{ "version": 3, "sources": ["../../node_modules/basiclightbox/dist/basicLightbox.min.js", "../../node_modules/sweetalert2/dist/sweetalert2.all.js", "../../node_modules/photoswipe/dist/photoswipe.js", "../../node_modules/photoswipe/dist/photoswipe-ui-default.js", "../../node_modules/exif-js/exif.js", "../../node_modules/sweetalert2/dist/sweetalert2.js", "../../node_modules/qr-scanner/node_modules/jsqr-es6/src/BitMatrix.ts", "../../node_modules/qr-scanner/node_modules/jsqr-es6/src/binarizer/index.ts", "../../node_modules/qr-scanner/node_modules/jsqr-es6/src/decoder/decodeData/BitStream.ts", "../../node_modules/qr-scanner/node_modules/jsqr-es6/src/decoder/decodeData/index.ts", "../../node_modules/qr-scanner/node_modules/jsqr-es6/src/decoder/reedsolomon/GenericGFPoly.ts", "../../node_modules/qr-scanner/node_modules/jsqr-es6/src/decoder/reedsolomon/GenericGF.ts", "../../node_modules/qr-scanner/node_modules/jsqr-es6/src/decoder/reedsolomon/index.ts", "../../node_modules/qr-scanner/node_modules/jsqr-es6/src/decoder/version.ts", "../../node_modules/qr-scanner/node_modules/jsqr-es6/src/decoder/decoder.ts", "../../node_modules/qr-scanner/node_modules/jsqr-es6/src/extractor/index.ts", "../../node_modules/qr-scanner/node_modules/jsqr-es6/src/locator/index.ts", "../../node_modules/qr-scanner/node_modules/jsqr-es6/src/index.ts", "../../node_modules/qr-scanner/src/worker.ts", "../../node_modules/qr-scanner/src/qr-scanner.ts", "../../node_modules/local-storage/stub.js", "../../node_modules/local-storage/parse.js", "../../node_modules/local-storage/tracking.js", "../../node_modules/local-storage/local-storage.js", "../../node_modules/mobile-detect/mobile-detect.js", "../../node_modules/ts-input-mask/dist/model/caret-string.js", "../../node_modules/ts-input-mask/dist/model/next.js", "../../node_modules/ts-input-mask/dist/model/notation.js", "../../node_modules/ts-input-mask/dist/util/isNull.js", "../../node_modules/ts-input-mask/dist/model/state.js", "../../node_modules/ts-input-mask/dist/model/state/e-o-l-state.js", "../../node_modules/ts-input-mask/dist/model/state/fixed-state.js", "../../node_modules/ts-input-mask/dist/model/state/free-state.js", "../../node_modules/ts-input-mask/dist/util/string.js", "../../node_modules/ts-input-mask/dist/model/state/optional-value-state.js", "../../node_modules/ts-input-mask/dist/model/state/value-state.js", "../../node_modules/ts-input-mask/dist/model/index.js", "../../node_modules/ts-input-mask/dist/helper/affinity-calculation-strategy.js", "../../node_modules/ts-input-mask/dist/helper/format-sanitizer.js", "../../node_modules/ts-input-mask/dist/helper/compiler.js", "../../node_modules/ts-input-mask/dist/helper/caret-string-iterator.js", "../../node_modules/ts-input-mask/dist/helper/mask.js", "../../node_modules/ts-input-mask/dist/helper/mask-affinity.js", "../../node_modules/ts-input-mask/dist/masked-text-changed-listener.js", "../../node_modules/ts-input-mask/dist/index.js", "../../node_modules/tslib/tslib.es6.mjs", "../../Typescript/Lib/Types/Map.ts", "../../Typescript/Lib/AxSystem/AxInit.ts", "../../Typescript/Lib/AxSystem/AxLoad.ts", "../../Typescript/Limestone/AxAlert/AxAlert.ts", "../../Typescript/Limestone/AxButton/AxButton.ts", "../../Typescript/Limestone/AxPortlet/AxPortletExpandable.ts", "../../Typescript/Limestone/AxPortlet/AxTab.ts", "../../Typescript/Limestone/AxLimeStone.ts", "../../node_modules/ssr-window/ssr-window.esm.js", "../../node_modules/dom7/dom7.esm.js", "../../node_modules/swiper/esm/utils/dom.js", "../../node_modules/swiper/esm/utils/utils.js", "../../node_modules/swiper/esm/utils/get-support.js", "../../node_modules/swiper/esm/utils/get-device.js", "../../node_modules/swiper/esm/utils/get-browser.js", "../../node_modules/swiper/esm/modules/resize/resize.js", "../../node_modules/swiper/esm/modules/observer/observer.js", "../../node_modules/swiper/esm/components/core/modular.js", "../../node_modules/swiper/esm/components/core/events-emitter.js", "../../node_modules/swiper/esm/components/core/update/updateSize.js", "../../node_modules/swiper/esm/components/core/update/updateSlides.js", "../../node_modules/swiper/esm/components/core/update/updateAutoHeight.js", "../../node_modules/swiper/esm/components/core/update/updateSlidesOffset.js", "../../node_modules/swiper/esm/components/core/update/updateSlidesProgress.js", "../../node_modules/swiper/esm/components/core/update/updateProgress.js", "../../node_modules/swiper/esm/components/core/update/updateSlidesClasses.js", "../../node_modules/swiper/esm/components/core/update/updateActiveIndex.js", "../../node_modules/swiper/esm/components/core/update/updateClickedSlide.js", "../../node_modules/swiper/esm/components/core/update/index.js", "../../node_modules/swiper/esm/components/core/translate/getTranslate.js", "../../node_modules/swiper/esm/components/core/translate/setTranslate.js", "../../node_modules/swiper/esm/components/core/translate/minTranslate.js", "../../node_modules/swiper/esm/components/core/translate/maxTranslate.js", "../../node_modules/swiper/esm/components/core/translate/translateTo.js", "../../node_modules/swiper/esm/components/core/translate/index.js", "../../node_modules/swiper/esm/components/core/transition/setTransition.js", "../../node_modules/swiper/esm/components/core/transition/transitionStart.js", "../../node_modules/swiper/esm/components/core/transition/transitionEnd.js", "../../node_modules/swiper/esm/components/core/transition/index.js", "../../node_modules/swiper/esm/components/core/slide/slideTo.js", "../../node_modules/swiper/esm/components/core/slide/slideToLoop.js", "../../node_modules/swiper/esm/components/core/slide/slideNext.js", "../../node_modules/swiper/esm/components/core/slide/slidePrev.js", "../../node_modules/swiper/esm/components/core/slide/slideReset.js", "../../node_modules/swiper/esm/components/core/slide/slideToClosest.js", "../../node_modules/swiper/esm/components/core/slide/slideToClickedSlide.js", "../../node_modules/swiper/esm/components/core/slide/index.js", "../../node_modules/swiper/esm/components/core/loop/loopCreate.js", "../../node_modules/swiper/esm/components/core/loop/loopFix.js", "../../node_modules/swiper/esm/components/core/loop/loopDestroy.js", "../../node_modules/swiper/esm/components/core/loop/index.js", "../../node_modules/swiper/esm/components/core/grab-cursor/setGrabCursor.js", "../../node_modules/swiper/esm/components/core/grab-cursor/unsetGrabCursor.js", "../../node_modules/swiper/esm/components/core/grab-cursor/index.js", "../../node_modules/swiper/esm/components/core/manipulation/appendSlide.js", "../../node_modules/swiper/esm/components/core/manipulation/prependSlide.js", "../../node_modules/swiper/esm/components/core/manipulation/addSlide.js", "../../node_modules/swiper/esm/components/core/manipulation/removeSlide.js", "../../node_modules/swiper/esm/components/core/manipulation/removeAllSlides.js", "../../node_modules/swiper/esm/components/core/manipulation/index.js", "../../node_modules/swiper/esm/components/core/events/onTouchStart.js", "../../node_modules/swiper/esm/components/core/events/onTouchMove.js", "../../node_modules/swiper/esm/components/core/events/onTouchEnd.js", "../../node_modules/swiper/esm/components/core/events/onResize.js", "../../node_modules/swiper/esm/components/core/events/onClick.js", "../../node_modules/swiper/esm/components/core/events/onScroll.js", "../../node_modules/swiper/esm/components/core/events/index.js", "../../node_modules/swiper/esm/components/core/breakpoints/setBreakpoint.js", "../../node_modules/swiper/esm/components/core/breakpoints/getBreakpoint.js", "../../node_modules/swiper/esm/components/core/breakpoints/index.js", "../../node_modules/swiper/esm/components/core/classes/addClasses.js", "../../node_modules/swiper/esm/components/core/classes/removeClasses.js", "../../node_modules/swiper/esm/components/core/classes/index.js", "../../node_modules/swiper/esm/components/core/images/loadImage.js", "../../node_modules/swiper/esm/components/core/images/preloadImages.js", "../../node_modules/swiper/esm/components/core/images/index.js", "../../node_modules/swiper/esm/components/core/check-overflow/index.js", "../../node_modules/swiper/esm/components/core/defaults.js", "../../node_modules/swiper/esm/components/core/core-class.js", "../../node_modules/swiper/esm/components/navigation/navigation.js", "../../node_modules/swiper/esm/components/pagination/pagination.js", "../../Typescript/Modules/AxProdSelection/AxProdDetail.ts", "../../node_modules/@glidejs/glide/dist/glide.esm.js", "../../Typescript/Modules/AxProdSelection/AxProdMain.ts", "../../Typescript/Lib/Mapper/ProductMapper.ts", "../../Typescript/Lib/Helper/I18nHelper.ts", "../../Typescript/Limestone/AxProgressBar/AxProgressBar.ts", "../../Typescript/Modules/Global/Progressbar.ts", "../../node_modules/i18next/dist/esm/i18next.js", "../../node_modules/@axess/limestone/build/js/i18n/en.json", "../../node_modules/@axess/limestone/build/js/ts/i18n.js", "../../node_modules/@axess/limestone/build/js/ts/lib/JQElementHelper.js", "../../node_modules/@axess/limestone/build/js/ts/AxDropdown/lib/AxDropdownInteraction.js", "../../node_modules/rxjs/src/internal/util/isFunction.ts", "../../node_modules/rxjs/src/internal/util/createErrorClass.ts", "../../node_modules/rxjs/src/internal/util/UnsubscriptionError.ts", "../../node_modules/rxjs/src/internal/util/arrRemove.ts", "../../node_modules/rxjs/src/internal/Subscription.ts", "../../node_modules/rxjs/src/internal/config.ts", "../../node_modules/rxjs/src/internal/scheduler/timeoutProvider.ts", "../../node_modules/rxjs/src/internal/util/reportUnhandledError.ts", "../../node_modules/rxjs/src/internal/util/noop.ts", "../../node_modules/rxjs/src/internal/NotificationFactories.ts", "../../node_modules/rxjs/src/internal/util/errorContext.ts", "../../node_modules/rxjs/src/internal/Subscriber.ts", "../../node_modules/rxjs/src/internal/symbol/observable.ts", "../../node_modules/rxjs/src/internal/util/identity.ts", "../../node_modules/rxjs/src/internal/util/pipe.ts", "../../node_modules/rxjs/src/internal/Observable.ts", "../../node_modules/rxjs/src/internal/util/lift.ts", "../../node_modules/rxjs/src/internal/operators/OperatorSubscriber.ts", "../../node_modules/rxjs/src/internal/util/ObjectUnsubscribedError.ts", "../../node_modules/rxjs/src/internal/Subject.ts", "../../node_modules/rxjs/src/internal/BehaviorSubject.ts", "../../node_modules/rxjs/src/internal/scheduler/dateTimestampProvider.ts", "../../node_modules/rxjs/src/internal/scheduler/Action.ts", "../../node_modules/rxjs/src/internal/scheduler/intervalProvider.ts", "../../node_modules/rxjs/src/internal/scheduler/AsyncAction.ts", "../../node_modules/rxjs/src/internal/Scheduler.ts", "../../node_modules/rxjs/src/internal/scheduler/AsyncScheduler.ts", "../../node_modules/rxjs/src/internal/scheduler/async.ts", "../../node_modules/rxjs/src/internal/util/isArrayLike.ts", "../../node_modules/rxjs/src/internal/util/isPromise.ts", "../../node_modules/rxjs/src/internal/util/isInteropObservable.ts", "../../node_modules/rxjs/src/internal/util/isAsyncIterable.ts", "../../node_modules/rxjs/src/internal/util/throwUnobservableError.ts", "../../node_modules/rxjs/src/internal/symbol/iterator.ts", "../../node_modules/rxjs/src/internal/util/isIterable.ts", "../../node_modules/rxjs/src/internal/util/isReadableStreamLike.ts", "../../node_modules/rxjs/src/internal/observable/innerFrom.ts", "../../node_modules/rxjs/src/internal/util/executeSchedule.ts", "../../node_modules/rxjs/src/internal/operators/map.ts", "../../node_modules/rxjs/src/internal/util/mapOneOrManyArgs.ts", "../../node_modules/rxjs/src/internal/operators/mergeInternals.ts", "../../node_modules/rxjs/src/internal/operators/mergeMap.ts", "../../node_modules/rxjs/src/internal/observable/fromEvent.ts", "../../node_modules/rxjs/src/internal/operators/debounceTime.ts", "../../node_modules/@popperjs/core/lib/enums.js", "../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js", "../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js", "../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js", "../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js", "../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js", "../../node_modules/@popperjs/core/lib/utils/math.js", "../../node_modules/@popperjs/core/lib/utils/userAgent.js", "../../node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js", "../../node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js", "../../node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js", "../../node_modules/@popperjs/core/lib/dom-utils/contains.js", "../../node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js", "../../node_modules/@popperjs/core/lib/dom-utils/isTableElement.js", "../../node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js", "../../node_modules/@popperjs/core/lib/dom-utils/getParentNode.js", "../../node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js", "../../node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js", "../../node_modules/@popperjs/core/lib/utils/within.js", "../../node_modules/@popperjs/core/lib/utils/getFreshSideObject.js", "../../node_modules/@popperjs/core/lib/utils/mergePaddingObject.js", "../../node_modules/@popperjs/core/lib/utils/expandToHashMap.js", "../../node_modules/@popperjs/core/lib/modifiers/arrow.js", "../../node_modules/@popperjs/core/lib/utils/getVariation.js", "../../node_modules/@popperjs/core/lib/modifiers/computeStyles.js", "../../node_modules/@popperjs/core/lib/modifiers/eventListeners.js", "../../node_modules/@popperjs/core/lib/utils/getOppositePlacement.js", "../../node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js", "../../node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js", "../../node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js", "../../node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js", "../../node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js", "../../node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js", "../../node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js", "../../node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js", "../../node_modules/@popperjs/core/lib/utils/rectToClientRect.js", "../../node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js", "../../node_modules/@popperjs/core/lib/utils/computeOffsets.js", "../../node_modules/@popperjs/core/lib/utils/detectOverflow.js", "../../node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js", "../../node_modules/@popperjs/core/lib/modifiers/flip.js", "../../node_modules/@popperjs/core/lib/modifiers/hide.js", "../../node_modules/@popperjs/core/lib/modifiers/offset.js", "../../node_modules/@popperjs/core/lib/modifiers/popperOffsets.js", "../../node_modules/@popperjs/core/lib/utils/getAltAxis.js", "../../node_modules/@popperjs/core/lib/modifiers/preventOverflow.js", "../../node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js", "../../node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js", "../../node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js", "../../node_modules/@popperjs/core/lib/utils/orderModifiers.js", "../../node_modules/@popperjs/core/lib/utils/debounce.js", "../../node_modules/@popperjs/core/lib/utils/mergeByName.js", "../../node_modules/@popperjs/core/lib/createPopper.js", "../../node_modules/@popperjs/core/lib/popper.js", "../../node_modules/tippy.js/src/constants.ts", "../../node_modules/tippy.js/src/utils.ts", "../../node_modules/tippy.js/src/dom-utils.ts", "../../node_modules/tippy.js/src/bindGlobalEventListeners.ts", "../../node_modules/tippy.js/src/browser.ts", "../../node_modules/tippy.js/src/validation.ts", "../../node_modules/tippy.js/src/props.ts", "../../node_modules/tippy.js/src/template.ts", "../../node_modules/tippy.js/src/createTippy.ts", "../../node_modules/tippy.js/src/index.ts", "../../node_modules/tippy.js/src/addons/createSingleton.ts", "../../node_modules/tippy.js/src/addons/delegate.ts", "../../node_modules/tippy.js/src/plugins/animateFill.ts", "../../node_modules/tippy.js/src/plugins/followCursor.ts", "../../node_modules/tippy.js/src/plugins/inlinePositioning.ts", "../../node_modules/tippy.js/src/plugins/sticky.ts", "../../node_modules/tippy.js/build/base.js", "../../node_modules/@axess/limestone/build/js/ts/AxDropdown/lib/AxDropdownEvents.js", "../../node_modules/@axess/limestone/build/js/ts/AxDropdown/AxDropdown.js", "../../node_modules/@axess/limestone/build/js/ts/AxInput/Helper/InputIconHelper.js", "../../node_modules/@axess/limestone/build/js/ts/AxInput/Helper/InputEventHelper.js", "../../node_modules/@axess/limestone/build/js/ts/AxInput/AxInput.js", "../../node_modules/@axess/limestone/build/js/ts/AxFormValidation/AxFormValidation.js", "../../node_modules/@axess/limestone/build/js/ts/AxModal/AxModal.js", "../../Typescript/Limestone/AxCounter/AxCounter.ts", "../../Typescript/Components/AxUtility/BodyUtility.ts", "../../Typescript/Modules/Packages/PackageMinMaxConstraint.ts", "../../Typescript/Lib/Enums/LoadingSpinnerPositionEnum.ts", "../../Typescript/Lib/Helper/RandomHelper.ts", "../../Typescript/Limestone/AxLoading/AxLoading.ts", "../../Typescript/Models/BestMatch/ProductCalcModel.ts", "../../Typescript/Components/BestMatch/BestMatchHandler.ts", "../../Typescript/Components/ProductList/TicketList.ts", "../../Typescript/Lib/Helper/RequestHelper.ts", "../../Typescript/Lib/Helper/AxProdSelection/SummaryRedirect.ts", "../../Typescript/Modules/AxProdSelection/Abstraction/NonPreDateable.ts", "../../Typescript/Modules/AxProdSelection/Packages/AxPackNonPredateable.ts", "../../Typescript/Components/AxDatepicker/InteractionHelper.ts", "../../Typescript/Components/AxDatepicker/EventHelper.ts", "../../Typescript/Components/AxDatepicker/RenderHelper.ts", "../../Typescript/Components/AxDatepicker/AxDatepicker.ts", "../../Typescript/Modules/AxProdSelection/Abstraction/PreDateable.ts", "../../Typescript/Modules/AxProdSelection/Packages/AxPackPredateable.ts", "../../Typescript/Modules/AxProdSelection/Tickets/AxProdNonPredateable.ts", "../../Typescript/Modules/AxProdSelection/Tickets/AxProdPredateable.ts", "../../Typescript/Models/Tickets/Product.ts", "../../Typescript/Modules/AxProdSelection/AxProdSelection.ts", "../../Typescript/Components/AxCalendar/AxCalendar.ts", "../../Typescript/Components/AxScrollspy/AxScrollspy.ts", "../../Typescript/Modules/AxProdSelection/Abstraction/SubCCalendar.ts", "../../Typescript/Modules/AxProdSelection/Tickets/AxProdSelectionCalendar.ts", "../../Typescript/Components/AxSlide/AxSlide.ts", "../../Typescript/Models/Reservation/TimeSlotKey.ts", "../../Typescript/Lib/Helper/Config/ConfigHelper.ts", "../../Typescript/Lib/Helper/DateHelper.ts", "../../Typescript/Modules/AxProdSelection/Abstraction/AxBooking.ts", "../../Typescript/Models/Reservation/TimeSlotKeyDto.ts", "../../Typescript/Modules/AxProdSelection/Tickets/AxProdBooking.ts", "../../Typescript/Modules/AxProdSelection/AxProdSummary.ts", "../../Typescript/Modules/Global/AxTopBar.ts", "../../Typescript/Utility/AxMain.ts", "../../Typescript/Modules/AxProdSelection/Packages/AxPackSelectionCalendar.ts", "../../Typescript/Modules/B2B/B2bMode.ts", "../../Typescript/Modules/ShoppingCart/ShoppingCart.ts", "../../Typescript/Lib/Constants/ProductTypeConstant.ts", "../../Typescript/Lib/Helper/ArrayHelper.ts", "../../Typescript/Lib/Helper/CookieHelper.ts", "../../Typescript/Modules/AxProdSelection/Packages/AxPackBooking.ts", "../../Typescript/Modules/Reservations/TimeSlots.ts", "../../Typescript/Limestone/AxMessage/AxAlertBanner.ts", "../../Typescript/Modules/Reservations/Reserved.ts", "../../Typescript/Modules/Categories/CategoryFilter.ts", "../../Typescript/Modules/Global/SubmenuAim.ts", "../../Typescript/Modules/Retail/RetailDetail.ts", "../../Typescript/Lib/Helper/AssetHelper.ts", "../../Typescript/Lib/Helper/ColorHelper.ts", "../../Typescript/Lib/Constants/KeyCollection/LocalStorageKeyCollection.ts", "../../Typescript/Lib/Helper/Retail/RetailHelper.ts", "../../Typescript/Modules/Retail/RetailMain.ts", "../../Typescript/Modules/Shipping/Shipping.ts", "../../Typescript/Models/Shipping/CustomerShippingInfo.ts", "../../Typescript/Modules/Retail/RetailFilter.ts", "../../Typescript/Modules/Profile/OrderHistory.ts", "../../Typescript/Modules/Global/AxBirthDateInputTriple.ts", "../../Typescript/Components/AxInput/AxCounterWithInput.ts", "../../Typescript/Modules/GiftCard/ProgressbarGiftCards.ts", "../../Typescript/Modules/GiftCard/MainGiftCards.ts", "../../Typescript/Modules/GiftCard/PersonalizeGiftCard.ts", "../../Typescript/Lib/Helper/PriceHelper.ts", "../../Typescript/Modules/Profile/PasswordValidation.ts", "../../Typescript/Modules/Profile/MyFamily.ts", "../../Typescript/Modules/Account/AccountRentalData.ts", "../../Typescript/Modules/Account/CustomerLessonProperties.ts", "../../Typescript/Lib/Helper/InputMaskHelper.ts", "../../Typescript/Modules/Reservations/SeasonCardBooking.ts", "../../Typescript/Components/AxForm/AxCheck.ts", "../../Typescript/Modules/ComplexPackages/ComplexPackageFilter.ts", "../../Typescript/Modules/ComplexPackages/ComplexPackageSelection.ts", "../../Typescript/Modules/ComplexPackages/ComplexPackageDetails.ts", "../../Typescript/Modules/ComplexPackages/ComplexPackageBookingOptions.ts", "../../Typescript/Models/ComplexPackages/BookingOptions/CompPackBookingValues.ts", "../../Typescript/Models/ComplexPackages/BookingOptions/CompPackOrderTicketValues.ts", "../../Typescript/Modules/ComplexPackages/BookingOptions/ComplexPackageBookingTicketsOptions.ts", "../../Typescript/Models/ComplexPackages/BookingOptions/CompPackOrderLessonProgramValues.ts", "../../Typescript/Modules/ComplexPackages/BookingOptions/CompPackBookingLessonProgramOptions.ts", "../../Typescript/Modules/ComplexPackages/BookingOptions/CompPackBookingPersonOptions.ts", "../../Typescript/Models/ComplexPackages/BookingOptions/CompPackOrderRentalValues.ts", "../../Typescript/Modules/ComplexPackages/BookingOptions/CompPackBookingRentalOptions.ts", "../../Typescript/Models/ComplexPackages/BookingOptions/CompPackOrderLessonValues.ts", "../../Typescript/Modules/ComplexPackages/BookingOptions/CompPackBookingLessonOptions.ts", "../../Typescript/Modules/Redirect/Redirect.ts", "../../Typescript/Modules/ComplexPackages/ComplexPackageSearchBar.ts", "../../Typescript/Modules/Lessons/LessonsLoadingSpinner.ts", "../../Typescript/Modules/Payment/Eguma.ts", "../../Typescript/Modules/ShoppingCart/ShoppingCartPersonalisation.ts", "../../Typescript/Modules/ShoppingCart/ShoppingCartReservationTimer.ts", "../../Typescript/Modules/B2B/B2BHistory.ts", "../../Typescript/Modules/ShoppingCart/ShoppingCartEntryRetail.ts", "../../Typescript/Modules/FindMyTicket/FindMyTicket.ts", "../../Typescript/Lib/Helper/wtpScanner.ts", "../../Typescript/Modules/Profile/MyChipCards.ts", "../../Typescript/Modules/Global/UtilityInit.ts", "../../Typescript/Components/AxFireShoppingCartModal/AxFireShoppingCartModal.ts", "../../Typescript/Modules/AxConfig/AxStaticConfigModule.ts", "../../Typescript/Modules/AxGA4/AxGA4Module.ts", "../../Typescript/Modules/ErrorHandling/ServerErrorPopUp.ts", "../../Typescript/Modules/Payment/VoucherPayment.ts", "../../Typescript/Modules/NewsLetterSubscription/Unsubscribe.ts", "../../Typescript/Modules/Global/Banner.ts", "../../Typescript/Modules/Hero/HeroModule.ts", "../../Typescript/Modules/Payment/Payment.ts", "../../Typescript/Service/Account/AccountStorageService.ts", "../../Typescript/Modules/Account/Registration.ts", "../../Typescript/Modules/Account/RegisterForm.ts", "../../Typescript/Modules/ProfileSettings/PersonalData.ts", "../../Typescript/Modules/NewsLetterSubscription/Resubscribe.ts", "../../Typescript/Modules/Account/MissingMandatoryData.ts", "../../Typescript/Modules/MaintenanceMode/MaintenanceScriptInfo.ts", "../../Typescript/Modules/Rental/RentalMain.ts", "../../Typescript/Modules/Rental/Helper/RentalFilterResetHelper.ts", "../../Typescript/Modules/Rental/Components/RentalFilterPriceSlider.ts", "../../Typescript/Modules/Rental/RentalFilter.ts", "../../Typescript/Modules/Global/LocalizationModule.ts", "../../Typescript/Modules/Ble/BleQrCodes.ts", "../../Typescript/Modules/ShoppingCart/ShoppingCartDateInputTriple.ts", "../../Typescript/Models/Rental/Details/RentalProdSelectionTimings.ts", "../../Typescript/Modules/Rental/ProductDetails/Components/RentDetailsProdSelectTimings.ts", "../../Typescript/Modules/Rental/Components/RentalDetailLightbox.ts", "../../Typescript/Modules/Rental/ProductDetails/Services/RentDetailsProdSelectionAbstract.ts", "../../Typescript/Models/Rental/Details/RentDetailsSingleItemSelectionSection.ts", "../../Typescript/Modules/Rental/ProductDetails/Services/RentDetailsProdSelectSingleItemHandler.ts", "../../Typescript/Models/Rental/Details/RentalDetailsPackOptionSelectionItem.ts", "../../Typescript/Modules/Rental/ProductDetails/Components/RentDetailsProdOptItemSelectSection.ts", "../../Typescript/Modules/Rental/ProductDetails/Components/RentDetailsPackItemSelectionSection.ts", "../../Typescript/Modules/Rental/ProductDetails/Services/RentDetailsProdSelectPackHandler.ts", "../../Typescript/Modules/Rental/ProductDetails/Services/RentDetailsProdSelectCompManager.ts", "../../Typescript/Modules/Rental/ProductDetails/RentalProductDetails.ts", "../../Typescript/Modules/Global/DateModule.ts", "../../Typescript/Modules/Rental/RentalShopDetails.ts", "../../Typescript/Modules/Rental/RiderDetails/RiderDetailsModule.ts", "../../node_modules/alpinejs/dist/module.esm.js", "../../Typescript/Modules/Rental/Services/ProductAndRiderDetailsService.ts", "../../Typescript/Models/Rental/RentalAllowedStatus.ts", "../../Typescript/Modules/Rental/Services/CheckAllowedRentalIItemsService.ts", "../../Typescript/Modules/Rental/RiderDetails/Components/RiderSelection.ts", "../../Typescript/Modules/Rental/RiderDetails/Components/ProductInfoPortlet.ts", "../../Typescript/Modules/Rental/RiderDetails/Components/LockerData.ts", "../../Typescript/Models/Rental/RiderDetails/RiderData.ts", "../../Typescript/Modules/Rental/RiderDetails/RiderDetailsModelBundle.ts", "../../Typescript/Modules/Rental/RiderDetails/Components/PersonDataForm.ts", "../../Typescript/Components/AxForm/DropDownComponent.ts", "../../Typescript/Dto/Rental/Properties/Request/WtpRentalPropertyRequestData.ts", "../../Typescript/Dto/Rental/Properties/Result/GetRentalPropertiesResultDto.ts", "../../Typescript/Modules/Rental/RiderDetails/Components/RentalPropertiesSelection.ts", "../../Typescript/Modules/Rental/RiderDetails/RiderDetailsCompBundle.ts", "../../Typescript/Modules/LessonPackages/LessonFilter.ts", "../../Typescript/Modules/LessonPackages/LandingPage.ts", "../../Typescript/Utility/AxFilterOverlay.ts", "../../Typescript/Modules/LessonPackages/SelectionAddSlot.ts", "../../Typescript/Modules/LessonPackages/Selection.ts", "../../Typescript/Modules/LessonPackages/Personalization.ts", "../../Typescript/Modules/LessonPackages/Components/PersonDataForm.ts", "../../Typescript/Modules/LessonPackages/LessonPackageStorage.ts", "../../Typescript/Modules/ShoppingCart/ToCheckout.ts", "../../Typescript/Modules/ShoppingCart/PopUpShoppingCart.ts", "../../node_modules/@microsoft/signalr/src/Errors.ts", "../../node_modules/@microsoft/signalr/src/HttpClient.ts", "../../node_modules/@microsoft/signalr/src/ILogger.ts", "../../node_modules/@microsoft/signalr/src/Loggers.ts", "../../node_modules/@microsoft/signalr/src/Utils.ts", "../../node_modules/@microsoft/signalr/src/FetchHttpClient.ts", "../../node_modules/@microsoft/signalr/src/XhrHttpClient.ts", "../../node_modules/@microsoft/signalr/src/DefaultHttpClient.ts", "../../node_modules/@microsoft/signalr/src/TextMessageFormat.ts", "../../node_modules/@microsoft/signalr/src/HandshakeProtocol.ts", "../../node_modules/@microsoft/signalr/src/IHubProtocol.ts", "../../node_modules/@microsoft/signalr/src/Subject.ts", "../../node_modules/@microsoft/signalr/src/MessageBuffer.ts", "../../node_modules/@microsoft/signalr/src/HubConnection.ts", "../../node_modules/@microsoft/signalr/src/DefaultReconnectPolicy.ts", "../../node_modules/@microsoft/signalr/src/HeaderNames.ts", "../../node_modules/@microsoft/signalr/src/AccessTokenHttpClient.ts", "../../node_modules/@microsoft/signalr/src/ITransport.ts", "../../node_modules/@microsoft/signalr/src/AbortController.ts", "../../node_modules/@microsoft/signalr/src/LongPollingTransport.ts", "../../node_modules/@microsoft/signalr/src/ServerSentEventsTransport.ts", "../../node_modules/@microsoft/signalr/src/WebSocketTransport.ts", "../../node_modules/@microsoft/signalr/src/HttpConnection.ts", "../../node_modules/@microsoft/signalr/src/JsonHubProtocol.ts", "../../node_modules/@microsoft/signalr/src/HubConnectionBuilder.ts", "../../Typescript/Modules/ShoppingCart/OneRiskNotification.ts", "../../Typescript/Modules/OneRisk/OneRisk.ts", "../../Typescript/Modules/Lessons/LessonBuyerInfoModule.ts", "../../Typescript/Modules/ConsentDocuments/ConsentDocuments.ts", "../../Typescript/Modules/AxProdSelection/QuickSelection/QuantitySelection.ts", "../../Typescript/Modules/AxProdSelection/LandingQuickSelection.ts", "../../Typescript/App.ts"], "sourcesContent": ["!function(e){if(\"object\"==typeof exports&&\"undefined\"!=typeof module)module.exports=e();else if(\"function\"==typeof define&&define.amd)define([],e);else{(\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:this).basicLightbox=e()}}((function(){return function e(n,t,o){function r(c,u){if(!t[c]){if(!n[c]){var s=\"function\"==typeof require&&require;if(!u&&s)return s(c,!0);if(i)return i(c,!0);var a=new Error(\"Cannot find module '\"+c+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var l=t[c]={exports:{}};n[c][0].call(l.exports,(function(e){return r(n[c][1][e]||e)}),l,l.exports,e,n,t,o)}return t[c].exports}for(var i=\"function\"==typeof require&&require,c=0;c1&&void 0!==arguments[1]&&arguments[1],t=document.createElement(\"div\");return t.innerHTML=e.trim(),!0===n?t.children:t.firstChild},r=function(e,n){var t=e.children;return 1===t.length&&t[0].tagName===n},i=function(e){return null!=(e=e||document.querySelector(\".basicLightbox\"))&&!0===e.ownerDocument.body.contains(e)};t.visible=i;t.create=function(e,n){var t=function(e,n){var t=o('\\n\\t\\t
\\n\\t\\t\\t
\\n\\t\\t
\\n\\t')),i=t.querySelector(\".basicLightbox__placeholder\");e.forEach((function(e){return i.appendChild(e)}));var c=r(i,\"IMG\"),u=r(i,\"VIDEO\"),s=r(i,\"IFRAME\");return!0===c&&t.classList.add(\"basicLightbox--img\"),!0===u&&t.classList.add(\"basicLightbox--video\"),!0===s&&t.classList.add(\"basicLightbox--iframe\"),t}(e=function(e){var n=\"string\"==typeof e,t=e instanceof HTMLElement==1;if(!1===n&&!1===t)throw new Error(\"Content must be a DOM element/node or string\");return!0===n?Array.from(o(e,!0)):\"TEMPLATE\"===e.tagName?[e.content.cloneNode(!0)]:Array.from(e.children)}(e),n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(null==(e=Object.assign({},e)).closable&&(e.closable=!0),null==e.className&&(e.className=\"\"),null==e.onShow&&(e.onShow=function(){}),null==e.onClose&&(e.onClose=function(){}),\"boolean\"!=typeof e.closable)throw new Error(\"Property `closable` must be a boolean\");if(\"string\"!=typeof e.className)throw new Error(\"Property `className` must be a string\");if(\"function\"!=typeof e.onShow)throw new Error(\"Property `onShow` must be a function\");if(\"function\"!=typeof e.onClose)throw new Error(\"Property `onClose` must be a function\");return e}(n)),c=function(e){return!1!==n.onClose(u)&&function(e,n){return e.classList.remove(\"basicLightbox--visible\"),setTimeout((function(){return!1===i(e)||e.parentElement.removeChild(e),n()}),410),!0}(t,(function(){if(\"function\"==typeof e)return e(u)}))};!0===n.closable&&t.addEventListener(\"click\",(function(e){e.target===t&&c()}));var u={element:function(){return t},visible:function(){return i(t)},show:function(e){return!1!==n.onShow(u)&&function(e,n){return document.body.appendChild(e),setTimeout((function(){requestAnimationFrame((function(){return e.classList.add(\"basicLightbox--visible\"),n()}))}),10),!0}(t,(function(){if(\"function\"==typeof e)return e(u)}))},close:c};return u}},{}]},{},[1])(1)}));", "/*!\n* sweetalert2 v11.4.8\n* Released under the MIT License.\n*/\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = global || self, global.Sweetalert2 = factory());\n}(this, function () { 'use strict';\n\n const consolePrefix = 'SweetAlert2:';\n /**\n * Filter the unique values into a new array\n * @param arr\n */\n\n const uniqueArray = arr => {\n const result = [];\n\n for (let i = 0; i < arr.length; i++) {\n if (result.indexOf(arr[i]) === -1) {\n result.push(arr[i]);\n }\n }\n\n return result;\n };\n /**\n * Capitalize the first letter of a string\n * @param {string} str\n * @returns {string}\n */\n\n const capitalizeFirstLetter = str => str.charAt(0).toUpperCase() + str.slice(1);\n /**\n * @param {NodeList | HTMLCollection | NamedNodeMap} nodeList\n * @returns {array}\n */\n\n const toArray = nodeList => Array.prototype.slice.call(nodeList);\n /**\n * Standardize console warnings\n * @param {string | array} message\n */\n\n const warn = message => {\n console.warn(\"\".concat(consolePrefix, \" \").concat(typeof message === 'object' ? message.join(' ') : message));\n };\n /**\n * Standardize console errors\n * @param {string} message\n */\n\n const error = message => {\n console.error(\"\".concat(consolePrefix, \" \").concat(message));\n };\n /**\n * Private global state for `warnOnce`\n * @type {Array}\n * @private\n */\n\n const previousWarnOnceMessages = [];\n /**\n * Show a console warning, but only if it hasn't already been shown\n * @param {string} message\n */\n\n const warnOnce = message => {\n if (!previousWarnOnceMessages.includes(message)) {\n previousWarnOnceMessages.push(message);\n warn(message);\n }\n };\n /**\n * Show a one-time console warning about deprecated params/methods\n */\n\n const warnAboutDeprecation = (deprecatedParam, useInstead) => {\n warnOnce(\"\\\"\".concat(deprecatedParam, \"\\\" is deprecated and will be removed in the next major release. Please use \\\"\").concat(useInstead, \"\\\" instead.\"));\n };\n /**\n * If `arg` is a function, call it (with no arguments or context) and return the result.\n * Otherwise, just pass the value through\n * @param arg\n */\n\n const callIfFunction = arg => typeof arg === 'function' ? arg() : arg;\n const hasToPromiseFn = arg => arg && typeof arg.toPromise === 'function';\n const asPromise = arg => hasToPromiseFn(arg) ? arg.toPromise() : Promise.resolve(arg);\n const isPromise = arg => arg && Promise.resolve(arg) === arg;\n\n const defaultParams = {\n title: '',\n titleText: '',\n text: '',\n html: '',\n footer: '',\n icon: undefined,\n iconColor: undefined,\n iconHtml: undefined,\n template: undefined,\n toast: false,\n showClass: {\n popup: 'swal2-show',\n backdrop: 'swal2-backdrop-show',\n icon: 'swal2-icon-show'\n },\n hideClass: {\n popup: 'swal2-hide',\n backdrop: 'swal2-backdrop-hide',\n icon: 'swal2-icon-hide'\n },\n customClass: {},\n target: 'body',\n color: undefined,\n backdrop: true,\n heightAuto: true,\n allowOutsideClick: true,\n allowEscapeKey: true,\n allowEnterKey: true,\n stopKeydownPropagation: true,\n keydownListenerCapture: false,\n showConfirmButton: true,\n showDenyButton: false,\n showCancelButton: false,\n preConfirm: undefined,\n preDeny: undefined,\n confirmButtonText: 'OK',\n confirmButtonAriaLabel: '',\n confirmButtonColor: undefined,\n denyButtonText: 'No',\n denyButtonAriaLabel: '',\n denyButtonColor: undefined,\n cancelButtonText: 'Cancel',\n cancelButtonAriaLabel: '',\n cancelButtonColor: undefined,\n buttonsStyling: true,\n reverseButtons: false,\n focusConfirm: true,\n focusDeny: false,\n focusCancel: false,\n returnFocus: true,\n showCloseButton: false,\n closeButtonHtml: '×',\n closeButtonAriaLabel: 'Close this dialog',\n loaderHtml: '',\n showLoaderOnConfirm: false,\n showLoaderOnDeny: false,\n imageUrl: undefined,\n imageWidth: undefined,\n imageHeight: undefined,\n imageAlt: '',\n timer: undefined,\n timerProgressBar: false,\n width: undefined,\n padding: undefined,\n background: undefined,\n input: undefined,\n inputPlaceholder: '',\n inputLabel: '',\n inputValue: '',\n inputOptions: {},\n inputAutoTrim: true,\n inputAttributes: {},\n inputValidator: undefined,\n returnInputValueOnDeny: false,\n validationMessage: undefined,\n grow: false,\n position: 'center',\n progressSteps: [],\n currentProgressStep: undefined,\n progressStepsDistance: undefined,\n willOpen: undefined,\n didOpen: undefined,\n didRender: undefined,\n willClose: undefined,\n didClose: undefined,\n didDestroy: undefined,\n scrollbarPadding: true\n };\n const updatableParams = ['allowEscapeKey', 'allowOutsideClick', 'background', 'buttonsStyling', 'cancelButtonAriaLabel', 'cancelButtonColor', 'cancelButtonText', 'closeButtonAriaLabel', 'closeButtonHtml', 'color', 'confirmButtonAriaLabel', 'confirmButtonColor', 'confirmButtonText', 'currentProgressStep', 'customClass', 'denyButtonAriaLabel', 'denyButtonColor', 'denyButtonText', 'didClose', 'didDestroy', 'footer', 'hideClass', 'html', 'icon', 'iconColor', 'iconHtml', 'imageAlt', 'imageHeight', 'imageUrl', 'imageWidth', 'preConfirm', 'preDeny', 'progressSteps', 'returnFocus', 'reverseButtons', 'showCancelButton', 'showCloseButton', 'showConfirmButton', 'showDenyButton', 'text', 'title', 'titleText', 'willClose'];\n const deprecatedParams = {};\n const toastIncompatibleParams = ['allowOutsideClick', 'allowEnterKey', 'backdrop', 'focusConfirm', 'focusDeny', 'focusCancel', 'returnFocus', 'heightAuto', 'keydownListenerCapture'];\n /**\n * Is valid parameter\n * @param {string} paramName\n */\n\n const isValidParameter = paramName => {\n return Object.prototype.hasOwnProperty.call(defaultParams, paramName);\n };\n /**\n * Is valid parameter for Swal.update() method\n * @param {string} paramName\n */\n\n const isUpdatableParameter = paramName => {\n return updatableParams.indexOf(paramName) !== -1;\n };\n /**\n * Is deprecated parameter\n * @param {string} paramName\n */\n\n const isDeprecatedParameter = paramName => {\n return deprecatedParams[paramName];\n };\n\n const checkIfParamIsValid = param => {\n if (!isValidParameter(param)) {\n warn(\"Unknown parameter \\\"\".concat(param, \"\\\"\"));\n }\n };\n\n const checkIfToastParamIsValid = param => {\n if (toastIncompatibleParams.includes(param)) {\n warn(\"The parameter \\\"\".concat(param, \"\\\" is incompatible with toasts\"));\n }\n };\n\n const checkIfParamIsDeprecated = param => {\n if (isDeprecatedParameter(param)) {\n warnAboutDeprecation(param, isDeprecatedParameter(param));\n }\n };\n /**\n * Show relevant warnings for given params\n *\n * @param params\n */\n\n\n const showWarningsForParams = params => {\n if (!params.backdrop && params.allowOutsideClick) {\n warn('\"allowOutsideClick\" parameter requires `backdrop` parameter to be set to `true`');\n }\n\n for (const param in params) {\n checkIfParamIsValid(param);\n\n if (params.toast) {\n checkIfToastParamIsValid(param);\n }\n\n checkIfParamIsDeprecated(param);\n }\n };\n\n const swalPrefix = 'swal2-';\n const prefix = items => {\n const result = {};\n\n for (const i in items) {\n result[items[i]] = swalPrefix + items[i];\n }\n\n return result;\n };\n const swalClasses = prefix(['container', 'shown', 'height-auto', 'iosfix', 'popup', 'modal', 'no-backdrop', 'no-transition', 'toast', 'toast-shown', 'show', 'hide', 'close', 'title', 'html-container', 'actions', 'confirm', 'deny', 'cancel', 'default-outline', 'footer', 'icon', 'icon-content', 'image', 'input', 'file', 'range', 'select', 'radio', 'checkbox', 'label', 'textarea', 'inputerror', 'input-label', 'validation-message', 'progress-steps', 'active-progress-step', 'progress-step', 'progress-step-line', 'loader', 'loading', 'styled', 'top', 'top-start', 'top-end', 'top-left', 'top-right', 'center', 'center-start', 'center-end', 'center-left', 'center-right', 'bottom', 'bottom-start', 'bottom-end', 'bottom-left', 'bottom-right', 'grow-row', 'grow-column', 'grow-fullscreen', 'rtl', 'timer-progress-bar', 'timer-progress-bar-container', 'scrollbar-measure', 'icon-success', 'icon-warning', 'icon-info', 'icon-question', 'icon-error']);\n const iconTypes = prefix(['success', 'warning', 'info', 'question', 'error']);\n\n /**\n * Gets the popup container which contains the backdrop and the popup itself.\n *\n * @returns {HTMLElement | null}\n */\n\n const getContainer = () => document.body.querySelector(\".\".concat(swalClasses.container));\n const elementBySelector = selectorString => {\n const container = getContainer();\n return container ? container.querySelector(selectorString) : null;\n };\n\n const elementByClass = className => {\n return elementBySelector(\".\".concat(className));\n };\n\n const getPopup = () => elementByClass(swalClasses.popup);\n const getIcon = () => elementByClass(swalClasses.icon);\n const getTitle = () => elementByClass(swalClasses.title);\n const getHtmlContainer = () => elementByClass(swalClasses['html-container']);\n const getImage = () => elementByClass(swalClasses.image);\n const getProgressSteps = () => elementByClass(swalClasses['progress-steps']);\n const getValidationMessage = () => elementByClass(swalClasses['validation-message']);\n const getConfirmButton = () => elementBySelector(\".\".concat(swalClasses.actions, \" .\").concat(swalClasses.confirm));\n const getDenyButton = () => elementBySelector(\".\".concat(swalClasses.actions, \" .\").concat(swalClasses.deny));\n const getInputLabel = () => elementByClass(swalClasses['input-label']);\n const getLoader = () => elementBySelector(\".\".concat(swalClasses.loader));\n const getCancelButton = () => elementBySelector(\".\".concat(swalClasses.actions, \" .\").concat(swalClasses.cancel));\n const getActions = () => elementByClass(swalClasses.actions);\n const getFooter = () => elementByClass(swalClasses.footer);\n const getTimerProgressBar = () => elementByClass(swalClasses['timer-progress-bar']);\n const getCloseButton = () => elementByClass(swalClasses.close); // https://github.com/jkup/focusable/blob/master/index.js\n\n const focusable = \"\\n a[href],\\n area[href],\\n input:not([disabled]),\\n select:not([disabled]),\\n textarea:not([disabled]),\\n button:not([disabled]),\\n iframe,\\n object,\\n embed,\\n [tabindex=\\\"0\\\"],\\n [contenteditable],\\n audio[controls],\\n video[controls],\\n summary\\n\";\n const getFocusableElements = () => {\n const focusableElementsWithTabindex = toArray(getPopup().querySelectorAll('[tabindex]:not([tabindex=\"-1\"]):not([tabindex=\"0\"])')) // sort according to tabindex\n .sort((a, b) => {\n const tabindexA = parseInt(a.getAttribute('tabindex'));\n const tabindexB = parseInt(b.getAttribute('tabindex'));\n\n if (tabindexA > tabindexB) {\n return 1;\n } else if (tabindexA < tabindexB) {\n return -1;\n }\n\n return 0;\n });\n const otherFocusableElements = toArray(getPopup().querySelectorAll(focusable)).filter(el => el.getAttribute('tabindex') !== '-1');\n return uniqueArray(focusableElementsWithTabindex.concat(otherFocusableElements)).filter(el => isVisible(el));\n };\n const isModal = () => {\n return hasClass(document.body, swalClasses.shown) && !hasClass(document.body, swalClasses['toast-shown']) && !hasClass(document.body, swalClasses['no-backdrop']);\n };\n const isToast = () => {\n return getPopup() && hasClass(getPopup(), swalClasses.toast);\n };\n const isLoading = () => {\n return getPopup().hasAttribute('data-loading');\n };\n\n const states = {\n previousBodyPadding: null\n };\n /**\n * Securely set innerHTML of an element\n * https://github.com/sweetalert2/sweetalert2/issues/1926\n *\n * @param {HTMLElement} elem\n * @param {string} html\n */\n\n const setInnerHtml = (elem, html) => {\n elem.textContent = '';\n\n if (html) {\n const parser = new DOMParser();\n const parsed = parser.parseFromString(html, \"text/html\");\n toArray(parsed.querySelector('head').childNodes).forEach(child => {\n elem.appendChild(child);\n });\n toArray(parsed.querySelector('body').childNodes).forEach(child => {\n elem.appendChild(child);\n });\n }\n };\n /**\n * @param {HTMLElement} elem\n * @param {string} className\n * @returns {boolean}\n */\n\n const hasClass = (elem, className) => {\n if (!className) {\n return false;\n }\n\n const classList = className.split(/\\s+/);\n\n for (let i = 0; i < classList.length; i++) {\n if (!elem.classList.contains(classList[i])) {\n return false;\n }\n }\n\n return true;\n };\n\n const removeCustomClasses = (elem, params) => {\n toArray(elem.classList).forEach(className => {\n if (!Object.values(swalClasses).includes(className) && !Object.values(iconTypes).includes(className) && !Object.values(params.showClass).includes(className)) {\n elem.classList.remove(className);\n }\n });\n };\n\n const applyCustomClass = (elem, params, className) => {\n removeCustomClasses(elem, params);\n\n if (params.customClass && params.customClass[className]) {\n if (typeof params.customClass[className] !== 'string' && !params.customClass[className].forEach) {\n return warn(\"Invalid type of customClass.\".concat(className, \"! Expected string or iterable object, got \\\"\").concat(typeof params.customClass[className], \"\\\"\"));\n }\n\n addClass(elem, params.customClass[className]);\n }\n };\n /**\n * @param {HTMLElement} popup\n * @param {string} inputType\n * @returns {HTMLInputElement | null}\n */\n\n const getInput = (popup, inputType) => {\n if (!inputType) {\n return null;\n }\n\n switch (inputType) {\n case 'select':\n case 'textarea':\n case 'file':\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses[inputType]));\n\n case 'checkbox':\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.checkbox, \" input\"));\n\n case 'radio':\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.radio, \" input:checked\")) || popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.radio, \" input:first-child\"));\n\n case 'range':\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.range, \" input\"));\n\n default:\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.input));\n }\n };\n /**\n * @param {HTMLInputElement} input\n */\n\n const focusInput = input => {\n input.focus(); // place cursor at end of text in text input\n\n if (input.type !== 'file') {\n // http://stackoverflow.com/a/2345915\n const val = input.value;\n input.value = '';\n input.value = val;\n }\n };\n /**\n * @param {HTMLElement | HTMLElement[] | null} target\n * @param {string | string[]} classList\n * @param {boolean} condition\n */\n\n const toggleClass = (target, classList, condition) => {\n if (!target || !classList) {\n return;\n }\n\n if (typeof classList === 'string') {\n classList = classList.split(/\\s+/).filter(Boolean);\n }\n\n classList.forEach(className => {\n if (Array.isArray(target)) {\n target.forEach(elem => {\n condition ? elem.classList.add(className) : elem.classList.remove(className);\n });\n } else {\n condition ? target.classList.add(className) : target.classList.remove(className);\n }\n });\n };\n /**\n * @param {HTMLElement | HTMLElement[] | null} target\n * @param {string | string[]} classList\n */\n\n const addClass = (target, classList) => {\n toggleClass(target, classList, true);\n };\n /**\n * @param {HTMLElement | HTMLElement[] | null} target\n * @param {string | string[]} classList\n */\n\n const removeClass = (target, classList) => {\n toggleClass(target, classList, false);\n };\n /**\n * Get direct child of an element by class name\n *\n * @param {HTMLElement} elem\n * @param {string} className\n * @returns {HTMLElement | null}\n */\n\n const getDirectChildByClass = (elem, className) => {\n const childNodes = toArray(elem.childNodes);\n\n for (let i = 0; i < childNodes.length; i++) {\n if (hasClass(childNodes[i], className)) {\n return childNodes[i];\n }\n }\n };\n /**\n * @param {HTMLElement} elem\n * @param {string} property\n * @param {*} value\n */\n\n const applyNumericalStyle = (elem, property, value) => {\n if (value === \"\".concat(parseInt(value))) {\n value = parseInt(value);\n }\n\n if (value || parseInt(value) === 0) {\n elem.style[property] = typeof value === 'number' ? \"\".concat(value, \"px\") : value;\n } else {\n elem.style.removeProperty(property);\n }\n };\n /**\n * @param {HTMLElement} elem\n * @param {string} display\n */\n\n const show = function (elem) {\n let display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'flex';\n elem.style.display = display;\n };\n /**\n * @param {HTMLElement} elem\n */\n\n const hide = elem => {\n elem.style.display = 'none';\n };\n const setStyle = (parent, selector, property, value) => {\n const el = parent.querySelector(selector);\n\n if (el) {\n el.style[property] = value;\n }\n };\n const toggle = (elem, condition, display) => {\n condition ? show(elem, display) : hide(elem);\n }; // borrowed from jquery $(elem).is(':visible') implementation\n\n const isVisible = elem => !!(elem && (elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length));\n const allButtonsAreHidden = () => !isVisible(getConfirmButton()) && !isVisible(getDenyButton()) && !isVisible(getCancelButton());\n const isScrollable = elem => !!(elem.scrollHeight > elem.clientHeight); // borrowed from https://stackoverflow.com/a/46352119\n\n const hasCssAnimation = elem => {\n const style = window.getComputedStyle(elem);\n const animDuration = parseFloat(style.getPropertyValue('animation-duration') || '0');\n const transDuration = parseFloat(style.getPropertyValue('transition-duration') || '0');\n return animDuration > 0 || transDuration > 0;\n };\n const animateTimerProgressBar = function (timer) {\n let reset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n const timerProgressBar = getTimerProgressBar();\n\n if (isVisible(timerProgressBar)) {\n if (reset) {\n timerProgressBar.style.transition = 'none';\n timerProgressBar.style.width = '100%';\n }\n\n setTimeout(() => {\n timerProgressBar.style.transition = \"width \".concat(timer / 1000, \"s linear\");\n timerProgressBar.style.width = '0%';\n }, 10);\n }\n };\n const stopTimerProgressBar = () => {\n const timerProgressBar = getTimerProgressBar();\n const timerProgressBarWidth = parseInt(window.getComputedStyle(timerProgressBar).width);\n timerProgressBar.style.removeProperty('transition');\n timerProgressBar.style.width = '100%';\n const timerProgressBarFullWidth = parseInt(window.getComputedStyle(timerProgressBar).width);\n const timerProgressBarPercent = timerProgressBarWidth / timerProgressBarFullWidth * 100;\n timerProgressBar.style.removeProperty('transition');\n timerProgressBar.style.width = \"\".concat(timerProgressBarPercent, \"%\");\n };\n\n /**\n * Detect Node env\n *\n * @returns {boolean}\n */\n const isNodeEnv = () => typeof window === 'undefined' || typeof document === 'undefined';\n\n const RESTORE_FOCUS_TIMEOUT = 100;\n\n const globalState = {};\n\n const focusPreviousActiveElement = () => {\n if (globalState.previousActiveElement && globalState.previousActiveElement.focus) {\n globalState.previousActiveElement.focus();\n globalState.previousActiveElement = null;\n } else if (document.body) {\n document.body.focus();\n }\n }; // Restore previous active (focused) element\n\n\n const restoreActiveElement = returnFocus => {\n return new Promise(resolve => {\n if (!returnFocus) {\n return resolve();\n }\n\n const x = window.scrollX;\n const y = window.scrollY;\n globalState.restoreFocusTimeout = setTimeout(() => {\n focusPreviousActiveElement();\n resolve();\n }, RESTORE_FOCUS_TIMEOUT); // issues/900\n\n window.scrollTo(x, y);\n });\n };\n\n const sweetHTML = \"\\n
\\n \\n \\n
\\n \\n

\\n
\\n \\n \\n
\\n \\n \\n
\\n \\n
\\n \\n \\n
\\n
\\n
\\n \\n \\n \\n
\\n
\\n
\\n
\\n
\\n
\\n\").replace(/(^|\\n)\\s*/g, '');\n\n const resetOldContainer = () => {\n const oldContainer = getContainer();\n\n if (!oldContainer) {\n return false;\n }\n\n oldContainer.remove();\n removeClass([document.documentElement, document.body], [swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['has-column']]);\n return true;\n };\n\n const resetValidationMessage = () => {\n globalState.currentInstance.resetValidationMessage();\n };\n\n const addInputChangeListeners = () => {\n const popup = getPopup();\n const input = getDirectChildByClass(popup, swalClasses.input);\n const file = getDirectChildByClass(popup, swalClasses.file);\n const range = popup.querySelector(\".\".concat(swalClasses.range, \" input\"));\n const rangeOutput = popup.querySelector(\".\".concat(swalClasses.range, \" output\"));\n const select = getDirectChildByClass(popup, swalClasses.select);\n const checkbox = popup.querySelector(\".\".concat(swalClasses.checkbox, \" input\"));\n const textarea = getDirectChildByClass(popup, swalClasses.textarea);\n input.oninput = resetValidationMessage;\n file.onchange = resetValidationMessage;\n select.onchange = resetValidationMessage;\n checkbox.onchange = resetValidationMessage;\n textarea.oninput = resetValidationMessage;\n\n range.oninput = () => {\n resetValidationMessage();\n rangeOutput.value = range.value;\n };\n\n range.onchange = () => {\n resetValidationMessage();\n range.nextSibling.value = range.value;\n };\n };\n\n const getTarget = target => typeof target === 'string' ? document.querySelector(target) : target;\n\n const setupAccessibility = params => {\n const popup = getPopup();\n popup.setAttribute('role', params.toast ? 'alert' : 'dialog');\n popup.setAttribute('aria-live', params.toast ? 'polite' : 'assertive');\n\n if (!params.toast) {\n popup.setAttribute('aria-modal', 'true');\n }\n };\n\n const setupRTL = targetElement => {\n if (window.getComputedStyle(targetElement).direction === 'rtl') {\n addClass(getContainer(), swalClasses.rtl);\n }\n };\n /*\n * Add modal + backdrop to DOM\n */\n\n\n const init = params => {\n // Clean up the old popup container if it exists\n const oldContainerExisted = resetOldContainer();\n /* istanbul ignore if */\n\n if (isNodeEnv()) {\n error('SweetAlert2 requires document to initialize');\n return;\n }\n\n const container = document.createElement('div');\n container.className = swalClasses.container;\n\n if (oldContainerExisted) {\n addClass(container, swalClasses['no-transition']);\n }\n\n setInnerHtml(container, sweetHTML);\n const targetElement = getTarget(params.target);\n targetElement.appendChild(container);\n setupAccessibility(params);\n setupRTL(targetElement);\n addInputChangeListeners();\n };\n\n /**\n * @param {HTMLElement | object | string} param\n * @param {HTMLElement} target\n */\n\n const parseHtmlToContainer = (param, target) => {\n // DOM element\n if (param instanceof HTMLElement) {\n target.appendChild(param);\n } // Object\n else if (typeof param === 'object') {\n handleObject(param, target);\n } // Plain string\n else if (param) {\n setInnerHtml(target, param);\n }\n };\n /**\n * @param {object} param\n * @param {HTMLElement} target\n */\n\n const handleObject = (param, target) => {\n // JQuery element(s)\n if (param.jquery) {\n handleJqueryElem(target, param);\n } // For other objects use their string representation\n else {\n setInnerHtml(target, param.toString());\n }\n };\n\n const handleJqueryElem = (target, elem) => {\n target.textContent = '';\n\n if (0 in elem) {\n for (let i = 0; (i in elem); i++) {\n target.appendChild(elem[i].cloneNode(true));\n }\n } else {\n target.appendChild(elem.cloneNode(true));\n }\n };\n\n const animationEndEvent = (() => {\n // Prevent run in Node env\n\n /* istanbul ignore if */\n if (isNodeEnv()) {\n return false;\n }\n\n const testEl = document.createElement('div');\n const transEndEventNames = {\n WebkitAnimation: 'webkitAnimationEnd',\n // Chrome, Safari and Opera\n animation: 'animationend' // Standard syntax\n\n };\n\n for (const i in transEndEventNames) {\n if (Object.prototype.hasOwnProperty.call(transEndEventNames, i) && typeof testEl.style[i] !== 'undefined') {\n return transEndEventNames[i];\n }\n }\n\n return false;\n })();\n\n // https://github.com/twbs/bootstrap/blob/master/js/src/modal.js\n\n const measureScrollbar = () => {\n const scrollDiv = document.createElement('div');\n scrollDiv.className = swalClasses['scrollbar-measure'];\n document.body.appendChild(scrollDiv);\n const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;\n document.body.removeChild(scrollDiv);\n return scrollbarWidth;\n };\n\n const renderActions = (instance, params) => {\n const actions = getActions();\n const loader = getLoader(); // Actions (buttons) wrapper\n\n if (!params.showConfirmButton && !params.showDenyButton && !params.showCancelButton) {\n hide(actions);\n } else {\n show(actions);\n } // Custom class\n\n\n applyCustomClass(actions, params, 'actions'); // Render all the buttons\n\n renderButtons(actions, loader, params); // Loader\n\n setInnerHtml(loader, params.loaderHtml);\n applyCustomClass(loader, params, 'loader');\n };\n\n function renderButtons(actions, loader, params) {\n const confirmButton = getConfirmButton();\n const denyButton = getDenyButton();\n const cancelButton = getCancelButton(); // Render buttons\n\n renderButton(confirmButton, 'confirm', params);\n renderButton(denyButton, 'deny', params);\n renderButton(cancelButton, 'cancel', params);\n handleButtonsStyling(confirmButton, denyButton, cancelButton, params);\n\n if (params.reverseButtons) {\n if (params.toast) {\n actions.insertBefore(cancelButton, confirmButton);\n actions.insertBefore(denyButton, confirmButton);\n } else {\n actions.insertBefore(cancelButton, loader);\n actions.insertBefore(denyButton, loader);\n actions.insertBefore(confirmButton, loader);\n }\n }\n }\n\n function handleButtonsStyling(confirmButton, denyButton, cancelButton, params) {\n if (!params.buttonsStyling) {\n return removeClass([confirmButton, denyButton, cancelButton], swalClasses.styled);\n }\n\n addClass([confirmButton, denyButton, cancelButton], swalClasses.styled); // Buttons background colors\n\n if (params.confirmButtonColor) {\n confirmButton.style.backgroundColor = params.confirmButtonColor;\n addClass(confirmButton, swalClasses['default-outline']);\n }\n\n if (params.denyButtonColor) {\n denyButton.style.backgroundColor = params.denyButtonColor;\n addClass(denyButton, swalClasses['default-outline']);\n }\n\n if (params.cancelButtonColor) {\n cancelButton.style.backgroundColor = params.cancelButtonColor;\n addClass(cancelButton, swalClasses['default-outline']);\n }\n }\n\n function renderButton(button, buttonType, params) {\n toggle(button, params[\"show\".concat(capitalizeFirstLetter(buttonType), \"Button\")], 'inline-block');\n setInnerHtml(button, params[\"\".concat(buttonType, \"ButtonText\")]); // Set caption text\n\n button.setAttribute('aria-label', params[\"\".concat(buttonType, \"ButtonAriaLabel\")]); // ARIA label\n // Add buttons custom classes\n\n button.className = swalClasses[buttonType];\n applyCustomClass(button, params, \"\".concat(buttonType, \"Button\"));\n addClass(button, params[\"\".concat(buttonType, \"ButtonClass\")]);\n }\n\n function handleBackdropParam(container, backdrop) {\n if (typeof backdrop === 'string') {\n container.style.background = backdrop;\n } else if (!backdrop) {\n addClass([document.documentElement, document.body], swalClasses['no-backdrop']);\n }\n }\n\n function handlePositionParam(container, position) {\n if (position in swalClasses) {\n addClass(container, swalClasses[position]);\n } else {\n warn('The \"position\" parameter is not valid, defaulting to \"center\"');\n addClass(container, swalClasses.center);\n }\n }\n\n function handleGrowParam(container, grow) {\n if (grow && typeof grow === 'string') {\n const growClass = \"grow-\".concat(grow);\n\n if (growClass in swalClasses) {\n addClass(container, swalClasses[growClass]);\n }\n }\n }\n\n const renderContainer = (instance, params) => {\n const container = getContainer();\n\n if (!container) {\n return;\n }\n\n handleBackdropParam(container, params.backdrop);\n handlePositionParam(container, params.position);\n handleGrowParam(container, params.grow); // Custom class\n\n applyCustomClass(container, params, 'container');\n };\n\n /**\n * This module contains `WeakMap`s for each effectively-\"private property\" that a `Swal` has.\n * For example, to set the private property \"foo\" of `this` to \"bar\", you can `privateProps.foo.set(this, 'bar')`\n * This is the approach that Babel will probably take to implement private methods/fields\n * https://github.com/tc39/proposal-private-methods\n * https://github.com/babel/babel/pull/7555\n * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module*\n * then we can use that language feature.\n */\n var privateProps = {\n awaitingPromise: new WeakMap(),\n promise: new WeakMap(),\n innerParams: new WeakMap(),\n domCache: new WeakMap()\n };\n\n const inputTypes = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea'];\n const renderInput = (instance, params) => {\n const popup = getPopup();\n const innerParams = privateProps.innerParams.get(instance);\n const rerender = !innerParams || params.input !== innerParams.input;\n inputTypes.forEach(inputType => {\n const inputClass = swalClasses[inputType];\n const inputContainer = getDirectChildByClass(popup, inputClass); // set attributes\n\n setAttributes(inputType, params.inputAttributes); // set class\n\n inputContainer.className = inputClass;\n\n if (rerender) {\n hide(inputContainer);\n }\n });\n\n if (params.input) {\n if (rerender) {\n showInput(params);\n } // set custom class\n\n\n setCustomClass(params);\n }\n };\n\n const showInput = params => {\n if (!renderInputType[params.input]) {\n return error(\"Unexpected type of input! Expected \\\"text\\\", \\\"email\\\", \\\"password\\\", \\\"number\\\", \\\"tel\\\", \\\"select\\\", \\\"radio\\\", \\\"checkbox\\\", \\\"textarea\\\", \\\"file\\\" or \\\"url\\\", got \\\"\".concat(params.input, \"\\\"\"));\n }\n\n const inputContainer = getInputContainer(params.input);\n const input = renderInputType[params.input](inputContainer, params);\n show(input); // input autofocus\n\n setTimeout(() => {\n focusInput(input);\n });\n };\n\n const removeAttributes = input => {\n for (let i = 0; i < input.attributes.length; i++) {\n const attrName = input.attributes[i].name;\n\n if (!['type', 'value', 'style'].includes(attrName)) {\n input.removeAttribute(attrName);\n }\n }\n };\n\n const setAttributes = (inputType, inputAttributes) => {\n const input = getInput(getPopup(), inputType);\n\n if (!input) {\n return;\n }\n\n removeAttributes(input);\n\n for (const attr in inputAttributes) {\n input.setAttribute(attr, inputAttributes[attr]);\n }\n };\n\n const setCustomClass = params => {\n const inputContainer = getInputContainer(params.input);\n\n if (params.customClass) {\n addClass(inputContainer, params.customClass.input);\n }\n };\n\n const setInputPlaceholder = (input, params) => {\n if (!input.placeholder || params.inputPlaceholder) {\n input.placeholder = params.inputPlaceholder;\n }\n };\n\n const setInputLabel = (input, prependTo, params) => {\n if (params.inputLabel) {\n input.id = swalClasses.input;\n const label = document.createElement('label');\n const labelClass = swalClasses['input-label'];\n label.setAttribute('for', input.id);\n label.className = labelClass;\n addClass(label, params.customClass.inputLabel);\n label.innerText = params.inputLabel;\n prependTo.insertAdjacentElement('beforebegin', label);\n }\n };\n\n const getInputContainer = inputType => {\n const inputClass = swalClasses[inputType] ? swalClasses[inputType] : swalClasses.input;\n return getDirectChildByClass(getPopup(), inputClass);\n };\n\n const renderInputType = {};\n\n renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = (input, params) => {\n if (typeof params.inputValue === 'string' || typeof params.inputValue === 'number') {\n input.value = params.inputValue;\n } else if (!isPromise(params.inputValue)) {\n warn(\"Unexpected type of inputValue! Expected \\\"string\\\", \\\"number\\\" or \\\"Promise\\\", got \\\"\".concat(typeof params.inputValue, \"\\\"\"));\n }\n\n setInputLabel(input, input, params);\n setInputPlaceholder(input, params);\n input.type = params.input;\n return input;\n };\n\n renderInputType.file = (input, params) => {\n setInputLabel(input, input, params);\n setInputPlaceholder(input, params);\n return input;\n };\n\n renderInputType.range = (range, params) => {\n const rangeInput = range.querySelector('input');\n const rangeOutput = range.querySelector('output');\n rangeInput.value = params.inputValue;\n rangeInput.type = params.input;\n rangeOutput.value = params.inputValue;\n setInputLabel(rangeInput, range, params);\n return range;\n };\n\n renderInputType.select = (select, params) => {\n select.textContent = '';\n\n if (params.inputPlaceholder) {\n const placeholder = document.createElement('option');\n setInnerHtml(placeholder, params.inputPlaceholder);\n placeholder.value = '';\n placeholder.disabled = true;\n placeholder.selected = true;\n select.appendChild(placeholder);\n }\n\n setInputLabel(select, select, params);\n return select;\n };\n\n renderInputType.radio = radio => {\n radio.textContent = '';\n return radio;\n };\n\n renderInputType.checkbox = (checkboxContainer, params) => {\n /** @type {HTMLInputElement} */\n const checkbox = getInput(getPopup(), 'checkbox');\n checkbox.value = '1';\n checkbox.id = swalClasses.checkbox;\n checkbox.checked = Boolean(params.inputValue);\n const label = checkboxContainer.querySelector('span');\n setInnerHtml(label, params.inputPlaceholder);\n return checkboxContainer;\n };\n\n renderInputType.textarea = (textarea, params) => {\n textarea.value = params.inputValue;\n setInputPlaceholder(textarea, params);\n setInputLabel(textarea, textarea, params);\n\n const getMargin = el => parseInt(window.getComputedStyle(el).marginLeft) + parseInt(window.getComputedStyle(el).marginRight); // https://github.com/sweetalert2/sweetalert2/issues/2291\n\n\n setTimeout(() => {\n // https://github.com/sweetalert2/sweetalert2/issues/1699\n if ('MutationObserver' in window) {\n const initialPopupWidth = parseInt(window.getComputedStyle(getPopup()).width);\n\n const textareaResizeHandler = () => {\n const textareaWidth = textarea.offsetWidth + getMargin(textarea);\n\n if (textareaWidth > initialPopupWidth) {\n getPopup().style.width = \"\".concat(textareaWidth, \"px\");\n } else {\n getPopup().style.width = null;\n }\n };\n\n new MutationObserver(textareaResizeHandler).observe(textarea, {\n attributes: true,\n attributeFilter: ['style']\n });\n }\n });\n return textarea;\n };\n\n const renderContent = (instance, params) => {\n const htmlContainer = getHtmlContainer();\n applyCustomClass(htmlContainer, params, 'htmlContainer'); // Content as HTML\n\n if (params.html) {\n parseHtmlToContainer(params.html, htmlContainer);\n show(htmlContainer, 'block');\n } // Content as plain text\n else if (params.text) {\n htmlContainer.textContent = params.text;\n show(htmlContainer, 'block');\n } // No content\n else {\n hide(htmlContainer);\n }\n\n renderInput(instance, params);\n };\n\n const renderFooter = (instance, params) => {\n const footer = getFooter();\n toggle(footer, params.footer);\n\n if (params.footer) {\n parseHtmlToContainer(params.footer, footer);\n } // Custom class\n\n\n applyCustomClass(footer, params, 'footer');\n };\n\n const renderCloseButton = (instance, params) => {\n const closeButton = getCloseButton();\n setInnerHtml(closeButton, params.closeButtonHtml); // Custom class\n\n applyCustomClass(closeButton, params, 'closeButton');\n toggle(closeButton, params.showCloseButton);\n closeButton.setAttribute('aria-label', params.closeButtonAriaLabel);\n };\n\n const renderIcon = (instance, params) => {\n const innerParams = privateProps.innerParams.get(instance);\n const icon = getIcon(); // if the given icon already rendered, apply the styling without re-rendering the icon\n\n if (innerParams && params.icon === innerParams.icon) {\n // Custom or default content\n setContent(icon, params);\n applyStyles(icon, params);\n return;\n }\n\n if (!params.icon && !params.iconHtml) {\n return hide(icon);\n }\n\n if (params.icon && Object.keys(iconTypes).indexOf(params.icon) === -1) {\n error(\"Unknown icon! Expected \\\"success\\\", \\\"error\\\", \\\"warning\\\", \\\"info\\\" or \\\"question\\\", got \\\"\".concat(params.icon, \"\\\"\"));\n return hide(icon);\n }\n\n show(icon); // Custom or default content\n\n setContent(icon, params);\n applyStyles(icon, params); // Animate icon\n\n addClass(icon, params.showClass.icon);\n };\n\n const applyStyles = (icon, params) => {\n for (const iconType in iconTypes) {\n if (params.icon !== iconType) {\n removeClass(icon, iconTypes[iconType]);\n }\n }\n\n addClass(icon, iconTypes[params.icon]); // Icon color\n\n setColor(icon, params); // Success icon background color\n\n adjustSuccessIconBackgroundColor(); // Custom class\n\n applyCustomClass(icon, params, 'icon');\n }; // Adjust success icon background color to match the popup background color\n\n\n const adjustSuccessIconBackgroundColor = () => {\n const popup = getPopup();\n const popupBackgroundColor = window.getComputedStyle(popup).getPropertyValue('background-color');\n const successIconParts = popup.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix');\n\n for (let i = 0; i < successIconParts.length; i++) {\n successIconParts[i].style.backgroundColor = popupBackgroundColor;\n }\n };\n\n const successIconHtml = \"\\n
\\n \\n
\\n
\\n\";\n const errorIconHtml = \"\\n \\n \\n \\n \\n\";\n\n const setContent = (icon, params) => {\n icon.textContent = '';\n\n if (params.iconHtml) {\n setInnerHtml(icon, iconContent(params.iconHtml));\n } else if (params.icon === 'success') {\n setInnerHtml(icon, successIconHtml);\n } else if (params.icon === 'error') {\n setInnerHtml(icon, errorIconHtml);\n } else {\n const defaultIconHtml = {\n question: '?',\n warning: '!',\n info: 'i'\n };\n setInnerHtml(icon, iconContent(defaultIconHtml[params.icon]));\n }\n };\n\n const setColor = (icon, params) => {\n if (!params.iconColor) {\n return;\n }\n\n icon.style.color = params.iconColor;\n icon.style.borderColor = params.iconColor;\n\n for (const sel of ['.swal2-success-line-tip', '.swal2-success-line-long', '.swal2-x-mark-line-left', '.swal2-x-mark-line-right']) {\n setStyle(icon, sel, 'backgroundColor', params.iconColor);\n }\n\n setStyle(icon, '.swal2-success-ring', 'borderColor', params.iconColor);\n };\n\n const iconContent = content => \"
\").concat(content, \"
\");\n\n const renderImage = (instance, params) => {\n const image = getImage();\n\n if (!params.imageUrl) {\n return hide(image);\n }\n\n show(image, ''); // Src, alt\n\n image.setAttribute('src', params.imageUrl);\n image.setAttribute('alt', params.imageAlt); // Width, height\n\n applyNumericalStyle(image, 'width', params.imageWidth);\n applyNumericalStyle(image, 'height', params.imageHeight); // Class\n\n image.className = swalClasses.image;\n applyCustomClass(image, params, 'image');\n };\n\n const createStepElement = step => {\n const stepEl = document.createElement('li');\n addClass(stepEl, swalClasses['progress-step']);\n setInnerHtml(stepEl, step);\n return stepEl;\n };\n\n const createLineElement = params => {\n const lineEl = document.createElement('li');\n addClass(lineEl, swalClasses['progress-step-line']);\n\n if (params.progressStepsDistance) {\n lineEl.style.width = params.progressStepsDistance;\n }\n\n return lineEl;\n };\n\n const renderProgressSteps = (instance, params) => {\n const progressStepsContainer = getProgressSteps();\n\n if (!params.progressSteps || params.progressSteps.length === 0) {\n return hide(progressStepsContainer);\n }\n\n show(progressStepsContainer);\n progressStepsContainer.textContent = '';\n\n if (params.currentProgressStep >= params.progressSteps.length) {\n warn('Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)');\n }\n\n params.progressSteps.forEach((step, index) => {\n const stepEl = createStepElement(step);\n progressStepsContainer.appendChild(stepEl);\n\n if (index === params.currentProgressStep) {\n addClass(stepEl, swalClasses['active-progress-step']);\n }\n\n if (index !== params.progressSteps.length - 1) {\n const lineEl = createLineElement(params);\n progressStepsContainer.appendChild(lineEl);\n }\n });\n };\n\n const renderTitle = (instance, params) => {\n const title = getTitle();\n toggle(title, params.title || params.titleText, 'block');\n\n if (params.title) {\n parseHtmlToContainer(params.title, title);\n }\n\n if (params.titleText) {\n title.innerText = params.titleText;\n } // Custom class\n\n\n applyCustomClass(title, params, 'title');\n };\n\n const renderPopup = (instance, params) => {\n const container = getContainer();\n const popup = getPopup(); // Width\n // https://github.com/sweetalert2/sweetalert2/issues/2170\n\n if (params.toast) {\n applyNumericalStyle(container, 'width', params.width);\n popup.style.width = '100%';\n popup.insertBefore(getLoader(), getIcon());\n } else {\n applyNumericalStyle(popup, 'width', params.width);\n } // Padding\n\n\n applyNumericalStyle(popup, 'padding', params.padding); // Color\n\n if (params.color) {\n popup.style.color = params.color;\n } // Background\n\n\n if (params.background) {\n popup.style.background = params.background;\n }\n\n hide(getValidationMessage()); // Classes\n\n addClasses(popup, params);\n };\n\n const addClasses = (popup, params) => {\n // Default Class + showClass when updating Swal.update({})\n popup.className = \"\".concat(swalClasses.popup, \" \").concat(isVisible(popup) ? params.showClass.popup : '');\n\n if (params.toast) {\n addClass([document.documentElement, document.body], swalClasses['toast-shown']);\n addClass(popup, swalClasses.toast);\n } else {\n addClass(popup, swalClasses.modal);\n } // Custom class\n\n\n applyCustomClass(popup, params, 'popup');\n\n if (typeof params.customClass === 'string') {\n addClass(popup, params.customClass);\n } // Icon class (#1842)\n\n\n if (params.icon) {\n addClass(popup, swalClasses[\"icon-\".concat(params.icon)]);\n }\n };\n\n const render = (instance, params) => {\n renderPopup(instance, params);\n renderContainer(instance, params);\n renderProgressSteps(instance, params);\n renderIcon(instance, params);\n renderImage(instance, params);\n renderTitle(instance, params);\n renderCloseButton(instance, params);\n renderContent(instance, params);\n renderActions(instance, params);\n renderFooter(instance, params);\n\n if (typeof params.didRender === 'function') {\n params.didRender(getPopup());\n }\n };\n\n const DismissReason = Object.freeze({\n cancel: 'cancel',\n backdrop: 'backdrop',\n close: 'close',\n esc: 'esc',\n timer: 'timer'\n });\n\n // Adding aria-hidden=\"true\" to elements outside of the active modal dialog ensures that\n // elements not within the active modal dialog will not be surfaced if a user opens a screen\n // reader\u2019s list of elements (headings, form controls, landmarks, etc.) in the document.\n\n const setAriaHidden = () => {\n const bodyChildren = toArray(document.body.children);\n bodyChildren.forEach(el => {\n if (el === getContainer() || el.contains(getContainer())) {\n return;\n }\n\n if (el.hasAttribute('aria-hidden')) {\n el.setAttribute('data-previous-aria-hidden', el.getAttribute('aria-hidden'));\n }\n\n el.setAttribute('aria-hidden', 'true');\n });\n };\n const unsetAriaHidden = () => {\n const bodyChildren = toArray(document.body.children);\n bodyChildren.forEach(el => {\n if (el.hasAttribute('data-previous-aria-hidden')) {\n el.setAttribute('aria-hidden', el.getAttribute('data-previous-aria-hidden'));\n el.removeAttribute('data-previous-aria-hidden');\n } else {\n el.removeAttribute('aria-hidden');\n }\n });\n };\n\n const swalStringParams = ['swal-title', 'swal-html', 'swal-footer'];\n const getTemplateParams = params => {\n const template = typeof params.template === 'string' ? document.querySelector(params.template) : params.template;\n\n if (!template) {\n return {};\n }\n /** @type {DocumentFragment} */\n\n\n const templateContent = template.content;\n showWarningsForElements(templateContent);\n const result = Object.assign(getSwalParams(templateContent), getSwalButtons(templateContent), getSwalImage(templateContent), getSwalIcon(templateContent), getSwalInput(templateContent), getSwalStringParams(templateContent, swalStringParams));\n return result;\n };\n /**\n * @param {DocumentFragment} templateContent\n */\n\n const getSwalParams = templateContent => {\n const result = {};\n toArray(templateContent.querySelectorAll('swal-param')).forEach(param => {\n showWarningsForAttributes(param, ['name', 'value']);\n const paramName = param.getAttribute('name');\n const value = param.getAttribute('value');\n\n if (typeof defaultParams[paramName] === 'boolean' && value === 'false') {\n result[paramName] = false;\n }\n\n if (typeof defaultParams[paramName] === 'object') {\n result[paramName] = JSON.parse(value);\n }\n });\n return result;\n };\n /**\n * @param {DocumentFragment} templateContent\n */\n\n\n const getSwalButtons = templateContent => {\n const result = {};\n toArray(templateContent.querySelectorAll('swal-button')).forEach(button => {\n showWarningsForAttributes(button, ['type', 'color', 'aria-label']);\n const type = button.getAttribute('type');\n result[\"\".concat(type, \"ButtonText\")] = button.innerHTML;\n result[\"show\".concat(capitalizeFirstLetter(type), \"Button\")] = true;\n\n if (button.hasAttribute('color')) {\n result[\"\".concat(type, \"ButtonColor\")] = button.getAttribute('color');\n }\n\n if (button.hasAttribute('aria-label')) {\n result[\"\".concat(type, \"ButtonAriaLabel\")] = button.getAttribute('aria-label');\n }\n });\n return result;\n };\n /**\n * @param {DocumentFragment} templateContent\n */\n\n\n const getSwalImage = templateContent => {\n const result = {};\n /** @type {HTMLElement} */\n\n const image = templateContent.querySelector('swal-image');\n\n if (image) {\n showWarningsForAttributes(image, ['src', 'width', 'height', 'alt']);\n\n if (image.hasAttribute('src')) {\n result.imageUrl = image.getAttribute('src');\n }\n\n if (image.hasAttribute('width')) {\n result.imageWidth = image.getAttribute('width');\n }\n\n if (image.hasAttribute('height')) {\n result.imageHeight = image.getAttribute('height');\n }\n\n if (image.hasAttribute('alt')) {\n result.imageAlt = image.getAttribute('alt');\n }\n }\n\n return result;\n };\n /**\n * @param {DocumentFragment} templateContent\n */\n\n\n const getSwalIcon = templateContent => {\n const result = {};\n /** @type {HTMLElement} */\n\n const icon = templateContent.querySelector('swal-icon');\n\n if (icon) {\n showWarningsForAttributes(icon, ['type', 'color']);\n\n if (icon.hasAttribute('type')) {\n result.icon = icon.getAttribute('type');\n }\n\n if (icon.hasAttribute('color')) {\n result.iconColor = icon.getAttribute('color');\n }\n\n result.iconHtml = icon.innerHTML;\n }\n\n return result;\n };\n /**\n * @param {DocumentFragment} templateContent\n */\n\n\n const getSwalInput = templateContent => {\n const result = {};\n /** @type {HTMLElement} */\n\n const input = templateContent.querySelector('swal-input');\n\n if (input) {\n showWarningsForAttributes(input, ['type', 'label', 'placeholder', 'value']);\n result.input = input.getAttribute('type') || 'text';\n\n if (input.hasAttribute('label')) {\n result.inputLabel = input.getAttribute('label');\n }\n\n if (input.hasAttribute('placeholder')) {\n result.inputPlaceholder = input.getAttribute('placeholder');\n }\n\n if (input.hasAttribute('value')) {\n result.inputValue = input.getAttribute('value');\n }\n }\n\n const inputOptions = templateContent.querySelectorAll('swal-input-option');\n\n if (inputOptions.length) {\n result.inputOptions = {};\n toArray(inputOptions).forEach(option => {\n showWarningsForAttributes(option, ['value']);\n const optionValue = option.getAttribute('value');\n const optionName = option.innerHTML;\n result.inputOptions[optionValue] = optionName;\n });\n }\n\n return result;\n };\n /**\n * @param {DocumentFragment} templateContent\n * @param {string[]} paramNames\n */\n\n\n const getSwalStringParams = (templateContent, paramNames) => {\n const result = {};\n\n for (const i in paramNames) {\n const paramName = paramNames[i];\n /** @type {HTMLElement} */\n\n const tag = templateContent.querySelector(paramName);\n\n if (tag) {\n showWarningsForAttributes(tag, []);\n result[paramName.replace(/^swal-/, '')] = tag.innerHTML.trim();\n }\n }\n\n return result;\n };\n /**\n * @param {DocumentFragment} templateContent\n */\n\n\n const showWarningsForElements = templateContent => {\n const allowedElements = swalStringParams.concat(['swal-param', 'swal-button', 'swal-image', 'swal-icon', 'swal-input', 'swal-input-option']);\n toArray(templateContent.children).forEach(el => {\n const tagName = el.tagName.toLowerCase();\n\n if (allowedElements.indexOf(tagName) === -1) {\n warn(\"Unrecognized element <\".concat(tagName, \">\"));\n }\n });\n };\n /**\n * @param {HTMLElement} el\n * @param {string[]} allowedAttributes\n */\n\n\n const showWarningsForAttributes = (el, allowedAttributes) => {\n toArray(el.attributes).forEach(attribute => {\n if (allowedAttributes.indexOf(attribute.name) === -1) {\n warn([\"Unrecognized attribute \\\"\".concat(attribute.name, \"\\\" on <\").concat(el.tagName.toLowerCase(), \">.\"), \"\".concat(allowedAttributes.length ? \"Allowed attributes are: \".concat(allowedAttributes.join(', ')) : 'To set the value, use HTML within the element.')]);\n }\n });\n };\n\n var defaultInputValidators = {\n email: (string, validationMessage) => {\n return /^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z0-9-]{2,24}$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid email address');\n },\n url: (string, validationMessage) => {\n // taken from https://stackoverflow.com/a/3809435 with a small change from #1306 and #2013\n return /^https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-z]{2,63}\\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid URL');\n }\n };\n\n function setDefaultInputValidators(params) {\n // Use default `inputValidator` for supported input types if not provided\n if (!params.inputValidator) {\n Object.keys(defaultInputValidators).forEach(key => {\n if (params.input === key) {\n params.inputValidator = defaultInputValidators[key];\n }\n });\n }\n }\n\n function validateCustomTargetElement(params) {\n // Determine if the custom target element is valid\n if (!params.target || typeof params.target === 'string' && !document.querySelector(params.target) || typeof params.target !== 'string' && !params.target.appendChild) {\n warn('Target parameter is not valid, defaulting to \"body\"');\n params.target = 'body';\n }\n }\n /**\n * Set type, text and actions on popup\n *\n * @param params\n */\n\n\n function setParameters(params) {\n setDefaultInputValidators(params); // showLoaderOnConfirm && preConfirm\n\n if (params.showLoaderOnConfirm && !params.preConfirm) {\n warn('showLoaderOnConfirm is set to true, but preConfirm is not defined.\\n' + 'showLoaderOnConfirm should be used together with preConfirm, see usage example:\\n' + 'https://sweetalert2.github.io/#ajax-request');\n }\n\n validateCustomTargetElement(params); // Replace newlines with
in title\n\n if (typeof params.title === 'string') {\n params.title = params.title.split('\\n').join('
');\n }\n\n init(params);\n }\n\n class Timer {\n constructor(callback, delay) {\n this.callback = callback;\n this.remaining = delay;\n this.running = false;\n this.start();\n }\n\n start() {\n if (!this.running) {\n this.running = true;\n this.started = new Date();\n this.id = setTimeout(this.callback, this.remaining);\n }\n\n return this.remaining;\n }\n\n stop() {\n if (this.running) {\n this.running = false;\n clearTimeout(this.id);\n this.remaining -= new Date().getTime() - this.started.getTime();\n }\n\n return this.remaining;\n }\n\n increase(n) {\n const running = this.running;\n\n if (running) {\n this.stop();\n }\n\n this.remaining += n;\n\n if (running) {\n this.start();\n }\n\n return this.remaining;\n }\n\n getTimerLeft() {\n if (this.running) {\n this.stop();\n this.start();\n }\n\n return this.remaining;\n }\n\n isRunning() {\n return this.running;\n }\n\n }\n\n const fixScrollbar = () => {\n // for queues, do not do this more than once\n if (states.previousBodyPadding !== null) {\n return;\n } // if the body has overflow\n\n\n if (document.body.scrollHeight > window.innerHeight) {\n // add padding so the content doesn't shift after removal of scrollbar\n states.previousBodyPadding = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right'));\n document.body.style.paddingRight = \"\".concat(states.previousBodyPadding + measureScrollbar(), \"px\");\n }\n };\n const undoScrollbar = () => {\n if (states.previousBodyPadding !== null) {\n document.body.style.paddingRight = \"\".concat(states.previousBodyPadding, \"px\");\n states.previousBodyPadding = null;\n }\n };\n\n /* istanbul ignore file */\n\n const iOSfix = () => {\n const iOS = // @ts-ignore\n /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream || navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;\n\n if (iOS && !hasClass(document.body, swalClasses.iosfix)) {\n const offset = document.body.scrollTop;\n document.body.style.top = \"\".concat(offset * -1, \"px\");\n addClass(document.body, swalClasses.iosfix);\n lockBodyScroll();\n addBottomPaddingForTallPopups();\n }\n };\n /**\n * https://github.com/sweetalert2/sweetalert2/issues/1948\n */\n\n const addBottomPaddingForTallPopups = () => {\n const ua = navigator.userAgent;\n const iOS = !!ua.match(/iPad/i) || !!ua.match(/iPhone/i);\n const webkit = !!ua.match(/WebKit/i);\n const iOSSafari = iOS && webkit && !ua.match(/CriOS/i);\n\n if (iOSSafari) {\n const bottomPanelHeight = 44;\n\n if (getPopup().scrollHeight > window.innerHeight - bottomPanelHeight) {\n getContainer().style.paddingBottom = \"\".concat(bottomPanelHeight, \"px\");\n }\n }\n };\n /**\n * https://github.com/sweetalert2/sweetalert2/issues/1246\n */\n\n\n const lockBodyScroll = () => {\n const container = getContainer();\n let preventTouchMove;\n\n container.ontouchstart = e => {\n preventTouchMove = shouldPreventTouchMove(e);\n };\n\n container.ontouchmove = e => {\n if (preventTouchMove) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n };\n\n const shouldPreventTouchMove = event => {\n const target = event.target;\n const container = getContainer();\n\n if (isStylus(event) || isZoom(event)) {\n return false;\n }\n\n if (target === container) {\n return true;\n }\n\n if (!isScrollable(container) && target.tagName !== 'INPUT' && // #1603\n target.tagName !== 'TEXTAREA' && // #2266\n !(isScrollable(getHtmlContainer()) && // #1944\n getHtmlContainer().contains(target))) {\n return true;\n }\n\n return false;\n };\n /**\n * https://github.com/sweetalert2/sweetalert2/issues/1786\n *\n * @param {*} event\n * @returns {boolean}\n */\n\n\n const isStylus = event => {\n return event.touches && event.touches.length && event.touches[0].touchType === 'stylus';\n };\n /**\n * https://github.com/sweetalert2/sweetalert2/issues/1891\n *\n * @param {TouchEvent} event\n * @returns {boolean}\n */\n\n\n const isZoom = event => {\n return event.touches && event.touches.length > 1;\n };\n\n const undoIOSfix = () => {\n if (hasClass(document.body, swalClasses.iosfix)) {\n const offset = parseInt(document.body.style.top, 10);\n removeClass(document.body, swalClasses.iosfix);\n document.body.style.top = '';\n document.body.scrollTop = offset * -1;\n }\n };\n\n const SHOW_CLASS_TIMEOUT = 10;\n /**\n * Open popup, add necessary classes and styles, fix scrollbar\n *\n * @param params\n */\n\n const openPopup = params => {\n const container = getContainer();\n const popup = getPopup();\n\n if (typeof params.willOpen === 'function') {\n params.willOpen(popup);\n }\n\n const bodyStyles = window.getComputedStyle(document.body);\n const initialBodyOverflow = bodyStyles.overflowY;\n addClasses$1(container, popup, params); // scrolling is 'hidden' until animation is done, after that 'auto'\n\n setTimeout(() => {\n setScrollingVisibility(container, popup);\n }, SHOW_CLASS_TIMEOUT);\n\n if (isModal()) {\n fixScrollContainer(container, params.scrollbarPadding, initialBodyOverflow);\n setAriaHidden();\n }\n\n if (!isToast() && !globalState.previousActiveElement) {\n globalState.previousActiveElement = document.activeElement;\n }\n\n if (typeof params.didOpen === 'function') {\n setTimeout(() => params.didOpen(popup));\n }\n\n removeClass(container, swalClasses['no-transition']);\n };\n\n const swalOpenAnimationFinished = event => {\n const popup = getPopup();\n\n if (event.target !== popup) {\n return;\n }\n\n const container = getContainer();\n popup.removeEventListener(animationEndEvent, swalOpenAnimationFinished);\n container.style.overflowY = 'auto';\n };\n\n const setScrollingVisibility = (container, popup) => {\n if (animationEndEvent && hasCssAnimation(popup)) {\n container.style.overflowY = 'hidden';\n popup.addEventListener(animationEndEvent, swalOpenAnimationFinished);\n } else {\n container.style.overflowY = 'auto';\n }\n };\n\n const fixScrollContainer = (container, scrollbarPadding, initialBodyOverflow) => {\n iOSfix();\n\n if (scrollbarPadding && initialBodyOverflow !== 'hidden') {\n fixScrollbar();\n } // sweetalert2/issues/1247\n\n\n setTimeout(() => {\n container.scrollTop = 0;\n });\n };\n\n const addClasses$1 = (container, popup, params) => {\n addClass(container, params.showClass.backdrop); // this workaround with opacity is needed for https://github.com/sweetalert2/sweetalert2/issues/2059\n\n popup.style.setProperty('opacity', '0', 'important');\n show(popup, 'grid');\n setTimeout(() => {\n // Animate popup right after showing it\n addClass(popup, params.showClass.popup); // and remove the opacity workaround\n\n popup.style.removeProperty('opacity');\n }, SHOW_CLASS_TIMEOUT); // 10ms in order to fix #2062\n\n addClass([document.documentElement, document.body], swalClasses.shown);\n\n if (params.heightAuto && params.backdrop && !params.toast) {\n addClass([document.documentElement, document.body], swalClasses['height-auto']);\n }\n };\n\n /**\n * Shows loader (spinner), this is useful with AJAX requests.\n * By default the loader be shown instead of the \"Confirm\" button.\n */\n\n const showLoading = buttonToReplace => {\n let popup = getPopup();\n\n if (!popup) {\n new Swal(); // eslint-disable-line no-new\n }\n\n popup = getPopup();\n const loader = getLoader();\n\n if (isToast()) {\n hide(getIcon());\n } else {\n replaceButton(popup, buttonToReplace);\n }\n\n show(loader);\n popup.setAttribute('data-loading', true);\n popup.setAttribute('aria-busy', true);\n popup.focus();\n };\n\n const replaceButton = (popup, buttonToReplace) => {\n const actions = getActions();\n const loader = getLoader();\n\n if (!buttonToReplace && isVisible(getConfirmButton())) {\n buttonToReplace = getConfirmButton();\n }\n\n show(actions);\n\n if (buttonToReplace) {\n hide(buttonToReplace);\n loader.setAttribute('data-button-to-replace', buttonToReplace.className);\n }\n\n loader.parentNode.insertBefore(loader, buttonToReplace);\n addClass([popup, actions], swalClasses.loading);\n };\n\n const handleInputOptionsAndValue = (instance, params) => {\n if (params.input === 'select' || params.input === 'radio') {\n handleInputOptions(instance, params);\n } else if (['text', 'email', 'number', 'tel', 'textarea'].includes(params.input) && (hasToPromiseFn(params.inputValue) || isPromise(params.inputValue))) {\n showLoading(getConfirmButton());\n handleInputValue(instance, params);\n }\n };\n const getInputValue = (instance, innerParams) => {\n const input = instance.getInput();\n\n if (!input) {\n return null;\n }\n\n switch (innerParams.input) {\n case 'checkbox':\n return getCheckboxValue(input);\n\n case 'radio':\n return getRadioValue(input);\n\n case 'file':\n return getFileValue(input);\n\n default:\n return innerParams.inputAutoTrim ? input.value.trim() : input.value;\n }\n };\n\n const getCheckboxValue = input => input.checked ? 1 : 0;\n\n const getRadioValue = input => input.checked ? input.value : null;\n\n const getFileValue = input => input.files.length ? input.getAttribute('multiple') !== null ? input.files : input.files[0] : null;\n\n const handleInputOptions = (instance, params) => {\n const popup = getPopup();\n\n const processInputOptions = inputOptions => populateInputOptions[params.input](popup, formatInputOptions(inputOptions), params);\n\n if (hasToPromiseFn(params.inputOptions) || isPromise(params.inputOptions)) {\n showLoading(getConfirmButton());\n asPromise(params.inputOptions).then(inputOptions => {\n instance.hideLoading();\n processInputOptions(inputOptions);\n });\n } else if (typeof params.inputOptions === 'object') {\n processInputOptions(params.inputOptions);\n } else {\n error(\"Unexpected type of inputOptions! Expected object, Map or Promise, got \".concat(typeof params.inputOptions));\n }\n };\n\n const handleInputValue = (instance, params) => {\n const input = instance.getInput();\n hide(input);\n asPromise(params.inputValue).then(inputValue => {\n input.value = params.input === 'number' ? parseFloat(inputValue) || 0 : \"\".concat(inputValue);\n show(input);\n input.focus();\n instance.hideLoading();\n }).catch(err => {\n error(\"Error in inputValue promise: \".concat(err));\n input.value = '';\n show(input);\n input.focus();\n instance.hideLoading();\n });\n };\n\n const populateInputOptions = {\n select: (popup, inputOptions, params) => {\n const select = getDirectChildByClass(popup, swalClasses.select);\n\n const renderOption = (parent, optionLabel, optionValue) => {\n const option = document.createElement('option');\n option.value = optionValue;\n setInnerHtml(option, optionLabel);\n option.selected = isSelected(optionValue, params.inputValue);\n parent.appendChild(option);\n };\n\n inputOptions.forEach(inputOption => {\n const optionValue = inputOption[0];\n const optionLabel = inputOption[1]; // spec:\n // https://www.w3.org/TR/html401/interact/forms.html#h-17.6\n // \"...all OPTGROUP elements must be specified directly within a SELECT element (i.e., groups may not be nested)...\"\n // check whether this is a \n\n if (Array.isArray(optionLabel)) {\n // if it is an array, then it is an \n const optgroup = document.createElement('optgroup');\n optgroup.label = optionValue;\n optgroup.disabled = false; // not configurable for now\n\n select.appendChild(optgroup);\n optionLabel.forEach(o => renderOption(optgroup, o[1], o[0]));\n } else {\n // case of \n valueFormatted = formatInputOptions(valueFormatted);\n }\n\n result.push([key, valueFormatted]);\n });\n } else {\n Object.keys(inputOptions).forEach(key => {\n let valueFormatted = inputOptions[key];\n\n if (typeof valueFormatted === 'object') {\n // case of \n valueFormatted = formatInputOptions(valueFormatted);\n }\n\n result.push([key, valueFormatted]);\n });\n }\n\n return result;\n };\n\n const isSelected = (optionValue, inputValue) => {\n return inputValue && inputValue.toString() === optionValue.toString();\n };\n\n /**\n * Hides loader and shows back the button which was hidden by .showLoading()\n */\n\n function hideLoading() {\n // do nothing if popup is closed\n const innerParams = privateProps.innerParams.get(this);\n\n if (!innerParams) {\n return;\n }\n\n const domCache = privateProps.domCache.get(this);\n hide(domCache.loader);\n\n if (isToast()) {\n if (innerParams.icon) {\n show(getIcon());\n }\n } else {\n showRelatedButton(domCache);\n }\n\n removeClass([domCache.popup, domCache.actions], swalClasses.loading);\n domCache.popup.removeAttribute('aria-busy');\n domCache.popup.removeAttribute('data-loading');\n domCache.confirmButton.disabled = false;\n domCache.denyButton.disabled = false;\n domCache.cancelButton.disabled = false;\n }\n\n const showRelatedButton = domCache => {\n const buttonToReplace = domCache.popup.getElementsByClassName(domCache.loader.getAttribute('data-button-to-replace'));\n\n if (buttonToReplace.length) {\n show(buttonToReplace[0], 'inline-block');\n } else if (allButtonsAreHidden()) {\n hide(domCache.actions);\n }\n };\n\n /**\n * Gets the input DOM node, this method works with input parameter.\n * @returns {HTMLElement | null}\n */\n\n function getInput$1(instance) {\n const innerParams = privateProps.innerParams.get(instance || this);\n const domCache = privateProps.domCache.get(instance || this);\n\n if (!domCache) {\n return null;\n }\n\n return getInput(domCache.popup, innerParams.input);\n }\n\n /**\n * This module contains `WeakMap`s for each effectively-\"private property\" that a `Swal` has.\n * For example, to set the private property \"foo\" of `this` to \"bar\", you can `privateProps.foo.set(this, 'bar')`\n * This is the approach that Babel will probably take to implement private methods/fields\n * https://github.com/tc39/proposal-private-methods\n * https://github.com/babel/babel/pull/7555\n * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module*\n * then we can use that language feature.\n */\n var privateMethods = {\n swalPromiseResolve: new WeakMap(),\n swalPromiseReject: new WeakMap()\n };\n\n /*\n * Global function to determine if SweetAlert2 popup is shown\n */\n\n const isVisible$1 = () => {\n return isVisible(getPopup());\n };\n /*\n * Global function to click 'Confirm' button\n */\n\n const clickConfirm = () => getConfirmButton() && getConfirmButton().click();\n /*\n * Global function to click 'Deny' button\n */\n\n const clickDeny = () => getDenyButton() && getDenyButton().click();\n /*\n * Global function to click 'Cancel' button\n */\n\n const clickCancel = () => getCancelButton() && getCancelButton().click();\n\n const removeKeydownHandler = globalState => {\n if (globalState.keydownTarget && globalState.keydownHandlerAdded) {\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n };\n const addKeydownHandler = (instance, globalState, innerParams, dismissWith) => {\n removeKeydownHandler(globalState);\n\n if (!innerParams.toast) {\n globalState.keydownHandler = e => keydownHandler(instance, e, dismissWith);\n\n globalState.keydownTarget = innerParams.keydownListenerCapture ? window : getPopup();\n globalState.keydownListenerCapture = innerParams.keydownListenerCapture;\n globalState.keydownTarget.addEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = true;\n }\n }; // Focus handling\n\n const setFocus = (innerParams, index, increment) => {\n const focusableElements = getFocusableElements(); // search for visible elements and select the next possible match\n\n if (focusableElements.length) {\n index = index + increment; // rollover to first item\n\n if (index === focusableElements.length) {\n index = 0; // go to last item\n } else if (index === -1) {\n index = focusableElements.length - 1;\n }\n\n return focusableElements[index].focus();\n } // no visible focusable elements, focus the popup\n\n\n getPopup().focus();\n };\n const arrowKeysNextButton = ['ArrowRight', 'ArrowDown'];\n const arrowKeysPreviousButton = ['ArrowLeft', 'ArrowUp'];\n\n const keydownHandler = (instance, e, dismissWith) => {\n const innerParams = privateProps.innerParams.get(instance);\n\n if (!innerParams) {\n return; // This instance has already been destroyed\n } // Ignore keydown during IME composition\n // https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event#ignoring_keydown_during_ime_composition\n // https://github.com/sweetalert2/sweetalert2/issues/720\n // https://github.com/sweetalert2/sweetalert2/issues/2406\n\n\n if (e.isComposing || e.keyCode === 229) {\n return;\n }\n\n if (innerParams.stopKeydownPropagation) {\n e.stopPropagation();\n } // ENTER\n\n\n if (e.key === 'Enter') {\n handleEnter(instance, e, innerParams);\n } // TAB\n else if (e.key === 'Tab') {\n handleTab(e, innerParams);\n } // ARROWS - switch focus between buttons\n else if ([...arrowKeysNextButton, ...arrowKeysPreviousButton].includes(e.key)) {\n handleArrows(e.key);\n } // ESC\n else if (e.key === 'Escape') {\n handleEsc(e, innerParams, dismissWith);\n }\n };\n\n const handleEnter = (instance, e, innerParams) => {\n // https://github.com/sweetalert2/sweetalert2/issues/2386\n if (!callIfFunction(innerParams.allowEnterKey)) {\n return;\n }\n\n if (e.target && instance.getInput() && e.target.outerHTML === instance.getInput().outerHTML) {\n if (['textarea', 'file'].includes(innerParams.input)) {\n return; // do not submit\n }\n\n clickConfirm();\n e.preventDefault();\n }\n };\n\n const handleTab = (e, innerParams) => {\n const targetElement = e.target;\n const focusableElements = getFocusableElements();\n let btnIndex = -1;\n\n for (let i = 0; i < focusableElements.length; i++) {\n if (targetElement === focusableElements[i]) {\n btnIndex = i;\n break;\n }\n } // Cycle to the next button\n\n\n if (!e.shiftKey) {\n setFocus(innerParams, btnIndex, 1);\n } // Cycle to the prev button\n else {\n setFocus(innerParams, btnIndex, -1);\n }\n\n e.stopPropagation();\n e.preventDefault();\n };\n\n const handleArrows = key => {\n const confirmButton = getConfirmButton();\n const denyButton = getDenyButton();\n const cancelButton = getCancelButton();\n\n if (![confirmButton, denyButton, cancelButton].includes(document.activeElement)) {\n return;\n }\n\n const sibling = arrowKeysNextButton.includes(key) ? 'nextElementSibling' : 'previousElementSibling';\n let buttonToFocus = document.activeElement;\n\n for (let i = 0; i < getActions().children.length; i++) {\n buttonToFocus = buttonToFocus[sibling];\n\n if (!buttonToFocus) {\n return;\n }\n\n if (isVisible(buttonToFocus) && buttonToFocus instanceof HTMLButtonElement) {\n break;\n }\n }\n\n if (buttonToFocus instanceof HTMLButtonElement) {\n buttonToFocus.focus();\n }\n };\n\n const handleEsc = (e, innerParams, dismissWith) => {\n if (callIfFunction(innerParams.allowEscapeKey)) {\n e.preventDefault();\n dismissWith(DismissReason.esc);\n }\n };\n\n /*\n * Instance method to close sweetAlert\n */\n\n function removePopupAndResetState(instance, container, returnFocus, didClose) {\n if (isToast()) {\n triggerDidCloseAndDispose(instance, didClose);\n } else {\n restoreActiveElement(returnFocus).then(() => triggerDidCloseAndDispose(instance, didClose));\n removeKeydownHandler(globalState);\n }\n\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); // workaround for #2088\n // for some reason removing the container in Safari will scroll the document to bottom\n\n if (isSafari) {\n container.setAttribute('style', 'display:none !important');\n container.removeAttribute('class');\n container.innerHTML = '';\n } else {\n container.remove();\n }\n\n if (isModal()) {\n undoScrollbar();\n undoIOSfix();\n unsetAriaHidden();\n }\n\n removeBodyClasses();\n }\n\n function removeBodyClasses() {\n removeClass([document.documentElement, document.body], [swalClasses.shown, swalClasses['height-auto'], swalClasses['no-backdrop'], swalClasses['toast-shown']]);\n }\n\n function close(resolveValue) {\n resolveValue = prepareResolveValue(resolveValue);\n const swalPromiseResolve = privateMethods.swalPromiseResolve.get(this);\n const didClose = triggerClosePopup(this);\n\n if (this.isAwaitingPromise()) {\n // A swal awaiting for a promise (after a click on Confirm or Deny) cannot be dismissed anymore #2335\n if (!resolveValue.isDismissed) {\n handleAwaitingPromise(this);\n swalPromiseResolve(resolveValue);\n }\n } else if (didClose) {\n // Resolve Swal promise\n swalPromiseResolve(resolveValue);\n }\n }\n function isAwaitingPromise() {\n return !!privateProps.awaitingPromise.get(this);\n }\n\n const triggerClosePopup = instance => {\n const popup = getPopup();\n\n if (!popup) {\n return false;\n }\n\n const innerParams = privateProps.innerParams.get(instance);\n\n if (!innerParams || hasClass(popup, innerParams.hideClass.popup)) {\n return false;\n }\n\n removeClass(popup, innerParams.showClass.popup);\n addClass(popup, innerParams.hideClass.popup);\n const backdrop = getContainer();\n removeClass(backdrop, innerParams.showClass.backdrop);\n addClass(backdrop, innerParams.hideClass.backdrop);\n handlePopupAnimation(instance, popup, innerParams);\n return true;\n };\n\n function rejectPromise(error) {\n const rejectPromise = privateMethods.swalPromiseReject.get(this);\n handleAwaitingPromise(this);\n\n if (rejectPromise) {\n // Reject Swal promise\n rejectPromise(error);\n }\n }\n const handleAwaitingPromise = instance => {\n if (instance.isAwaitingPromise()) {\n privateProps.awaitingPromise.delete(instance); // The instance might have been previously partly destroyed, we must resume the destroy process in this case #2335\n\n if (!privateProps.innerParams.get(instance)) {\n instance._destroy();\n }\n }\n };\n\n const prepareResolveValue = resolveValue => {\n // When user calls Swal.close()\n if (typeof resolveValue === 'undefined') {\n return {\n isConfirmed: false,\n isDenied: false,\n isDismissed: true\n };\n }\n\n return Object.assign({\n isConfirmed: false,\n isDenied: false,\n isDismissed: false\n }, resolveValue);\n };\n\n const handlePopupAnimation = (instance, popup, innerParams) => {\n const container = getContainer(); // If animation is supported, animate\n\n const animationIsSupported = animationEndEvent && hasCssAnimation(popup);\n\n if (typeof innerParams.willClose === 'function') {\n innerParams.willClose(popup);\n }\n\n if (animationIsSupported) {\n animatePopup(instance, popup, container, innerParams.returnFocus, innerParams.didClose);\n } else {\n // Otherwise, remove immediately\n removePopupAndResetState(instance, container, innerParams.returnFocus, innerParams.didClose);\n }\n };\n\n const animatePopup = (instance, popup, container, returnFocus, didClose) => {\n globalState.swalCloseEventFinishedCallback = removePopupAndResetState.bind(null, instance, container, returnFocus, didClose);\n popup.addEventListener(animationEndEvent, function (e) {\n if (e.target === popup) {\n globalState.swalCloseEventFinishedCallback();\n delete globalState.swalCloseEventFinishedCallback;\n }\n });\n };\n\n const triggerDidCloseAndDispose = (instance, didClose) => {\n setTimeout(() => {\n if (typeof didClose === 'function') {\n didClose.bind(instance.params)();\n }\n\n instance._destroy();\n });\n };\n\n function setButtonsDisabled(instance, buttons, disabled) {\n const domCache = privateProps.domCache.get(instance);\n buttons.forEach(button => {\n domCache[button].disabled = disabled;\n });\n }\n\n function setInputDisabled(input, disabled) {\n if (!input) {\n return false;\n }\n\n if (input.type === 'radio') {\n const radiosContainer = input.parentNode.parentNode;\n const radios = radiosContainer.querySelectorAll('input');\n\n for (let i = 0; i < radios.length; i++) {\n radios[i].disabled = disabled;\n }\n } else {\n input.disabled = disabled;\n }\n }\n\n function enableButtons() {\n setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], false);\n }\n function disableButtons() {\n setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], true);\n }\n function enableInput() {\n return setInputDisabled(this.getInput(), false);\n }\n function disableInput() {\n return setInputDisabled(this.getInput(), true);\n }\n\n function showValidationMessage(error) {\n const domCache = privateProps.domCache.get(this);\n const params = privateProps.innerParams.get(this);\n setInnerHtml(domCache.validationMessage, error);\n domCache.validationMessage.className = swalClasses['validation-message'];\n\n if (params.customClass && params.customClass.validationMessage) {\n addClass(domCache.validationMessage, params.customClass.validationMessage);\n }\n\n show(domCache.validationMessage);\n const input = this.getInput();\n\n if (input) {\n input.setAttribute('aria-invalid', true);\n input.setAttribute('aria-describedby', swalClasses['validation-message']);\n focusInput(input);\n addClass(input, swalClasses.inputerror);\n }\n } // Hide block with validation message\n\n function resetValidationMessage$1() {\n const domCache = privateProps.domCache.get(this);\n\n if (domCache.validationMessage) {\n hide(domCache.validationMessage);\n }\n\n const input = this.getInput();\n\n if (input) {\n input.removeAttribute('aria-invalid');\n input.removeAttribute('aria-describedby');\n removeClass(input, swalClasses.inputerror);\n }\n }\n\n function getProgressSteps$1() {\n const domCache = privateProps.domCache.get(this);\n return domCache.progressSteps;\n }\n\n /**\n * Updates popup parameters.\n */\n\n function update(params) {\n const popup = getPopup();\n const innerParams = privateProps.innerParams.get(this);\n\n if (!popup || hasClass(popup, innerParams.hideClass.popup)) {\n return warn(\"You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.\");\n }\n\n const validUpdatableParams = filterValidParams(params);\n const updatedParams = Object.assign({}, innerParams, validUpdatableParams);\n render(this, updatedParams);\n privateProps.innerParams.set(this, updatedParams);\n Object.defineProperties(this, {\n params: {\n value: Object.assign({}, this.params, params),\n writable: false,\n enumerable: true\n }\n });\n }\n\n const filterValidParams = params => {\n const validUpdatableParams = {};\n Object.keys(params).forEach(param => {\n if (isUpdatableParameter(param)) {\n validUpdatableParams[param] = params[param];\n } else {\n warn(\"Invalid parameter to update: \\\"\".concat(param, \"\\\". Updatable params are listed here: https://github.com/sweetalert2/sweetalert2/blob/master/src/utils/params.js\\n\\nIf you think this parameter should be updatable, request it here: https://github.com/sweetalert2/sweetalert2/issues/new?template=02_feature_request.md\"));\n }\n });\n return validUpdatableParams;\n };\n\n function _destroy() {\n const domCache = privateProps.domCache.get(this);\n const innerParams = privateProps.innerParams.get(this);\n\n if (!innerParams) {\n disposeWeakMaps(this); // The WeakMaps might have been partly destroyed, we must recall it to dispose any remaining WeakMaps #2335\n\n return; // This instance has already been destroyed\n } // Check if there is another Swal closing\n\n\n if (domCache.popup && globalState.swalCloseEventFinishedCallback) {\n globalState.swalCloseEventFinishedCallback();\n delete globalState.swalCloseEventFinishedCallback;\n } // Check if there is a swal disposal defer timer\n\n\n if (globalState.deferDisposalTimer) {\n clearTimeout(globalState.deferDisposalTimer);\n delete globalState.deferDisposalTimer;\n }\n\n if (typeof innerParams.didDestroy === 'function') {\n innerParams.didDestroy();\n }\n\n disposeSwal(this);\n }\n\n const disposeSwal = instance => {\n disposeWeakMaps(instance); // Unset this.params so GC will dispose it (#1569)\n\n delete instance.params; // Unset globalState props so GC will dispose globalState (#1569)\n\n delete globalState.keydownHandler;\n delete globalState.keydownTarget; // Unset currentInstance\n\n delete globalState.currentInstance;\n };\n\n const disposeWeakMaps = instance => {\n // If the current instance is awaiting a promise result, we keep the privateMethods to call them once the promise result is retrieved #2335\n if (instance.isAwaitingPromise()) {\n unsetWeakMaps(privateProps, instance);\n privateProps.awaitingPromise.set(instance, true);\n } else {\n unsetWeakMaps(privateMethods, instance);\n unsetWeakMaps(privateProps, instance);\n }\n };\n\n const unsetWeakMaps = (obj, instance) => {\n for (const i in obj) {\n obj[i].delete(instance);\n }\n };\n\n\n\n var instanceMethods = /*#__PURE__*/Object.freeze({\n hideLoading: hideLoading,\n disableLoading: hideLoading,\n getInput: getInput$1,\n close: close,\n isAwaitingPromise: isAwaitingPromise,\n rejectPromise: rejectPromise,\n handleAwaitingPromise: handleAwaitingPromise,\n closePopup: close,\n closeModal: close,\n closeToast: close,\n enableButtons: enableButtons,\n disableButtons: disableButtons,\n enableInput: enableInput,\n disableInput: disableInput,\n showValidationMessage: showValidationMessage,\n resetValidationMessage: resetValidationMessage$1,\n getProgressSteps: getProgressSteps$1,\n update: update,\n _destroy: _destroy\n });\n\n const handleConfirmButtonClick = instance => {\n const innerParams = privateProps.innerParams.get(instance);\n instance.disableButtons();\n\n if (innerParams.input) {\n handleConfirmOrDenyWithInput(instance, 'confirm');\n } else {\n confirm(instance, true);\n }\n };\n const handleDenyButtonClick = instance => {\n const innerParams = privateProps.innerParams.get(instance);\n instance.disableButtons();\n\n if (innerParams.returnInputValueOnDeny) {\n handleConfirmOrDenyWithInput(instance, 'deny');\n } else {\n deny(instance, false);\n }\n };\n const handleCancelButtonClick = (instance, dismissWith) => {\n instance.disableButtons();\n dismissWith(DismissReason.cancel);\n };\n\n const handleConfirmOrDenyWithInput = (instance, type\n /* 'confirm' | 'deny' */\n ) => {\n const innerParams = privateProps.innerParams.get(instance);\n\n if (!innerParams.input) {\n return error(\"The \\\"input\\\" parameter is needed to be set when using returnInputValueOn\".concat(capitalizeFirstLetter(type)));\n }\n\n const inputValue = getInputValue(instance, innerParams);\n\n if (innerParams.inputValidator) {\n handleInputValidator(instance, inputValue, type);\n } else if (!instance.getInput().checkValidity()) {\n instance.enableButtons();\n instance.showValidationMessage(innerParams.validationMessage);\n } else if (type === 'deny') {\n deny(instance, inputValue);\n } else {\n confirm(instance, inputValue);\n }\n };\n\n const handleInputValidator = (instance, inputValue, type\n /* 'confirm' | 'deny' */\n ) => {\n const innerParams = privateProps.innerParams.get(instance);\n instance.disableInput();\n const validationPromise = Promise.resolve().then(() => asPromise(innerParams.inputValidator(inputValue, innerParams.validationMessage)));\n validationPromise.then(validationMessage => {\n instance.enableButtons();\n instance.enableInput();\n\n if (validationMessage) {\n instance.showValidationMessage(validationMessage);\n } else if (type === 'deny') {\n deny(instance, inputValue);\n } else {\n confirm(instance, inputValue);\n }\n });\n };\n\n const deny = (instance, value) => {\n const innerParams = privateProps.innerParams.get(instance || undefined);\n\n if (innerParams.showLoaderOnDeny) {\n showLoading(getDenyButton());\n }\n\n if (innerParams.preDeny) {\n privateProps.awaitingPromise.set(instance || undefined, true); // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preDeny's promise is received\n\n const preDenyPromise = Promise.resolve().then(() => asPromise(innerParams.preDeny(value, innerParams.validationMessage)));\n preDenyPromise.then(preDenyValue => {\n if (preDenyValue === false) {\n instance.hideLoading();\n handleAwaitingPromise(instance);\n } else {\n instance.closePopup({\n isDenied: true,\n value: typeof preDenyValue === 'undefined' ? value : preDenyValue\n });\n }\n }).catch(error$$1 => rejectWith(instance || undefined, error$$1));\n } else {\n instance.closePopup({\n isDenied: true,\n value\n });\n }\n };\n\n const succeedWith = (instance, value) => {\n instance.closePopup({\n isConfirmed: true,\n value\n });\n };\n\n const rejectWith = (instance, error$$1) => {\n instance.rejectPromise(error$$1);\n };\n\n const confirm = (instance, value) => {\n const innerParams = privateProps.innerParams.get(instance || undefined);\n\n if (innerParams.showLoaderOnConfirm) {\n showLoading();\n }\n\n if (innerParams.preConfirm) {\n instance.resetValidationMessage();\n privateProps.awaitingPromise.set(instance || undefined, true); // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preConfirm's promise is received\n\n const preConfirmPromise = Promise.resolve().then(() => asPromise(innerParams.preConfirm(value, innerParams.validationMessage)));\n preConfirmPromise.then(preConfirmValue => {\n if (isVisible(getValidationMessage()) || preConfirmValue === false) {\n instance.hideLoading();\n handleAwaitingPromise(instance);\n } else {\n succeedWith(instance, typeof preConfirmValue === 'undefined' ? value : preConfirmValue);\n }\n }).catch(error$$1 => rejectWith(instance || undefined, error$$1));\n } else {\n succeedWith(instance, value);\n }\n };\n\n const handlePopupClick = (instance, domCache, dismissWith) => {\n const innerParams = privateProps.innerParams.get(instance);\n\n if (innerParams.toast) {\n handleToastClick(instance, domCache, dismissWith);\n } else {\n // Ignore click events that had mousedown on the popup but mouseup on the container\n // This can happen when the user drags a slider\n handleModalMousedown(domCache); // Ignore click events that had mousedown on the container but mouseup on the popup\n\n handleContainerMousedown(domCache);\n handleModalClick(instance, domCache, dismissWith);\n }\n };\n\n const handleToastClick = (instance, domCache, dismissWith) => {\n // Closing toast by internal click\n domCache.popup.onclick = () => {\n const innerParams = privateProps.innerParams.get(instance);\n\n if (innerParams && (isAnyButtonShown(innerParams) || innerParams.timer || innerParams.input)) {\n return;\n }\n\n dismissWith(DismissReason.close);\n };\n };\n /**\n * @param {*} innerParams\n * @returns {boolean}\n */\n\n\n const isAnyButtonShown = innerParams => {\n return innerParams.showConfirmButton || innerParams.showDenyButton || innerParams.showCancelButton || innerParams.showCloseButton;\n };\n\n let ignoreOutsideClick = false;\n\n const handleModalMousedown = domCache => {\n domCache.popup.onmousedown = () => {\n domCache.container.onmouseup = function (e) {\n domCache.container.onmouseup = undefined; // We only check if the mouseup target is the container because usually it doesn't\n // have any other direct children aside of the popup\n\n if (e.target === domCache.container) {\n ignoreOutsideClick = true;\n }\n };\n };\n };\n\n const handleContainerMousedown = domCache => {\n domCache.container.onmousedown = () => {\n domCache.popup.onmouseup = function (e) {\n domCache.popup.onmouseup = undefined; // We also need to check if the mouseup target is a child of the popup\n\n if (e.target === domCache.popup || domCache.popup.contains(e.target)) {\n ignoreOutsideClick = true;\n }\n };\n };\n };\n\n const handleModalClick = (instance, domCache, dismissWith) => {\n domCache.container.onclick = e => {\n const innerParams = privateProps.innerParams.get(instance);\n\n if (ignoreOutsideClick) {\n ignoreOutsideClick = false;\n return;\n }\n\n if (e.target === domCache.container && callIfFunction(innerParams.allowOutsideClick)) {\n dismissWith(DismissReason.backdrop);\n }\n };\n };\n\n const isJqueryElement = elem => typeof elem === 'object' && elem.jquery;\n\n const isElement = elem => elem instanceof Element || isJqueryElement(elem);\n\n const argsToParams = args => {\n const params = {};\n\n if (typeof args[0] === 'object' && !isElement(args[0])) {\n Object.assign(params, args[0]);\n } else {\n ['title', 'html', 'icon'].forEach((name, index) => {\n const arg = args[index];\n\n if (typeof arg === 'string' || isElement(arg)) {\n params[name] = arg;\n } else if (arg !== undefined) {\n error(\"Unexpected type of \".concat(name, \"! Expected \\\"string\\\" or \\\"Element\\\", got \").concat(typeof arg));\n }\n });\n }\n\n return params;\n };\n\n function fire() {\n const Swal = this; // eslint-disable-line @typescript-eslint/no-this-alias\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return new Swal(...args);\n }\n\n /**\n * Returns an extended version of `Swal` containing `params` as defaults.\n * Useful for reusing Swal configuration.\n *\n * For example:\n *\n * Before:\n * const textPromptOptions = { input: 'text', showCancelButton: true }\n * const {value: firstName} = await Swal.fire({ ...textPromptOptions, title: 'What is your first name?' })\n * const {value: lastName} = await Swal.fire({ ...textPromptOptions, title: 'What is your last name?' })\n *\n * After:\n * const TextPrompt = Swal.mixin({ input: 'text', showCancelButton: true })\n * const {value: firstName} = await TextPrompt('What is your first name?')\n * const {value: lastName} = await TextPrompt('What is your last name?')\n *\n * @param mixinParams\n */\n function mixin(mixinParams) {\n class MixinSwal extends this {\n _main(params, priorityMixinParams) {\n return super._main(params, Object.assign({}, mixinParams, priorityMixinParams));\n }\n\n }\n\n return MixinSwal;\n }\n\n /**\n * If `timer` parameter is set, returns number of milliseconds of timer remained.\n * Otherwise, returns undefined.\n */\n\n const getTimerLeft = () => {\n return globalState.timeout && globalState.timeout.getTimerLeft();\n };\n /**\n * Stop timer. Returns number of milliseconds of timer remained.\n * If `timer` parameter isn't set, returns undefined.\n */\n\n const stopTimer = () => {\n if (globalState.timeout) {\n stopTimerProgressBar();\n return globalState.timeout.stop();\n }\n };\n /**\n * Resume timer. Returns number of milliseconds of timer remained.\n * If `timer` parameter isn't set, returns undefined.\n */\n\n const resumeTimer = () => {\n if (globalState.timeout) {\n const remaining = globalState.timeout.start();\n animateTimerProgressBar(remaining);\n return remaining;\n }\n };\n /**\n * Resume timer. Returns number of milliseconds of timer remained.\n * If `timer` parameter isn't set, returns undefined.\n */\n\n const toggleTimer = () => {\n const timer = globalState.timeout;\n return timer && (timer.running ? stopTimer() : resumeTimer());\n };\n /**\n * Increase timer. Returns number of milliseconds of an updated timer.\n * If `timer` parameter isn't set, returns undefined.\n */\n\n const increaseTimer = n => {\n if (globalState.timeout) {\n const remaining = globalState.timeout.increase(n);\n animateTimerProgressBar(remaining, true);\n return remaining;\n }\n };\n /**\n * Check if timer is running. Returns true if timer is running\n * or false if timer is paused or stopped.\n * If `timer` parameter isn't set, returns undefined\n */\n\n const isTimerRunning = () => {\n return globalState.timeout && globalState.timeout.isRunning();\n };\n\n let bodyClickListenerAdded = false;\n const clickHandlers = {};\n function bindClickHandler() {\n let attr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'data-swal-template';\n clickHandlers[attr] = this;\n\n if (!bodyClickListenerAdded) {\n document.body.addEventListener('click', bodyClickListener);\n bodyClickListenerAdded = true;\n }\n }\n\n const bodyClickListener = event => {\n for (let el = event.target; el && el !== document; el = el.parentNode) {\n for (const attr in clickHandlers) {\n const template = el.getAttribute(attr);\n\n if (template) {\n clickHandlers[attr].fire({\n template\n });\n return;\n }\n }\n }\n };\n\n\n\n var staticMethods = /*#__PURE__*/Object.freeze({\n isValidParameter: isValidParameter,\n isUpdatableParameter: isUpdatableParameter,\n isDeprecatedParameter: isDeprecatedParameter,\n argsToParams: argsToParams,\n isVisible: isVisible$1,\n clickConfirm: clickConfirm,\n clickDeny: clickDeny,\n clickCancel: clickCancel,\n getContainer: getContainer,\n getPopup: getPopup,\n getTitle: getTitle,\n getHtmlContainer: getHtmlContainer,\n getImage: getImage,\n getIcon: getIcon,\n getInputLabel: getInputLabel,\n getCloseButton: getCloseButton,\n getActions: getActions,\n getConfirmButton: getConfirmButton,\n getDenyButton: getDenyButton,\n getCancelButton: getCancelButton,\n getLoader: getLoader,\n getFooter: getFooter,\n getTimerProgressBar: getTimerProgressBar,\n getFocusableElements: getFocusableElements,\n getValidationMessage: getValidationMessage,\n isLoading: isLoading,\n fire: fire,\n mixin: mixin,\n showLoading: showLoading,\n enableLoading: showLoading,\n getTimerLeft: getTimerLeft,\n stopTimer: stopTimer,\n resumeTimer: resumeTimer,\n toggleTimer: toggleTimer,\n increaseTimer: increaseTimer,\n isTimerRunning: isTimerRunning,\n bindClickHandler: bindClickHandler\n });\n\n let currentInstance;\n\n class SweetAlert {\n constructor() {\n // Prevent run in Node env\n if (typeof window === 'undefined') {\n return;\n }\n\n currentInstance = this; // @ts-ignore\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n const outerParams = Object.freeze(this.constructor.argsToParams(args));\n Object.defineProperties(this, {\n params: {\n value: outerParams,\n writable: false,\n enumerable: true,\n configurable: true\n }\n }); // @ts-ignore\n\n const promise = this._main(this.params);\n\n privateProps.promise.set(this, promise);\n }\n\n _main(userParams) {\n let mixinParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n showWarningsForParams(Object.assign({}, mixinParams, userParams));\n\n if (globalState.currentInstance) {\n globalState.currentInstance._destroy();\n\n if (isModal()) {\n unsetAriaHidden();\n }\n }\n\n globalState.currentInstance = this;\n const innerParams = prepareParams(userParams, mixinParams);\n setParameters(innerParams);\n Object.freeze(innerParams); // clear the previous timer\n\n if (globalState.timeout) {\n globalState.timeout.stop();\n delete globalState.timeout;\n } // clear the restore focus timeout\n\n\n clearTimeout(globalState.restoreFocusTimeout);\n const domCache = populateDomCache(this);\n render(this, innerParams);\n privateProps.innerParams.set(this, innerParams);\n return swalPromise(this, domCache, innerParams);\n } // `catch` cannot be the name of a module export, so we define our thenable methods here instead\n\n\n then(onFulfilled) {\n const promise = privateProps.promise.get(this);\n return promise.then(onFulfilled);\n }\n\n finally(onFinally) {\n const promise = privateProps.promise.get(this);\n return promise.finally(onFinally);\n }\n\n }\n\n const swalPromise = (instance, domCache, innerParams) => {\n return new Promise((resolve, reject) => {\n // functions to handle all closings/dismissals\n const dismissWith = dismiss => {\n instance.closePopup({\n isDismissed: true,\n dismiss\n });\n };\n\n privateMethods.swalPromiseResolve.set(instance, resolve);\n privateMethods.swalPromiseReject.set(instance, reject);\n\n domCache.confirmButton.onclick = () => handleConfirmButtonClick(instance);\n\n domCache.denyButton.onclick = () => handleDenyButtonClick(instance);\n\n domCache.cancelButton.onclick = () => handleCancelButtonClick(instance, dismissWith);\n\n domCache.closeButton.onclick = () => dismissWith(DismissReason.close);\n\n handlePopupClick(instance, domCache, dismissWith);\n addKeydownHandler(instance, globalState, innerParams, dismissWith);\n handleInputOptionsAndValue(instance, innerParams);\n openPopup(innerParams);\n setupTimer(globalState, innerParams, dismissWith);\n initFocus(domCache, innerParams); // Scroll container to top on open (#1247, #1946)\n\n setTimeout(() => {\n domCache.container.scrollTop = 0;\n });\n });\n };\n\n const prepareParams = (userParams, mixinParams) => {\n const templateParams = getTemplateParams(userParams);\n const params = Object.assign({}, defaultParams, mixinParams, templateParams, userParams); // precedence is described in #2131\n\n params.showClass = Object.assign({}, defaultParams.showClass, params.showClass);\n params.hideClass = Object.assign({}, defaultParams.hideClass, params.hideClass);\n return params;\n };\n\n const populateDomCache = instance => {\n const domCache = {\n popup: getPopup(),\n container: getContainer(),\n actions: getActions(),\n confirmButton: getConfirmButton(),\n denyButton: getDenyButton(),\n cancelButton: getCancelButton(),\n loader: getLoader(),\n closeButton: getCloseButton(),\n validationMessage: getValidationMessage(),\n progressSteps: getProgressSteps()\n };\n privateProps.domCache.set(instance, domCache);\n return domCache;\n };\n\n const setupTimer = (globalState$$1, innerParams, dismissWith) => {\n const timerProgressBar = getTimerProgressBar();\n hide(timerProgressBar);\n\n if (innerParams.timer) {\n globalState$$1.timeout = new Timer(() => {\n dismissWith('timer');\n delete globalState$$1.timeout;\n }, innerParams.timer);\n\n if (innerParams.timerProgressBar) {\n show(timerProgressBar);\n applyCustomClass(timerProgressBar, innerParams, 'timerProgressBar');\n setTimeout(() => {\n if (globalState$$1.timeout && globalState$$1.timeout.running) {\n // timer can be already stopped or unset at this point\n animateTimerProgressBar(innerParams.timer);\n }\n });\n }\n }\n };\n\n const initFocus = (domCache, innerParams) => {\n if (innerParams.toast) {\n return;\n }\n\n if (!callIfFunction(innerParams.allowEnterKey)) {\n return blurActiveElement();\n }\n\n if (!focusButton(domCache, innerParams)) {\n setFocus(innerParams, -1, 1);\n }\n };\n\n const focusButton = (domCache, innerParams) => {\n if (innerParams.focusDeny && isVisible(domCache.denyButton)) {\n domCache.denyButton.focus();\n return true;\n }\n\n if (innerParams.focusCancel && isVisible(domCache.cancelButton)) {\n domCache.cancelButton.focus();\n return true;\n }\n\n if (innerParams.focusConfirm && isVisible(domCache.confirmButton)) {\n domCache.confirmButton.focus();\n return true;\n }\n\n return false;\n };\n\n const blurActiveElement = () => {\n if (document.activeElement instanceof HTMLElement && typeof document.activeElement.blur === 'function') {\n document.activeElement.blur();\n }\n }; // Assign instance methods from src/instanceMethods/*.js to prototype\n\n\n Object.assign(SweetAlert.prototype, instanceMethods); // Assign static methods from src/staticMethods/*.js to constructor\n\n Object.assign(SweetAlert, staticMethods); // Proxy to instance methods to constructor, for now, for backwards compatibility\n\n Object.keys(instanceMethods).forEach(key => {\n SweetAlert[key] = function () {\n if (currentInstance) {\n return currentInstance[key](...arguments);\n }\n };\n });\n SweetAlert.DismissReason = DismissReason;\n SweetAlert.version = '11.4.8';\n\n const Swal = SweetAlert; // @ts-ignore\n\n Swal.default = Swal;\n\n return Swal;\n\n}));\nif (typeof this !== 'undefined' && this.Sweetalert2){ this.swal = this.sweetAlert = this.Swal = this.SweetAlert = this.Sweetalert2}\n\n\"undefined\"!=typeof document&&function(e,t){var n=e.createElement(\"style\");if(e.getElementsByTagName(\"head\")[0].appendChild(n),n.styleSheet)n.styleSheet.disabled||(n.styleSheet.cssText=t);else try{n.innerHTML=t}catch(e){n.innerText=t}}(document,\".swal2-popup.swal2-toast{box-sizing:border-box;grid-column:1/4!important;grid-row:1/4!important;grid-template-columns:1fr 99fr 1fr;padding:1em;overflow-y:hidden;background:#fff;box-shadow:0 0 1px rgba(0,0,0,.075),0 1px 2px rgba(0,0,0,.075),1px 2px 4px rgba(0,0,0,.075),1px 3px 8px rgba(0,0,0,.075),2px 4px 16px rgba(0,0,0,.075);pointer-events:all}.swal2-popup.swal2-toast>*{grid-column:2}.swal2-popup.swal2-toast .swal2-title{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-loading{justify-content:center}.swal2-popup.swal2-toast .swal2-input{height:2em;margin:.5em;font-size:1em}.swal2-popup.swal2-toast .swal2-validation-message{font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-popup.swal2-toast .swal2-html-container{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-html-container:empty{padding:0}.swal2-popup.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-popup.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:700}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-popup.swal2-toast .swal2-styled{margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;transform:rotate(45deg);border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.8em;left:-.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-toast-animate-success-line-tip .75s;animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-toast-animate-success-line-long .75s;animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{-webkit-animation:swal2-toast-show .5s;animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{-webkit-animation:swal2-toast-hide .1s forwards;animation:swal2-toast-hide .1s forwards}.swal2-container{display:grid;position:fixed;z-index:1060;top:0;right:0;bottom:0;left:0;box-sizing:border-box;grid-template-areas:\\\"top-start top top-end\\\" \\\"center-start center center-end\\\" \\\"bottom-start bottom-center bottom-end\\\";grid-template-rows:minmax(-webkit-min-content,auto) minmax(-webkit-min-content,auto) minmax(-webkit-min-content,auto);grid-template-rows:minmax(min-content,auto) minmax(min-content,auto) minmax(min-content,auto);height:100%;padding:.625em;overflow-x:hidden;transition:background-color .1s;-webkit-overflow-scrolling:touch}.swal2-container.swal2-backdrop-show,.swal2-container.swal2-noanimation{background:rgba(0,0,0,.4)}.swal2-container.swal2-backdrop-hide{background:0 0!important}.swal2-container.swal2-bottom-start,.swal2-container.swal2-center-start,.swal2-container.swal2-top-start{grid-template-columns:minmax(0,1fr) auto auto}.swal2-container.swal2-bottom,.swal2-container.swal2-center,.swal2-container.swal2-top{grid-template-columns:auto minmax(0,1fr) auto}.swal2-container.swal2-bottom-end,.swal2-container.swal2-center-end,.swal2-container.swal2-top-end{grid-template-columns:auto auto minmax(0,1fr)}.swal2-container.swal2-top-start>.swal2-popup{align-self:start}.swal2-container.swal2-top>.swal2-popup{grid-column:2;align-self:start;justify-self:center}.swal2-container.swal2-top-end>.swal2-popup,.swal2-container.swal2-top-right>.swal2-popup{grid-column:3;align-self:start;justify-self:end}.swal2-container.swal2-center-left>.swal2-popup,.swal2-container.swal2-center-start>.swal2-popup{grid-row:2;align-self:center}.swal2-container.swal2-center>.swal2-popup{grid-column:2;grid-row:2;align-self:center;justify-self:center}.swal2-container.swal2-center-end>.swal2-popup,.swal2-container.swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;align-self:center;justify-self:end}.swal2-container.swal2-bottom-left>.swal2-popup,.swal2-container.swal2-bottom-start>.swal2-popup{grid-column:1;grid-row:3;align-self:end}.swal2-container.swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;justify-self:center;align-self:end}.swal2-container.swal2-bottom-end>.swal2-popup,.swal2-container.swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;align-self:end;justify-self:end}.swal2-container.swal2-grow-fullscreen>.swal2-popup,.swal2-container.swal2-grow-row>.swal2-popup{grid-column:1/4;width:100%}.swal2-container.swal2-grow-column>.swal2-popup,.swal2-container.swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}.swal2-container.swal2-no-transition{transition:none!important}.swal2-popup{display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0,100%);width:32em;max-width:100%;padding:0 0 1.25em;border:none;border-radius:5px;background:#fff;color:#545454;font-family:inherit;font-size:1rem}.swal2-popup:focus{outline:0}.swal2-popup.swal2-loading{overflow-y:hidden}.swal2-title{position:relative;max-width:100%;margin:0;padding:.8em 1em 0;color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}.swal2-actions{display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;width:auto;margin:1.25em auto 0;padding:0}.swal2-actions:not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}.swal2-actions:not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,.1))}.swal2-actions:not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0,0,0,.2),rgba(0,0,0,.2))}.swal2-loader{display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 transparent #2778c4 transparent}.swal2-styled{margin:.3125em;padding:.625em 1.1em;transition:box-shadow .1s;box-shadow:0 0 0 3px transparent;font-weight:500}.swal2-styled:not([disabled]){cursor:pointer}.swal2-styled.swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#7066e0;color:#fff;font-size:1em}.swal2-styled.swal2-confirm:focus{box-shadow:0 0 0 3px rgba(112,102,224,.5)}.swal2-styled.swal2-deny{border:0;border-radius:.25em;background:initial;background-color:#dc3741;color:#fff;font-size:1em}.swal2-styled.swal2-deny:focus{box-shadow:0 0 0 3px rgba(220,55,65,.5)}.swal2-styled.swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#6e7881;color:#fff;font-size:1em}.swal2-styled.swal2-cancel:focus{box-shadow:0 0 0 3px rgba(110,120,129,.5)}.swal2-styled.swal2-default-outline:focus{box-shadow:0 0 0 3px rgba(100,150,200,.5)}.swal2-styled:focus{outline:0}.swal2-styled::-moz-focus-inner{border:0}.swal2-footer{justify-content:center;margin:1em 0 0;padding:1em 1em 0;border-top:1px solid #eee;color:inherit;font-size:1em}.swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto!important;overflow:hidden;border-bottom-right-radius:5px;border-bottom-left-radius:5px}.swal2-timer-progress-bar{width:100%;height:.25em;background:rgba(0,0,0,.2)}.swal2-image{max-width:100%;margin:2em auto 1em}.swal2-close{z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:color .1s,box-shadow .1s;border:none;border-radius:5px;background:0 0;color:#ccc;font-family:serif;font-family:monospace;font-size:2.5em;cursor:pointer;justify-self:end}.swal2-close:hover{transform:none;background:0 0;color:#f27474}.swal2-close:focus{outline:0;box-shadow:inset 0 0 0 3px rgba(100,150,200,.5)}.swal2-close::-moz-focus-inner{border:0}.swal2-html-container{z-index:1;justify-content:center;margin:1em 1.6em .3em;padding:0;overflow:auto;color:inherit;font-size:1.125em;font-weight:400;line-height:normal;text-align:center;word-wrap:break-word;word-break:break-word}.swal2-checkbox,.swal2-file,.swal2-input,.swal2-radio,.swal2-select,.swal2-textarea{margin:1em 2em 3px}.swal2-file,.swal2-input,.swal2-textarea{box-sizing:border-box;width:auto;transition:border-color .1s,box-shadow .1s;border:1px solid #d9d9d9;border-radius:.1875em;background:inherit;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px transparent;color:inherit;font-size:1.125em}.swal2-file.swal2-inputerror,.swal2-input.swal2-inputerror,.swal2-textarea.swal2-inputerror{border-color:#f27474!important;box-shadow:0 0 2px #f27474!important}.swal2-file:focus,.swal2-input:focus,.swal2-textarea:focus{border:1px solid #b4dbed;outline:0;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(100,150,200,.5)}.swal2-file::-moz-placeholder,.swal2-input::-moz-placeholder,.swal2-textarea::-moz-placeholder{color:#ccc}.swal2-file:-ms-input-placeholder,.swal2-input:-ms-input-placeholder,.swal2-textarea:-ms-input-placeholder{color:#ccc}.swal2-file::placeholder,.swal2-input::placeholder,.swal2-textarea::placeholder{color:#ccc}.swal2-range{margin:1em 2em 3px;background:#fff}.swal2-range input{width:80%}.swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}.swal2-range input,.swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}.swal2-input{height:2.625em;padding:0 .75em}.swal2-file{width:75%;margin-right:auto;margin-left:auto;background:inherit;font-size:1.125em}.swal2-textarea{height:6.75em;padding:.75em}.swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:inherit;color:inherit;font-size:1.125em}.swal2-checkbox,.swal2-radio{align-items:center;justify-content:center;background:#fff;color:inherit}.swal2-checkbox label,.swal2-radio label{margin:0 .6em;font-size:1.125em}.swal2-checkbox input,.swal2-radio input{flex-shrink:0;margin:0 .4em}.swal2-input-label{display:flex;justify-content:center;margin:1em auto 0}.swal2-validation-message{align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}.swal2-validation-message::before{content:\\\"!\\\";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}.swal2-icon{position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;border:.25em solid transparent;border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}.swal2-icon.swal2-error{border-color:#f27474;color:#f27474}.swal2-icon.swal2-error .swal2-x-mark{position:relative;flex-grow:1}.swal2-icon.swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}.swal2-icon.swal2-error.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-error.swal2-icon-show .swal2-x-mark{-webkit-animation:swal2-animate-error-x-mark .5s;animation:swal2-animate-error-x-mark .5s}.swal2-icon.swal2-warning{border-color:#facea8;color:#f8bb86}.swal2-icon.swal2-warning.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-warning.swal2-icon-show .swal2-icon-content{-webkit-animation:swal2-animate-i-mark .5s;animation:swal2-animate-i-mark .5s}.swal2-icon.swal2-info{border-color:#9de0f6;color:#3fc3ee}.swal2-icon.swal2-info.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-info.swal2-icon-show .swal2-icon-content{-webkit-animation:swal2-animate-i-mark .8s;animation:swal2-animate-i-mark .8s}.swal2-icon.swal2-question{border-color:#c9dae1;color:#87adbd}.swal2-icon.swal2-question.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-question.swal2-icon-show .swal2-icon-content{-webkit-animation:swal2-animate-question-mark .8s;animation:swal2-animate-question-mark .8s}.swal2-icon.swal2-success{border-color:#a5dc86;color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;transform:rotate(45deg);border-radius:50%}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}.swal2-icon.swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-.25em;left:-.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}.swal2-icon.swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}.swal2-icon.swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-animate-success-line-tip .75s;animation:swal2-animate-success-line-tip .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-animate-success-line-long .75s;animation:swal2-animate-success-line-long .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-circular-line-right{-webkit-animation:swal2-rotate-success-circular-line 4.25s ease-in;animation:swal2-rotate-success-circular-line 4.25s ease-in}.swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:inherit;font-weight:600}.swal2-progress-steps li{display:inline-block;position:relative}.swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}.swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}[class^=swal2]{-webkit-tap-highlight-color:transparent}.swal2-show{-webkit-animation:swal2-show .3s;animation:swal2-show .3s}.swal2-hide{-webkit-animation:swal2-hide .15s forwards;animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@-webkit-keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@-webkit-keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@-webkit-keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@-webkit-keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@-webkit-keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@-webkit-keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@-webkit-keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@-webkit-keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@-webkit-keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@-webkit-keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@-webkit-keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@-webkit-keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@-webkit-keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@-webkit-keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto!important}body.swal2-no-backdrop .swal2-container{background-color:transparent!important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll!important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static!important}}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:transparent;pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{top:0;right:auto;bottom:auto;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{top:0;right:0;bottom:auto;left:auto}body.swal2-toast-shown .swal2-container.swal2-top-left,body.swal2-toast-shown .swal2-container.swal2-top-start{top:0;right:auto;bottom:auto;left:0}body.swal2-toast-shown .swal2-container.swal2-center-left,body.swal2-toast-shown .swal2-container.swal2-center-start{top:50%;right:auto;bottom:auto;left:0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{top:50%;right:auto;bottom:auto;left:50%;transform:translate(-50%,-50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{top:50%;right:0;bottom:auto;left:auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-left,body.swal2-toast-shown .swal2-container.swal2-bottom-start{top:auto;right:auto;bottom:0;left:0}body.swal2-toast-shown .swal2-container.swal2-bottom{top:auto;right:auto;bottom:0;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{top:auto;right:0;bottom:0;left:auto}\");", "/*! PhotoSwipe - v4.1.3 - 2019-01-08\n* http://photoswipe.com\n* Copyright (c) 2019 Dmitry Semenov; */\n(function (root, factory) { \n\tif (typeof define === 'function' && define.amd) {\n\t\tdefine(factory);\n\t} else if (typeof exports === 'object') {\n\t\tmodule.exports = factory();\n\t} else {\n\t\troot.PhotoSwipe = factory();\n\t}\n})(this, function () {\n\n\t'use strict';\n\tvar PhotoSwipe = function(template, UiClass, items, options){\n\n/*>>framework-bridge*/\n/**\n *\n * Set of generic functions used by gallery.\n * \n * You're free to modify anything here as long as functionality is kept.\n * \n */\nvar framework = {\n\tfeatures: null,\n\tbind: function(target, type, listener, unbind) {\n\t\tvar methodName = (unbind ? 'remove' : 'add') + 'EventListener';\n\t\ttype = type.split(' ');\n\t\tfor(var i = 0; i < type.length; i++) {\n\t\t\tif(type[i]) {\n\t\t\t\ttarget[methodName]( type[i], listener, false);\n\t\t\t}\n\t\t}\n\t},\n\tisArray: function(obj) {\n\t\treturn (obj instanceof Array);\n\t},\n\tcreateEl: function(classes, tag) {\n\t\tvar el = document.createElement(tag || 'div');\n\t\tif(classes) {\n\t\t\tel.className = classes;\n\t\t}\n\t\treturn el;\n\t},\n\tgetScrollY: function() {\n\t\tvar yOffset = window.pageYOffset;\n\t\treturn yOffset !== undefined ? yOffset : document.documentElement.scrollTop;\n\t},\n\tunbind: function(target, type, listener) {\n\t\tframework.bind(target,type,listener,true);\n\t},\n\tremoveClass: function(el, className) {\n\t\tvar reg = new RegExp('(\\\\s|^)' + className + '(\\\\s|$)');\n\t\tel.className = el.className.replace(reg, ' ').replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, ''); \n\t},\n\taddClass: function(el, className) {\n\t\tif( !framework.hasClass(el,className) ) {\n\t\t\tel.className += (el.className ? ' ' : '') + className;\n\t\t}\n\t},\n\thasClass: function(el, className) {\n\t\treturn el.className && new RegExp('(^|\\\\s)' + className + '(\\\\s|$)').test(el.className);\n\t},\n\tgetChildByClass: function(parentEl, childClassName) {\n\t\tvar node = parentEl.firstChild;\n\t\twhile(node) {\n\t\t\tif( framework.hasClass(node, childClassName) ) {\n\t\t\t\treturn node;\n\t\t\t}\n\t\t\tnode = node.nextSibling;\n\t\t}\n\t},\n\tarraySearch: function(array, value, key) {\n\t\tvar i = array.length;\n\t\twhile(i--) {\n\t\t\tif(array[i][key] === value) {\n\t\t\t\treturn i;\n\t\t\t} \n\t\t}\n\t\treturn -1;\n\t},\n\textend: function(o1, o2, preventOverwrite) {\n\t\tfor (var prop in o2) {\n\t\t\tif (o2.hasOwnProperty(prop)) {\n\t\t\t\tif(preventOverwrite && o1.hasOwnProperty(prop)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\to1[prop] = o2[prop];\n\t\t\t}\n\t\t}\n\t},\n\teasing: {\n\t\tsine: {\n\t\t\tout: function(k) {\n\t\t\t\treturn Math.sin(k * (Math.PI / 2));\n\t\t\t},\n\t\t\tinOut: function(k) {\n\t\t\t\treturn - (Math.cos(Math.PI * k) - 1) / 2;\n\t\t\t}\n\t\t},\n\t\tcubic: {\n\t\t\tout: function(k) {\n\t\t\t\treturn --k * k * k + 1;\n\t\t\t}\n\t\t}\n\t\t/*\n\t\t\telastic: {\n\t\t\t\tout: function ( k ) {\n\n\t\t\t\t\tvar s, a = 0.1, p = 0.4;\n\t\t\t\t\tif ( k === 0 ) return 0;\n\t\t\t\t\tif ( k === 1 ) return 1;\n\t\t\t\t\tif ( !a || a < 1 ) { a = 1; s = p / 4; }\n\t\t\t\t\telse s = p * Math.asin( 1 / a ) / ( 2 * Math.PI );\n\t\t\t\t\treturn ( a * Math.pow( 2, - 10 * k) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) + 1 );\n\n\t\t\t\t},\n\t\t\t},\n\t\t\tback: {\n\t\t\t\tout: function ( k ) {\n\t\t\t\t\tvar s = 1.70158;\n\t\t\t\t\treturn --k * k * ( ( s + 1 ) * k + s ) + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t*/\n\t},\n\n\t/**\n\t * \n\t * @return {object}\n\t * \n\t * {\n\t * raf : request animation frame function\n\t * caf : cancel animation frame function\n\t * transfrom : transform property key (with vendor), or null if not supported\n\t * oldIE : IE8 or below\n\t * }\n\t * \n\t */\n\tdetectFeatures: function() {\n\t\tif(framework.features) {\n\t\t\treturn framework.features;\n\t\t}\n\t\tvar helperEl = framework.createEl(),\n\t\t\thelperStyle = helperEl.style,\n\t\t\tvendor = '',\n\t\t\tfeatures = {};\n\n\t\t// IE8 and below\n\t\tfeatures.oldIE = document.all && !document.addEventListener;\n\n\t\tfeatures.touch = 'ontouchstart' in window;\n\n\t\tif(window.requestAnimationFrame) {\n\t\t\tfeatures.raf = window.requestAnimationFrame;\n\t\t\tfeatures.caf = window.cancelAnimationFrame;\n\t\t}\n\n\t\tfeatures.pointerEvent = !!(window.PointerEvent) || navigator.msPointerEnabled;\n\n\t\t// fix false-positive detection of old Android in new IE\n\t\t// (IE11 ua string contains \"Android 4.0\")\n\t\t\n\t\tif(!features.pointerEvent) { \n\n\t\t\tvar ua = navigator.userAgent;\n\n\t\t\t// Detect if device is iPhone or iPod and if it's older than iOS 8\n\t\t\t// http://stackoverflow.com/a/14223920\n\t\t\t// \n\t\t\t// This detection is made because of buggy top/bottom toolbars\n\t\t\t// that don't trigger window.resize event.\n\t\t\t// For more info refer to _isFixedPosition variable in core.js\n\n\t\t\tif (/iP(hone|od)/.test(navigator.platform)) {\n\t\t\t\tvar v = (navigator.appVersion).match(/OS (\\d+)_(\\d+)_?(\\d+)?/);\n\t\t\t\tif(v && v.length > 0) {\n\t\t\t\t\tv = parseInt(v[1], 10);\n\t\t\t\t\tif(v >= 1 && v < 8 ) {\n\t\t\t\t\t\tfeatures.isOldIOSPhone = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Detect old Android (before KitKat)\n\t\t\t// due to bugs related to position:fixed\n\t\t\t// http://stackoverflow.com/questions/7184573/pick-up-the-android-version-in-the-browser-by-javascript\n\t\t\t\n\t\t\tvar match = ua.match(/Android\\s([0-9\\.]*)/);\n\t\t\tvar androidversion = match ? match[1] : 0;\n\t\t\tandroidversion = parseFloat(androidversion);\n\t\t\tif(androidversion >= 1 ) {\n\t\t\t\tif(androidversion < 4.4) {\n\t\t\t\t\tfeatures.isOldAndroid = true; // for fixed position bug & performance\n\t\t\t\t}\n\t\t\t\tfeatures.androidVersion = androidversion; // for touchend bug\n\t\t\t}\t\n\t\t\tfeatures.isMobileOpera = /opera mini|opera mobi/i.test(ua);\n\n\t\t\t// p.s. yes, yes, UA sniffing is bad, propose your solution for above bugs.\n\t\t}\n\t\t\n\t\tvar styleChecks = ['transform', 'perspective', 'animationName'],\n\t\t\tvendors = ['', 'webkit','Moz','ms','O'],\n\t\t\tstyleCheckItem,\n\t\t\tstyleName;\n\n\t\tfor(var i = 0; i < 4; i++) {\n\t\t\tvendor = vendors[i];\n\n\t\t\tfor(var a = 0; a < 3; a++) {\n\t\t\t\tstyleCheckItem = styleChecks[a];\n\n\t\t\t\t// uppercase first letter of property name, if vendor is present\n\t\t\t\tstyleName = vendor + (vendor ? \n\t\t\t\t\t\t\t\t\t\tstyleCheckItem.charAt(0).toUpperCase() + styleCheckItem.slice(1) : \n\t\t\t\t\t\t\t\t\t\tstyleCheckItem);\n\t\t\t\n\t\t\t\tif(!features[styleCheckItem] && styleName in helperStyle ) {\n\t\t\t\t\tfeatures[styleCheckItem] = styleName;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(vendor && !features.raf) {\n\t\t\t\tvendor = vendor.toLowerCase();\n\t\t\t\tfeatures.raf = window[vendor+'RequestAnimationFrame'];\n\t\t\t\tif(features.raf) {\n\t\t\t\t\tfeatures.caf = window[vendor+'CancelAnimationFrame'] || \n\t\t\t\t\t\t\t\t\twindow[vendor+'CancelRequestAnimationFrame'];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\t\n\t\tif(!features.raf) {\n\t\t\tvar lastTime = 0;\n\t\t\tfeatures.raf = function(fn) {\n\t\t\t\tvar currTime = new Date().getTime();\n\t\t\t\tvar timeToCall = Math.max(0, 16 - (currTime - lastTime));\n\t\t\t\tvar id = window.setTimeout(function() { fn(currTime + timeToCall); }, timeToCall);\n\t\t\t\tlastTime = currTime + timeToCall;\n\t\t\t\treturn id;\n\t\t\t};\n\t\t\tfeatures.caf = function(id) { clearTimeout(id); };\n\t\t}\n\n\t\t// Detect SVG support\n\t\tfeatures.svg = !!document.createElementNS && \n\t\t\t\t\t\t!!document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect;\n\n\t\tframework.features = features;\n\n\t\treturn features;\n\t}\n};\n\nframework.detectFeatures();\n\n// Override addEventListener for old versions of IE\nif(framework.features.oldIE) {\n\n\tframework.bind = function(target, type, listener, unbind) {\n\t\t\n\t\ttype = type.split(' ');\n\n\t\tvar methodName = (unbind ? 'detach' : 'attach') + 'Event',\n\t\t\tevName,\n\t\t\t_handleEv = function() {\n\t\t\t\tlistener.handleEvent.call(listener);\n\t\t\t};\n\n\t\tfor(var i = 0; i < type.length; i++) {\n\t\t\tevName = type[i];\n\t\t\tif(evName) {\n\n\t\t\t\tif(typeof listener === 'object' && listener.handleEvent) {\n\t\t\t\t\tif(!unbind) {\n\t\t\t\t\t\tlistener['oldIE' + evName] = _handleEv;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif(!listener['oldIE' + evName]) {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttarget[methodName]( 'on' + evName, listener['oldIE' + evName]);\n\t\t\t\t} else {\n\t\t\t\t\ttarget[methodName]( 'on' + evName, listener);\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t};\n\t\n}\n\n/*>>framework-bridge*/\n\n/*>>core*/\n//function(template, UiClass, items, options)\n\nvar self = this;\n\n/**\n * Static vars, don't change unless you know what you're doing.\n */\nvar DOUBLE_TAP_RADIUS = 25, \n\tNUM_HOLDERS = 3;\n\n/**\n * Options\n */\nvar _options = {\n\tallowPanToNext:true,\n\tspacing: 0.12,\n\tbgOpacity: 1,\n\tmouseUsed: false,\n\tloop: true,\n\tpinchToClose: true,\n\tcloseOnScroll: true,\n\tcloseOnVerticalDrag: true,\n\tverticalDragRange: 0.75,\n\thideAnimationDuration: 333,\n\tshowAnimationDuration: 333,\n\tshowHideOpacity: false,\n\tfocus: true,\n\tescKey: true,\n\tarrowKeys: true,\n\tmainScrollEndFriction: 0.35,\n\tpanEndFriction: 0.35,\n\tisClickableElement: function(el) {\n return el.tagName === 'A';\n },\n getDoubleTapZoom: function(isMouseClick, item) {\n \tif(isMouseClick) {\n \t\treturn 1;\n \t} else {\n \t\treturn item.initialZoomLevel < 0.7 ? 1 : 1.33;\n \t}\n },\n maxSpreadZoom: 1.33,\n\tmodal: true,\n\n\t// not fully implemented yet\n\tscaleMode: 'fit' // TODO\n};\nframework.extend(_options, options);\n\n\n/**\n * Private helper variables & functions\n */\n\nvar _getEmptyPoint = function() { \n\t\treturn {x:0,y:0}; \n\t};\n\nvar _isOpen,\n\t_isDestroying,\n\t_closedByScroll,\n\t_currentItemIndex,\n\t_containerStyle,\n\t_containerShiftIndex,\n\t_currPanDist = _getEmptyPoint(),\n\t_startPanOffset = _getEmptyPoint(),\n\t_panOffset = _getEmptyPoint(),\n\t_upMoveEvents, // drag move, drag end & drag cancel events array\n\t_downEvents, // drag start events array\n\t_globalEventHandlers,\n\t_viewportSize = {},\n\t_currZoomLevel,\n\t_startZoomLevel,\n\t_translatePrefix,\n\t_translateSufix,\n\t_updateSizeInterval,\n\t_itemsNeedUpdate,\n\t_currPositionIndex = 0,\n\t_offset = {},\n\t_slideSize = _getEmptyPoint(), // size of slide area, including spacing\n\t_itemHolders,\n\t_prevItemIndex,\n\t_indexDiff = 0, // difference of indexes since last content update\n\t_dragStartEvent,\n\t_dragMoveEvent,\n\t_dragEndEvent,\n\t_dragCancelEvent,\n\t_transformKey,\n\t_pointerEventEnabled,\n\t_isFixedPosition = true,\n\t_likelyTouchDevice,\n\t_modules = [],\n\t_requestAF,\n\t_cancelAF,\n\t_initalClassName,\n\t_initalWindowScrollY,\n\t_oldIE,\n\t_currentWindowScrollY,\n\t_features,\n\t_windowVisibleSize = {},\n\t_renderMaxResolution = false,\n\t_orientationChangeTimeout,\n\n\n\t// Registers PhotoSWipe module (History, Controller ...)\n\t_registerModule = function(name, module) {\n\t\tframework.extend(self, module.publicMethods);\n\t\t_modules.push(name);\n\t},\n\n\t_getLoopedId = function(index) {\n\t\tvar numSlides = _getNumItems();\n\t\tif(index > numSlides - 1) {\n\t\t\treturn index - numSlides;\n\t\t} else if(index < 0) {\n\t\t\treturn numSlides + index;\n\t\t}\n\t\treturn index;\n\t},\n\t\n\t// Micro bind/trigger\n\t_listeners = {},\n\t_listen = function(name, fn) {\n\t\tif(!_listeners[name]) {\n\t\t\t_listeners[name] = [];\n\t\t}\n\t\treturn _listeners[name].push(fn);\n\t},\n\t_shout = function(name) {\n\t\tvar listeners = _listeners[name];\n\n\t\tif(listeners) {\n\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\targs.shift();\n\n\t\t\tfor(var i = 0; i < listeners.length; i++) {\n\t\t\t\tlisteners[i].apply(self, args);\n\t\t\t}\n\t\t}\n\t},\n\n\t_getCurrentTime = function() {\n\t\treturn new Date().getTime();\n\t},\n\t_applyBgOpacity = function(opacity) {\n\t\t_bgOpacity = opacity;\n\t\tself.bg.style.opacity = opacity * _options.bgOpacity;\n\t},\n\n\t_applyZoomTransform = function(styleObj,x,y,zoom,item) {\n\t\tif(!_renderMaxResolution || (item && item !== self.currItem) ) {\n\t\t\tzoom = zoom / (item ? item.fitRatio : self.currItem.fitRatio);\t\n\t\t}\n\t\t\t\n\t\tstyleObj[_transformKey] = _translatePrefix + x + 'px, ' + y + 'px' + _translateSufix + ' scale(' + zoom + ')';\n\t},\n\t_applyCurrentZoomPan = function( allowRenderResolution ) {\n\t\tif(_currZoomElementStyle) {\n\n\t\t\tif(allowRenderResolution) {\n\t\t\t\tif(_currZoomLevel > self.currItem.fitRatio) {\n\t\t\t\t\tif(!_renderMaxResolution) {\n\t\t\t\t\t\t_setImageSize(self.currItem, false, true);\n\t\t\t\t\t\t_renderMaxResolution = true;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif(_renderMaxResolution) {\n\t\t\t\t\t\t_setImageSize(self.currItem);\n\t\t\t\t\t\t_renderMaxResolution = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\n\t\t\t_applyZoomTransform(_currZoomElementStyle, _panOffset.x, _panOffset.y, _currZoomLevel);\n\t\t}\n\t},\n\t_applyZoomPanToItem = function(item) {\n\t\tif(item.container) {\n\n\t\t\t_applyZoomTransform(item.container.style, \n\t\t\t\t\t\t\t\titem.initialPosition.x, \n\t\t\t\t\t\t\t\titem.initialPosition.y, \n\t\t\t\t\t\t\t\titem.initialZoomLevel,\n\t\t\t\t\t\t\t\titem);\n\t\t}\n\t},\n\t_setTranslateX = function(x, elStyle) {\n\t\telStyle[_transformKey] = _translatePrefix + x + 'px, 0px' + _translateSufix;\n\t},\n\t_moveMainScroll = function(x, dragging) {\n\n\t\tif(!_options.loop && dragging) {\n\t\t\tvar newSlideIndexOffset = _currentItemIndex + (_slideSize.x * _currPositionIndex - x) / _slideSize.x,\n\t\t\t\tdelta = Math.round(x - _mainScrollPos.x);\n\n\t\t\tif( (newSlideIndexOffset < 0 && delta > 0) || \n\t\t\t\t(newSlideIndexOffset >= _getNumItems() - 1 && delta < 0) ) {\n\t\t\t\tx = _mainScrollPos.x + delta * _options.mainScrollEndFriction;\n\t\t\t} \n\t\t}\n\t\t\n\t\t_mainScrollPos.x = x;\n\t\t_setTranslateX(x, _containerStyle);\n\t},\n\t_calculatePanOffset = function(axis, zoomLevel) {\n\t\tvar m = _midZoomPoint[axis] - _offset[axis];\n\t\treturn _startPanOffset[axis] + _currPanDist[axis] + m - m * ( zoomLevel / _startZoomLevel );\n\t},\n\t\n\t_equalizePoints = function(p1, p2) {\n\t\tp1.x = p2.x;\n\t\tp1.y = p2.y;\n\t\tif(p2.id) {\n\t\t\tp1.id = p2.id;\n\t\t}\n\t},\n\t_roundPoint = function(p) {\n\t\tp.x = Math.round(p.x);\n\t\tp.y = Math.round(p.y);\n\t},\n\n\t_mouseMoveTimeout = null,\n\t_onFirstMouseMove = function() {\n\t\t// Wait until mouse move event is fired at least twice during 100ms\n\t\t// We do this, because some mobile browsers trigger it on touchstart\n\t\tif(_mouseMoveTimeout ) { \n\t\t\tframework.unbind(document, 'mousemove', _onFirstMouseMove);\n\t\t\tframework.addClass(template, 'pswp--has_mouse');\n\t\t\t_options.mouseUsed = true;\n\t\t\t_shout('mouseUsed');\n\t\t}\n\t\t_mouseMoveTimeout = setTimeout(function() {\n\t\t\t_mouseMoveTimeout = null;\n\t\t}, 100);\n\t},\n\n\t_bindEvents = function() {\n\t\tframework.bind(document, 'keydown', self);\n\n\t\tif(_features.transform) {\n\t\t\t// don't bind click event in browsers that don't support transform (mostly IE8)\n\t\t\tframework.bind(self.scrollWrap, 'click', self);\n\t\t}\n\t\t\n\n\t\tif(!_options.mouseUsed) {\n\t\t\tframework.bind(document, 'mousemove', _onFirstMouseMove);\n\t\t}\n\n\t\tframework.bind(window, 'resize scroll orientationchange', self);\n\n\t\t_shout('bindEvents');\n\t},\n\n\t_unbindEvents = function() {\n\t\tframework.unbind(window, 'resize scroll orientationchange', self);\n\t\tframework.unbind(window, 'scroll', _globalEventHandlers.scroll);\n\t\tframework.unbind(document, 'keydown', self);\n\t\tframework.unbind(document, 'mousemove', _onFirstMouseMove);\n\n\t\tif(_features.transform) {\n\t\t\tframework.unbind(self.scrollWrap, 'click', self);\n\t\t}\n\n\t\tif(_isDragging) {\n\t\t\tframework.unbind(window, _upMoveEvents, self);\n\t\t}\n\n\t\tclearTimeout(_orientationChangeTimeout);\n\n\t\t_shout('unbindEvents');\n\t},\n\t\n\t_calculatePanBounds = function(zoomLevel, update) {\n\t\tvar bounds = _calculateItemSize( self.currItem, _viewportSize, zoomLevel );\n\t\tif(update) {\n\t\t\t_currPanBounds = bounds;\n\t\t}\n\t\treturn bounds;\n\t},\n\t\n\t_getMinZoomLevel = function(item) {\n\t\tif(!item) {\n\t\t\titem = self.currItem;\n\t\t}\n\t\treturn item.initialZoomLevel;\n\t},\n\t_getMaxZoomLevel = function(item) {\n\t\tif(!item) {\n\t\t\titem = self.currItem;\n\t\t}\n\t\treturn item.w > 0 ? _options.maxSpreadZoom : 1;\n\t},\n\n\t// Return true if offset is out of the bounds\n\t_modifyDestPanOffset = function(axis, destPanBounds, destPanOffset, destZoomLevel) {\n\t\tif(destZoomLevel === self.currItem.initialZoomLevel) {\n\t\t\tdestPanOffset[axis] = self.currItem.initialPosition[axis];\n\t\t\treturn true;\n\t\t} else {\n\t\t\tdestPanOffset[axis] = _calculatePanOffset(axis, destZoomLevel); \n\n\t\t\tif(destPanOffset[axis] > destPanBounds.min[axis]) {\n\t\t\t\tdestPanOffset[axis] = destPanBounds.min[axis];\n\t\t\t\treturn true;\n\t\t\t} else if(destPanOffset[axis] < destPanBounds.max[axis] ) {\n\t\t\t\tdestPanOffset[axis] = destPanBounds.max[axis];\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t},\n\n\t_setupTransforms = function() {\n\n\t\tif(_transformKey) {\n\t\t\t// setup 3d transforms\n\t\t\tvar allow3dTransform = _features.perspective && !_likelyTouchDevice;\n\t\t\t_translatePrefix = 'translate' + (allow3dTransform ? '3d(' : '(');\n\t\t\t_translateSufix = _features.perspective ? ', 0px)' : ')';\t\n\t\t\treturn;\n\t\t}\n\n\t\t// Override zoom/pan/move functions in case old browser is used (most likely IE)\n\t\t// (so they use left/top/width/height, instead of CSS transform)\n\t\n\t\t_transformKey = 'left';\n\t\tframework.addClass(template, 'pswp--ie');\n\n\t\t_setTranslateX = function(x, elStyle) {\n\t\t\telStyle.left = x + 'px';\n\t\t};\n\t\t_applyZoomPanToItem = function(item) {\n\n\t\t\tvar zoomRatio = item.fitRatio > 1 ? 1 : item.fitRatio,\n\t\t\t\ts = item.container.style,\n\t\t\t\tw = zoomRatio * item.w,\n\t\t\t\th = zoomRatio * item.h;\n\n\t\t\ts.width = w + 'px';\n\t\t\ts.height = h + 'px';\n\t\t\ts.left = item.initialPosition.x + 'px';\n\t\t\ts.top = item.initialPosition.y + 'px';\n\n\t\t};\n\t\t_applyCurrentZoomPan = function() {\n\t\t\tif(_currZoomElementStyle) {\n\n\t\t\t\tvar s = _currZoomElementStyle,\n\t\t\t\t\titem = self.currItem,\n\t\t\t\t\tzoomRatio = item.fitRatio > 1 ? 1 : item.fitRatio,\n\t\t\t\t\tw = zoomRatio * item.w,\n\t\t\t\t\th = zoomRatio * item.h;\n\n\t\t\t\ts.width = w + 'px';\n\t\t\t\ts.height = h + 'px';\n\n\n\t\t\t\ts.left = _panOffset.x + 'px';\n\t\t\t\ts.top = _panOffset.y + 'px';\n\t\t\t}\n\t\t\t\n\t\t};\n\t},\n\n\t_onKeyDown = function(e) {\n\t\tvar keydownAction = '';\n\t\tif(_options.escKey && e.keyCode === 27) { \n\t\t\tkeydownAction = 'close';\n\t\t} else if(_options.arrowKeys) {\n\t\t\tif(e.keyCode === 37) {\n\t\t\t\tkeydownAction = 'prev';\n\t\t\t} else if(e.keyCode === 39) { \n\t\t\t\tkeydownAction = 'next';\n\t\t\t}\n\t\t}\n\n\t\tif(keydownAction) {\n\t\t\t// don't do anything if special key pressed to prevent from overriding default browser actions\n\t\t\t// e.g. in Chrome on Mac cmd+arrow-left returns to previous page\n\t\t\tif( !e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey ) {\n\t\t\t\tif(e.preventDefault) {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t} else {\n\t\t\t\t\te.returnValue = false;\n\t\t\t\t} \n\t\t\t\tself[keydownAction]();\n\t\t\t}\n\t\t}\n\t},\n\n\t_onGlobalClick = function(e) {\n\t\tif(!e) {\n\t\t\treturn;\n\t\t}\n\n\t\t// don't allow click event to pass through when triggering after drag or some other gesture\n\t\tif(_moved || _zoomStarted || _mainScrollAnimating || _verticalDragInitiated) {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t}\n\t},\n\n\t_updatePageScrollOffset = function() {\n\t\tself.setScrollOffset(0, framework.getScrollY());\t\t\n\t};\n\t\n\n\n\t\n\n\n\n// Micro animation engine\nvar _animations = {},\n\t_numAnimations = 0,\n\t_stopAnimation = function(name) {\n\t\tif(_animations[name]) {\n\t\t\tif(_animations[name].raf) {\n\t\t\t\t_cancelAF( _animations[name].raf );\n\t\t\t}\n\t\t\t_numAnimations--;\n\t\t\tdelete _animations[name];\n\t\t}\n\t},\n\t_registerStartAnimation = function(name) {\n\t\tif(_animations[name]) {\n\t\t\t_stopAnimation(name);\n\t\t}\n\t\tif(!_animations[name]) {\n\t\t\t_numAnimations++;\n\t\t\t_animations[name] = {};\n\t\t}\n\t},\n\t_stopAllAnimations = function() {\n\t\tfor (var prop in _animations) {\n\n\t\t\tif( _animations.hasOwnProperty( prop ) ) {\n\t\t\t\t_stopAnimation(prop);\n\t\t\t} \n\t\t\t\n\t\t}\n\t},\n\t_animateProp = function(name, b, endProp, d, easingFn, onUpdate, onComplete) {\n\t\tvar startAnimTime = _getCurrentTime(), t;\n\t\t_registerStartAnimation(name);\n\n\t\tvar animloop = function(){\n\t\t\tif ( _animations[name] ) {\n\t\t\t\t\n\t\t\t\tt = _getCurrentTime() - startAnimTime; // time diff\n\t\t\t\t//b - beginning (start prop)\n\t\t\t\t//d - anim duration\n\n\t\t\t\tif ( t >= d ) {\n\t\t\t\t\t_stopAnimation(name);\n\t\t\t\t\tonUpdate(endProp);\n\t\t\t\t\tif(onComplete) {\n\t\t\t\t\t\tonComplete();\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tonUpdate( (endProp - b) * easingFn(t/d) + b );\n\n\t\t\t\t_animations[name].raf = _requestAF(animloop);\n\t\t\t}\n\t\t};\n\t\tanimloop();\n\t};\n\t\n\n\nvar publicMethods = {\n\n\t// make a few local variables and functions public\n\tshout: _shout,\n\tlisten: _listen,\n\tviewportSize: _viewportSize,\n\toptions: _options,\n\n\tisMainScrollAnimating: function() {\n\t\treturn _mainScrollAnimating;\n\t},\n\tgetZoomLevel: function() {\n\t\treturn _currZoomLevel;\n\t},\n\tgetCurrentIndex: function() {\n\t\treturn _currentItemIndex;\n\t},\n\tisDragging: function() {\n\t\treturn _isDragging;\n\t},\t\n\tisZooming: function() {\n\t\treturn _isZooming;\n\t},\n\tsetScrollOffset: function(x,y) {\n\t\t_offset.x = x;\n\t\t_currentWindowScrollY = _offset.y = y;\n\t\t_shout('updateScrollOffset', _offset);\n\t},\n\tapplyZoomPan: function(zoomLevel,panX,panY,allowRenderResolution) {\n\t\t_panOffset.x = panX;\n\t\t_panOffset.y = panY;\n\t\t_currZoomLevel = zoomLevel;\n\t\t_applyCurrentZoomPan( allowRenderResolution );\n\t},\n\n\tinit: function() {\n\n\t\tif(_isOpen || _isDestroying) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar i;\n\n\t\tself.framework = framework; // basic functionality\n\t\tself.template = template; // root DOM element of PhotoSwipe\n\t\tself.bg = framework.getChildByClass(template, 'pswp__bg');\n\n\t\t_initalClassName = template.className;\n\t\t_isOpen = true;\n\t\t\t\t\n\t\t_features = framework.detectFeatures();\n\t\t_requestAF = _features.raf;\n\t\t_cancelAF = _features.caf;\n\t\t_transformKey = _features.transform;\n\t\t_oldIE = _features.oldIE;\n\t\t\n\t\tself.scrollWrap = framework.getChildByClass(template, 'pswp__scroll-wrap');\n\t\tself.container = framework.getChildByClass(self.scrollWrap, 'pswp__container');\n\n\t\t_containerStyle = self.container.style; // for fast access\n\n\t\t// Objects that hold slides (there are only 3 in DOM)\n\t\tself.itemHolders = _itemHolders = [\n\t\t\t{el:self.container.children[0] , wrap:0, index: -1},\n\t\t\t{el:self.container.children[1] , wrap:0, index: -1},\n\t\t\t{el:self.container.children[2] , wrap:0, index: -1}\n\t\t];\n\n\t\t// hide nearby item holders until initial zoom animation finishes (to avoid extra Paints)\n\t\t_itemHolders[0].el.style.display = _itemHolders[2].el.style.display = 'none';\n\n\t\t_setupTransforms();\n\n\t\t// Setup global events\n\t\t_globalEventHandlers = {\n\t\t\tresize: self.updateSize,\n\n\t\t\t// Fixes: iOS 10.3 resize event\n\t\t\t// does not update scrollWrap.clientWidth instantly after resize\n\t\t\t// https://github.com/dimsemenov/PhotoSwipe/issues/1315\n\t\t\torientationchange: function() {\n\t\t\t\tclearTimeout(_orientationChangeTimeout);\n\t\t\t\t_orientationChangeTimeout = setTimeout(function() {\n\t\t\t\t\tif(_viewportSize.x !== self.scrollWrap.clientWidth) {\n\t\t\t\t\t\tself.updateSize();\n\t\t\t\t\t}\n\t\t\t\t}, 500);\n\t\t\t},\n\t\t\tscroll: _updatePageScrollOffset,\n\t\t\tkeydown: _onKeyDown,\n\t\t\tclick: _onGlobalClick\n\t\t};\n\n\t\t// disable show/hide effects on old browsers that don't support CSS animations or transforms, \n\t\t// old IOS, Android and Opera mobile. Blackberry seems to work fine, even older models.\n\t\tvar oldPhone = _features.isOldIOSPhone || _features.isOldAndroid || _features.isMobileOpera;\n\t\tif(!_features.animationName || !_features.transform || oldPhone) {\n\t\t\t_options.showAnimationDuration = _options.hideAnimationDuration = 0;\n\t\t}\n\n\t\t// init modules\n\t\tfor(i = 0; i < _modules.length; i++) {\n\t\t\tself['init' + _modules[i]]();\n\t\t}\n\t\t\n\t\t// init\n\t\tif(UiClass) {\n\t\t\tvar ui = self.ui = new UiClass(self, framework);\n\t\t\tui.init();\n\t\t}\n\n\t\t_shout('firstUpdate');\n\t\t_currentItemIndex = _currentItemIndex || _options.index || 0;\n\t\t// validate index\n\t\tif( isNaN(_currentItemIndex) || _currentItemIndex < 0 || _currentItemIndex >= _getNumItems() ) {\n\t\t\t_currentItemIndex = 0;\n\t\t}\n\t\tself.currItem = _getItemAt( _currentItemIndex );\n\n\t\t\n\t\tif(_features.isOldIOSPhone || _features.isOldAndroid) {\n\t\t\t_isFixedPosition = false;\n\t\t}\n\t\t\n\t\ttemplate.setAttribute('aria-hidden', 'false');\n\t\tif(_options.modal) {\n\t\t\tif(!_isFixedPosition) {\n\t\t\t\ttemplate.style.position = 'absolute';\n\t\t\t\ttemplate.style.top = framework.getScrollY() + 'px';\n\t\t\t} else {\n\t\t\t\ttemplate.style.position = 'fixed';\n\t\t\t}\n\t\t}\n\n\t\tif(_currentWindowScrollY === undefined) {\n\t\t\t_shout('initialLayout');\n\t\t\t_currentWindowScrollY = _initalWindowScrollY = framework.getScrollY();\n\t\t}\n\t\t\n\t\t// add classes to root element of PhotoSwipe\n\t\tvar rootClasses = 'pswp--open ';\n\t\tif(_options.mainClass) {\n\t\t\trootClasses += _options.mainClass + ' ';\n\t\t}\n\t\tif(_options.showHideOpacity) {\n\t\t\trootClasses += 'pswp--animate_opacity ';\n\t\t}\n\t\trootClasses += _likelyTouchDevice ? 'pswp--touch' : 'pswp--notouch';\n\t\trootClasses += _features.animationName ? ' pswp--css_animation' : '';\n\t\trootClasses += _features.svg ? ' pswp--svg' : '';\n\t\tframework.addClass(template, rootClasses);\n\n\t\tself.updateSize();\n\n\t\t// initial update\n\t\t_containerShiftIndex = -1;\n\t\t_indexDiff = null;\n\t\tfor(i = 0; i < NUM_HOLDERS; i++) {\n\t\t\t_setTranslateX( (i+_containerShiftIndex) * _slideSize.x, _itemHolders[i].el.style);\n\t\t}\n\n\t\tif(!_oldIE) {\n\t\t\tframework.bind(self.scrollWrap, _downEvents, self); // no dragging for old IE\n\t\t}\t\n\n\t\t_listen('initialZoomInEnd', function() {\n\t\t\tself.setContent(_itemHolders[0], _currentItemIndex-1);\n\t\t\tself.setContent(_itemHolders[2], _currentItemIndex+1);\n\n\t\t\t_itemHolders[0].el.style.display = _itemHolders[2].el.style.display = 'block';\n\n\t\t\tif(_options.focus) {\n\t\t\t\t// focus causes layout, \n\t\t\t\t// which causes lag during the animation, \n\t\t\t\t// that's why we delay it untill the initial zoom transition ends\n\t\t\t\ttemplate.focus();\n\t\t\t}\n\t\t\t \n\n\t\t\t_bindEvents();\n\t\t});\n\n\t\t// set content for center slide (first time)\n\t\tself.setContent(_itemHolders[1], _currentItemIndex);\n\t\t\n\t\tself.updateCurrItem();\n\n\t\t_shout('afterInit');\n\n\t\tif(!_isFixedPosition) {\n\n\t\t\t// On all versions of iOS lower than 8.0, we check size of viewport every second.\n\t\t\t// \n\t\t\t// This is done to detect when Safari top & bottom bars appear, \n\t\t\t// as this action doesn't trigger any events (like resize). \n\t\t\t// \n\t\t\t// On iOS8 they fixed this.\n\t\t\t// \n\t\t\t// 10 Nov 2014: iOS 7 usage ~40%. iOS 8 usage 56%.\n\t\t\t\n\t\t\t_updateSizeInterval = setInterval(function() {\n\t\t\t\tif(!_numAnimations && !_isDragging && !_isZooming && (_currZoomLevel === self.currItem.initialZoomLevel) ) {\n\t\t\t\t\tself.updateSize();\n\t\t\t\t}\n\t\t\t}, 1000);\n\t\t}\n\n\t\tframework.addClass(template, 'pswp--visible');\n\t},\n\n\t// Close the gallery, then destroy it\n\tclose: function() {\n\t\tif(!_isOpen) {\n\t\t\treturn;\n\t\t}\n\n\t\t_isOpen = false;\n\t\t_isDestroying = true;\n\t\t_shout('close');\n\t\t_unbindEvents();\n\n\t\t_showOrHide(self.currItem, null, true, self.destroy);\n\t},\n\n\t// destroys the gallery (unbinds events, cleans up intervals and timeouts to avoid memory leaks)\n\tdestroy: function() {\n\t\t_shout('destroy');\n\n\t\tif(_showOrHideTimeout) {\n\t\t\tclearTimeout(_showOrHideTimeout);\n\t\t}\n\t\t\n\t\ttemplate.setAttribute('aria-hidden', 'true');\n\t\ttemplate.className = _initalClassName;\n\n\t\tif(_updateSizeInterval) {\n\t\t\tclearInterval(_updateSizeInterval);\n\t\t}\n\n\t\tframework.unbind(self.scrollWrap, _downEvents, self);\n\n\t\t// we unbind scroll event at the end, as closing animation may depend on it\n\t\tframework.unbind(window, 'scroll', self);\n\n\t\t_stopDragUpdateLoop();\n\n\t\t_stopAllAnimations();\n\n\t\t_listeners = null;\n\t},\n\n\t/**\n\t * Pan image to position\n\t * @param {Number} x \n\t * @param {Number} y \n\t * @param {Boolean} force Will ignore bounds if set to true.\n\t */\n\tpanTo: function(x,y,force) {\n\t\tif(!force) {\n\t\t\tif(x > _currPanBounds.min.x) {\n\t\t\t\tx = _currPanBounds.min.x;\n\t\t\t} else if(x < _currPanBounds.max.x) {\n\t\t\t\tx = _currPanBounds.max.x;\n\t\t\t}\n\n\t\t\tif(y > _currPanBounds.min.y) {\n\t\t\t\ty = _currPanBounds.min.y;\n\t\t\t} else if(y < _currPanBounds.max.y) {\n\t\t\t\ty = _currPanBounds.max.y;\n\t\t\t}\n\t\t}\n\t\t\n\t\t_panOffset.x = x;\n\t\t_panOffset.y = y;\n\t\t_applyCurrentZoomPan();\n\t},\n\t\n\thandleEvent: function (e) {\n\t\te = e || window.event;\n\t\tif(_globalEventHandlers[e.type]) {\n\t\t\t_globalEventHandlers[e.type](e);\n\t\t}\n\t},\n\n\n\tgoTo: function(index) {\n\n\t\tindex = _getLoopedId(index);\n\n\t\tvar diff = index - _currentItemIndex;\n\t\t_indexDiff = diff;\n\n\t\t_currentItemIndex = index;\n\t\tself.currItem = _getItemAt( _currentItemIndex );\n\t\t_currPositionIndex -= diff;\n\t\t\n\t\t_moveMainScroll(_slideSize.x * _currPositionIndex);\n\t\t\n\n\t\t_stopAllAnimations();\n\t\t_mainScrollAnimating = false;\n\n\t\tself.updateCurrItem();\n\t},\n\tnext: function() {\n\t\tself.goTo( _currentItemIndex + 1);\n\t},\n\tprev: function() {\n\t\tself.goTo( _currentItemIndex - 1);\n\t},\n\n\t// update current zoom/pan objects\n\tupdateCurrZoomItem: function(emulateSetContent) {\n\t\tif(emulateSetContent) {\n\t\t\t_shout('beforeChange', 0);\n\t\t}\n\n\t\t// itemHolder[1] is middle (current) item\n\t\tif(_itemHolders[1].el.children.length) {\n\t\t\tvar zoomElement = _itemHolders[1].el.children[0];\n\t\t\tif( framework.hasClass(zoomElement, 'pswp__zoom-wrap') ) {\n\t\t\t\t_currZoomElementStyle = zoomElement.style;\n\t\t\t} else {\n\t\t\t\t_currZoomElementStyle = null;\n\t\t\t}\n\t\t} else {\n\t\t\t_currZoomElementStyle = null;\n\t\t}\n\t\t\n\t\t_currPanBounds = self.currItem.bounds;\t\n\t\t_startZoomLevel = _currZoomLevel = self.currItem.initialZoomLevel;\n\n\t\t_panOffset.x = _currPanBounds.center.x;\n\t\t_panOffset.y = _currPanBounds.center.y;\n\n\t\tif(emulateSetContent) {\n\t\t\t_shout('afterChange');\n\t\t}\n\t},\n\n\n\tinvalidateCurrItems: function() {\n\t\t_itemsNeedUpdate = true;\n\t\tfor(var i = 0; i < NUM_HOLDERS; i++) {\n\t\t\tif( _itemHolders[i].item ) {\n\t\t\t\t_itemHolders[i].item.needsUpdate = true;\n\t\t\t}\n\t\t}\n\t},\n\n\tupdateCurrItem: function(beforeAnimation) {\n\n\t\tif(_indexDiff === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar diffAbs = Math.abs(_indexDiff),\n\t\t\ttempHolder;\n\n\t\tif(beforeAnimation && diffAbs < 2) {\n\t\t\treturn;\n\t\t}\n\n\n\t\tself.currItem = _getItemAt( _currentItemIndex );\n\t\t_renderMaxResolution = false;\n\t\t\n\t\t_shout('beforeChange', _indexDiff);\n\n\t\tif(diffAbs >= NUM_HOLDERS) {\n\t\t\t_containerShiftIndex += _indexDiff + (_indexDiff > 0 ? -NUM_HOLDERS : NUM_HOLDERS);\n\t\t\tdiffAbs = NUM_HOLDERS;\n\t\t}\n\t\tfor(var i = 0; i < diffAbs; i++) {\n\t\t\tif(_indexDiff > 0) {\n\t\t\t\ttempHolder = _itemHolders.shift();\n\t\t\t\t_itemHolders[NUM_HOLDERS-1] = tempHolder; // move first to last\n\n\t\t\t\t_containerShiftIndex++;\n\t\t\t\t_setTranslateX( (_containerShiftIndex+2) * _slideSize.x, tempHolder.el.style);\n\t\t\t\tself.setContent(tempHolder, _currentItemIndex - diffAbs + i + 1 + 1);\n\t\t\t} else {\n\t\t\t\ttempHolder = _itemHolders.pop();\n\t\t\t\t_itemHolders.unshift( tempHolder ); // move last to first\n\n\t\t\t\t_containerShiftIndex--;\n\t\t\t\t_setTranslateX( _containerShiftIndex * _slideSize.x, tempHolder.el.style);\n\t\t\t\tself.setContent(tempHolder, _currentItemIndex + diffAbs - i - 1 - 1);\n\t\t\t}\n\t\t\t\n\t\t}\n\n\t\t// reset zoom/pan on previous item\n\t\tif(_currZoomElementStyle && Math.abs(_indexDiff) === 1) {\n\n\t\t\tvar prevItem = _getItemAt(_prevItemIndex);\n\t\t\tif(prevItem.initialZoomLevel !== _currZoomLevel) {\n\t\t\t\t_calculateItemSize(prevItem , _viewportSize );\n\t\t\t\t_setImageSize(prevItem);\n\t\t\t\t_applyZoomPanToItem( prevItem ); \t\t\t\t\n\t\t\t}\n\n\t\t}\n\n\t\t// reset diff after update\n\t\t_indexDiff = 0;\n\n\t\tself.updateCurrZoomItem();\n\n\t\t_prevItemIndex = _currentItemIndex;\n\n\t\t_shout('afterChange');\n\t\t\n\t},\n\n\n\n\tupdateSize: function(force) {\n\t\t\n\t\tif(!_isFixedPosition && _options.modal) {\n\t\t\tvar windowScrollY = framework.getScrollY();\n\t\t\tif(_currentWindowScrollY !== windowScrollY) {\n\t\t\t\ttemplate.style.top = windowScrollY + 'px';\n\t\t\t\t_currentWindowScrollY = windowScrollY;\n\t\t\t}\n\t\t\tif(!force && _windowVisibleSize.x === window.innerWidth && _windowVisibleSize.y === window.innerHeight) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t_windowVisibleSize.x = window.innerWidth;\n\t\t\t_windowVisibleSize.y = window.innerHeight;\n\n\t\t\t//template.style.width = _windowVisibleSize.x + 'px';\n\t\t\ttemplate.style.height = _windowVisibleSize.y + 'px';\n\t\t}\n\n\n\n\t\t_viewportSize.x = self.scrollWrap.clientWidth;\n\t\t_viewportSize.y = self.scrollWrap.clientHeight;\n\n\t\t_updatePageScrollOffset();\n\n\t\t_slideSize.x = _viewportSize.x + Math.round(_viewportSize.x * _options.spacing);\n\t\t_slideSize.y = _viewportSize.y;\n\n\t\t_moveMainScroll(_slideSize.x * _currPositionIndex);\n\n\t\t_shout('beforeResize'); // even may be used for example to switch image sources\n\n\n\t\t// don't re-calculate size on inital size update\n\t\tif(_containerShiftIndex !== undefined) {\n\n\t\t\tvar holder,\n\t\t\t\titem,\n\t\t\t\thIndex;\n\n\t\t\tfor(var i = 0; i < NUM_HOLDERS; i++) {\n\t\t\t\tholder = _itemHolders[i];\n\t\t\t\t_setTranslateX( (i+_containerShiftIndex) * _slideSize.x, holder.el.style);\n\n\t\t\t\thIndex = _currentItemIndex+i-1;\n\n\t\t\t\tif(_options.loop && _getNumItems() > 2) {\n\t\t\t\t\thIndex = _getLoopedId(hIndex);\n\t\t\t\t}\n\n\t\t\t\t// update zoom level on items and refresh source (if needsUpdate)\n\t\t\t\titem = _getItemAt( hIndex );\n\n\t\t\t\t// re-render gallery item if `needsUpdate`,\n\t\t\t\t// or doesn't have `bounds` (entirely new slide object)\n\t\t\t\tif( item && (_itemsNeedUpdate || item.needsUpdate || !item.bounds) ) {\n\n\t\t\t\t\tself.cleanSlide( item );\n\t\t\t\t\t\n\t\t\t\t\tself.setContent( holder, hIndex );\n\n\t\t\t\t\t// if \"center\" slide\n\t\t\t\t\tif(i === 1) {\n\t\t\t\t\t\tself.currItem = item;\n\t\t\t\t\t\tself.updateCurrZoomItem(true);\n\t\t\t\t\t}\n\n\t\t\t\t\titem.needsUpdate = false;\n\n\t\t\t\t} else if(holder.index === -1 && hIndex >= 0) {\n\t\t\t\t\t// add content first time\n\t\t\t\t\tself.setContent( holder, hIndex );\n\t\t\t\t}\n\t\t\t\tif(item && item.container) {\n\t\t\t\t\t_calculateItemSize(item, _viewportSize);\n\t\t\t\t\t_setImageSize(item);\n\t\t\t\t\t_applyZoomPanToItem( item );\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t_itemsNeedUpdate = false;\n\t\t}\t\n\n\t\t_startZoomLevel = _currZoomLevel = self.currItem.initialZoomLevel;\n\t\t_currPanBounds = self.currItem.bounds;\n\n\t\tif(_currPanBounds) {\n\t\t\t_panOffset.x = _currPanBounds.center.x;\n\t\t\t_panOffset.y = _currPanBounds.center.y;\n\t\t\t_applyCurrentZoomPan( true );\n\t\t}\n\t\t\n\t\t_shout('resize');\n\t},\n\t\n\t// Zoom current item to\n\tzoomTo: function(destZoomLevel, centerPoint, speed, easingFn, updateFn) {\n\t\t/*\n\t\t\tif(destZoomLevel === 'fit') {\n\t\t\t\tdestZoomLevel = self.currItem.fitRatio;\n\t\t\t} else if(destZoomLevel === 'fill') {\n\t\t\t\tdestZoomLevel = self.currItem.fillRatio;\n\t\t\t}\n\t\t*/\n\n\t\tif(centerPoint) {\n\t\t\t_startZoomLevel = _currZoomLevel;\n\t\t\t_midZoomPoint.x = Math.abs(centerPoint.x) - _panOffset.x ;\n\t\t\t_midZoomPoint.y = Math.abs(centerPoint.y) - _panOffset.y ;\n\t\t\t_equalizePoints(_startPanOffset, _panOffset);\n\t\t}\n\n\t\tvar destPanBounds = _calculatePanBounds(destZoomLevel, false),\n\t\t\tdestPanOffset = {};\n\n\t\t_modifyDestPanOffset('x', destPanBounds, destPanOffset, destZoomLevel);\n\t\t_modifyDestPanOffset('y', destPanBounds, destPanOffset, destZoomLevel);\n\n\t\tvar initialZoomLevel = _currZoomLevel;\n\t\tvar initialPanOffset = {\n\t\t\tx: _panOffset.x,\n\t\t\ty: _panOffset.y\n\t\t};\n\n\t\t_roundPoint(destPanOffset);\n\n\t\tvar onUpdate = function(now) {\n\t\t\tif(now === 1) {\n\t\t\t\t_currZoomLevel = destZoomLevel;\n\t\t\t\t_panOffset.x = destPanOffset.x;\n\t\t\t\t_panOffset.y = destPanOffset.y;\n\t\t\t} else {\n\t\t\t\t_currZoomLevel = (destZoomLevel - initialZoomLevel) * now + initialZoomLevel;\n\t\t\t\t_panOffset.x = (destPanOffset.x - initialPanOffset.x) * now + initialPanOffset.x;\n\t\t\t\t_panOffset.y = (destPanOffset.y - initialPanOffset.y) * now + initialPanOffset.y;\n\t\t\t}\n\n\t\t\tif(updateFn) {\n\t\t\t\tupdateFn(now);\n\t\t\t}\n\n\t\t\t_applyCurrentZoomPan( now === 1 );\n\t\t};\n\n\t\tif(speed) {\n\t\t\t_animateProp('customZoomTo', 0, 1, speed, easingFn || framework.easing.sine.inOut, onUpdate);\n\t\t} else {\n\t\t\tonUpdate(1);\n\t\t}\n\t}\n\n\n};\n\n\n/*>>core*/\n\n/*>>gestures*/\n/**\n * Mouse/touch/pointer event handlers.\n * \n * separated from @core.js for readability\n */\n\nvar MIN_SWIPE_DISTANCE = 30,\n\tDIRECTION_CHECK_OFFSET = 10; // amount of pixels to drag to determine direction of swipe\n\nvar _gestureStartTime,\n\t_gestureCheckSpeedTime,\n\n\t// pool of objects that are used during dragging of zooming\n\tp = {}, // first point\n\tp2 = {}, // second point (for zoom gesture)\n\tdelta = {},\n\t_currPoint = {},\n\t_startPoint = {},\n\t_currPointers = [],\n\t_startMainScrollPos = {},\n\t_releaseAnimData,\n\t_posPoints = [], // array of points during dragging, used to determine type of gesture\n\t_tempPoint = {},\n\n\t_isZoomingIn,\n\t_verticalDragInitiated,\n\t_oldAndroidTouchEndTimeout,\n\t_currZoomedItemIndex = 0,\n\t_centerPoint = _getEmptyPoint(),\n\t_lastReleaseTime = 0,\n\t_isDragging, // at least one pointer is down\n\t_isMultitouch, // at least two _pointers are down\n\t_zoomStarted, // zoom level changed during zoom gesture\n\t_moved,\n\t_dragAnimFrame,\n\t_mainScrollShifted,\n\t_currentPoints, // array of current touch points\n\t_isZooming,\n\t_currPointsDistance,\n\t_startPointsDistance,\n\t_currPanBounds,\n\t_mainScrollPos = _getEmptyPoint(),\n\t_currZoomElementStyle,\n\t_mainScrollAnimating, // true, if animation after swipe gesture is running\n\t_midZoomPoint = _getEmptyPoint(),\n\t_currCenterPoint = _getEmptyPoint(),\n\t_direction,\n\t_isFirstMove,\n\t_opacityChanged,\n\t_bgOpacity,\n\t_wasOverInitialZoom,\n\n\t_isEqualPoints = function(p1, p2) {\n\t\treturn p1.x === p2.x && p1.y === p2.y;\n\t},\n\t_isNearbyPoints = function(touch0, touch1) {\n\t\treturn Math.abs(touch0.x - touch1.x) < DOUBLE_TAP_RADIUS && Math.abs(touch0.y - touch1.y) < DOUBLE_TAP_RADIUS;\n\t},\n\t_calculatePointsDistance = function(p1, p2) {\n\t\t_tempPoint.x = Math.abs( p1.x - p2.x );\n\t\t_tempPoint.y = Math.abs( p1.y - p2.y );\n\t\treturn Math.sqrt(_tempPoint.x * _tempPoint.x + _tempPoint.y * _tempPoint.y);\n\t},\n\t_stopDragUpdateLoop = function() {\n\t\tif(_dragAnimFrame) {\n\t\t\t_cancelAF(_dragAnimFrame);\n\t\t\t_dragAnimFrame = null;\n\t\t}\n\t},\n\t_dragUpdateLoop = function() {\n\t\tif(_isDragging) {\n\t\t\t_dragAnimFrame = _requestAF(_dragUpdateLoop);\n\t\t\t_renderMovement();\n\t\t}\n\t},\n\t_canPan = function() {\n\t\treturn !(_options.scaleMode === 'fit' && _currZoomLevel === self.currItem.initialZoomLevel);\n\t},\n\t\n\t// find the closest parent DOM element\n\t_closestElement = function(el, fn) {\n\t \tif(!el || el === document) {\n\t \t\treturn false;\n\t \t}\n\n\t \t// don't search elements above pswp__scroll-wrap\n\t \tif(el.getAttribute('class') && el.getAttribute('class').indexOf('pswp__scroll-wrap') > -1 ) {\n\t \t\treturn false;\n\t \t}\n\n\t \tif( fn(el) ) {\n\t \t\treturn el;\n\t \t}\n\n\t \treturn _closestElement(el.parentNode, fn);\n\t},\n\n\t_preventObj = {},\n\t_preventDefaultEventBehaviour = function(e, isDown) {\n\t _preventObj.prevent = !_closestElement(e.target, _options.isClickableElement);\n\n\t\t_shout('preventDragEvent', e, isDown, _preventObj);\n\t\treturn _preventObj.prevent;\n\n\t},\n\t_convertTouchToPoint = function(touch, p) {\n\t\tp.x = touch.pageX;\n\t\tp.y = touch.pageY;\n\t\tp.id = touch.identifier;\n\t\treturn p;\n\t},\n\t_findCenterOfPoints = function(p1, p2, pCenter) {\n\t\tpCenter.x = (p1.x + p2.x) * 0.5;\n\t\tpCenter.y = (p1.y + p2.y) * 0.5;\n\t},\n\t_pushPosPoint = function(time, x, y) {\n\t\tif(time - _gestureCheckSpeedTime > 50) {\n\t\t\tvar o = _posPoints.length > 2 ? _posPoints.shift() : {};\n\t\t\to.x = x;\n\t\t\to.y = y; \n\t\t\t_posPoints.push(o);\n\t\t\t_gestureCheckSpeedTime = time;\n\t\t}\n\t},\n\n\t_calculateVerticalDragOpacityRatio = function() {\n\t\tvar yOffset = _panOffset.y - self.currItem.initialPosition.y; // difference between initial and current position\n\t\treturn 1 - Math.abs( yOffset / (_viewportSize.y / 2) );\n\t},\n\n\t\n\t// points pool, reused during touch events\n\t_ePoint1 = {},\n\t_ePoint2 = {},\n\t_tempPointsArr = [],\n\t_tempCounter,\n\t_getTouchPoints = function(e) {\n\t\t// clean up previous points, without recreating array\n\t\twhile(_tempPointsArr.length > 0) {\n\t\t\t_tempPointsArr.pop();\n\t\t}\n\n\t\tif(!_pointerEventEnabled) {\n\t\t\tif(e.type.indexOf('touch') > -1) {\n\n\t\t\t\tif(e.touches && e.touches.length > 0) {\n\t\t\t\t\t_tempPointsArr[0] = _convertTouchToPoint(e.touches[0], _ePoint1);\n\t\t\t\t\tif(e.touches.length > 1) {\n\t\t\t\t\t\t_tempPointsArr[1] = _convertTouchToPoint(e.touches[1], _ePoint2);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\t_ePoint1.x = e.pageX;\n\t\t\t\t_ePoint1.y = e.pageY;\n\t\t\t\t_ePoint1.id = '';\n\t\t\t\t_tempPointsArr[0] = _ePoint1;//_ePoint1;\n\t\t\t}\n\t\t} else {\n\t\t\t_tempCounter = 0;\n\t\t\t// we can use forEach, as pointer events are supported only in modern browsers\n\t\t\t_currPointers.forEach(function(p) {\n\t\t\t\tif(_tempCounter === 0) {\n\t\t\t\t\t_tempPointsArr[0] = p;\n\t\t\t\t} else if(_tempCounter === 1) {\n\t\t\t\t\t_tempPointsArr[1] = p;\n\t\t\t\t}\n\t\t\t\t_tempCounter++;\n\n\t\t\t});\n\t\t}\n\t\treturn _tempPointsArr;\n\t},\n\n\t_panOrMoveMainScroll = function(axis, delta) {\n\n\t\tvar panFriction,\n\t\t\toverDiff = 0,\n\t\t\tnewOffset = _panOffset[axis] + delta[axis],\n\t\t\tstartOverDiff,\n\t\t\tdir = delta[axis] > 0,\n\t\t\tnewMainScrollPosition = _mainScrollPos.x + delta.x,\n\t\t\tmainScrollDiff = _mainScrollPos.x - _startMainScrollPos.x,\n\t\t\tnewPanPos,\n\t\t\tnewMainScrollPos;\n\n\t\t// calculate fdistance over the bounds and friction\n\t\tif(newOffset > _currPanBounds.min[axis] || newOffset < _currPanBounds.max[axis]) {\n\t\t\tpanFriction = _options.panEndFriction;\n\t\t\t// Linear increasing of friction, so at 1/4 of viewport it's at max value. \n\t\t\t// Looks not as nice as was expected. Left for history.\n\t\t\t// panFriction = (1 - (_panOffset[axis] + delta[axis] + panBounds.min[axis]) / (_viewportSize[axis] / 4) );\n\t\t} else {\n\t\t\tpanFriction = 1;\n\t\t}\n\t\t\n\t\tnewOffset = _panOffset[axis] + delta[axis] * panFriction;\n\n\t\t// move main scroll or start panning\n\t\tif(_options.allowPanToNext || _currZoomLevel === self.currItem.initialZoomLevel) {\n\n\n\t\t\tif(!_currZoomElementStyle) {\n\t\t\t\t\n\t\t\t\tnewMainScrollPos = newMainScrollPosition;\n\n\t\t\t} else if(_direction === 'h' && axis === 'x' && !_zoomStarted ) {\n\t\t\t\t\n\t\t\t\tif(dir) {\n\t\t\t\t\tif(newOffset > _currPanBounds.min[axis]) {\n\t\t\t\t\t\tpanFriction = _options.panEndFriction;\n\t\t\t\t\t\toverDiff = _currPanBounds.min[axis] - newOffset;\n\t\t\t\t\t\tstartOverDiff = _currPanBounds.min[axis] - _startPanOffset[axis];\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// drag right\n\t\t\t\t\tif( (startOverDiff <= 0 || mainScrollDiff < 0) && _getNumItems() > 1 ) {\n\t\t\t\t\t\tnewMainScrollPos = newMainScrollPosition;\n\t\t\t\t\t\tif(mainScrollDiff < 0 && newMainScrollPosition > _startMainScrollPos.x) {\n\t\t\t\t\t\t\tnewMainScrollPos = _startMainScrollPos.x;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif(_currPanBounds.min.x !== _currPanBounds.max.x) {\n\t\t\t\t\t\t\tnewPanPos = newOffset;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\n\t\t\t\t\tif(newOffset < _currPanBounds.max[axis] ) {\n\t\t\t\t\t\tpanFriction =_options.panEndFriction;\n\t\t\t\t\t\toverDiff = newOffset - _currPanBounds.max[axis];\n\t\t\t\t\t\tstartOverDiff = _startPanOffset[axis] - _currPanBounds.max[axis];\n\t\t\t\t\t}\n\n\t\t\t\t\tif( (startOverDiff <= 0 || mainScrollDiff > 0) && _getNumItems() > 1 ) {\n\t\t\t\t\t\tnewMainScrollPos = newMainScrollPosition;\n\n\t\t\t\t\t\tif(mainScrollDiff > 0 && newMainScrollPosition < _startMainScrollPos.x) {\n\t\t\t\t\t\t\tnewMainScrollPos = _startMainScrollPos.x;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif(_currPanBounds.min.x !== _currPanBounds.max.x) {\n\t\t\t\t\t\t\tnewPanPos = newOffset;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\n\t\t\t\t//\n\t\t\t}\n\n\t\t\tif(axis === 'x') {\n\n\t\t\t\tif(newMainScrollPos !== undefined) {\n\t\t\t\t\t_moveMainScroll(newMainScrollPos, true);\n\t\t\t\t\tif(newMainScrollPos === _startMainScrollPos.x) {\n\t\t\t\t\t\t_mainScrollShifted = false;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t_mainScrollShifted = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif(_currPanBounds.min.x !== _currPanBounds.max.x) {\n\t\t\t\t\tif(newPanPos !== undefined) {\n\t\t\t\t\t\t_panOffset.x = newPanPos;\n\t\t\t\t\t} else if(!_mainScrollShifted) {\n\t\t\t\t\t\t_panOffset.x += delta.x * panFriction;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn newMainScrollPos !== undefined;\n\t\t\t}\n\n\t\t}\n\n\t\tif(!_mainScrollAnimating) {\n\t\t\t\n\t\t\tif(!_mainScrollShifted) {\n\t\t\t\tif(_currZoomLevel > self.currItem.fitRatio) {\n\t\t\t\t\t_panOffset[axis] += delta[axis] * panFriction;\n\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t\n\t\t}\n\t\t\n\t},\n\n\t// Pointerdown/touchstart/mousedown handler\n\t_onDragStart = function(e) {\n\n\t\t// Allow dragging only via left mouse button.\n\t\t// As this handler is not added in IE8 - we ignore e.which\n\t\t// \n\t\t// http://www.quirksmode.org/js/events_properties.html\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/event.button\n\t\tif(e.type === 'mousedown' && e.button > 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif(_initialZoomRunning) {\n\t\t\te.preventDefault();\n\t\t\treturn;\n\t\t}\n\n\t\tif(_oldAndroidTouchEndTimeout && e.type === 'mousedown') {\n\t\t\treturn;\n\t\t}\n\n\t\tif(_preventDefaultEventBehaviour(e, true)) {\n\t\t\te.preventDefault();\n\t\t}\n\n\n\n\t\t_shout('pointerDown');\n\n\t\tif(_pointerEventEnabled) {\n\t\t\tvar pointerIndex = framework.arraySearch(_currPointers, e.pointerId, 'id');\n\t\t\tif(pointerIndex < 0) {\n\t\t\t\tpointerIndex = _currPointers.length;\n\t\t\t}\n\t\t\t_currPointers[pointerIndex] = {x:e.pageX, y:e.pageY, id: e.pointerId};\n\t\t}\n\t\t\n\n\n\t\tvar startPointsList = _getTouchPoints(e),\n\t\t\tnumPoints = startPointsList.length;\n\n\t\t_currentPoints = null;\n\n\t\t_stopAllAnimations();\n\n\t\t// init drag\n\t\tif(!_isDragging || numPoints === 1) {\n\n\t\t\t\n\n\t\t\t_isDragging = _isFirstMove = true;\n\t\t\tframework.bind(window, _upMoveEvents, self);\n\n\t\t\t_isZoomingIn = \n\t\t\t\t_wasOverInitialZoom = \n\t\t\t\t_opacityChanged = \n\t\t\t\t_verticalDragInitiated = \n\t\t\t\t_mainScrollShifted = \n\t\t\t\t_moved = \n\t\t\t\t_isMultitouch = \n\t\t\t\t_zoomStarted = false;\n\n\t\t\t_direction = null;\n\n\t\t\t_shout('firstTouchStart', startPointsList);\n\n\t\t\t_equalizePoints(_startPanOffset, _panOffset);\n\n\t\t\t_currPanDist.x = _currPanDist.y = 0;\n\t\t\t_equalizePoints(_currPoint, startPointsList[0]);\n\t\t\t_equalizePoints(_startPoint, _currPoint);\n\n\t\t\t//_equalizePoints(_startMainScrollPos, _mainScrollPos);\n\t\t\t_startMainScrollPos.x = _slideSize.x * _currPositionIndex;\n\n\t\t\t_posPoints = [{\n\t\t\t\tx: _currPoint.x,\n\t\t\t\ty: _currPoint.y\n\t\t\t}];\n\n\t\t\t_gestureCheckSpeedTime = _gestureStartTime = _getCurrentTime();\n\n\t\t\t//_mainScrollAnimationEnd(true);\n\t\t\t_calculatePanBounds( _currZoomLevel, true );\n\t\t\t\n\t\t\t// Start rendering\n\t\t\t_stopDragUpdateLoop();\n\t\t\t_dragUpdateLoop();\n\t\t\t\n\t\t}\n\n\t\t// init zoom\n\t\tif(!_isZooming && numPoints > 1 && !_mainScrollAnimating && !_mainScrollShifted) {\n\t\t\t_startZoomLevel = _currZoomLevel;\n\t\t\t_zoomStarted = false; // true if zoom changed at least once\n\n\t\t\t_isZooming = _isMultitouch = true;\n\t\t\t_currPanDist.y = _currPanDist.x = 0;\n\n\t\t\t_equalizePoints(_startPanOffset, _panOffset);\n\n\t\t\t_equalizePoints(p, startPointsList[0]);\n\t\t\t_equalizePoints(p2, startPointsList[1]);\n\n\t\t\t_findCenterOfPoints(p, p2, _currCenterPoint);\n\n\t\t\t_midZoomPoint.x = Math.abs(_currCenterPoint.x) - _panOffset.x;\n\t\t\t_midZoomPoint.y = Math.abs(_currCenterPoint.y) - _panOffset.y;\n\t\t\t_currPointsDistance = _startPointsDistance = _calculatePointsDistance(p, p2);\n\t\t}\n\n\n\t},\n\n\t// Pointermove/touchmove/mousemove handler\n\t_onDragMove = function(e) {\n\n\t\te.preventDefault();\n\n\t\tif(_pointerEventEnabled) {\n\t\t\tvar pointerIndex = framework.arraySearch(_currPointers, e.pointerId, 'id');\n\t\t\tif(pointerIndex > -1) {\n\t\t\t\tvar p = _currPointers[pointerIndex];\n\t\t\t\tp.x = e.pageX;\n\t\t\t\tp.y = e.pageY; \n\t\t\t}\n\t\t}\n\n\t\tif(_isDragging) {\n\t\t\tvar touchesList = _getTouchPoints(e);\n\t\t\tif(!_direction && !_moved && !_isZooming) {\n\n\t\t\t\tif(_mainScrollPos.x !== _slideSize.x * _currPositionIndex) {\n\t\t\t\t\t// if main scroll position is shifted \u2013 direction is always horizontal\n\t\t\t\t\t_direction = 'h';\n\t\t\t\t} else {\n\t\t\t\t\tvar diff = Math.abs(touchesList[0].x - _currPoint.x) - Math.abs(touchesList[0].y - _currPoint.y);\n\t\t\t\t\t// check the direction of movement\n\t\t\t\t\tif(Math.abs(diff) >= DIRECTION_CHECK_OFFSET) {\n\t\t\t\t\t\t_direction = diff > 0 ? 'h' : 'v';\n\t\t\t\t\t\t_currentPoints = touchesList;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\t_currentPoints = touchesList;\n\t\t\t}\n\t\t}\t\n\t},\n\t// \n\t_renderMovement = function() {\n\n\t\tif(!_currentPoints) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar numPoints = _currentPoints.length;\n\n\t\tif(numPoints === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t_equalizePoints(p, _currentPoints[0]);\n\n\t\tdelta.x = p.x - _currPoint.x;\n\t\tdelta.y = p.y - _currPoint.y;\n\n\t\tif(_isZooming && numPoints > 1) {\n\t\t\t// Handle behaviour for more than 1 point\n\n\t\t\t_currPoint.x = p.x;\n\t\t\t_currPoint.y = p.y;\n\t\t\n\t\t\t// check if one of two points changed\n\t\t\tif( !delta.x && !delta.y && _isEqualPoints(_currentPoints[1], p2) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t_equalizePoints(p2, _currentPoints[1]);\n\n\n\t\t\tif(!_zoomStarted) {\n\t\t\t\t_zoomStarted = true;\n\t\t\t\t_shout('zoomGestureStarted');\n\t\t\t}\n\t\t\t\n\t\t\t// Distance between two points\n\t\t\tvar pointsDistance = _calculatePointsDistance(p,p2);\n\n\t\t\tvar zoomLevel = _calculateZoomLevel(pointsDistance);\n\n\t\t\t// slightly over the of initial zoom level\n\t\t\tif(zoomLevel > self.currItem.initialZoomLevel + self.currItem.initialZoomLevel / 15) {\n\t\t\t\t_wasOverInitialZoom = true;\n\t\t\t}\n\n\t\t\t// Apply the friction if zoom level is out of the bounds\n\t\t\tvar zoomFriction = 1,\n\t\t\t\tminZoomLevel = _getMinZoomLevel(),\n\t\t\t\tmaxZoomLevel = _getMaxZoomLevel();\n\n\t\t\tif ( zoomLevel < minZoomLevel ) {\n\t\t\t\t\n\t\t\t\tif(_options.pinchToClose && !_wasOverInitialZoom && _startZoomLevel <= self.currItem.initialZoomLevel) {\n\t\t\t\t\t// fade out background if zooming out\n\t\t\t\t\tvar minusDiff = minZoomLevel - zoomLevel;\n\t\t\t\t\tvar percent = 1 - minusDiff / (minZoomLevel / 1.2);\n\n\t\t\t\t\t_applyBgOpacity(percent);\n\t\t\t\t\t_shout('onPinchClose', percent);\n\t\t\t\t\t_opacityChanged = true;\n\t\t\t\t} else {\n\t\t\t\t\tzoomFriction = (minZoomLevel - zoomLevel) / minZoomLevel;\n\t\t\t\t\tif(zoomFriction > 1) {\n\t\t\t\t\t\tzoomFriction = 1;\n\t\t\t\t\t}\n\t\t\t\t\tzoomLevel = minZoomLevel - zoomFriction * (minZoomLevel / 3);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t} else if ( zoomLevel > maxZoomLevel ) {\n\t\t\t\t// 1.5 - extra zoom level above the max. E.g. if max is x6, real max 6 + 1.5 = 7.5\n\t\t\t\tzoomFriction = (zoomLevel - maxZoomLevel) / ( minZoomLevel * 6 );\n\t\t\t\tif(zoomFriction > 1) {\n\t\t\t\t\tzoomFriction = 1;\n\t\t\t\t}\n\t\t\t\tzoomLevel = maxZoomLevel + zoomFriction * minZoomLevel;\n\t\t\t}\n\n\t\t\tif(zoomFriction < 0) {\n\t\t\t\tzoomFriction = 0;\n\t\t\t}\n\n\t\t\t// distance between touch points after friction is applied\n\t\t\t_currPointsDistance = pointsDistance;\n\n\t\t\t// _centerPoint - The point in the middle of two pointers\n\t\t\t_findCenterOfPoints(p, p2, _centerPoint);\n\t\t\n\t\t\t// paning with two pointers pressed\n\t\t\t_currPanDist.x += _centerPoint.x - _currCenterPoint.x;\n\t\t\t_currPanDist.y += _centerPoint.y - _currCenterPoint.y;\n\t\t\t_equalizePoints(_currCenterPoint, _centerPoint);\n\n\t\t\t_panOffset.x = _calculatePanOffset('x', zoomLevel);\n\t\t\t_panOffset.y = _calculatePanOffset('y', zoomLevel);\n\n\t\t\t_isZoomingIn = zoomLevel > _currZoomLevel;\n\t\t\t_currZoomLevel = zoomLevel;\n\t\t\t_applyCurrentZoomPan();\n\n\t\t} else {\n\n\t\t\t// handle behaviour for one point (dragging or panning)\n\n\t\t\tif(!_direction) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(_isFirstMove) {\n\t\t\t\t_isFirstMove = false;\n\n\t\t\t\t// subtract drag distance that was used during the detection direction \n\n\t\t\t\tif( Math.abs(delta.x) >= DIRECTION_CHECK_OFFSET) {\n\t\t\t\t\tdelta.x -= _currentPoints[0].x - _startPoint.x;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif( Math.abs(delta.y) >= DIRECTION_CHECK_OFFSET) {\n\t\t\t\t\tdelta.y -= _currentPoints[0].y - _startPoint.y;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t_currPoint.x = p.x;\n\t\t\t_currPoint.y = p.y;\n\n\t\t\t// do nothing if pointers position hasn't changed\n\t\t\tif(delta.x === 0 && delta.y === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(_direction === 'v' && _options.closeOnVerticalDrag) {\n\t\t\t\tif(!_canPan()) {\n\t\t\t\t\t_currPanDist.y += delta.y;\n\t\t\t\t\t_panOffset.y += delta.y;\n\n\t\t\t\t\tvar opacityRatio = _calculateVerticalDragOpacityRatio();\n\n\t\t\t\t\t_verticalDragInitiated = true;\n\t\t\t\t\t_shout('onVerticalDrag', opacityRatio);\n\n\t\t\t\t\t_applyBgOpacity(opacityRatio);\n\t\t\t\t\t_applyCurrentZoomPan();\n\t\t\t\t\treturn ;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t_pushPosPoint(_getCurrentTime(), p.x, p.y);\n\n\t\t\t_moved = true;\n\t\t\t_currPanBounds = self.currItem.bounds;\n\t\t\t\n\t\t\tvar mainScrollChanged = _panOrMoveMainScroll('x', delta);\n\t\t\tif(!mainScrollChanged) {\n\t\t\t\t_panOrMoveMainScroll('y', delta);\n\n\t\t\t\t_roundPoint(_panOffset);\n\t\t\t\t_applyCurrentZoomPan();\n\t\t\t}\n\n\t\t}\n\n\t},\n\t\n\t// Pointerup/pointercancel/touchend/touchcancel/mouseup event handler\n\t_onDragRelease = function(e) {\n\n\t\tif(_features.isOldAndroid ) {\n\n\t\t\tif(_oldAndroidTouchEndTimeout && e.type === 'mouseup') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// on Android (v4.1, 4.2, 4.3 & possibly older) \n\t\t\t// ghost mousedown/up event isn't preventable via e.preventDefault,\n\t\t\t// which causes fake mousedown event\n\t\t\t// so we block mousedown/up for 600ms\n\t\t\tif( e.type.indexOf('touch') > -1 ) {\n\t\t\t\tclearTimeout(_oldAndroidTouchEndTimeout);\n\t\t\t\t_oldAndroidTouchEndTimeout = setTimeout(function() {\n\t\t\t\t\t_oldAndroidTouchEndTimeout = 0;\n\t\t\t\t}, 600);\n\t\t\t}\n\t\t\t\n\t\t}\n\n\t\t_shout('pointerUp');\n\n\t\tif(_preventDefaultEventBehaviour(e, false)) {\n\t\t\te.preventDefault();\n\t\t}\n\n\t\tvar releasePoint;\n\n\t\tif(_pointerEventEnabled) {\n\t\t\tvar pointerIndex = framework.arraySearch(_currPointers, e.pointerId, 'id');\n\t\t\t\n\t\t\tif(pointerIndex > -1) {\n\t\t\t\treleasePoint = _currPointers.splice(pointerIndex, 1)[0];\n\n\t\t\t\tif(navigator.msPointerEnabled) {\n\t\t\t\t\tvar MSPOINTER_TYPES = {\n\t\t\t\t\t\t4: 'mouse', // event.MSPOINTER_TYPE_MOUSE\n\t\t\t\t\t\t2: 'touch', // event.MSPOINTER_TYPE_TOUCH \n\t\t\t\t\t\t3: 'pen' // event.MSPOINTER_TYPE_PEN\n\t\t\t\t\t};\n\t\t\t\t\treleasePoint.type = MSPOINTER_TYPES[e.pointerType];\n\n\t\t\t\t\tif(!releasePoint.type) {\n\t\t\t\t\t\treleasePoint.type = e.pointerType || 'mouse';\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treleasePoint.type = e.pointerType || 'mouse';\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tvar touchList = _getTouchPoints(e),\n\t\t\tgestureType,\n\t\t\tnumPoints = touchList.length;\n\n\t\tif(e.type === 'mouseup') {\n\t\t\tnumPoints = 0;\n\t\t}\n\n\t\t// Do nothing if there were 3 touch points or more\n\t\tif(numPoints === 2) {\n\t\t\t_currentPoints = null;\n\t\t\treturn true;\n\t\t}\n\n\t\t// if second pointer released\n\t\tif(numPoints === 1) {\n\t\t\t_equalizePoints(_startPoint, touchList[0]);\n\t\t}\t\t\t\t\n\n\n\t\t// pointer hasn't moved, send \"tap release\" point\n\t\tif(numPoints === 0 && !_direction && !_mainScrollAnimating) {\n\t\t\tif(!releasePoint) {\n\t\t\t\tif(e.type === 'mouseup') {\n\t\t\t\t\treleasePoint = {x: e.pageX, y: e.pageY, type:'mouse'};\n\t\t\t\t} else if(e.changedTouches && e.changedTouches[0]) {\n\t\t\t\t\treleasePoint = {x: e.changedTouches[0].pageX, y: e.changedTouches[0].pageY, type:'touch'};\n\t\t\t\t}\t\t\n\t\t\t}\n\n\t\t\t_shout('touchRelease', e, releasePoint);\n\t\t}\n\n\t\t// Difference in time between releasing of two last touch points (zoom gesture)\n\t\tvar releaseTimeDiff = -1;\n\n\t\t// Gesture completed, no pointers left\n\t\tif(numPoints === 0) {\n\t\t\t_isDragging = false;\n\t\t\tframework.unbind(window, _upMoveEvents, self);\n\n\t\t\t_stopDragUpdateLoop();\n\n\t\t\tif(_isZooming) {\n\t\t\t\t// Two points released at the same time\n\t\t\t\treleaseTimeDiff = 0;\n\t\t\t} else if(_lastReleaseTime !== -1) {\n\t\t\t\treleaseTimeDiff = _getCurrentTime() - _lastReleaseTime;\n\t\t\t}\n\t\t}\n\t\t_lastReleaseTime = numPoints === 1 ? _getCurrentTime() : -1;\n\t\t\n\t\tif(releaseTimeDiff !== -1 && releaseTimeDiff < 150) {\n\t\t\tgestureType = 'zoom';\n\t\t} else {\n\t\t\tgestureType = 'swipe';\n\t\t}\n\n\t\tif(_isZooming && numPoints < 2) {\n\t\t\t_isZooming = false;\n\n\t\t\t// Only second point released\n\t\t\tif(numPoints === 1) {\n\t\t\t\tgestureType = 'zoomPointerUp';\n\t\t\t}\n\t\t\t_shout('zoomGestureEnded');\n\t\t}\n\n\t\t_currentPoints = null;\n\t\tif(!_moved && !_zoomStarted && !_mainScrollAnimating && !_verticalDragInitiated) {\n\t\t\t// nothing to animate\n\t\t\treturn;\n\t\t}\n\t\n\t\t_stopAllAnimations();\n\n\t\t\n\t\tif(!_releaseAnimData) {\n\t\t\t_releaseAnimData = _initDragReleaseAnimationData();\n\t\t}\n\t\t\n\t\t_releaseAnimData.calculateSwipeSpeed('x');\n\n\n\t\tif(_verticalDragInitiated) {\n\n\t\t\tvar opacityRatio = _calculateVerticalDragOpacityRatio();\n\n\t\t\tif(opacityRatio < _options.verticalDragRange) {\n\t\t\t\tself.close();\n\t\t\t} else {\n\t\t\t\tvar initalPanY = _panOffset.y,\n\t\t\t\t\tinitialBgOpacity = _bgOpacity;\n\n\t\t\t\t_animateProp('verticalDrag', 0, 1, 300, framework.easing.cubic.out, function(now) {\n\t\t\t\t\t\n\t\t\t\t\t_panOffset.y = (self.currItem.initialPosition.y - initalPanY) * now + initalPanY;\n\n\t\t\t\t\t_applyBgOpacity( (1 - initialBgOpacity) * now + initialBgOpacity );\n\t\t\t\t\t_applyCurrentZoomPan();\n\t\t\t\t});\n\n\t\t\t\t_shout('onVerticalDrag', 1);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\n\t\t// main scroll \n\t\tif( (_mainScrollShifted || _mainScrollAnimating) && numPoints === 0) {\n\t\t\tvar itemChanged = _finishSwipeMainScrollGesture(gestureType, _releaseAnimData);\n\t\t\tif(itemChanged) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tgestureType = 'zoomPointerUp';\n\t\t}\n\n\t\t// prevent zoom/pan animation when main scroll animation runs\n\t\tif(_mainScrollAnimating) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t// Complete simple zoom gesture (reset zoom level if it's out of the bounds) \n\t\tif(gestureType !== 'swipe') {\n\t\t\t_completeZoomGesture();\n\t\t\treturn;\n\t\t}\n\t\n\t\t// Complete pan gesture if main scroll is not shifted, and it's possible to pan current image\n\t\tif(!_mainScrollShifted && _currZoomLevel > self.currItem.fitRatio) {\n\t\t\t_completePanGesture(_releaseAnimData);\n\t\t}\n\t},\n\n\n\t// Returns object with data about gesture\n\t// It's created only once and then reused\n\t_initDragReleaseAnimationData = function() {\n\t\t// temp local vars\n\t\tvar lastFlickDuration,\n\t\t\ttempReleasePos;\n\n\t\t// s = this\n\t\tvar s = {\n\t\t\tlastFlickOffset: {},\n\t\t\tlastFlickDist: {},\n\t\t\tlastFlickSpeed: {},\n\t\t\tslowDownRatio: {},\n\t\t\tslowDownRatioReverse: {},\n\t\t\tspeedDecelerationRatio: {},\n\t\t\tspeedDecelerationRatioAbs: {},\n\t\t\tdistanceOffset: {},\n\t\t\tbackAnimDestination: {},\n\t\t\tbackAnimStarted: {},\n\t\t\tcalculateSwipeSpeed: function(axis) {\n\t\t\t\t\n\n\t\t\t\tif( _posPoints.length > 1) {\n\t\t\t\t\tlastFlickDuration = _getCurrentTime() - _gestureCheckSpeedTime + 50;\n\t\t\t\t\ttempReleasePos = _posPoints[_posPoints.length-2][axis];\n\t\t\t\t} else {\n\t\t\t\t\tlastFlickDuration = _getCurrentTime() - _gestureStartTime; // total gesture duration\n\t\t\t\t\ttempReleasePos = _startPoint[axis];\n\t\t\t\t}\n\t\t\t\ts.lastFlickOffset[axis] = _currPoint[axis] - tempReleasePos;\n\t\t\t\ts.lastFlickDist[axis] = Math.abs(s.lastFlickOffset[axis]);\n\t\t\t\tif(s.lastFlickDist[axis] > 20) {\n\t\t\t\t\ts.lastFlickSpeed[axis] = s.lastFlickOffset[axis] / lastFlickDuration;\n\t\t\t\t} else {\n\t\t\t\t\ts.lastFlickSpeed[axis] = 0;\n\t\t\t\t}\n\t\t\t\tif( Math.abs(s.lastFlickSpeed[axis]) < 0.1 ) {\n\t\t\t\t\ts.lastFlickSpeed[axis] = 0;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\ts.slowDownRatio[axis] = 0.95;\n\t\t\t\ts.slowDownRatioReverse[axis] = 1 - s.slowDownRatio[axis];\n\t\t\t\ts.speedDecelerationRatio[axis] = 1;\n\t\t\t},\n\n\t\t\tcalculateOverBoundsAnimOffset: function(axis, speed) {\n\t\t\t\tif(!s.backAnimStarted[axis]) {\n\n\t\t\t\t\tif(_panOffset[axis] > _currPanBounds.min[axis]) {\n\t\t\t\t\t\ts.backAnimDestination[axis] = _currPanBounds.min[axis];\n\t\t\t\t\t\t\n\t\t\t\t\t} else if(_panOffset[axis] < _currPanBounds.max[axis]) {\n\t\t\t\t\t\ts.backAnimDestination[axis] = _currPanBounds.max[axis];\n\t\t\t\t\t}\n\n\t\t\t\t\tif(s.backAnimDestination[axis] !== undefined) {\n\t\t\t\t\t\ts.slowDownRatio[axis] = 0.7;\n\t\t\t\t\t\ts.slowDownRatioReverse[axis] = 1 - s.slowDownRatio[axis];\n\t\t\t\t\t\tif(s.speedDecelerationRatioAbs[axis] < 0.05) {\n\n\t\t\t\t\t\t\ts.lastFlickSpeed[axis] = 0;\n\t\t\t\t\t\t\ts.backAnimStarted[axis] = true;\n\n\t\t\t\t\t\t\t_animateProp('bounceZoomPan'+axis,_panOffset[axis], \n\t\t\t\t\t\t\t\ts.backAnimDestination[axis], \n\t\t\t\t\t\t\t\tspeed || 300, \n\t\t\t\t\t\t\t\tframework.easing.sine.out, \n\t\t\t\t\t\t\t\tfunction(pos) {\n\t\t\t\t\t\t\t\t\t_panOffset[axis] = pos;\n\t\t\t\t\t\t\t\t\t_applyCurrentZoomPan();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\n\t\t\t// Reduces the speed by slowDownRatio (per 10ms)\n\t\t\tcalculateAnimOffset: function(axis) {\n\t\t\t\tif(!s.backAnimStarted[axis]) {\n\t\t\t\t\ts.speedDecelerationRatio[axis] = s.speedDecelerationRatio[axis] * (s.slowDownRatio[axis] + \n\t\t\t\t\t\t\t\t\t\t\t\ts.slowDownRatioReverse[axis] - \n\t\t\t\t\t\t\t\t\t\t\t\ts.slowDownRatioReverse[axis] * s.timeDiff / 10);\n\n\t\t\t\t\ts.speedDecelerationRatioAbs[axis] = Math.abs(s.lastFlickSpeed[axis] * s.speedDecelerationRatio[axis]);\n\t\t\t\t\ts.distanceOffset[axis] = s.lastFlickSpeed[axis] * s.speedDecelerationRatio[axis] * s.timeDiff;\n\t\t\t\t\t_panOffset[axis] += s.distanceOffset[axis];\n\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tpanAnimLoop: function() {\n\t\t\t\tif ( _animations.zoomPan ) {\n\t\t\t\t\t_animations.zoomPan.raf = _requestAF(s.panAnimLoop);\n\n\t\t\t\t\ts.now = _getCurrentTime();\n\t\t\t\t\ts.timeDiff = s.now - s.lastNow;\n\t\t\t\t\ts.lastNow = s.now;\n\t\t\t\t\t\n\t\t\t\t\ts.calculateAnimOffset('x');\n\t\t\t\t\ts.calculateAnimOffset('y');\n\n\t\t\t\t\t_applyCurrentZoomPan();\n\t\t\t\t\t\n\t\t\t\t\ts.calculateOverBoundsAnimOffset('x');\n\t\t\t\t\ts.calculateOverBoundsAnimOffset('y');\n\n\n\t\t\t\t\tif (s.speedDecelerationRatioAbs.x < 0.05 && s.speedDecelerationRatioAbs.y < 0.05) {\n\n\t\t\t\t\t\t// round pan position\n\t\t\t\t\t\t_panOffset.x = Math.round(_panOffset.x);\n\t\t\t\t\t\t_panOffset.y = Math.round(_panOffset.y);\n\t\t\t\t\t\t_applyCurrentZoomPan();\n\t\t\t\t\t\t\n\t\t\t\t\t\t_stopAnimation('zoomPan');\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t};\n\t\treturn s;\n\t},\n\n\t_completePanGesture = function(animData) {\n\t\t// calculate swipe speed for Y axis (paanning)\n\t\tanimData.calculateSwipeSpeed('y');\n\n\t\t_currPanBounds = self.currItem.bounds;\n\t\t\n\t\tanimData.backAnimDestination = {};\n\t\tanimData.backAnimStarted = {};\n\n\t\t// Avoid acceleration animation if speed is too low\n\t\tif(Math.abs(animData.lastFlickSpeed.x) <= 0.05 && Math.abs(animData.lastFlickSpeed.y) <= 0.05 ) {\n\t\t\tanimData.speedDecelerationRatioAbs.x = animData.speedDecelerationRatioAbs.y = 0;\n\n\t\t\t// Run pan drag release animation. E.g. if you drag image and release finger without momentum.\n\t\t\tanimData.calculateOverBoundsAnimOffset('x');\n\t\t\tanimData.calculateOverBoundsAnimOffset('y');\n\t\t\treturn true;\n\t\t}\n\n\t\t// Animation loop that controls the acceleration after pan gesture ends\n\t\t_registerStartAnimation('zoomPan');\n\t\tanimData.lastNow = _getCurrentTime();\n\t\tanimData.panAnimLoop();\n\t},\n\n\n\t_finishSwipeMainScrollGesture = function(gestureType, _releaseAnimData) {\n\t\tvar itemChanged;\n\t\tif(!_mainScrollAnimating) {\n\t\t\t_currZoomedItemIndex = _currentItemIndex;\n\t\t}\n\n\n\t\t\n\t\tvar itemsDiff;\n\n\t\tif(gestureType === 'swipe') {\n\t\t\tvar totalShiftDist = _currPoint.x - _startPoint.x,\n\t\t\t\tisFastLastFlick = _releaseAnimData.lastFlickDist.x < 10;\n\n\t\t\t// if container is shifted for more than MIN_SWIPE_DISTANCE, \n\t\t\t// and last flick gesture was in right direction\n\t\t\tif(totalShiftDist > MIN_SWIPE_DISTANCE && \n\t\t\t\t(isFastLastFlick || _releaseAnimData.lastFlickOffset.x > 20) ) {\n\t\t\t\t// go to prev item\n\t\t\t\titemsDiff = -1;\n\t\t\t} else if(totalShiftDist < -MIN_SWIPE_DISTANCE && \n\t\t\t\t(isFastLastFlick || _releaseAnimData.lastFlickOffset.x < -20) ) {\n\t\t\t\t// go to next item\n\t\t\t\titemsDiff = 1;\n\t\t\t}\n\t\t}\n\n\t\tvar nextCircle;\n\n\t\tif(itemsDiff) {\n\t\t\t\n\t\t\t_currentItemIndex += itemsDiff;\n\n\t\t\tif(_currentItemIndex < 0) {\n\t\t\t\t_currentItemIndex = _options.loop ? _getNumItems()-1 : 0;\n\t\t\t\tnextCircle = true;\n\t\t\t} else if(_currentItemIndex >= _getNumItems()) {\n\t\t\t\t_currentItemIndex = _options.loop ? 0 : _getNumItems()-1;\n\t\t\t\tnextCircle = true;\n\t\t\t}\n\n\t\t\tif(!nextCircle || _options.loop) {\n\t\t\t\t_indexDiff += itemsDiff;\n\t\t\t\t_currPositionIndex -= itemsDiff;\n\t\t\t\titemChanged = true;\n\t\t\t}\n\t\t\t\n\n\t\t\t\n\t\t}\n\n\t\tvar animateToX = _slideSize.x * _currPositionIndex;\n\t\tvar animateToDist = Math.abs( animateToX - _mainScrollPos.x );\n\t\tvar finishAnimDuration;\n\n\n\t\tif(!itemChanged && animateToX > _mainScrollPos.x !== _releaseAnimData.lastFlickSpeed.x > 0) {\n\t\t\t// \"return to current\" duration, e.g. when dragging from slide 0 to -1\n\t\t\tfinishAnimDuration = 333; \n\t\t} else {\n\t\t\tfinishAnimDuration = Math.abs(_releaseAnimData.lastFlickSpeed.x) > 0 ? \n\t\t\t\t\t\t\t\t\tanimateToDist / Math.abs(_releaseAnimData.lastFlickSpeed.x) : \n\t\t\t\t\t\t\t\t\t333;\n\n\t\t\tfinishAnimDuration = Math.min(finishAnimDuration, 400);\n\t\t\tfinishAnimDuration = Math.max(finishAnimDuration, 250);\n\t\t}\n\n\t\tif(_currZoomedItemIndex === _currentItemIndex) {\n\t\t\titemChanged = false;\n\t\t}\n\t\t\n\t\t_mainScrollAnimating = true;\n\t\t\n\t\t_shout('mainScrollAnimStart');\n\n\t\t_animateProp('mainScroll', _mainScrollPos.x, animateToX, finishAnimDuration, framework.easing.cubic.out, \n\t\t\t_moveMainScroll,\n\t\t\tfunction() {\n\t\t\t\t_stopAllAnimations();\n\t\t\t\t_mainScrollAnimating = false;\n\t\t\t\t_currZoomedItemIndex = -1;\n\t\t\t\t\n\t\t\t\tif(itemChanged || _currZoomedItemIndex !== _currentItemIndex) {\n\t\t\t\t\tself.updateCurrItem();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t_shout('mainScrollAnimComplete');\n\t\t\t}\n\t\t);\n\n\t\tif(itemChanged) {\n\t\t\tself.updateCurrItem(true);\n\t\t}\n\n\t\treturn itemChanged;\n\t},\n\n\t_calculateZoomLevel = function(touchesDistance) {\n\t\treturn 1 / _startPointsDistance * touchesDistance * _startZoomLevel;\n\t},\n\n\t// Resets zoom if it's out of bounds\n\t_completeZoomGesture = function() {\n\t\tvar destZoomLevel = _currZoomLevel,\n\t\t\tminZoomLevel = _getMinZoomLevel(),\n\t\t\tmaxZoomLevel = _getMaxZoomLevel();\n\n\t\tif ( _currZoomLevel < minZoomLevel ) {\n\t\t\tdestZoomLevel = minZoomLevel;\n\t\t} else if ( _currZoomLevel > maxZoomLevel ) {\n\t\t\tdestZoomLevel = maxZoomLevel;\n\t\t}\n\n\t\tvar destOpacity = 1,\n\t\t\tonUpdate,\n\t\t\tinitialOpacity = _bgOpacity;\n\n\t\tif(_opacityChanged && !_isZoomingIn && !_wasOverInitialZoom && _currZoomLevel < minZoomLevel) {\n\t\t\t//_closedByScroll = true;\n\t\t\tself.close();\n\t\t\treturn true;\n\t\t}\n\n\t\tif(_opacityChanged) {\n\t\t\tonUpdate = function(now) {\n\t\t\t\t_applyBgOpacity( (destOpacity - initialOpacity) * now + initialOpacity );\n\t\t\t};\n\t\t}\n\n\t\tself.zoomTo(destZoomLevel, 0, 200, framework.easing.cubic.out, onUpdate);\n\t\treturn true;\n\t};\n\n\n_registerModule('Gestures', {\n\tpublicMethods: {\n\n\t\tinitGestures: function() {\n\n\t\t\t// helper function that builds touch/pointer/mouse events\n\t\t\tvar addEventNames = function(pref, down, move, up, cancel) {\n\t\t\t\t_dragStartEvent = pref + down;\n\t\t\t\t_dragMoveEvent = pref + move;\n\t\t\t\t_dragEndEvent = pref + up;\n\t\t\t\tif(cancel) {\n\t\t\t\t\t_dragCancelEvent = pref + cancel;\n\t\t\t\t} else {\n\t\t\t\t\t_dragCancelEvent = '';\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t_pointerEventEnabled = _features.pointerEvent;\n\t\t\tif(_pointerEventEnabled && _features.touch) {\n\t\t\t\t// we don't need touch events, if browser supports pointer events\n\t\t\t\t_features.touch = false;\n\t\t\t}\n\n\t\t\tif(_pointerEventEnabled) {\n\t\t\t\tif(navigator.msPointerEnabled) {\n\t\t\t\t\t// IE10 pointer events are case-sensitive\n\t\t\t\t\taddEventNames('MSPointer', 'Down', 'Move', 'Up', 'Cancel');\n\t\t\t\t} else {\n\t\t\t\t\taddEventNames('pointer', 'down', 'move', 'up', 'cancel');\n\t\t\t\t}\n\t\t\t} else if(_features.touch) {\n\t\t\t\taddEventNames('touch', 'start', 'move', 'end', 'cancel');\n\t\t\t\t_likelyTouchDevice = true;\n\t\t\t} else {\n\t\t\t\taddEventNames('mouse', 'down', 'move', 'up');\t\n\t\t\t}\n\n\t\t\t_upMoveEvents = _dragMoveEvent + ' ' + _dragEndEvent + ' ' + _dragCancelEvent;\n\t\t\t_downEvents = _dragStartEvent;\n\n\t\t\tif(_pointerEventEnabled && !_likelyTouchDevice) {\n\t\t\t\t_likelyTouchDevice = (navigator.maxTouchPoints > 1) || (navigator.msMaxTouchPoints > 1);\n\t\t\t}\n\t\t\t// make variable public\n\t\t\tself.likelyTouchDevice = _likelyTouchDevice; \n\t\t\t\n\t\t\t_globalEventHandlers[_dragStartEvent] = _onDragStart;\n\t\t\t_globalEventHandlers[_dragMoveEvent] = _onDragMove;\n\t\t\t_globalEventHandlers[_dragEndEvent] = _onDragRelease; // the Kraken\n\n\t\t\tif(_dragCancelEvent) {\n\t\t\t\t_globalEventHandlers[_dragCancelEvent] = _globalEventHandlers[_dragEndEvent];\n\t\t\t}\n\n\t\t\t// Bind mouse events on device with detected hardware touch support, in case it supports multiple types of input.\n\t\t\tif(_features.touch) {\n\t\t\t\t_downEvents += ' mousedown';\n\t\t\t\t_upMoveEvents += ' mousemove mouseup';\n\t\t\t\t_globalEventHandlers.mousedown = _globalEventHandlers[_dragStartEvent];\n\t\t\t\t_globalEventHandlers.mousemove = _globalEventHandlers[_dragMoveEvent];\n\t\t\t\t_globalEventHandlers.mouseup = _globalEventHandlers[_dragEndEvent];\n\t\t\t}\n\n\t\t\tif(!_likelyTouchDevice) {\n\t\t\t\t// don't allow pan to next slide from zoomed state on Desktop\n\t\t\t\t_options.allowPanToNext = false;\n\t\t\t}\n\t\t}\n\n\t}\n});\n\n\n/*>>gestures*/\n\n/*>>show-hide-transition*/\n/**\n * show-hide-transition.js:\n *\n * Manages initial opening or closing transition.\n *\n * If you're not planning to use transition for gallery at all,\n * you may set options hideAnimationDuration and showAnimationDuration to 0,\n * and just delete startAnimation function.\n * \n */\n\n\nvar _showOrHideTimeout,\n\t_showOrHide = function(item, img, out, completeFn) {\n\n\t\tif(_showOrHideTimeout) {\n\t\t\tclearTimeout(_showOrHideTimeout);\n\t\t}\n\n\t\t_initialZoomRunning = true;\n\t\t_initialContentSet = true;\n\t\t\n\t\t// dimensions of small thumbnail {x:,y:,w:}.\n\t\t// Height is optional, as calculated based on large image.\n\t\tvar thumbBounds; \n\t\tif(item.initialLayout) {\n\t\t\tthumbBounds = item.initialLayout;\n\t\t\titem.initialLayout = null;\n\t\t} else {\n\t\t\tthumbBounds = _options.getThumbBoundsFn && _options.getThumbBoundsFn(_currentItemIndex);\n\t\t}\n\n\t\tvar duration = out ? _options.hideAnimationDuration : _options.showAnimationDuration;\n\n\t\tvar onComplete = function() {\n\t\t\t_stopAnimation('initialZoom');\n\t\t\tif(!out) {\n\t\t\t\t_applyBgOpacity(1);\n\t\t\t\tif(img) {\n\t\t\t\t\timg.style.display = 'block';\n\t\t\t\t}\n\t\t\t\tframework.addClass(template, 'pswp--animated-in');\n\t\t\t\t_shout('initialZoom' + (out ? 'OutEnd' : 'InEnd'));\n\t\t\t} else {\n\t\t\t\tself.template.removeAttribute('style');\n\t\t\t\tself.bg.removeAttribute('style');\n\t\t\t}\n\n\t\t\tif(completeFn) {\n\t\t\t\tcompleteFn();\n\t\t\t}\n\t\t\t_initialZoomRunning = false;\n\t\t};\n\n\t\t// if bounds aren't provided, just open gallery without animation\n\t\tif(!duration || !thumbBounds || thumbBounds.x === undefined) {\n\n\t\t\t_shout('initialZoom' + (out ? 'Out' : 'In') );\n\n\t\t\t_currZoomLevel = item.initialZoomLevel;\n\t\t\t_equalizePoints(_panOffset, item.initialPosition );\n\t\t\t_applyCurrentZoomPan();\n\n\t\t\ttemplate.style.opacity = out ? 0 : 1;\n\t\t\t_applyBgOpacity(1);\n\n\t\t\tif(duration) {\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\tonComplete();\n\t\t\t\t}, duration);\n\t\t\t} else {\n\t\t\t\tonComplete();\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tvar startAnimation = function() {\n\t\t\tvar closeWithRaf = _closedByScroll,\n\t\t\t\tfadeEverything = !self.currItem.src || self.currItem.loadError || _options.showHideOpacity;\n\t\t\t\n\t\t\t// apply hw-acceleration to image\n\t\t\tif(item.miniImg) {\n\t\t\t\titem.miniImg.style.webkitBackfaceVisibility = 'hidden';\n\t\t\t}\n\n\t\t\tif(!out) {\n\t\t\t\t_currZoomLevel = thumbBounds.w / item.w;\n\t\t\t\t_panOffset.x = thumbBounds.x;\n\t\t\t\t_panOffset.y = thumbBounds.y - _initalWindowScrollY;\n\n\t\t\t\tself[fadeEverything ? 'template' : 'bg'].style.opacity = 0.001;\n\t\t\t\t_applyCurrentZoomPan();\n\t\t\t}\n\n\t\t\t_registerStartAnimation('initialZoom');\n\t\t\t\n\t\t\tif(out && !closeWithRaf) {\n\t\t\t\tframework.removeClass(template, 'pswp--animated-in');\n\t\t\t}\n\n\t\t\tif(fadeEverything) {\n\t\t\t\tif(out) {\n\t\t\t\t\tframework[ (closeWithRaf ? 'remove' : 'add') + 'Class' ](template, 'pswp--animate_opacity');\n\t\t\t\t} else {\n\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\tframework.addClass(template, 'pswp--animate_opacity');\n\t\t\t\t\t}, 30);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t_showOrHideTimeout = setTimeout(function() {\n\n\t\t\t\t_shout('initialZoom' + (out ? 'Out' : 'In') );\n\t\t\t\t\n\n\t\t\t\tif(!out) {\n\n\t\t\t\t\t// \"in\" animation always uses CSS transitions (instead of rAF).\n\t\t\t\t\t// CSS transition work faster here, \n\t\t\t\t\t// as developer may also want to animate other things, \n\t\t\t\t\t// like ui on top of sliding area, which can be animated just via CSS\n\t\t\t\t\t\n\t\t\t\t\t_currZoomLevel = item.initialZoomLevel;\n\t\t\t\t\t_equalizePoints(_panOffset, item.initialPosition );\n\t\t\t\t\t_applyCurrentZoomPan();\n\t\t\t\t\t_applyBgOpacity(1);\n\n\t\t\t\t\tif(fadeEverything) {\n\t\t\t\t\t\ttemplate.style.opacity = 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t_applyBgOpacity(1);\n\t\t\t\t\t}\n\n\t\t\t\t\t_showOrHideTimeout = setTimeout(onComplete, duration + 20);\n\t\t\t\t} else {\n\n\t\t\t\t\t// \"out\" animation uses rAF only when PhotoSwipe is closed by browser scroll, to recalculate position\n\t\t\t\t\tvar destZoomLevel = thumbBounds.w / item.w,\n\t\t\t\t\t\tinitialPanOffset = {\n\t\t\t\t\t\t\tx: _panOffset.x,\n\t\t\t\t\t\t\ty: _panOffset.y\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinitialZoomLevel = _currZoomLevel,\n\t\t\t\t\t\tinitalBgOpacity = _bgOpacity,\n\t\t\t\t\t\tonUpdate = function(now) {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(now === 1) {\n\t\t\t\t\t\t\t\t_currZoomLevel = destZoomLevel;\n\t\t\t\t\t\t\t\t_panOffset.x = thumbBounds.x;\n\t\t\t\t\t\t\t\t_panOffset.y = thumbBounds.y - _currentWindowScrollY;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t_currZoomLevel = (destZoomLevel - initialZoomLevel) * now + initialZoomLevel;\n\t\t\t\t\t\t\t\t_panOffset.x = (thumbBounds.x - initialPanOffset.x) * now + initialPanOffset.x;\n\t\t\t\t\t\t\t\t_panOffset.y = (thumbBounds.y - _currentWindowScrollY - initialPanOffset.y) * now + initialPanOffset.y;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t_applyCurrentZoomPan();\n\t\t\t\t\t\t\tif(fadeEverything) {\n\t\t\t\t\t\t\t\ttemplate.style.opacity = 1 - now;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t_applyBgOpacity( initalBgOpacity - now * initalBgOpacity );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\tif(closeWithRaf) {\n\t\t\t\t\t\t_animateProp('initialZoom', 0, 1, duration, framework.easing.cubic.out, onUpdate, onComplete);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tonUpdate(1);\n\t\t\t\t\t\t_showOrHideTimeout = setTimeout(onComplete, duration + 20);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\n\t\t\t}, out ? 25 : 90); // Main purpose of this delay is to give browser time to paint and\n\t\t\t\t\t// create composite layers of PhotoSwipe UI parts (background, controls, caption, arrows).\n\t\t\t\t\t// Which avoids lag at the beginning of scale transition.\n\t\t};\n\t\tstartAnimation();\n\n\t\t\n\t};\n\n/*>>show-hide-transition*/\n\n/*>>items-controller*/\n/**\n*\n* Controller manages gallery items, their dimensions, and their content.\n* \n*/\n\nvar _items,\n\t_tempPanAreaSize = {},\n\t_imagesToAppendPool = [],\n\t_initialContentSet,\n\t_initialZoomRunning,\n\t_controllerDefaultOptions = {\n\t\tindex: 0,\n\t\terrorMsg: '
The image could not be loaded.
',\n\t\tforceProgressiveLoading: false, // TODO\n\t\tpreload: [1,1],\n\t\tgetNumItemsFn: function() {\n\t\t\treturn _items.length;\n\t\t}\n\t};\n\n\nvar _getItemAt,\n\t_getNumItems,\n\t_initialIsLoop,\n\t_getZeroBounds = function() {\n\t\treturn {\n\t\t\tcenter:{x:0,y:0}, \n\t\t\tmax:{x:0,y:0}, \n\t\t\tmin:{x:0,y:0}\n\t\t};\n\t},\n\t_calculateSingleItemPanBounds = function(item, realPanElementW, realPanElementH ) {\n\t\tvar bounds = item.bounds;\n\n\t\t// position of element when it's centered\n\t\tbounds.center.x = Math.round((_tempPanAreaSize.x - realPanElementW) / 2);\n\t\tbounds.center.y = Math.round((_tempPanAreaSize.y - realPanElementH) / 2) + item.vGap.top;\n\n\t\t// maximum pan position\n\t\tbounds.max.x = (realPanElementW > _tempPanAreaSize.x) ? \n\t\t\t\t\t\t\tMath.round(_tempPanAreaSize.x - realPanElementW) : \n\t\t\t\t\t\t\tbounds.center.x;\n\t\t\n\t\tbounds.max.y = (realPanElementH > _tempPanAreaSize.y) ? \n\t\t\t\t\t\t\tMath.round(_tempPanAreaSize.y - realPanElementH) + item.vGap.top : \n\t\t\t\t\t\t\tbounds.center.y;\n\t\t\n\t\t// minimum pan position\n\t\tbounds.min.x = (realPanElementW > _tempPanAreaSize.x) ? 0 : bounds.center.x;\n\t\tbounds.min.y = (realPanElementH > _tempPanAreaSize.y) ? item.vGap.top : bounds.center.y;\n\t},\n\t_calculateItemSize = function(item, viewportSize, zoomLevel) {\n\n\t\tif (item.src && !item.loadError) {\n\t\t\tvar isInitial = !zoomLevel;\n\t\t\t\n\t\t\tif(isInitial) {\n\t\t\t\tif(!item.vGap) {\n\t\t\t\t\titem.vGap = {top:0,bottom:0};\n\t\t\t\t}\n\t\t\t\t// allows overriding vertical margin for individual items\n\t\t\t\t_shout('parseVerticalMargin', item);\n\t\t\t}\n\n\n\t\t\t_tempPanAreaSize.x = viewportSize.x;\n\t\t\t_tempPanAreaSize.y = viewportSize.y - item.vGap.top - item.vGap.bottom;\n\n\t\t\tif (isInitial) {\n\t\t\t\tvar hRatio = _tempPanAreaSize.x / item.w;\n\t\t\t\tvar vRatio = _tempPanAreaSize.y / item.h;\n\n\t\t\t\titem.fitRatio = hRatio < vRatio ? hRatio : vRatio;\n\t\t\t\t//item.fillRatio = hRatio > vRatio ? hRatio : vRatio;\n\n\t\t\t\tvar scaleMode = _options.scaleMode;\n\n\t\t\t\tif (scaleMode === 'orig') {\n\t\t\t\t\tzoomLevel = 1;\n\t\t\t\t} else if (scaleMode === 'fit') {\n\t\t\t\t\tzoomLevel = item.fitRatio;\n\t\t\t\t}\n\n\t\t\t\tif (zoomLevel > 1) {\n\t\t\t\t\tzoomLevel = 1;\n\t\t\t\t}\n\n\t\t\t\titem.initialZoomLevel = zoomLevel;\n\t\t\t\t\n\t\t\t\tif(!item.bounds) {\n\t\t\t\t\t// reuse bounds object\n\t\t\t\t\titem.bounds = _getZeroBounds(); \n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(!zoomLevel) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t_calculateSingleItemPanBounds(item, item.w * zoomLevel, item.h * zoomLevel);\n\n\t\t\tif (isInitial && zoomLevel === item.initialZoomLevel) {\n\t\t\t\titem.initialPosition = item.bounds.center;\n\t\t\t}\n\n\t\t\treturn item.bounds;\n\t\t} else {\n\t\t\titem.w = item.h = 0;\n\t\t\titem.initialZoomLevel = item.fitRatio = 1;\n\t\t\titem.bounds = _getZeroBounds();\n\t\t\titem.initialPosition = item.bounds.center;\n\n\t\t\t// if it's not image, we return zero bounds (content is not zoomable)\n\t\t\treturn item.bounds;\n\t\t}\n\t\t\n\t},\n\n\t\n\n\n\t_appendImage = function(index, item, baseDiv, img, preventAnimation, keepPlaceholder) {\n\t\t\n\n\t\tif(item.loadError) {\n\t\t\treturn;\n\t\t}\n\n\t\tif(img) {\n\n\t\t\titem.imageAppended = true;\n\t\t\t_setImageSize(item, img, (item === self.currItem && _renderMaxResolution) );\n\t\t\t\n\t\t\tbaseDiv.appendChild(img);\n\n\t\t\tif(keepPlaceholder) {\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\tif(item && item.loaded && item.placeholder) {\n\t\t\t\t\t\titem.placeholder.style.display = 'none';\n\t\t\t\t\t\titem.placeholder = null;\n\t\t\t\t\t}\n\t\t\t\t}, 500);\n\t\t\t}\n\t\t}\n\t},\n\t\n\n\n\t_preloadImage = function(item) {\n\t\titem.loading = true;\n\t\titem.loaded = false;\n\t\tvar img = item.img = framework.createEl('pswp__img', 'img');\n\t\tvar onComplete = function() {\n\t\t\titem.loading = false;\n\t\t\titem.loaded = true;\n\n\t\t\tif(item.loadComplete) {\n\t\t\t\titem.loadComplete(item);\n\t\t\t} else {\n\t\t\t\titem.img = null; // no need to store image object\n\t\t\t}\n\t\t\timg.onload = img.onerror = null;\n\t\t\timg = null;\n\t\t};\n\t\timg.onload = onComplete;\n\t\timg.onerror = function() {\n\t\t\titem.loadError = true;\n\t\t\tonComplete();\n\t\t};\t\t\n\n\t\timg.src = item.src;// + '?a=' + Math.random();\n\n\t\treturn img;\n\t},\n\t_checkForError = function(item, cleanUp) {\n\t\tif(item.src && item.loadError && item.container) {\n\n\t\t\tif(cleanUp) {\n\t\t\t\titem.container.innerHTML = '';\n\t\t\t}\n\n\t\t\titem.container.innerHTML = _options.errorMsg.replace('%url%', item.src );\n\t\t\treturn true;\n\t\t\t\n\t\t}\n\t},\n\t_setImageSize = function(item, img, maxRes) {\n\t\tif(!item.src) {\n\t\t\treturn;\n\t\t}\n\n\t\tif(!img) {\n\t\t\timg = item.container.lastChild;\n\t\t}\n\n\t\tvar w = maxRes ? item.w : Math.round(item.w * item.fitRatio),\n\t\t\th = maxRes ? item.h : Math.round(item.h * item.fitRatio);\n\t\t\n\t\tif(item.placeholder && !item.loaded) {\n\t\t\titem.placeholder.style.width = w + 'px';\n\t\t\titem.placeholder.style.height = h + 'px';\n\t\t}\n\n\t\timg.style.width = w + 'px';\n\t\timg.style.height = h + 'px';\n\t},\n\t_appendImagesPool = function() {\n\n\t\tif(_imagesToAppendPool.length) {\n\t\t\tvar poolItem;\n\n\t\t\tfor(var i = 0; i < _imagesToAppendPool.length; i++) {\n\t\t\t\tpoolItem = _imagesToAppendPool[i];\n\t\t\t\tif( poolItem.holder.index === poolItem.index ) {\n\t\t\t\t\t_appendImage(poolItem.index, poolItem.item, poolItem.baseDiv, poolItem.img, false, poolItem.clearPlaceholder);\n\t\t\t\t}\n\t\t\t}\n\t\t\t_imagesToAppendPool = [];\n\t\t}\n\t};\n\t\n\n\n_registerModule('Controller', {\n\n\tpublicMethods: {\n\n\t\tlazyLoadItem: function(index) {\n\t\t\tindex = _getLoopedId(index);\n\t\t\tvar item = _getItemAt(index);\n\n\t\t\tif(!item || ((item.loaded || item.loading) && !_itemsNeedUpdate)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t_shout('gettingData', index, item);\n\n\t\t\tif (!item.src) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t_preloadImage(item);\n\t\t},\n\t\tinitController: function() {\n\t\t\tframework.extend(_options, _controllerDefaultOptions, true);\n\t\t\tself.items = _items = items;\n\t\t\t_getItemAt = self.getItemAt;\n\t\t\t_getNumItems = _options.getNumItemsFn; //self.getNumItems;\n\n\n\n\t\t\t_initialIsLoop = _options.loop;\n\t\t\tif(_getNumItems() < 3) {\n\t\t\t\t_options.loop = false; // disable loop if less then 3 items\n\t\t\t}\n\n\t\t\t_listen('beforeChange', function(diff) {\n\n\t\t\t\tvar p = _options.preload,\n\t\t\t\t\tisNext = diff === null ? true : (diff >= 0),\n\t\t\t\t\tpreloadBefore = Math.min(p[0], _getNumItems() ),\n\t\t\t\t\tpreloadAfter = Math.min(p[1], _getNumItems() ),\n\t\t\t\t\ti;\n\n\n\t\t\t\tfor(i = 1; i <= (isNext ? preloadAfter : preloadBefore); i++) {\n\t\t\t\t\tself.lazyLoadItem(_currentItemIndex+i);\n\t\t\t\t}\n\t\t\t\tfor(i = 1; i <= (isNext ? preloadBefore : preloadAfter); i++) {\n\t\t\t\t\tself.lazyLoadItem(_currentItemIndex-i);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t_listen('initialLayout', function() {\n\t\t\t\tself.currItem.initialLayout = _options.getThumbBoundsFn && _options.getThumbBoundsFn(_currentItemIndex);\n\t\t\t});\n\n\t\t\t_listen('mainScrollAnimComplete', _appendImagesPool);\n\t\t\t_listen('initialZoomInEnd', _appendImagesPool);\n\n\n\n\t\t\t_listen('destroy', function() {\n\t\t\t\tvar item;\n\t\t\t\tfor(var i = 0; i < _items.length; i++) {\n\t\t\t\t\titem = _items[i];\n\t\t\t\t\t// remove reference to DOM elements, for GC\n\t\t\t\t\tif(item.container) {\n\t\t\t\t\t\titem.container = null; \n\t\t\t\t\t}\n\t\t\t\t\tif(item.placeholder) {\n\t\t\t\t\t\titem.placeholder = null;\n\t\t\t\t\t}\n\t\t\t\t\tif(item.img) {\n\t\t\t\t\t\titem.img = null;\n\t\t\t\t\t}\n\t\t\t\t\tif(item.preloader) {\n\t\t\t\t\t\titem.preloader = null;\n\t\t\t\t\t}\n\t\t\t\t\tif(item.loadError) {\n\t\t\t\t\t\titem.loaded = item.loadError = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t_imagesToAppendPool = null;\n\t\t\t});\n\t\t},\n\n\n\t\tgetItemAt: function(index) {\n\t\t\tif (index >= 0) {\n\t\t\t\treturn _items[index] !== undefined ? _items[index] : false;\n\t\t\t}\n\t\t\treturn false;\n\t\t},\n\n\t\tallowProgressiveImg: function() {\n\t\t\t// 1. Progressive image loading isn't working on webkit/blink \n\t\t\t// when hw-acceleration (e.g. translateZ) is applied to IMG element.\n\t\t\t// That's why in PhotoSwipe parent element gets zoom transform, not image itself.\n\t\t\t// \n\t\t\t// 2. Progressive image loading sometimes blinks in webkit/blink when applying animation to parent element.\n\t\t\t// That's why it's disabled on touch devices (mainly because of swipe transition)\n\t\t\t// \n\t\t\t// 3. Progressive image loading sometimes doesn't work in IE (up to 11).\n\n\t\t\t// Don't allow progressive loading on non-large touch devices\n\t\t\treturn _options.forceProgressiveLoading || !_likelyTouchDevice || _options.mouseUsed || screen.width > 1200; \n\t\t\t// 1200 - to eliminate touch devices with large screen (like Chromebook Pixel)\n\t\t},\n\n\t\tsetContent: function(holder, index) {\n\n\t\t\tif(_options.loop) {\n\t\t\t\tindex = _getLoopedId(index);\n\t\t\t}\n\n\t\t\tvar prevItem = self.getItemAt(holder.index);\n\t\t\tif(prevItem) {\n\t\t\t\tprevItem.container = null;\n\t\t\t}\n\t\n\t\t\tvar item = self.getItemAt(index),\n\t\t\t\timg;\n\t\t\t\n\t\t\tif(!item) {\n\t\t\t\tholder.el.innerHTML = '';\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// allow to override data\n\t\t\t_shout('gettingData', index, item);\n\n\t\t\tholder.index = index;\n\t\t\tholder.item = item;\n\n\t\t\t// base container DIV is created only once for each of 3 holders\n\t\t\tvar baseDiv = item.container = framework.createEl('pswp__zoom-wrap'); \n\n\t\t\t\n\n\t\t\tif(!item.src && item.html) {\n\t\t\t\tif(item.html.tagName) {\n\t\t\t\t\tbaseDiv.appendChild(item.html);\n\t\t\t\t} else {\n\t\t\t\t\tbaseDiv.innerHTML = item.html;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t_checkForError(item);\n\n\t\t\t_calculateItemSize(item, _viewportSize);\n\t\t\t\n\t\t\tif(item.src && !item.loadError && !item.loaded) {\n\n\t\t\t\titem.loadComplete = function(item) {\n\n\t\t\t\t\t// gallery closed before image finished loading\n\t\t\t\t\tif(!_isOpen) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// check if holder hasn't changed while image was loading\n\t\t\t\t\tif(holder && holder.index === index ) {\n\t\t\t\t\t\tif( _checkForError(item, true) ) {\n\t\t\t\t\t\t\titem.loadComplete = item.img = null;\n\t\t\t\t\t\t\t_calculateItemSize(item, _viewportSize);\n\t\t\t\t\t\t\t_applyZoomPanToItem(item);\n\n\t\t\t\t\t\t\tif(holder.index === _currentItemIndex) {\n\t\t\t\t\t\t\t\t// recalculate dimensions\n\t\t\t\t\t\t\t\tself.updateCurrZoomItem();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif( !item.imageAppended ) {\n\t\t\t\t\t\t\tif(_features.transform && (_mainScrollAnimating || _initialZoomRunning) ) {\n\t\t\t\t\t\t\t\t_imagesToAppendPool.push({\n\t\t\t\t\t\t\t\t\titem:item,\n\t\t\t\t\t\t\t\t\tbaseDiv:baseDiv,\n\t\t\t\t\t\t\t\t\timg:item.img,\n\t\t\t\t\t\t\t\t\tindex:index,\n\t\t\t\t\t\t\t\t\tholder:holder,\n\t\t\t\t\t\t\t\t\tclearPlaceholder:true\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t_appendImage(index, item, baseDiv, item.img, _mainScrollAnimating || _initialZoomRunning, true);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// remove preloader & mini-img\n\t\t\t\t\t\t\tif(!_initialZoomRunning && item.placeholder) {\n\t\t\t\t\t\t\t\titem.placeholder.style.display = 'none';\n\t\t\t\t\t\t\t\titem.placeholder = null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\titem.loadComplete = null;\n\t\t\t\t\titem.img = null; // no need to store image element after it's added\n\n\t\t\t\t\t_shout('imageLoadComplete', index, item);\n\t\t\t\t};\n\n\t\t\t\tif(framework.features.transform) {\n\t\t\t\t\t\n\t\t\t\t\tvar placeholderClassName = 'pswp__img pswp__img--placeholder'; \n\t\t\t\t\tplaceholderClassName += (item.msrc ? '' : ' pswp__img--placeholder--blank');\n\n\t\t\t\t\tvar placeholder = framework.createEl(placeholderClassName, item.msrc ? 'img' : '');\n\t\t\t\t\tif(item.msrc) {\n\t\t\t\t\t\tplaceholder.src = item.msrc;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t_setImageSize(item, placeholder);\n\n\t\t\t\t\tbaseDiv.appendChild(placeholder);\n\t\t\t\t\titem.placeholder = placeholder;\n\n\t\t\t\t}\n\t\t\t\t\n\n\t\t\t\t\n\n\t\t\t\tif(!item.loading) {\n\t\t\t\t\t_preloadImage(item);\n\t\t\t\t}\n\n\n\t\t\t\tif( self.allowProgressiveImg() ) {\n\t\t\t\t\t// just append image\n\t\t\t\t\tif(!_initialContentSet && _features.transform) {\n\t\t\t\t\t\t_imagesToAppendPool.push({\n\t\t\t\t\t\t\titem:item, \n\t\t\t\t\t\t\tbaseDiv:baseDiv, \n\t\t\t\t\t\t\timg:item.img, \n\t\t\t\t\t\t\tindex:index, \n\t\t\t\t\t\t\tholder:holder\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\t_appendImage(index, item, baseDiv, item.img, true, true);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t} else if(item.src && !item.loadError) {\n\t\t\t\t// image object is created every time, due to bugs of image loading & delay when switching images\n\t\t\t\timg = framework.createEl('pswp__img', 'img');\n\t\t\t\timg.style.opacity = 1;\n\t\t\t\timg.src = item.src;\n\t\t\t\t_setImageSize(item, img);\n\t\t\t\t_appendImage(index, item, baseDiv, img, true);\n\t\t\t}\n\t\t\t\n\n\t\t\tif(!_initialContentSet && index === _currentItemIndex) {\n\t\t\t\t_currZoomElementStyle = baseDiv.style;\n\t\t\t\t_showOrHide(item, (img ||item.img) );\n\t\t\t} else {\n\t\t\t\t_applyZoomPanToItem(item);\n\t\t\t}\n\n\t\t\tholder.el.innerHTML = '';\n\t\t\tholder.el.appendChild(baseDiv);\n\t\t},\n\n\t\tcleanSlide: function( item ) {\n\t\t\tif(item.img ) {\n\t\t\t\titem.img.onload = item.img.onerror = null;\n\t\t\t}\n\t\t\titem.loaded = item.loading = item.img = item.imageAppended = false;\n\t\t}\n\n\t}\n});\n\n/*>>items-controller*/\n\n/*>>tap*/\n/**\n * tap.js:\n *\n * Displatches tap and double-tap events.\n * \n */\n\nvar tapTimer,\n\ttapReleasePoint = {},\n\t_dispatchTapEvent = function(origEvent, releasePoint, pointerType) {\t\t\n\t\tvar e = document.createEvent( 'CustomEvent' ),\n\t\t\teDetail = {\n\t\t\t\torigEvent:origEvent, \n\t\t\t\ttarget:origEvent.target, \n\t\t\t\treleasePoint: releasePoint, \n\t\t\t\tpointerType:pointerType || 'touch'\n\t\t\t};\n\n\t\te.initCustomEvent( 'pswpTap', true, true, eDetail );\n\t\torigEvent.target.dispatchEvent(e);\n\t};\n\n_registerModule('Tap', {\n\tpublicMethods: {\n\t\tinitTap: function() {\n\t\t\t_listen('firstTouchStart', self.onTapStart);\n\t\t\t_listen('touchRelease', self.onTapRelease);\n\t\t\t_listen('destroy', function() {\n\t\t\t\ttapReleasePoint = {};\n\t\t\t\ttapTimer = null;\n\t\t\t});\n\t\t},\n\t\tonTapStart: function(touchList) {\n\t\t\tif(touchList.length > 1) {\n\t\t\t\tclearTimeout(tapTimer);\n\t\t\t\ttapTimer = null;\n\t\t\t}\n\t\t},\n\t\tonTapRelease: function(e, releasePoint) {\n\t\t\tif(!releasePoint) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(!_moved && !_isMultitouch && !_numAnimations) {\n\t\t\t\tvar p0 = releasePoint;\n\t\t\t\tif(tapTimer) {\n\t\t\t\t\tclearTimeout(tapTimer);\n\t\t\t\t\ttapTimer = null;\n\n\t\t\t\t\t// Check if taped on the same place\n\t\t\t\t\tif ( _isNearbyPoints(p0, tapReleasePoint) ) {\n\t\t\t\t\t\t_shout('doubleTap', p0);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif(releasePoint.type === 'mouse') {\n\t\t\t\t\t_dispatchTapEvent(e, releasePoint, 'mouse');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar clickedTagName = e.target.tagName.toUpperCase();\n\t\t\t\t// avoid double tap delay on buttons and elements that have class pswp__single-tap\n\t\t\t\tif(clickedTagName === 'BUTTON' || framework.hasClass(e.target, 'pswp__single-tap') ) {\n\t\t\t\t\t_dispatchTapEvent(e, releasePoint);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t_equalizePoints(tapReleasePoint, p0);\n\n\t\t\t\ttapTimer = setTimeout(function() {\n\t\t\t\t\t_dispatchTapEvent(e, releasePoint);\n\t\t\t\t\ttapTimer = null;\n\t\t\t\t}, 300);\n\t\t\t}\n\t\t}\n\t}\n});\n\n/*>>tap*/\n\n/*>>desktop-zoom*/\n/**\n *\n * desktop-zoom.js:\n *\n * - Binds mousewheel event for paning zoomed image.\n * - Manages \"dragging\", \"zoomed-in\", \"zoom-out\" classes.\n * (which are used for cursors and zoom icon)\n * - Adds toggleDesktopZoom function.\n * \n */\n\nvar _wheelDelta;\n\t\n_registerModule('DesktopZoom', {\n\n\tpublicMethods: {\n\n\t\tinitDesktopZoom: function() {\n\n\t\t\tif(_oldIE) {\n\t\t\t\t// no zoom for old IE (<=8)\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(_likelyTouchDevice) {\n\t\t\t\t// if detected hardware touch support, we wait until mouse is used,\n\t\t\t\t// and only then apply desktop-zoom features\n\t\t\t\t_listen('mouseUsed', function() {\n\t\t\t\t\tself.setupDesktopZoom();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tself.setupDesktopZoom(true);\n\t\t\t}\n\n\t\t},\n\n\t\tsetupDesktopZoom: function(onInit) {\n\n\t\t\t_wheelDelta = {};\n\n\t\t\tvar events = 'wheel mousewheel DOMMouseScroll';\n\t\t\t\n\t\t\t_listen('bindEvents', function() {\n\t\t\t\tframework.bind(template, events, self.handleMouseWheel);\n\t\t\t});\n\n\t\t\t_listen('unbindEvents', function() {\n\t\t\t\tif(_wheelDelta) {\n\t\t\t\t\tframework.unbind(template, events, self.handleMouseWheel);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tself.mouseZoomedIn = false;\n\n\t\t\tvar hasDraggingClass,\n\t\t\t\tupdateZoomable = function() {\n\t\t\t\t\tif(self.mouseZoomedIn) {\n\t\t\t\t\t\tframework.removeClass(template, 'pswp--zoomed-in');\n\t\t\t\t\t\tself.mouseZoomedIn = false;\n\t\t\t\t\t}\n\t\t\t\t\tif(_currZoomLevel < 1) {\n\t\t\t\t\t\tframework.addClass(template, 'pswp--zoom-allowed');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tframework.removeClass(template, 'pswp--zoom-allowed');\n\t\t\t\t\t}\n\t\t\t\t\tremoveDraggingClass();\n\t\t\t\t},\n\t\t\t\tremoveDraggingClass = function() {\n\t\t\t\t\tif(hasDraggingClass) {\n\t\t\t\t\t\tframework.removeClass(template, 'pswp--dragging');\n\t\t\t\t\t\thasDraggingClass = false;\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t_listen('resize' , updateZoomable);\n\t\t\t_listen('afterChange' , updateZoomable);\n\t\t\t_listen('pointerDown', function() {\n\t\t\t\tif(self.mouseZoomedIn) {\n\t\t\t\t\thasDraggingClass = true;\n\t\t\t\t\tframework.addClass(template, 'pswp--dragging');\n\t\t\t\t}\n\t\t\t});\n\t\t\t_listen('pointerUp', removeDraggingClass);\n\n\t\t\tif(!onInit) {\n\t\t\t\tupdateZoomable();\n\t\t\t}\n\t\t\t\n\t\t},\n\n\t\thandleMouseWheel: function(e) {\n\n\t\t\tif(_currZoomLevel <= self.currItem.fitRatio) {\n\t\t\t\tif( _options.modal ) {\n\n\t\t\t\t\tif (!_options.closeOnScroll || _numAnimations || _isDragging) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t} else if(_transformKey && Math.abs(e.deltaY) > 2) {\n\t\t\t\t\t\t// close PhotoSwipe\n\t\t\t\t\t\t// if browser supports transforms & scroll changed enough\n\t\t\t\t\t\t_closedByScroll = true;\n\t\t\t\t\t\tself.close();\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// allow just one event to fire\n\t\t\te.stopPropagation();\n\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/Events/wheel\n\t\t\t_wheelDelta.x = 0;\n\n\t\t\tif('deltaX' in e) {\n\t\t\t\tif(e.deltaMode === 1 /* DOM_DELTA_LINE */) {\n\t\t\t\t\t// 18 - average line height\n\t\t\t\t\t_wheelDelta.x = e.deltaX * 18;\n\t\t\t\t\t_wheelDelta.y = e.deltaY * 18;\n\t\t\t\t} else {\n\t\t\t\t\t_wheelDelta.x = e.deltaX;\n\t\t\t\t\t_wheelDelta.y = e.deltaY;\n\t\t\t\t}\n\t\t\t} else if('wheelDelta' in e) {\n\t\t\t\tif(e.wheelDeltaX) {\n\t\t\t\t\t_wheelDelta.x = -0.16 * e.wheelDeltaX;\n\t\t\t\t}\n\t\t\t\tif(e.wheelDeltaY) {\n\t\t\t\t\t_wheelDelta.y = -0.16 * e.wheelDeltaY;\n\t\t\t\t} else {\n\t\t\t\t\t_wheelDelta.y = -0.16 * e.wheelDelta;\n\t\t\t\t}\n\t\t\t} else if('detail' in e) {\n\t\t\t\t_wheelDelta.y = e.detail;\n\t\t\t} else {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t_calculatePanBounds(_currZoomLevel, true);\n\n\t\t\tvar newPanX = _panOffset.x - _wheelDelta.x,\n\t\t\t\tnewPanY = _panOffset.y - _wheelDelta.y;\n\n\t\t\t// only prevent scrolling in nonmodal mode when not at edges\n\t\t\tif (_options.modal ||\n\t\t\t\t(\n\t\t\t\tnewPanX <= _currPanBounds.min.x && newPanX >= _currPanBounds.max.x &&\n\t\t\t\tnewPanY <= _currPanBounds.min.y && newPanY >= _currPanBounds.max.y\n\t\t\t\t) ) {\n\t\t\t\te.preventDefault();\n\t\t\t}\n\n\t\t\t// TODO: use rAF instead of mousewheel?\n\t\t\tself.panTo(newPanX, newPanY);\n\t\t},\n\n\t\ttoggleDesktopZoom: function(centerPoint) {\n\t\t\tcenterPoint = centerPoint || {x:_viewportSize.x/2 + _offset.x, y:_viewportSize.y/2 + _offset.y };\n\n\t\t\tvar doubleTapZoomLevel = _options.getDoubleTapZoom(true, self.currItem);\n\t\t\tvar zoomOut = _currZoomLevel === doubleTapZoomLevel;\n\t\t\t\n\t\t\tself.mouseZoomedIn = !zoomOut;\n\n\t\t\tself.zoomTo(zoomOut ? self.currItem.initialZoomLevel : doubleTapZoomLevel, centerPoint, 333);\n\t\t\tframework[ (!zoomOut ? 'add' : 'remove') + 'Class'](template, 'pswp--zoomed-in');\n\t\t}\n\n\t}\n});\n\n\n/*>>desktop-zoom*/\n\n/*>>history*/\n/**\n *\n * history.js:\n *\n * - Back button to close gallery.\n * \n * - Unique URL for each slide: example.com/&pid=1&gid=3\n * (where PID is picture index, and GID and gallery index)\n * \n * - Switch URL when slides change.\n * \n */\n\n\nvar _historyDefaultOptions = {\n\thistory: true,\n\tgalleryUID: 1\n};\n\nvar _historyUpdateTimeout,\n\t_hashChangeTimeout,\n\t_hashAnimCheckTimeout,\n\t_hashChangedByScript,\n\t_hashChangedByHistory,\n\t_hashReseted,\n\t_initialHash,\n\t_historyChanged,\n\t_closedFromURL,\n\t_urlChangedOnce,\n\t_windowLoc,\n\n\t_supportsPushState,\n\n\t_getHash = function() {\n\t\treturn _windowLoc.hash.substring(1);\n\t},\n\t_cleanHistoryTimeouts = function() {\n\n\t\tif(_historyUpdateTimeout) {\n\t\t\tclearTimeout(_historyUpdateTimeout);\n\t\t}\n\n\t\tif(_hashAnimCheckTimeout) {\n\t\t\tclearTimeout(_hashAnimCheckTimeout);\n\t\t}\n\t},\n\n\t// pid - Picture index\n\t// gid - Gallery index\n\t_parseItemIndexFromURL = function() {\n\t\tvar hash = _getHash(),\n\t\t\tparams = {};\n\n\t\tif(hash.length < 5) { // pid=1\n\t\t\treturn params;\n\t\t}\n\n\t\tvar i, vars = hash.split('&');\n\t\tfor (i = 0; i < vars.length; i++) {\n\t\t\tif(!vars[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tvar pair = vars[i].split('=');\t\n\t\t\tif(pair.length < 2) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tparams[pair[0]] = pair[1];\n\t\t}\n\t\tif(_options.galleryPIDs) {\n\t\t\t// detect custom pid in hash and search for it among the items collection\n\t\t\tvar searchfor = params.pid;\n\t\t\tparams.pid = 0; // if custom pid cannot be found, fallback to the first item\n\t\t\tfor(i = 0; i < _items.length; i++) {\n\t\t\t\tif(_items[i].pid === searchfor) {\n\t\t\t\t\tparams.pid = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tparams.pid = parseInt(params.pid,10)-1;\n\t\t}\n\t\tif( params.pid < 0 ) {\n\t\t\tparams.pid = 0;\n\t\t}\n\t\treturn params;\n\t},\n\t_updateHash = function() {\n\n\t\tif(_hashAnimCheckTimeout) {\n\t\t\tclearTimeout(_hashAnimCheckTimeout);\n\t\t}\n\n\n\t\tif(_numAnimations || _isDragging) {\n\t\t\t// changing browser URL forces layout/paint in some browsers, which causes noticable lag during animation\n\t\t\t// that's why we update hash only when no animations running\n\t\t\t_hashAnimCheckTimeout = setTimeout(_updateHash, 500);\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif(_hashChangedByScript) {\n\t\t\tclearTimeout(_hashChangeTimeout);\n\t\t} else {\n\t\t\t_hashChangedByScript = true;\n\t\t}\n\n\n\t\tvar pid = (_currentItemIndex + 1);\n\t\tvar item = _getItemAt( _currentItemIndex );\n\t\tif(item.hasOwnProperty('pid')) {\n\t\t\t// carry forward any custom pid assigned to the item\n\t\t\tpid = item.pid;\n\t\t}\n\t\tvar newHash = _initialHash + '&' + 'gid=' + _options.galleryUID + '&' + 'pid=' + pid;\n\n\t\tif(!_historyChanged) {\n\t\t\tif(_windowLoc.hash.indexOf(newHash) === -1) {\n\t\t\t\t_urlChangedOnce = true;\n\t\t\t}\n\t\t\t// first time - add new hisory record, then just replace\n\t\t}\n\n\t\tvar newURL = _windowLoc.href.split('#')[0] + '#' + newHash;\n\n\t\tif( _supportsPushState ) {\n\n\t\t\tif('#' + newHash !== window.location.hash) {\n\t\t\t\thistory[_historyChanged ? 'replaceState' : 'pushState']('', document.title, newURL);\n\t\t\t}\n\n\t\t} else {\n\t\t\tif(_historyChanged) {\n\t\t\t\t_windowLoc.replace( newURL );\n\t\t\t} else {\n\t\t\t\t_windowLoc.hash = newHash;\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\n\t\t_historyChanged = true;\n\t\t_hashChangeTimeout = setTimeout(function() {\n\t\t\t_hashChangedByScript = false;\n\t\t}, 60);\n\t};\n\n\n\n\t\n\n_registerModule('History', {\n\n\t\n\n\tpublicMethods: {\n\t\tinitHistory: function() {\n\n\t\t\tframework.extend(_options, _historyDefaultOptions, true);\n\n\t\t\tif( !_options.history ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\n\t\t\t_windowLoc = window.location;\n\t\t\t_urlChangedOnce = false;\n\t\t\t_closedFromURL = false;\n\t\t\t_historyChanged = false;\n\t\t\t_initialHash = _getHash();\n\t\t\t_supportsPushState = ('pushState' in history);\n\n\n\t\t\tif(_initialHash.indexOf('gid=') > -1) {\n\t\t\t\t_initialHash = _initialHash.split('&gid=')[0];\n\t\t\t\t_initialHash = _initialHash.split('?gid=')[0];\n\t\t\t}\n\t\t\t\n\n\t\t\t_listen('afterChange', self.updateURL);\n\t\t\t_listen('unbindEvents', function() {\n\t\t\t\tframework.unbind(window, 'hashchange', self.onHashChange);\n\t\t\t});\n\n\n\t\t\tvar returnToOriginal = function() {\n\t\t\t\t_hashReseted = true;\n\t\t\t\tif(!_closedFromURL) {\n\n\t\t\t\t\tif(_urlChangedOnce) {\n\t\t\t\t\t\thistory.back();\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tif(_initialHash) {\n\t\t\t\t\t\t\t_windowLoc.hash = _initialHash;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (_supportsPushState) {\n\n\t\t\t\t\t\t\t\t// remove hash from url without refreshing it or scrolling to top\n\t\t\t\t\t\t\t\thistory.pushState('', document.title, _windowLoc.pathname + _windowLoc.search );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t_windowLoc.hash = '';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\n\t\t\t\t_cleanHistoryTimeouts();\n\t\t\t};\n\n\n\t\t\t_listen('unbindEvents', function() {\n\t\t\t\tif(_closedByScroll) {\n\t\t\t\t\t// if PhotoSwipe is closed by scroll, we go \"back\" before the closing animation starts\n\t\t\t\t\t// this is done to keep the scroll position\n\t\t\t\t\treturnToOriginal();\n\t\t\t\t}\n\t\t\t});\n\t\t\t_listen('destroy', function() {\n\t\t\t\tif(!_hashReseted) {\n\t\t\t\t\treturnToOriginal();\n\t\t\t\t}\n\t\t\t});\n\t\t\t_listen('firstUpdate', function() {\n\t\t\t\t_currentItemIndex = _parseItemIndexFromURL().pid;\n\t\t\t});\n\n\t\t\t\n\n\t\t\t\n\t\t\tvar index = _initialHash.indexOf('pid=');\n\t\t\tif(index > -1) {\n\t\t\t\t_initialHash = _initialHash.substring(0, index);\n\t\t\t\tif(_initialHash.slice(-1) === '&') {\n\t\t\t\t\t_initialHash = _initialHash.slice(0, -1);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\n\t\t\tsetTimeout(function() {\n\t\t\t\tif(_isOpen) { // hasn't destroyed yet\n\t\t\t\t\tframework.bind(window, 'hashchange', self.onHashChange);\n\t\t\t\t}\n\t\t\t}, 40);\n\t\t\t\n\t\t},\n\t\tonHashChange: function() {\n\n\t\t\tif(_getHash() === _initialHash) {\n\n\t\t\t\t_closedFromURL = true;\n\t\t\t\tself.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(!_hashChangedByScript) {\n\n\t\t\t\t_hashChangedByHistory = true;\n\t\t\t\tself.goTo( _parseItemIndexFromURL().pid );\n\t\t\t\t_hashChangedByHistory = false;\n\t\t\t}\n\t\t\t\n\t\t},\n\t\tupdateURL: function() {\n\n\t\t\t// Delay the update of URL, to avoid lag during transition, \n\t\t\t// and to not to trigger actions like \"refresh page sound\" or \"blinking favicon\" to often\n\t\t\t\n\t\t\t_cleanHistoryTimeouts();\n\t\t\t\n\n\t\t\tif(_hashChangedByHistory) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(!_historyChanged) {\n\t\t\t\t_updateHash(); // first time\n\t\t\t} else {\n\t\t\t\t_historyUpdateTimeout = setTimeout(_updateHash, 800);\n\t\t\t}\n\t\t}\n\t\n\t}\n});\n\n\n/*>>history*/\n\tframework.extend(self, publicMethods); };\n\treturn PhotoSwipe;\n});", "/*! PhotoSwipe Default UI - 4.1.3 - 2019-01-08\n* http://photoswipe.com\n* Copyright (c) 2019 Dmitry Semenov; */\n/**\n*\n* UI on top of main sliding area (caption, arrows, close button, etc.).\n* Built just using public methods/properties of PhotoSwipe.\n* \n*/\n(function (root, factory) { \n\tif (typeof define === 'function' && define.amd) {\n\t\tdefine(factory);\n\t} else if (typeof exports === 'object') {\n\t\tmodule.exports = factory();\n\t} else {\n\t\troot.PhotoSwipeUI_Default = factory();\n\t}\n})(this, function () {\n\n\t'use strict';\n\n\n\nvar PhotoSwipeUI_Default =\n function(pswp, framework) {\n\n\tvar ui = this;\n\tvar _overlayUIUpdated = false,\n\t\t_controlsVisible = true,\n\t\t_fullscrenAPI,\n\t\t_controls,\n\t\t_captionContainer,\n\t\t_fakeCaptionContainer,\n\t\t_indexIndicator,\n\t\t_shareButton,\n\t\t_shareModal,\n\t\t_shareModalHidden = true,\n\t\t_initalCloseOnScrollValue,\n\t\t_isIdle,\n\t\t_listen,\n\n\t\t_loadingIndicator,\n\t\t_loadingIndicatorHidden,\n\t\t_loadingIndicatorTimeout,\n\n\t\t_galleryHasOneSlide,\n\n\t\t_options,\n\t\t_defaultUIOptions = {\n\t\t\tbarsSize: {top:44, bottom:'auto'},\n\t\t\tcloseElClasses: ['item', 'caption', 'zoom-wrap', 'ui', 'top-bar'], \n\t\t\ttimeToIdle: 4000, \n\t\t\ttimeToIdleOutside: 1000,\n\t\t\tloadingIndicatorDelay: 1000, // 2s\n\t\t\t\n\t\t\taddCaptionHTMLFn: function(item, captionEl /*, isFake */) {\n\t\t\t\tif(!item.title) {\n\t\t\t\t\tcaptionEl.children[0].innerHTML = '';\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tcaptionEl.children[0].innerHTML = item.title;\n\t\t\t\treturn true;\n\t\t\t},\n\n\t\t\tcloseEl:true,\n\t\t\tcaptionEl: true,\n\t\t\tfullscreenEl: true,\n\t\t\tzoomEl: true,\n\t\t\tshareEl: true,\n\t\t\tcounterEl: true,\n\t\t\tarrowEl: true,\n\t\t\tpreloaderEl: true,\n\n\t\t\ttapToClose: false,\n\t\t\ttapToToggleControls: true,\n\n\t\t\tclickToCloseNonZoomable: true,\n\n\t\t\tshareButtons: [\n\t\t\t\t{id:'facebook', label:'Share on Facebook', url:'https://www.facebook.com/sharer/sharer.php?u={{url}}'},\n\t\t\t\t{id:'twitter', label:'Tweet', url:'https://twitter.com/intent/tweet?text={{text}}&url={{url}}'},\n\t\t\t\t{id:'pinterest', label:'Pin it', url:'http://www.pinterest.com/pin/create/button/'+\n\t\t\t\t\t\t\t\t\t\t\t\t\t'?url={{url}}&media={{image_url}}&description={{text}}'},\n\t\t\t\t{id:'download', label:'Download image', url:'{{raw_image_url}}', download:true}\n\t\t\t],\n\t\t\tgetImageURLForShare: function( /* shareButtonData */ ) {\n\t\t\t\treturn pswp.currItem.src || '';\n\t\t\t},\n\t\t\tgetPageURLForShare: function( /* shareButtonData */ ) {\n\t\t\t\treturn window.location.href;\n\t\t\t},\n\t\t\tgetTextForShare: function( /* shareButtonData */ ) {\n\t\t\t\treturn pswp.currItem.title || '';\n\t\t\t},\n\t\t\t\t\n\t\t\tindexIndicatorSep: ' / ',\n\t\t\tfitControlsWidth: 1200\n\n\t\t},\n\t\t_blockControlsTap,\n\t\t_blockControlsTapTimeout;\n\n\n\n\tvar _onControlsTap = function(e) {\n\t\t\tif(_blockControlsTap) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\n\t\t\te = e || window.event;\n\n\t\t\tif(_options.timeToIdle && _options.mouseUsed && !_isIdle) {\n\t\t\t\t// reset idle timer\n\t\t\t\t_onIdleMouseMove();\n\t\t\t}\n\n\n\t\t\tvar target = e.target || e.srcElement,\n\t\t\t\tuiElement,\n\t\t\t\tclickedClass = target.getAttribute('class') || '',\n\t\t\t\tfound;\n\n\t\t\tfor(var i = 0; i < _uiElements.length; i++) {\n\t\t\t\tuiElement = _uiElements[i];\n\t\t\t\tif(uiElement.onTap && clickedClass.indexOf('pswp__' + uiElement.name ) > -1 ) {\n\t\t\t\t\tuiElement.onTap();\n\t\t\t\t\tfound = true;\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(found) {\n\t\t\t\tif(e.stopPropagation) {\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t}\n\t\t\t\t_blockControlsTap = true;\n\n\t\t\t\t// Some versions of Android don't prevent ghost click event \n\t\t\t\t// when preventDefault() was called on touchstart and/or touchend.\n\t\t\t\t// \n\t\t\t\t// This happens on v4.3, 4.2, 4.1, \n\t\t\t\t// older versions strangely work correctly, \n\t\t\t\t// but just in case we add delay on all of them)\t\n\t\t\t\tvar tapDelay = framework.features.isOldAndroid ? 600 : 30;\n\t\t\t\t_blockControlsTapTimeout = setTimeout(function() {\n\t\t\t\t\t_blockControlsTap = false;\n\t\t\t\t}, tapDelay);\n\t\t\t}\n\n\t\t},\n\t\t_fitControlsInViewport = function() {\n\t\t\treturn !pswp.likelyTouchDevice || _options.mouseUsed || screen.width > _options.fitControlsWidth;\n\t\t},\n\t\t_togglePswpClass = function(el, cName, add) {\n\t\t\tframework[ (add ? 'add' : 'remove') + 'Class' ](el, 'pswp__' + cName);\n\t\t},\n\n\t\t// add class when there is just one item in the gallery\n\t\t// (by default it hides left/right arrows and 1ofX counter)\n\t\t_countNumItems = function() {\n\t\t\tvar hasOneSlide = (_options.getNumItemsFn() === 1);\n\n\t\t\tif(hasOneSlide !== _galleryHasOneSlide) {\n\t\t\t\t_togglePswpClass(_controls, 'ui--one-slide', hasOneSlide);\n\t\t\t\t_galleryHasOneSlide = hasOneSlide;\n\t\t\t}\n\t\t},\n\t\t_toggleShareModalClass = function() {\n\t\t\t_togglePswpClass(_shareModal, 'share-modal--hidden', _shareModalHidden);\n\t\t},\n\t\t_toggleShareModal = function() {\n\n\t\t\t_shareModalHidden = !_shareModalHidden;\n\t\t\t\n\t\t\t\n\t\t\tif(!_shareModalHidden) {\n\t\t\t\t_toggleShareModalClass();\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\tif(!_shareModalHidden) {\n\t\t\t\t\t\tframework.addClass(_shareModal, 'pswp__share-modal--fade-in');\n\t\t\t\t\t}\n\t\t\t\t}, 30);\n\t\t\t} else {\n\t\t\t\tframework.removeClass(_shareModal, 'pswp__share-modal--fade-in');\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\tif(_shareModalHidden) {\n\t\t\t\t\t\t_toggleShareModalClass();\n\t\t\t\t\t}\n\t\t\t\t}, 300);\n\t\t\t}\n\t\t\t\n\t\t\tif(!_shareModalHidden) {\n\t\t\t\t_updateShareURLs();\n\t\t\t}\n\t\t\treturn false;\n\t\t},\n\n\t\t_openWindowPopup = function(e) {\n\t\t\te = e || window.event;\n\t\t\tvar target = e.target || e.srcElement;\n\n\t\t\tpswp.shout('shareLinkClick', e, target);\n\n\t\t\tif(!target.href) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif( target.hasAttribute('download') ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\twindow.open(target.href, 'pswp_share', 'scrollbars=yes,resizable=yes,toolbar=no,'+\n\t\t\t\t\t\t\t\t\t\t'location=yes,width=550,height=420,top=100,left=' + \n\t\t\t\t\t\t\t\t\t\t(window.screen ? Math.round(screen.width / 2 - 275) : 100) );\n\n\t\t\tif(!_shareModalHidden) {\n\t\t\t\t_toggleShareModal();\n\t\t\t}\n\t\t\t\n\t\t\treturn false;\n\t\t},\n\t\t_updateShareURLs = function() {\n\t\t\tvar shareButtonOut = '',\n\t\t\t\tshareButtonData,\n\t\t\t\tshareURL,\n\t\t\t\timage_url,\n\t\t\t\tpage_url,\n\t\t\t\tshare_text;\n\n\t\t\tfor(var i = 0; i < _options.shareButtons.length; i++) {\n\t\t\t\tshareButtonData = _options.shareButtons[i];\n\n\t\t\t\timage_url = _options.getImageURLForShare(shareButtonData);\n\t\t\t\tpage_url = _options.getPageURLForShare(shareButtonData);\n\t\t\t\tshare_text = _options.getTextForShare(shareButtonData);\n\n\t\t\t\tshareURL = shareButtonData.url.replace('{{url}}', encodeURIComponent(page_url) )\n\t\t\t\t\t\t\t\t\t.replace('{{image_url}}', encodeURIComponent(image_url) )\n\t\t\t\t\t\t\t\t\t.replace('{{raw_image_url}}', image_url )\n\t\t\t\t\t\t\t\t\t.replace('{{text}}', encodeURIComponent(share_text) );\n\n\t\t\t\tshareButtonOut += '' + \n\t\t\t\t\t\t\t\t\tshareButtonData.label + '';\n\n\t\t\t\tif(_options.parseShareButtonOut) {\n\t\t\t\t\tshareButtonOut = _options.parseShareButtonOut(shareButtonData, shareButtonOut);\n\t\t\t\t}\n\t\t\t}\n\t\t\t_shareModal.children[0].innerHTML = shareButtonOut;\n\t\t\t_shareModal.children[0].onclick = _openWindowPopup;\n\n\t\t},\n\t\t_hasCloseClass = function(target) {\n\t\t\tfor(var i = 0; i < _options.closeElClasses.length; i++) {\n\t\t\t\tif( framework.hasClass(target, 'pswp__' + _options.closeElClasses[i]) ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t_idleInterval,\n\t\t_idleTimer,\n\t\t_idleIncrement = 0,\n\t\t_onIdleMouseMove = function() {\n\t\t\tclearTimeout(_idleTimer);\n\t\t\t_idleIncrement = 0;\n\t\t\tif(_isIdle) {\n\t\t\t\tui.setIdle(false);\n\t\t\t}\n\t\t},\n\t\t_onMouseLeaveWindow = function(e) {\n\t\t\te = e ? e : window.event;\n\t\t\tvar from = e.relatedTarget || e.toElement;\n\t\t\tif (!from || from.nodeName === 'HTML') {\n\t\t\t\tclearTimeout(_idleTimer);\n\t\t\t\t_idleTimer = setTimeout(function() {\n\t\t\t\t\tui.setIdle(true);\n\t\t\t\t}, _options.timeToIdleOutside);\n\t\t\t}\n\t\t},\n\t\t_setupFullscreenAPI = function() {\n\t\t\tif(_options.fullscreenEl && !framework.features.isOldAndroid) {\n\t\t\t\tif(!_fullscrenAPI) {\n\t\t\t\t\t_fullscrenAPI = ui.getFullscreenAPI();\n\t\t\t\t}\n\t\t\t\tif(_fullscrenAPI) {\n\t\t\t\t\tframework.bind(document, _fullscrenAPI.eventK, ui.updateFullscreen);\n\t\t\t\t\tui.updateFullscreen();\n\t\t\t\t\tframework.addClass(pswp.template, 'pswp--supports-fs');\n\t\t\t\t} else {\n\t\t\t\t\tframework.removeClass(pswp.template, 'pswp--supports-fs');\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t_setupLoadingIndicator = function() {\n\t\t\t// Setup loading indicator\n\t\t\tif(_options.preloaderEl) {\n\t\t\t\n\t\t\t\t_toggleLoadingIndicator(true);\n\n\t\t\t\t_listen('beforeChange', function() {\n\n\t\t\t\t\tclearTimeout(_loadingIndicatorTimeout);\n\n\t\t\t\t\t// display loading indicator with delay\n\t\t\t\t\t_loadingIndicatorTimeout = setTimeout(function() {\n\n\t\t\t\t\t\tif(pswp.currItem && pswp.currItem.loading) {\n\n\t\t\t\t\t\t\tif( !pswp.allowProgressiveImg() || (pswp.currItem.img && !pswp.currItem.img.naturalWidth) ) {\n\t\t\t\t\t\t\t\t// show preloader if progressive loading is not enabled, \n\t\t\t\t\t\t\t\t// or image width is not defined yet (because of slow connection)\n\t\t\t\t\t\t\t\t_toggleLoadingIndicator(false); \n\t\t\t\t\t\t\t\t// items-controller.js function allowProgressiveImg\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t_toggleLoadingIndicator(true); // hide preloader\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}, _options.loadingIndicatorDelay);\n\t\t\t\t\t\n\t\t\t\t});\n\t\t\t\t_listen('imageLoadComplete', function(index, item) {\n\t\t\t\t\tif(pswp.currItem === item) {\n\t\t\t\t\t\t_toggleLoadingIndicator(true);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t}\n\t\t},\n\t\t_toggleLoadingIndicator = function(hide) {\n\t\t\tif( _loadingIndicatorHidden !== hide ) {\n\t\t\t\t_togglePswpClass(_loadingIndicator, 'preloader--active', !hide);\n\t\t\t\t_loadingIndicatorHidden = hide;\n\t\t\t}\n\t\t},\n\t\t_applyNavBarGaps = function(item) {\n\t\t\tvar gap = item.vGap;\n\n\t\t\tif( _fitControlsInViewport() ) {\n\t\t\t\t\n\t\t\t\tvar bars = _options.barsSize; \n\t\t\t\tif(_options.captionEl && bars.bottom === 'auto') {\n\t\t\t\t\tif(!_fakeCaptionContainer) {\n\t\t\t\t\t\t_fakeCaptionContainer = framework.createEl('pswp__caption pswp__caption--fake');\n\t\t\t\t\t\t_fakeCaptionContainer.appendChild( framework.createEl('pswp__caption__center') );\n\t\t\t\t\t\t_controls.insertBefore(_fakeCaptionContainer, _captionContainer);\n\t\t\t\t\t\tframework.addClass(_controls, 'pswp__ui--fit');\n\t\t\t\t\t}\n\t\t\t\t\tif( _options.addCaptionHTMLFn(item, _fakeCaptionContainer, true) ) {\n\n\t\t\t\t\t\tvar captionSize = _fakeCaptionContainer.clientHeight;\n\t\t\t\t\t\tgap.bottom = parseInt(captionSize,10) || 44;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tgap.bottom = bars.top; // if no caption, set size of bottom gap to size of top\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tgap.bottom = bars.bottom === 'auto' ? 0 : bars.bottom;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// height of top bar is static, no need to calculate it\n\t\t\t\tgap.top = bars.top;\n\t\t\t} else {\n\t\t\t\tgap.top = gap.bottom = 0;\n\t\t\t}\n\t\t},\n\t\t_setupIdle = function() {\n\t\t\t// Hide controls when mouse is used\n\t\t\tif(_options.timeToIdle) {\n\t\t\t\t_listen('mouseUsed', function() {\n\t\t\t\t\t\n\t\t\t\t\tframework.bind(document, 'mousemove', _onIdleMouseMove);\n\t\t\t\t\tframework.bind(document, 'mouseout', _onMouseLeaveWindow);\n\n\t\t\t\t\t_idleInterval = setInterval(function() {\n\t\t\t\t\t\t_idleIncrement++;\n\t\t\t\t\t\tif(_idleIncrement === 2) {\n\t\t\t\t\t\t\tui.setIdle(true);\n\t\t\t\t\t\t}\n\t\t\t\t\t}, _options.timeToIdle / 2);\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t_setupHidingControlsDuringGestures = function() {\n\n\t\t\t// Hide controls on vertical drag\n\t\t\t_listen('onVerticalDrag', function(now) {\n\t\t\t\tif(_controlsVisible && now < 0.95) {\n\t\t\t\t\tui.hideControls();\n\t\t\t\t} else if(!_controlsVisible && now >= 0.95) {\n\t\t\t\t\tui.showControls();\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// Hide controls when pinching to close\n\t\t\tvar pinchControlsHidden;\n\t\t\t_listen('onPinchClose' , function(now) {\n\t\t\t\tif(_controlsVisible && now < 0.9) {\n\t\t\t\t\tui.hideControls();\n\t\t\t\t\tpinchControlsHidden = true;\n\t\t\t\t} else if(pinchControlsHidden && !_controlsVisible && now > 0.9) {\n\t\t\t\t\tui.showControls();\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t_listen('zoomGestureEnded', function() {\n\t\t\t\tpinchControlsHidden = false;\n\t\t\t\tif(pinchControlsHidden && !_controlsVisible) {\n\t\t\t\t\tui.showControls();\n\t\t\t\t}\n\t\t\t});\n\n\t\t};\n\n\n\n\tvar _uiElements = [\n\t\t{ \n\t\t\tname: 'caption', \n\t\t\toption: 'captionEl',\n\t\t\tonInit: function(el) { \n\t\t\t\t_captionContainer = el; \n\t\t\t} \n\t\t},\n\t\t{ \n\t\t\tname: 'share-modal', \n\t\t\toption: 'shareEl',\n\t\t\tonInit: function(el) { \n\t\t\t\t_shareModal = el;\n\t\t\t},\n\t\t\tonTap: function() {\n\t\t\t\t_toggleShareModal();\n\t\t\t} \n\t\t},\n\t\t{ \n\t\t\tname: 'button--share', \n\t\t\toption: 'shareEl',\n\t\t\tonInit: function(el) { \n\t\t\t\t_shareButton = el;\n\t\t\t},\n\t\t\tonTap: function() {\n\t\t\t\t_toggleShareModal();\n\t\t\t} \n\t\t},\n\t\t{ \n\t\t\tname: 'button--zoom', \n\t\t\toption: 'zoomEl',\n\t\t\tonTap: pswp.toggleDesktopZoom\n\t\t},\n\t\t{ \n\t\t\tname: 'counter', \n\t\t\toption: 'counterEl',\n\t\t\tonInit: function(el) { \n\t\t\t\t_indexIndicator = el;\n\t\t\t} \n\t\t},\n\t\t{ \n\t\t\tname: 'button--close', \n\t\t\toption: 'closeEl',\n\t\t\tonTap: pswp.close\n\t\t},\n\t\t{ \n\t\t\tname: 'button--arrow--left', \n\t\t\toption: 'arrowEl',\n\t\t\tonTap: pswp.prev\n\t\t},\n\t\t{ \n\t\t\tname: 'button--arrow--right', \n\t\t\toption: 'arrowEl',\n\t\t\tonTap: pswp.next\n\t\t},\n\t\t{ \n\t\t\tname: 'button--fs', \n\t\t\toption: 'fullscreenEl',\n\t\t\tonTap: function() { \n\t\t\t\tif(_fullscrenAPI.isFullscreen()) {\n\t\t\t\t\t_fullscrenAPI.exit();\n\t\t\t\t} else {\n\t\t\t\t\t_fullscrenAPI.enter();\n\t\t\t\t}\n\t\t\t} \n\t\t},\n\t\t{ \n\t\t\tname: 'preloader', \n\t\t\toption: 'preloaderEl',\n\t\t\tonInit: function(el) { \n\t\t\t\t_loadingIndicator = el;\n\t\t\t} \n\t\t}\n\n\t];\n\n\tvar _setupUIElements = function() {\n\t\tvar item,\n\t\t\tclassAttr,\n\t\t\tuiElement;\n\n\t\tvar loopThroughChildElements = function(sChildren) {\n\t\t\tif(!sChildren) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar l = sChildren.length;\n\t\t\tfor(var i = 0; i < l; i++) {\n\t\t\t\titem = sChildren[i];\n\t\t\t\tclassAttr = item.className;\n\n\t\t\t\tfor(var a = 0; a < _uiElements.length; a++) {\n\t\t\t\t\tuiElement = _uiElements[a];\n\n\t\t\t\t\tif(classAttr.indexOf('pswp__' + uiElement.name) > -1 ) {\n\n\t\t\t\t\t\tif( _options[uiElement.option] ) { // if element is not disabled from options\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tframework.removeClass(item, 'pswp__element--disabled');\n\t\t\t\t\t\t\tif(uiElement.onInit) {\n\t\t\t\t\t\t\t\tuiElement.onInit(item);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//item.style.display = 'block';\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tframework.addClass(item, 'pswp__element--disabled');\n\t\t\t\t\t\t\t//item.style.display = 'none';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tloopThroughChildElements(_controls.children);\n\n\t\tvar topBar = framework.getChildByClass(_controls, 'pswp__top-bar');\n\t\tif(topBar) {\n\t\t\tloopThroughChildElements( topBar.children );\n\t\t}\n\t};\n\n\n\t\n\n\tui.init = function() {\n\n\t\t// extend options\n\t\tframework.extend(pswp.options, _defaultUIOptions, true);\n\n\t\t// create local link for fast access\n\t\t_options = pswp.options;\n\n\t\t// find pswp__ui element\n\t\t_controls = framework.getChildByClass(pswp.scrollWrap, 'pswp__ui');\n\n\t\t// create local link\n\t\t_listen = pswp.listen;\n\n\n\t\t_setupHidingControlsDuringGestures();\n\n\t\t// update controls when slides change\n\t\t_listen('beforeChange', ui.update);\n\n\t\t// toggle zoom on double-tap\n\t\t_listen('doubleTap', function(point) {\n\t\t\tvar initialZoomLevel = pswp.currItem.initialZoomLevel;\n\t\t\tif(pswp.getZoomLevel() !== initialZoomLevel) {\n\t\t\t\tpswp.zoomTo(initialZoomLevel, point, 333);\n\t\t\t} else {\n\t\t\t\tpswp.zoomTo(_options.getDoubleTapZoom(false, pswp.currItem), point, 333);\n\t\t\t}\n\t\t});\n\n\t\t// Allow text selection in caption\n\t\t_listen('preventDragEvent', function(e, isDown, preventObj) {\n\t\t\tvar t = e.target || e.srcElement;\n\t\t\tif(\n\t\t\t\tt && \n\t\t\t\tt.getAttribute('class') && e.type.indexOf('mouse') > -1 && \n\t\t\t\t( t.getAttribute('class').indexOf('__caption') > 0 || (/(SMALL|STRONG|EM)/i).test(t.tagName) ) \n\t\t\t) {\n\t\t\t\tpreventObj.prevent = false;\n\t\t\t}\n\t\t});\n\n\t\t// bind events for UI\n\t\t_listen('bindEvents', function() {\n\t\t\tframework.bind(_controls, 'pswpTap click', _onControlsTap);\n\t\t\tframework.bind(pswp.scrollWrap, 'pswpTap', ui.onGlobalTap);\n\n\t\t\tif(!pswp.likelyTouchDevice) {\n\t\t\t\tframework.bind(pswp.scrollWrap, 'mouseover', ui.onMouseOver);\n\t\t\t}\n\t\t});\n\n\t\t// unbind events for UI\n\t\t_listen('unbindEvents', function() {\n\t\t\tif(!_shareModalHidden) {\n\t\t\t\t_toggleShareModal();\n\t\t\t}\n\n\t\t\tif(_idleInterval) {\n\t\t\t\tclearInterval(_idleInterval);\n\t\t\t}\n\t\t\tframework.unbind(document, 'mouseout', _onMouseLeaveWindow);\n\t\t\tframework.unbind(document, 'mousemove', _onIdleMouseMove);\n\t\t\tframework.unbind(_controls, 'pswpTap click', _onControlsTap);\n\t\t\tframework.unbind(pswp.scrollWrap, 'pswpTap', ui.onGlobalTap);\n\t\t\tframework.unbind(pswp.scrollWrap, 'mouseover', ui.onMouseOver);\n\n\t\t\tif(_fullscrenAPI) {\n\t\t\t\tframework.unbind(document, _fullscrenAPI.eventK, ui.updateFullscreen);\n\t\t\t\tif(_fullscrenAPI.isFullscreen()) {\n\t\t\t\t\t_options.hideAnimationDuration = 0;\n\t\t\t\t\t_fullscrenAPI.exit();\n\t\t\t\t}\n\t\t\t\t_fullscrenAPI = null;\n\t\t\t}\n\t\t});\n\n\n\t\t// clean up things when gallery is destroyed\n\t\t_listen('destroy', function() {\n\t\t\tif(_options.captionEl) {\n\t\t\t\tif(_fakeCaptionContainer) {\n\t\t\t\t\t_controls.removeChild(_fakeCaptionContainer);\n\t\t\t\t}\n\t\t\t\tframework.removeClass(_captionContainer, 'pswp__caption--empty');\n\t\t\t}\n\n\t\t\tif(_shareModal) {\n\t\t\t\t_shareModal.children[0].onclick = null;\n\t\t\t}\n\t\t\tframework.removeClass(_controls, 'pswp__ui--over-close');\n\t\t\tframework.addClass( _controls, 'pswp__ui--hidden');\n\t\t\tui.setIdle(false);\n\t\t});\n\t\t\n\n\t\tif(!_options.showAnimationDuration) {\n\t\t\tframework.removeClass( _controls, 'pswp__ui--hidden');\n\t\t}\n\t\t_listen('initialZoomIn', function() {\n\t\t\tif(_options.showAnimationDuration) {\n\t\t\t\tframework.removeClass( _controls, 'pswp__ui--hidden');\n\t\t\t}\n\t\t});\n\t\t_listen('initialZoomOut', function() {\n\t\t\tframework.addClass( _controls, 'pswp__ui--hidden');\n\t\t});\n\n\t\t_listen('parseVerticalMargin', _applyNavBarGaps);\n\t\t\n\t\t_setupUIElements();\n\n\t\tif(_options.shareEl && _shareButton && _shareModal) {\n\t\t\t_shareModalHidden = true;\n\t\t}\n\n\t\t_countNumItems();\n\n\t\t_setupIdle();\n\n\t\t_setupFullscreenAPI();\n\n\t\t_setupLoadingIndicator();\n\t};\n\n\tui.setIdle = function(isIdle) {\n\t\t_isIdle = isIdle;\n\t\t_togglePswpClass(_controls, 'ui--idle', isIdle);\n\t};\n\n\tui.update = function() {\n\t\t// Don't update UI if it's hidden\n\t\tif(_controlsVisible && pswp.currItem) {\n\t\t\t\n\t\t\tui.updateIndexIndicator();\n\n\t\t\tif(_options.captionEl) {\n\t\t\t\t_options.addCaptionHTMLFn(pswp.currItem, _captionContainer);\n\n\t\t\t\t_togglePswpClass(_captionContainer, 'caption--empty', !pswp.currItem.title);\n\t\t\t}\n\n\t\t\t_overlayUIUpdated = true;\n\n\t\t} else {\n\t\t\t_overlayUIUpdated = false;\n\t\t}\n\n\t\tif(!_shareModalHidden) {\n\t\t\t_toggleShareModal();\n\t\t}\n\n\t\t_countNumItems();\n\t};\n\n\tui.updateFullscreen = function(e) {\n\n\t\tif(e) {\n\t\t\t// some browsers change window scroll position during the fullscreen\n\t\t\t// so PhotoSwipe updates it just in case\n\t\t\tsetTimeout(function() {\n\t\t\t\tpswp.setScrollOffset( 0, framework.getScrollY() );\n\t\t\t}, 50);\n\t\t}\n\t\t\n\t\t// toogle pswp--fs class on root element\n\t\tframework[ (_fullscrenAPI.isFullscreen() ? 'add' : 'remove') + 'Class' ](pswp.template, 'pswp--fs');\n\t};\n\n\tui.updateIndexIndicator = function() {\n\t\tif(_options.counterEl) {\n\t\t\t_indexIndicator.innerHTML = (pswp.getCurrentIndex()+1) + \n\t\t\t\t\t\t\t\t\t\t_options.indexIndicatorSep + \n\t\t\t\t\t\t\t\t\t\t_options.getNumItemsFn();\n\t\t}\n\t};\n\t\n\tui.onGlobalTap = function(e) {\n\t\te = e || window.event;\n\t\tvar target = e.target || e.srcElement;\n\n\t\tif(_blockControlsTap) {\n\t\t\treturn;\n\t\t}\n\n\t\tif(e.detail && e.detail.pointerType === 'mouse') {\n\n\t\t\t// close gallery if clicked outside of the image\n\t\t\tif(_hasCloseClass(target)) {\n\t\t\t\tpswp.close();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(framework.hasClass(target, 'pswp__img')) {\n\t\t\t\tif(pswp.getZoomLevel() === 1 && pswp.getZoomLevel() <= pswp.currItem.fitRatio) {\n\t\t\t\t\tif(_options.clickToCloseNonZoomable) {\n\t\t\t\t\t\tpswp.close();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tpswp.toggleDesktopZoom(e.detail.releasePoint);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t} else {\n\n\t\t\t// tap anywhere (except buttons) to toggle visibility of controls\n\t\t\tif(_options.tapToToggleControls) {\n\t\t\t\tif(_controlsVisible) {\n\t\t\t\t\tui.hideControls();\n\t\t\t\t} else {\n\t\t\t\t\tui.showControls();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// tap to close gallery\n\t\t\tif(_options.tapToClose && (framework.hasClass(target, 'pswp__img') || _hasCloseClass(target)) ) {\n\t\t\t\tpswp.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t}\n\t};\n\tui.onMouseOver = function(e) {\n\t\te = e || window.event;\n\t\tvar target = e.target || e.srcElement;\n\n\t\t// add class when mouse is over an element that should close the gallery\n\t\t_togglePswpClass(_controls, 'ui--over-close', _hasCloseClass(target));\n\t};\n\n\tui.hideControls = function() {\n\t\tframework.addClass(_controls,'pswp__ui--hidden');\n\t\t_controlsVisible = false;\n\t};\n\n\tui.showControls = function() {\n\t\t_controlsVisible = true;\n\t\tif(!_overlayUIUpdated) {\n\t\t\tui.update();\n\t\t}\n\t\tframework.removeClass(_controls,'pswp__ui--hidden');\n\t};\n\n\tui.supportsFullscreen = function() {\n\t\tvar d = document;\n\t\treturn !!(d.exitFullscreen || d.mozCancelFullScreen || d.webkitExitFullscreen || d.msExitFullscreen);\n\t};\n\n\tui.getFullscreenAPI = function() {\n\t\tvar dE = document.documentElement,\n\t\t\tapi,\n\t\t\ttF = 'fullscreenchange';\n\n\t\tif (dE.requestFullscreen) {\n\t\t\tapi = {\n\t\t\t\tenterK: 'requestFullscreen',\n\t\t\t\texitK: 'exitFullscreen',\n\t\t\t\telementK: 'fullscreenElement',\n\t\t\t\teventK: tF\n\t\t\t};\n\n\t\t} else if(dE.mozRequestFullScreen ) {\n\t\t\tapi = {\n\t\t\t\tenterK: 'mozRequestFullScreen',\n\t\t\t\texitK: 'mozCancelFullScreen',\n\t\t\t\telementK: 'mozFullScreenElement',\n\t\t\t\teventK: 'moz' + tF\n\t\t\t};\n\n\t\t\t\n\n\t\t} else if(dE.webkitRequestFullscreen) {\n\t\t\tapi = {\n\t\t\t\tenterK: 'webkitRequestFullscreen',\n\t\t\t\texitK: 'webkitExitFullscreen',\n\t\t\t\telementK: 'webkitFullscreenElement',\n\t\t\t\teventK: 'webkit' + tF\n\t\t\t};\n\n\t\t} else if(dE.msRequestFullscreen) {\n\t\t\tapi = {\n\t\t\t\tenterK: 'msRequestFullscreen',\n\t\t\t\texitK: 'msExitFullscreen',\n\t\t\t\telementK: 'msFullscreenElement',\n\t\t\t\teventK: 'MSFullscreenChange'\n\t\t\t};\n\t\t}\n\n\t\tif(api) {\n\t\t\tapi.enter = function() { \n\t\t\t\t// disable close-on-scroll in fullscreen\n\t\t\t\t_initalCloseOnScrollValue = _options.closeOnScroll; \n\t\t\t\t_options.closeOnScroll = false; \n\n\t\t\t\tif(this.enterK === 'webkitRequestFullscreen') {\n\t\t\t\t\tpswp.template[this.enterK]( Element.ALLOW_KEYBOARD_INPUT );\n\t\t\t\t} else {\n\t\t\t\t\treturn pswp.template[this.enterK](); \n\t\t\t\t}\n\t\t\t};\n\t\t\tapi.exit = function() { \n\t\t\t\t_options.closeOnScroll = _initalCloseOnScrollValue;\n\n\t\t\t\treturn document[this.exitK](); \n\n\t\t\t};\n\t\t\tapi.isFullscreen = function() { return document[this.elementK]; };\n\t\t}\n\n\t\treturn api;\n\t};\n\n\n\n};\nreturn PhotoSwipeUI_Default;\n\n\n});\n", "(function() {\n\n var debug = false;\n\n var root = this;\n\n var EXIF = function(obj) {\n if (obj instanceof EXIF) return obj;\n if (!(this instanceof EXIF)) return new EXIF(obj);\n this.EXIFwrapped = obj;\n };\n\n if (typeof exports !== 'undefined') {\n if (typeof module !== 'undefined' && module.exports) {\n exports = module.exports = EXIF;\n }\n exports.EXIF = EXIF;\n } else {\n root.EXIF = EXIF;\n }\n\n var ExifTags = EXIF.Tags = {\n\n // version tags\n 0x9000 : \"ExifVersion\", // EXIF version\n 0xA000 : \"FlashpixVersion\", // Flashpix format version\n\n // colorspace tags\n 0xA001 : \"ColorSpace\", // Color space information tag\n\n // image configuration\n 0xA002 : \"PixelXDimension\", // Valid width of meaningful image\n 0xA003 : \"PixelYDimension\", // Valid height of meaningful image\n 0x9101 : \"ComponentsConfiguration\", // Information about channels\n 0x9102 : \"CompressedBitsPerPixel\", // Compressed bits per pixel\n\n // user information\n 0x927C : \"MakerNote\", // Any desired information written by the manufacturer\n 0x9286 : \"UserComment\", // Comments by user\n\n // related file\n 0xA004 : \"RelatedSoundFile\", // Name of related sound file\n\n // date and time\n 0x9003 : \"DateTimeOriginal\", // Date and time when the original image was generated\n 0x9004 : \"DateTimeDigitized\", // Date and time when the image was stored digitally\n 0x9290 : \"SubsecTime\", // Fractions of seconds for DateTime\n 0x9291 : \"SubsecTimeOriginal\", // Fractions of seconds for DateTimeOriginal\n 0x9292 : \"SubsecTimeDigitized\", // Fractions of seconds for DateTimeDigitized\n\n // picture-taking conditions\n 0x829A : \"ExposureTime\", // Exposure time (in seconds)\n 0x829D : \"FNumber\", // F number\n 0x8822 : \"ExposureProgram\", // Exposure program\n 0x8824 : \"SpectralSensitivity\", // Spectral sensitivity\n 0x8827 : \"ISOSpeedRatings\", // ISO speed rating\n 0x8828 : \"OECF\", // Optoelectric conversion factor\n 0x9201 : \"ShutterSpeedValue\", // Shutter speed\n 0x9202 : \"ApertureValue\", // Lens aperture\n 0x9203 : \"BrightnessValue\", // Value of brightness\n 0x9204 : \"ExposureBias\", // Exposure bias\n 0x9205 : \"MaxApertureValue\", // Smallest F number of lens\n 0x9206 : \"SubjectDistance\", // Distance to subject in meters\n 0x9207 : \"MeteringMode\", // Metering mode\n 0x9208 : \"LightSource\", // Kind of light source\n 0x9209 : \"Flash\", // Flash status\n 0x9214 : \"SubjectArea\", // Location and area of main subject\n 0x920A : \"FocalLength\", // Focal length of the lens in mm\n 0xA20B : \"FlashEnergy\", // Strobe energy in BCPS\n 0xA20C : \"SpatialFrequencyResponse\", //\n 0xA20E : \"FocalPlaneXResolution\", // Number of pixels in width direction per FocalPlaneResolutionUnit\n 0xA20F : \"FocalPlaneYResolution\", // Number of pixels in height direction per FocalPlaneResolutionUnit\n 0xA210 : \"FocalPlaneResolutionUnit\", // Unit for measuring FocalPlaneXResolution and FocalPlaneYResolution\n 0xA214 : \"SubjectLocation\", // Location of subject in image\n 0xA215 : \"ExposureIndex\", // Exposure index selected on camera\n 0xA217 : \"SensingMethod\", // Image sensor type\n 0xA300 : \"FileSource\", // Image source (3 == DSC)\n 0xA301 : \"SceneType\", // Scene type (1 == directly photographed)\n 0xA302 : \"CFAPattern\", // Color filter array geometric pattern\n 0xA401 : \"CustomRendered\", // Special processing\n 0xA402 : \"ExposureMode\", // Exposure mode\n 0xA403 : \"WhiteBalance\", // 1 = auto white balance, 2 = manual\n 0xA404 : \"DigitalZoomRation\", // Digital zoom ratio\n 0xA405 : \"FocalLengthIn35mmFilm\", // Equivalent foacl length assuming 35mm film camera (in mm)\n 0xA406 : \"SceneCaptureType\", // Type of scene\n 0xA407 : \"GainControl\", // Degree of overall image gain adjustment\n 0xA408 : \"Contrast\", // Direction of contrast processing applied by camera\n 0xA409 : \"Saturation\", // Direction of saturation processing applied by camera\n 0xA40A : \"Sharpness\", // Direction of sharpness processing applied by camera\n 0xA40B : \"DeviceSettingDescription\", //\n 0xA40C : \"SubjectDistanceRange\", // Distance to subject\n\n // other tags\n 0xA005 : \"InteroperabilityIFDPointer\",\n 0xA420 : \"ImageUniqueID\" // Identifier assigned uniquely to each image\n };\n\n var TiffTags = EXIF.TiffTags = {\n 0x0100 : \"ImageWidth\",\n 0x0101 : \"ImageHeight\",\n 0x8769 : \"ExifIFDPointer\",\n 0x8825 : \"GPSInfoIFDPointer\",\n 0xA005 : \"InteroperabilityIFDPointer\",\n 0x0102 : \"BitsPerSample\",\n 0x0103 : \"Compression\",\n 0x0106 : \"PhotometricInterpretation\",\n 0x0112 : \"Orientation\",\n 0x0115 : \"SamplesPerPixel\",\n 0x011C : \"PlanarConfiguration\",\n 0x0212 : \"YCbCrSubSampling\",\n 0x0213 : \"YCbCrPositioning\",\n 0x011A : \"XResolution\",\n 0x011B : \"YResolution\",\n 0x0128 : \"ResolutionUnit\",\n 0x0111 : \"StripOffsets\",\n 0x0116 : \"RowsPerStrip\",\n 0x0117 : \"StripByteCounts\",\n 0x0201 : \"JPEGInterchangeFormat\",\n 0x0202 : \"JPEGInterchangeFormatLength\",\n 0x012D : \"TransferFunction\",\n 0x013E : \"WhitePoint\",\n 0x013F : \"PrimaryChromaticities\",\n 0x0211 : \"YCbCrCoefficients\",\n 0x0214 : \"ReferenceBlackWhite\",\n 0x0132 : \"DateTime\",\n 0x010E : \"ImageDescription\",\n 0x010F : \"Make\",\n 0x0110 : \"Model\",\n 0x0131 : \"Software\",\n 0x013B : \"Artist\",\n 0x8298 : \"Copyright\"\n };\n\n var GPSTags = EXIF.GPSTags = {\n 0x0000 : \"GPSVersionID\",\n 0x0001 : \"GPSLatitudeRef\",\n 0x0002 : \"GPSLatitude\",\n 0x0003 : \"GPSLongitudeRef\",\n 0x0004 : \"GPSLongitude\",\n 0x0005 : \"GPSAltitudeRef\",\n 0x0006 : \"GPSAltitude\",\n 0x0007 : \"GPSTimeStamp\",\n 0x0008 : \"GPSSatellites\",\n 0x0009 : \"GPSStatus\",\n 0x000A : \"GPSMeasureMode\",\n 0x000B : \"GPSDOP\",\n 0x000C : \"GPSSpeedRef\",\n 0x000D : \"GPSSpeed\",\n 0x000E : \"GPSTrackRef\",\n 0x000F : \"GPSTrack\",\n 0x0010 : \"GPSImgDirectionRef\",\n 0x0011 : \"GPSImgDirection\",\n 0x0012 : \"GPSMapDatum\",\n 0x0013 : \"GPSDestLatitudeRef\",\n 0x0014 : \"GPSDestLatitude\",\n 0x0015 : \"GPSDestLongitudeRef\",\n 0x0016 : \"GPSDestLongitude\",\n 0x0017 : \"GPSDestBearingRef\",\n 0x0018 : \"GPSDestBearing\",\n 0x0019 : \"GPSDestDistanceRef\",\n 0x001A : \"GPSDestDistance\",\n 0x001B : \"GPSProcessingMethod\",\n 0x001C : \"GPSAreaInformation\",\n 0x001D : \"GPSDateStamp\",\n 0x001E : \"GPSDifferential\"\n };\n\n // EXIF 2.3 Spec\n var IFD1Tags = EXIF.IFD1Tags = {\n 0x0100: \"ImageWidth\",\n 0x0101: \"ImageHeight\",\n 0x0102: \"BitsPerSample\",\n 0x0103: \"Compression\",\n 0x0106: \"PhotometricInterpretation\",\n 0x0111: \"StripOffsets\",\n 0x0112: \"Orientation\",\n 0x0115: \"SamplesPerPixel\",\n 0x0116: \"RowsPerStrip\",\n 0x0117: \"StripByteCounts\",\n 0x011A: \"XResolution\",\n 0x011B: \"YResolution\",\n 0x011C: \"PlanarConfiguration\",\n 0x0128: \"ResolutionUnit\",\n 0x0201: \"JpegIFOffset\", // When image format is JPEG, this value show offset to JPEG data stored.(aka \"ThumbnailOffset\" or \"JPEGInterchangeFormat\")\n 0x0202: \"JpegIFByteCount\", // When image format is JPEG, this value shows data size of JPEG image (aka \"ThumbnailLength\" or \"JPEGInterchangeFormatLength\")\n 0x0211: \"YCbCrCoefficients\",\n 0x0212: \"YCbCrSubSampling\",\n 0x0213: \"YCbCrPositioning\",\n 0x0214: \"ReferenceBlackWhite\"\n };\n\n var StringValues = EXIF.StringValues = {\n ExposureProgram : {\n 0 : \"Not defined\",\n 1 : \"Manual\",\n 2 : \"Normal program\",\n 3 : \"Aperture priority\",\n 4 : \"Shutter priority\",\n 5 : \"Creative program\",\n 6 : \"Action program\",\n 7 : \"Portrait mode\",\n 8 : \"Landscape mode\"\n },\n MeteringMode : {\n 0 : \"Unknown\",\n 1 : \"Average\",\n 2 : \"CenterWeightedAverage\",\n 3 : \"Spot\",\n 4 : \"MultiSpot\",\n 5 : \"Pattern\",\n 6 : \"Partial\",\n 255 : \"Other\"\n },\n LightSource : {\n 0 : \"Unknown\",\n 1 : \"Daylight\",\n 2 : \"Fluorescent\",\n 3 : \"Tungsten (incandescent light)\",\n 4 : \"Flash\",\n 9 : \"Fine weather\",\n 10 : \"Cloudy weather\",\n 11 : \"Shade\",\n 12 : \"Daylight fluorescent (D 5700 - 7100K)\",\n 13 : \"Day white fluorescent (N 4600 - 5400K)\",\n 14 : \"Cool white fluorescent (W 3900 - 4500K)\",\n 15 : \"White fluorescent (WW 3200 - 3700K)\",\n 17 : \"Standard light A\",\n 18 : \"Standard light B\",\n 19 : \"Standard light C\",\n 20 : \"D55\",\n 21 : \"D65\",\n 22 : \"D75\",\n 23 : \"D50\",\n 24 : \"ISO studio tungsten\",\n 255 : \"Other\"\n },\n Flash : {\n 0x0000 : \"Flash did not fire\",\n 0x0001 : \"Flash fired\",\n 0x0005 : \"Strobe return light not detected\",\n 0x0007 : \"Strobe return light detected\",\n 0x0009 : \"Flash fired, compulsory flash mode\",\n 0x000D : \"Flash fired, compulsory flash mode, return light not detected\",\n 0x000F : \"Flash fired, compulsory flash mode, return light detected\",\n 0x0010 : \"Flash did not fire, compulsory flash mode\",\n 0x0018 : \"Flash did not fire, auto mode\",\n 0x0019 : \"Flash fired, auto mode\",\n 0x001D : \"Flash fired, auto mode, return light not detected\",\n 0x001F : \"Flash fired, auto mode, return light detected\",\n 0x0020 : \"No flash function\",\n 0x0041 : \"Flash fired, red-eye reduction mode\",\n 0x0045 : \"Flash fired, red-eye reduction mode, return light not detected\",\n 0x0047 : \"Flash fired, red-eye reduction mode, return light detected\",\n 0x0049 : \"Flash fired, compulsory flash mode, red-eye reduction mode\",\n 0x004D : \"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected\",\n 0x004F : \"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected\",\n 0x0059 : \"Flash fired, auto mode, red-eye reduction mode\",\n 0x005D : \"Flash fired, auto mode, return light not detected, red-eye reduction mode\",\n 0x005F : \"Flash fired, auto mode, return light detected, red-eye reduction mode\"\n },\n SensingMethod : {\n 1 : \"Not defined\",\n 2 : \"One-chip color area sensor\",\n 3 : \"Two-chip color area sensor\",\n 4 : \"Three-chip color area sensor\",\n 5 : \"Color sequential area sensor\",\n 7 : \"Trilinear sensor\",\n 8 : \"Color sequential linear sensor\"\n },\n SceneCaptureType : {\n 0 : \"Standard\",\n 1 : \"Landscape\",\n 2 : \"Portrait\",\n 3 : \"Night scene\"\n },\n SceneType : {\n 1 : \"Directly photographed\"\n },\n CustomRendered : {\n 0 : \"Normal process\",\n 1 : \"Custom process\"\n },\n WhiteBalance : {\n 0 : \"Auto white balance\",\n 1 : \"Manual white balance\"\n },\n GainControl : {\n 0 : \"None\",\n 1 : \"Low gain up\",\n 2 : \"High gain up\",\n 3 : \"Low gain down\",\n 4 : \"High gain down\"\n },\n Contrast : {\n 0 : \"Normal\",\n 1 : \"Soft\",\n 2 : \"Hard\"\n },\n Saturation : {\n 0 : \"Normal\",\n 1 : \"Low saturation\",\n 2 : \"High saturation\"\n },\n Sharpness : {\n 0 : \"Normal\",\n 1 : \"Soft\",\n 2 : \"Hard\"\n },\n SubjectDistanceRange : {\n 0 : \"Unknown\",\n 1 : \"Macro\",\n 2 : \"Close view\",\n 3 : \"Distant view\"\n },\n FileSource : {\n 3 : \"DSC\"\n },\n\n Components : {\n 0 : \"\",\n 1 : \"Y\",\n 2 : \"Cb\",\n 3 : \"Cr\",\n 4 : \"R\",\n 5 : \"G\",\n 6 : \"B\"\n }\n };\n\n function addEvent(element, event, handler) {\n if (element.addEventListener) {\n element.addEventListener(event, handler, false);\n } else if (element.attachEvent) {\n element.attachEvent(\"on\" + event, handler);\n }\n }\n\n function imageHasData(img) {\n return !!(img.exifdata);\n }\n\n\n function base64ToArrayBuffer(base64, contentType) {\n contentType = contentType || base64.match(/^data\\:([^\\;]+)\\;base64,/mi)[1] || ''; // e.g. 'data:image/jpeg;base64,...' => 'image/jpeg'\n base64 = base64.replace(/^data\\:([^\\;]+)\\;base64,/gmi, '');\n var binary = atob(base64);\n var len = binary.length;\n var buffer = new ArrayBuffer(len);\n var view = new Uint8Array(buffer);\n for (var i = 0; i < len; i++) {\n view[i] = binary.charCodeAt(i);\n }\n return buffer;\n }\n\n function objectURLToBlob(url, callback) {\n var http = new XMLHttpRequest();\n http.open(\"GET\", url, true);\n http.responseType = \"blob\";\n http.onload = function(e) {\n if (this.status == 200 || this.status === 0) {\n callback(this.response);\n }\n };\n http.send();\n }\n\n function getImageData(img, callback) {\n function handleBinaryFile(binFile) {\n var data = findEXIFinJPEG(binFile);\n img.exifdata = data || {};\n var iptcdata = findIPTCinJPEG(binFile);\n img.iptcdata = iptcdata || {};\n if (EXIF.isXmpEnabled) {\n var xmpdata= findXMPinJPEG(binFile);\n img.xmpdata = xmpdata || {}; \n }\n if (callback) {\n callback.call(img);\n }\n }\n\n if (img.src) {\n if (/^data\\:/i.test(img.src)) { // Data URI\n var arrayBuffer = base64ToArrayBuffer(img.src);\n handleBinaryFile(arrayBuffer);\n\n } else if (/^blob\\:/i.test(img.src)) { // Object URL\n var fileReader = new FileReader();\n fileReader.onload = function(e) {\n handleBinaryFile(e.target.result);\n };\n objectURLToBlob(img.src, function (blob) {\n fileReader.readAsArrayBuffer(blob);\n });\n } else {\n var http = new XMLHttpRequest();\n http.onload = function() {\n if (this.status == 200 || this.status === 0) {\n handleBinaryFile(http.response);\n } else {\n throw \"Could not load image\";\n }\n http = null;\n };\n http.open(\"GET\", img.src, true);\n http.responseType = \"arraybuffer\";\n http.send(null);\n }\n } else if (self.FileReader && (img instanceof self.Blob || img instanceof self.File)) {\n var fileReader = new FileReader();\n fileReader.onload = function(e) {\n if (debug) console.log(\"Got file of length \" + e.target.result.byteLength);\n handleBinaryFile(e.target.result);\n };\n\n fileReader.readAsArrayBuffer(img);\n }\n }\n\n function findEXIFinJPEG(file) {\n var dataView = new DataView(file);\n\n if (debug) console.log(\"Got file of length \" + file.byteLength);\n if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8)) {\n if (debug) console.log(\"Not a valid JPEG\");\n return false; // not a valid jpeg\n }\n\n var offset = 2,\n length = file.byteLength,\n marker;\n\n while (offset < length) {\n if (dataView.getUint8(offset) != 0xFF) {\n if (debug) console.log(\"Not a valid marker at offset \" + offset + \", found: \" + dataView.getUint8(offset));\n return false; // not a valid marker, something is wrong\n }\n\n marker = dataView.getUint8(offset + 1);\n if (debug) console.log(marker);\n\n // we could implement handling for other markers here,\n // but we're only looking for 0xFFE1 for EXIF data\n\n if (marker == 225) {\n if (debug) console.log(\"Found 0xFFE1 marker\");\n\n return readEXIFData(dataView, offset + 4, dataView.getUint16(offset + 2) - 2);\n\n // offset += 2 + file.getShortAt(offset+2, true);\n\n } else {\n offset += 2 + dataView.getUint16(offset+2);\n }\n\n }\n\n }\n\n function findIPTCinJPEG(file) {\n var dataView = new DataView(file);\n\n if (debug) console.log(\"Got file of length \" + file.byteLength);\n if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8)) {\n if (debug) console.log(\"Not a valid JPEG\");\n return false; // not a valid jpeg\n }\n\n var offset = 2,\n length = file.byteLength;\n\n\n var isFieldSegmentStart = function(dataView, offset){\n return (\n dataView.getUint8(offset) === 0x38 &&\n dataView.getUint8(offset+1) === 0x42 &&\n dataView.getUint8(offset+2) === 0x49 &&\n dataView.getUint8(offset+3) === 0x4D &&\n dataView.getUint8(offset+4) === 0x04 &&\n dataView.getUint8(offset+5) === 0x04\n );\n };\n\n while (offset < length) {\n\n if ( isFieldSegmentStart(dataView, offset )){\n\n // Get the length of the name header (which is padded to an even number of bytes)\n var nameHeaderLength = dataView.getUint8(offset+7);\n if(nameHeaderLength % 2 !== 0) nameHeaderLength += 1;\n // Check for pre photoshop 6 format\n if(nameHeaderLength === 0) {\n // Always 4\n nameHeaderLength = 4;\n }\n\n var startOffset = offset + 8 + nameHeaderLength;\n var sectionLength = dataView.getUint16(offset + 6 + nameHeaderLength);\n\n return readIPTCData(file, startOffset, sectionLength);\n\n break;\n\n }\n\n\n // Not the marker, continue searching\n offset++;\n\n }\n\n }\n var IptcFieldMap = {\n 0x78 : 'caption',\n 0x6E : 'credit',\n 0x19 : 'keywords',\n 0x37 : 'dateCreated',\n 0x50 : 'byline',\n 0x55 : 'bylineTitle',\n 0x7A : 'captionWriter',\n 0x69 : 'headline',\n 0x74 : 'copyright',\n 0x0F : 'category'\n };\n function readIPTCData(file, startOffset, sectionLength){\n var dataView = new DataView(file);\n var data = {};\n var fieldValue, fieldName, dataSize, segmentType, segmentSize;\n var segmentStartPos = startOffset;\n while(segmentStartPos < startOffset+sectionLength) {\n if(dataView.getUint8(segmentStartPos) === 0x1C && dataView.getUint8(segmentStartPos+1) === 0x02){\n segmentType = dataView.getUint8(segmentStartPos+2);\n if(segmentType in IptcFieldMap) {\n dataSize = dataView.getInt16(segmentStartPos+3);\n segmentSize = dataSize + 5;\n fieldName = IptcFieldMap[segmentType];\n fieldValue = getStringFromDB(dataView, segmentStartPos+5, dataSize);\n // Check if we already stored a value with this name\n if(data.hasOwnProperty(fieldName)) {\n // Value already stored with this name, create multivalue field\n if(data[fieldName] instanceof Array) {\n data[fieldName].push(fieldValue);\n }\n else {\n data[fieldName] = [data[fieldName], fieldValue];\n }\n }\n else {\n data[fieldName] = fieldValue;\n }\n }\n\n }\n segmentStartPos++;\n }\n return data;\n }\n\n\n\n function readTags(file, tiffStart, dirStart, strings, bigEnd) {\n var entries = file.getUint16(dirStart, !bigEnd),\n tags = {},\n entryOffset, tag,\n i;\n\n for (i=0;i 4 ? valueOffset : (entryOffset + 8);\n vals = [];\n for (n=0;n 4 ? valueOffset : (entryOffset + 8);\n return getStringFromDB(file, offset, numValues-1);\n\n case 3: // short, 16 bit int\n if (numValues == 1) {\n return file.getUint16(entryOffset + 8, !bigEnd);\n } else {\n offset = numValues > 2 ? valueOffset : (entryOffset + 8);\n vals = [];\n for (n=0;n dataView.byteLength) { // this should not happen\n // console.log('******** IFD1Offset is outside the bounds of the DataView ********');\n return {};\n }\n // console.log('******* thumbnail IFD offset (IFD1) is: %s', IFD1OffsetPointer);\n\n var thumbTags = readTags(dataView, tiffStart, tiffStart + IFD1OffsetPointer, IFD1Tags, bigEnd)\n\n // EXIF 2.3 specification for JPEG format thumbnail\n\n // If the value of Compression(0x0103) Tag in IFD1 is '6', thumbnail image format is JPEG.\n // Most of Exif image uses JPEG format for thumbnail. In that case, you can get offset of thumbnail\n // by JpegIFOffset(0x0201) Tag in IFD1, size of thumbnail by JpegIFByteCount(0x0202) Tag.\n // Data format is ordinary JPEG format, starts from 0xFFD8 and ends by 0xFFD9. It seems that\n // JPEG format and 160x120pixels of size are recommended thumbnail format for Exif2.1 or later.\n\n if (thumbTags['Compression']) {\n // console.log('Thumbnail image found!');\n\n switch (thumbTags['Compression']) {\n case 6:\n // console.log('Thumbnail image format is JPEG');\n if (thumbTags.JpegIFOffset && thumbTags.JpegIFByteCount) {\n // extract the thumbnail\n var tOffset = tiffStart + thumbTags.JpegIFOffset;\n var tLength = thumbTags.JpegIFByteCount;\n thumbTags['blob'] = new Blob([new Uint8Array(dataView.buffer, tOffset, tLength)], {\n type: 'image/jpeg'\n });\n }\n break;\n\n case 1:\n console.log(\"Thumbnail image format is TIFF, which is not implemented.\");\n break;\n default:\n console.log(\"Unknown thumbnail image format '%s'\", thumbTags['Compression']);\n }\n }\n else if (thumbTags['PhotometricInterpretation'] == 2) {\n console.log(\"Thumbnail image format is RGB, which is not implemented.\");\n }\n return thumbTags;\n }\n\n function getStringFromDB(buffer, start, length) {\n var outstr = \"\";\n for (n = start; n < start+length; n++) {\n outstr += String.fromCharCode(buffer.getUint8(n));\n }\n return outstr;\n }\n\n function readEXIFData(file, start) {\n if (getStringFromDB(file, start, 4) != \"Exif\") {\n if (debug) console.log(\"Not valid EXIF data! \" + getStringFromDB(file, start, 4));\n return false;\n }\n\n var bigEnd,\n tags, tag,\n exifData, gpsData,\n tiffOffset = start + 6;\n\n // test for TIFF validity and endianness\n if (file.getUint16(tiffOffset) == 0x4949) {\n bigEnd = false;\n } else if (file.getUint16(tiffOffset) == 0x4D4D) {\n bigEnd = true;\n } else {\n if (debug) console.log(\"Not valid TIFF data! (no 0x4949 or 0x4D4D)\");\n return false;\n }\n\n if (file.getUint16(tiffOffset+2, !bigEnd) != 0x002A) {\n if (debug) console.log(\"Not valid TIFF data! (no 0x002A)\");\n return false;\n }\n\n var firstIFDOffset = file.getUint32(tiffOffset+4, !bigEnd);\n\n if (firstIFDOffset < 0x00000008) {\n if (debug) console.log(\"Not valid TIFF data! (First offset less than 8)\", file.getUint32(tiffOffset+4, !bigEnd));\n return false;\n }\n\n tags = readTags(file, tiffOffset, tiffOffset + firstIFDOffset, TiffTags, bigEnd);\n\n if (tags.ExifIFDPointer) {\n exifData = readTags(file, tiffOffset, tiffOffset + tags.ExifIFDPointer, ExifTags, bigEnd);\n for (tag in exifData) {\n switch (tag) {\n case \"LightSource\" :\n case \"Flash\" :\n case \"MeteringMode\" :\n case \"ExposureProgram\" :\n case \"SensingMethod\" :\n case \"SceneCaptureType\" :\n case \"SceneType\" :\n case \"CustomRendered\" :\n case \"WhiteBalance\" :\n case \"GainControl\" :\n case \"Contrast\" :\n case \"Saturation\" :\n case \"Sharpness\" :\n case \"SubjectDistanceRange\" :\n case \"FileSource\" :\n exifData[tag] = StringValues[tag][exifData[tag]];\n break;\n\n case \"ExifVersion\" :\n case \"FlashpixVersion\" :\n exifData[tag] = String.fromCharCode(exifData[tag][0], exifData[tag][1], exifData[tag][2], exifData[tag][3]);\n break;\n\n case \"ComponentsConfiguration\" :\n exifData[tag] =\n StringValues.Components[exifData[tag][0]] +\n StringValues.Components[exifData[tag][1]] +\n StringValues.Components[exifData[tag][2]] +\n StringValues.Components[exifData[tag][3]];\n break;\n }\n tags[tag] = exifData[tag];\n }\n }\n\n if (tags.GPSInfoIFDPointer) {\n gpsData = readTags(file, tiffOffset, tiffOffset + tags.GPSInfoIFDPointer, GPSTags, bigEnd);\n for (tag in gpsData) {\n switch (tag) {\n case \"GPSVersionID\" :\n gpsData[tag] = gpsData[tag][0] +\n \".\" + gpsData[tag][1] +\n \".\" + gpsData[tag][2] +\n \".\" + gpsData[tag][3];\n break;\n }\n tags[tag] = gpsData[tag];\n }\n }\n\n // extract thumbnail\n tags['thumbnail'] = readThumbnailImage(file, tiffOffset, firstIFDOffset, bigEnd);\n\n return tags;\n }\n\n function findXMPinJPEG(file) {\n\n if (!('DOMParser' in self)) {\n // console.warn('XML parsing not supported without DOMParser');\n return;\n }\n var dataView = new DataView(file);\n\n if (debug) console.log(\"Got file of length \" + file.byteLength);\n if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8)) {\n if (debug) console.log(\"Not a valid JPEG\");\n return false; // not a valid jpeg\n }\n\n var offset = 2,\n length = file.byteLength,\n dom = new DOMParser();\n\n while (offset < (length-4)) {\n if (getStringFromDB(dataView, offset, 4) == \"http\") {\n var startOffset = offset - 1;\n var sectionLength = dataView.getUint16(offset - 2) - 1;\n var xmpString = getStringFromDB(dataView, startOffset, sectionLength)\n var xmpEndIndex = xmpString.indexOf('xmpmeta>') + 8;\n xmpString = xmpString.substring( xmpString.indexOf( ' 0) {\n json['@attributes'] = {};\n for (var j = 0; j < xml.attributes.length; j++) {\n var attribute = xml.attributes.item(j);\n json['@attributes'][attribute.nodeName] = attribute.nodeValue;\n }\n }\n } else if (xml.nodeType == 3) { // text node\n return xml.nodeValue;\n }\n \n // deal with children\n if (xml.hasChildNodes()) {\n for(var i = 0; i < xml.childNodes.length; i++) {\n var child = xml.childNodes.item(i);\n var nodeName = child.nodeName;\n if (json[nodeName] == null) {\n json[nodeName] = xml2json(child);\n } else {\n if (json[nodeName].push == null) {\n var old = json[nodeName];\n json[nodeName] = [];\n json[nodeName].push(old);\n }\n json[nodeName].push(xml2json(child));\n }\n }\n }\n \n return json;\n }\n\n function xml2Object(xml) {\n try {\n var obj = {};\n if (xml.children.length > 0) {\n for (var i = 0; i < xml.children.length; i++) {\n var item = xml.children.item(i);\n var attributes = item.attributes;\n for(var idx in attributes) {\n var itemAtt = attributes[idx];\n var dataKey = itemAtt.nodeName;\n var dataValue = itemAtt.nodeValue;\n\n if(dataKey !== undefined) {\n obj[dataKey] = dataValue;\n }\n }\n var nodeName = item.nodeName;\n\n if (typeof (obj[nodeName]) == \"undefined\") {\n obj[nodeName] = xml2json(item);\n } else {\n if (typeof (obj[nodeName].push) == \"undefined\") {\n var old = obj[nodeName];\n\n obj[nodeName] = [];\n obj[nodeName].push(old);\n }\n obj[nodeName].push(xml2json(item));\n }\n }\n } else {\n obj = xml.textContent;\n }\n return obj;\n } catch (e) {\n console.log(e.message);\n }\n }\n\n EXIF.enableXmp = function() {\n EXIF.isXmpEnabled = true;\n }\n\n EXIF.disableXmp = function() {\n EXIF.isXmpEnabled = false;\n }\n\n EXIF.getData = function(img, callback) {\n if (((self.Image && img instanceof self.Image)\n || (self.HTMLImageElement && img instanceof self.HTMLImageElement))\n && !img.complete)\n return false;\n\n if (!imageHasData(img)) {\n getImageData(img, callback);\n } else {\n if (callback) {\n callback.call(img);\n }\n }\n return true;\n }\n\n EXIF.getTag = function(img, tag) {\n if (!imageHasData(img)) return;\n return img.exifdata[tag];\n }\n \n EXIF.getIptcTag = function(img, tag) {\n if (!imageHasData(img)) return;\n return img.iptcdata[tag];\n }\n\n EXIF.getAllTags = function(img) {\n if (!imageHasData(img)) return {};\n var a,\n data = img.exifdata,\n tags = {};\n for (a in data) {\n if (data.hasOwnProperty(a)) {\n tags[a] = data[a];\n }\n }\n return tags;\n }\n \n EXIF.getAllIptcTags = function(img) {\n if (!imageHasData(img)) return {};\n var a,\n data = img.iptcdata,\n tags = {};\n for (a in data) {\n if (data.hasOwnProperty(a)) {\n tags[a] = data[a];\n }\n }\n return tags;\n }\n\n EXIF.pretty = function(img) {\n if (!imageHasData(img)) return \"\";\n var a,\n data = img.exifdata,\n strPretty = \"\";\n for (a in data) {\n if (data.hasOwnProperty(a)) {\n if (typeof data[a] == \"object\") {\n if (data[a] instanceof Number) {\n strPretty += a + \" : \" + data[a] + \" [\" + data[a].numerator + \"/\" + data[a].denominator + \"]\\r\\n\";\n } else {\n strPretty += a + \" : [\" + data[a].length + \" values]\\r\\n\";\n }\n } else {\n strPretty += a + \" : \" + data[a] + \"\\r\\n\";\n }\n }\n }\n return strPretty;\n }\n\n EXIF.readFromBinaryFile = function(file) {\n return findEXIFinJPEG(file);\n }\n\n if (typeof define === 'function' && define.amd) {\n define('exif-js', [], function() {\n return EXIF;\n });\n }\n}.call(this));\n\n", "/*!\n* sweetalert2 v11.4.8\n* Released under the MIT License.\n*/\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = global || self, global.Sweetalert2 = factory());\n}(this, function () { 'use strict';\n\n const consolePrefix = 'SweetAlert2:';\n /**\n * Filter the unique values into a new array\n * @param arr\n */\n\n const uniqueArray = arr => {\n const result = [];\n\n for (let i = 0; i < arr.length; i++) {\n if (result.indexOf(arr[i]) === -1) {\n result.push(arr[i]);\n }\n }\n\n return result;\n };\n /**\n * Capitalize the first letter of a string\n * @param {string} str\n * @returns {string}\n */\n\n const capitalizeFirstLetter = str => str.charAt(0).toUpperCase() + str.slice(1);\n /**\n * @param {NodeList | HTMLCollection | NamedNodeMap} nodeList\n * @returns {array}\n */\n\n const toArray = nodeList => Array.prototype.slice.call(nodeList);\n /**\n * Standardize console warnings\n * @param {string | array} message\n */\n\n const warn = message => {\n console.warn(\"\".concat(consolePrefix, \" \").concat(typeof message === 'object' ? message.join(' ') : message));\n };\n /**\n * Standardize console errors\n * @param {string} message\n */\n\n const error = message => {\n console.error(\"\".concat(consolePrefix, \" \").concat(message));\n };\n /**\n * Private global state for `warnOnce`\n * @type {Array}\n * @private\n */\n\n const previousWarnOnceMessages = [];\n /**\n * Show a console warning, but only if it hasn't already been shown\n * @param {string} message\n */\n\n const warnOnce = message => {\n if (!previousWarnOnceMessages.includes(message)) {\n previousWarnOnceMessages.push(message);\n warn(message);\n }\n };\n /**\n * Show a one-time console warning about deprecated params/methods\n */\n\n const warnAboutDeprecation = (deprecatedParam, useInstead) => {\n warnOnce(\"\\\"\".concat(deprecatedParam, \"\\\" is deprecated and will be removed in the next major release. Please use \\\"\").concat(useInstead, \"\\\" instead.\"));\n };\n /**\n * If `arg` is a function, call it (with no arguments or context) and return the result.\n * Otherwise, just pass the value through\n * @param arg\n */\n\n const callIfFunction = arg => typeof arg === 'function' ? arg() : arg;\n const hasToPromiseFn = arg => arg && typeof arg.toPromise === 'function';\n const asPromise = arg => hasToPromiseFn(arg) ? arg.toPromise() : Promise.resolve(arg);\n const isPromise = arg => arg && Promise.resolve(arg) === arg;\n\n const defaultParams = {\n title: '',\n titleText: '',\n text: '',\n html: '',\n footer: '',\n icon: undefined,\n iconColor: undefined,\n iconHtml: undefined,\n template: undefined,\n toast: false,\n showClass: {\n popup: 'swal2-show',\n backdrop: 'swal2-backdrop-show',\n icon: 'swal2-icon-show'\n },\n hideClass: {\n popup: 'swal2-hide',\n backdrop: 'swal2-backdrop-hide',\n icon: 'swal2-icon-hide'\n },\n customClass: {},\n target: 'body',\n color: undefined,\n backdrop: true,\n heightAuto: true,\n allowOutsideClick: true,\n allowEscapeKey: true,\n allowEnterKey: true,\n stopKeydownPropagation: true,\n keydownListenerCapture: false,\n showConfirmButton: true,\n showDenyButton: false,\n showCancelButton: false,\n preConfirm: undefined,\n preDeny: undefined,\n confirmButtonText: 'OK',\n confirmButtonAriaLabel: '',\n confirmButtonColor: undefined,\n denyButtonText: 'No',\n denyButtonAriaLabel: '',\n denyButtonColor: undefined,\n cancelButtonText: 'Cancel',\n cancelButtonAriaLabel: '',\n cancelButtonColor: undefined,\n buttonsStyling: true,\n reverseButtons: false,\n focusConfirm: true,\n focusDeny: false,\n focusCancel: false,\n returnFocus: true,\n showCloseButton: false,\n closeButtonHtml: '×',\n closeButtonAriaLabel: 'Close this dialog',\n loaderHtml: '',\n showLoaderOnConfirm: false,\n showLoaderOnDeny: false,\n imageUrl: undefined,\n imageWidth: undefined,\n imageHeight: undefined,\n imageAlt: '',\n timer: undefined,\n timerProgressBar: false,\n width: undefined,\n padding: undefined,\n background: undefined,\n input: undefined,\n inputPlaceholder: '',\n inputLabel: '',\n inputValue: '',\n inputOptions: {},\n inputAutoTrim: true,\n inputAttributes: {},\n inputValidator: undefined,\n returnInputValueOnDeny: false,\n validationMessage: undefined,\n grow: false,\n position: 'center',\n progressSteps: [],\n currentProgressStep: undefined,\n progressStepsDistance: undefined,\n willOpen: undefined,\n didOpen: undefined,\n didRender: undefined,\n willClose: undefined,\n didClose: undefined,\n didDestroy: undefined,\n scrollbarPadding: true\n };\n const updatableParams = ['allowEscapeKey', 'allowOutsideClick', 'background', 'buttonsStyling', 'cancelButtonAriaLabel', 'cancelButtonColor', 'cancelButtonText', 'closeButtonAriaLabel', 'closeButtonHtml', 'color', 'confirmButtonAriaLabel', 'confirmButtonColor', 'confirmButtonText', 'currentProgressStep', 'customClass', 'denyButtonAriaLabel', 'denyButtonColor', 'denyButtonText', 'didClose', 'didDestroy', 'footer', 'hideClass', 'html', 'icon', 'iconColor', 'iconHtml', 'imageAlt', 'imageHeight', 'imageUrl', 'imageWidth', 'preConfirm', 'preDeny', 'progressSteps', 'returnFocus', 'reverseButtons', 'showCancelButton', 'showCloseButton', 'showConfirmButton', 'showDenyButton', 'text', 'title', 'titleText', 'willClose'];\n const deprecatedParams = {};\n const toastIncompatibleParams = ['allowOutsideClick', 'allowEnterKey', 'backdrop', 'focusConfirm', 'focusDeny', 'focusCancel', 'returnFocus', 'heightAuto', 'keydownListenerCapture'];\n /**\n * Is valid parameter\n * @param {string} paramName\n */\n\n const isValidParameter = paramName => {\n return Object.prototype.hasOwnProperty.call(defaultParams, paramName);\n };\n /**\n * Is valid parameter for Swal.update() method\n * @param {string} paramName\n */\n\n const isUpdatableParameter = paramName => {\n return updatableParams.indexOf(paramName) !== -1;\n };\n /**\n * Is deprecated parameter\n * @param {string} paramName\n */\n\n const isDeprecatedParameter = paramName => {\n return deprecatedParams[paramName];\n };\n\n const checkIfParamIsValid = param => {\n if (!isValidParameter(param)) {\n warn(\"Unknown parameter \\\"\".concat(param, \"\\\"\"));\n }\n };\n\n const checkIfToastParamIsValid = param => {\n if (toastIncompatibleParams.includes(param)) {\n warn(\"The parameter \\\"\".concat(param, \"\\\" is incompatible with toasts\"));\n }\n };\n\n const checkIfParamIsDeprecated = param => {\n if (isDeprecatedParameter(param)) {\n warnAboutDeprecation(param, isDeprecatedParameter(param));\n }\n };\n /**\n * Show relevant warnings for given params\n *\n * @param params\n */\n\n\n const showWarningsForParams = params => {\n if (!params.backdrop && params.allowOutsideClick) {\n warn('\"allowOutsideClick\" parameter requires `backdrop` parameter to be set to `true`');\n }\n\n for (const param in params) {\n checkIfParamIsValid(param);\n\n if (params.toast) {\n checkIfToastParamIsValid(param);\n }\n\n checkIfParamIsDeprecated(param);\n }\n };\n\n const swalPrefix = 'swal2-';\n const prefix = items => {\n const result = {};\n\n for (const i in items) {\n result[items[i]] = swalPrefix + items[i];\n }\n\n return result;\n };\n const swalClasses = prefix(['container', 'shown', 'height-auto', 'iosfix', 'popup', 'modal', 'no-backdrop', 'no-transition', 'toast', 'toast-shown', 'show', 'hide', 'close', 'title', 'html-container', 'actions', 'confirm', 'deny', 'cancel', 'default-outline', 'footer', 'icon', 'icon-content', 'image', 'input', 'file', 'range', 'select', 'radio', 'checkbox', 'label', 'textarea', 'inputerror', 'input-label', 'validation-message', 'progress-steps', 'active-progress-step', 'progress-step', 'progress-step-line', 'loader', 'loading', 'styled', 'top', 'top-start', 'top-end', 'top-left', 'top-right', 'center', 'center-start', 'center-end', 'center-left', 'center-right', 'bottom', 'bottom-start', 'bottom-end', 'bottom-left', 'bottom-right', 'grow-row', 'grow-column', 'grow-fullscreen', 'rtl', 'timer-progress-bar', 'timer-progress-bar-container', 'scrollbar-measure', 'icon-success', 'icon-warning', 'icon-info', 'icon-question', 'icon-error']);\n const iconTypes = prefix(['success', 'warning', 'info', 'question', 'error']);\n\n /**\n * Gets the popup container which contains the backdrop and the popup itself.\n *\n * @returns {HTMLElement | null}\n */\n\n const getContainer = () => document.body.querySelector(\".\".concat(swalClasses.container));\n const elementBySelector = selectorString => {\n const container = getContainer();\n return container ? container.querySelector(selectorString) : null;\n };\n\n const elementByClass = className => {\n return elementBySelector(\".\".concat(className));\n };\n\n const getPopup = () => elementByClass(swalClasses.popup);\n const getIcon = () => elementByClass(swalClasses.icon);\n const getTitle = () => elementByClass(swalClasses.title);\n const getHtmlContainer = () => elementByClass(swalClasses['html-container']);\n const getImage = () => elementByClass(swalClasses.image);\n const getProgressSteps = () => elementByClass(swalClasses['progress-steps']);\n const getValidationMessage = () => elementByClass(swalClasses['validation-message']);\n const getConfirmButton = () => elementBySelector(\".\".concat(swalClasses.actions, \" .\").concat(swalClasses.confirm));\n const getDenyButton = () => elementBySelector(\".\".concat(swalClasses.actions, \" .\").concat(swalClasses.deny));\n const getInputLabel = () => elementByClass(swalClasses['input-label']);\n const getLoader = () => elementBySelector(\".\".concat(swalClasses.loader));\n const getCancelButton = () => elementBySelector(\".\".concat(swalClasses.actions, \" .\").concat(swalClasses.cancel));\n const getActions = () => elementByClass(swalClasses.actions);\n const getFooter = () => elementByClass(swalClasses.footer);\n const getTimerProgressBar = () => elementByClass(swalClasses['timer-progress-bar']);\n const getCloseButton = () => elementByClass(swalClasses.close); // https://github.com/jkup/focusable/blob/master/index.js\n\n const focusable = \"\\n a[href],\\n area[href],\\n input:not([disabled]),\\n select:not([disabled]),\\n textarea:not([disabled]),\\n button:not([disabled]),\\n iframe,\\n object,\\n embed,\\n [tabindex=\\\"0\\\"],\\n [contenteditable],\\n audio[controls],\\n video[controls],\\n summary\\n\";\n const getFocusableElements = () => {\n const focusableElementsWithTabindex = toArray(getPopup().querySelectorAll('[tabindex]:not([tabindex=\"-1\"]):not([tabindex=\"0\"])')) // sort according to tabindex\n .sort((a, b) => {\n const tabindexA = parseInt(a.getAttribute('tabindex'));\n const tabindexB = parseInt(b.getAttribute('tabindex'));\n\n if (tabindexA > tabindexB) {\n return 1;\n } else if (tabindexA < tabindexB) {\n return -1;\n }\n\n return 0;\n });\n const otherFocusableElements = toArray(getPopup().querySelectorAll(focusable)).filter(el => el.getAttribute('tabindex') !== '-1');\n return uniqueArray(focusableElementsWithTabindex.concat(otherFocusableElements)).filter(el => isVisible(el));\n };\n const isModal = () => {\n return hasClass(document.body, swalClasses.shown) && !hasClass(document.body, swalClasses['toast-shown']) && !hasClass(document.body, swalClasses['no-backdrop']);\n };\n const isToast = () => {\n return getPopup() && hasClass(getPopup(), swalClasses.toast);\n };\n const isLoading = () => {\n return getPopup().hasAttribute('data-loading');\n };\n\n const states = {\n previousBodyPadding: null\n };\n /**\n * Securely set innerHTML of an element\n * https://github.com/sweetalert2/sweetalert2/issues/1926\n *\n * @param {HTMLElement} elem\n * @param {string} html\n */\n\n const setInnerHtml = (elem, html) => {\n elem.textContent = '';\n\n if (html) {\n const parser = new DOMParser();\n const parsed = parser.parseFromString(html, \"text/html\");\n toArray(parsed.querySelector('head').childNodes).forEach(child => {\n elem.appendChild(child);\n });\n toArray(parsed.querySelector('body').childNodes).forEach(child => {\n elem.appendChild(child);\n });\n }\n };\n /**\n * @param {HTMLElement} elem\n * @param {string} className\n * @returns {boolean}\n */\n\n const hasClass = (elem, className) => {\n if (!className) {\n return false;\n }\n\n const classList = className.split(/\\s+/);\n\n for (let i = 0; i < classList.length; i++) {\n if (!elem.classList.contains(classList[i])) {\n return false;\n }\n }\n\n return true;\n };\n\n const removeCustomClasses = (elem, params) => {\n toArray(elem.classList).forEach(className => {\n if (!Object.values(swalClasses).includes(className) && !Object.values(iconTypes).includes(className) && !Object.values(params.showClass).includes(className)) {\n elem.classList.remove(className);\n }\n });\n };\n\n const applyCustomClass = (elem, params, className) => {\n removeCustomClasses(elem, params);\n\n if (params.customClass && params.customClass[className]) {\n if (typeof params.customClass[className] !== 'string' && !params.customClass[className].forEach) {\n return warn(\"Invalid type of customClass.\".concat(className, \"! Expected string or iterable object, got \\\"\").concat(typeof params.customClass[className], \"\\\"\"));\n }\n\n addClass(elem, params.customClass[className]);\n }\n };\n /**\n * @param {HTMLElement} popup\n * @param {string} inputType\n * @returns {HTMLInputElement | null}\n */\n\n const getInput = (popup, inputType) => {\n if (!inputType) {\n return null;\n }\n\n switch (inputType) {\n case 'select':\n case 'textarea':\n case 'file':\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses[inputType]));\n\n case 'checkbox':\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.checkbox, \" input\"));\n\n case 'radio':\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.radio, \" input:checked\")) || popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.radio, \" input:first-child\"));\n\n case 'range':\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.range, \" input\"));\n\n default:\n return popup.querySelector(\".\".concat(swalClasses.popup, \" > .\").concat(swalClasses.input));\n }\n };\n /**\n * @param {HTMLInputElement} input\n */\n\n const focusInput = input => {\n input.focus(); // place cursor at end of text in text input\n\n if (input.type !== 'file') {\n // http://stackoverflow.com/a/2345915\n const val = input.value;\n input.value = '';\n input.value = val;\n }\n };\n /**\n * @param {HTMLElement | HTMLElement[] | null} target\n * @param {string | string[]} classList\n * @param {boolean} condition\n */\n\n const toggleClass = (target, classList, condition) => {\n if (!target || !classList) {\n return;\n }\n\n if (typeof classList === 'string') {\n classList = classList.split(/\\s+/).filter(Boolean);\n }\n\n classList.forEach(className => {\n if (Array.isArray(target)) {\n target.forEach(elem => {\n condition ? elem.classList.add(className) : elem.classList.remove(className);\n });\n } else {\n condition ? target.classList.add(className) : target.classList.remove(className);\n }\n });\n };\n /**\n * @param {HTMLElement | HTMLElement[] | null} target\n * @param {string | string[]} classList\n */\n\n const addClass = (target, classList) => {\n toggleClass(target, classList, true);\n };\n /**\n * @param {HTMLElement | HTMLElement[] | null} target\n * @param {string | string[]} classList\n */\n\n const removeClass = (target, classList) => {\n toggleClass(target, classList, false);\n };\n /**\n * Get direct child of an element by class name\n *\n * @param {HTMLElement} elem\n * @param {string} className\n * @returns {HTMLElement | null}\n */\n\n const getDirectChildByClass = (elem, className) => {\n const childNodes = toArray(elem.childNodes);\n\n for (let i = 0; i < childNodes.length; i++) {\n if (hasClass(childNodes[i], className)) {\n return childNodes[i];\n }\n }\n };\n /**\n * @param {HTMLElement} elem\n * @param {string} property\n * @param {*} value\n */\n\n const applyNumericalStyle = (elem, property, value) => {\n if (value === \"\".concat(parseInt(value))) {\n value = parseInt(value);\n }\n\n if (value || parseInt(value) === 0) {\n elem.style[property] = typeof value === 'number' ? \"\".concat(value, \"px\") : value;\n } else {\n elem.style.removeProperty(property);\n }\n };\n /**\n * @param {HTMLElement} elem\n * @param {string} display\n */\n\n const show = function (elem) {\n let display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'flex';\n elem.style.display = display;\n };\n /**\n * @param {HTMLElement} elem\n */\n\n const hide = elem => {\n elem.style.display = 'none';\n };\n const setStyle = (parent, selector, property, value) => {\n const el = parent.querySelector(selector);\n\n if (el) {\n el.style[property] = value;\n }\n };\n const toggle = (elem, condition, display) => {\n condition ? show(elem, display) : hide(elem);\n }; // borrowed from jquery $(elem).is(':visible') implementation\n\n const isVisible = elem => !!(elem && (elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length));\n const allButtonsAreHidden = () => !isVisible(getConfirmButton()) && !isVisible(getDenyButton()) && !isVisible(getCancelButton());\n const isScrollable = elem => !!(elem.scrollHeight > elem.clientHeight); // borrowed from https://stackoverflow.com/a/46352119\n\n const hasCssAnimation = elem => {\n const style = window.getComputedStyle(elem);\n const animDuration = parseFloat(style.getPropertyValue('animation-duration') || '0');\n const transDuration = parseFloat(style.getPropertyValue('transition-duration') || '0');\n return animDuration > 0 || transDuration > 0;\n };\n const animateTimerProgressBar = function (timer) {\n let reset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n const timerProgressBar = getTimerProgressBar();\n\n if (isVisible(timerProgressBar)) {\n if (reset) {\n timerProgressBar.style.transition = 'none';\n timerProgressBar.style.width = '100%';\n }\n\n setTimeout(() => {\n timerProgressBar.style.transition = \"width \".concat(timer / 1000, \"s linear\");\n timerProgressBar.style.width = '0%';\n }, 10);\n }\n };\n const stopTimerProgressBar = () => {\n const timerProgressBar = getTimerProgressBar();\n const timerProgressBarWidth = parseInt(window.getComputedStyle(timerProgressBar).width);\n timerProgressBar.style.removeProperty('transition');\n timerProgressBar.style.width = '100%';\n const timerProgressBarFullWidth = parseInt(window.getComputedStyle(timerProgressBar).width);\n const timerProgressBarPercent = timerProgressBarWidth / timerProgressBarFullWidth * 100;\n timerProgressBar.style.removeProperty('transition');\n timerProgressBar.style.width = \"\".concat(timerProgressBarPercent, \"%\");\n };\n\n /**\n * Detect Node env\n *\n * @returns {boolean}\n */\n const isNodeEnv = () => typeof window === 'undefined' || typeof document === 'undefined';\n\n const RESTORE_FOCUS_TIMEOUT = 100;\n\n const globalState = {};\n\n const focusPreviousActiveElement = () => {\n if (globalState.previousActiveElement && globalState.previousActiveElement.focus) {\n globalState.previousActiveElement.focus();\n globalState.previousActiveElement = null;\n } else if (document.body) {\n document.body.focus();\n }\n }; // Restore previous active (focused) element\n\n\n const restoreActiveElement = returnFocus => {\n return new Promise(resolve => {\n if (!returnFocus) {\n return resolve();\n }\n\n const x = window.scrollX;\n const y = window.scrollY;\n globalState.restoreFocusTimeout = setTimeout(() => {\n focusPreviousActiveElement();\n resolve();\n }, RESTORE_FOCUS_TIMEOUT); // issues/900\n\n window.scrollTo(x, y);\n });\n };\n\n const sweetHTML = \"\\n
\\n \\n
    \\n
    \\n \\n

    \\n
    \\n \\n \\n
    \\n \\n \\n
    \\n \\n
    \\n \\n \\n
    \\n
    \\n
    \\n \\n \\n \\n
    \\n
    \\n
    \\n
    \\n
    \\n
    \\n\").replace(/(^|\\n)\\s*/g, '');\n\n const resetOldContainer = () => {\n const oldContainer = getContainer();\n\n if (!oldContainer) {\n return false;\n }\n\n oldContainer.remove();\n removeClass([document.documentElement, document.body], [swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['has-column']]);\n return true;\n };\n\n const resetValidationMessage = () => {\n globalState.currentInstance.resetValidationMessage();\n };\n\n const addInputChangeListeners = () => {\n const popup = getPopup();\n const input = getDirectChildByClass(popup, swalClasses.input);\n const file = getDirectChildByClass(popup, swalClasses.file);\n const range = popup.querySelector(\".\".concat(swalClasses.range, \" input\"));\n const rangeOutput = popup.querySelector(\".\".concat(swalClasses.range, \" output\"));\n const select = getDirectChildByClass(popup, swalClasses.select);\n const checkbox = popup.querySelector(\".\".concat(swalClasses.checkbox, \" input\"));\n const textarea = getDirectChildByClass(popup, swalClasses.textarea);\n input.oninput = resetValidationMessage;\n file.onchange = resetValidationMessage;\n select.onchange = resetValidationMessage;\n checkbox.onchange = resetValidationMessage;\n textarea.oninput = resetValidationMessage;\n\n range.oninput = () => {\n resetValidationMessage();\n rangeOutput.value = range.value;\n };\n\n range.onchange = () => {\n resetValidationMessage();\n range.nextSibling.value = range.value;\n };\n };\n\n const getTarget = target => typeof target === 'string' ? document.querySelector(target) : target;\n\n const setupAccessibility = params => {\n const popup = getPopup();\n popup.setAttribute('role', params.toast ? 'alert' : 'dialog');\n popup.setAttribute('aria-live', params.toast ? 'polite' : 'assertive');\n\n if (!params.toast) {\n popup.setAttribute('aria-modal', 'true');\n }\n };\n\n const setupRTL = targetElement => {\n if (window.getComputedStyle(targetElement).direction === 'rtl') {\n addClass(getContainer(), swalClasses.rtl);\n }\n };\n /*\n * Add modal + backdrop to DOM\n */\n\n\n const init = params => {\n // Clean up the old popup container if it exists\n const oldContainerExisted = resetOldContainer();\n /* istanbul ignore if */\n\n if (isNodeEnv()) {\n error('SweetAlert2 requires document to initialize');\n return;\n }\n\n const container = document.createElement('div');\n container.className = swalClasses.container;\n\n if (oldContainerExisted) {\n addClass(container, swalClasses['no-transition']);\n }\n\n setInnerHtml(container, sweetHTML);\n const targetElement = getTarget(params.target);\n targetElement.appendChild(container);\n setupAccessibility(params);\n setupRTL(targetElement);\n addInputChangeListeners();\n };\n\n /**\n * @param {HTMLElement | object | string} param\n * @param {HTMLElement} target\n */\n\n const parseHtmlToContainer = (param, target) => {\n // DOM element\n if (param instanceof HTMLElement) {\n target.appendChild(param);\n } // Object\n else if (typeof param === 'object') {\n handleObject(param, target);\n } // Plain string\n else if (param) {\n setInnerHtml(target, param);\n }\n };\n /**\n * @param {object} param\n * @param {HTMLElement} target\n */\n\n const handleObject = (param, target) => {\n // JQuery element(s)\n if (param.jquery) {\n handleJqueryElem(target, param);\n } // For other objects use their string representation\n else {\n setInnerHtml(target, param.toString());\n }\n };\n\n const handleJqueryElem = (target, elem) => {\n target.textContent = '';\n\n if (0 in elem) {\n for (let i = 0; (i in elem); i++) {\n target.appendChild(elem[i].cloneNode(true));\n }\n } else {\n target.appendChild(elem.cloneNode(true));\n }\n };\n\n const animationEndEvent = (() => {\n // Prevent run in Node env\n\n /* istanbul ignore if */\n if (isNodeEnv()) {\n return false;\n }\n\n const testEl = document.createElement('div');\n const transEndEventNames = {\n WebkitAnimation: 'webkitAnimationEnd',\n // Chrome, Safari and Opera\n animation: 'animationend' // Standard syntax\n\n };\n\n for (const i in transEndEventNames) {\n if (Object.prototype.hasOwnProperty.call(transEndEventNames, i) && typeof testEl.style[i] !== 'undefined') {\n return transEndEventNames[i];\n }\n }\n\n return false;\n })();\n\n // https://github.com/twbs/bootstrap/blob/master/js/src/modal.js\n\n const measureScrollbar = () => {\n const scrollDiv = document.createElement('div');\n scrollDiv.className = swalClasses['scrollbar-measure'];\n document.body.appendChild(scrollDiv);\n const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;\n document.body.removeChild(scrollDiv);\n return scrollbarWidth;\n };\n\n const renderActions = (instance, params) => {\n const actions = getActions();\n const loader = getLoader(); // Actions (buttons) wrapper\n\n if (!params.showConfirmButton && !params.showDenyButton && !params.showCancelButton) {\n hide(actions);\n } else {\n show(actions);\n } // Custom class\n\n\n applyCustomClass(actions, params, 'actions'); // Render all the buttons\n\n renderButtons(actions, loader, params); // Loader\n\n setInnerHtml(loader, params.loaderHtml);\n applyCustomClass(loader, params, 'loader');\n };\n\n function renderButtons(actions, loader, params) {\n const confirmButton = getConfirmButton();\n const denyButton = getDenyButton();\n const cancelButton = getCancelButton(); // Render buttons\n\n renderButton(confirmButton, 'confirm', params);\n renderButton(denyButton, 'deny', params);\n renderButton(cancelButton, 'cancel', params);\n handleButtonsStyling(confirmButton, denyButton, cancelButton, params);\n\n if (params.reverseButtons) {\n if (params.toast) {\n actions.insertBefore(cancelButton, confirmButton);\n actions.insertBefore(denyButton, confirmButton);\n } else {\n actions.insertBefore(cancelButton, loader);\n actions.insertBefore(denyButton, loader);\n actions.insertBefore(confirmButton, loader);\n }\n }\n }\n\n function handleButtonsStyling(confirmButton, denyButton, cancelButton, params) {\n if (!params.buttonsStyling) {\n return removeClass([confirmButton, denyButton, cancelButton], swalClasses.styled);\n }\n\n addClass([confirmButton, denyButton, cancelButton], swalClasses.styled); // Buttons background colors\n\n if (params.confirmButtonColor) {\n confirmButton.style.backgroundColor = params.confirmButtonColor;\n addClass(confirmButton, swalClasses['default-outline']);\n }\n\n if (params.denyButtonColor) {\n denyButton.style.backgroundColor = params.denyButtonColor;\n addClass(denyButton, swalClasses['default-outline']);\n }\n\n if (params.cancelButtonColor) {\n cancelButton.style.backgroundColor = params.cancelButtonColor;\n addClass(cancelButton, swalClasses['default-outline']);\n }\n }\n\n function renderButton(button, buttonType, params) {\n toggle(button, params[\"show\".concat(capitalizeFirstLetter(buttonType), \"Button\")], 'inline-block');\n setInnerHtml(button, params[\"\".concat(buttonType, \"ButtonText\")]); // Set caption text\n\n button.setAttribute('aria-label', params[\"\".concat(buttonType, \"ButtonAriaLabel\")]); // ARIA label\n // Add buttons custom classes\n\n button.className = swalClasses[buttonType];\n applyCustomClass(button, params, \"\".concat(buttonType, \"Button\"));\n addClass(button, params[\"\".concat(buttonType, \"ButtonClass\")]);\n }\n\n function handleBackdropParam(container, backdrop) {\n if (typeof backdrop === 'string') {\n container.style.background = backdrop;\n } else if (!backdrop) {\n addClass([document.documentElement, document.body], swalClasses['no-backdrop']);\n }\n }\n\n function handlePositionParam(container, position) {\n if (position in swalClasses) {\n addClass(container, swalClasses[position]);\n } else {\n warn('The \"position\" parameter is not valid, defaulting to \"center\"');\n addClass(container, swalClasses.center);\n }\n }\n\n function handleGrowParam(container, grow) {\n if (grow && typeof grow === 'string') {\n const growClass = \"grow-\".concat(grow);\n\n if (growClass in swalClasses) {\n addClass(container, swalClasses[growClass]);\n }\n }\n }\n\n const renderContainer = (instance, params) => {\n const container = getContainer();\n\n if (!container) {\n return;\n }\n\n handleBackdropParam(container, params.backdrop);\n handlePositionParam(container, params.position);\n handleGrowParam(container, params.grow); // Custom class\n\n applyCustomClass(container, params, 'container');\n };\n\n /**\n * This module contains `WeakMap`s for each effectively-\"private property\" that a `Swal` has.\n * For example, to set the private property \"foo\" of `this` to \"bar\", you can `privateProps.foo.set(this, 'bar')`\n * This is the approach that Babel will probably take to implement private methods/fields\n * https://github.com/tc39/proposal-private-methods\n * https://github.com/babel/babel/pull/7555\n * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module*\n * then we can use that language feature.\n */\n var privateProps = {\n awaitingPromise: new WeakMap(),\n promise: new WeakMap(),\n innerParams: new WeakMap(),\n domCache: new WeakMap()\n };\n\n const inputTypes = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea'];\n const renderInput = (instance, params) => {\n const popup = getPopup();\n const innerParams = privateProps.innerParams.get(instance);\n const rerender = !innerParams || params.input !== innerParams.input;\n inputTypes.forEach(inputType => {\n const inputClass = swalClasses[inputType];\n const inputContainer = getDirectChildByClass(popup, inputClass); // set attributes\n\n setAttributes(inputType, params.inputAttributes); // set class\n\n inputContainer.className = inputClass;\n\n if (rerender) {\n hide(inputContainer);\n }\n });\n\n if (params.input) {\n if (rerender) {\n showInput(params);\n } // set custom class\n\n\n setCustomClass(params);\n }\n };\n\n const showInput = params => {\n if (!renderInputType[params.input]) {\n return error(\"Unexpected type of input! Expected \\\"text\\\", \\\"email\\\", \\\"password\\\", \\\"number\\\", \\\"tel\\\", \\\"select\\\", \\\"radio\\\", \\\"checkbox\\\", \\\"textarea\\\", \\\"file\\\" or \\\"url\\\", got \\\"\".concat(params.input, \"\\\"\"));\n }\n\n const inputContainer = getInputContainer(params.input);\n const input = renderInputType[params.input](inputContainer, params);\n show(input); // input autofocus\n\n setTimeout(() => {\n focusInput(input);\n });\n };\n\n const removeAttributes = input => {\n for (let i = 0; i < input.attributes.length; i++) {\n const attrName = input.attributes[i].name;\n\n if (!['type', 'value', 'style'].includes(attrName)) {\n input.removeAttribute(attrName);\n }\n }\n };\n\n const setAttributes = (inputType, inputAttributes) => {\n const input = getInput(getPopup(), inputType);\n\n if (!input) {\n return;\n }\n\n removeAttributes(input);\n\n for (const attr in inputAttributes) {\n input.setAttribute(attr, inputAttributes[attr]);\n }\n };\n\n const setCustomClass = params => {\n const inputContainer = getInputContainer(params.input);\n\n if (params.customClass) {\n addClass(inputContainer, params.customClass.input);\n }\n };\n\n const setInputPlaceholder = (input, params) => {\n if (!input.placeholder || params.inputPlaceholder) {\n input.placeholder = params.inputPlaceholder;\n }\n };\n\n const setInputLabel = (input, prependTo, params) => {\n if (params.inputLabel) {\n input.id = swalClasses.input;\n const label = document.createElement('label');\n const labelClass = swalClasses['input-label'];\n label.setAttribute('for', input.id);\n label.className = labelClass;\n addClass(label, params.customClass.inputLabel);\n label.innerText = params.inputLabel;\n prependTo.insertAdjacentElement('beforebegin', label);\n }\n };\n\n const getInputContainer = inputType => {\n const inputClass = swalClasses[inputType] ? swalClasses[inputType] : swalClasses.input;\n return getDirectChildByClass(getPopup(), inputClass);\n };\n\n const renderInputType = {};\n\n renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = (input, params) => {\n if (typeof params.inputValue === 'string' || typeof params.inputValue === 'number') {\n input.value = params.inputValue;\n } else if (!isPromise(params.inputValue)) {\n warn(\"Unexpected type of inputValue! Expected \\\"string\\\", \\\"number\\\" or \\\"Promise\\\", got \\\"\".concat(typeof params.inputValue, \"\\\"\"));\n }\n\n setInputLabel(input, input, params);\n setInputPlaceholder(input, params);\n input.type = params.input;\n return input;\n };\n\n renderInputType.file = (input, params) => {\n setInputLabel(input, input, params);\n setInputPlaceholder(input, params);\n return input;\n };\n\n renderInputType.range = (range, params) => {\n const rangeInput = range.querySelector('input');\n const rangeOutput = range.querySelector('output');\n rangeInput.value = params.inputValue;\n rangeInput.type = params.input;\n rangeOutput.value = params.inputValue;\n setInputLabel(rangeInput, range, params);\n return range;\n };\n\n renderInputType.select = (select, params) => {\n select.textContent = '';\n\n if (params.inputPlaceholder) {\n const placeholder = document.createElement('option');\n setInnerHtml(placeholder, params.inputPlaceholder);\n placeholder.value = '';\n placeholder.disabled = true;\n placeholder.selected = true;\n select.appendChild(placeholder);\n }\n\n setInputLabel(select, select, params);\n return select;\n };\n\n renderInputType.radio = radio => {\n radio.textContent = '';\n return radio;\n };\n\n renderInputType.checkbox = (checkboxContainer, params) => {\n /** @type {HTMLInputElement} */\n const checkbox = getInput(getPopup(), 'checkbox');\n checkbox.value = '1';\n checkbox.id = swalClasses.checkbox;\n checkbox.checked = Boolean(params.inputValue);\n const label = checkboxContainer.querySelector('span');\n setInnerHtml(label, params.inputPlaceholder);\n return checkboxContainer;\n };\n\n renderInputType.textarea = (textarea, params) => {\n textarea.value = params.inputValue;\n setInputPlaceholder(textarea, params);\n setInputLabel(textarea, textarea, params);\n\n const getMargin = el => parseInt(window.getComputedStyle(el).marginLeft) + parseInt(window.getComputedStyle(el).marginRight); // https://github.com/sweetalert2/sweetalert2/issues/2291\n\n\n setTimeout(() => {\n // https://github.com/sweetalert2/sweetalert2/issues/1699\n if ('MutationObserver' in window) {\n const initialPopupWidth = parseInt(window.getComputedStyle(getPopup()).width);\n\n const textareaResizeHandler = () => {\n const textareaWidth = textarea.offsetWidth + getMargin(textarea);\n\n if (textareaWidth > initialPopupWidth) {\n getPopup().style.width = \"\".concat(textareaWidth, \"px\");\n } else {\n getPopup().style.width = null;\n }\n };\n\n new MutationObserver(textareaResizeHandler).observe(textarea, {\n attributes: true,\n attributeFilter: ['style']\n });\n }\n });\n return textarea;\n };\n\n const renderContent = (instance, params) => {\n const htmlContainer = getHtmlContainer();\n applyCustomClass(htmlContainer, params, 'htmlContainer'); // Content as HTML\n\n if (params.html) {\n parseHtmlToContainer(params.html, htmlContainer);\n show(htmlContainer, 'block');\n } // Content as plain text\n else if (params.text) {\n htmlContainer.textContent = params.text;\n show(htmlContainer, 'block');\n } // No content\n else {\n hide(htmlContainer);\n }\n\n renderInput(instance, params);\n };\n\n const renderFooter = (instance, params) => {\n const footer = getFooter();\n toggle(footer, params.footer);\n\n if (params.footer) {\n parseHtmlToContainer(params.footer, footer);\n } // Custom class\n\n\n applyCustomClass(footer, params, 'footer');\n };\n\n const renderCloseButton = (instance, params) => {\n const closeButton = getCloseButton();\n setInnerHtml(closeButton, params.closeButtonHtml); // Custom class\n\n applyCustomClass(closeButton, params, 'closeButton');\n toggle(closeButton, params.showCloseButton);\n closeButton.setAttribute('aria-label', params.closeButtonAriaLabel);\n };\n\n const renderIcon = (instance, params) => {\n const innerParams = privateProps.innerParams.get(instance);\n const icon = getIcon(); // if the given icon already rendered, apply the styling without re-rendering the icon\n\n if (innerParams && params.icon === innerParams.icon) {\n // Custom or default content\n setContent(icon, params);\n applyStyles(icon, params);\n return;\n }\n\n if (!params.icon && !params.iconHtml) {\n return hide(icon);\n }\n\n if (params.icon && Object.keys(iconTypes).indexOf(params.icon) === -1) {\n error(\"Unknown icon! Expected \\\"success\\\", \\\"error\\\", \\\"warning\\\", \\\"info\\\" or \\\"question\\\", got \\\"\".concat(params.icon, \"\\\"\"));\n return hide(icon);\n }\n\n show(icon); // Custom or default content\n\n setContent(icon, params);\n applyStyles(icon, params); // Animate icon\n\n addClass(icon, params.showClass.icon);\n };\n\n const applyStyles = (icon, params) => {\n for (const iconType in iconTypes) {\n if (params.icon !== iconType) {\n removeClass(icon, iconTypes[iconType]);\n }\n }\n\n addClass(icon, iconTypes[params.icon]); // Icon color\n\n setColor(icon, params); // Success icon background color\n\n adjustSuccessIconBackgroundColor(); // Custom class\n\n applyCustomClass(icon, params, 'icon');\n }; // Adjust success icon background color to match the popup background color\n\n\n const adjustSuccessIconBackgroundColor = () => {\n const popup = getPopup();\n const popupBackgroundColor = window.getComputedStyle(popup).getPropertyValue('background-color');\n const successIconParts = popup.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix');\n\n for (let i = 0; i < successIconParts.length; i++) {\n successIconParts[i].style.backgroundColor = popupBackgroundColor;\n }\n };\n\n const successIconHtml = \"\\n
    \\n \\n
    \\n
    \\n\";\n const errorIconHtml = \"\\n \\n \\n \\n \\n\";\n\n const setContent = (icon, params) => {\n icon.textContent = '';\n\n if (params.iconHtml) {\n setInnerHtml(icon, iconContent(params.iconHtml));\n } else if (params.icon === 'success') {\n setInnerHtml(icon, successIconHtml);\n } else if (params.icon === 'error') {\n setInnerHtml(icon, errorIconHtml);\n } else {\n const defaultIconHtml = {\n question: '?',\n warning: '!',\n info: 'i'\n };\n setInnerHtml(icon, iconContent(defaultIconHtml[params.icon]));\n }\n };\n\n const setColor = (icon, params) => {\n if (!params.iconColor) {\n return;\n }\n\n icon.style.color = params.iconColor;\n icon.style.borderColor = params.iconColor;\n\n for (const sel of ['.swal2-success-line-tip', '.swal2-success-line-long', '.swal2-x-mark-line-left', '.swal2-x-mark-line-right']) {\n setStyle(icon, sel, 'backgroundColor', params.iconColor);\n }\n\n setStyle(icon, '.swal2-success-ring', 'borderColor', params.iconColor);\n };\n\n const iconContent = content => \"
    \").concat(content, \"
    \");\n\n const renderImage = (instance, params) => {\n const image = getImage();\n\n if (!params.imageUrl) {\n return hide(image);\n }\n\n show(image, ''); // Src, alt\n\n image.setAttribute('src', params.imageUrl);\n image.setAttribute('alt', params.imageAlt); // Width, height\n\n applyNumericalStyle(image, 'width', params.imageWidth);\n applyNumericalStyle(image, 'height', params.imageHeight); // Class\n\n image.className = swalClasses.image;\n applyCustomClass(image, params, 'image');\n };\n\n const createStepElement = step => {\n const stepEl = document.createElement('li');\n addClass(stepEl, swalClasses['progress-step']);\n setInnerHtml(stepEl, step);\n return stepEl;\n };\n\n const createLineElement = params => {\n const lineEl = document.createElement('li');\n addClass(lineEl, swalClasses['progress-step-line']);\n\n if (params.progressStepsDistance) {\n lineEl.style.width = params.progressStepsDistance;\n }\n\n return lineEl;\n };\n\n const renderProgressSteps = (instance, params) => {\n const progressStepsContainer = getProgressSteps();\n\n if (!params.progressSteps || params.progressSteps.length === 0) {\n return hide(progressStepsContainer);\n }\n\n show(progressStepsContainer);\n progressStepsContainer.textContent = '';\n\n if (params.currentProgressStep >= params.progressSteps.length) {\n warn('Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)');\n }\n\n params.progressSteps.forEach((step, index) => {\n const stepEl = createStepElement(step);\n progressStepsContainer.appendChild(stepEl);\n\n if (index === params.currentProgressStep) {\n addClass(stepEl, swalClasses['active-progress-step']);\n }\n\n if (index !== params.progressSteps.length - 1) {\n const lineEl = createLineElement(params);\n progressStepsContainer.appendChild(lineEl);\n }\n });\n };\n\n const renderTitle = (instance, params) => {\n const title = getTitle();\n toggle(title, params.title || params.titleText, 'block');\n\n if (params.title) {\n parseHtmlToContainer(params.title, title);\n }\n\n if (params.titleText) {\n title.innerText = params.titleText;\n } // Custom class\n\n\n applyCustomClass(title, params, 'title');\n };\n\n const renderPopup = (instance, params) => {\n const container = getContainer();\n const popup = getPopup(); // Width\n // https://github.com/sweetalert2/sweetalert2/issues/2170\n\n if (params.toast) {\n applyNumericalStyle(container, 'width', params.width);\n popup.style.width = '100%';\n popup.insertBefore(getLoader(), getIcon());\n } else {\n applyNumericalStyle(popup, 'width', params.width);\n } // Padding\n\n\n applyNumericalStyle(popup, 'padding', params.padding); // Color\n\n if (params.color) {\n popup.style.color = params.color;\n } // Background\n\n\n if (params.background) {\n popup.style.background = params.background;\n }\n\n hide(getValidationMessage()); // Classes\n\n addClasses(popup, params);\n };\n\n const addClasses = (popup, params) => {\n // Default Class + showClass when updating Swal.update({})\n popup.className = \"\".concat(swalClasses.popup, \" \").concat(isVisible(popup) ? params.showClass.popup : '');\n\n if (params.toast) {\n addClass([document.documentElement, document.body], swalClasses['toast-shown']);\n addClass(popup, swalClasses.toast);\n } else {\n addClass(popup, swalClasses.modal);\n } // Custom class\n\n\n applyCustomClass(popup, params, 'popup');\n\n if (typeof params.customClass === 'string') {\n addClass(popup, params.customClass);\n } // Icon class (#1842)\n\n\n if (params.icon) {\n addClass(popup, swalClasses[\"icon-\".concat(params.icon)]);\n }\n };\n\n const render = (instance, params) => {\n renderPopup(instance, params);\n renderContainer(instance, params);\n renderProgressSteps(instance, params);\n renderIcon(instance, params);\n renderImage(instance, params);\n renderTitle(instance, params);\n renderCloseButton(instance, params);\n renderContent(instance, params);\n renderActions(instance, params);\n renderFooter(instance, params);\n\n if (typeof params.didRender === 'function') {\n params.didRender(getPopup());\n }\n };\n\n const DismissReason = Object.freeze({\n cancel: 'cancel',\n backdrop: 'backdrop',\n close: 'close',\n esc: 'esc',\n timer: 'timer'\n });\n\n // Adding aria-hidden=\"true\" to elements outside of the active modal dialog ensures that\n // elements not within the active modal dialog will not be surfaced if a user opens a screen\n // reader\u2019s list of elements (headings, form controls, landmarks, etc.) in the document.\n\n const setAriaHidden = () => {\n const bodyChildren = toArray(document.body.children);\n bodyChildren.forEach(el => {\n if (el === getContainer() || el.contains(getContainer())) {\n return;\n }\n\n if (el.hasAttribute('aria-hidden')) {\n el.setAttribute('data-previous-aria-hidden', el.getAttribute('aria-hidden'));\n }\n\n el.setAttribute('aria-hidden', 'true');\n });\n };\n const unsetAriaHidden = () => {\n const bodyChildren = toArray(document.body.children);\n bodyChildren.forEach(el => {\n if (el.hasAttribute('data-previous-aria-hidden')) {\n el.setAttribute('aria-hidden', el.getAttribute('data-previous-aria-hidden'));\n el.removeAttribute('data-previous-aria-hidden');\n } else {\n el.removeAttribute('aria-hidden');\n }\n });\n };\n\n const swalStringParams = ['swal-title', 'swal-html', 'swal-footer'];\n const getTemplateParams = params => {\n const template = typeof params.template === 'string' ? document.querySelector(params.template) : params.template;\n\n if (!template) {\n return {};\n }\n /** @type {DocumentFragment} */\n\n\n const templateContent = template.content;\n showWarningsForElements(templateContent);\n const result = Object.assign(getSwalParams(templateContent), getSwalButtons(templateContent), getSwalImage(templateContent), getSwalIcon(templateContent), getSwalInput(templateContent), getSwalStringParams(templateContent, swalStringParams));\n return result;\n };\n /**\n * @param {DocumentFragment} templateContent\n */\n\n const getSwalParams = templateContent => {\n const result = {};\n toArray(templateContent.querySelectorAll('swal-param')).forEach(param => {\n showWarningsForAttributes(param, ['name', 'value']);\n const paramName = param.getAttribute('name');\n const value = param.getAttribute('value');\n\n if (typeof defaultParams[paramName] === 'boolean' && value === 'false') {\n result[paramName] = false;\n }\n\n if (typeof defaultParams[paramName] === 'object') {\n result[paramName] = JSON.parse(value);\n }\n });\n return result;\n };\n /**\n * @param {DocumentFragment} templateContent\n */\n\n\n const getSwalButtons = templateContent => {\n const result = {};\n toArray(templateContent.querySelectorAll('swal-button')).forEach(button => {\n showWarningsForAttributes(button, ['type', 'color', 'aria-label']);\n const type = button.getAttribute('type');\n result[\"\".concat(type, \"ButtonText\")] = button.innerHTML;\n result[\"show\".concat(capitalizeFirstLetter(type), \"Button\")] = true;\n\n if (button.hasAttribute('color')) {\n result[\"\".concat(type, \"ButtonColor\")] = button.getAttribute('color');\n }\n\n if (button.hasAttribute('aria-label')) {\n result[\"\".concat(type, \"ButtonAriaLabel\")] = button.getAttribute('aria-label');\n }\n });\n return result;\n };\n /**\n * @param {DocumentFragment} templateContent\n */\n\n\n const getSwalImage = templateContent => {\n const result = {};\n /** @type {HTMLElement} */\n\n const image = templateContent.querySelector('swal-image');\n\n if (image) {\n showWarningsForAttributes(image, ['src', 'width', 'height', 'alt']);\n\n if (image.hasAttribute('src')) {\n result.imageUrl = image.getAttribute('src');\n }\n\n if (image.hasAttribute('width')) {\n result.imageWidth = image.getAttribute('width');\n }\n\n if (image.hasAttribute('height')) {\n result.imageHeight = image.getAttribute('height');\n }\n\n if (image.hasAttribute('alt')) {\n result.imageAlt = image.getAttribute('alt');\n }\n }\n\n return result;\n };\n /**\n * @param {DocumentFragment} templateContent\n */\n\n\n const getSwalIcon = templateContent => {\n const result = {};\n /** @type {HTMLElement} */\n\n const icon = templateContent.querySelector('swal-icon');\n\n if (icon) {\n showWarningsForAttributes(icon, ['type', 'color']);\n\n if (icon.hasAttribute('type')) {\n result.icon = icon.getAttribute('type');\n }\n\n if (icon.hasAttribute('color')) {\n result.iconColor = icon.getAttribute('color');\n }\n\n result.iconHtml = icon.innerHTML;\n }\n\n return result;\n };\n /**\n * @param {DocumentFragment} templateContent\n */\n\n\n const getSwalInput = templateContent => {\n const result = {};\n /** @type {HTMLElement} */\n\n const input = templateContent.querySelector('swal-input');\n\n if (input) {\n showWarningsForAttributes(input, ['type', 'label', 'placeholder', 'value']);\n result.input = input.getAttribute('type') || 'text';\n\n if (input.hasAttribute('label')) {\n result.inputLabel = input.getAttribute('label');\n }\n\n if (input.hasAttribute('placeholder')) {\n result.inputPlaceholder = input.getAttribute('placeholder');\n }\n\n if (input.hasAttribute('value')) {\n result.inputValue = input.getAttribute('value');\n }\n }\n\n const inputOptions = templateContent.querySelectorAll('swal-input-option');\n\n if (inputOptions.length) {\n result.inputOptions = {};\n toArray(inputOptions).forEach(option => {\n showWarningsForAttributes(option, ['value']);\n const optionValue = option.getAttribute('value');\n const optionName = option.innerHTML;\n result.inputOptions[optionValue] = optionName;\n });\n }\n\n return result;\n };\n /**\n * @param {DocumentFragment} templateContent\n * @param {string[]} paramNames\n */\n\n\n const getSwalStringParams = (templateContent, paramNames) => {\n const result = {};\n\n for (const i in paramNames) {\n const paramName = paramNames[i];\n /** @type {HTMLElement} */\n\n const tag = templateContent.querySelector(paramName);\n\n if (tag) {\n showWarningsForAttributes(tag, []);\n result[paramName.replace(/^swal-/, '')] = tag.innerHTML.trim();\n }\n }\n\n return result;\n };\n /**\n * @param {DocumentFragment} templateContent\n */\n\n\n const showWarningsForElements = templateContent => {\n const allowedElements = swalStringParams.concat(['swal-param', 'swal-button', 'swal-image', 'swal-icon', 'swal-input', 'swal-input-option']);\n toArray(templateContent.children).forEach(el => {\n const tagName = el.tagName.toLowerCase();\n\n if (allowedElements.indexOf(tagName) === -1) {\n warn(\"Unrecognized element <\".concat(tagName, \">\"));\n }\n });\n };\n /**\n * @param {HTMLElement} el\n * @param {string[]} allowedAttributes\n */\n\n\n const showWarningsForAttributes = (el, allowedAttributes) => {\n toArray(el.attributes).forEach(attribute => {\n if (allowedAttributes.indexOf(attribute.name) === -1) {\n warn([\"Unrecognized attribute \\\"\".concat(attribute.name, \"\\\" on <\").concat(el.tagName.toLowerCase(), \">.\"), \"\".concat(allowedAttributes.length ? \"Allowed attributes are: \".concat(allowedAttributes.join(', ')) : 'To set the value, use HTML within the element.')]);\n }\n });\n };\n\n var defaultInputValidators = {\n email: (string, validationMessage) => {\n return /^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z0-9-]{2,24}$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid email address');\n },\n url: (string, validationMessage) => {\n // taken from https://stackoverflow.com/a/3809435 with a small change from #1306 and #2013\n return /^https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-z]{2,63}\\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid URL');\n }\n };\n\n function setDefaultInputValidators(params) {\n // Use default `inputValidator` for supported input types if not provided\n if (!params.inputValidator) {\n Object.keys(defaultInputValidators).forEach(key => {\n if (params.input === key) {\n params.inputValidator = defaultInputValidators[key];\n }\n });\n }\n }\n\n function validateCustomTargetElement(params) {\n // Determine if the custom target element is valid\n if (!params.target || typeof params.target === 'string' && !document.querySelector(params.target) || typeof params.target !== 'string' && !params.target.appendChild) {\n warn('Target parameter is not valid, defaulting to \"body\"');\n params.target = 'body';\n }\n }\n /**\n * Set type, text and actions on popup\n *\n * @param params\n */\n\n\n function setParameters(params) {\n setDefaultInputValidators(params); // showLoaderOnConfirm && preConfirm\n\n if (params.showLoaderOnConfirm && !params.preConfirm) {\n warn('showLoaderOnConfirm is set to true, but preConfirm is not defined.\\n' + 'showLoaderOnConfirm should be used together with preConfirm, see usage example:\\n' + 'https://sweetalert2.github.io/#ajax-request');\n }\n\n validateCustomTargetElement(params); // Replace newlines with
    in title\n\n if (typeof params.title === 'string') {\n params.title = params.title.split('\\n').join('
    ');\n }\n\n init(params);\n }\n\n class Timer {\n constructor(callback, delay) {\n this.callback = callback;\n this.remaining = delay;\n this.running = false;\n this.start();\n }\n\n start() {\n if (!this.running) {\n this.running = true;\n this.started = new Date();\n this.id = setTimeout(this.callback, this.remaining);\n }\n\n return this.remaining;\n }\n\n stop() {\n if (this.running) {\n this.running = false;\n clearTimeout(this.id);\n this.remaining -= new Date().getTime() - this.started.getTime();\n }\n\n return this.remaining;\n }\n\n increase(n) {\n const running = this.running;\n\n if (running) {\n this.stop();\n }\n\n this.remaining += n;\n\n if (running) {\n this.start();\n }\n\n return this.remaining;\n }\n\n getTimerLeft() {\n if (this.running) {\n this.stop();\n this.start();\n }\n\n return this.remaining;\n }\n\n isRunning() {\n return this.running;\n }\n\n }\n\n const fixScrollbar = () => {\n // for queues, do not do this more than once\n if (states.previousBodyPadding !== null) {\n return;\n } // if the body has overflow\n\n\n if (document.body.scrollHeight > window.innerHeight) {\n // add padding so the content doesn't shift after removal of scrollbar\n states.previousBodyPadding = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right'));\n document.body.style.paddingRight = \"\".concat(states.previousBodyPadding + measureScrollbar(), \"px\");\n }\n };\n const undoScrollbar = () => {\n if (states.previousBodyPadding !== null) {\n document.body.style.paddingRight = \"\".concat(states.previousBodyPadding, \"px\");\n states.previousBodyPadding = null;\n }\n };\n\n /* istanbul ignore file */\n\n const iOSfix = () => {\n const iOS = // @ts-ignore\n /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream || navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;\n\n if (iOS && !hasClass(document.body, swalClasses.iosfix)) {\n const offset = document.body.scrollTop;\n document.body.style.top = \"\".concat(offset * -1, \"px\");\n addClass(document.body, swalClasses.iosfix);\n lockBodyScroll();\n addBottomPaddingForTallPopups();\n }\n };\n /**\n * https://github.com/sweetalert2/sweetalert2/issues/1948\n */\n\n const addBottomPaddingForTallPopups = () => {\n const ua = navigator.userAgent;\n const iOS = !!ua.match(/iPad/i) || !!ua.match(/iPhone/i);\n const webkit = !!ua.match(/WebKit/i);\n const iOSSafari = iOS && webkit && !ua.match(/CriOS/i);\n\n if (iOSSafari) {\n const bottomPanelHeight = 44;\n\n if (getPopup().scrollHeight > window.innerHeight - bottomPanelHeight) {\n getContainer().style.paddingBottom = \"\".concat(bottomPanelHeight, \"px\");\n }\n }\n };\n /**\n * https://github.com/sweetalert2/sweetalert2/issues/1246\n */\n\n\n const lockBodyScroll = () => {\n const container = getContainer();\n let preventTouchMove;\n\n container.ontouchstart = e => {\n preventTouchMove = shouldPreventTouchMove(e);\n };\n\n container.ontouchmove = e => {\n if (preventTouchMove) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n };\n\n const shouldPreventTouchMove = event => {\n const target = event.target;\n const container = getContainer();\n\n if (isStylus(event) || isZoom(event)) {\n return false;\n }\n\n if (target === container) {\n return true;\n }\n\n if (!isScrollable(container) && target.tagName !== 'INPUT' && // #1603\n target.tagName !== 'TEXTAREA' && // #2266\n !(isScrollable(getHtmlContainer()) && // #1944\n getHtmlContainer().contains(target))) {\n return true;\n }\n\n return false;\n };\n /**\n * https://github.com/sweetalert2/sweetalert2/issues/1786\n *\n * @param {*} event\n * @returns {boolean}\n */\n\n\n const isStylus = event => {\n return event.touches && event.touches.length && event.touches[0].touchType === 'stylus';\n };\n /**\n * https://github.com/sweetalert2/sweetalert2/issues/1891\n *\n * @param {TouchEvent} event\n * @returns {boolean}\n */\n\n\n const isZoom = event => {\n return event.touches && event.touches.length > 1;\n };\n\n const undoIOSfix = () => {\n if (hasClass(document.body, swalClasses.iosfix)) {\n const offset = parseInt(document.body.style.top, 10);\n removeClass(document.body, swalClasses.iosfix);\n document.body.style.top = '';\n document.body.scrollTop = offset * -1;\n }\n };\n\n const SHOW_CLASS_TIMEOUT = 10;\n /**\n * Open popup, add necessary classes and styles, fix scrollbar\n *\n * @param params\n */\n\n const openPopup = params => {\n const container = getContainer();\n const popup = getPopup();\n\n if (typeof params.willOpen === 'function') {\n params.willOpen(popup);\n }\n\n const bodyStyles = window.getComputedStyle(document.body);\n const initialBodyOverflow = bodyStyles.overflowY;\n addClasses$1(container, popup, params); // scrolling is 'hidden' until animation is done, after that 'auto'\n\n setTimeout(() => {\n setScrollingVisibility(container, popup);\n }, SHOW_CLASS_TIMEOUT);\n\n if (isModal()) {\n fixScrollContainer(container, params.scrollbarPadding, initialBodyOverflow);\n setAriaHidden();\n }\n\n if (!isToast() && !globalState.previousActiveElement) {\n globalState.previousActiveElement = document.activeElement;\n }\n\n if (typeof params.didOpen === 'function') {\n setTimeout(() => params.didOpen(popup));\n }\n\n removeClass(container, swalClasses['no-transition']);\n };\n\n const swalOpenAnimationFinished = event => {\n const popup = getPopup();\n\n if (event.target !== popup) {\n return;\n }\n\n const container = getContainer();\n popup.removeEventListener(animationEndEvent, swalOpenAnimationFinished);\n container.style.overflowY = 'auto';\n };\n\n const setScrollingVisibility = (container, popup) => {\n if (animationEndEvent && hasCssAnimation(popup)) {\n container.style.overflowY = 'hidden';\n popup.addEventListener(animationEndEvent, swalOpenAnimationFinished);\n } else {\n container.style.overflowY = 'auto';\n }\n };\n\n const fixScrollContainer = (container, scrollbarPadding, initialBodyOverflow) => {\n iOSfix();\n\n if (scrollbarPadding && initialBodyOverflow !== 'hidden') {\n fixScrollbar();\n } // sweetalert2/issues/1247\n\n\n setTimeout(() => {\n container.scrollTop = 0;\n });\n };\n\n const addClasses$1 = (container, popup, params) => {\n addClass(container, params.showClass.backdrop); // this workaround with opacity is needed for https://github.com/sweetalert2/sweetalert2/issues/2059\n\n popup.style.setProperty('opacity', '0', 'important');\n show(popup, 'grid');\n setTimeout(() => {\n // Animate popup right after showing it\n addClass(popup, params.showClass.popup); // and remove the opacity workaround\n\n popup.style.removeProperty('opacity');\n }, SHOW_CLASS_TIMEOUT); // 10ms in order to fix #2062\n\n addClass([document.documentElement, document.body], swalClasses.shown);\n\n if (params.heightAuto && params.backdrop && !params.toast) {\n addClass([document.documentElement, document.body], swalClasses['height-auto']);\n }\n };\n\n /**\n * Shows loader (spinner), this is useful with AJAX requests.\n * By default the loader be shown instead of the \"Confirm\" button.\n */\n\n const showLoading = buttonToReplace => {\n let popup = getPopup();\n\n if (!popup) {\n new Swal(); // eslint-disable-line no-new\n }\n\n popup = getPopup();\n const loader = getLoader();\n\n if (isToast()) {\n hide(getIcon());\n } else {\n replaceButton(popup, buttonToReplace);\n }\n\n show(loader);\n popup.setAttribute('data-loading', true);\n popup.setAttribute('aria-busy', true);\n popup.focus();\n };\n\n const replaceButton = (popup, buttonToReplace) => {\n const actions = getActions();\n const loader = getLoader();\n\n if (!buttonToReplace && isVisible(getConfirmButton())) {\n buttonToReplace = getConfirmButton();\n }\n\n show(actions);\n\n if (buttonToReplace) {\n hide(buttonToReplace);\n loader.setAttribute('data-button-to-replace', buttonToReplace.className);\n }\n\n loader.parentNode.insertBefore(loader, buttonToReplace);\n addClass([popup, actions], swalClasses.loading);\n };\n\n const handleInputOptionsAndValue = (instance, params) => {\n if (params.input === 'select' || params.input === 'radio') {\n handleInputOptions(instance, params);\n } else if (['text', 'email', 'number', 'tel', 'textarea'].includes(params.input) && (hasToPromiseFn(params.inputValue) || isPromise(params.inputValue))) {\n showLoading(getConfirmButton());\n handleInputValue(instance, params);\n }\n };\n const getInputValue = (instance, innerParams) => {\n const input = instance.getInput();\n\n if (!input) {\n return null;\n }\n\n switch (innerParams.input) {\n case 'checkbox':\n return getCheckboxValue(input);\n\n case 'radio':\n return getRadioValue(input);\n\n case 'file':\n return getFileValue(input);\n\n default:\n return innerParams.inputAutoTrim ? input.value.trim() : input.value;\n }\n };\n\n const getCheckboxValue = input => input.checked ? 1 : 0;\n\n const getRadioValue = input => input.checked ? input.value : null;\n\n const getFileValue = input => input.files.length ? input.getAttribute('multiple') !== null ? input.files : input.files[0] : null;\n\n const handleInputOptions = (instance, params) => {\n const popup = getPopup();\n\n const processInputOptions = inputOptions => populateInputOptions[params.input](popup, formatInputOptions(inputOptions), params);\n\n if (hasToPromiseFn(params.inputOptions) || isPromise(params.inputOptions)) {\n showLoading(getConfirmButton());\n asPromise(params.inputOptions).then(inputOptions => {\n instance.hideLoading();\n processInputOptions(inputOptions);\n });\n } else if (typeof params.inputOptions === 'object') {\n processInputOptions(params.inputOptions);\n } else {\n error(\"Unexpected type of inputOptions! Expected object, Map or Promise, got \".concat(typeof params.inputOptions));\n }\n };\n\n const handleInputValue = (instance, params) => {\n const input = instance.getInput();\n hide(input);\n asPromise(params.inputValue).then(inputValue => {\n input.value = params.input === 'number' ? parseFloat(inputValue) || 0 : \"\".concat(inputValue);\n show(input);\n input.focus();\n instance.hideLoading();\n }).catch(err => {\n error(\"Error in inputValue promise: \".concat(err));\n input.value = '';\n show(input);\n input.focus();\n instance.hideLoading();\n });\n };\n\n const populateInputOptions = {\n select: (popup, inputOptions, params) => {\n const select = getDirectChildByClass(popup, swalClasses.select);\n\n const renderOption = (parent, optionLabel, optionValue) => {\n const option = document.createElement('option');\n option.value = optionValue;\n setInnerHtml(option, optionLabel);\n option.selected = isSelected(optionValue, params.inputValue);\n parent.appendChild(option);\n };\n\n inputOptions.forEach(inputOption => {\n const optionValue = inputOption[0];\n const optionLabel = inputOption[1]; // spec:\n // https://www.w3.org/TR/html401/interact/forms.html#h-17.6\n // \"...all OPTGROUP elements must be specified directly within a SELECT element (i.e., groups may not be nested)...\"\n // check whether this is a \n\n if (Array.isArray(optionLabel)) {\n // if it is an array, then it is an \n const optgroup = document.createElement('optgroup');\n optgroup.label = optionValue;\n optgroup.disabled = false; // not configurable for now\n\n select.appendChild(optgroup);\n optionLabel.forEach(o => renderOption(optgroup, o[1], o[0]));\n } else {\n // case of \n valueFormatted = formatInputOptions(valueFormatted);\n }\n\n result.push([key, valueFormatted]);\n });\n } else {\n Object.keys(inputOptions).forEach(key => {\n let valueFormatted = inputOptions[key];\n\n if (typeof valueFormatted === 'object') {\n // case of \n valueFormatted = formatInputOptions(valueFormatted);\n }\n\n result.push([key, valueFormatted]);\n });\n }\n\n return result;\n };\n\n const isSelected = (optionValue, inputValue) => {\n return inputValue && inputValue.toString() === optionValue.toString();\n };\n\n /**\n * Hides loader and shows back the button which was hidden by .showLoading()\n */\n\n function hideLoading() {\n // do nothing if popup is closed\n const innerParams = privateProps.innerParams.get(this);\n\n if (!innerParams) {\n return;\n }\n\n const domCache = privateProps.domCache.get(this);\n hide(domCache.loader);\n\n if (isToast()) {\n if (innerParams.icon) {\n show(getIcon());\n }\n } else {\n showRelatedButton(domCache);\n }\n\n removeClass([domCache.popup, domCache.actions], swalClasses.loading);\n domCache.popup.removeAttribute('aria-busy');\n domCache.popup.removeAttribute('data-loading');\n domCache.confirmButton.disabled = false;\n domCache.denyButton.disabled = false;\n domCache.cancelButton.disabled = false;\n }\n\n const showRelatedButton = domCache => {\n const buttonToReplace = domCache.popup.getElementsByClassName(domCache.loader.getAttribute('data-button-to-replace'));\n\n if (buttonToReplace.length) {\n show(buttonToReplace[0], 'inline-block');\n } else if (allButtonsAreHidden()) {\n hide(domCache.actions);\n }\n };\n\n /**\n * Gets the input DOM node, this method works with input parameter.\n * @returns {HTMLElement | null}\n */\n\n function getInput$1(instance) {\n const innerParams = privateProps.innerParams.get(instance || this);\n const domCache = privateProps.domCache.get(instance || this);\n\n if (!domCache) {\n return null;\n }\n\n return getInput(domCache.popup, innerParams.input);\n }\n\n /**\n * This module contains `WeakMap`s for each effectively-\"private property\" that a `Swal` has.\n * For example, to set the private property \"foo\" of `this` to \"bar\", you can `privateProps.foo.set(this, 'bar')`\n * This is the approach that Babel will probably take to implement private methods/fields\n * https://github.com/tc39/proposal-private-methods\n * https://github.com/babel/babel/pull/7555\n * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module*\n * then we can use that language feature.\n */\n var privateMethods = {\n swalPromiseResolve: new WeakMap(),\n swalPromiseReject: new WeakMap()\n };\n\n /*\n * Global function to determine if SweetAlert2 popup is shown\n */\n\n const isVisible$1 = () => {\n return isVisible(getPopup());\n };\n /*\n * Global function to click 'Confirm' button\n */\n\n const clickConfirm = () => getConfirmButton() && getConfirmButton().click();\n /*\n * Global function to click 'Deny' button\n */\n\n const clickDeny = () => getDenyButton() && getDenyButton().click();\n /*\n * Global function to click 'Cancel' button\n */\n\n const clickCancel = () => getCancelButton() && getCancelButton().click();\n\n const removeKeydownHandler = globalState => {\n if (globalState.keydownTarget && globalState.keydownHandlerAdded) {\n globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = false;\n }\n };\n const addKeydownHandler = (instance, globalState, innerParams, dismissWith) => {\n removeKeydownHandler(globalState);\n\n if (!innerParams.toast) {\n globalState.keydownHandler = e => keydownHandler(instance, e, dismissWith);\n\n globalState.keydownTarget = innerParams.keydownListenerCapture ? window : getPopup();\n globalState.keydownListenerCapture = innerParams.keydownListenerCapture;\n globalState.keydownTarget.addEventListener('keydown', globalState.keydownHandler, {\n capture: globalState.keydownListenerCapture\n });\n globalState.keydownHandlerAdded = true;\n }\n }; // Focus handling\n\n const setFocus = (innerParams, index, increment) => {\n const focusableElements = getFocusableElements(); // search for visible elements and select the next possible match\n\n if (focusableElements.length) {\n index = index + increment; // rollover to first item\n\n if (index === focusableElements.length) {\n index = 0; // go to last item\n } else if (index === -1) {\n index = focusableElements.length - 1;\n }\n\n return focusableElements[index].focus();\n } // no visible focusable elements, focus the popup\n\n\n getPopup().focus();\n };\n const arrowKeysNextButton = ['ArrowRight', 'ArrowDown'];\n const arrowKeysPreviousButton = ['ArrowLeft', 'ArrowUp'];\n\n const keydownHandler = (instance, e, dismissWith) => {\n const innerParams = privateProps.innerParams.get(instance);\n\n if (!innerParams) {\n return; // This instance has already been destroyed\n } // Ignore keydown during IME composition\n // https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event#ignoring_keydown_during_ime_composition\n // https://github.com/sweetalert2/sweetalert2/issues/720\n // https://github.com/sweetalert2/sweetalert2/issues/2406\n\n\n if (e.isComposing || e.keyCode === 229) {\n return;\n }\n\n if (innerParams.stopKeydownPropagation) {\n e.stopPropagation();\n } // ENTER\n\n\n if (e.key === 'Enter') {\n handleEnter(instance, e, innerParams);\n } // TAB\n else if (e.key === 'Tab') {\n handleTab(e, innerParams);\n } // ARROWS - switch focus between buttons\n else if ([...arrowKeysNextButton, ...arrowKeysPreviousButton].includes(e.key)) {\n handleArrows(e.key);\n } // ESC\n else if (e.key === 'Escape') {\n handleEsc(e, innerParams, dismissWith);\n }\n };\n\n const handleEnter = (instance, e, innerParams) => {\n // https://github.com/sweetalert2/sweetalert2/issues/2386\n if (!callIfFunction(innerParams.allowEnterKey)) {\n return;\n }\n\n if (e.target && instance.getInput() && e.target.outerHTML === instance.getInput().outerHTML) {\n if (['textarea', 'file'].includes(innerParams.input)) {\n return; // do not submit\n }\n\n clickConfirm();\n e.preventDefault();\n }\n };\n\n const handleTab = (e, innerParams) => {\n const targetElement = e.target;\n const focusableElements = getFocusableElements();\n let btnIndex = -1;\n\n for (let i = 0; i < focusableElements.length; i++) {\n if (targetElement === focusableElements[i]) {\n btnIndex = i;\n break;\n }\n } // Cycle to the next button\n\n\n if (!e.shiftKey) {\n setFocus(innerParams, btnIndex, 1);\n } // Cycle to the prev button\n else {\n setFocus(innerParams, btnIndex, -1);\n }\n\n e.stopPropagation();\n e.preventDefault();\n };\n\n const handleArrows = key => {\n const confirmButton = getConfirmButton();\n const denyButton = getDenyButton();\n const cancelButton = getCancelButton();\n\n if (![confirmButton, denyButton, cancelButton].includes(document.activeElement)) {\n return;\n }\n\n const sibling = arrowKeysNextButton.includes(key) ? 'nextElementSibling' : 'previousElementSibling';\n let buttonToFocus = document.activeElement;\n\n for (let i = 0; i < getActions().children.length; i++) {\n buttonToFocus = buttonToFocus[sibling];\n\n if (!buttonToFocus) {\n return;\n }\n\n if (isVisible(buttonToFocus) && buttonToFocus instanceof HTMLButtonElement) {\n break;\n }\n }\n\n if (buttonToFocus instanceof HTMLButtonElement) {\n buttonToFocus.focus();\n }\n };\n\n const handleEsc = (e, innerParams, dismissWith) => {\n if (callIfFunction(innerParams.allowEscapeKey)) {\n e.preventDefault();\n dismissWith(DismissReason.esc);\n }\n };\n\n /*\n * Instance method to close sweetAlert\n */\n\n function removePopupAndResetState(instance, container, returnFocus, didClose) {\n if (isToast()) {\n triggerDidCloseAndDispose(instance, didClose);\n } else {\n restoreActiveElement(returnFocus).then(() => triggerDidCloseAndDispose(instance, didClose));\n removeKeydownHandler(globalState);\n }\n\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); // workaround for #2088\n // for some reason removing the container in Safari will scroll the document to bottom\n\n if (isSafari) {\n container.setAttribute('style', 'display:none !important');\n container.removeAttribute('class');\n container.innerHTML = '';\n } else {\n container.remove();\n }\n\n if (isModal()) {\n undoScrollbar();\n undoIOSfix();\n unsetAriaHidden();\n }\n\n removeBodyClasses();\n }\n\n function removeBodyClasses() {\n removeClass([document.documentElement, document.body], [swalClasses.shown, swalClasses['height-auto'], swalClasses['no-backdrop'], swalClasses['toast-shown']]);\n }\n\n function close(resolveValue) {\n resolveValue = prepareResolveValue(resolveValue);\n const swalPromiseResolve = privateMethods.swalPromiseResolve.get(this);\n const didClose = triggerClosePopup(this);\n\n if (this.isAwaitingPromise()) {\n // A swal awaiting for a promise (after a click on Confirm or Deny) cannot be dismissed anymore #2335\n if (!resolveValue.isDismissed) {\n handleAwaitingPromise(this);\n swalPromiseResolve(resolveValue);\n }\n } else if (didClose) {\n // Resolve Swal promise\n swalPromiseResolve(resolveValue);\n }\n }\n function isAwaitingPromise() {\n return !!privateProps.awaitingPromise.get(this);\n }\n\n const triggerClosePopup = instance => {\n const popup = getPopup();\n\n if (!popup) {\n return false;\n }\n\n const innerParams = privateProps.innerParams.get(instance);\n\n if (!innerParams || hasClass(popup, innerParams.hideClass.popup)) {\n return false;\n }\n\n removeClass(popup, innerParams.showClass.popup);\n addClass(popup, innerParams.hideClass.popup);\n const backdrop = getContainer();\n removeClass(backdrop, innerParams.showClass.backdrop);\n addClass(backdrop, innerParams.hideClass.backdrop);\n handlePopupAnimation(instance, popup, innerParams);\n return true;\n };\n\n function rejectPromise(error) {\n const rejectPromise = privateMethods.swalPromiseReject.get(this);\n handleAwaitingPromise(this);\n\n if (rejectPromise) {\n // Reject Swal promise\n rejectPromise(error);\n }\n }\n const handleAwaitingPromise = instance => {\n if (instance.isAwaitingPromise()) {\n privateProps.awaitingPromise.delete(instance); // The instance might have been previously partly destroyed, we must resume the destroy process in this case #2335\n\n if (!privateProps.innerParams.get(instance)) {\n instance._destroy();\n }\n }\n };\n\n const prepareResolveValue = resolveValue => {\n // When user calls Swal.close()\n if (typeof resolveValue === 'undefined') {\n return {\n isConfirmed: false,\n isDenied: false,\n isDismissed: true\n };\n }\n\n return Object.assign({\n isConfirmed: false,\n isDenied: false,\n isDismissed: false\n }, resolveValue);\n };\n\n const handlePopupAnimation = (instance, popup, innerParams) => {\n const container = getContainer(); // If animation is supported, animate\n\n const animationIsSupported = animationEndEvent && hasCssAnimation(popup);\n\n if (typeof innerParams.willClose === 'function') {\n innerParams.willClose(popup);\n }\n\n if (animationIsSupported) {\n animatePopup(instance, popup, container, innerParams.returnFocus, innerParams.didClose);\n } else {\n // Otherwise, remove immediately\n removePopupAndResetState(instance, container, innerParams.returnFocus, innerParams.didClose);\n }\n };\n\n const animatePopup = (instance, popup, container, returnFocus, didClose) => {\n globalState.swalCloseEventFinishedCallback = removePopupAndResetState.bind(null, instance, container, returnFocus, didClose);\n popup.addEventListener(animationEndEvent, function (e) {\n if (e.target === popup) {\n globalState.swalCloseEventFinishedCallback();\n delete globalState.swalCloseEventFinishedCallback;\n }\n });\n };\n\n const triggerDidCloseAndDispose = (instance, didClose) => {\n setTimeout(() => {\n if (typeof didClose === 'function') {\n didClose.bind(instance.params)();\n }\n\n instance._destroy();\n });\n };\n\n function setButtonsDisabled(instance, buttons, disabled) {\n const domCache = privateProps.domCache.get(instance);\n buttons.forEach(button => {\n domCache[button].disabled = disabled;\n });\n }\n\n function setInputDisabled(input, disabled) {\n if (!input) {\n return false;\n }\n\n if (input.type === 'radio') {\n const radiosContainer = input.parentNode.parentNode;\n const radios = radiosContainer.querySelectorAll('input');\n\n for (let i = 0; i < radios.length; i++) {\n radios[i].disabled = disabled;\n }\n } else {\n input.disabled = disabled;\n }\n }\n\n function enableButtons() {\n setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], false);\n }\n function disableButtons() {\n setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], true);\n }\n function enableInput() {\n return setInputDisabled(this.getInput(), false);\n }\n function disableInput() {\n return setInputDisabled(this.getInput(), true);\n }\n\n function showValidationMessage(error) {\n const domCache = privateProps.domCache.get(this);\n const params = privateProps.innerParams.get(this);\n setInnerHtml(domCache.validationMessage, error);\n domCache.validationMessage.className = swalClasses['validation-message'];\n\n if (params.customClass && params.customClass.validationMessage) {\n addClass(domCache.validationMessage, params.customClass.validationMessage);\n }\n\n show(domCache.validationMessage);\n const input = this.getInput();\n\n if (input) {\n input.setAttribute('aria-invalid', true);\n input.setAttribute('aria-describedby', swalClasses['validation-message']);\n focusInput(input);\n addClass(input, swalClasses.inputerror);\n }\n } // Hide block with validation message\n\n function resetValidationMessage$1() {\n const domCache = privateProps.domCache.get(this);\n\n if (domCache.validationMessage) {\n hide(domCache.validationMessage);\n }\n\n const input = this.getInput();\n\n if (input) {\n input.removeAttribute('aria-invalid');\n input.removeAttribute('aria-describedby');\n removeClass(input, swalClasses.inputerror);\n }\n }\n\n function getProgressSteps$1() {\n const domCache = privateProps.domCache.get(this);\n return domCache.progressSteps;\n }\n\n /**\n * Updates popup parameters.\n */\n\n function update(params) {\n const popup = getPopup();\n const innerParams = privateProps.innerParams.get(this);\n\n if (!popup || hasClass(popup, innerParams.hideClass.popup)) {\n return warn(\"You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.\");\n }\n\n const validUpdatableParams = filterValidParams(params);\n const updatedParams = Object.assign({}, innerParams, validUpdatableParams);\n render(this, updatedParams);\n privateProps.innerParams.set(this, updatedParams);\n Object.defineProperties(this, {\n params: {\n value: Object.assign({}, this.params, params),\n writable: false,\n enumerable: true\n }\n });\n }\n\n const filterValidParams = params => {\n const validUpdatableParams = {};\n Object.keys(params).forEach(param => {\n if (isUpdatableParameter(param)) {\n validUpdatableParams[param] = params[param];\n } else {\n warn(\"Invalid parameter to update: \\\"\".concat(param, \"\\\". Updatable params are listed here: https://github.com/sweetalert2/sweetalert2/blob/master/src/utils/params.js\\n\\nIf you think this parameter should be updatable, request it here: https://github.com/sweetalert2/sweetalert2/issues/new?template=02_feature_request.md\"));\n }\n });\n return validUpdatableParams;\n };\n\n function _destroy() {\n const domCache = privateProps.domCache.get(this);\n const innerParams = privateProps.innerParams.get(this);\n\n if (!innerParams) {\n disposeWeakMaps(this); // The WeakMaps might have been partly destroyed, we must recall it to dispose any remaining WeakMaps #2335\n\n return; // This instance has already been destroyed\n } // Check if there is another Swal closing\n\n\n if (domCache.popup && globalState.swalCloseEventFinishedCallback) {\n globalState.swalCloseEventFinishedCallback();\n delete globalState.swalCloseEventFinishedCallback;\n } // Check if there is a swal disposal defer timer\n\n\n if (globalState.deferDisposalTimer) {\n clearTimeout(globalState.deferDisposalTimer);\n delete globalState.deferDisposalTimer;\n }\n\n if (typeof innerParams.didDestroy === 'function') {\n innerParams.didDestroy();\n }\n\n disposeSwal(this);\n }\n\n const disposeSwal = instance => {\n disposeWeakMaps(instance); // Unset this.params so GC will dispose it (#1569)\n\n delete instance.params; // Unset globalState props so GC will dispose globalState (#1569)\n\n delete globalState.keydownHandler;\n delete globalState.keydownTarget; // Unset currentInstance\n\n delete globalState.currentInstance;\n };\n\n const disposeWeakMaps = instance => {\n // If the current instance is awaiting a promise result, we keep the privateMethods to call them once the promise result is retrieved #2335\n if (instance.isAwaitingPromise()) {\n unsetWeakMaps(privateProps, instance);\n privateProps.awaitingPromise.set(instance, true);\n } else {\n unsetWeakMaps(privateMethods, instance);\n unsetWeakMaps(privateProps, instance);\n }\n };\n\n const unsetWeakMaps = (obj, instance) => {\n for (const i in obj) {\n obj[i].delete(instance);\n }\n };\n\n\n\n var instanceMethods = /*#__PURE__*/Object.freeze({\n hideLoading: hideLoading,\n disableLoading: hideLoading,\n getInput: getInput$1,\n close: close,\n isAwaitingPromise: isAwaitingPromise,\n rejectPromise: rejectPromise,\n handleAwaitingPromise: handleAwaitingPromise,\n closePopup: close,\n closeModal: close,\n closeToast: close,\n enableButtons: enableButtons,\n disableButtons: disableButtons,\n enableInput: enableInput,\n disableInput: disableInput,\n showValidationMessage: showValidationMessage,\n resetValidationMessage: resetValidationMessage$1,\n getProgressSteps: getProgressSteps$1,\n update: update,\n _destroy: _destroy\n });\n\n const handleConfirmButtonClick = instance => {\n const innerParams = privateProps.innerParams.get(instance);\n instance.disableButtons();\n\n if (innerParams.input) {\n handleConfirmOrDenyWithInput(instance, 'confirm');\n } else {\n confirm(instance, true);\n }\n };\n const handleDenyButtonClick = instance => {\n const innerParams = privateProps.innerParams.get(instance);\n instance.disableButtons();\n\n if (innerParams.returnInputValueOnDeny) {\n handleConfirmOrDenyWithInput(instance, 'deny');\n } else {\n deny(instance, false);\n }\n };\n const handleCancelButtonClick = (instance, dismissWith) => {\n instance.disableButtons();\n dismissWith(DismissReason.cancel);\n };\n\n const handleConfirmOrDenyWithInput = (instance, type\n /* 'confirm' | 'deny' */\n ) => {\n const innerParams = privateProps.innerParams.get(instance);\n\n if (!innerParams.input) {\n return error(\"The \\\"input\\\" parameter is needed to be set when using returnInputValueOn\".concat(capitalizeFirstLetter(type)));\n }\n\n const inputValue = getInputValue(instance, innerParams);\n\n if (innerParams.inputValidator) {\n handleInputValidator(instance, inputValue, type);\n } else if (!instance.getInput().checkValidity()) {\n instance.enableButtons();\n instance.showValidationMessage(innerParams.validationMessage);\n } else if (type === 'deny') {\n deny(instance, inputValue);\n } else {\n confirm(instance, inputValue);\n }\n };\n\n const handleInputValidator = (instance, inputValue, type\n /* 'confirm' | 'deny' */\n ) => {\n const innerParams = privateProps.innerParams.get(instance);\n instance.disableInput();\n const validationPromise = Promise.resolve().then(() => asPromise(innerParams.inputValidator(inputValue, innerParams.validationMessage)));\n validationPromise.then(validationMessage => {\n instance.enableButtons();\n instance.enableInput();\n\n if (validationMessage) {\n instance.showValidationMessage(validationMessage);\n } else if (type === 'deny') {\n deny(instance, inputValue);\n } else {\n confirm(instance, inputValue);\n }\n });\n };\n\n const deny = (instance, value) => {\n const innerParams = privateProps.innerParams.get(instance || undefined);\n\n if (innerParams.showLoaderOnDeny) {\n showLoading(getDenyButton());\n }\n\n if (innerParams.preDeny) {\n privateProps.awaitingPromise.set(instance || undefined, true); // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preDeny's promise is received\n\n const preDenyPromise = Promise.resolve().then(() => asPromise(innerParams.preDeny(value, innerParams.validationMessage)));\n preDenyPromise.then(preDenyValue => {\n if (preDenyValue === false) {\n instance.hideLoading();\n handleAwaitingPromise(instance);\n } else {\n instance.closePopup({\n isDenied: true,\n value: typeof preDenyValue === 'undefined' ? value : preDenyValue\n });\n }\n }).catch(error$$1 => rejectWith(instance || undefined, error$$1));\n } else {\n instance.closePopup({\n isDenied: true,\n value\n });\n }\n };\n\n const succeedWith = (instance, value) => {\n instance.closePopup({\n isConfirmed: true,\n value\n });\n };\n\n const rejectWith = (instance, error$$1) => {\n instance.rejectPromise(error$$1);\n };\n\n const confirm = (instance, value) => {\n const innerParams = privateProps.innerParams.get(instance || undefined);\n\n if (innerParams.showLoaderOnConfirm) {\n showLoading();\n }\n\n if (innerParams.preConfirm) {\n instance.resetValidationMessage();\n privateProps.awaitingPromise.set(instance || undefined, true); // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preConfirm's promise is received\n\n const preConfirmPromise = Promise.resolve().then(() => asPromise(innerParams.preConfirm(value, innerParams.validationMessage)));\n preConfirmPromise.then(preConfirmValue => {\n if (isVisible(getValidationMessage()) || preConfirmValue === false) {\n instance.hideLoading();\n handleAwaitingPromise(instance);\n } else {\n succeedWith(instance, typeof preConfirmValue === 'undefined' ? value : preConfirmValue);\n }\n }).catch(error$$1 => rejectWith(instance || undefined, error$$1));\n } else {\n succeedWith(instance, value);\n }\n };\n\n const handlePopupClick = (instance, domCache, dismissWith) => {\n const innerParams = privateProps.innerParams.get(instance);\n\n if (innerParams.toast) {\n handleToastClick(instance, domCache, dismissWith);\n } else {\n // Ignore click events that had mousedown on the popup but mouseup on the container\n // This can happen when the user drags a slider\n handleModalMousedown(domCache); // Ignore click events that had mousedown on the container but mouseup on the popup\n\n handleContainerMousedown(domCache);\n handleModalClick(instance, domCache, dismissWith);\n }\n };\n\n const handleToastClick = (instance, domCache, dismissWith) => {\n // Closing toast by internal click\n domCache.popup.onclick = () => {\n const innerParams = privateProps.innerParams.get(instance);\n\n if (innerParams && (isAnyButtonShown(innerParams) || innerParams.timer || innerParams.input)) {\n return;\n }\n\n dismissWith(DismissReason.close);\n };\n };\n /**\n * @param {*} innerParams\n * @returns {boolean}\n */\n\n\n const isAnyButtonShown = innerParams => {\n return innerParams.showConfirmButton || innerParams.showDenyButton || innerParams.showCancelButton || innerParams.showCloseButton;\n };\n\n let ignoreOutsideClick = false;\n\n const handleModalMousedown = domCache => {\n domCache.popup.onmousedown = () => {\n domCache.container.onmouseup = function (e) {\n domCache.container.onmouseup = undefined; // We only check if the mouseup target is the container because usually it doesn't\n // have any other direct children aside of the popup\n\n if (e.target === domCache.container) {\n ignoreOutsideClick = true;\n }\n };\n };\n };\n\n const handleContainerMousedown = domCache => {\n domCache.container.onmousedown = () => {\n domCache.popup.onmouseup = function (e) {\n domCache.popup.onmouseup = undefined; // We also need to check if the mouseup target is a child of the popup\n\n if (e.target === domCache.popup || domCache.popup.contains(e.target)) {\n ignoreOutsideClick = true;\n }\n };\n };\n };\n\n const handleModalClick = (instance, domCache, dismissWith) => {\n domCache.container.onclick = e => {\n const innerParams = privateProps.innerParams.get(instance);\n\n if (ignoreOutsideClick) {\n ignoreOutsideClick = false;\n return;\n }\n\n if (e.target === domCache.container && callIfFunction(innerParams.allowOutsideClick)) {\n dismissWith(DismissReason.backdrop);\n }\n };\n };\n\n const isJqueryElement = elem => typeof elem === 'object' && elem.jquery;\n\n const isElement = elem => elem instanceof Element || isJqueryElement(elem);\n\n const argsToParams = args => {\n const params = {};\n\n if (typeof args[0] === 'object' && !isElement(args[0])) {\n Object.assign(params, args[0]);\n } else {\n ['title', 'html', 'icon'].forEach((name, index) => {\n const arg = args[index];\n\n if (typeof arg === 'string' || isElement(arg)) {\n params[name] = arg;\n } else if (arg !== undefined) {\n error(\"Unexpected type of \".concat(name, \"! Expected \\\"string\\\" or \\\"Element\\\", got \").concat(typeof arg));\n }\n });\n }\n\n return params;\n };\n\n function fire() {\n const Swal = this; // eslint-disable-line @typescript-eslint/no-this-alias\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return new Swal(...args);\n }\n\n /**\n * Returns an extended version of `Swal` containing `params` as defaults.\n * Useful for reusing Swal configuration.\n *\n * For example:\n *\n * Before:\n * const textPromptOptions = { input: 'text', showCancelButton: true }\n * const {value: firstName} = await Swal.fire({ ...textPromptOptions, title: 'What is your first name?' })\n * const {value: lastName} = await Swal.fire({ ...textPromptOptions, title: 'What is your last name?' })\n *\n * After:\n * const TextPrompt = Swal.mixin({ input: 'text', showCancelButton: true })\n * const {value: firstName} = await TextPrompt('What is your first name?')\n * const {value: lastName} = await TextPrompt('What is your last name?')\n *\n * @param mixinParams\n */\n function mixin(mixinParams) {\n class MixinSwal extends this {\n _main(params, priorityMixinParams) {\n return super._main(params, Object.assign({}, mixinParams, priorityMixinParams));\n }\n\n }\n\n return MixinSwal;\n }\n\n /**\n * If `timer` parameter is set, returns number of milliseconds of timer remained.\n * Otherwise, returns undefined.\n */\n\n const getTimerLeft = () => {\n return globalState.timeout && globalState.timeout.getTimerLeft();\n };\n /**\n * Stop timer. Returns number of milliseconds of timer remained.\n * If `timer` parameter isn't set, returns undefined.\n */\n\n const stopTimer = () => {\n if (globalState.timeout) {\n stopTimerProgressBar();\n return globalState.timeout.stop();\n }\n };\n /**\n * Resume timer. Returns number of milliseconds of timer remained.\n * If `timer` parameter isn't set, returns undefined.\n */\n\n const resumeTimer = () => {\n if (globalState.timeout) {\n const remaining = globalState.timeout.start();\n animateTimerProgressBar(remaining);\n return remaining;\n }\n };\n /**\n * Resume timer. Returns number of milliseconds of timer remained.\n * If `timer` parameter isn't set, returns undefined.\n */\n\n const toggleTimer = () => {\n const timer = globalState.timeout;\n return timer && (timer.running ? stopTimer() : resumeTimer());\n };\n /**\n * Increase timer. Returns number of milliseconds of an updated timer.\n * If `timer` parameter isn't set, returns undefined.\n */\n\n const increaseTimer = n => {\n if (globalState.timeout) {\n const remaining = globalState.timeout.increase(n);\n animateTimerProgressBar(remaining, true);\n return remaining;\n }\n };\n /**\n * Check if timer is running. Returns true if timer is running\n * or false if timer is paused or stopped.\n * If `timer` parameter isn't set, returns undefined\n */\n\n const isTimerRunning = () => {\n return globalState.timeout && globalState.timeout.isRunning();\n };\n\n let bodyClickListenerAdded = false;\n const clickHandlers = {};\n function bindClickHandler() {\n let attr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'data-swal-template';\n clickHandlers[attr] = this;\n\n if (!bodyClickListenerAdded) {\n document.body.addEventListener('click', bodyClickListener);\n bodyClickListenerAdded = true;\n }\n }\n\n const bodyClickListener = event => {\n for (let el = event.target; el && el !== document; el = el.parentNode) {\n for (const attr in clickHandlers) {\n const template = el.getAttribute(attr);\n\n if (template) {\n clickHandlers[attr].fire({\n template\n });\n return;\n }\n }\n }\n };\n\n\n\n var staticMethods = /*#__PURE__*/Object.freeze({\n isValidParameter: isValidParameter,\n isUpdatableParameter: isUpdatableParameter,\n isDeprecatedParameter: isDeprecatedParameter,\n argsToParams: argsToParams,\n isVisible: isVisible$1,\n clickConfirm: clickConfirm,\n clickDeny: clickDeny,\n clickCancel: clickCancel,\n getContainer: getContainer,\n getPopup: getPopup,\n getTitle: getTitle,\n getHtmlContainer: getHtmlContainer,\n getImage: getImage,\n getIcon: getIcon,\n getInputLabel: getInputLabel,\n getCloseButton: getCloseButton,\n getActions: getActions,\n getConfirmButton: getConfirmButton,\n getDenyButton: getDenyButton,\n getCancelButton: getCancelButton,\n getLoader: getLoader,\n getFooter: getFooter,\n getTimerProgressBar: getTimerProgressBar,\n getFocusableElements: getFocusableElements,\n getValidationMessage: getValidationMessage,\n isLoading: isLoading,\n fire: fire,\n mixin: mixin,\n showLoading: showLoading,\n enableLoading: showLoading,\n getTimerLeft: getTimerLeft,\n stopTimer: stopTimer,\n resumeTimer: resumeTimer,\n toggleTimer: toggleTimer,\n increaseTimer: increaseTimer,\n isTimerRunning: isTimerRunning,\n bindClickHandler: bindClickHandler\n });\n\n let currentInstance;\n\n class SweetAlert {\n constructor() {\n // Prevent run in Node env\n if (typeof window === 'undefined') {\n return;\n }\n\n currentInstance = this; // @ts-ignore\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n const outerParams = Object.freeze(this.constructor.argsToParams(args));\n Object.defineProperties(this, {\n params: {\n value: outerParams,\n writable: false,\n enumerable: true,\n configurable: true\n }\n }); // @ts-ignore\n\n const promise = this._main(this.params);\n\n privateProps.promise.set(this, promise);\n }\n\n _main(userParams) {\n let mixinParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n showWarningsForParams(Object.assign({}, mixinParams, userParams));\n\n if (globalState.currentInstance) {\n globalState.currentInstance._destroy();\n\n if (isModal()) {\n unsetAriaHidden();\n }\n }\n\n globalState.currentInstance = this;\n const innerParams = prepareParams(userParams, mixinParams);\n setParameters(innerParams);\n Object.freeze(innerParams); // clear the previous timer\n\n if (globalState.timeout) {\n globalState.timeout.stop();\n delete globalState.timeout;\n } // clear the restore focus timeout\n\n\n clearTimeout(globalState.restoreFocusTimeout);\n const domCache = populateDomCache(this);\n render(this, innerParams);\n privateProps.innerParams.set(this, innerParams);\n return swalPromise(this, domCache, innerParams);\n } // `catch` cannot be the name of a module export, so we define our thenable methods here instead\n\n\n then(onFulfilled) {\n const promise = privateProps.promise.get(this);\n return promise.then(onFulfilled);\n }\n\n finally(onFinally) {\n const promise = privateProps.promise.get(this);\n return promise.finally(onFinally);\n }\n\n }\n\n const swalPromise = (instance, domCache, innerParams) => {\n return new Promise((resolve, reject) => {\n // functions to handle all closings/dismissals\n const dismissWith = dismiss => {\n instance.closePopup({\n isDismissed: true,\n dismiss\n });\n };\n\n privateMethods.swalPromiseResolve.set(instance, resolve);\n privateMethods.swalPromiseReject.set(instance, reject);\n\n domCache.confirmButton.onclick = () => handleConfirmButtonClick(instance);\n\n domCache.denyButton.onclick = () => handleDenyButtonClick(instance);\n\n domCache.cancelButton.onclick = () => handleCancelButtonClick(instance, dismissWith);\n\n domCache.closeButton.onclick = () => dismissWith(DismissReason.close);\n\n handlePopupClick(instance, domCache, dismissWith);\n addKeydownHandler(instance, globalState, innerParams, dismissWith);\n handleInputOptionsAndValue(instance, innerParams);\n openPopup(innerParams);\n setupTimer(globalState, innerParams, dismissWith);\n initFocus(domCache, innerParams); // Scroll container to top on open (#1247, #1946)\n\n setTimeout(() => {\n domCache.container.scrollTop = 0;\n });\n });\n };\n\n const prepareParams = (userParams, mixinParams) => {\n const templateParams = getTemplateParams(userParams);\n const params = Object.assign({}, defaultParams, mixinParams, templateParams, userParams); // precedence is described in #2131\n\n params.showClass = Object.assign({}, defaultParams.showClass, params.showClass);\n params.hideClass = Object.assign({}, defaultParams.hideClass, params.hideClass);\n return params;\n };\n\n const populateDomCache = instance => {\n const domCache = {\n popup: getPopup(),\n container: getContainer(),\n actions: getActions(),\n confirmButton: getConfirmButton(),\n denyButton: getDenyButton(),\n cancelButton: getCancelButton(),\n loader: getLoader(),\n closeButton: getCloseButton(),\n validationMessage: getValidationMessage(),\n progressSteps: getProgressSteps()\n };\n privateProps.domCache.set(instance, domCache);\n return domCache;\n };\n\n const setupTimer = (globalState$$1, innerParams, dismissWith) => {\n const timerProgressBar = getTimerProgressBar();\n hide(timerProgressBar);\n\n if (innerParams.timer) {\n globalState$$1.timeout = new Timer(() => {\n dismissWith('timer');\n delete globalState$$1.timeout;\n }, innerParams.timer);\n\n if (innerParams.timerProgressBar) {\n show(timerProgressBar);\n applyCustomClass(timerProgressBar, innerParams, 'timerProgressBar');\n setTimeout(() => {\n if (globalState$$1.timeout && globalState$$1.timeout.running) {\n // timer can be already stopped or unset at this point\n animateTimerProgressBar(innerParams.timer);\n }\n });\n }\n }\n };\n\n const initFocus = (domCache, innerParams) => {\n if (innerParams.toast) {\n return;\n }\n\n if (!callIfFunction(innerParams.allowEnterKey)) {\n return blurActiveElement();\n }\n\n if (!focusButton(domCache, innerParams)) {\n setFocus(innerParams, -1, 1);\n }\n };\n\n const focusButton = (domCache, innerParams) => {\n if (innerParams.focusDeny && isVisible(domCache.denyButton)) {\n domCache.denyButton.focus();\n return true;\n }\n\n if (innerParams.focusCancel && isVisible(domCache.cancelButton)) {\n domCache.cancelButton.focus();\n return true;\n }\n\n if (innerParams.focusConfirm && isVisible(domCache.confirmButton)) {\n domCache.confirmButton.focus();\n return true;\n }\n\n return false;\n };\n\n const blurActiveElement = () => {\n if (document.activeElement instanceof HTMLElement && typeof document.activeElement.blur === 'function') {\n document.activeElement.blur();\n }\n }; // Assign instance methods from src/instanceMethods/*.js to prototype\n\n\n Object.assign(SweetAlert.prototype, instanceMethods); // Assign static methods from src/staticMethods/*.js to constructor\n\n Object.assign(SweetAlert, staticMethods); // Proxy to instance methods to constructor, for now, for backwards compatibility\n\n Object.keys(instanceMethods).forEach(key => {\n SweetAlert[key] = function () {\n if (currentInstance) {\n return currentInstance[key](...arguments);\n }\n };\n });\n SweetAlert.DismissReason = DismissReason;\n SweetAlert.version = '11.4.8';\n\n const Swal = SweetAlert; // @ts-ignore\n\n Swal.default = Swal;\n\n return Swal;\n\n}));\nif (typeof this !== 'undefined' && this.Sweetalert2){ this.swal = this.sweetAlert = this.Swal = this.SweetAlert = this.Sweetalert2}\n", "export class BitMatrix {\n public static createEmpty(width: number, height: number) {\n return new BitMatrix(new Uint8ClampedArray(width * height), width);\n }\n\n public width: number;\n public height: number;\n private data: Uint8ClampedArray;\n\n constructor(data: Uint8ClampedArray, width: number) {\n this.width = width;\n this.height = data.length / width;\n this.data = data;\n }\n\n public get(x: number, y: number): boolean {\n if (x < 0 || x >= this.width || y < 0 || y >= this.height) {\n return false;\n }\n return !!this.data[y * this.width + x];\n }\n\n public set(x: number, y: number, v: boolean) {\n this.data[y * this.width + x] = v ? 1 : 0;\n }\n\n public setRegion(left: number, top: number, width: number, height: number, v: boolean) {\n for (let y = top; y < top + height; y++) {\n for (let x = left; x < left + width; x++) {\n this.set(x, y, !!v);\n }\n }\n }\n}\n", "import {BitMatrix} from \"../BitMatrix\";\nimport {GreyscaleWeights} from \"../index\";\n\nconst REGION_SIZE = 8;\nconst MIN_DYNAMIC_RANGE = 24;\n\nfunction numBetween(value: number, min: number, max: number): number {\n return value < min ? min : value > max ? max : value;\n}\n\n// Like BitMatrix but accepts arbitry Uint8 values\nclass Matrix {\n private data: Uint8ClampedArray;\n private width: number;\n constructor(width: number, height: number, buffer?: Uint8ClampedArray) {\n this.width = width;\n const bufferSize = width * height;\n if (buffer && buffer.length !== bufferSize) {\n throw new Error(\"Wrong buffer size\");\n }\n this.data = buffer || new Uint8ClampedArray(bufferSize);\n }\n public get(x: number, y: number) {\n return this.data[y * this.width + x];\n }\n public set(x: number, y: number, value: number) {\n this.data[y * this.width + x] = value;\n }\n}\n\nexport function binarize(data: Uint8ClampedArray, width: number, height: number, returnInverted: boolean,\n greyscaleWeights: GreyscaleWeights, canOverwriteImage: boolean) {\n const pixelCount = width * height;\n if (data.length !== pixelCount * 4) {\n throw new Error(\"Malformed data passed to binarizer.\");\n }\n // assign the greyscale and binary image within the rgba buffer as the rgba image will not be needed after conversion\n let bufferOffset = 0;\n // Convert image to greyscale\n let greyscaleBuffer: Uint8ClampedArray;\n if (canOverwriteImage) {\n greyscaleBuffer = new Uint8ClampedArray(data.buffer, bufferOffset, pixelCount);\n bufferOffset += pixelCount;\n }\n const greyscalePixels = new Matrix(width, height, greyscaleBuffer);\n if (greyscaleWeights.useIntegerApproximation) {\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n const pixelPosition = (y * width + x) * 4;\n const r = data[pixelPosition];\n const g = data[pixelPosition + 1];\n const b = data[pixelPosition + 2];\n greyscalePixels.set(x, y,\n // tslint:disable-next-line no-bitwise\n (greyscaleWeights.red * r + greyscaleWeights.green * g + greyscaleWeights.blue * b + 128) >> 8);\n }\n }\n } else {\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n const pixelPosition = (y * width + x) * 4;\n const r = data[pixelPosition];\n const g = data[pixelPosition + 1];\n const b = data[pixelPosition + 2];\n greyscalePixels.set(x, y,\n greyscaleWeights.red * r + greyscaleWeights.green * g + greyscaleWeights.blue * b);\n }\n }\n }\n const horizontalRegionCount = Math.ceil(width / REGION_SIZE);\n const verticalRegionCount = Math.ceil(height / REGION_SIZE);\n const blackPointsCount = horizontalRegionCount * verticalRegionCount;\n\n let blackPointsBuffer: Uint8ClampedArray;\n if (canOverwriteImage) {\n blackPointsBuffer = new Uint8ClampedArray(data.buffer, bufferOffset, blackPointsCount);\n bufferOffset += blackPointsCount;\n }\n const blackPoints = new Matrix(horizontalRegionCount, verticalRegionCount, blackPointsBuffer);\n for (let verticalRegion = 0; verticalRegion < verticalRegionCount; verticalRegion++) {\n for (let hortizontalRegion = 0; hortizontalRegion < horizontalRegionCount; hortizontalRegion++) {\n let min = Infinity;\n let max = 0;\n for (let y = 0; y < REGION_SIZE; y++) {\n for (let x = 0; x < REGION_SIZE; x++) {\n const pixelLumosity =\n greyscalePixels.get(hortizontalRegion * REGION_SIZE + x, verticalRegion * REGION_SIZE + y);\n min = Math.min(min, pixelLumosity);\n max = Math.max(max, pixelLumosity);\n }\n }\n // We could also compute the real average of all pixels but following the assumption that the qr code consists\n // of bright and dark pixels and essentially not much in between, by (min + max)/2 we make the cut really between\n // those two classes. If using the average over all pixel in a block of mostly bright pixels and few dark pixels,\n // the avg would tend to the bright side and darker bright pixels could be interpreted as dark.\n let average = (min + max) / 2;\n // Small bias towards black by moving the threshold up. We do this, as in the finder patterns white holes tend\n // to appear which makes them undetectable.\n const blackBias = 1.11;\n average = Math.min(255, average * blackBias);\n if (max - min <= MIN_DYNAMIC_RANGE) {\n // If variation within the block is low, assume this is a block with only light or only\n // dark pixels. In that case we do not want to use the average, as it would divide this\n // low contrast area into black and white pixels, essentially creating data out of noise.\n //\n // Default the blackpoint for these blocks to be half the min - effectively white them out\n average = min / 2;\n\n if (verticalRegion > 0 && hortizontalRegion > 0) {\n // Correct the \"white background\" assumption for blocks that have neighbors by comparing\n // the pixels in this block to the previously calculated black points. This is based on\n // the fact that dark barcode symbology is always surrounded by some amount of light\n // background for which reasonable black point estimates were made. The bp estimated at\n // the boundaries is used for the interior.\n\n // The (min < bp) is arbitrary but works better than other heuristics that were tried.\n const averageNeighborBlackPoint = (\n blackPoints.get(hortizontalRegion, verticalRegion - 1) +\n (2 * blackPoints.get(hortizontalRegion - 1, verticalRegion)) +\n blackPoints.get(hortizontalRegion - 1, verticalRegion - 1)\n ) / 4;\n if (min < averageNeighborBlackPoint) {\n average = averageNeighborBlackPoint; // no need to apply black bias as already applied to neighbors\n }\n }\n }\n blackPoints.set(hortizontalRegion, verticalRegion, average);\n }\n }\n\n let binarized: BitMatrix;\n if (canOverwriteImage) {\n const binarizedBuffer = new Uint8ClampedArray(data.buffer, bufferOffset, pixelCount);\n bufferOffset += pixelCount;\n binarized = new BitMatrix(binarizedBuffer, width);\n } else {\n binarized = BitMatrix.createEmpty(width, height);\n }\n\n let inverted: BitMatrix = null;\n if (returnInverted) {\n if (canOverwriteImage) {\n const invertedBuffer = new Uint8ClampedArray(data.buffer, bufferOffset, pixelCount);\n inverted = new BitMatrix(invertedBuffer, width);\n } else {\n inverted = BitMatrix.createEmpty(width, height);\n }\n }\n\n for (let verticalRegion = 0; verticalRegion < verticalRegionCount; verticalRegion++) {\n for (let hortizontalRegion = 0; hortizontalRegion < horizontalRegionCount; hortizontalRegion++) {\n const left = numBetween(hortizontalRegion, 2, horizontalRegionCount - 3);\n const top = numBetween(verticalRegion, 2, verticalRegionCount - 3);\n let sum = 0;\n for (let xRegion = -2; xRegion <= 2; xRegion++) {\n for (let yRegion = -2; yRegion <= 2; yRegion++) {\n sum += blackPoints.get(left + xRegion, top + yRegion);\n }\n }\n const threshold = sum / 25;\n for (let xRegion = 0; xRegion < REGION_SIZE; xRegion++) {\n for (let yRegion = 0; yRegion < REGION_SIZE; yRegion++) {\n const x = hortizontalRegion * REGION_SIZE + xRegion;\n const y = verticalRegion * REGION_SIZE + yRegion;\n const lum = greyscalePixels.get(x, y);\n binarized.set(x, y, lum <= threshold);\n if (returnInverted) {\n inverted.set(x, y, !(lum <= threshold));\n }\n }\n }\n }\n }\n if (returnInverted) {\n return { binarized, inverted };\n }\n return { binarized };\n}\n", "// tslint:disable:no-bitwise\n\nexport class BitStream {\n private bytes: Uint8ClampedArray;\n private byteOffset: number = 0;\n private bitOffset: number = 0;\n\n constructor(bytes: Uint8ClampedArray) {\n this.bytes = bytes;\n }\n\n public readBits(numBits: number): number {\n if (numBits < 1 || numBits > 32 || numBits > this.available()) {\n throw new Error(\"Cannot read \" + numBits.toString() + \" bits\");\n }\n\n let result = 0;\n // First, read remainder from current byte\n if (this.bitOffset > 0) {\n const bitsLeft = 8 - this.bitOffset;\n const toRead = numBits < bitsLeft ? numBits : bitsLeft;\n const bitsToNotRead = bitsLeft - toRead;\n const mask = (0xFF >> (8 - toRead)) << bitsToNotRead;\n result = (this.bytes[this.byteOffset] & mask) >> bitsToNotRead;\n numBits -= toRead;\n this.bitOffset += toRead;\n if (this.bitOffset === 8) {\n this.bitOffset = 0;\n this.byteOffset++;\n }\n }\n\n // Next read whole bytes\n if (numBits > 0) {\n while (numBits >= 8) {\n result = (result << 8) | (this.bytes[this.byteOffset] & 0xFF);\n this.byteOffset++;\n numBits -= 8;\n }\n\n // Finally read a partial byte\n if (numBits > 0) {\n const bitsToNotRead = 8 - numBits;\n const mask = (0xFF >> bitsToNotRead) << bitsToNotRead;\n result = (result << numBits) | ((this.bytes[this.byteOffset] & mask) >> bitsToNotRead);\n this.bitOffset += numBits;\n }\n }\n return result;\n }\n\n public available(): number {\n return 8 * (this.bytes.length - this.byteOffset) - this.bitOffset;\n }\n}\n", "// tslint:disable:no-bitwise\nimport { BitStream } from \"./BitStream\";\n\nexport interface Chunk {\n type: Mode;\n text: string;\n}\n\nexport interface ByteChunk {\n type: Mode.Byte | Mode.Kanji;\n bytes: number[];\n}\n\nexport interface ECIChunk {\n type: Mode.ECI;\n assignmentNumber: number;\n}\n\nexport interface StructuredAppend {\n type: Mode.StructuredAppend;\n currentSequence: number;\n totalSequence: number;\n parity: number;\n}\n\nexport type Chunks = Array;\n\nexport interface DecodedQR {\n text: string;\n bytes: number[];\n chunks: Chunks;\n version: number;\n}\n\nexport enum Mode {\n Numeric = \"numeric\",\n Alphanumeric = \"alphanumeric\",\n Byte = \"byte\",\n Kanji = \"kanji\",\n ECI = \"eci\",\n StructuredAppend = \"structuredappend\",\n}\n\nenum ModeByte {\n Terminator = 0x0,\n Numeric = 0x1,\n Alphanumeric = 0x2,\n Byte = 0x4,\n Kanji = 0x8,\n ECI = 0x7,\n StructuredAppend = 0x3,\n // FNC1FirstPosition = 0x5,\n // FNC1SecondPosition = 0x9,\n}\n\nfunction decodeNumeric(stream: BitStream, size: number) {\n const bytes: number[] = [];\n let text = \"\";\n\n const characterCountSize = [10, 12, 14][size];\n let length = stream.readBits(characterCountSize);\n // Read digits in groups of 3\n while (length >= 3) {\n const num = stream.readBits(10);\n if (num >= 1000) {\n throw new Error(\"Invalid numeric value above 999\");\n }\n\n const a = Math.floor(num / 100);\n const b = Math.floor(num / 10) % 10;\n const c = num % 10;\n\n bytes.push(48 + a, 48 + b, 48 + c);\n text += a.toString() + b.toString() + c.toString();\n length -= 3;\n }\n\n // If the number of digits aren't a multiple of 3, the remaining digits are special cased.\n if (length === 2) {\n const num = stream.readBits(7);\n if (num >= 100) {\n throw new Error(\"Invalid numeric value above 99\");\n }\n\n const a = Math.floor(num / 10);\n const b = num % 10;\n\n bytes.push(48 + a, 48 + b);\n text += a.toString() + b.toString();\n } else if (length === 1) {\n const num = stream.readBits(4);\n if (num >= 10) {\n throw new Error(\"Invalid numeric value above 9\");\n }\n\n bytes.push(48 + num);\n text += num.toString();\n }\n\n return { bytes, text };\n}\n\nconst AlphanumericCharacterCodes = [\n \"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\",\n \"9\", \"A\", \"B\", \"C\", \"D\", \"E\", \"F\", \"G\", \"H\",\n \"I\", \"J\", \"K\", \"L\", \"M\", \"N\", \"O\", \"P\", \"Q\",\n \"R\", \"S\", \"T\", \"U\", \"V\", \"W\", \"X\", \"Y\", \"Z\",\n \" \", \"$\", \"%\", \"*\", \"+\", \"-\", \".\", \"/\", \":\",\n];\n\nfunction decodeAlphanumeric(stream: BitStream, size: number) {\n const bytes: number[] = [];\n let text = \"\";\n\n const characterCountSize = [9, 11, 13][size];\n let length = stream.readBits(characterCountSize);\n while (length >= 2) {\n const v = stream.readBits(11);\n\n const a = Math.floor(v / 45);\n const b = v % 45;\n\n bytes.push(AlphanumericCharacterCodes[a].charCodeAt(0), AlphanumericCharacterCodes[b].charCodeAt(0));\n text += AlphanumericCharacterCodes[a] + AlphanumericCharacterCodes[b];\n length -= 2;\n }\n\n if (length === 1) {\n const a = stream.readBits(6);\n bytes.push(AlphanumericCharacterCodes[a].charCodeAt(0));\n text += AlphanumericCharacterCodes[a];\n }\n\n return { bytes, text };\n}\n\nfunction decodeByte(stream: BitStream, size: number) {\n const bytes: number[] = [];\n let text = \"\";\n\n const characterCountSize = [8, 16, 16][size];\n const length = stream.readBits(characterCountSize);\n for (let i = 0; i < length; i++) {\n const b = stream.readBits(8);\n bytes.push(b);\n }\n try {\n text += decodeURIComponent(bytes.map(b => `%${(\"0\" + b.toString(16)).substr(-2)}`).join(\"\"));\n } catch {\n // failed to decode\n }\n\n return { bytes, text };\n}\n\nfunction decodeKanji(stream: BitStream, size: number) {\n const bytes: number[] = [];\n\n const characterCountSize = [8, 10, 12][size];\n const length = stream.readBits(characterCountSize);\n for (let i = 0; i < length; i++) {\n const k = stream.readBits(13);\n\n let c = (Math.floor(k / 0xC0) << 8) | (k % 0xC0);\n if (c < 0x1F00) {\n c += 0x8140;\n } else {\n c += 0xC140;\n }\n\n bytes.push(c >> 8, c & 0xFF);\n }\n\n const text = new TextDecoder(\"shift-jis\").decode(Uint8Array.from(bytes));\n return { bytes, text };\n}\n\nexport function decode(data: Uint8ClampedArray, version: number): DecodedQR {\n const stream = new BitStream(data);\n\n // There are 3 'sizes' based on the version. 1-9 is small (0), 10-26 is medium (1) and 27-40 is large (2).\n const size = version <= 9 ? 0 : version <= 26 ? 1 : 2;\n\n const result: DecodedQR = {\n text: \"\",\n bytes: [],\n chunks: [],\n version,\n };\n\n while (stream.available() >= 4) {\n const mode = stream.readBits(4);\n if (mode === ModeByte.Terminator) {\n return result;\n } else if (mode === ModeByte.ECI) {\n if (stream.readBits(1) === 0) {\n result.chunks.push({\n type: Mode.ECI,\n assignmentNumber: stream.readBits(7),\n });\n } else if (stream.readBits(1) === 0) {\n result.chunks.push({\n type: Mode.ECI,\n assignmentNumber: stream.readBits(14),\n });\n } else if (stream.readBits(1) === 0) {\n result.chunks.push({\n type: Mode.ECI,\n assignmentNumber: stream.readBits(21),\n });\n } else {\n // ECI data seems corrupted\n result.chunks.push({\n type: Mode.ECI,\n assignmentNumber: -1,\n });\n }\n } else if (mode === ModeByte.Numeric) {\n const numericResult = decodeNumeric(stream, size);\n result.text += numericResult.text;\n result.bytes.push(...numericResult.bytes);\n result.chunks.push({\n type: Mode.Numeric,\n text: numericResult.text,\n });\n } else if (mode === ModeByte.Alphanumeric) {\n const alphanumericResult = decodeAlphanumeric(stream, size);\n result.text += alphanumericResult.text;\n result.bytes.push(...alphanumericResult.bytes);\n result.chunks.push({\n type: Mode.Alphanumeric,\n text: alphanumericResult.text,\n });\n } else if (mode === ModeByte.Byte) {\n const byteResult = decodeByte(stream, size);\n result.text += byteResult.text;\n result.bytes.push(...byteResult.bytes);\n result.chunks.push({\n type: Mode.Byte,\n bytes: byteResult.bytes,\n text: byteResult.text,\n });\n } else if (mode === ModeByte.Kanji) {\n const kanjiResult = decodeKanji(stream, size);\n result.text += kanjiResult.text;\n result.bytes.push(...kanjiResult.bytes);\n result.chunks.push({\n type: Mode.Kanji,\n bytes: kanjiResult.bytes,\n text: kanjiResult.text,\n });\n } else if (mode === ModeByte.StructuredAppend) {\n result.chunks.push({\n type: Mode.StructuredAppend,\n currentSequence: stream.readBits(4),\n totalSequence: stream.readBits(4),\n parity: stream.readBits(8),\n });\n }\n }\n\n // If there is no data left, or the remaining bits are all 0, then that counts as a termination marker\n if (stream.available() === 0 || stream.readBits(stream.available()) === 0) {\n return result;\n }\n}\n", "import GenericGF, { addOrSubtractGF } from \"./GenericGF\";\n\nexport default class GenericGFPoly {\n private field: GenericGF;\n private coefficients: Uint8ClampedArray;\n\n constructor(field: GenericGF, coefficients: Uint8ClampedArray) {\n if (coefficients.length === 0) {\n throw new Error(\"No coefficients.\");\n }\n this.field = field;\n const coefficientsLength = coefficients.length;\n if (coefficientsLength > 1 && coefficients[0] === 0) {\n // Leading term must be non-zero for anything except the constant polynomial \"0\"\n let firstNonZero = 1;\n while (firstNonZero < coefficientsLength && coefficients[firstNonZero] === 0) {\n firstNonZero++;\n }\n if (firstNonZero === coefficientsLength) {\n this.coefficients = field.zero.coefficients;\n } else {\n this.coefficients = new Uint8ClampedArray(coefficientsLength - firstNonZero);\n for (let i = 0; i < this.coefficients.length; i++) {\n this.coefficients[i] = coefficients[firstNonZero + i];\n }\n }\n } else {\n this.coefficients = coefficients;\n }\n }\n\n public degree() {\n return this.coefficients.length - 1;\n }\n\n public isZero() {\n return this.coefficients[0] === 0;\n }\n\n public getCoefficient(degree: number) {\n return this.coefficients[this.coefficients.length - 1 - degree];\n }\n\n public addOrSubtract(other: GenericGFPoly) {\n if (this.isZero()) {\n return other;\n }\n if (other.isZero()) {\n return this;\n }\n\n let smallerCoefficients = this.coefficients;\n let largerCoefficients = other.coefficients;\n if (smallerCoefficients.length > largerCoefficients.length) {\n [smallerCoefficients, largerCoefficients] = [largerCoefficients, smallerCoefficients];\n }\n const sumDiff = new Uint8ClampedArray(largerCoefficients.length);\n const lengthDiff = largerCoefficients.length - smallerCoefficients.length;\n for (let i = 0; i < lengthDiff; i++) {\n sumDiff[i] = largerCoefficients[i];\n }\n\n for (let i = lengthDiff; i < largerCoefficients.length; i++) {\n sumDiff[i] = addOrSubtractGF(smallerCoefficients[i - lengthDiff], largerCoefficients[i]);\n }\n\n return new GenericGFPoly(this.field, sumDiff);\n }\n\n public multiply(scalar: number) {\n if (scalar === 0) {\n return this.field.zero;\n }\n if (scalar === 1) {\n return this;\n }\n const size = this.coefficients.length;\n const product = new Uint8ClampedArray(size);\n for (let i = 0; i < size; i++) {\n product[i] = this.field.multiply(this.coefficients[i], scalar);\n }\n\n return new GenericGFPoly(this.field, product);\n }\n\n public multiplyPoly(other: GenericGFPoly): GenericGFPoly {\n if (this.isZero() || other.isZero()) {\n return this.field.zero;\n }\n const aCoefficients = this.coefficients;\n const aLength = aCoefficients.length;\n const bCoefficients = other.coefficients;\n const bLength = bCoefficients.length;\n const product = new Uint8ClampedArray(aLength + bLength - 1);\n for (let i = 0; i < aLength; i++) {\n const aCoeff = aCoefficients[i];\n for (let j = 0; j < bLength; j++) {\n product[i + j] = addOrSubtractGF(product[i + j],\n this.field.multiply(aCoeff, bCoefficients[j]));\n }\n }\n return new GenericGFPoly(this.field, product);\n }\n\n public multiplyByMonomial(degree: number, coefficient: number) {\n if (degree < 0) {\n throw new Error(\"Invalid degree less than 0\");\n }\n if (coefficient === 0) {\n return this.field.zero;\n }\n const size = this.coefficients.length;\n const product = new Uint8ClampedArray(size + degree);\n for (let i = 0; i < size; i++) {\n product[i] = this.field.multiply(this.coefficients[i], coefficient);\n }\n return new GenericGFPoly(this.field, product);\n }\n\n public evaluateAt(a: number) {\n let result = 0;\n if (a === 0) {\n // Just return the x^0 coefficient\n return this.getCoefficient(0);\n }\n const size = this.coefficients.length;\n if (a === 1) {\n // Just the sum of the coefficients\n this.coefficients.forEach((coefficient) => {\n result = addOrSubtractGF(result, coefficient);\n });\n return result;\n }\n result = this.coefficients[0];\n for (let i = 1; i < size; i++) {\n result = addOrSubtractGF(this.field.multiply(a, result), this.coefficients[i]);\n }\n return result;\n }\n}\n", "import GenericGFPoly from \"./GenericGFPoly\";\n\nexport function addOrSubtractGF(a: number, b: number) {\n return a ^ b; // tslint:disable-line:no-bitwise\n}\n\nexport default class GenericGF {\n public primitive: number;\n public size: number;\n public generatorBase: number;\n public zero: GenericGFPoly;\n public one: GenericGFPoly;\n\n private expTable: number[];\n private logTable: number[];\n\n constructor(primitive: number, size: number, genBase: number) {\n this.primitive = primitive;\n this.size = size;\n this.generatorBase = genBase;\n this.expTable = new Array(this.size);\n this.logTable = new Array(this.size);\n\n let x = 1;\n for (let i = 0; i < this.size; i++) {\n this.expTable[i] = x;\n x = x * 2;\n if (x >= this.size) {\n x = (x ^ this.primitive) & (this.size - 1); // tslint:disable-line:no-bitwise\n }\n }\n\n for (let i = 0; i < this.size - 1; i++) {\n this.logTable[this.expTable[i]] = i;\n }\n this.zero = new GenericGFPoly(this, Uint8ClampedArray.from([0]));\n this.one = new GenericGFPoly(this, Uint8ClampedArray.from([1]));\n }\n\n public multiply(a: number, b: number) {\n if (a === 0 || b === 0) {\n return 0;\n }\n return this.expTable[(this.logTable[a] + this.logTable[b]) % (this.size - 1)];\n }\n\n public inverse(a: number) {\n if (a === 0) {\n throw new Error(\"Can't invert 0\");\n }\n return this.expTable[this.size - this.logTable[a] - 1];\n }\n\n public buildMonomial(degree: number, coefficient: number): GenericGFPoly {\n if (degree < 0) {\n throw new Error(\"Invalid monomial degree less than 0\");\n }\n if (coefficient === 0) {\n return this.zero;\n }\n const coefficients = new Uint8ClampedArray(degree + 1);\n coefficients[0] = coefficient;\n return new GenericGFPoly(this, coefficients);\n }\n\n public log(a: number) {\n if (a === 0) {\n throw new Error(\"Can't take log(0)\");\n }\n return this.logTable[a];\n }\n\n public exp(a: number) {\n return this.expTable[a];\n }\n}\n", "import GenericGF, { addOrSubtractGF } from \"./GenericGF\";\nimport GenericGFPoly from \"./GenericGFPoly\";\n\nfunction runEuclideanAlgorithm(field: GenericGF, a: GenericGFPoly, b: GenericGFPoly, R: number): GenericGFPoly[] {\n // Assume a's degree is >= b's\n if (a.degree() < b.degree()) {\n [a, b] = [b, a];\n }\n\n let rLast = a;\n let r = b;\n let tLast = field.zero;\n let t = field.one;\n\n // Run Euclidean algorithm until r's degree is less than R/2\n while (r.degree() >= R / 2) {\n const rLastLast = rLast;\n const tLastLast = tLast;\n rLast = r;\n tLast = t;\n\n // Divide rLastLast by rLast, with quotient in q and remainder in r\n if (rLast.isZero()) {\n // Euclidean algorithm already terminated?\n return null;\n }\n r = rLastLast;\n let q = field.zero;\n const denominatorLeadingTerm = rLast.getCoefficient(rLast.degree());\n const dltInverse = field.inverse(denominatorLeadingTerm);\n while (r.degree() >= rLast.degree() && !r.isZero()) {\n const degreeDiff = r.degree() - rLast.degree();\n const scale = field.multiply(r.getCoefficient(r.degree()), dltInverse);\n q = q.addOrSubtract(field.buildMonomial(degreeDiff, scale));\n r = r.addOrSubtract(rLast.multiplyByMonomial(degreeDiff, scale));\n }\n\n t = q.multiplyPoly(tLast).addOrSubtract(tLastLast);\n\n if (r.degree() >= rLast.degree()) {\n return null;\n }\n }\n\n const sigmaTildeAtZero = t.getCoefficient(0);\n if (sigmaTildeAtZero === 0) {\n return null;\n }\n\n const inverse = field.inverse(sigmaTildeAtZero);\n return [t.multiply(inverse), r.multiply(inverse)];\n}\n\nfunction findErrorLocations(field: GenericGF, errorLocator: GenericGFPoly): number[] {\n // This is a direct application of Chien's search\n const numErrors = errorLocator.degree();\n if (numErrors === 1) {\n return [errorLocator.getCoefficient(1)];\n }\n const result: number[] = new Array(numErrors);\n let errorCount = 0;\n for (let i = 1; i < field.size && errorCount < numErrors; i++) {\n if (errorLocator.evaluateAt(i) === 0) {\n result[errorCount] = field.inverse(i);\n errorCount++;\n }\n }\n if (errorCount !== numErrors) {\n return null;\n }\n return result;\n}\n\nfunction findErrorMagnitudes(field: GenericGF, errorEvaluator: GenericGFPoly, errorLocations: number[]): number[] {\n // This is directly applying Forney's Formula\n const s = errorLocations.length;\n const result: number[] = new Array(s);\n for (let i = 0; i < s; i++) {\n const xiInverse = field.inverse(errorLocations[i]);\n let denominator = 1;\n for (let j = 0; j < s; j++) {\n if (i !== j) {\n denominator = field.multiply(denominator, addOrSubtractGF(1, field.multiply(errorLocations[j], xiInverse)));\n }\n }\n result[i] = field.multiply(errorEvaluator.evaluateAt(xiInverse), field.inverse(denominator));\n if (field.generatorBase !== 0) {\n result[i] = field.multiply(result[i], xiInverse);\n }\n }\n return result;\n}\n\nexport function decode(bytes: number[], twoS: number) {\n const outputBytes = new Uint8ClampedArray(bytes.length);\n outputBytes.set(bytes);\n\n const field = new GenericGF(0x011D, 256, 0); // x^8 + x^4 + x^3 + x^2 + 1\n const poly = new GenericGFPoly(field, outputBytes);\n\n const syndromeCoefficients = new Uint8ClampedArray(twoS);\n let error = false;\n for (let s = 0; s < twoS; s++) {\n const evaluation = poly.evaluateAt(field.exp(s + field.generatorBase));\n syndromeCoefficients[syndromeCoefficients.length - 1 - s] = evaluation;\n if (evaluation !== 0) {\n error = true;\n }\n }\n if (!error) {\n return outputBytes;\n }\n\n const syndrome = new GenericGFPoly(field, syndromeCoefficients);\n\n const sigmaOmega = runEuclideanAlgorithm(field, field.buildMonomial(twoS, 1), syndrome, twoS);\n if (sigmaOmega === null) {\n return null;\n }\n\n const errorLocations = findErrorLocations(field, sigmaOmega[0]);\n if (errorLocations == null) {\n return null;\n }\n\n const errorMagnitudes = findErrorMagnitudes(field, sigmaOmega[1], errorLocations);\n for (let i = 0; i < errorLocations.length; i++) {\n const position = outputBytes.length - 1 - field.log(errorLocations[i]);\n if (position < 0) {\n return null;\n }\n outputBytes[position] = addOrSubtractGF(outputBytes[position], errorMagnitudes[i]);\n }\n\n return outputBytes;\n}\n", "export interface Version {\n infoBits: number;\n versionNumber: number;\n alignmentPatternCenters: number[];\n errorCorrectionLevels: Array<{\n ecCodewordsPerBlock: number;\n ecBlocks: Array<{\n numBlocks: number;\n dataCodewordsPerBlock: number;\n }>\n }>;\n}\n\nexport const VERSIONS: Version[] = [\n {\n infoBits: null,\n versionNumber: 1,\n alignmentPatternCenters: [],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 7,\n ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 19 }],\n },\n {\n ecCodewordsPerBlock: 10,\n ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 16 }],\n },\n {\n ecCodewordsPerBlock: 13,\n ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 13 }],\n },\n {\n ecCodewordsPerBlock: 17,\n ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 9 }],\n },\n ],\n },\n {\n infoBits: null,\n versionNumber: 2,\n alignmentPatternCenters: [6, 18],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 10,\n ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 34 }],\n },\n {\n ecCodewordsPerBlock: 16,\n ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 28 }],\n },\n {\n ecCodewordsPerBlock: 22,\n ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 22 }],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 16 }],\n },\n ],\n },\n {\n infoBits: null,\n versionNumber: 3,\n alignmentPatternCenters: [6, 22],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 15,\n ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 55 }],\n },\n {\n ecCodewordsPerBlock: 26,\n ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 44 }],\n },\n {\n ecCodewordsPerBlock: 18,\n ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 17 }],\n },\n {\n ecCodewordsPerBlock: 22,\n ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 13 }],\n },\n ],\n },\n {\n infoBits: null,\n versionNumber: 4,\n alignmentPatternCenters: [6, 26],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 20,\n ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 80 }],\n },\n {\n ecCodewordsPerBlock: 18,\n ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 32 }],\n },\n {\n ecCodewordsPerBlock: 26,\n ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 24 }],\n },\n {\n ecCodewordsPerBlock: 16,\n ecBlocks: [{ numBlocks: 4, dataCodewordsPerBlock: 9 }],\n },\n ],\n },\n {\n infoBits: null,\n versionNumber: 5,\n alignmentPatternCenters: [6, 30],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 26,\n ecBlocks: [{ numBlocks: 1, dataCodewordsPerBlock: 108 }],\n },\n {\n ecCodewordsPerBlock: 24,\n ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 43 }],\n },\n {\n ecCodewordsPerBlock: 18,\n ecBlocks: [\n { numBlocks: 2, dataCodewordsPerBlock: 15 },\n { numBlocks: 2, dataCodewordsPerBlock: 16 },\n ],\n },\n {\n ecCodewordsPerBlock: 22,\n ecBlocks: [\n { numBlocks: 2, dataCodewordsPerBlock: 11 },\n { numBlocks: 2, dataCodewordsPerBlock: 12 },\n ],\n },\n ],\n },\n {\n infoBits: null,\n versionNumber: 6,\n alignmentPatternCenters: [6, 34],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 18,\n ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 68 }],\n },\n {\n ecCodewordsPerBlock: 16,\n ecBlocks: [{ numBlocks: 4, dataCodewordsPerBlock: 27 }],\n },\n {\n ecCodewordsPerBlock: 24,\n ecBlocks: [{ numBlocks: 4, dataCodewordsPerBlock: 19 }],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [{ numBlocks: 4, dataCodewordsPerBlock: 15 }],\n },\n ],\n },\n {\n infoBits: 0x07C94,\n versionNumber: 7,\n alignmentPatternCenters: [6, 22, 38],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 20,\n ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 78 }],\n },\n {\n ecCodewordsPerBlock: 18,\n ecBlocks: [{ numBlocks: 4, dataCodewordsPerBlock: 31 }],\n },\n {\n ecCodewordsPerBlock: 18,\n ecBlocks: [\n { numBlocks: 2, dataCodewordsPerBlock: 14 },\n { numBlocks: 4, dataCodewordsPerBlock: 15 },\n ],\n },\n {\n ecCodewordsPerBlock: 26,\n ecBlocks: [\n { numBlocks: 4, dataCodewordsPerBlock: 13 },\n { numBlocks: 1, dataCodewordsPerBlock: 14 },\n ],\n },\n ],\n },\n {\n infoBits: 0x085BC,\n versionNumber: 8,\n alignmentPatternCenters: [6, 24, 42],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 24,\n ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 97 }],\n },\n {\n ecCodewordsPerBlock: 22,\n ecBlocks: [\n { numBlocks: 2, dataCodewordsPerBlock: 38 },\n { numBlocks: 2, dataCodewordsPerBlock: 39 },\n ],\n },\n {\n ecCodewordsPerBlock: 22,\n ecBlocks: [\n { numBlocks: 4, dataCodewordsPerBlock: 18 },\n { numBlocks: 2, dataCodewordsPerBlock: 19 },\n ],\n },\n {\n ecCodewordsPerBlock: 26,\n ecBlocks: [\n { numBlocks: 4, dataCodewordsPerBlock: 14 },\n { numBlocks: 2, dataCodewordsPerBlock: 15 },\n ],\n },\n ],\n },\n {\n infoBits: 0x09A99,\n versionNumber: 9,\n alignmentPatternCenters: [6, 26, 46],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [{ numBlocks: 2, dataCodewordsPerBlock: 116 }],\n },\n {\n ecCodewordsPerBlock: 22,\n ecBlocks: [\n { numBlocks: 3, dataCodewordsPerBlock: 36 },\n { numBlocks: 2, dataCodewordsPerBlock: 37 },\n ],\n },\n {\n ecCodewordsPerBlock: 20,\n ecBlocks: [\n { numBlocks: 4, dataCodewordsPerBlock: 16 },\n { numBlocks: 4, dataCodewordsPerBlock: 17 },\n ],\n },\n {\n ecCodewordsPerBlock: 24,\n ecBlocks: [\n { numBlocks: 4, dataCodewordsPerBlock: 12 },\n { numBlocks: 4, dataCodewordsPerBlock: 13 },\n ],\n },\n ],\n },\n {\n infoBits: 0x0A4D3,\n versionNumber: 10,\n alignmentPatternCenters: [6, 28, 50],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 18,\n ecBlocks: [\n { numBlocks: 2, dataCodewordsPerBlock: 68 },\n { numBlocks: 2, dataCodewordsPerBlock: 69 },\n ],\n },\n {\n ecCodewordsPerBlock: 26,\n ecBlocks: [\n { numBlocks: 4, dataCodewordsPerBlock: 43 },\n { numBlocks: 1, dataCodewordsPerBlock: 44 },\n ],\n },\n {\n ecCodewordsPerBlock: 24,\n ecBlocks: [\n { numBlocks: 6, dataCodewordsPerBlock: 19 },\n { numBlocks: 2, dataCodewordsPerBlock: 20 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 6, dataCodewordsPerBlock: 15 },\n { numBlocks: 2, dataCodewordsPerBlock: 16 },\n ],\n },\n ],\n },\n {\n infoBits: 0x0BBF6,\n versionNumber: 11,\n alignmentPatternCenters: [6, 30, 54],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 20,\n ecBlocks: [{ numBlocks: 4, dataCodewordsPerBlock: 81 }],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 1, dataCodewordsPerBlock: 50 },\n { numBlocks: 4, dataCodewordsPerBlock: 51 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 4, dataCodewordsPerBlock: 22 },\n { numBlocks: 4, dataCodewordsPerBlock: 23 },\n ],\n },\n {\n ecCodewordsPerBlock: 24,\n ecBlocks: [\n { numBlocks: 3, dataCodewordsPerBlock: 12 },\n { numBlocks: 8, dataCodewordsPerBlock: 13 },\n ],\n },\n ],\n },\n {\n infoBits: 0x0C762,\n versionNumber: 12,\n alignmentPatternCenters: [6, 32, 58],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 24,\n ecBlocks: [\n { numBlocks: 2, dataCodewordsPerBlock: 92 },\n { numBlocks: 2, dataCodewordsPerBlock: 93 },\n ],\n },\n {\n ecCodewordsPerBlock: 22,\n ecBlocks: [\n { numBlocks: 6, dataCodewordsPerBlock: 36 },\n { numBlocks: 2, dataCodewordsPerBlock: 37 },\n ],\n },\n {\n ecCodewordsPerBlock: 26,\n ecBlocks: [\n { numBlocks: 4, dataCodewordsPerBlock: 20 },\n { numBlocks: 6, dataCodewordsPerBlock: 21 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 7, dataCodewordsPerBlock: 14 },\n { numBlocks: 4, dataCodewordsPerBlock: 15 },\n ],\n },\n ],\n },\n {\n infoBits: 0x0D847,\n versionNumber: 13,\n alignmentPatternCenters: [6, 34, 62],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 26,\n ecBlocks: [{ numBlocks: 4, dataCodewordsPerBlock: 107 }],\n },\n {\n ecCodewordsPerBlock: 22,\n ecBlocks: [\n { numBlocks: 8, dataCodewordsPerBlock: 37 },\n { numBlocks: 1, dataCodewordsPerBlock: 38 },\n ],\n },\n {\n ecCodewordsPerBlock: 24,\n ecBlocks: [\n { numBlocks: 8, dataCodewordsPerBlock: 20 },\n { numBlocks: 4, dataCodewordsPerBlock: 21 },\n ],\n },\n {\n ecCodewordsPerBlock: 22,\n ecBlocks: [\n { numBlocks: 12, dataCodewordsPerBlock: 11 },\n { numBlocks: 4, dataCodewordsPerBlock: 12 },\n ],\n },\n ],\n },\n {\n infoBits: 0x0E60D,\n versionNumber: 14,\n alignmentPatternCenters: [6, 26, 46, 66],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 3, dataCodewordsPerBlock: 115 },\n { numBlocks: 1, dataCodewordsPerBlock: 116 },\n ],\n },\n {\n ecCodewordsPerBlock: 24,\n ecBlocks: [\n { numBlocks: 4, dataCodewordsPerBlock: 40 },\n { numBlocks: 5, dataCodewordsPerBlock: 41 },\n ],\n },\n {\n ecCodewordsPerBlock: 20,\n ecBlocks: [\n { numBlocks: 11, dataCodewordsPerBlock: 16 },\n { numBlocks: 5, dataCodewordsPerBlock: 17 },\n ],\n },\n {\n ecCodewordsPerBlock: 24,\n ecBlocks: [\n { numBlocks: 11, dataCodewordsPerBlock: 12 },\n { numBlocks: 5, dataCodewordsPerBlock: 13 },\n ],\n },\n ],\n },\n {\n infoBits: 0x0F928,\n versionNumber: 15,\n alignmentPatternCenters: [6, 26, 48, 70],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 22,\n ecBlocks: [\n { numBlocks: 5, dataCodewordsPerBlock: 87 },\n { numBlocks: 1, dataCodewordsPerBlock: 88 },\n ],\n },\n {\n ecCodewordsPerBlock: 24,\n ecBlocks: [\n { numBlocks: 5, dataCodewordsPerBlock: 41 },\n { numBlocks: 5, dataCodewordsPerBlock: 42 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 5, dataCodewordsPerBlock: 24 },\n { numBlocks: 7, dataCodewordsPerBlock: 25 },\n ],\n },\n {\n ecCodewordsPerBlock: 24,\n ecBlocks: [\n { numBlocks: 11, dataCodewordsPerBlock: 12 },\n { numBlocks: 7, dataCodewordsPerBlock: 13 },\n ],\n },\n ],\n },\n {\n infoBits: 0x10B78,\n versionNumber: 16,\n alignmentPatternCenters: [6, 26, 50, 74],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 24,\n ecBlocks: [\n { numBlocks: 5, dataCodewordsPerBlock: 98 },\n { numBlocks: 1, dataCodewordsPerBlock: 99 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 7, dataCodewordsPerBlock: 45 },\n { numBlocks: 3, dataCodewordsPerBlock: 46 },\n ],\n },\n {\n ecCodewordsPerBlock: 24,\n ecBlocks: [\n { numBlocks: 15, dataCodewordsPerBlock: 19 },\n { numBlocks: 2, dataCodewordsPerBlock: 20 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 3, dataCodewordsPerBlock: 15 },\n { numBlocks: 13, dataCodewordsPerBlock: 16 },\n ],\n },\n ],\n },\n {\n infoBits: 0x1145D,\n versionNumber: 17,\n alignmentPatternCenters: [6, 30, 54, 78],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 1, dataCodewordsPerBlock: 107 },\n { numBlocks: 5, dataCodewordsPerBlock: 108 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 10, dataCodewordsPerBlock: 46 },\n { numBlocks: 1, dataCodewordsPerBlock: 47 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 1, dataCodewordsPerBlock: 22 },\n { numBlocks: 15, dataCodewordsPerBlock: 23 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 2, dataCodewordsPerBlock: 14 },\n { numBlocks: 17, dataCodewordsPerBlock: 15 },\n ],\n },\n ],\n },\n {\n infoBits: 0x12A17,\n versionNumber: 18,\n alignmentPatternCenters: [6, 30, 56, 82],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 5, dataCodewordsPerBlock: 120 },\n { numBlocks: 1, dataCodewordsPerBlock: 121 },\n ],\n },\n {\n ecCodewordsPerBlock: 26,\n ecBlocks: [\n { numBlocks: 9, dataCodewordsPerBlock: 43 },\n { numBlocks: 4, dataCodewordsPerBlock: 44 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 17, dataCodewordsPerBlock: 22 },\n { numBlocks: 1, dataCodewordsPerBlock: 23 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 2, dataCodewordsPerBlock: 14 },\n { numBlocks: 19, dataCodewordsPerBlock: 15 },\n ],\n },\n ],\n },\n {\n infoBits: 0x13532,\n versionNumber: 19,\n alignmentPatternCenters: [6, 30, 58, 86],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 3, dataCodewordsPerBlock: 113 },\n { numBlocks: 4, dataCodewordsPerBlock: 114 },\n ],\n },\n {\n ecCodewordsPerBlock: 26,\n ecBlocks: [\n { numBlocks: 3, dataCodewordsPerBlock: 44 },\n { numBlocks: 11, dataCodewordsPerBlock: 45 },\n ],\n },\n {\n ecCodewordsPerBlock: 26,\n ecBlocks: [\n { numBlocks: 17, dataCodewordsPerBlock: 21 },\n { numBlocks: 4, dataCodewordsPerBlock: 22 },\n ],\n },\n {\n ecCodewordsPerBlock: 26,\n ecBlocks: [\n { numBlocks: 9, dataCodewordsPerBlock: 13 },\n { numBlocks: 16, dataCodewordsPerBlock: 14 },\n ],\n },\n ],\n },\n {\n infoBits: 0x149A6,\n versionNumber: 20,\n alignmentPatternCenters: [6, 34, 62, 90],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 3, dataCodewordsPerBlock: 107 },\n { numBlocks: 5, dataCodewordsPerBlock: 108 },\n ],\n },\n {\n ecCodewordsPerBlock: 26,\n ecBlocks: [\n { numBlocks: 3, dataCodewordsPerBlock: 41 },\n { numBlocks: 13, dataCodewordsPerBlock: 42 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 15, dataCodewordsPerBlock: 24 },\n { numBlocks: 5, dataCodewordsPerBlock: 25 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 15, dataCodewordsPerBlock: 15 },\n { numBlocks: 10, dataCodewordsPerBlock: 16 },\n ],\n },\n ],\n },\n {\n infoBits: 0x15683,\n versionNumber: 21,\n alignmentPatternCenters: [6, 28, 50, 72, 94],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 4, dataCodewordsPerBlock: 116 },\n { numBlocks: 4, dataCodewordsPerBlock: 117 },\n ],\n },\n {\n ecCodewordsPerBlock: 26,\n ecBlocks: [{ numBlocks: 17, dataCodewordsPerBlock: 42 }],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 17, dataCodewordsPerBlock: 22 },\n { numBlocks: 6, dataCodewordsPerBlock: 23 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 19, dataCodewordsPerBlock: 16 },\n { numBlocks: 6, dataCodewordsPerBlock: 17 },\n ],\n },\n ],\n },\n {\n infoBits: 0x168C9,\n versionNumber: 22,\n alignmentPatternCenters: [6, 26, 50, 74, 98],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 2, dataCodewordsPerBlock: 111 },\n { numBlocks: 7, dataCodewordsPerBlock: 112 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [{ numBlocks: 17, dataCodewordsPerBlock: 46 }],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 7, dataCodewordsPerBlock: 24 },\n { numBlocks: 16, dataCodewordsPerBlock: 25 },\n ],\n },\n {\n ecCodewordsPerBlock: 24,\n ecBlocks: [{ numBlocks: 34, dataCodewordsPerBlock: 13 }],\n },\n ],\n },\n {\n infoBits: 0x177EC,\n versionNumber: 23,\n alignmentPatternCenters: [6, 30, 54, 74, 102],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 4, dataCodewordsPerBlock: 121 },\n { numBlocks: 5, dataCodewordsPerBlock: 122 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 4, dataCodewordsPerBlock: 47 },\n { numBlocks: 14, dataCodewordsPerBlock: 48 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 11, dataCodewordsPerBlock: 24 },\n { numBlocks: 14, dataCodewordsPerBlock: 25 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 16, dataCodewordsPerBlock: 15 },\n { numBlocks: 14, dataCodewordsPerBlock: 16 },\n ],\n },\n ],\n },\n {\n infoBits: 0x18EC4,\n versionNumber: 24,\n alignmentPatternCenters: [6, 28, 54, 80, 106],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 6, dataCodewordsPerBlock: 117 },\n { numBlocks: 4, dataCodewordsPerBlock: 118 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 6, dataCodewordsPerBlock: 45 },\n { numBlocks: 14, dataCodewordsPerBlock: 46 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 11, dataCodewordsPerBlock: 24 },\n { numBlocks: 16, dataCodewordsPerBlock: 25 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 30, dataCodewordsPerBlock: 16 },\n { numBlocks: 2, dataCodewordsPerBlock: 17 },\n ],\n },\n ],\n },\n {\n infoBits: 0x191E1,\n versionNumber: 25,\n alignmentPatternCenters: [6, 32, 58, 84, 110],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 26,\n ecBlocks: [\n { numBlocks: 8, dataCodewordsPerBlock: 106 },\n { numBlocks: 4, dataCodewordsPerBlock: 107 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 8, dataCodewordsPerBlock: 47 },\n { numBlocks: 13, dataCodewordsPerBlock: 48 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 7, dataCodewordsPerBlock: 24 },\n { numBlocks: 22, dataCodewordsPerBlock: 25 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 22, dataCodewordsPerBlock: 15 },\n { numBlocks: 13, dataCodewordsPerBlock: 16 },\n ],\n },\n ],\n },\n {\n infoBits: 0x1AFAB,\n versionNumber: 26,\n alignmentPatternCenters: [6, 30, 58, 86, 114],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 10, dataCodewordsPerBlock: 114 },\n { numBlocks: 2, dataCodewordsPerBlock: 115 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 19, dataCodewordsPerBlock: 46 },\n { numBlocks: 4, dataCodewordsPerBlock: 47 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 28, dataCodewordsPerBlock: 22 },\n { numBlocks: 6, dataCodewordsPerBlock: 23 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 33, dataCodewordsPerBlock: 16 },\n { numBlocks: 4, dataCodewordsPerBlock: 17 },\n ],\n },\n ],\n },\n {\n infoBits: 0x1B08E,\n versionNumber: 27,\n alignmentPatternCenters: [6, 34, 62, 90, 118],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 8, dataCodewordsPerBlock: 122 },\n { numBlocks: 4, dataCodewordsPerBlock: 123 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 22, dataCodewordsPerBlock: 45 },\n { numBlocks: 3, dataCodewordsPerBlock: 46 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 8, dataCodewordsPerBlock: 23 },\n { numBlocks: 26, dataCodewordsPerBlock: 24 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 12, dataCodewordsPerBlock: 15 },\n { numBlocks: 28, dataCodewordsPerBlock: 16 },\n ],\n },\n ],\n },\n {\n infoBits: 0x1CC1A,\n versionNumber: 28,\n alignmentPatternCenters: [6, 26, 50, 74, 98, 122],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 3, dataCodewordsPerBlock: 117 },\n { numBlocks: 10, dataCodewordsPerBlock: 118 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 3, dataCodewordsPerBlock: 45 },\n { numBlocks: 23, dataCodewordsPerBlock: 46 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 4, dataCodewordsPerBlock: 24 },\n { numBlocks: 31, dataCodewordsPerBlock: 25 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 11, dataCodewordsPerBlock: 15 },\n { numBlocks: 31, dataCodewordsPerBlock: 16 },\n ],\n },\n ],\n },\n {\n infoBits: 0x1D33F,\n versionNumber: 29,\n alignmentPatternCenters: [6, 30, 54, 78, 102, 126],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 7, dataCodewordsPerBlock: 116 },\n { numBlocks: 7, dataCodewordsPerBlock: 117 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 21, dataCodewordsPerBlock: 45 },\n { numBlocks: 7, dataCodewordsPerBlock: 46 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 1, dataCodewordsPerBlock: 23 },\n { numBlocks: 37, dataCodewordsPerBlock: 24 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 19, dataCodewordsPerBlock: 15 },\n { numBlocks: 26, dataCodewordsPerBlock: 16 },\n ],\n },\n ],\n },\n {\n infoBits: 0x1ED75,\n versionNumber: 30,\n alignmentPatternCenters: [6, 26, 52, 78, 104, 130],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 5, dataCodewordsPerBlock: 115 },\n { numBlocks: 10, dataCodewordsPerBlock: 116 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 19, dataCodewordsPerBlock: 47 },\n { numBlocks: 10, dataCodewordsPerBlock: 48 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 15, dataCodewordsPerBlock: 24 },\n { numBlocks: 25, dataCodewordsPerBlock: 25 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 23, dataCodewordsPerBlock: 15 },\n { numBlocks: 25, dataCodewordsPerBlock: 16 },\n ],\n },\n ],\n },\n {\n infoBits: 0x1F250,\n versionNumber: 31,\n alignmentPatternCenters: [6, 30, 56, 82, 108, 134],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 13, dataCodewordsPerBlock: 115 },\n { numBlocks: 3, dataCodewordsPerBlock: 116 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 2, dataCodewordsPerBlock: 46 },\n { numBlocks: 29, dataCodewordsPerBlock: 47 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 42, dataCodewordsPerBlock: 24 },\n { numBlocks: 1, dataCodewordsPerBlock: 25 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 23, dataCodewordsPerBlock: 15 },\n { numBlocks: 28, dataCodewordsPerBlock: 16 },\n ],\n },\n ],\n },\n {\n infoBits: 0x209D5,\n versionNumber: 32,\n alignmentPatternCenters: [6, 34, 60, 86, 112, 138],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [{ numBlocks: 17, dataCodewordsPerBlock: 115 }],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 10, dataCodewordsPerBlock: 46 },\n { numBlocks: 23, dataCodewordsPerBlock: 47 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 10, dataCodewordsPerBlock: 24 },\n { numBlocks: 35, dataCodewordsPerBlock: 25 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 19, dataCodewordsPerBlock: 15 },\n { numBlocks: 35, dataCodewordsPerBlock: 16 },\n ],\n },\n ],\n },\n {\n infoBits: 0x216F0,\n versionNumber: 33,\n alignmentPatternCenters: [6, 30, 58, 86, 114, 142],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 17, dataCodewordsPerBlock: 115 },\n { numBlocks: 1, dataCodewordsPerBlock: 116 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 14, dataCodewordsPerBlock: 46 },\n { numBlocks: 21, dataCodewordsPerBlock: 47 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 29, dataCodewordsPerBlock: 24 },\n { numBlocks: 19, dataCodewordsPerBlock: 25 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 11, dataCodewordsPerBlock: 15 },\n { numBlocks: 46, dataCodewordsPerBlock: 16 },\n ],\n },\n ],\n },\n {\n infoBits: 0x228BA,\n versionNumber: 34,\n alignmentPatternCenters: [6, 34, 62, 90, 118, 146],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 13, dataCodewordsPerBlock: 115 },\n { numBlocks: 6, dataCodewordsPerBlock: 116 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 14, dataCodewordsPerBlock: 46 },\n { numBlocks: 23, dataCodewordsPerBlock: 47 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 44, dataCodewordsPerBlock: 24 },\n { numBlocks: 7, dataCodewordsPerBlock: 25 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 59, dataCodewordsPerBlock: 16 },\n { numBlocks: 1, dataCodewordsPerBlock: 17 },\n ],\n },\n ],\n },\n {\n infoBits: 0x2379F,\n versionNumber: 35,\n alignmentPatternCenters: [6, 30, 54, 78, 102, 126, 150],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 12, dataCodewordsPerBlock: 121 },\n { numBlocks: 7, dataCodewordsPerBlock: 122 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 12, dataCodewordsPerBlock: 47 },\n { numBlocks: 26, dataCodewordsPerBlock: 48 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 39, dataCodewordsPerBlock: 24 },\n { numBlocks: 14, dataCodewordsPerBlock: 25 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 22, dataCodewordsPerBlock: 15 },\n { numBlocks: 41, dataCodewordsPerBlock: 16 },\n ],\n },\n ],\n },\n {\n infoBits: 0x24B0B,\n versionNumber: 36,\n alignmentPatternCenters: [ 6, 24, 50, 76, 102, 128, 154 ],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 6, dataCodewordsPerBlock: 121 },\n { numBlocks: 14, dataCodewordsPerBlock: 122 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 6, dataCodewordsPerBlock: 47 },\n { numBlocks: 34, dataCodewordsPerBlock: 48 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 46, dataCodewordsPerBlock: 24 },\n { numBlocks: 10, dataCodewordsPerBlock: 25 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 2, dataCodewordsPerBlock: 15 },\n { numBlocks: 64, dataCodewordsPerBlock: 16 },\n ],\n },\n ],\n },\n {\n infoBits: 0x2542E,\n versionNumber: 37,\n alignmentPatternCenters: [ 6, 28, 54, 80, 106, 132, 158 ],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 17, dataCodewordsPerBlock: 122 },\n { numBlocks: 4, dataCodewordsPerBlock: 123 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 29, dataCodewordsPerBlock: 46 },\n { numBlocks: 14, dataCodewordsPerBlock: 47 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 49, dataCodewordsPerBlock: 24 },\n { numBlocks: 10, dataCodewordsPerBlock: 25 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 24, dataCodewordsPerBlock: 15 },\n { numBlocks: 46, dataCodewordsPerBlock: 16 },\n ],\n },\n ],\n },\n {\n infoBits: 0x26A64,\n versionNumber: 38,\n alignmentPatternCenters: [ 6, 32, 58, 84, 110, 136, 162 ],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 4, dataCodewordsPerBlock: 122 },\n { numBlocks: 18, dataCodewordsPerBlock: 123 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 13, dataCodewordsPerBlock: 46 },\n { numBlocks: 32, dataCodewordsPerBlock: 47 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 48, dataCodewordsPerBlock: 24 },\n { numBlocks: 14, dataCodewordsPerBlock: 25 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 42, dataCodewordsPerBlock: 15 },\n { numBlocks: 32, dataCodewordsPerBlock: 16 },\n ],\n },\n ],\n },\n {\n infoBits: 0x27541,\n versionNumber: 39,\n alignmentPatternCenters: [ 6, 26, 54, 82, 110, 138, 166 ],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 20, dataCodewordsPerBlock: 117 },\n { numBlocks: 4, dataCodewordsPerBlock: 118 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 40, dataCodewordsPerBlock: 47 },\n { numBlocks: 7, dataCodewordsPerBlock: 48 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 43, dataCodewordsPerBlock: 24 },\n { numBlocks: 22, dataCodewordsPerBlock: 25 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 10, dataCodewordsPerBlock: 15 },\n { numBlocks: 67, dataCodewordsPerBlock: 16 },\n ],\n },\n ],\n },\n {\n infoBits: 0x28C69,\n versionNumber: 40,\n alignmentPatternCenters: [ 6, 30, 58, 86, 114, 142, 170 ],\n errorCorrectionLevels: [\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 19, dataCodewordsPerBlock: 118 },\n { numBlocks: 6, dataCodewordsPerBlock: 119 },\n ],\n },\n {\n ecCodewordsPerBlock: 28,\n ecBlocks: [\n { numBlocks: 18, dataCodewordsPerBlock: 47 },\n { numBlocks: 31, dataCodewordsPerBlock: 48 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 34, dataCodewordsPerBlock: 24 },\n { numBlocks: 34, dataCodewordsPerBlock: 25 },\n ],\n },\n {\n ecCodewordsPerBlock: 30,\n ecBlocks: [\n { numBlocks: 20, dataCodewordsPerBlock: 15 },\n { numBlocks: 61, dataCodewordsPerBlock: 16 },\n ],\n },\n ],\n },\n];\n", "import { BitMatrix } from \"../BitMatrix\";\nimport { Point } from \"../Point\";\nimport { decode as decodeData, DecodedQR } from \"./decodeData\";\nimport { decode as rsDecode } from \"./reedsolomon\";\nimport { Version, VERSIONS } from \"./version\";\n\n// tslint:disable:no-bitwise\nfunction numBitsDiffering(x: number, y: number) {\n let z = x ^ y;\n let bitCount = 0;\n while (z) {\n bitCount++;\n z &= z - 1;\n }\n return bitCount;\n}\n\nfunction pushBit(bit: any, byte: number) {\n return (byte << 1) | bit;\n}\n// tslint:enable:no-bitwise\n\nconst FORMAT_INFO_TABLE = [\n { bits: 0x5412, formatInfo: { errorCorrectionLevel: 1, dataMask: 0 } },\n { bits: 0x5125, formatInfo: { errorCorrectionLevel: 1, dataMask: 1 } },\n { bits: 0x5E7C, formatInfo: { errorCorrectionLevel: 1, dataMask: 2 } },\n { bits: 0x5B4B, formatInfo: { errorCorrectionLevel: 1, dataMask: 3 } },\n { bits: 0x45F9, formatInfo: { errorCorrectionLevel: 1, dataMask: 4 } },\n { bits: 0x40CE, formatInfo: { errorCorrectionLevel: 1, dataMask: 5 } },\n { bits: 0x4F97, formatInfo: { errorCorrectionLevel: 1, dataMask: 6 } },\n { bits: 0x4AA0, formatInfo: { errorCorrectionLevel: 1, dataMask: 7 } },\n { bits: 0x77C4, formatInfo: { errorCorrectionLevel: 0, dataMask: 0 } },\n { bits: 0x72F3, formatInfo: { errorCorrectionLevel: 0, dataMask: 1 } },\n { bits: 0x7DAA, formatInfo: { errorCorrectionLevel: 0, dataMask: 2 } },\n { bits: 0x789D, formatInfo: { errorCorrectionLevel: 0, dataMask: 3 } },\n { bits: 0x662F, formatInfo: { errorCorrectionLevel: 0, dataMask: 4 } },\n { bits: 0x6318, formatInfo: { errorCorrectionLevel: 0, dataMask: 5 } },\n { bits: 0x6C41, formatInfo: { errorCorrectionLevel: 0, dataMask: 6 } },\n { bits: 0x6976, formatInfo: { errorCorrectionLevel: 0, dataMask: 7 } },\n { bits: 0x1689, formatInfo: { errorCorrectionLevel: 3, dataMask: 0 } },\n { bits: 0x13BE, formatInfo: { errorCorrectionLevel: 3, dataMask: 1 } },\n { bits: 0x1CE7, formatInfo: { errorCorrectionLevel: 3, dataMask: 2 } },\n { bits: 0x19D0, formatInfo: { errorCorrectionLevel: 3, dataMask: 3 } },\n { bits: 0x0762, formatInfo: { errorCorrectionLevel: 3, dataMask: 4 } },\n { bits: 0x0255, formatInfo: { errorCorrectionLevel: 3, dataMask: 5 } },\n { bits: 0x0D0C, formatInfo: { errorCorrectionLevel: 3, dataMask: 6 } },\n { bits: 0x083B, formatInfo: { errorCorrectionLevel: 3, dataMask: 7 } },\n { bits: 0x355F, formatInfo: { errorCorrectionLevel: 2, dataMask: 0 } },\n { bits: 0x3068, formatInfo: { errorCorrectionLevel: 2, dataMask: 1 } },\n { bits: 0x3F31, formatInfo: { errorCorrectionLevel: 2, dataMask: 2 } },\n { bits: 0x3A06, formatInfo: { errorCorrectionLevel: 2, dataMask: 3 } },\n { bits: 0x24B4, formatInfo: { errorCorrectionLevel: 2, dataMask: 4 } },\n { bits: 0x2183, formatInfo: { errorCorrectionLevel: 2, dataMask: 5 } },\n { bits: 0x2EDA, formatInfo: { errorCorrectionLevel: 2, dataMask: 6 } },\n { bits: 0x2BED, formatInfo: { errorCorrectionLevel: 2, dataMask: 7 } },\n];\n\nconst DATA_MASKS = [\n (p: Point) => ((p.y + p.x) % 2) === 0,\n (p: Point) => (p.y % 2) === 0,\n (p: Point) => p.x % 3 === 0,\n (p: Point) => (p.y + p.x) % 3 === 0,\n (p: Point) => (Math.floor(p.y / 2) + Math.floor(p.x / 3)) % 2 === 0,\n (p: Point) => ((p.x * p.y) % 2) + ((p.x * p.y) % 3) === 0,\n (p: Point) => ((((p.y * p.x) % 2) + (p.y * p.x) % 3) % 2) === 0,\n (p: Point) => ((((p.y + p.x) % 2) + (p.y * p.x) % 3) % 2) === 0,\n];\n\ninterface FormatInformation {\n errorCorrectionLevel: number;\n dataMask: number;\n}\n\nfunction buildFunctionPatternMask(version: Version): BitMatrix {\n const dimension = 17 + 4 * version.versionNumber;\n const matrix = BitMatrix.createEmpty(dimension, dimension);\n\n matrix.setRegion(0, 0, 9, 9, true); // Top left finder pattern + separator + format\n matrix.setRegion(dimension - 8, 0, 8, 9, true); // Top right finder pattern + separator + format\n matrix.setRegion(0, dimension - 8, 9, 8, true); // Bottom left finder pattern + separator + format\n\n // Alignment patterns\n for (const x of version.alignmentPatternCenters) {\n for (const y of version.alignmentPatternCenters) {\n if (!(x === 6 && y === 6 || x === 6 && y === dimension - 7 || x === dimension - 7 && y === 6)) {\n matrix.setRegion(x - 2, y - 2, 5, 5, true);\n }\n }\n }\n\n matrix.setRegion(6, 9, 1, dimension - 17, true); // Vertical timing pattern\n matrix.setRegion(9, 6, dimension - 17, 1, true); // Horizontal timing pattern\n\n if (version.versionNumber > 6) {\n matrix.setRegion(dimension - 11, 0, 3, 6, true); // Version info, top right\n matrix.setRegion(0, dimension - 11, 6, 3, true); // Version info, bottom left\n }\n\n return matrix;\n}\n\nfunction readCodewords(matrix: BitMatrix, version: Version, formatInfo: FormatInformation) {\n const dataMask = DATA_MASKS[formatInfo.dataMask];\n const dimension = matrix.height;\n\n const functionPatternMask = buildFunctionPatternMask(version);\n\n const codewords: number[] = [];\n let currentByte = 0;\n let bitsRead = 0;\n\n // Read columns in pairs, from right to left\n let readingUp = true;\n for (let columnIndex = dimension - 1; columnIndex > 0; columnIndex -= 2) {\n if (columnIndex === 6) { // Skip whole column with vertical alignment pattern;\n columnIndex--;\n }\n for (let i = 0; i < dimension; i++) {\n const y = readingUp ? dimension - 1 - i : i;\n for (let columnOffset = 0; columnOffset < 2; columnOffset++) {\n const x = columnIndex - columnOffset;\n if (!functionPatternMask.get(x, y)) {\n bitsRead++;\n let bit = matrix.get(x, y);\n if (dataMask({y, x})) {\n bit = !bit;\n }\n currentByte = pushBit(bit, currentByte);\n if (bitsRead === 8) { // Whole bytes\n codewords.push(currentByte);\n bitsRead = 0;\n currentByte = 0;\n }\n }\n }\n }\n readingUp = !readingUp;\n }\n return codewords;\n}\n\nfunction readVersion(matrix: BitMatrix): Version {\n const dimension = matrix.height;\n\n const provisionalVersion = Math.floor((dimension - 17) / 4);\n if (provisionalVersion <= 6) { // 6 and under dont have version info in the QR code\n return VERSIONS[provisionalVersion - 1];\n }\n\n let topRightVersionBits = 0;\n for (let y = 5; y >= 0; y--) {\n for (let x = dimension - 9; x >= dimension - 11; x--) {\n topRightVersionBits = pushBit(matrix.get(x, y), topRightVersionBits);\n }\n }\n\n let bottomLeftVersionBits = 0;\n for (let x = 5; x >= 0; x--) {\n for (let y = dimension - 9; y >= dimension - 11; y--) {\n bottomLeftVersionBits = pushBit(matrix.get(x, y), bottomLeftVersionBits);\n }\n }\n\n let bestDifference = Infinity;\n let bestVersion: Version;\n for (const version of VERSIONS) {\n if (version.infoBits === topRightVersionBits || version.infoBits === bottomLeftVersionBits) {\n return version;\n }\n\n let difference = numBitsDiffering(topRightVersionBits, version.infoBits);\n if (difference < bestDifference) {\n bestVersion = version;\n bestDifference = difference;\n }\n\n difference = numBitsDiffering(bottomLeftVersionBits, version.infoBits);\n if (difference < bestDifference) {\n bestVersion = version;\n bestDifference = difference;\n }\n }\n // We can tolerate up to 3 bits of error since no two version info codewords will\n // differ in less than 8 bits.\n if (bestDifference <= 3) {\n return bestVersion;\n }\n}\n\nfunction readFormatInformation(matrix: BitMatrix) {\n let topLeftFormatInfoBits = 0;\n for (let x = 0; x <= 8; x++) {\n if (x !== 6) { // Skip timing pattern bit\n topLeftFormatInfoBits = pushBit(matrix.get(x, 8), topLeftFormatInfoBits);\n }\n }\n for (let y = 7; y >= 0; y--) {\n if (y !== 6) { // Skip timing pattern bit\n topLeftFormatInfoBits = pushBit(matrix.get(8, y), topLeftFormatInfoBits);\n }\n }\n\n const dimension = matrix.height;\n let topRightBottomRightFormatInfoBits = 0;\n for (let y = dimension - 1; y >= dimension - 7; y--) { // bottom left\n topRightBottomRightFormatInfoBits = pushBit(matrix.get(8, y), topRightBottomRightFormatInfoBits);\n }\n for (let x = dimension - 8; x < dimension; x++) { // top right\n topRightBottomRightFormatInfoBits = pushBit(matrix.get(x, 8), topRightBottomRightFormatInfoBits);\n }\n\n let bestDifference = Infinity;\n let bestFormatInfo = null;\n for (const {bits, formatInfo} of FORMAT_INFO_TABLE) {\n if (bits === topLeftFormatInfoBits || bits === topRightBottomRightFormatInfoBits) {\n return formatInfo;\n }\n let difference = numBitsDiffering(topLeftFormatInfoBits, bits);\n if (difference < bestDifference) {\n bestFormatInfo = formatInfo;\n bestDifference = difference;\n }\n if (topLeftFormatInfoBits !== topRightBottomRightFormatInfoBits) { // also try the other option\n difference = numBitsDiffering(topRightBottomRightFormatInfoBits, bits);\n if (difference < bestDifference) {\n bestFormatInfo = formatInfo;\n bestDifference = difference;\n }\n }\n }\n // Hamming distance of the 32 masked codes is 7, by construction, so <= 3 bits differing means we found a match\n if (bestDifference <= 3) {\n return bestFormatInfo;\n }\n return null;\n}\n\nfunction getDataBlocks(codewords: number[], version: Version, ecLevel: number) {\n const ecInfo = version.errorCorrectionLevels[ecLevel];\n const dataBlocks: Array<{\n numDataCodewords: number;\n codewords: number[];\n }> = [];\n\n let totalCodewords = 0;\n ecInfo.ecBlocks.forEach(block => {\n for (let i = 0; i < block.numBlocks; i++) {\n dataBlocks.push({ numDataCodewords: block.dataCodewordsPerBlock, codewords: [] });\n totalCodewords += block.dataCodewordsPerBlock + ecInfo.ecCodewordsPerBlock;\n }\n });\n\n // In some cases the QR code will be malformed enough that we pull off more or less than we should.\n // If we pull off less there's nothing we can do.\n // If we pull off more we can safely truncate\n if (codewords.length < totalCodewords) {\n return null;\n }\n codewords = codewords.slice(0, totalCodewords);\n\n const shortBlockSize = ecInfo.ecBlocks[0].dataCodewordsPerBlock;\n // Pull codewords to fill the blocks up to the minimum size\n for (let i = 0; i < shortBlockSize; i++) {\n for (const dataBlock of dataBlocks) {\n dataBlock.codewords.push(codewords.shift());\n }\n }\n\n // If there are any large blocks, pull codewords to fill the last element of those\n if (ecInfo.ecBlocks.length > 1) {\n const smallBlockCount = ecInfo.ecBlocks[0].numBlocks;\n const largeBlockCount = ecInfo.ecBlocks[1].numBlocks;\n for (let i = 0; i < largeBlockCount; i++) {\n dataBlocks[smallBlockCount + i].codewords.push(codewords.shift());\n }\n }\n\n // Add the rest of the codewords to the blocks. These are the error correction codewords.\n while (codewords.length > 0) {\n for (const dataBlock of dataBlocks) {\n dataBlock.codewords.push(codewords.shift());\n }\n }\n\n return dataBlocks;\n}\n\nfunction decodeMatrix(matrix: BitMatrix) {\n const version = readVersion(matrix);\n if (!version) {\n return null;\n }\n\n const formatInfo = readFormatInformation(matrix);\n if (!formatInfo) {\n return null;\n }\n\n const codewords = readCodewords(matrix, version, formatInfo);\n const dataBlocks = getDataBlocks(codewords, version, formatInfo.errorCorrectionLevel);\n if (!dataBlocks) {\n return null;\n }\n\n // Count total number of data bytes\n const totalBytes = dataBlocks.reduce((a, b) => a + b.numDataCodewords, 0);\n const resultBytes = new Uint8ClampedArray(totalBytes);\n\n let resultIndex = 0;\n for (const dataBlock of dataBlocks) {\n const correctedBytes = rsDecode(dataBlock.codewords, dataBlock.codewords.length - dataBlock.numDataCodewords);\n if (!correctedBytes) {\n return null;\n }\n for (let i = 0; i < dataBlock.numDataCodewords; i++) {\n resultBytes[resultIndex++] = correctedBytes[i];\n }\n }\n\n try {\n return decodeData(resultBytes, version.versionNumber);\n } catch {\n return null;\n }\n}\n\nexport function decode(matrix: BitMatrix): DecodedQR {\n if (matrix == null) {\n return null;\n }\n const result = decodeMatrix(matrix);\n if (result) {\n return result;\n }\n // Decoding didn't work, try mirroring the QR across the topLeft -> bottomRight line.\n for (let x = 0; x < matrix.width; x++) {\n for (let y = x + 1; y < matrix.height; y++) {\n if (matrix.get(x, y) !== matrix.get(y, x)) {\n matrix.set(x, y, !matrix.get(x, y));\n matrix.set(y, x, !matrix.get(y, x));\n }\n }\n }\n return decodeMatrix(matrix);\n}\n", "import {BitMatrix} from \"../BitMatrix\";\nimport {Point, QRLocation} from \"../locator\";\n\ninterface PerspectiveTransform {\n a11: number;\n a21: number;\n a31: number;\n a12: number;\n a22: number;\n a32: number;\n a13: number;\n a23: number;\n a33: number;\n}\n\nfunction squareToQuadrilateral(p1: Point, p2: Point, p3: Point, p4: Point): PerspectiveTransform {\n const dx3 = p1.x - p2.x + p3.x - p4.x;\n const dy3 = p1.y - p2.y + p3.y - p4.y;\n if (dx3 === 0 && dy3 === 0) { // Affine\n return {\n a11: p2.x - p1.x,\n a12: p2.y - p1.y,\n a13: 0,\n a21: p3.x - p2.x,\n a22: p3.y - p2.y,\n a23: 0,\n a31: p1.x,\n a32: p1.y,\n a33: 1,\n };\n } else {\n const dx1 = p2.x - p3.x;\n const dx2 = p4.x - p3.x;\n const dy1 = p2.y - p3.y;\n const dy2 = p4.y - p3.y;\n const denominator = dx1 * dy2 - dx2 * dy1;\n const a13 = (dx3 * dy2 - dx2 * dy3) / denominator;\n const a23 = (dx1 * dy3 - dx3 * dy1) / denominator;\n return {\n a11: p2.x - p1.x + a13 * p2.x,\n a12: p2.y - p1.y + a13 * p2.y,\n a13,\n a21: p4.x - p1.x + a23 * p4.x,\n a22: p4.y - p1.y + a23 * p4.y,\n a23,\n a31: p1.x,\n a32: p1.y,\n a33: 1,\n };\n }\n}\n\nfunction quadrilateralToSquare(p1: Point, p2: Point, p3: Point, p4: Point): PerspectiveTransform {\n // Here, the adjoint serves as the inverse:\n const sToQ = squareToQuadrilateral(p1, p2, p3, p4);\n return {\n a11: sToQ.a22 * sToQ.a33 - sToQ.a23 * sToQ.a32,\n a12: sToQ.a13 * sToQ.a32 - sToQ.a12 * sToQ.a33,\n a13: sToQ.a12 * sToQ.a23 - sToQ.a13 * sToQ.a22,\n a21: sToQ.a23 * sToQ.a31 - sToQ.a21 * sToQ.a33,\n a22: sToQ.a11 * sToQ.a33 - sToQ.a13 * sToQ.a31,\n a23: sToQ.a13 * sToQ.a21 - sToQ.a11 * sToQ.a23,\n a31: sToQ.a21 * sToQ.a32 - sToQ.a22 * sToQ.a31,\n a32: sToQ.a12 * sToQ.a31 - sToQ.a11 * sToQ.a32,\n a33: sToQ.a11 * sToQ.a22 - sToQ.a12 * sToQ.a21,\n };\n}\n\nfunction times(a: PerspectiveTransform, b: PerspectiveTransform): PerspectiveTransform {\n return {\n a11: a.a11 * b.a11 + a.a21 * b.a12 + a.a31 * b.a13,\n a12: a.a12 * b.a11 + a.a22 * b.a12 + a.a32 * b.a13,\n a13: a.a13 * b.a11 + a.a23 * b.a12 + a.a33 * b.a13,\n a21: a.a11 * b.a21 + a.a21 * b.a22 + a.a31 * b.a23,\n a22: a.a12 * b.a21 + a.a22 * b.a22 + a.a32 * b.a23,\n a23: a.a13 * b.a21 + a.a23 * b.a22 + a.a33 * b.a23,\n a31: a.a11 * b.a31 + a.a21 * b.a32 + a.a31 * b.a33,\n a32: a.a12 * b.a31 + a.a22 * b.a32 + a.a32 * b.a33,\n a33: a.a13 * b.a31 + a.a23 * b.a32 + a.a33 * b.a33,\n };\n}\n\nexport function extract(image: BitMatrix, location: QRLocation) {\n const qToS = quadrilateralToSquare(\n {x: 3.5, y: 3.5},\n {x: location.dimension - 3.5, y: 3.5},\n {x: location.dimension - 6.5, y: location.dimension - 6.5},\n {x: 3.5, y: location.dimension - 3.5},\n );\n const sToQ = squareToQuadrilateral(location.topLeft, location.topRight, location.alignmentPattern, location.bottomLeft);\n const transform = times(sToQ, qToS);\n\n const matrix = BitMatrix.createEmpty(location.dimension, location.dimension);\n const mappingFunction = (x: number, y: number) => {\n const denominator = transform.a13 * x + transform.a23 * y + transform.a33;\n return {\n x: (transform.a11 * x + transform.a21 * y + transform.a31) / denominator,\n y: (transform.a12 * x + transform.a22 * y + transform.a32) / denominator,\n };\n };\n\n for (let y = 0; y < location.dimension; y++) {\n for (let x = 0; x < location.dimension; x++) {\n const xValue = x + 0.5;\n const yValue = y + 0.5;\n const sourcePixel = mappingFunction(xValue, yValue);\n matrix.set(x, y, image.get(Math.floor(sourcePixel.x), Math.floor(sourcePixel.y)));\n }\n }\n\n return {\n matrix,\n mappingFunction,\n };\n}\n", "import { BitMatrix } from \"../BitMatrix\";\n\nconst MAX_FINDERPATTERNS_TO_SEARCH = 5;\nconst MIN_QUAD_RATIO = 0.5;\nconst MAX_QUAD_RATIO = 1.5;\n\nexport interface Point {\n x: number;\n y: number;\n}\n\nexport interface QRLocation {\n topRight: Point;\n bottomLeft: Point;\n topLeft: Point;\n alignmentPattern: Point;\n dimension: number;\n}\n\nconst distance = (a: Point, b: Point) => Math.sqrt((b.x - a.x) ** 2 + (b.y - a.y) ** 2);\n\nfunction sum(values: number[]) {\n return values.reduce((a, b) => a + b);\n}\n\n// Takes three finder patterns and organizes them into topLeft, topRight, etc\nfunction reorderFinderPatterns(pattern1: Point, pattern2: Point, pattern3: Point) {\n // Find distances between pattern centers\n const oneTwoDistance = distance(pattern1, pattern2);\n const twoThreeDistance = distance(pattern2, pattern3);\n const oneThreeDistance = distance(pattern1, pattern3);\n\n let bottomLeft: Point;\n let topLeft: Point;\n let topRight: Point;\n\n // Assume one closest to other two is B; A and C will just be guesses at first\n if (twoThreeDistance >= oneTwoDistance && twoThreeDistance >= oneThreeDistance) {\n [bottomLeft, topLeft, topRight] = [pattern2, pattern1, pattern3];\n } else if (oneThreeDistance >= twoThreeDistance && oneThreeDistance >= oneTwoDistance) {\n [bottomLeft, topLeft, topRight] = [pattern1, pattern2, pattern3];\n } else {\n [bottomLeft, topLeft, topRight] = [pattern1, pattern3, pattern2];\n }\n\n // Use cross product to figure out whether bottomLeft (A) and topRight (C) are correct or flipped in relation to topLeft (B)\n // This asks whether BC x BA has a positive z component, which is the arrangement we want. If it's negative, then\n // we've got it flipped around and should swap topRight and bottomLeft.\n if (((topRight.x - topLeft.x) * (bottomLeft.y - topLeft.y)) - ((topRight.y - topLeft.y) * (bottomLeft.x - topLeft.x)) < 0) {\n [bottomLeft, topRight] = [topRight, bottomLeft];\n }\n\n return { bottomLeft, topLeft, topRight };\n}\n\n// Computes the dimension (number of modules on a side) of the QR Code based on the position of the finder patterns\nfunction computeDimension(topLeft: Point, topRight: Point, bottomLeft: Point, matrix: BitMatrix) {\n const moduleSize = (\n sum(countBlackWhiteRun(topLeft, bottomLeft, matrix, 5)) / 7 + // Divide by 7 since the ratio is 1:1:3:1:1\n sum(countBlackWhiteRun(topLeft, topRight, matrix, 5)) / 7 +\n sum(countBlackWhiteRun(bottomLeft, topLeft, matrix, 5)) / 7 +\n sum(countBlackWhiteRun(topRight, topLeft, matrix, 5)) / 7\n ) / 4;\n\n if (moduleSize < 1) {\n throw new Error(\"Invalid module size\");\n }\n\n const topDimension = Math.round(distance(topLeft, topRight) / moduleSize);\n const sideDimension = Math.round(distance(topLeft, bottomLeft) / moduleSize);\n let dimension = Math.floor((topDimension + sideDimension) / 2) + 7;\n switch (dimension % 4) {\n case 0:\n dimension++;\n break;\n case 2:\n dimension--;\n break;\n }\n return { dimension, moduleSize };\n}\n\n// Takes an origin point and an end point and counts the sizes of the black white run from the origin towards the end point.\n// Returns an array of elements, representing the pixel size of the black white run.\n// Uses a variant of http://en.wikipedia.org/wiki/Bresenham's_line_algorithm\nfunction countBlackWhiteRunTowardsPoint(origin: Point, end: Point, matrix: BitMatrix, length: number) {\n const switchPoints: Point[] = [{x: Math.floor(origin.x), y: Math.floor(origin.y)}];\n const steep = Math.abs(end.y - origin.y) > Math.abs(end.x - origin.x);\n\n let fromX: number;\n let fromY: number;\n let toX: number;\n let toY: number;\n if (steep) {\n fromX = Math.floor(origin.y);\n fromY = Math.floor(origin.x);\n toX = Math.floor(end.y);\n toY = Math.floor(end.x);\n } else {\n fromX = Math.floor(origin.x);\n fromY = Math.floor(origin.y);\n toX = Math.floor(end.x);\n toY = Math.floor(end.y);\n }\n\n const dx = Math.abs(toX - fromX);\n const dy = Math.abs(toY - fromY);\n let error = Math.floor(-dx / 2);\n const xStep = fromX < toX ? 1 : -1;\n const yStep = fromY < toY ? 1 : -1;\n\n let currentPixel = true;\n // Loop up until x == toX, but not beyond\n for (let x = fromX, y = fromY; x !== toX + xStep; x += xStep) {\n // Does current pixel mean we have moved white to black or vice versa?\n // Scanning black in state 0,2 and white in state 1, so if we find the wrong\n // color, advance to next state or end if we are in state 2 already\n const realX = steep ? y : x;\n const realY = steep ? x : y;\n if (matrix.get(realX, realY) !== currentPixel) {\n currentPixel = !currentPixel;\n switchPoints.push({x: realX, y: realY});\n if (switchPoints.length === length + 1) {\n break;\n }\n }\n error += dy;\n if (error > 0) {\n if (y === toY) {\n break;\n }\n y += yStep;\n error -= dx;\n }\n }\n const distances: number[] = [];\n for (let i = 0; i < length; i++) {\n if (switchPoints[i] && switchPoints[i + 1]) {\n distances.push(distance(switchPoints[i], switchPoints[i + 1]));\n } else {\n distances.push(0);\n }\n }\n return distances;\n}\n\n// Takes an origin point and an end point and counts the sizes of the black white run in the origin point\n// along the line that intersects with the end point. Returns an array of elements, representing the pixel sizes\n// of the black white run. Takes a length which represents the number of switches from black to white to look for.\nfunction countBlackWhiteRun(origin: Point, end: Point, matrix: BitMatrix, length: number) {\n const rise = end.y - origin.y;\n const run = end.x - origin.x;\n\n const towardsEnd = countBlackWhiteRunTowardsPoint(origin, end, matrix, Math.ceil(length / 2));\n const awayFromEnd = countBlackWhiteRunTowardsPoint(origin, {x: origin.x - run, y: origin.y - rise}, matrix, Math.ceil(length / 2));\n\n const middleValue = towardsEnd.shift() + awayFromEnd.shift() - 1; // Substract one so we don't double count a pixel\n return awayFromEnd.concat(middleValue).concat(...towardsEnd);\n}\n\n// Takes in a black white run and an array of expected ratios. Returns the average size of the run as well as the \"error\" -\n// that is the amount the run diverges from the expected ratio\nfunction scoreBlackWhiteRun(sequence: number[], ratios: number[]) {\n const averageSize = sum(sequence) / sum(ratios);\n let error = 0;\n ratios.forEach((ratio, i) => {\n error += (sequence[i] - ratio * averageSize) ** 2;\n });\n\n return { averageSize, error };\n}\n\n// Takes an X,Y point and an array of sizes and scores the point against those ratios.\n// For example for a finder pattern takes the ratio list of 1:1:3:1:1 and checks horizontal, vertical and diagonal ratios\n// against that.\nfunction scorePattern(point: Point, ratios: number[], matrix: BitMatrix) {\n try {\n const horizontalRun = countBlackWhiteRun(point, {x: -1, y: point.y}, matrix, ratios.length);\n const verticalRun = countBlackWhiteRun(point, {x: point.x, y: -1}, matrix, ratios.length);\n\n const topLeftPoint = {\n x: Math.max(0, point.x - point.y) - 1,\n y: Math.max(0, point.y - point.x) - 1,\n };\n const topLeftBottomRightRun = countBlackWhiteRun(point, topLeftPoint, matrix, ratios.length);\n\n const bottomLeftPoint = {\n x: Math.min(matrix.width, point.x + point.y) + 1,\n y: Math.min(matrix.height, point.y + point.x) + 1,\n };\n const bottomLeftTopRightRun = countBlackWhiteRun(point, bottomLeftPoint, matrix, ratios.length);\n\n const horzError = scoreBlackWhiteRun(horizontalRun, ratios);\n const vertError = scoreBlackWhiteRun(verticalRun, ratios);\n const diagDownError = scoreBlackWhiteRun(topLeftBottomRightRun, ratios);\n const diagUpError = scoreBlackWhiteRun(bottomLeftTopRightRun, ratios);\n\n const ratioError = Math.sqrt(horzError.error * horzError.error +\n vertError.error * vertError.error +\n diagDownError.error * diagDownError.error +\n diagUpError.error * diagUpError.error);\n\n const avgSize = (horzError.averageSize + vertError.averageSize + diagDownError.averageSize + diagUpError.averageSize) / 4;\n\n const sizeError = ((horzError.averageSize - avgSize) ** 2 +\n (vertError.averageSize - avgSize) ** 2 +\n (diagDownError.averageSize - avgSize) ** 2 +\n (diagUpError.averageSize - avgSize) ** 2) / avgSize;\n return ratioError + sizeError;\n } catch {\n return Infinity;\n }\n}\n\nfunction recenterLocation(matrix: BitMatrix, p: Point): Point {\n let leftX = Math.round(p.x);\n while (matrix.get(leftX, Math.round(p.y))) {\n leftX--;\n }\n let rightX = Math.round(p.x);\n while (matrix.get(rightX, Math.round(p.y))) {\n rightX++;\n }\n const x = (leftX + rightX) / 2;\n\n let topY = Math.round(p.y);\n while (matrix.get(Math.round(x), topY)) {\n topY--;\n }\n let bottomY = Math.round(p.y);\n while (matrix.get(Math.round(x), bottomY)) {\n bottomY++;\n }\n const y = (topY + bottomY) / 2;\n\n return { x, y };\n}\n\ninterface Quad {\n top: {\n startX: number;\n endX: number;\n y: number;\n };\n bottom: {\n startX: number;\n endX: number;\n y: number;\n };\n}\n\nexport function locate(matrix: BitMatrix): QRLocation[] {\n const finderPatternQuads: Quad[] = [];\n let activeFinderPatternQuads: Quad[] = [];\n const alignmentPatternQuads: Quad[] = [];\n let activeAlignmentPatternQuads: Quad[] = [];\n\n for (let y = 0; y <= matrix.height; y++) {\n let length = 0;\n let lastBit = false;\n let scans = [0, 0, 0, 0, 0];\n\n for (let x = -1; x <= matrix.width; x++) {\n const v = matrix.get(x, y);\n if (v === lastBit) {\n length++;\n } else {\n scans = [scans[1], scans[2], scans[3], scans[4], length];\n length = 1;\n lastBit = v;\n\n // Do the last 5 color changes ~ match the expected ratio for a finder pattern? 1:1:3:1:1 of b:w:b:w:b\n const averageFinderPatternBlocksize = sum(scans) / 7;\n const validFinderPattern =\n Math.abs(scans[0] - averageFinderPatternBlocksize) < averageFinderPatternBlocksize &&\n Math.abs(scans[1] - averageFinderPatternBlocksize) < averageFinderPatternBlocksize &&\n Math.abs(scans[2] - 3 * averageFinderPatternBlocksize) < 3 * averageFinderPatternBlocksize &&\n Math.abs(scans[3] - averageFinderPatternBlocksize) < averageFinderPatternBlocksize &&\n Math.abs(scans[4] - averageFinderPatternBlocksize) < averageFinderPatternBlocksize &&\n !v; // And make sure the current pixel is white since finder patterns are bordered in white\n\n // Do the last 3 color changes ~ match the expected ratio for an alignment pattern? 1:1:1 of w:b:w\n const averageAlignmentPatternBlocksize = sum(scans.slice(-3)) / 3;\n const validAlignmentPattern =\n Math.abs(scans[2] - averageAlignmentPatternBlocksize) < averageAlignmentPatternBlocksize &&\n Math.abs(scans[3] - averageAlignmentPatternBlocksize) < averageAlignmentPatternBlocksize &&\n Math.abs(scans[4] - averageAlignmentPatternBlocksize) < averageAlignmentPatternBlocksize &&\n v; // Is the current pixel black since alignment patterns are bordered in black\n\n if (validFinderPattern) {\n // Compute the start and end x values of the large center black square\n const endX = x - scans[3] - scans[4];\n const startX = endX - scans[2];\n\n const line = { startX, endX, y };\n // Is there a quad directly above the current spot? If so, extend it with the new line. Otherwise, create a new quad with\n // that line as the starting point.\n const matchingQuads = activeFinderPatternQuads.filter(q =>\n (startX >= q.bottom.startX && startX <= q.bottom.endX) ||\n (endX >= q.bottom.startX && startX <= q.bottom.endX) ||\n (startX <= q.bottom.startX && endX >= q.bottom.endX && (\n (scans[2] / (q.bottom.endX - q.bottom.startX)) < MAX_QUAD_RATIO &&\n (scans[2] / (q.bottom.endX - q.bottom.startX)) > MIN_QUAD_RATIO\n )),\n );\n if (matchingQuads.length > 0) {\n matchingQuads[0].bottom = line;\n } else {\n activeFinderPatternQuads.push({ top: line, bottom: line });\n }\n }\n if (validAlignmentPattern) {\n // Compute the start and end x values of the center black square\n const endX = x - scans[4];\n const startX = endX - scans[3];\n\n const line = { startX, y, endX };\n // Is there a quad directly above the current spot? If so, extend it with the new line. Otherwise, create a new quad with\n // that line as the starting point.\n const matchingQuads = activeAlignmentPatternQuads.filter(q =>\n (startX >= q.bottom.startX && startX <= q.bottom.endX) ||\n (endX >= q.bottom.startX && startX <= q.bottom.endX) ||\n (startX <= q.bottom.startX && endX >= q.bottom.endX && (\n (scans[2] / (q.bottom.endX - q.bottom.startX)) < MAX_QUAD_RATIO &&\n (scans[2] / (q.bottom.endX - q.bottom.startX)) > MIN_QUAD_RATIO\n )),\n );\n if (matchingQuads.length > 0) {\n matchingQuads[0].bottom = line;\n } else {\n activeAlignmentPatternQuads.push({ top: line, bottom: line });\n }\n }\n }\n }\n finderPatternQuads.push(...activeFinderPatternQuads.filter(q => q.bottom.y !== y && q.bottom.y - q.top.y >= 2));\n activeFinderPatternQuads = activeFinderPatternQuads.filter(q => q.bottom.y === y);\n\n alignmentPatternQuads.push(...activeAlignmentPatternQuads.filter(q => q.bottom.y !== y));\n activeAlignmentPatternQuads = activeAlignmentPatternQuads.filter(q => q.bottom.y === y);\n\n }\n\n finderPatternQuads.push(...activeFinderPatternQuads.filter(q => q.bottom.y - q.top.y >= 2));\n alignmentPatternQuads.push(...activeAlignmentPatternQuads);\n\n // Refactored from cozmo/jsQR to (hopefully) circumvent an issue in Safari 13+ on both Mac and iOS (also including\n // iOS Chrome and other Safari iOS derivatives). Safari was very occasionally and apparently not deterministically\n // throwing a \"RangeError: Array size is not a small enough positive integer.\" exception seemingly within the second\n // .map of the original code (here the second for-loop). This second .map contained a nested .map call over the same\n // array instance which was the chained result from previous calls to .map, .filter and .sort which potentially caused\n // this bug in Safari?\n // Also see https://github.com/cozmo/jsQR/issues/157 and https://bugs.webkit.org/show_bug.cgi?id=211619#c3\n const scoredFinderPatternPositions: Array = [];\n for (const quad of finderPatternQuads) {\n if (quad.bottom.y - quad.top.y < 2) {\n // All quads must be at least 2px tall since the center square is larger than a block\n continue;\n }\n\n // calculate quad center\n const x = (quad.top.startX + quad.top.endX + quad.bottom.startX + quad.bottom.endX) / 4;\n const y = (quad.top.y + quad.bottom.y + 1) / 2;\n if (!matrix.get(Math.round(x), Math.round(y))) {\n continue;\n }\n\n const lengths = [quad.top.endX - quad.top.startX, quad.bottom.endX - quad.bottom.startX, quad.bottom.y - quad.top.y + 1];\n const size = sum(lengths) / lengths.length;\n // Initial scoring of finder pattern quads by looking at their ratios, not taking into account position\n const score = scorePattern({x: Math.round(x), y: Math.round(y)}, [1, 1, 3, 1, 1], matrix);\n scoredFinderPatternPositions.push({ score, x, y, size });\n }\n if (scoredFinderPatternPositions.length < 3) {\n // A QR code has 3 finder patterns, therefore we need at least 3 candidates.\n return null;\n }\n scoredFinderPatternPositions.sort((a, b) => a.score - b.score);\n\n // Now take the top finder pattern options and try to find 2 other options with a similar size.\n const finderPatternGroups: Array<{ points: [Point, Point, Point], score: number }> = [];\n for (let i = 0; i < Math.min(scoredFinderPatternPositions.length, MAX_FINDERPATTERNS_TO_SEARCH); ++i) {\n const point = scoredFinderPatternPositions[i];\n const otherPoints: typeof scoredFinderPatternPositions = [];\n\n for (const otherPoint of scoredFinderPatternPositions) {\n if (otherPoint === point) {\n continue;\n }\n otherPoints.push({\n ...otherPoint,\n score: otherPoint.score + ((otherPoint.size - point.size) ** 2) / point.size, // score similarity of sizes\n });\n }\n otherPoints.sort((a, b) => a.score - b.score);\n\n finderPatternGroups.push({\n points: [point, otherPoints[0], otherPoints[1]], // note that otherPoints.length >= 2 as scoredFinderPatternPositions.length >= 3\n score: point.score + otherPoints[0].score + otherPoints[1].score, // total combined score of the three points in the group\n });\n }\n finderPatternGroups.sort((a, b) => a.score - b.score);\n const bestFinderPatternGroup = finderPatternGroups[0];\n\n const { topRight, topLeft, bottomLeft } = reorderFinderPatterns(...bestFinderPatternGroup.points);\n const alignment = findAlignmentPattern(matrix, alignmentPatternQuads, topRight, topLeft, bottomLeft);\n const result: QRLocation[] = [];\n if (alignment) {\n result.push({\n alignmentPattern: { x: alignment.alignmentPattern.x, y: alignment.alignmentPattern.y },\n bottomLeft: {x: bottomLeft.x, y: bottomLeft.y },\n dimension: alignment.dimension,\n topLeft: {x: topLeft.x, y: topLeft.y },\n topRight: {x: topRight.x, y: topRight.y },\n });\n }\n\n // We normally use the center of the quads as the location of the tracking points, which is optimal for most cases and will account\n // for a skew in the image. However, In some cases, a slight skew might not be real and instead be caused by image compression\n // errors and/or low resolution. For those cases, we'd be better off centering the point exactly in the middle of the black area. We\n // compute and return the location data for the naively centered points as it is little additional work and allows for multiple\n // attempts at decoding harder images.\n const midTopRight = recenterLocation(matrix, topRight);\n const midTopLeft = recenterLocation(matrix, topLeft);\n const midBottomLeft = recenterLocation(matrix, bottomLeft);\n const centeredAlignment = findAlignmentPattern(matrix, alignmentPatternQuads, midTopRight, midTopLeft, midBottomLeft);\n if (centeredAlignment) {\n result.push({\n alignmentPattern: { x: centeredAlignment.alignmentPattern.x, y: centeredAlignment.alignmentPattern.y },\n bottomLeft: { x: midBottomLeft.x, y: midBottomLeft. y },\n topLeft: { x: midTopLeft.x, y: midTopLeft. y },\n topRight: { x: midTopRight.x, y: midTopRight. y },\n dimension: centeredAlignment.dimension,\n });\n }\n\n if (result.length === 0) {\n return null;\n }\n\n return result;\n}\n\nfunction findAlignmentPattern(matrix: BitMatrix, alignmentPatternQuads: Quad[], topRight: Point, topLeft: Point, bottomLeft: Point) {\n // Now that we've found the three finder patterns we can determine the blockSize and the size of the QR code.\n // We'll use these to help find the alignment pattern but also later when we do the extraction.\n let dimension: number;\n let moduleSize: number;\n try {\n ({ dimension, moduleSize } = computeDimension(topLeft, topRight, bottomLeft, matrix));\n } catch (e) {\n return null;\n }\n\n // Now find the alignment pattern\n const bottomRightFinderPattern = { // Best guess at where a bottomRight finder pattern would be\n x: topRight.x - topLeft.x + bottomLeft.x,\n y: topRight.y - topLeft.y + bottomLeft.y,\n };\n const modulesBetweenFinderPatterns = ((distance(topLeft, bottomLeft) + distance(topLeft, topRight)) / 2 / moduleSize);\n const correctionToTopLeft = 1 - (3 / modulesBetweenFinderPatterns);\n const expectedAlignmentPattern = {\n x: topLeft.x + correctionToTopLeft * (bottomRightFinderPattern.x - topLeft.x),\n y: topLeft.y + correctionToTopLeft * (bottomRightFinderPattern.y - topLeft.y),\n };\n\n const alignmentPatterns = alignmentPatternQuads\n .map(q => {\n const x = (q.top.startX + q.top.endX + q.bottom.startX + q.bottom.endX) / 4;\n const y = (q.top.y + q.bottom.y + 1) / 2;\n if (!matrix.get(Math.floor(x), Math.floor(y))) {\n return;\n }\n\n const sizeScore = scorePattern({x: Math.floor(x), y: Math.floor(y)}, [1, 1, 1], matrix);\n const score = sizeScore + distance({x, y}, expectedAlignmentPattern);\n return { x, y, score };\n })\n .filter(v => !!v)\n .sort((a, b) => a.score - b.score);\n\n // If there are less than 15 modules between finder patterns it's a version 1 QR code and as such has no alignmemnt pattern\n // so we can only use our best guess.\n const alignmentPattern = modulesBetweenFinderPatterns >= 15 && alignmentPatterns.length ? alignmentPatterns[0] : expectedAlignmentPattern;\n\n return { alignmentPattern, dimension };\n}\n", "import {binarize} from \"./binarizer\";\nimport {BitMatrix} from \"./BitMatrix\";\nimport {Chunks} from \"./decoder/decodeData\";\nimport {decode} from \"./decoder/decoder\";\nimport { Version } from \"./decoder/version\";\nimport {extract} from \"./extractor\";\nimport {locate, Point} from \"./locator\";\n\nexport interface QRCode {\n binaryData: number[];\n data: string;\n chunks: Chunks;\n version: number;\n location: {\n topRightCorner: Point;\n topLeftCorner: Point;\n bottomRightCorner: Point;\n bottomLeftCorner: Point;\n\n topRightFinderPattern: Point;\n topLeftFinderPattern: Point;\n bottomLeftFinderPattern: Point;\n\n bottomRightAlignmentPattern?: Point;\n };\n matrix: BitMatrix;\n}\n\nfunction scan(matrix: BitMatrix): QRCode | null {\n const locations = locate(matrix);\n if (!locations) {\n return null;\n }\n\n for (const location of locations) {\n const extracted = extract(matrix, location);\n const decoded = decode(extracted.matrix);\n if (decoded) {\n return {\n binaryData: decoded.bytes,\n data: decoded.text,\n chunks: decoded.chunks,\n version: decoded.version,\n location: {\n topRightCorner: extracted.mappingFunction(location.dimension, 0),\n topLeftCorner: extracted.mappingFunction(0, 0),\n bottomRightCorner: extracted.mappingFunction(location.dimension, location.dimension),\n bottomLeftCorner: extracted.mappingFunction(0, location.dimension),\n\n topRightFinderPattern: location.topRight,\n topLeftFinderPattern: location.topLeft,\n bottomLeftFinderPattern: location.bottomLeft,\n\n bottomRightAlignmentPattern: location.alignmentPattern,\n },\n matrix: extracted.matrix,\n };\n }\n }\n return null;\n}\n\nexport interface Options {\n inversionAttempts?: \"dontInvert\" | \"onlyInvert\" | \"attemptBoth\" | \"invertFirst\";\n greyScaleWeights?: GreyscaleWeights;\n canOverwriteImage?: boolean;\n}\n\nexport interface GreyscaleWeights {\n red: number;\n green: number;\n blue: number;\n useIntegerApproximation?: boolean;\n}\n\nconst defaultOptions: Options = {\n inversionAttempts: \"attemptBoth\",\n greyScaleWeights: {\n red: 0.2126,\n green: 0.7152,\n blue: 0.0722,\n useIntegerApproximation: false,\n },\n canOverwriteImage: true,\n};\n\nfunction mergeObject(target: any, src: any) {\n Object.keys(src).forEach(opt => { // Sad implementation of Object.assign since we target es5 not es6\n target[opt] = src[opt];\n });\n}\n\nfunction jsQR(data: Uint8ClampedArray, width: number, height: number, providedOptions: Options = {}): QRCode | null {\n const options = Object.create(null);\n mergeObject(options, defaultOptions);\n mergeObject(options, providedOptions);\n\n const tryInvertedFirst = options.inversionAttempts === \"onlyInvert\" || options.inversionAttempts === \"invertFirst\";\n const shouldInvert = options.inversionAttempts === \"attemptBoth\" || tryInvertedFirst;\n const {binarized, inverted} = binarize(data, width, height, shouldInvert, options.greyScaleWeights,\n options.canOverwriteImage);\n let result = scan(tryInvertedFirst ? inverted : binarized);\n if (!result && (options.inversionAttempts === \"attemptBoth\" || options.inversionAttempts === \"invertFirst\")) {\n result = scan(tryInvertedFirst ? binarized : inverted);\n }\n return result;\n}\n\n(jsQR as any).default = jsQR;\nexport default jsQR;\n", "// @ts-ignore jsqr-es6 does not provide types currently\nimport jsQR from '../node_modules/jsqr-es6/dist/jsQR.js';\n\ntype GrayscaleWeights = {\n red: number,\n green: number,\n blue: number,\n useIntegerApproximation: boolean,\n};\n\nlet inversionAttempts: 'dontInvert' | 'onlyInvert' | 'attemptBoth' = 'dontInvert';\nlet grayscaleWeights: GrayscaleWeights = {\n // weights for quick luma integer approximation (https://en.wikipedia.org/wiki/YUV#Full_swing_for_BT.601)\n red: 77,\n green: 150,\n blue: 29,\n useIntegerApproximation: true,\n};\n\nself.onmessage = event => {\n const id = event['data']['id'];\n const type = event['data']['type'];\n const data = event['data']['data'];\n\n switch (type) {\n case 'decode':\n decode(data, id);\n break;\n case 'grayscaleWeights':\n setGrayscaleWeights(data);\n break;\n case 'inversionMode':\n setInversionMode(data);\n break;\n case 'close':\n // close after earlier messages in the event loop finished processing\n self.close();\n break;\n }\n};\n\nfunction decode(data: { data: Uint8ClampedArray, width: number, height: number }, requestId: number): void {\n const rgbaData = data['data'];\n const width = data['width'];\n const height = data['height'];\n const result = jsQR(rgbaData, width, height, {\n inversionAttempts: inversionAttempts,\n greyScaleWeights: grayscaleWeights,\n });\n if (!result) {\n (self as unknown as Worker).postMessage({\n id: requestId,\n type: 'qrResult',\n data: null,\n });\n return;\n }\n\n (self as unknown as Worker).postMessage({\n id: requestId,\n type: 'qrResult',\n data: result.data,\n // equivalent to cornerPoints of native BarcodeDetector\n cornerPoints: [\n result.location.topLeftCorner,\n result.location.topRightCorner,\n result.location.bottomRightCorner,\n result.location.bottomLeftCorner,\n ],\n });\n}\n\nfunction setGrayscaleWeights(data: GrayscaleWeights) {\n // update grayscaleWeights in a closure compiler compatible fashion\n grayscaleWeights.red = data['red'];\n grayscaleWeights.green = data['green'];\n grayscaleWeights.blue = data['blue'];\n grayscaleWeights.useIntegerApproximation = data['useIntegerApproximation'];\n}\n\nfunction setInversionMode(inversionMode: 'original' | 'invert' | 'both') {\n switch (inversionMode) {\n case 'original':\n inversionAttempts = 'dontInvert';\n break;\n case 'invert':\n inversionAttempts = 'onlyInvert';\n break;\n case 'both':\n inversionAttempts = 'attemptBoth';\n break;\n default:\n throw new Error('Invalid inversion mode');\n }\n}\n", "class QrScanner {\n static readonly DEFAULT_CANVAS_SIZE = 400;\n static readonly NO_QR_CODE_FOUND = 'No QR code found';\n private static _disableBarcodeDetector = false;\n private static _workerMessageId = 0;\n\n /** @deprecated */\n static set WORKER_PATH(workerPath: string) {\n console.warn('Setting QrScanner.WORKER_PATH is not required and not supported anymore. '\n + 'Have a look at the README for new setup instructions.');\n }\n\n static async hasCamera(): Promise {\n try {\n return !!(await QrScanner.listCameras(false)).length;\n } catch (e) {\n return false;\n }\n }\n\n static async listCameras(requestLabels = false): Promise> {\n if (!navigator.mediaDevices) return [];\n\n const enumerateCameras = async (): Promise> =>\n (await navigator.mediaDevices.enumerateDevices()).filter((device) => device.kind === 'videoinput');\n\n // Note that enumerateDevices can always be called and does not prompt the user for permission.\n // However, enumerateDevices only includes device labels if served via https and an active media stream exists\n // or permission to access the camera was given. Therefore, if we're not getting labels but labels are requested\n // ask for camera permission by opening a stream.\n let openedStream: MediaStream | undefined;\n try {\n if (requestLabels && (await enumerateCameras()).every((camera) => !camera.label)) {\n openedStream = await navigator.mediaDevices.getUserMedia({ audio: false, video: true });\n }\n } catch (e) {\n // Fail gracefully, especially if the device has no camera or on mobile when the camera is already in use\n // and some browsers disallow a second stream.\n }\n\n try {\n return (await enumerateCameras()).map((camera, i) => ({\n id: camera.deviceId,\n label: camera.label || (i === 0 ? 'Default Camera' : `Camera ${i + 1}`),\n }));\n } finally {\n // close the stream we just opened for getting camera access for listing the device labels\n if (openedStream) {\n console.warn('Call listCameras after successfully starting a QR scanner to avoid creating '\n + 'a temporary video stream');\n QrScanner._stopVideoStream(openedStream);\n }\n }\n }\n\n readonly $video: HTMLVideoElement;\n readonly $canvas: HTMLCanvasElement;\n readonly $overlay?: HTMLDivElement;\n private readonly $codeOutlineHighlight?: SVGSVGElement;\n private readonly _onDecode?: (result: QrScanner.ScanResult) => void;\n private readonly _legacyOnDecode?: (result: string) => void;\n private readonly _legacyCanvasSize: number = QrScanner.DEFAULT_CANVAS_SIZE;\n private _preferredCamera: QrScanner.FacingMode | QrScanner.DeviceId = 'environment';\n private readonly _maxScansPerSecond: number = 25;\n private _lastScanTimestamp: number = -1;\n private _scanRegion: QrScanner.ScanRegion;\n private _codeOutlineHighlightRemovalTimeout?: number;\n private _qrEnginePromise: Promise\n private _active: boolean = false;\n private _paused: boolean = false;\n private _flashOn: boolean = false;\n private _destroyed: boolean = false;\n\n constructor(\n video: HTMLVideoElement,\n onDecode: (result: QrScanner.ScanResult) => void,\n options: {\n onDecodeError?: (error: Error | string) => void,\n calculateScanRegion?: (video: HTMLVideoElement) => QrScanner.ScanRegion,\n preferredCamera?: QrScanner.FacingMode | QrScanner.DeviceId,\n maxScansPerSecond?: number;\n highlightScanRegion?: boolean,\n highlightCodeOutline?: boolean,\n overlay?: HTMLDivElement,\n /** just a temporary flag until we switch entirely to the new api */\n returnDetailedScanResult?: true,\n },\n );\n /** @deprecated */\n constructor(\n video: HTMLVideoElement,\n onDecode: (result: string) => void,\n onDecodeError?: (error: Error | string) => void,\n calculateScanRegion?: (video: HTMLVideoElement) => QrScanner.ScanRegion,\n preferredCamera?: QrScanner.FacingMode | QrScanner.DeviceId,\n );\n /** @deprecated */\n constructor(\n video: HTMLVideoElement,\n onDecode: (result: string) => void,\n onDecodeError?: (error: Error | string) => void,\n canvasSize?: number,\n preferredCamera?: QrScanner.FacingMode | QrScanner.DeviceId,\n );\n /** @deprecated */\n constructor(video: HTMLVideoElement, onDecode: (result: string) => void, canvasSize?: number);\n constructor(\n video: HTMLVideoElement,\n onDecode: ((result: QrScanner.ScanResult) => void) | ((result: string) => void),\n canvasSizeOrOnDecodeErrorOrOptions?: number | ((error: Error | string) => void) | {\n onDecodeError?: (error: Error | string) => void,\n calculateScanRegion?: (video: HTMLVideoElement) => QrScanner.ScanRegion,\n preferredCamera?: QrScanner.FacingMode | QrScanner.DeviceId,\n maxScansPerSecond?: number;\n highlightScanRegion?: boolean,\n highlightCodeOutline?: boolean,\n overlay?: HTMLDivElement,\n /** just a temporary flag until we switch entirely to the new api */\n returnDetailedScanResult?: true,\n },\n canvasSizeOrCalculateScanRegion?: number | ((video: HTMLVideoElement) => QrScanner.ScanRegion),\n preferredCamera?: QrScanner.FacingMode | QrScanner.DeviceId,\n ) {\n this.$video = video;\n this.$canvas = document.createElement('canvas');\n\n if (canvasSizeOrOnDecodeErrorOrOptions && typeof canvasSizeOrOnDecodeErrorOrOptions === 'object') {\n // we got an options object using the new api\n this._onDecode = onDecode as QrScanner['_onDecode'];\n } else {\n if (canvasSizeOrOnDecodeErrorOrOptions || canvasSizeOrCalculateScanRegion || preferredCamera) {\n console.warn('You\\'re using a deprecated version of the QrScanner constructor which will be removed in '\n + 'the future');\n } else {\n // Only video and onDecode were specified and we can't distinguish between new or old api usage. For\n // backwards compatibility we have to assume the old api for now. The options object is marked as non-\n // optional in the parameter list above to make clear that ScanResult instead of string is only passed\n // if an options object was provided. However, in the future once legacy support is removed, the options\n // object should become optional.\n console.warn('Note that the type of the scan result passed to onDecode will change in the future. '\n + 'To already switch to the new api today, you can pass returnDetailedScanResult: true.');\n }\n this._legacyOnDecode = onDecode as QrScanner['_legacyOnDecode'];\n }\n\n const options = typeof canvasSizeOrOnDecodeErrorOrOptions === 'object'\n ? canvasSizeOrOnDecodeErrorOrOptions\n : {};\n this._onDecodeError = options.onDecodeError || (typeof canvasSizeOrOnDecodeErrorOrOptions === 'function'\n ? canvasSizeOrOnDecodeErrorOrOptions\n : this._onDecodeError);\n this._calculateScanRegion = options.calculateScanRegion || (typeof canvasSizeOrCalculateScanRegion==='function'\n ? canvasSizeOrCalculateScanRegion\n : this._calculateScanRegion);\n this._preferredCamera = options.preferredCamera || preferredCamera || this._preferredCamera;\n this._legacyCanvasSize = typeof canvasSizeOrOnDecodeErrorOrOptions === 'number'\n ? canvasSizeOrOnDecodeErrorOrOptions\n : typeof canvasSizeOrCalculateScanRegion === 'number'\n ? canvasSizeOrCalculateScanRegion\n : this._legacyCanvasSize;\n this._maxScansPerSecond = options.maxScansPerSecond || this._maxScansPerSecond;\n\n this._onPlay = this._onPlay.bind(this);\n this._onLoadedMetaData = this._onLoadedMetaData.bind(this);\n this._onVisibilityChange = this._onVisibilityChange.bind(this);\n this._updateOverlay = this._updateOverlay.bind(this);\n\n // @ts-ignore\n video.disablePictureInPicture = true;\n // Allow inline playback on iPhone instead of requiring full screen playback,\n // see https://webkit.org/blog/6784/new-video-policies-for-ios/\n // @ts-ignore\n video.playsInline = true;\n // Allow play() on iPhone without requiring a user gesture. Should not really be needed as camera stream\n // includes no audio, but just to be safe.\n video.muted = true;\n\n // Avoid Safari stopping the video stream on a hidden video.\n // See https://github.com/cozmo/jsQR/issues/185\n let shouldHideVideo = false;\n if (video.hidden) {\n video.hidden = false;\n shouldHideVideo = true;\n }\n if (!document.body.contains(video)) {\n document.body.appendChild(video);\n shouldHideVideo = true;\n }\n const videoContainer = video.parentElement!;\n\n if (options.highlightScanRegion || options.highlightCodeOutline) {\n const gotExternalOverlay = !!options.overlay;\n this.$overlay = options.overlay || document.createElement('div');\n const overlayStyle = this.$overlay.style;\n overlayStyle.position = 'absolute';\n overlayStyle.display = 'none';\n overlayStyle.pointerEvents = 'none';\n this.$overlay.classList.add('scan-region-highlight');\n if (!gotExternalOverlay && options.highlightScanRegion) {\n // default style; can be overwritten via css, e.g. by changing the svg's stroke color, hiding the\n // .scan-region-highlight-svg, setting a border, outline, background, etc.\n this.$overlay.innerHTML = ''\n + '';\n try {\n this.$overlay.firstElementChild!.animate({ transform: ['scale(.98)', 'scale(1.01)'] }, {\n duration: 400,\n iterations: Infinity,\n direction: 'alternate',\n easing: 'ease-in-out',\n });\n } catch (e) {}\n videoContainer.insertBefore(this.$overlay, this.$video.nextSibling);\n }\n if (options.highlightCodeOutline) {\n // default style; can be overwritten via css\n this.$overlay.insertAdjacentHTML(\n 'beforeend',\n '',\n );\n this.$codeOutlineHighlight = this.$overlay.lastElementChild as SVGSVGElement;\n }\n }\n this._scanRegion = this._calculateScanRegion(video);\n\n requestAnimationFrame(() => {\n // Checking in requestAnimationFrame which should avoid a potential additional re-flow for getComputedStyle.\n const videoStyle = window.getComputedStyle(video);\n if (videoStyle.display === 'none') {\n video.style.setProperty('display', 'block', 'important');\n shouldHideVideo = true;\n }\n if (videoStyle.visibility !== 'visible') {\n video.style.setProperty('visibility', 'visible', 'important');\n shouldHideVideo = true;\n }\n if (shouldHideVideo) {\n // Hide the video in a way that doesn't cause Safari to stop the playback.\n console.warn('QrScanner has overwritten the video hiding style to avoid Safari stopping the playback.');\n video.style.opacity = '0';\n video.style.width = '0';\n video.style.height = '0';\n if (this.$overlay && this.$overlay.parentElement) {\n this.$overlay.parentElement.removeChild(this.$overlay);\n }\n // @ts-ignore\n delete this.$overlay!;\n // @ts-ignore\n delete this.$codeOutlineHighlight!;\n }\n\n if (this.$overlay) {\n this._updateOverlay();\n }\n });\n\n video.addEventListener('play', this._onPlay);\n video.addEventListener('loadedmetadata', this._onLoadedMetaData);\n document.addEventListener('visibilitychange', this._onVisibilityChange);\n window.addEventListener('resize', this._updateOverlay);\n\n this._qrEnginePromise = QrScanner.createQrEngine();\n }\n\n async hasFlash(): Promise {\n let stream: MediaStream | undefined;\n try {\n if (this.$video.srcObject) {\n if (!(this.$video.srcObject instanceof MediaStream)) return false; // srcObject is not a camera stream\n stream = this.$video.srcObject;\n } else {\n stream = (await this._getCameraStream()).stream;\n }\n return 'torch' in stream.getVideoTracks()[0].getSettings();\n } catch (e) {\n return false;\n } finally {\n // close the stream we just opened for detecting whether it supports flash\n if (stream && stream !== this.$video.srcObject) {\n console.warn('Call hasFlash after successfully starting the scanner to avoid creating '\n + 'a temporary video stream');\n QrScanner._stopVideoStream(stream);\n }\n }\n }\n\n isFlashOn(): boolean {\n return this._flashOn;\n }\n\n async toggleFlash(): Promise {\n if (this._flashOn) {\n await this.turnFlashOff();\n } else {\n await this.turnFlashOn();\n }\n }\n\n async turnFlashOn(): Promise {\n if (this._flashOn || this._destroyed) return;\n this._flashOn = true;\n if (!this._active || this._paused) return; // flash will be turned on later on .start()\n try {\n if (!await this.hasFlash()) throw 'No flash available';\n // Note that the video track is guaranteed to exist and to be a MediaStream due to the check in hasFlash\n await (this.$video.srcObject as MediaStream).getVideoTracks()[0].applyConstraints({\n // @ts-ignore: constraint 'torch' is unknown to ts\n advanced: [{ torch: true }],\n });\n } catch (e) {\n this._flashOn = false;\n throw e;\n }\n }\n\n async turnFlashOff(): Promise {\n if (!this._flashOn) return;\n // applyConstraints with torch: false does not work to turn the flashlight off, as a stream's torch stays\n // continuously on, see https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints#torch. Therefore,\n // we have to stop the stream to turn the flashlight off.\n this._flashOn = false;\n await this._restartVideoStream();\n }\n\n destroy(): void {\n this.$video.removeEventListener('loadedmetadata', this._onLoadedMetaData);\n this.$video.removeEventListener('play', this._onPlay);\n document.removeEventListener('visibilitychange', this._onVisibilityChange);\n window.removeEventListener('resize', this._updateOverlay);\n\n this._destroyed = true;\n this._flashOn = false;\n this.stop(); // sets this._paused = true and this._active = false\n QrScanner._postWorkerMessage(this._qrEnginePromise, 'close');\n }\n\n async start(): Promise {\n if (this._destroyed) throw new Error('The QR scanner can not be started as it had been destroyed.');\n if (this._active && !this._paused) return;\n\n if (window.location.protocol !== 'https:') {\n // warn but try starting the camera anyways\n console.warn('The camera stream is only accessible if the page is transferred via https.');\n }\n\n this._active = true;\n if (document.hidden) return; // camera will be started as soon as tab is in foreground\n this._paused = false;\n if (this.$video.srcObject) {\n // camera stream already/still set\n await this.$video.play();\n return;\n }\n\n try {\n const { stream, facingMode } = await this._getCameraStream();\n if (!this._active || this._paused) {\n // was stopped in the meantime\n QrScanner._stopVideoStream(stream);\n return;\n }\n this._setVideoMirror(facingMode);\n this.$video.srcObject = stream;\n await this.$video.play();\n\n // Restart the flash if it was previously on\n if (this._flashOn) {\n this._flashOn = false; // force turnFlashOn to restart the flash\n this.turnFlashOn().catch(() => {});\n }\n } catch (e) {\n if (this._paused) return;\n this._active = false;\n throw e;\n }\n }\n\n stop(): void {\n this.pause();\n this._active = false;\n }\n\n async pause(stopStreamImmediately = false): Promise {\n this._paused = true;\n if (!this._active) return true;\n this.$video.pause();\n\n if (this.$overlay) {\n this.$overlay.style.display = 'none';\n }\n\n const stopStream = () => {\n if (this.$video.srcObject instanceof MediaStream) {\n // revoke srcObject only if it's a stream which was likely set by us\n QrScanner._stopVideoStream(this.$video.srcObject);\n this.$video.srcObject = null;\n }\n };\n\n if (stopStreamImmediately) {\n stopStream();\n return true;\n }\n\n await new Promise((resolve) => setTimeout(resolve, 300));\n if (!this._paused) return false;\n stopStream();\n return true;\n }\n\n async setCamera(facingModeOrDeviceId: QrScanner.FacingMode | QrScanner.DeviceId): Promise {\n if (facingModeOrDeviceId === this._preferredCamera) return;\n this._preferredCamera = facingModeOrDeviceId;\n // Restart the scanner with the new camera which will also update the video mirror and the scan region.\n await this._restartVideoStream();\n }\n\n static async scanImage(\n imageOrFileOrBlobOrUrl: HTMLImageElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas | ImageBitmap\n | SVGImageElement | File | Blob | URL | String,\n options: {\n scanRegion?: QrScanner.ScanRegion | null,\n qrEngine?: Worker | BarcodeDetector | Promise | null,\n canvas?: HTMLCanvasElement | null,\n disallowCanvasResizing?: boolean,\n alsoTryWithoutScanRegion?: boolean,\n /** just a temporary flag until we switch entirely to the new api */\n returnDetailedScanResult?: true,\n },\n ): Promise;\n /** @deprecated */\n static async scanImage(\n imageOrFileOrBlobOrUrl: HTMLImageElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas | ImageBitmap\n | SVGImageElement | File | Blob | URL | String,\n scanRegion?: QrScanner.ScanRegion | null,\n qrEngine?: Worker | BarcodeDetector | Promise | null,\n canvas?: HTMLCanvasElement | null,\n disallowCanvasResizing?: boolean,\n alsoTryWithoutScanRegion?: boolean,\n ): Promise;\n static async scanImage(\n imageOrFileOrBlobOrUrl: HTMLImageElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas | ImageBitmap\n | SVGImageElement | File | Blob | URL | String,\n scanRegionOrOptions?: QrScanner.ScanRegion | {\n scanRegion?: QrScanner.ScanRegion | null,\n qrEngine?: Worker | BarcodeDetector | Promise | null,\n canvas?: HTMLCanvasElement | null,\n disallowCanvasResizing?: boolean,\n alsoTryWithoutScanRegion?: boolean,\n /** just a temporary flag until we switch entirely to the new api */\n returnDetailedScanResult?: true,\n } | null,\n qrEngine?: Worker | BarcodeDetector | Promise | null,\n canvas?: HTMLCanvasElement | null,\n disallowCanvasResizing: boolean = false,\n alsoTryWithoutScanRegion: boolean = false,\n ): Promise {\n let scanRegion: QrScanner.ScanRegion | null | undefined;\n let returnDetailedScanResult = false;\n if (scanRegionOrOptions && (\n 'scanRegion' in scanRegionOrOptions\n || 'qrEngine' in scanRegionOrOptions\n || 'canvas' in scanRegionOrOptions\n || 'disallowCanvasResizing' in scanRegionOrOptions\n || 'alsoTryWithoutScanRegion' in scanRegionOrOptions\n || 'returnDetailedScanResult' in scanRegionOrOptions\n )) {\n // we got an options object using the new api\n scanRegion = scanRegionOrOptions.scanRegion;\n qrEngine = scanRegionOrOptions.qrEngine;\n canvas = scanRegionOrOptions.canvas;\n disallowCanvasResizing = scanRegionOrOptions.disallowCanvasResizing || false;\n alsoTryWithoutScanRegion = scanRegionOrOptions.alsoTryWithoutScanRegion || false;\n returnDetailedScanResult = true;\n } else if (scanRegionOrOptions || qrEngine || canvas || disallowCanvasResizing || alsoTryWithoutScanRegion) {\n console.warn('You\\'re using a deprecated api for scanImage which will be removed in the future.');\n } else {\n // Only imageOrFileOrBlobOrUrl was specified and we can't distinguish between new or old api usage. For\n // backwards compatibility we have to assume the old api for now. The options object is marked as non-\n // optional in the parameter list above to make clear that ScanResult instead of string is only returned if\n // an options object was provided. However, in the future once legacy support is removed, the options object\n // should become optional.\n console.warn('Note that the return type of scanImage will change in the future. To already switch to the '\n + 'new api today, you can pass returnDetailedScanResult: true.');\n }\n\n const gotExternalEngine = !!qrEngine;\n\n try {\n let image: HTMLImageElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas | ImageBitmap\n | SVGImageElement;\n let canvasContext: CanvasRenderingContext2D;\n [qrEngine, image] = await Promise.all([\n qrEngine || QrScanner.createQrEngine(),\n QrScanner._loadImage(imageOrFileOrBlobOrUrl),\n ]);\n [canvas, canvasContext] = QrScanner._drawToCanvas(image, scanRegion, canvas, disallowCanvasResizing);\n let detailedScanResult: QrScanner.ScanResult;\n\n if (qrEngine instanceof Worker) {\n const qrEngineWorker = qrEngine; // for ts to know that it's still a worker later in the event listeners\n if (!gotExternalEngine) {\n // Enable scanning of inverted color qr codes.\n QrScanner._postWorkerMessageSync(qrEngineWorker, 'inversionMode', 'both');\n }\n detailedScanResult = await new Promise((resolve, reject) => {\n let timeout: number;\n let onMessage: (event: MessageEvent) => void;\n let onError: (error: ErrorEvent | string) => void;\n let expectedResponseId = -1;\n onMessage = (event: MessageEvent) => {\n if (event.data.id !== expectedResponseId) {\n return;\n }\n qrEngineWorker.removeEventListener('message', onMessage);\n qrEngineWorker.removeEventListener('error', onError);\n clearTimeout(timeout);\n if (event.data.data !== null) {\n resolve({\n data: event.data.data,\n cornerPoints: QrScanner._convertPoints(event.data.cornerPoints, scanRegion),\n });\n } else {\n reject(QrScanner.NO_QR_CODE_FOUND);\n }\n };\n onError = (error: ErrorEvent | string) => {\n qrEngineWorker.removeEventListener('message', onMessage);\n qrEngineWorker.removeEventListener('error', onError);\n clearTimeout(timeout);\n const errorMessage = !error ? 'Unknown Error' : ((error as ErrorEvent).message || error);\n reject('Scanner error: ' + errorMessage);\n };\n qrEngineWorker.addEventListener('message', onMessage);\n qrEngineWorker.addEventListener('error', onError);\n timeout = setTimeout(() => onError('timeout'), 10000);\n const imageData = canvasContext.getImageData(0, 0, canvas!.width, canvas!.height);\n expectedResponseId = QrScanner._postWorkerMessageSync(\n qrEngineWorker,\n 'decode',\n imageData,\n [imageData.data.buffer],\n );\n });\n } else {\n detailedScanResult = await Promise.race([\n new Promise((resolve, reject) => window.setTimeout(\n () => reject('Scanner error: timeout'),\n 10000,\n )),\n (async (): Promise => {\n try {\n const [scanResult] = await qrEngine.detect(canvas!);\n if (!scanResult) throw QrScanner.NO_QR_CODE_FOUND;\n return {\n data: scanResult.rawValue,\n cornerPoints: QrScanner._convertPoints(scanResult.cornerPoints, scanRegion),\n };\n } catch (e) {\n const errorMessage = (e as Error).message || e as string;\n if (/not implemented|service unavailable/.test(errorMessage)) {\n // Not implemented can apparently for some reason happen even though getSupportedFormats\n // in createQrScanner reported that it's supported, see issue #98.\n // Service unavailable can happen after some time when the BarcodeDetector crashed and\n // can theoretically be recovered from by creating a new BarcodeDetector. However, in\n // newer browsers this issue does not seem to be present anymore and therefore we do not\n // apply this optimization anymore but just set _disableBarcodeDetector in both cases.\n // Also note that if we got an external qrEngine that crashed, we should possibly notify\n // the caller about it, but we also don't do this here, as it's such an unlikely case.\n QrScanner._disableBarcodeDetector = true;\n // retry without passing the broken BarcodeScanner instance\n return QrScanner.scanImage(imageOrFileOrBlobOrUrl, {\n scanRegion,\n canvas,\n disallowCanvasResizing,\n alsoTryWithoutScanRegion,\n });\n }\n throw `Scanner error: ${errorMessage}`;\n }\n })(),\n ]);\n }\n return returnDetailedScanResult ? detailedScanResult : detailedScanResult.data;\n } catch (e) {\n if (!scanRegion || !alsoTryWithoutScanRegion) throw e;\n const detailedScanResult = await QrScanner.scanImage(\n imageOrFileOrBlobOrUrl,\n { qrEngine, canvas, disallowCanvasResizing },\n );\n return returnDetailedScanResult ? detailedScanResult : detailedScanResult.data;\n } finally {\n if (!gotExternalEngine) {\n QrScanner._postWorkerMessage(qrEngine!, 'close');\n }\n }\n }\n\n setGrayscaleWeights(red: number, green: number, blue: number, useIntegerApproximation: boolean = true): void {\n // Note that for the native BarcodeDecoder or if the worker was destroyed, this is a no-op. However, the native\n // implementations work also well with colored qr codes.\n QrScanner._postWorkerMessage(\n this._qrEnginePromise,\n 'grayscaleWeights',\n { red, green, blue, useIntegerApproximation }\n );\n }\n\n setInversionMode(inversionMode: QrScanner.InversionMode): void {\n // Note that for the native BarcodeDecoder or if the worker was destroyed, this is a no-op. However, the native\n // implementations scan normal and inverted qr codes by default\n QrScanner._postWorkerMessage(this._qrEnginePromise, 'inversionMode', inversionMode);\n }\n\n static async createQrEngine(): Promise;\n /** @deprecated */\n static async createQrEngine(workerPath: string): Promise;\n static async createQrEngine(workerPath?: string): Promise {\n if (workerPath) {\n console.warn('Specifying a worker path is not required and not supported anymore.');\n }\n\n // @ts-ignore no types defined for import\n const createWorker = () => (import('./qr-scanner-worker.min.js') as Promise<{ createWorker: () => Worker }>)\n .then((module) => module.createWorker());\n\n const useBarcodeDetector = !QrScanner._disableBarcodeDetector\n && 'BarcodeDetector' in window\n && BarcodeDetector.getSupportedFormats\n && (await BarcodeDetector.getSupportedFormats()).includes('qr_code');\n\n if (!useBarcodeDetector) return createWorker();\n\n // On Macs with an M1/M2 processor and macOS Ventura (macOS version 13), the BarcodeDetector is broken in\n // Chromium based browsers, regardless of the version. For that constellation, the BarcodeDetector does not\n // error but does not detect QR codes. Macs without an M1/M2 or before Ventura are fine.\n // See issue #209 and https://bugs.chromium.org/p/chromium/issues/detail?id=1382442\n // TODO update this once the issue in macOS is fixed\n const userAgentData = navigator.userAgentData;\n const isChromiumOnMacWithArmVentura = userAgentData // all Chromium browsers support userAgentData\n && userAgentData.brands.some(({ brand }) => /Chromium/i.test(brand))\n && /mac ?OS/i.test(userAgentData.platform)\n // Does it have an ARM chip (e.g. M1/M2) and Ventura? Check this last as getHighEntropyValues can\n // theoretically trigger a browser prompt, although no browser currently does seem to show one.\n // If browser or user refused to return the requested values, assume broken ARM Ventura, to be safe.\n && await userAgentData.getHighEntropyValues(['architecture', 'platformVersion'])\n .then(({ architecture, platformVersion }) =>\n /arm/i.test(architecture || 'arm') && parseInt(platformVersion || '13') >= /* Ventura */ 13)\n .catch(() => true);\n if (isChromiumOnMacWithArmVentura) return createWorker();\n\n return new BarcodeDetector({ formats: ['qr_code'] });\n }\n\n private _onPlay(): void {\n this._scanRegion = this._calculateScanRegion(this.$video);\n this._updateOverlay();\n if (this.$overlay) {\n this.$overlay.style.display = '';\n }\n this._scanFrame();\n }\n\n private _onLoadedMetaData(): void {\n this._scanRegion = this._calculateScanRegion(this.$video);\n this._updateOverlay();\n }\n\n private _onVisibilityChange(): void {\n if (document.hidden) {\n this.pause();\n } else if (this._active) {\n this.start();\n }\n }\n\n private _calculateScanRegion(video: HTMLVideoElement): QrScanner.ScanRegion {\n // Default scan region calculation. Note that this can be overwritten in the constructor.\n const smallestDimension = Math.min(video.videoWidth, video.videoHeight);\n const scanRegionSize = Math.round(2 / 3 * smallestDimension);\n return {\n x: Math.round((video.videoWidth - scanRegionSize) / 2),\n y: Math.round((video.videoHeight - scanRegionSize) / 2),\n width: scanRegionSize,\n height: scanRegionSize,\n downScaledWidth: this._legacyCanvasSize,\n downScaledHeight: this._legacyCanvasSize,\n };\n }\n\n private _updateOverlay(): void {\n requestAnimationFrame(() => {\n // Running in requestAnimationFrame which should avoid a potential additional re-flow for getComputedStyle\n // and offsetWidth, offsetHeight, offsetLeft, offsetTop.\n if (!this.$overlay) return;\n const video = this.$video;\n const videoWidth = video.videoWidth;\n const videoHeight = video.videoHeight;\n const elementWidth = video.offsetWidth;\n const elementHeight = video.offsetHeight;\n const elementX = video.offsetLeft;\n const elementY = video.offsetTop;\n\n const videoStyle = window.getComputedStyle(video);\n const videoObjectFit = videoStyle.objectFit;\n const videoAspectRatio = videoWidth / videoHeight;\n const elementAspectRatio = elementWidth / elementHeight;\n let videoScaledWidth: number;\n let videoScaledHeight: number;\n switch (videoObjectFit) {\n case 'none':\n videoScaledWidth = videoWidth;\n videoScaledHeight = videoHeight;\n break;\n case 'fill':\n videoScaledWidth = elementWidth;\n videoScaledHeight = elementHeight;\n break;\n default: // 'cover', 'contains', 'scale-down'\n if (videoObjectFit === 'cover'\n ? videoAspectRatio > elementAspectRatio\n : videoAspectRatio < elementAspectRatio) {\n // The scaled height is the element height\n // - for 'cover' if the video aspect ratio is wider than the element aspect ratio\n // (scaled height matches element height and scaled width overflows element width)\n // - for 'contains'/'scale-down' if element aspect ratio is wider than the video aspect ratio\n // (scaled height matched element height and element width overflows scaled width)\n videoScaledHeight = elementHeight;\n videoScaledWidth = videoScaledHeight * videoAspectRatio;\n } else {\n videoScaledWidth = elementWidth;\n videoScaledHeight = videoScaledWidth / videoAspectRatio;\n }\n if (videoObjectFit === 'scale-down') {\n // for 'scale-down' the dimensions are the minimum of 'contains' and 'none'\n videoScaledWidth = Math.min(videoScaledWidth, videoWidth);\n videoScaledHeight = Math.min(videoScaledHeight, videoHeight);\n }\n }\n\n // getComputedStyle is so nice to convert keywords (left, center, right, top, bottom) to percent and makes\n // sure to set the default of 50% if only one or no component was provided, therefore we can be sure that\n // both components are set. Additionally, it converts units other than px (e.g. rem) to px.\n const [videoX, videoY] = videoStyle.objectPosition.split(' ').map((length, i) => {\n const lengthValue = parseFloat(length);\n return length.endsWith('%')\n ? (!i ? elementWidth - videoScaledWidth : elementHeight - videoScaledHeight) * lengthValue / 100\n : lengthValue;\n });\n\n const regionWidth = this._scanRegion.width || videoWidth;\n const regionHeight = this._scanRegion.height || videoHeight;\n const regionX = this._scanRegion.x || 0;\n const regionY = this._scanRegion.y || 0;\n\n const overlayStyle = this.$overlay.style;\n overlayStyle.width = `${regionWidth / videoWidth * videoScaledWidth}px`;\n overlayStyle.height = `${regionHeight / videoHeight * videoScaledHeight}px`;\n overlayStyle.top = `${elementY + videoY + regionY / videoHeight * videoScaledHeight}px`;\n const isVideoMirrored = /scaleX\\(-1\\)/.test(video.style.transform!);\n overlayStyle.left = `${elementX\n + (isVideoMirrored ? elementWidth - videoX - videoScaledWidth : videoX)\n + (isVideoMirrored ? videoWidth - regionX - regionWidth : regionX) / videoWidth * videoScaledWidth}px`;\n // apply same mirror as on video\n overlayStyle.transform = video.style.transform;\n });\n }\n\n private static _convertPoints(\n points: QrScanner.Point[],\n scanRegion?: QrScanner.ScanRegion | null,\n ): QrScanner.Point[] {\n if (!scanRegion) return points;\n const offsetX = scanRegion.x || 0;\n const offsetY = scanRegion.y || 0;\n const scaleFactorX = scanRegion.width && scanRegion.downScaledWidth\n ? scanRegion.width / scanRegion.downScaledWidth\n : 1;\n const scaleFactorY = scanRegion.height && scanRegion.downScaledHeight\n ? scanRegion.height / scanRegion.downScaledHeight\n : 1;\n for (const point of points) {\n point.x = point.x * scaleFactorX + offsetX;\n point.y = point.y * scaleFactorY + offsetY;\n }\n return points;\n }\n\n private _scanFrame(): void {\n if (!this._active || this.$video.paused || this.$video.ended) return;\n // If requestVideoFrameCallback is available use that to avoid unnecessary scans on the same frame as the\n // camera's framerate can be lower than the screen refresh rate and this._maxScansPerSecond, especially in dark\n // settings where the exposure time is longer. Both, requestVideoFrameCallback and requestAnimationFrame are not\n // being fired if the tab is in the background, which is what we want.\n const requestFrame = 'requestVideoFrameCallback' in this.$video\n // @ts-ignore\n ? this.$video.requestVideoFrameCallback.bind(this.$video)\n : requestAnimationFrame;\n requestFrame(async () => {\n if (this.$video.readyState <= 1) {\n // Skip scans until the video is ready as drawImage() only works correctly on a video with readyState\n // > 1, see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage#Notes.\n // This also avoids false positives for videos paused after a successful scan which remains visible on\n // the canvas until the video is started again and ready.\n this._scanFrame();\n return;\n }\n\n const timeSinceLastScan = Date.now() - this._lastScanTimestamp;\n const minimumTimeBetweenScans = 1000 / this._maxScansPerSecond;\n if (timeSinceLastScan < minimumTimeBetweenScans) {\n await new Promise((resolve) => setTimeout(resolve, minimumTimeBetweenScans - timeSinceLastScan));\n }\n // console.log('Scan rate:', Math.round(1000 / (Date.now() - this._lastScanTimestamp)));\n this._lastScanTimestamp = Date.now();\n\n let result: QrScanner.ScanResult | undefined;\n try {\n result = await QrScanner.scanImage(this.$video, {\n scanRegion: this._scanRegion,\n qrEngine: this._qrEnginePromise,\n canvas: this.$canvas,\n });\n } catch (error) {\n if (!this._active) return;\n this._onDecodeError(error as Error | string);\n }\n\n if (QrScanner._disableBarcodeDetector && !(await this._qrEnginePromise instanceof Worker)) {\n // replace the disabled BarcodeDetector\n this._qrEnginePromise = QrScanner.createQrEngine();\n }\n\n if (result) {\n if (this._onDecode) {\n this._onDecode(result);\n } else if (this._legacyOnDecode) {\n this._legacyOnDecode(result.data);\n }\n\n if (this.$codeOutlineHighlight) {\n clearTimeout(this._codeOutlineHighlightRemovalTimeout);\n this._codeOutlineHighlightRemovalTimeout = undefined;\n this.$codeOutlineHighlight.setAttribute(\n 'viewBox',\n `${this._scanRegion.x || 0} `\n + `${this._scanRegion.y || 0} `\n + `${this._scanRegion.width || this.$video.videoWidth} `\n + `${this._scanRegion.height || this.$video.videoHeight}`,\n );\n const polygon = this.$codeOutlineHighlight.firstElementChild!;\n polygon.setAttribute('points', result.cornerPoints.map(({x, y}) => `${x},${y}`).join(' '));\n this.$codeOutlineHighlight.style.display = '';\n }\n } else if (this.$codeOutlineHighlight && !this._codeOutlineHighlightRemovalTimeout) {\n // hide after timeout to make it flash less when on some frames the QR code is detected and on some not\n this._codeOutlineHighlightRemovalTimeout = setTimeout(\n () => this.$codeOutlineHighlight!.style.display = 'none',\n 100,\n );\n }\n\n this._scanFrame();\n });\n }\n\n private _onDecodeError(error: Error | string): void {\n // default error handler; can be overwritten in the constructor\n if (error === QrScanner.NO_QR_CODE_FOUND) return;\n console.log(error);\n }\n\n private async _getCameraStream(): Promise<{ stream: MediaStream, facingMode: QrScanner.FacingMode }> {\n if (!navigator.mediaDevices) throw 'Camera not found.';\n\n const preferenceType = /^(environment|user)$/.test(this._preferredCamera)\n ? 'facingMode'\n : 'deviceId';\n const constraintsWithoutCamera: Array = [{\n width: { min: 1024 }\n }, {\n width: { min: 768 }\n }, {}];\n const constraintsWithCamera = constraintsWithoutCamera.map((constraint) => Object.assign({}, constraint, {\n [preferenceType]: { exact: this._preferredCamera },\n }));\n\n for (const constraints of [...constraintsWithCamera, ...constraintsWithoutCamera]) {\n try {\n const stream = await navigator.mediaDevices.getUserMedia({ video: constraints, audio: false });\n // Try to determine the facing mode from the stream, otherwise use a guess or 'environment' as\n // default. Note that the guess is not always accurate as Safari returns cameras of different facing\n // mode, even for exact facingMode constraints.\n const facingMode = this._getFacingMode(stream)\n || (constraints.facingMode\n ? this._preferredCamera as QrScanner.FacingMode // a facing mode we were able to fulfill\n : (this._preferredCamera === 'environment'\n ? 'user' // switch as _preferredCamera was environment but we are not able to fulfill it\n : 'environment' // switch from unfulfilled user facingMode or default to environment\n )\n );\n return { stream, facingMode };\n } catch (e) {}\n }\n\n throw 'Camera not found.';\n }\n\n private async _restartVideoStream(): Promise {\n // Note that we always pause the stream and not only if !this._paused as even if this._paused === true, the\n // stream might still be running, as it's by default only stopped after a delay of 300ms.\n const wasPaused = this._paused;\n const paused = await this.pause(true);\n if (!paused || wasPaused || !this._active) return;\n await this.start();\n }\n\n private static _stopVideoStream(stream : MediaStream): void {\n for (const track of stream.getTracks()) {\n track.stop(); // note that this will also automatically turn the flashlight off\n stream.removeTrack(track);\n }\n }\n\n private _setVideoMirror(facingMode: QrScanner.FacingMode): void {\n // in user facing mode mirror the video to make it easier for the user to position the QR code\n const scaleFactor = facingMode === 'user'? -1 : 1;\n this.$video.style.transform = 'scaleX(' + scaleFactor + ')';\n }\n\n private _getFacingMode(videoStream: MediaStream): QrScanner.FacingMode | null {\n const videoTrack = videoStream.getVideoTracks()[0];\n if (!videoTrack) return null; // unknown\n // inspired by https://github.com/JodusNodus/react-qr-reader/blob/master/src/getDeviceId.js#L13\n return /rear|back|environment/i.test(videoTrack.label)\n ? 'environment'\n : /front|user|face/i.test(videoTrack.label)\n ? 'user'\n : null; // unknown\n }\n\n private static _drawToCanvas(\n image: HTMLImageElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas | ImageBitmap\n | SVGImageElement,\n scanRegion?: QrScanner.ScanRegion | null,\n canvas?: HTMLCanvasElement | null,\n disallowCanvasResizing= false,\n ): [HTMLCanvasElement, CanvasRenderingContext2D] {\n canvas = canvas || document.createElement('canvas');\n const scanRegionX = scanRegion && scanRegion.x ? scanRegion.x : 0;\n const scanRegionY = scanRegion && scanRegion.y ? scanRegion.y : 0;\n const scanRegionWidth = scanRegion && scanRegion.width\n ? scanRegion.width\n : (image as HTMLVideoElement).videoWidth || image.width as number;\n const scanRegionHeight = scanRegion && scanRegion.height\n ? scanRegion.height\n : (image as HTMLVideoElement).videoHeight || image.height as number;\n\n if (!disallowCanvasResizing) {\n const canvasWidth = scanRegion && scanRegion.downScaledWidth\n ? scanRegion.downScaledWidth\n : scanRegionWidth;\n const canvasHeight = scanRegion && scanRegion.downScaledHeight\n ? scanRegion.downScaledHeight\n : scanRegionHeight;\n // Setting the canvas width or height clears the canvas, even if the values didn't change, therefore only\n // set them if they actually changed.\n if (canvas.width !== canvasWidth) {\n canvas.width = canvasWidth;\n }\n if (canvas.height !== canvasHeight) {\n canvas.height = canvasHeight;\n }\n }\n\n const context = canvas.getContext('2d', { alpha: false })!;\n context.imageSmoothingEnabled = false; // gives less blurry images\n context.drawImage(\n image,\n scanRegionX, scanRegionY, scanRegionWidth, scanRegionHeight,\n 0, 0, canvas.width, canvas.height,\n );\n return [canvas, context];\n }\n\n private static async _loadImage(\n imageOrFileOrBlobOrUrl: HTMLImageElement | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas | ImageBitmap\n | SVGImageElement | File | Blob | URL | String,\n ): Promise {\n if (imageOrFileOrBlobOrUrl instanceof Image) {\n await QrScanner._awaitImageLoad(imageOrFileOrBlobOrUrl);\n return imageOrFileOrBlobOrUrl;\n } else if (imageOrFileOrBlobOrUrl instanceof HTMLVideoElement\n || imageOrFileOrBlobOrUrl instanceof HTMLCanvasElement\n || imageOrFileOrBlobOrUrl instanceof SVGImageElement\n || 'OffscreenCanvas' in window && imageOrFileOrBlobOrUrl instanceof OffscreenCanvas\n || 'ImageBitmap' in window && imageOrFileOrBlobOrUrl instanceof ImageBitmap) {\n return imageOrFileOrBlobOrUrl;\n } else if (imageOrFileOrBlobOrUrl instanceof File || imageOrFileOrBlobOrUrl instanceof Blob\n || imageOrFileOrBlobOrUrl instanceof URL || typeof imageOrFileOrBlobOrUrl === 'string') {\n const image = new Image();\n if (imageOrFileOrBlobOrUrl instanceof File || imageOrFileOrBlobOrUrl instanceof Blob) {\n image.src = URL.createObjectURL(imageOrFileOrBlobOrUrl);\n } else {\n image.src = imageOrFileOrBlobOrUrl.toString();\n }\n try {\n await QrScanner._awaitImageLoad(image);\n return image;\n } finally {\n if (imageOrFileOrBlobOrUrl instanceof File || imageOrFileOrBlobOrUrl instanceof Blob) {\n URL.revokeObjectURL(image.src);\n }\n }\n } else {\n throw 'Unsupported image type.';\n }\n }\n\n private static async _awaitImageLoad(image: HTMLImageElement): Promise {\n if (image.complete && image.naturalWidth !== 0) return; // already loaded\n await new Promise((resolve, reject) => {\n const listener = (event: ErrorEvent | Event) => {\n image.removeEventListener('load', listener);\n image.removeEventListener('error', listener);\n if (event instanceof ErrorEvent) {\n reject('Image load error');\n } else {\n resolve();\n }\n };\n image.addEventListener('load', listener);\n image.addEventListener('error', listener);\n });\n }\n\n private static async _postWorkerMessage(\n qrEngineOrQrEnginePromise: Worker | BarcodeDetector | Promise,\n type: string,\n data?: any,\n transfer?: Transferable[],\n ): Promise {\n return QrScanner._postWorkerMessageSync(await qrEngineOrQrEnginePromise, type, data, transfer);\n }\n\n // sync version of _postWorkerMessage without performance overhead of async functions\n private static _postWorkerMessageSync(\n qrEngine: Worker | BarcodeDetector,\n type: string,\n data?: any,\n transfer?: Transferable[],\n ): number {\n if (!(qrEngine instanceof Worker)) return -1;\n const id = QrScanner._workerMessageId++;\n qrEngine.postMessage({\n id,\n type,\n data,\n }, transfer);\n return id;\n }\n}\n\ndeclare namespace QrScanner {\n export interface ScanRegion {\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n downScaledWidth?: number;\n downScaledHeight?: number;\n }\n\n export type FacingMode = 'environment' | 'user';\n export type DeviceId = string;\n\n export interface Camera {\n id: DeviceId;\n label: string;\n }\n\n export type InversionMode = 'original' | 'invert' | 'both';\n\n export interface Point {\n x: number;\n y: number;\n }\n\n export interface ScanResult {\n data: string;\n // In clockwise order, starting at top left, but this might not be guaranteed in the future.\n cornerPoints: QrScanner.Point[];\n }\n}\n\n// simplified from https://wicg.github.io/shape-detection-api/#barcode-detection-api\ndeclare class BarcodeDetector {\n constructor(options?: { formats: string[] });\n static getSupportedFormats(): Promise;\n detect(image: ImageBitmapSource): Promise>;\n}\n\n// simplified from https://github.com/lukewarlow/user-agent-data-types/blob/master/index.d.ts\ndeclare global {\n interface Navigator {\n readonly userAgentData?: {\n readonly platform: string;\n readonly brands: Array<{\n readonly brand: string;\n readonly version: string;\n }>;\n getHighEntropyValues(hints: string[]): Promise<{\n readonly architecture?: string;\n readonly platformVersion?: string;\n }>;\n };\n }\n}\n\nexport default QrScanner;\n", "'use strict';\n\nvar ms = {};\n\nfunction getItem (key) {\n return key in ms ? ms[key] : null;\n}\n\nfunction setItem (key, value) {\n ms[key] = value;\n return true;\n}\n\nfunction removeItem (key) {\n var found = key in ms;\n if (found) {\n return delete ms[key];\n }\n return false;\n}\n\nfunction clear () {\n ms = {};\n return true;\n}\n\nmodule.exports = {\n getItem: getItem,\n setItem: setItem,\n removeItem: removeItem,\n clear: clear\n};\n", "'use strict';\n\nfunction parse (rawValue) {\n const parsed = parseValue(rawValue);\n\n if (parsed === undefined) {\n return null;\n }\n\n return parsed;\n}\n\nfunction parseValue (rawValue) {\n try {\n return JSON.parse(rawValue);\n } catch (err) {\n return rawValue;\n }\n}\n\nmodule.exports = parse;\n", "'use strict';\n\nvar parse = require('./parse');\nvar listeners = {};\nvar listening = false;\n\nfunction listen () {\n if (global.addEventListener) {\n global.addEventListener('storage', change, false);\n } else if (global.attachEvent) {\n global.attachEvent('onstorage', change);\n } else {\n global.onstorage = change;\n }\n}\n\nfunction change (e) {\n if (!e) {\n e = global.event;\n }\n var all = listeners[e.key];\n if (all) {\n all.forEach(fire);\n }\n\n function fire (listener) {\n listener(parse(e.newValue), parse(e.oldValue), e.url || e.uri);\n }\n}\n\nfunction on (key, fn) {\n if (listeners[key]) {\n listeners[key].push(fn);\n } else {\n listeners[key] = [fn];\n }\n if (listening === false) {\n listen();\n }\n}\n\nfunction off (key, fn) {\n var ns = listeners[key];\n if (ns.length > 1) {\n ns.splice(ns.indexOf(fn), 1);\n } else {\n listeners[key] = [];\n }\n}\n\nmodule.exports = {\n on: on,\n off: off\n};\n", "'use strict';\n\nvar stub = require('./stub');\nvar parse = require('./parse');\nvar tracking = require('./tracking');\nvar ls = 'localStorage' in global && global.localStorage ? global.localStorage : stub;\n\nfunction accessor (key, value) {\n if (arguments.length === 1) {\n return get(key);\n }\n return set(key, value);\n}\n\nfunction get (key) {\n const raw = ls.getItem(key);\n const parsed = parse(raw);\n return parsed;\n}\n\nfunction set (key, value) {\n try {\n ls.setItem(key, JSON.stringify(value));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction remove (key) {\n return ls.removeItem(key);\n}\n\nfunction clear () {\n return ls.clear();\n}\n\nfunction backend (store) {\n store && (ls = store);\n\n return ls;\n}\n\naccessor.set = set;\naccessor.get = get;\naccessor.remove = remove;\naccessor.clear = clear;\naccessor.backend = backend;\naccessor.on = tracking.on;\naccessor.off = tracking.off;\n\nmodule.exports = accessor;\n", "// THIS FILE IS GENERATED - DO NOT EDIT!\n/*!mobile-detect v1.4.5 2021-03-13*/\n/*global module:false, define:false*/\n/*jshint latedef:false*/\n/*!@license Copyright 2013, Heinrich Goebl, License: MIT, see https://github.com/hgoebl/mobile-detect.js*/\n(function (define, undefined) {\ndefine(function () {\n 'use strict';\n\n var impl = {};\n\n impl.mobileDetectRules = {\n \"phones\": {\n \"iPhone\": \"\\\\biPhone\\\\b|\\\\biPod\\\\b\",\n \"BlackBerry\": \"BlackBerry|\\\\bBB10\\\\b|rim[0-9]+|\\\\b(BBA100|BBB100|BBD100|BBE100|BBF100|STH100)\\\\b-[0-9]+\",\n \"Pixel\": \"; \\\\bPixel\\\\b\",\n \"HTC\": \"HTC|HTC.*(Sensation|Evo|Vision|Explorer|6800|8100|8900|A7272|S510e|C110e|Legend|Desire|T8282)|APX515CKT|Qtek9090|APA9292KT|HD_mini|Sensation.*Z710e|PG86100|Z715e|Desire.*(A8181|HD)|ADR6200|ADR6400L|ADR6425|001HT|Inspire 4G|Android.*\\\\bEVO\\\\b|T-Mobile G1|Z520m|Android [0-9.]+; Pixel\",\n \"Nexus\": \"Nexus One|Nexus S|Galaxy.*Nexus|Android.*Nexus.*Mobile|Nexus 4|Nexus 5|Nexus 5X|Nexus 6\",\n \"Dell\": \"Dell[;]? (Streak|Aero|Venue|Venue Pro|Flash|Smoke|Mini 3iX)|XCD28|XCD35|\\\\b001DL\\\\b|\\\\b101DL\\\\b|\\\\bGS01\\\\b\",\n \"Motorola\": \"Motorola|DROIDX|DROID BIONIC|\\\\bDroid\\\\b.*Build|Android.*Xoom|HRI39|MOT-|A1260|A1680|A555|A853|A855|A953|A955|A956|Motorola.*ELECTRIFY|Motorola.*i1|i867|i940|MB200|MB300|MB501|MB502|MB508|MB511|MB520|MB525|MB526|MB611|MB612|MB632|MB810|MB855|MB860|MB861|MB865|MB870|ME501|ME502|ME511|ME525|ME600|ME632|ME722|ME811|ME860|ME863|ME865|MT620|MT710|MT716|MT720|MT810|MT870|MT917|Motorola.*TITANIUM|WX435|WX445|XT300|XT301|XT311|XT316|XT317|XT319|XT320|XT390|XT502|XT530|XT531|XT532|XT535|XT603|XT610|XT611|XT615|XT681|XT701|XT702|XT711|XT720|XT800|XT806|XT860|XT862|XT875|XT882|XT883|XT894|XT901|XT907|XT909|XT910|XT912|XT928|XT926|XT915|XT919|XT925|XT1021|\\\\bMoto E\\\\b|XT1068|XT1092|XT1052\",\n \"Samsung\": \"\\\\bSamsung\\\\b|SM-G950F|SM-G955F|SM-G9250|GT-19300|SGH-I337|BGT-S5230|GT-B2100|GT-B2700|GT-B2710|GT-B3210|GT-B3310|GT-B3410|GT-B3730|GT-B3740|GT-B5510|GT-B5512|GT-B5722|GT-B6520|GT-B7300|GT-B7320|GT-B7330|GT-B7350|GT-B7510|GT-B7722|GT-B7800|GT-C3010|GT-C3011|GT-C3060|GT-C3200|GT-C3212|GT-C3212I|GT-C3262|GT-C3222|GT-C3300|GT-C3300K|GT-C3303|GT-C3303K|GT-C3310|GT-C3322|GT-C3330|GT-C3350|GT-C3500|GT-C3510|GT-C3530|GT-C3630|GT-C3780|GT-C5010|GT-C5212|GT-C6620|GT-C6625|GT-C6712|GT-E1050|GT-E1070|GT-E1075|GT-E1080|GT-E1081|GT-E1085|GT-E1087|GT-E1100|GT-E1107|GT-E1110|GT-E1120|GT-E1125|GT-E1130|GT-E1160|GT-E1170|GT-E1175|GT-E1180|GT-E1182|GT-E1200|GT-E1210|GT-E1225|GT-E1230|GT-E1390|GT-E2100|GT-E2120|GT-E2121|GT-E2152|GT-E2220|GT-E2222|GT-E2230|GT-E2232|GT-E2250|GT-E2370|GT-E2550|GT-E2652|GT-E3210|GT-E3213|GT-I5500|GT-I5503|GT-I5700|GT-I5800|GT-I5801|GT-I6410|GT-I6420|GT-I7110|GT-I7410|GT-I7500|GT-I8000|GT-I8150|GT-I8160|GT-I8190|GT-I8320|GT-I8330|GT-I8350|GT-I8530|GT-I8700|GT-I8703|GT-I8910|GT-I9000|GT-I9001|GT-I9003|GT-I9010|GT-I9020|GT-I9023|GT-I9070|GT-I9082|GT-I9100|GT-I9103|GT-I9220|GT-I9250|GT-I9300|GT-I9305|GT-I9500|GT-I9505|GT-M3510|GT-M5650|GT-M7500|GT-M7600|GT-M7603|GT-M8800|GT-M8910|GT-N7000|GT-S3110|GT-S3310|GT-S3350|GT-S3353|GT-S3370|GT-S3650|GT-S3653|GT-S3770|GT-S3850|GT-S5210|GT-S5220|GT-S5229|GT-S5230|GT-S5233|GT-S5250|GT-S5253|GT-S5260|GT-S5263|GT-S5270|GT-S5300|GT-S5330|GT-S5350|GT-S5360|GT-S5363|GT-S5369|GT-S5380|GT-S5380D|GT-S5560|GT-S5570|GT-S5600|GT-S5603|GT-S5610|GT-S5620|GT-S5660|GT-S5670|GT-S5690|GT-S5750|GT-S5780|GT-S5830|GT-S5839|GT-S6102|GT-S6500|GT-S7070|GT-S7200|GT-S7220|GT-S7230|GT-S7233|GT-S7250|GT-S7500|GT-S7530|GT-S7550|GT-S7562|GT-S7710|GT-S8000|GT-S8003|GT-S8500|GT-S8530|GT-S8600|SCH-A310|SCH-A530|SCH-A570|SCH-A610|SCH-A630|SCH-A650|SCH-A790|SCH-A795|SCH-A850|SCH-A870|SCH-A890|SCH-A930|SCH-A950|SCH-A970|SCH-A990|SCH-I100|SCH-I110|SCH-I400|SCH-I405|SCH-I500|SCH-I510|SCH-I515|SCH-I600|SCH-I730|SCH-I760|SCH-I770|SCH-I830|SCH-I910|SCH-I920|SCH-I959|SCH-LC11|SCH-N150|SCH-N300|SCH-R100|SCH-R300|SCH-R351|SCH-R400|SCH-R410|SCH-T300|SCH-U310|SCH-U320|SCH-U350|SCH-U360|SCH-U365|SCH-U370|SCH-U380|SCH-U410|SCH-U430|SCH-U450|SCH-U460|SCH-U470|SCH-U490|SCH-U540|SCH-U550|SCH-U620|SCH-U640|SCH-U650|SCH-U660|SCH-U700|SCH-U740|SCH-U750|SCH-U810|SCH-U820|SCH-U900|SCH-U940|SCH-U960|SCS-26UC|SGH-A107|SGH-A117|SGH-A127|SGH-A137|SGH-A157|SGH-A167|SGH-A177|SGH-A187|SGH-A197|SGH-A227|SGH-A237|SGH-A257|SGH-A437|SGH-A517|SGH-A597|SGH-A637|SGH-A657|SGH-A667|SGH-A687|SGH-A697|SGH-A707|SGH-A717|SGH-A727|SGH-A737|SGH-A747|SGH-A767|SGH-A777|SGH-A797|SGH-A817|SGH-A827|SGH-A837|SGH-A847|SGH-A867|SGH-A877|SGH-A887|SGH-A897|SGH-A927|SGH-B100|SGH-B130|SGH-B200|SGH-B220|SGH-C100|SGH-C110|SGH-C120|SGH-C130|SGH-C140|SGH-C160|SGH-C170|SGH-C180|SGH-C200|SGH-C207|SGH-C210|SGH-C225|SGH-C230|SGH-C417|SGH-C450|SGH-D307|SGH-D347|SGH-D357|SGH-D407|SGH-D415|SGH-D780|SGH-D807|SGH-D980|SGH-E105|SGH-E200|SGH-E315|SGH-E316|SGH-E317|SGH-E335|SGH-E590|SGH-E635|SGH-E715|SGH-E890|SGH-F300|SGH-F480|SGH-I200|SGH-I300|SGH-I320|SGH-I550|SGH-I577|SGH-I600|SGH-I607|SGH-I617|SGH-I627|SGH-I637|SGH-I677|SGH-I700|SGH-I717|SGH-I727|SGH-i747M|SGH-I777|SGH-I780|SGH-I827|SGH-I847|SGH-I857|SGH-I896|SGH-I897|SGH-I900|SGH-I907|SGH-I917|SGH-I927|SGH-I937|SGH-I997|SGH-J150|SGH-J200|SGH-L170|SGH-L700|SGH-M110|SGH-M150|SGH-M200|SGH-N105|SGH-N500|SGH-N600|SGH-N620|SGH-N625|SGH-N700|SGH-N710|SGH-P107|SGH-P207|SGH-P300|SGH-P310|SGH-P520|SGH-P735|SGH-P777|SGH-Q105|SGH-R210|SGH-R220|SGH-R225|SGH-S105|SGH-S307|SGH-T109|SGH-T119|SGH-T139|SGH-T209|SGH-T219|SGH-T229|SGH-T239|SGH-T249|SGH-T259|SGH-T309|SGH-T319|SGH-T329|SGH-T339|SGH-T349|SGH-T359|SGH-T369|SGH-T379|SGH-T409|SGH-T429|SGH-T439|SGH-T459|SGH-T469|SGH-T479|SGH-T499|SGH-T509|SGH-T519|SGH-T539|SGH-T559|SGH-T589|SGH-T609|SGH-T619|SGH-T629|SGH-T639|SGH-T659|SGH-T669|SGH-T679|SGH-T709|SGH-T719|SGH-T729|SGH-T739|SGH-T746|SGH-T749|SGH-T759|SGH-T769|SGH-T809|SGH-T819|SGH-T839|SGH-T919|SGH-T929|SGH-T939|SGH-T959|SGH-T989|SGH-U100|SGH-U200|SGH-U800|SGH-V205|SGH-V206|SGH-X100|SGH-X105|SGH-X120|SGH-X140|SGH-X426|SGH-X427|SGH-X475|SGH-X495|SGH-X497|SGH-X507|SGH-X600|SGH-X610|SGH-X620|SGH-X630|SGH-X700|SGH-X820|SGH-X890|SGH-Z130|SGH-Z150|SGH-Z170|SGH-ZX10|SGH-ZX20|SHW-M110|SPH-A120|SPH-A400|SPH-A420|SPH-A460|SPH-A500|SPH-A560|SPH-A600|SPH-A620|SPH-A660|SPH-A700|SPH-A740|SPH-A760|SPH-A790|SPH-A800|SPH-A820|SPH-A840|SPH-A880|SPH-A900|SPH-A940|SPH-A960|SPH-D600|SPH-D700|SPH-D710|SPH-D720|SPH-I300|SPH-I325|SPH-I330|SPH-I350|SPH-I500|SPH-I600|SPH-I700|SPH-L700|SPH-M100|SPH-M220|SPH-M240|SPH-M300|SPH-M305|SPH-M320|SPH-M330|SPH-M350|SPH-M360|SPH-M370|SPH-M380|SPH-M510|SPH-M540|SPH-M550|SPH-M560|SPH-M570|SPH-M580|SPH-M610|SPH-M620|SPH-M630|SPH-M800|SPH-M810|SPH-M850|SPH-M900|SPH-M910|SPH-M920|SPH-M930|SPH-N100|SPH-N200|SPH-N240|SPH-N300|SPH-N400|SPH-Z400|SWC-E100|SCH-i909|GT-N7100|GT-N7105|SCH-I535|SM-N900A|SGH-I317|SGH-T999L|GT-S5360B|GT-I8262|GT-S6802|GT-S6312|GT-S6310|GT-S5312|GT-S5310|GT-I9105|GT-I8510|GT-S6790N|SM-G7105|SM-N9005|GT-S5301|GT-I9295|GT-I9195|SM-C101|GT-S7392|GT-S7560|GT-B7610|GT-I5510|GT-S7582|GT-S7530E|GT-I8750|SM-G9006V|SM-G9008V|SM-G9009D|SM-G900A|SM-G900D|SM-G900F|SM-G900H|SM-G900I|SM-G900J|SM-G900K|SM-G900L|SM-G900M|SM-G900P|SM-G900R4|SM-G900S|SM-G900T|SM-G900V|SM-G900W8|SHV-E160K|SCH-P709|SCH-P729|SM-T2558|GT-I9205|SM-G9350|SM-J120F|SM-G920F|SM-G920V|SM-G930F|SM-N910C|SM-A310F|GT-I9190|SM-J500FN|SM-G903F|SM-J330F|SM-G610F|SM-G981B|SM-G892A|SM-A530F\",\n \"LG\": \"\\\\bLG\\\\b;|LG[- ]?(C800|C900|E400|E610|E900|E-900|F160|F180K|F180L|F180S|730|855|L160|LS740|LS840|LS970|LU6200|MS690|MS695|MS770|MS840|MS870|MS910|P500|P700|P705|VM696|AS680|AS695|AX840|C729|E970|GS505|272|C395|E739BK|E960|L55C|L75C|LS696|LS860|P769BK|P350|P500|P509|P870|UN272|US730|VS840|VS950|LN272|LN510|LS670|LS855|LW690|MN270|MN510|P509|P769|P930|UN200|UN270|UN510|UN610|US670|US740|US760|UX265|UX840|VN271|VN530|VS660|VS700|VS740|VS750|VS910|VS920|VS930|VX9200|VX11000|AX840A|LW770|P506|P925|P999|E612|D955|D802|MS323|M257)|LM-G710\",\n \"Sony\": \"SonyST|SonyLT|SonyEricsson|SonyEricssonLT15iv|LT18i|E10i|LT28h|LT26w|SonyEricssonMT27i|C5303|C6902|C6903|C6906|C6943|D2533|SOV34|601SO|F8332\",\n \"Asus\": \"Asus.*Galaxy|PadFone.*Mobile\",\n \"Xiaomi\": \"^(?!.*\\\\bx11\\\\b).*xiaomi.*$|POCOPHONE F1|MI 8|Redmi Note 9S|Redmi Note 5A Prime|N2G47H|M2001J2G|M2001J2I|M1805E10A|M2004J11G|M1902F1G|M2002J9G|M2004J19G|M2003J6A1G\",\n \"NokiaLumia\": \"Lumia [0-9]{3,4}\",\n \"Micromax\": \"Micromax.*\\\\b(A210|A92|A88|A72|A111|A110Q|A115|A116|A110|A90S|A26|A51|A35|A54|A25|A27|A89|A68|A65|A57|A90)\\\\b\",\n \"Palm\": \"PalmSource|Palm\",\n \"Vertu\": \"Vertu|Vertu.*Ltd|Vertu.*Ascent|Vertu.*Ayxta|Vertu.*Constellation(F|Quest)?|Vertu.*Monika|Vertu.*Signature\",\n \"Pantech\": \"PANTECH|IM-A850S|IM-A840S|IM-A830L|IM-A830K|IM-A830S|IM-A820L|IM-A810K|IM-A810S|IM-A800S|IM-T100K|IM-A725L|IM-A780L|IM-A775C|IM-A770K|IM-A760S|IM-A750K|IM-A740S|IM-A730S|IM-A720L|IM-A710K|IM-A690L|IM-A690S|IM-A650S|IM-A630K|IM-A600S|VEGA PTL21|PT003|P8010|ADR910L|P6030|P6020|P9070|P4100|P9060|P5000|CDM8992|TXT8045|ADR8995|IS11PT|P2030|P6010|P8000|PT002|IS06|CDM8999|P9050|PT001|TXT8040|P2020|P9020|P2000|P7040|P7000|C790\",\n \"Fly\": \"IQ230|IQ444|IQ450|IQ440|IQ442|IQ441|IQ245|IQ256|IQ236|IQ255|IQ235|IQ245|IQ275|IQ240|IQ285|IQ280|IQ270|IQ260|IQ250\",\n \"Wiko\": \"KITE 4G|HIGHWAY|GETAWAY|STAIRWAY|DARKSIDE|DARKFULL|DARKNIGHT|DARKMOON|SLIDE|WAX 4G|RAINBOW|BLOOM|SUNSET|GOA(?!nna)|LENNY|BARRY|IGGY|OZZY|CINK FIVE|CINK PEAX|CINK PEAX 2|CINK SLIM|CINK SLIM 2|CINK +|CINK KING|CINK PEAX|CINK SLIM|SUBLIM\",\n \"iMobile\": \"i-mobile (IQ|i-STYLE|idea|ZAA|Hitz)\",\n \"SimValley\": \"\\\\b(SP-80|XT-930|SX-340|XT-930|SX-310|SP-360|SP60|SPT-800|SP-120|SPT-800|SP-140|SPX-5|SPX-8|SP-100|SPX-8|SPX-12)\\\\b\",\n \"Wolfgang\": \"AT-B24D|AT-AS50HD|AT-AS40W|AT-AS55HD|AT-AS45q2|AT-B26D|AT-AS50Q\",\n \"Alcatel\": \"Alcatel\",\n \"Nintendo\": \"Nintendo (3DS|Switch)\",\n \"Amoi\": \"Amoi\",\n \"INQ\": \"INQ\",\n \"OnePlus\": \"ONEPLUS\",\n \"GenericPhone\": \"Tapatalk|PDA;|SAGEM|\\\\bmmp\\\\b|pocket|\\\\bpsp\\\\b|symbian|Smartphone|smartfon|treo|up.browser|up.link|vodafone|\\\\bwap\\\\b|nokia|Series40|Series60|S60|SonyEricsson|N900|MAUI.*WAP.*Browser\"\n },\n \"tablets\": {\n \"iPad\": \"iPad|iPad.*Mobile\",\n \"NexusTablet\": \"Android.*Nexus[\\\\s]+(7|9|10)\",\n \"GoogleTablet\": \"Android.*Pixel C\",\n \"SamsungTablet\": \"SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P1000|GT-P1003|GT-P1010|GT-P3105|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P3100|GT-P3108|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7320|GT-P7511|GT-N8000|GT-P8510|SGH-I497|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-P3113|GT-P5113|GT-P8110|GT-N8010|GT-N8005|GT-N8020|GT-P1013|GT-P6201|GT-P7501|GT-N5100|GT-N5105|GT-N5110|SHV-E140K|SHV-E140L|SHV-E140S|SHV-E150S|SHV-E230K|SHV-E230L|SHV-E230S|SHW-M180K|SHW-M180L|SHW-M180S|SHW-M180W|SHW-M300W|SHW-M305W|SHW-M380K|SHW-M380S|SHW-M380W|SHW-M430W|SHW-M480K|SHW-M480S|SHW-M480W|SHW-M485W|SHW-M486W|SHW-M500W|GT-I9228|SCH-P739|SCH-I925|GT-I9200|GT-P5200|GT-P5210|GT-P5210X|SM-T311|SM-T310|SM-T310X|SM-T210|SM-T210R|SM-T211|SM-P600|SM-P601|SM-P605|SM-P900|SM-P901|SM-T217|SM-T217A|SM-T217S|SM-P6000|SM-T3100|SGH-I467|XE500|SM-T110|GT-P5220|GT-I9200X|GT-N5110X|GT-N5120|SM-P905|SM-T111|SM-T2105|SM-T315|SM-T320|SM-T320X|SM-T321|SM-T520|SM-T525|SM-T530NU|SM-T230NU|SM-T330NU|SM-T900|XE500T1C|SM-P605V|SM-P905V|SM-T337V|SM-T537V|SM-T707V|SM-T807V|SM-P600X|SM-P900X|SM-T210X|SM-T230|SM-T230X|SM-T325|GT-P7503|SM-T531|SM-T330|SM-T530|SM-T705|SM-T705C|SM-T535|SM-T331|SM-T800|SM-T700|SM-T537|SM-T807|SM-P907A|SM-T337A|SM-T537A|SM-T707A|SM-T807A|SM-T237|SM-T807P|SM-P607T|SM-T217T|SM-T337T|SM-T807T|SM-T116NQ|SM-T116BU|SM-P550|SM-T350|SM-T550|SM-T9000|SM-P9000|SM-T705Y|SM-T805|GT-P3113|SM-T710|SM-T810|SM-T815|SM-T360|SM-T533|SM-T113|SM-T335|SM-T715|SM-T560|SM-T670|SM-T677|SM-T377|SM-T567|SM-T357T|SM-T555|SM-T561|SM-T713|SM-T719|SM-T813|SM-T819|SM-T580|SM-T355Y?|SM-T280|SM-T817A|SM-T820|SM-W700|SM-P580|SM-T587|SM-P350|SM-P555M|SM-P355M|SM-T113NU|SM-T815Y|SM-T585|SM-T285|SM-T825|SM-W708|SM-T835|SM-T830|SM-T837V|SM-T720|SM-T510|SM-T387V|SM-P610|SM-T290|SM-T515|SM-T590|SM-T595|SM-T725|SM-T817P|SM-P585N0|SM-T395|SM-T295|SM-T865|SM-P610N|SM-P615|SM-T970|SM-T380|SM-T5950|SM-T905|SM-T231|SM-T500|SM-T860\",\n \"Kindle\": \"Kindle|Silk.*Accelerated|Android.*\\\\b(KFOT|KFTT|KFJWI|KFJWA|KFOTE|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|WFJWAE|KFSAWA|KFSAWI|KFASWI|KFARWI|KFFOWI|KFGIWI|KFMEWI)\\\\b|Android.*Silk\\/[0-9.]+ like Chrome\\/[0-9.]+ (?!Mobile)\",\n \"SurfaceTablet\": \"Windows NT [0-9.]+; ARM;.*(Tablet|ARMBJS)\",\n \"HPTablet\": \"HP Slate (7|8|10)|HP ElitePad 900|hp-tablet|EliteBook.*Touch|HP 8|Slate 21|HP SlateBook 10\",\n \"AsusTablet\": \"^.*PadFone((?!Mobile).)*$|Transformer|TF101|TF101G|TF300T|TF300TG|TF300TL|TF700T|TF700KL|TF701T|TF810C|ME171|ME301T|ME302C|ME371MG|ME370T|ME372MG|ME172V|ME173X|ME400C|Slider SL101|\\\\bK00F\\\\b|\\\\bK00C\\\\b|\\\\bK00E\\\\b|\\\\bK00L\\\\b|TX201LA|ME176C|ME102A|\\\\bM80TA\\\\b|ME372CL|ME560CG|ME372CG|ME302KL| K010 | K011 | K017 | K01E |ME572C|ME103K|ME170C|ME171C|\\\\bME70C\\\\b|ME581C|ME581CL|ME8510C|ME181C|P01Y|PO1MA|P01Z|\\\\bP027\\\\b|\\\\bP024\\\\b|\\\\bP00C\\\\b\",\n \"BlackBerryTablet\": \"PlayBook|RIM Tablet\",\n \"HTCtablet\": \"HTC_Flyer_P512|HTC Flyer|HTC Jetstream|HTC-P715a|HTC EVO View 4G|PG41200|PG09410\",\n \"MotorolaTablet\": \"xoom|sholest|MZ615|MZ605|MZ505|MZ601|MZ602|MZ603|MZ604|MZ606|MZ607|MZ608|MZ609|MZ615|MZ616|MZ617\",\n \"NookTablet\": \"Android.*Nook|NookColor|nook browser|BNRV200|BNRV200A|BNTV250|BNTV250A|BNTV400|BNTV600|LogicPD Zoom2\",\n \"AcerTablet\": \"Android.*; \\\\b(A100|A101|A110|A200|A210|A211|A500|A501|A510|A511|A700|A701|W500|W500P|W501|W501P|W510|W511|W700|G100|G100W|B1-A71|B1-710|B1-711|A1-810|A1-811|A1-830)\\\\b|W3-810|\\\\bA3-A10\\\\b|\\\\bA3-A11\\\\b|\\\\bA3-A20\\\\b|\\\\bA3-A30|A3-A40\",\n \"ToshibaTablet\": \"Android.*(AT100|AT105|AT200|AT205|AT270|AT275|AT300|AT305|AT1S5|AT500|AT570|AT700|AT830)|TOSHIBA.*FOLIO\",\n \"LGTablet\": \"\\\\bL-06C|LG-V909|LG-V900|LG-V700|LG-V510|LG-V500|LG-V410|LG-V400|LG-VK810\\\\b\",\n \"FujitsuTablet\": \"Android.*\\\\b(F-01D|F-02F|F-05E|F-10D|M532|Q572)\\\\b\",\n \"PrestigioTablet\": \"PMP3170B|PMP3270B|PMP3470B|PMP7170B|PMP3370B|PMP3570C|PMP5870C|PMP3670B|PMP5570C|PMP5770D|PMP3970B|PMP3870C|PMP5580C|PMP5880D|PMP5780D|PMP5588C|PMP7280C|PMP7280C3G|PMP7280|PMP7880D|PMP5597D|PMP5597|PMP7100D|PER3464|PER3274|PER3574|PER3884|PER5274|PER5474|PMP5097CPRO|PMP5097|PMP7380D|PMP5297C|PMP5297C_QUAD|PMP812E|PMP812E3G|PMP812F|PMP810E|PMP880TD|PMT3017|PMT3037|PMT3047|PMT3057|PMT7008|PMT5887|PMT5001|PMT5002\",\n \"LenovoTablet\": \"Lenovo TAB|Idea(Tab|Pad)( A1|A10| K1|)|ThinkPad([ ]+)?Tablet|YT3-850M|YT3-X90L|YT3-X90F|YT3-X90X|Lenovo.*(S2109|S2110|S5000|S6000|K3011|A3000|A3500|A1000|A2107|A2109|A1107|A5500|A7600|B6000|B8000|B8080)(-|)(FL|F|HV|H|)|TB-X103F|TB-X304X|TB-X304F|TB-X304L|TB-X505F|TB-X505L|TB-X505X|TB-X605F|TB-X605L|TB-8703F|TB-8703X|TB-8703N|TB-8704N|TB-8704F|TB-8704X|TB-8704V|TB-7304F|TB-7304I|TB-7304X|Tab2A7-10F|Tab2A7-20F|TB2-X30L|YT3-X50L|YT3-X50F|YT3-X50M|YT-X705F|YT-X703F|YT-X703L|YT-X705L|YT-X705X|TB2-X30F|TB2-X30L|TB2-X30M|A2107A-F|A2107A-H|TB3-730F|TB3-730M|TB3-730X|TB-7504F|TB-7504X|TB-X704F|TB-X104F|TB3-X70F|TB-X705F|TB-8504F|TB3-X70L|TB3-710F|TB-X704L\",\n \"DellTablet\": \"Venue 11|Venue 8|Venue 7|Dell Streak 10|Dell Streak 7\",\n \"YarvikTablet\": \"Android.*\\\\b(TAB210|TAB211|TAB224|TAB250|TAB260|TAB264|TAB310|TAB360|TAB364|TAB410|TAB411|TAB420|TAB424|TAB450|TAB460|TAB461|TAB464|TAB465|TAB467|TAB468|TAB07-100|TAB07-101|TAB07-150|TAB07-151|TAB07-152|TAB07-200|TAB07-201-3G|TAB07-210|TAB07-211|TAB07-212|TAB07-214|TAB07-220|TAB07-400|TAB07-485|TAB08-150|TAB08-200|TAB08-201-3G|TAB08-201-30|TAB09-100|TAB09-211|TAB09-410|TAB10-150|TAB10-201|TAB10-211|TAB10-400|TAB10-410|TAB13-201|TAB274EUK|TAB275EUK|TAB374EUK|TAB462EUK|TAB474EUK|TAB9-200)\\\\b\",\n \"MedionTablet\": \"Android.*\\\\bOYO\\\\b|LIFE.*(P9212|P9514|P9516|S9512)|LIFETAB\",\n \"ArnovaTablet\": \"97G4|AN10G2|AN7bG3|AN7fG3|AN8G3|AN8cG3|AN7G3|AN9G3|AN7dG3|AN7dG3ST|AN7dG3ChildPad|AN10bG3|AN10bG3DT|AN9G2\",\n \"IntensoTablet\": \"INM8002KP|INM1010FP|INM805ND|Intenso Tab|TAB1004\",\n \"IRUTablet\": \"M702pro\",\n \"MegafonTablet\": \"MegaFon V9|\\\\bZTE V9\\\\b|Android.*\\\\bMT7A\\\\b\",\n \"EbodaTablet\": \"E-Boda (Supreme|Impresspeed|Izzycomm|Essential)\",\n \"AllViewTablet\": \"Allview.*(Viva|Alldro|City|Speed|All TV|Frenzy|Quasar|Shine|TX1|AX1|AX2)\",\n \"ArchosTablet\": \"\\\\b(101G9|80G9|A101IT)\\\\b|Qilive 97R|Archos5|\\\\bARCHOS (70|79|80|90|97|101|FAMILYPAD|)(b|c|)(G10| Cobalt| TITANIUM(HD|)| Xenon| Neon|XSK| 2| XS 2| PLATINUM| CARBON|GAMEPAD)\\\\b\",\n \"AinolTablet\": \"NOVO7|NOVO8|NOVO10|Novo7Aurora|Novo7Basic|NOVO7PALADIN|novo9-Spark\",\n \"NokiaLumiaTablet\": \"Lumia 2520\",\n \"SonyTablet\": \"Sony.*Tablet|Xperia Tablet|Sony Tablet S|SO-03E|SGPT12|SGPT13|SGPT114|SGPT121|SGPT122|SGPT123|SGPT111|SGPT112|SGPT113|SGPT131|SGPT132|SGPT133|SGPT211|SGPT212|SGPT213|SGP311|SGP312|SGP321|EBRD1101|EBRD1102|EBRD1201|SGP351|SGP341|SGP511|SGP512|SGP521|SGP541|SGP551|SGP621|SGP641|SGP612|SOT31|SGP771|SGP611|SGP612|SGP712\",\n \"PhilipsTablet\": \"\\\\b(PI2010|PI3000|PI3100|PI3105|PI3110|PI3205|PI3210|PI3900|PI4010|PI7000|PI7100)\\\\b\",\n \"CubeTablet\": \"Android.*(K8GT|U9GT|U10GT|U16GT|U17GT|U18GT|U19GT|U20GT|U23GT|U30GT)|CUBE U8GT\",\n \"CobyTablet\": \"MID1042|MID1045|MID1125|MID1126|MID7012|MID7014|MID7015|MID7034|MID7035|MID7036|MID7042|MID7048|MID7127|MID8042|MID8048|MID8127|MID9042|MID9740|MID9742|MID7022|MID7010\",\n \"MIDTablet\": \"M9701|M9000|M9100|M806|M1052|M806|T703|MID701|MID713|MID710|MID727|MID760|MID830|MID728|MID933|MID125|MID810|MID732|MID120|MID930|MID800|MID731|MID900|MID100|MID820|MID735|MID980|MID130|MID833|MID737|MID960|MID135|MID860|MID736|MID140|MID930|MID835|MID733|MID4X10\",\n \"MSITablet\": \"MSI \\\\b(Primo 73K|Primo 73L|Primo 81L|Primo 77|Primo 93|Primo 75|Primo 76|Primo 73|Primo 81|Primo 91|Primo 90|Enjoy 71|Enjoy 7|Enjoy 10)\\\\b\",\n \"SMiTTablet\": \"Android.*(\\\\bMID\\\\b|MID-560|MTV-T1200|MTV-PND531|MTV-P1101|MTV-PND530)\",\n \"RockChipTablet\": \"Android.*(RK2818|RK2808A|RK2918|RK3066)|RK2738|RK2808A\",\n \"FlyTablet\": \"IQ310|Fly Vision\",\n \"bqTablet\": \"Android.*(bq)?.*\\\\b(Elcano|Curie|Edison|Maxwell|Kepler|Pascal|Tesla|Hypatia|Platon|Newton|Livingstone|Cervantes|Avant|Aquaris ([E|M]10|M8))\\\\b|Maxwell.*Lite|Maxwell.*Plus\",\n \"HuaweiTablet\": \"MediaPad|MediaPad 7 Youth|IDEOS S7|S7-201c|S7-202u|S7-101|S7-103|S7-104|S7-105|S7-106|S7-201|S7-Slim|M2-A01L|BAH-L09|BAH-W09|AGS-L09|CMR-AL19\",\n \"NecTablet\": \"\\\\bN-06D|\\\\bN-08D\",\n \"PantechTablet\": \"Pantech.*P4100\",\n \"BronchoTablet\": \"Broncho.*(N701|N708|N802|a710)\",\n \"VersusTablet\": \"TOUCHPAD.*[78910]|\\\\bTOUCHTAB\\\\b\",\n \"ZyncTablet\": \"z1000|Z99 2G|z930|z990|z909|Z919|z900\",\n \"PositivoTablet\": \"TB07STA|TB10STA|TB07FTA|TB10FTA\",\n \"NabiTablet\": \"Android.*\\\\bNabi\",\n \"KoboTablet\": \"Kobo Touch|\\\\bK080\\\\b|\\\\bVox\\\\b Build|\\\\bArc\\\\b Build\",\n \"DanewTablet\": \"DSlide.*\\\\b(700|701R|702|703R|704|802|970|971|972|973|974|1010|1012)\\\\b\",\n \"TexetTablet\": \"NaviPad|TB-772A|TM-7045|TM-7055|TM-9750|TM-7016|TM-7024|TM-7026|TM-7041|TM-7043|TM-7047|TM-8041|TM-9741|TM-9747|TM-9748|TM-9751|TM-7022|TM-7021|TM-7020|TM-7011|TM-7010|TM-7023|TM-7025|TM-7037W|TM-7038W|TM-7027W|TM-9720|TM-9725|TM-9737W|TM-1020|TM-9738W|TM-9740|TM-9743W|TB-807A|TB-771A|TB-727A|TB-725A|TB-719A|TB-823A|TB-805A|TB-723A|TB-715A|TB-707A|TB-705A|TB-709A|TB-711A|TB-890HD|TB-880HD|TB-790HD|TB-780HD|TB-770HD|TB-721HD|TB-710HD|TB-434HD|TB-860HD|TB-840HD|TB-760HD|TB-750HD|TB-740HD|TB-730HD|TB-722HD|TB-720HD|TB-700HD|TB-500HD|TB-470HD|TB-431HD|TB-430HD|TB-506|TB-504|TB-446|TB-436|TB-416|TB-146SE|TB-126SE\",\n \"PlaystationTablet\": \"Playstation.*(Portable|Vita)\",\n \"TrekstorTablet\": \"ST10416-1|VT10416-1|ST70408-1|ST702xx-1|ST702xx-2|ST80208|ST97216|ST70104-2|VT10416-2|ST10216-2A|SurfTab\",\n \"PyleAudioTablet\": \"\\\\b(PTBL10CEU|PTBL10C|PTBL72BC|PTBL72BCEU|PTBL7CEU|PTBL7C|PTBL92BC|PTBL92BCEU|PTBL9CEU|PTBL9CUK|PTBL9C)\\\\b\",\n \"AdvanTablet\": \"Android.* \\\\b(E3A|T3X|T5C|T5B|T3E|T3C|T3B|T1J|T1F|T2A|T1H|T1i|E1C|T1-E|T5-A|T4|E1-B|T2Ci|T1-B|T1-D|O1-A|E1-A|T1-A|T3A|T4i)\\\\b \",\n \"DanyTechTablet\": \"Genius Tab G3|Genius Tab S2|Genius Tab Q3|Genius Tab G4|Genius Tab Q4|Genius Tab G-II|Genius TAB GII|Genius TAB GIII|Genius Tab S1\",\n \"GalapadTablet\": \"Android [0-9.]+; [a-z-]+; \\\\bG1\\\\b\",\n \"MicromaxTablet\": \"Funbook|Micromax.*\\\\b(P250|P560|P360|P362|P600|P300|P350|P500|P275)\\\\b\",\n \"KarbonnTablet\": \"Android.*\\\\b(A39|A37|A34|ST8|ST10|ST7|Smart Tab3|Smart Tab2)\\\\b\",\n \"AllFineTablet\": \"Fine7 Genius|Fine7 Shine|Fine7 Air|Fine8 Style|Fine9 More|Fine10 Joy|Fine11 Wide\",\n \"PROSCANTablet\": \"\\\\b(PEM63|PLT1023G|PLT1041|PLT1044|PLT1044G|PLT1091|PLT4311|PLT4311PL|PLT4315|PLT7030|PLT7033|PLT7033D|PLT7035|PLT7035D|PLT7044K|PLT7045K|PLT7045KB|PLT7071KG|PLT7072|PLT7223G|PLT7225G|PLT7777G|PLT7810K|PLT7849G|PLT7851G|PLT7852G|PLT8015|PLT8031|PLT8034|PLT8036|PLT8080K|PLT8082|PLT8088|PLT8223G|PLT8234G|PLT8235G|PLT8816K|PLT9011|PLT9045K|PLT9233G|PLT9735|PLT9760G|PLT9770G)\\\\b\",\n \"YONESTablet\": \"BQ1078|BC1003|BC1077|RK9702|BC9730|BC9001|IT9001|BC7008|BC7010|BC708|BC728|BC7012|BC7030|BC7027|BC7026\",\n \"ChangJiaTablet\": \"TPC7102|TPC7103|TPC7105|TPC7106|TPC7107|TPC7201|TPC7203|TPC7205|TPC7210|TPC7708|TPC7709|TPC7712|TPC7110|TPC8101|TPC8103|TPC8105|TPC8106|TPC8203|TPC8205|TPC8503|TPC9106|TPC9701|TPC97101|TPC97103|TPC97105|TPC97106|TPC97111|TPC97113|TPC97203|TPC97603|TPC97809|TPC97205|TPC10101|TPC10103|TPC10106|TPC10111|TPC10203|TPC10205|TPC10503\",\n \"GUTablet\": \"TX-A1301|TX-M9002|Q702|kf026\",\n \"PointOfViewTablet\": \"TAB-P506|TAB-navi-7-3G-M|TAB-P517|TAB-P-527|TAB-P701|TAB-P703|TAB-P721|TAB-P731N|TAB-P741|TAB-P825|TAB-P905|TAB-P925|TAB-PR945|TAB-PL1015|TAB-P1025|TAB-PI1045|TAB-P1325|TAB-PROTAB[0-9]+|TAB-PROTAB25|TAB-PROTAB26|TAB-PROTAB27|TAB-PROTAB26XL|TAB-PROTAB2-IPS9|TAB-PROTAB30-IPS9|TAB-PROTAB25XXL|TAB-PROTAB26-IPS10|TAB-PROTAB30-IPS10\",\n \"OvermaxTablet\": \"OV-(SteelCore|NewBase|Basecore|Baseone|Exellen|Quattor|EduTab|Solution|ACTION|BasicTab|TeddyTab|MagicTab|Stream|TB-08|TB-09)|Qualcore 1027\",\n \"HCLTablet\": \"HCL.*Tablet|Connect-3G-2.0|Connect-2G-2.0|ME Tablet U1|ME Tablet U2|ME Tablet G1|ME Tablet X1|ME Tablet Y2|ME Tablet Sync\",\n \"DPSTablet\": \"DPS Dream 9|DPS Dual 7\",\n \"VistureTablet\": \"V97 HD|i75 3G|Visture V4( HD)?|Visture V5( HD)?|Visture V10\",\n \"CrestaTablet\": \"CTP(-)?810|CTP(-)?818|CTP(-)?828|CTP(-)?838|CTP(-)?888|CTP(-)?978|CTP(-)?980|CTP(-)?987|CTP(-)?988|CTP(-)?989\",\n \"MediatekTablet\": \"\\\\bMT8125|MT8389|MT8135|MT8377\\\\b\",\n \"ConcordeTablet\": \"Concorde([ ]+)?Tab|ConCorde ReadMan\",\n \"GoCleverTablet\": \"GOCLEVER TAB|A7GOCLEVER|M1042|M7841|M742|R1042BK|R1041|TAB A975|TAB A7842|TAB A741|TAB A741L|TAB M723G|TAB M721|TAB A1021|TAB I921|TAB R721|TAB I720|TAB T76|TAB R70|TAB R76.2|TAB R106|TAB R83.2|TAB M813G|TAB I721|GCTA722|TAB I70|TAB I71|TAB S73|TAB R73|TAB R74|TAB R93|TAB R75|TAB R76.1|TAB A73|TAB A93|TAB A93.2|TAB T72|TAB R83|TAB R974|TAB R973|TAB A101|TAB A103|TAB A104|TAB A104.2|R105BK|M713G|A972BK|TAB A971|TAB R974.2|TAB R104|TAB R83.3|TAB A1042\",\n \"ModecomTablet\": \"FreeTAB 9000|FreeTAB 7.4|FreeTAB 7004|FreeTAB 7800|FreeTAB 2096|FreeTAB 7.5|FreeTAB 1014|FreeTAB 1001 |FreeTAB 8001|FreeTAB 9706|FreeTAB 9702|FreeTAB 7003|FreeTAB 7002|FreeTAB 1002|FreeTAB 7801|FreeTAB 1331|FreeTAB 1004|FreeTAB 8002|FreeTAB 8014|FreeTAB 9704|FreeTAB 1003\",\n \"VoninoTablet\": \"\\\\b(Argus[ _]?S|Diamond[ _]?79HD|Emerald[ _]?78E|Luna[ _]?70C|Onyx[ _]?S|Onyx[ _]?Z|Orin[ _]?HD|Orin[ _]?S|Otis[ _]?S|SpeedStar[ _]?S|Magnet[ _]?M9|Primus[ _]?94[ _]?3G|Primus[ _]?94HD|Primus[ _]?QS|Android.*\\\\bQ8\\\\b|Sirius[ _]?EVO[ _]?QS|Sirius[ _]?QS|Spirit[ _]?S)\\\\b\",\n \"ECSTablet\": \"V07OT2|TM105A|S10OT1|TR10CS1\",\n \"StorexTablet\": \"eZee[_']?(Tab|Go)[0-9]+|TabLC7|Looney Tunes Tab\",\n \"VodafoneTablet\": \"SmartTab([ ]+)?[0-9]+|SmartTabII10|SmartTabII7|VF-1497|VFD 1400\",\n \"EssentielBTablet\": \"Smart[ ']?TAB[ ]+?[0-9]+|Family[ ']?TAB2\",\n \"RossMoorTablet\": \"RM-790|RM-997|RMD-878G|RMD-974R|RMT-705A|RMT-701|RME-601|RMT-501|RMT-711\",\n \"iMobileTablet\": \"i-mobile i-note\",\n \"TolinoTablet\": \"tolino tab [0-9.]+|tolino shine\",\n \"AudioSonicTablet\": \"\\\\bC-22Q|T7-QC|T-17B|T-17P\\\\b\",\n \"AMPETablet\": \"Android.* A78 \",\n \"SkkTablet\": \"Android.* (SKYPAD|PHOENIX|CYCLOPS)\",\n \"TecnoTablet\": \"TECNO P9|TECNO DP8D\",\n \"JXDTablet\": \"Android.* \\\\b(F3000|A3300|JXD5000|JXD3000|JXD2000|JXD300B|JXD300|S5800|S7800|S602b|S5110b|S7300|S5300|S602|S603|S5100|S5110|S601|S7100a|P3000F|P3000s|P101|P200s|P1000m|P200m|P9100|P1000s|S6600b|S908|P1000|P300|S18|S6600|S9100)\\\\b\",\n \"iJoyTablet\": \"Tablet (Spirit 7|Essentia|Galatea|Fusion|Onix 7|Landa|Titan|Scooby|Deox|Stella|Themis|Argon|Unique 7|Sygnus|Hexen|Finity 7|Cream|Cream X2|Jade|Neon 7|Neron 7|Kandy|Scape|Saphyr 7|Rebel|Biox|Rebel|Rebel 8GB|Myst|Draco 7|Myst|Tab7-004|Myst|Tadeo Jones|Tablet Boing|Arrow|Draco Dual Cam|Aurix|Mint|Amity|Revolution|Finity 9|Neon 9|T9w|Amity 4GB Dual Cam|Stone 4GB|Stone 8GB|Andromeda|Silken|X2|Andromeda II|Halley|Flame|Saphyr 9,7|Touch 8|Planet|Triton|Unique 10|Hexen 10|Memphis 4GB|Memphis 8GB|Onix 10)\",\n \"FX2Tablet\": \"FX2 PAD7|FX2 PAD10\",\n \"XoroTablet\": \"KidsPAD 701|PAD[ ]?712|PAD[ ]?714|PAD[ ]?716|PAD[ ]?717|PAD[ ]?718|PAD[ ]?720|PAD[ ]?721|PAD[ ]?722|PAD[ ]?790|PAD[ ]?792|PAD[ ]?900|PAD[ ]?9715D|PAD[ ]?9716DR|PAD[ ]?9718DR|PAD[ ]?9719QR|PAD[ ]?9720QR|TelePAD1030|Telepad1032|TelePAD730|TelePAD731|TelePAD732|TelePAD735Q|TelePAD830|TelePAD9730|TelePAD795|MegaPAD 1331|MegaPAD 1851|MegaPAD 2151\",\n \"ViewsonicTablet\": \"ViewPad 10pi|ViewPad 10e|ViewPad 10s|ViewPad E72|ViewPad7|ViewPad E100|ViewPad 7e|ViewSonic VB733|VB100a\",\n \"VerizonTablet\": \"QTAQZ3|QTAIR7|QTAQTZ3|QTASUN1|QTASUN2|QTAXIA1\",\n \"OdysTablet\": \"LOOX|XENO10|ODYS[ -](Space|EVO|Xpress|NOON)|\\\\bXELIO\\\\b|Xelio10Pro|XELIO7PHONETAB|XELIO10EXTREME|XELIOPT2|NEO_QUAD10\",\n \"CaptivaTablet\": \"CAPTIVA PAD\",\n \"IconbitTablet\": \"NetTAB|NT-3702|NT-3702S|NT-3702S|NT-3603P|NT-3603P|NT-0704S|NT-0704S|NT-3805C|NT-3805C|NT-0806C|NT-0806C|NT-0909T|NT-0909T|NT-0907S|NT-0907S|NT-0902S|NT-0902S\",\n \"TeclastTablet\": \"T98 4G|\\\\bP80\\\\b|\\\\bX90HD\\\\b|X98 Air|X98 Air 3G|\\\\bX89\\\\b|P80 3G|\\\\bX80h\\\\b|P98 Air|\\\\bX89HD\\\\b|P98 3G|\\\\bP90HD\\\\b|P89 3G|X98 3G|\\\\bP70h\\\\b|P79HD 3G|G18d 3G|\\\\bP79HD\\\\b|\\\\bP89s\\\\b|\\\\bA88\\\\b|\\\\bP10HD\\\\b|\\\\bP19HD\\\\b|G18 3G|\\\\bP78HD\\\\b|\\\\bA78\\\\b|\\\\bP75\\\\b|G17s 3G|G17h 3G|\\\\bP85t\\\\b|\\\\bP90\\\\b|\\\\bP11\\\\b|\\\\bP98t\\\\b|\\\\bP98HD\\\\b|\\\\bG18d\\\\b|\\\\bP85s\\\\b|\\\\bP11HD\\\\b|\\\\bP88s\\\\b|\\\\bA80HD\\\\b|\\\\bA80se\\\\b|\\\\bA10h\\\\b|\\\\bP89\\\\b|\\\\bP78s\\\\b|\\\\bG18\\\\b|\\\\bP85\\\\b|\\\\bA70h\\\\b|\\\\bA70\\\\b|\\\\bG17\\\\b|\\\\bP18\\\\b|\\\\bA80s\\\\b|\\\\bA11s\\\\b|\\\\bP88HD\\\\b|\\\\bA80h\\\\b|\\\\bP76s\\\\b|\\\\bP76h\\\\b|\\\\bP98\\\\b|\\\\bA10HD\\\\b|\\\\bP78\\\\b|\\\\bP88\\\\b|\\\\bA11\\\\b|\\\\bA10t\\\\b|\\\\bP76a\\\\b|\\\\bP76t\\\\b|\\\\bP76e\\\\b|\\\\bP85HD\\\\b|\\\\bP85a\\\\b|\\\\bP86\\\\b|\\\\bP75HD\\\\b|\\\\bP76v\\\\b|\\\\bA12\\\\b|\\\\bP75a\\\\b|\\\\bA15\\\\b|\\\\bP76Ti\\\\b|\\\\bP81HD\\\\b|\\\\bA10\\\\b|\\\\bT760VE\\\\b|\\\\bT720HD\\\\b|\\\\bP76\\\\b|\\\\bP73\\\\b|\\\\bP71\\\\b|\\\\bP72\\\\b|\\\\bT720SE\\\\b|\\\\bC520Ti\\\\b|\\\\bT760\\\\b|\\\\bT720VE\\\\b|T720-3GE|T720-WiFi\",\n \"OndaTablet\": \"\\\\b(V975i|Vi30|VX530|V701|Vi60|V701s|Vi50|V801s|V719|Vx610w|VX610W|V819i|Vi10|VX580W|Vi10|V711s|V813|V811|V820w|V820|Vi20|V711|VI30W|V712|V891w|V972|V819w|V820w|Vi60|V820w|V711|V813s|V801|V819|V975s|V801|V819|V819|V818|V811|V712|V975m|V101w|V961w|V812|V818|V971|V971s|V919|V989|V116w|V102w|V973|Vi40)\\\\b[\\\\s]+|V10 \\\\b4G\\\\b\",\n \"JaytechTablet\": \"TPC-PA762\",\n \"BlaupunktTablet\": \"Endeavour 800NG|Endeavour 1010\",\n \"DigmaTablet\": \"\\\\b(iDx10|iDx9|iDx8|iDx7|iDxD7|iDxD8|iDsQ8|iDsQ7|iDsQ8|iDsD10|iDnD7|3TS804H|iDsQ11|iDj7|iDs10)\\\\b\",\n \"EvolioTablet\": \"ARIA_Mini_wifi|Aria[ _]Mini|Evolio X10|Evolio X7|Evolio X8|\\\\bEvotab\\\\b|\\\\bNeura\\\\b\",\n \"LavaTablet\": \"QPAD E704|\\\\bIvoryS\\\\b|E-TAB IVORY|\\\\bE-TAB\\\\b\",\n \"AocTablet\": \"MW0811|MW0812|MW0922|MTK8382|MW1031|MW0831|MW0821|MW0931|MW0712\",\n \"MpmanTablet\": \"MP11 OCTA|MP10 OCTA|MPQC1114|MPQC1004|MPQC994|MPQC974|MPQC973|MPQC804|MPQC784|MPQC780|\\\\bMPG7\\\\b|MPDCG75|MPDCG71|MPDC1006|MP101DC|MPDC9000|MPDC905|MPDC706HD|MPDC706|MPDC705|MPDC110|MPDC100|MPDC99|MPDC97|MPDC88|MPDC8|MPDC77|MP709|MID701|MID711|MID170|MPDC703|MPQC1010\",\n \"CelkonTablet\": \"CT695|CT888|CT[\\\\s]?910|CT7 Tab|CT9 Tab|CT3 Tab|CT2 Tab|CT1 Tab|C820|C720|\\\\bCT-1\\\\b\",\n \"WolderTablet\": \"miTab \\\\b(DIAMOND|SPACE|BROOKLYN|NEO|FLY|MANHATTAN|FUNK|EVOLUTION|SKY|GOCAR|IRON|GENIUS|POP|MINT|EPSILON|BROADWAY|JUMP|HOP|LEGEND|NEW AGE|LINE|ADVANCE|FEEL|FOLLOW|LIKE|LINK|LIVE|THINK|FREEDOM|CHICAGO|CLEVELAND|BALTIMORE-GH|IOWA|BOSTON|SEATTLE|PHOENIX|DALLAS|IN 101|MasterChef)\\\\b\",\n \"MediacomTablet\": \"M-MPI10C3G|M-SP10EG|M-SP10EGP|M-SP10HXAH|M-SP7HXAH|M-SP10HXBH|M-SP8HXAH|M-SP8MXA\",\n \"MiTablet\": \"\\\\bMI PAD\\\\b|\\\\bHM NOTE 1W\\\\b\",\n \"NibiruTablet\": \"Nibiru M1|Nibiru Jupiter One\",\n \"NexoTablet\": \"NEXO NOVA|NEXO 10|NEXO AVIO|NEXO FREE|NEXO GO|NEXO EVO|NEXO 3G|NEXO SMART|NEXO KIDDO|NEXO MOBI\",\n \"LeaderTablet\": \"TBLT10Q|TBLT10I|TBL-10WDKB|TBL-10WDKBO2013|TBL-W230V2|TBL-W450|TBL-W500|SV572|TBLT7I|TBA-AC7-8G|TBLT79|TBL-8W16|TBL-10W32|TBL-10WKB|TBL-W100\",\n \"UbislateTablet\": \"UbiSlate[\\\\s]?7C\",\n \"PocketBookTablet\": \"Pocketbook\",\n \"KocasoTablet\": \"\\\\b(TB-1207)\\\\b\",\n \"HisenseTablet\": \"\\\\b(F5281|E2371)\\\\b\",\n \"Hudl\": \"Hudl HT7S3|Hudl 2\",\n \"TelstraTablet\": \"T-Hub2\",\n \"GenericTablet\": \"Android.*\\\\b97D\\\\b|Tablet(?!.*PC)|BNTV250A|MID-WCDMA|LogicPD Zoom2|\\\\bA7EB\\\\b|CatNova8|A1_07|CT704|CT1002|\\\\bM721\\\\b|rk30sdk|\\\\bEVOTAB\\\\b|M758A|ET904|ALUMIUM10|Smartfren Tab|Endeavour 1010|Tablet-PC-4|Tagi Tab|\\\\bM6pro\\\\b|CT1020W|arc 10HD|\\\\bTP750\\\\b|\\\\bQTAQZ3\\\\b|WVT101|TM1088|KT107\"\n },\n \"oss\": {\n \"AndroidOS\": \"Android\",\n \"BlackBerryOS\": \"blackberry|\\\\bBB10\\\\b|rim tablet os\",\n \"PalmOS\": \"PalmOS|avantgo|blazer|elaine|hiptop|palm|plucker|xiino\",\n \"SymbianOS\": \"Symbian|SymbOS|Series60|Series40|SYB-[0-9]+|\\\\bS60\\\\b\",\n \"WindowsMobileOS\": \"Windows CE.*(PPC|Smartphone|Mobile|[0-9]{3}x[0-9]{3})|Windows Mobile|Windows Phone [0-9.]+|WCE;\",\n \"WindowsPhoneOS\": \"Windows Phone 10.0|Windows Phone 8.1|Windows Phone 8.0|Windows Phone OS|XBLWP7|ZuneWP7|Windows NT 6.[23]; ARM;\",\n \"iOS\": \"\\\\biPhone.*Mobile|\\\\biPod|\\\\biPad|AppleCoreMedia\",\n \"iPadOS\": \"CPU OS 13\",\n \"SailfishOS\": \"Sailfish\",\n \"MeeGoOS\": \"MeeGo\",\n \"MaemoOS\": \"Maemo\",\n \"JavaOS\": \"J2ME\\/|\\\\bMIDP\\\\b|\\\\bCLDC\\\\b\",\n \"webOS\": \"webOS|hpwOS\",\n \"badaOS\": \"\\\\bBada\\\\b\",\n \"BREWOS\": \"BREW\"\n },\n \"uas\": {\n \"Chrome\": \"\\\\bCrMo\\\\b|CriOS|Android.*Chrome\\/[.0-9]* (Mobile)?\",\n \"Dolfin\": \"\\\\bDolfin\\\\b\",\n \"Opera\": \"Opera.*Mini|Opera.*Mobi|Android.*Opera|Mobile.*OPR\\/[0-9.]+$|Coast\\/[0-9.]+\",\n \"Skyfire\": \"Skyfire\",\n \"Edge\": \"\\\\bEdgiOS\\\\b|Mobile Safari\\/[.0-9]* Edge\",\n \"IE\": \"IEMobile|MSIEMobile\",\n \"Firefox\": \"fennec|firefox.*maemo|(Mobile|Tablet).*Firefox|Firefox.*Mobile|FxiOS\",\n \"Bolt\": \"bolt\",\n \"TeaShark\": \"teashark\",\n \"Blazer\": \"Blazer\",\n \"Safari\": \"Version((?!\\\\bEdgiOS\\\\b).)*Mobile.*Safari|Safari.*Mobile|MobileSafari\",\n \"WeChat\": \"\\\\bMicroMessenger\\\\b\",\n \"UCBrowser\": \"UC.*Browser|UCWEB\",\n \"baiduboxapp\": \"baiduboxapp\",\n \"baidubrowser\": \"baidubrowser\",\n \"DiigoBrowser\": \"DiigoBrowser\",\n \"Mercury\": \"\\\\bMercury\\\\b\",\n \"ObigoBrowser\": \"Obigo\",\n \"NetFront\": \"NF-Browser\",\n \"GenericBrowser\": \"NokiaBrowser|OviBrowser|OneBrowser|TwonkyBeamBrowser|SEMC.*Browser|FlyFlow|Minimo|NetFront|Novarra-Vision|MQQBrowser|MicroMessenger\",\n \"PaleMoon\": \"Android.*PaleMoon|Mobile.*PaleMoon\"\n },\n \"props\": {\n \"Mobile\": \"Mobile\\/[VER]\",\n \"Build\": \"Build\\/[VER]\",\n \"Version\": \"Version\\/[VER]\",\n \"VendorID\": \"VendorID\\/[VER]\",\n \"iPad\": \"iPad.*CPU[a-z ]+[VER]\",\n \"iPhone\": \"iPhone.*CPU[a-z ]+[VER]\",\n \"iPod\": \"iPod.*CPU[a-z ]+[VER]\",\n \"Kindle\": \"Kindle\\/[VER]\",\n \"Chrome\": [\n \"Chrome\\/[VER]\",\n \"CriOS\\/[VER]\",\n \"CrMo\\/[VER]\"\n ],\n \"Coast\": [\n \"Coast\\/[VER]\"\n ],\n \"Dolfin\": \"Dolfin\\/[VER]\",\n \"Firefox\": [\n \"Firefox\\/[VER]\",\n \"FxiOS\\/[VER]\"\n ],\n \"Fennec\": \"Fennec\\/[VER]\",\n \"Edge\": \"Edge\\/[VER]\",\n \"IE\": [\n \"IEMobile\\/[VER];\",\n \"IEMobile [VER]\",\n \"MSIE [VER];\",\n \"Trident\\/[0-9.]+;.*rv:[VER]\"\n ],\n \"NetFront\": \"NetFront\\/[VER]\",\n \"NokiaBrowser\": \"NokiaBrowser\\/[VER]\",\n \"Opera\": [\n \" OPR\\/[VER]\",\n \"Opera Mini\\/[VER]\",\n \"Version\\/[VER]\"\n ],\n \"Opera Mini\": \"Opera Mini\\/[VER]\",\n \"Opera Mobi\": \"Version\\/[VER]\",\n \"UCBrowser\": [\n \"UCWEB[VER]\",\n \"UC.*Browser\\/[VER]\"\n ],\n \"MQQBrowser\": \"MQQBrowser\\/[VER]\",\n \"MicroMessenger\": \"MicroMessenger\\/[VER]\",\n \"baiduboxapp\": \"baiduboxapp\\/[VER]\",\n \"baidubrowser\": \"baidubrowser\\/[VER]\",\n \"SamsungBrowser\": \"SamsungBrowser\\/[VER]\",\n \"Iron\": \"Iron\\/[VER]\",\n \"Safari\": [\n \"Version\\/[VER]\",\n \"Safari\\/[VER]\"\n ],\n \"Skyfire\": \"Skyfire\\/[VER]\",\n \"Tizen\": \"Tizen\\/[VER]\",\n \"Webkit\": \"webkit[ \\/][VER]\",\n \"PaleMoon\": \"PaleMoon\\/[VER]\",\n \"SailfishBrowser\": \"SailfishBrowser\\/[VER]\",\n \"Gecko\": \"Gecko\\/[VER]\",\n \"Trident\": \"Trident\\/[VER]\",\n \"Presto\": \"Presto\\/[VER]\",\n \"Goanna\": \"Goanna\\/[VER]\",\n \"iOS\": \" \\\\bi?OS\\\\b [VER][ ;]{1}\",\n \"Android\": \"Android [VER]\",\n \"Sailfish\": \"Sailfish [VER]\",\n \"BlackBerry\": [\n \"BlackBerry[\\\\w]+\\/[VER]\",\n \"BlackBerry.*Version\\/[VER]\",\n \"Version\\/[VER]\"\n ],\n \"BREW\": \"BREW [VER]\",\n \"Java\": \"Java\\/[VER]\",\n \"Windows Phone OS\": [\n \"Windows Phone OS [VER]\",\n \"Windows Phone [VER]\"\n ],\n \"Windows Phone\": \"Windows Phone [VER]\",\n \"Windows CE\": \"Windows CE\\/[VER]\",\n \"Windows NT\": \"Windows NT [VER]\",\n \"Symbian\": [\n \"SymbianOS\\/[VER]\",\n \"Symbian\\/[VER]\"\n ],\n \"webOS\": [\n \"webOS\\/[VER]\",\n \"hpwOS\\/[VER];\"\n ]\n },\n \"utils\": {\n \"Bot\": \"Googlebot|facebookexternalhit|Google-AMPHTML|s~amp-validator|AdsBot-Google|Google Keyword Suggestion|Facebot|YandexBot|YandexMobileBot|bingbot|ia_archiver|AhrefsBot|Ezooms|GSLFbot|WBSearchBot|Twitterbot|TweetmemeBot|Twikle|PaperLiBot|Wotbox|UnwindFetchor|Exabot|MJ12bot|YandexImages|TurnitinBot|Pingdom|contentkingapp|AspiegelBot\",\n \"MobileBot\": \"Googlebot-Mobile|AdsBot-Google-Mobile|YahooSeeker\\/M1A1-R2D2\",\n \"DesktopMode\": \"WPDesktop\",\n \"TV\": \"SonyDTV|HbbTV\",\n \"WebKit\": \"(webkit)[ \\/]([\\\\w.]+)\",\n \"Console\": \"\\\\b(Nintendo|Nintendo WiiU|Nintendo 3DS|Nintendo Switch|PLAYSTATION|Xbox)\\\\b\",\n \"Watch\": \"SM-V700\"\n }\n};\n\n // following patterns come from http://detectmobilebrowsers.com/\n impl.detectMobileBrowsers = {\n fullPattern: /(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i,\n shortPattern: /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i,\n tabletPattern: /android|ipad|playbook|silk/i\n };\n\n var hasOwnProp = Object.prototype.hasOwnProperty,\n isArray;\n\n impl.FALLBACK_PHONE = 'UnknownPhone';\n impl.FALLBACK_TABLET = 'UnknownTablet';\n impl.FALLBACK_MOBILE = 'UnknownMobile';\n\n isArray = ('isArray' in Array) ?\n Array.isArray : function (value) { return Object.prototype.toString.call(value) === '[object Array]'; };\n\n function equalIC(a, b) {\n return a != null && b != null && a.toLowerCase() === b.toLowerCase();\n }\n\n function containsIC(array, value) {\n var valueLC, i, len = array.length;\n if (!len || !value) {\n return false;\n }\n valueLC = value.toLowerCase();\n for (i = 0; i < len; ++i) {\n if (valueLC === array[i].toLowerCase()) {\n return true;\n }\n }\n return false;\n }\n\n function convertPropsToRegExp(object) {\n for (var key in object) {\n if (hasOwnProp.call(object, key)) {\n object[key] = new RegExp(object[key], 'i');\n }\n }\n }\n\n function prepareUserAgent(userAgent) {\n return (userAgent || '').substr(0, 500); // mitigate vulnerable to ReDoS\n }\n\n (function init() {\n var key, values, value, i, len, verPos, mobileDetectRules = impl.mobileDetectRules;\n for (key in mobileDetectRules.props) {\n if (hasOwnProp.call(mobileDetectRules.props, key)) {\n values = mobileDetectRules.props[key];\n if (!isArray(values)) {\n values = [values];\n }\n len = values.length;\n for (i = 0; i < len; ++i) {\n value = values[i];\n verPos = value.indexOf('[VER]');\n if (verPos >= 0) {\n value = value.substring(0, verPos) + '([\\\\w._\\\\+]+)' + value.substring(verPos + 5);\n }\n values[i] = new RegExp(value, 'i');\n }\n mobileDetectRules.props[key] = values;\n }\n }\n convertPropsToRegExp(mobileDetectRules.oss);\n convertPropsToRegExp(mobileDetectRules.phones);\n convertPropsToRegExp(mobileDetectRules.tablets);\n convertPropsToRegExp(mobileDetectRules.uas);\n convertPropsToRegExp(mobileDetectRules.utils);\n\n // copy some patterns to oss0 which are tested first (see issue#15)\n mobileDetectRules.oss0 = {\n WindowsPhoneOS: mobileDetectRules.oss.WindowsPhoneOS,\n WindowsMobileOS: mobileDetectRules.oss.WindowsMobileOS\n };\n }());\n\n /**\n * Test userAgent string against a set of rules and find the first matched key.\n * @param {Object} rules (key is String, value is RegExp)\n * @param {String} userAgent the navigator.userAgent (or HTTP-Header 'User-Agent').\n * @returns {String|null} the matched key if found, otherwise null\n * @private\n */\n impl.findMatch = function(rules, userAgent) {\n for (var key in rules) {\n if (hasOwnProp.call(rules, key)) {\n if (rules[key].test(userAgent)) {\n return key;\n }\n }\n }\n return null;\n };\n\n /**\n * Test userAgent string against a set of rules and return an array of matched keys.\n * @param {Object} rules (key is String, value is RegExp)\n * @param {String} userAgent the navigator.userAgent (or HTTP-Header 'User-Agent').\n * @returns {Array} an array of matched keys, may be empty when there is no match, but not null\n * @private\n */\n impl.findMatches = function(rules, userAgent) {\n var result = [];\n for (var key in rules) {\n if (hasOwnProp.call(rules, key)) {\n if (rules[key].test(userAgent)) {\n result.push(key);\n }\n }\n }\n return result;\n };\n\n /**\n * Check the version of the given property in the User-Agent.\n *\n * @param {String} propertyName\n * @param {String} userAgent\n * @return {String} version or null if version not found\n * @private\n */\n impl.getVersionStr = function (propertyName, userAgent) {\n var props = impl.mobileDetectRules.props, patterns, i, len, match;\n if (hasOwnProp.call(props, propertyName)) {\n patterns = props[propertyName];\n len = patterns.length;\n for (i = 0; i < len; ++i) {\n match = patterns[i].exec(userAgent);\n if (match !== null) {\n return match[1];\n }\n }\n }\n return null;\n };\n\n /**\n * Check the version of the given property in the User-Agent.\n * Will return a float number. (eg. 2_0 will return 2.0, 4.3.1 will return 4.31)\n *\n * @param {String} propertyName\n * @param {String} userAgent\n * @return {Number} version or NaN if version not found\n * @private\n */\n impl.getVersion = function (propertyName, userAgent) {\n var version = impl.getVersionStr(propertyName, userAgent);\n return version ? impl.prepareVersionNo(version) : NaN;\n };\n\n /**\n * Prepare the version number.\n *\n * @param {String} version\n * @return {Number} the version number as a floating number\n * @private\n */\n impl.prepareVersionNo = function (version) {\n var numbers;\n\n numbers = version.split(/[a-z._ \\/\\-]/i);\n if (numbers.length === 1) {\n version = numbers[0];\n }\n if (numbers.length > 1) {\n version = numbers[0] + '.';\n numbers.shift();\n version += numbers.join('');\n }\n return Number(version);\n };\n\n impl.isMobileFallback = function (userAgent) {\n return impl.detectMobileBrowsers.fullPattern.test(userAgent) ||\n impl.detectMobileBrowsers.shortPattern.test(userAgent.substr(0,4));\n };\n\n impl.isTabletFallback = function (userAgent) {\n return impl.detectMobileBrowsers.tabletPattern.test(userAgent);\n };\n\n impl.prepareDetectionCache = function (cache, userAgent, maxPhoneWidth) {\n if (cache.mobile !== undefined) {\n return;\n }\n var phone, tablet, phoneSized;\n\n // first check for stronger tablet rules, then phone (see issue#5)\n tablet = impl.findMatch(impl.mobileDetectRules.tablets, userAgent);\n if (tablet) {\n cache.mobile = cache.tablet = tablet;\n cache.phone = null;\n return; // unambiguously identified as tablet\n }\n\n phone = impl.findMatch(impl.mobileDetectRules.phones, userAgent);\n if (phone) {\n cache.mobile = cache.phone = phone;\n cache.tablet = null;\n return; // unambiguously identified as phone\n }\n\n // our rules haven't found a match -> try more general fallback rules\n if (impl.isMobileFallback(userAgent)) {\n phoneSized = MobileDetect.isPhoneSized(maxPhoneWidth);\n if (phoneSized === undefined) {\n cache.mobile = impl.FALLBACK_MOBILE;\n cache.tablet = cache.phone = null;\n } else if (phoneSized) {\n cache.mobile = cache.phone = impl.FALLBACK_PHONE;\n cache.tablet = null;\n } else {\n cache.mobile = cache.tablet = impl.FALLBACK_TABLET;\n cache.phone = null;\n }\n } else if (impl.isTabletFallback(userAgent)) {\n cache.mobile = cache.tablet = impl.FALLBACK_TABLET;\n cache.phone = null;\n } else {\n // not mobile at all!\n cache.mobile = cache.tablet = cache.phone = null;\n }\n };\n\n // t is a reference to a MobileDetect instance\n impl.mobileGrade = function (t) {\n // impl note:\n // To keep in sync w/ Mobile_Detect.php easily, the following code is tightly aligned to the PHP version.\n // When changes are made in Mobile_Detect.php, copy this method and replace:\n // $this-> / t.\n // self::MOBILE_GRADE_(.) / '$1'\n // , self::VERSION_TYPE_FLOAT / (nothing)\n // isIOS() / os('iOS')\n // [reg] / (nothing) <-- jsdelivr complaining about unescaped unicode character U+00AE\n var $isMobile = t.mobile() !== null;\n\n if (\n // Apple iOS 3.2-5.1 - Tested on the original iPad (4.3 / 5.0), iPad 2 (4.3), iPad 3 (5.1), original iPhone (3.1), iPhone 3 (3.2), 3GS (4.3), 4 (4.3 / 5.0), and 4S (5.1)\n t.os('iOS') && t.version('iPad')>=4.3 ||\n t.os('iOS') && t.version('iPhone')>=3.1 ||\n t.os('iOS') && t.version('iPod')>=3.1 ||\n\n // Android 2.1-2.3 - Tested on the HTC Incredible (2.2), original Droid (2.2), HTC Aria (2.1), Google Nexus S (2.3). Functional on 1.5 & 1.6 but performance may be sluggish, tested on Google G1 (1.5)\n // Android 3.1 (Honeycomb) - Tested on the Samsung Galaxy Tab 10.1 and Motorola XOOM\n // Android 4.0 (ICS) - Tested on a Galaxy Nexus. Note: transition performance can be poor on upgraded devices\n // Android 4.1 (Jelly Bean) - Tested on a Galaxy Nexus and Galaxy 7\n ( t.version('Android')>2.1 && t.is('Webkit') ) ||\n\n // Windows Phone 7-7.5 - Tested on the HTC Surround (7.0) HTC Trophy (7.5), LG-E900 (7.5), Nokia Lumia 800\n t.version('Windows Phone OS')>=7.0 ||\n\n // Blackberry 7 - Tested on BlackBerry Torch 9810\n // Blackberry 6.0 - Tested on the Torch 9800 and Style 9670\n t.is('BlackBerry') && t.version('BlackBerry')>=6.0 ||\n // Blackberry Playbook (1.0-2.0) - Tested on PlayBook\n t.match('Playbook.*Tablet') ||\n\n // Palm WebOS (1.4-2.0) - Tested on the Palm Pixi (1.4), Pre (1.4), Pre 2 (2.0)\n ( t.version('webOS')>=1.4 && t.match('Palm|Pre|Pixi') ) ||\n // Palm WebOS 3.0 - Tested on HP TouchPad\n t.match('hp.*TouchPad') ||\n\n // Firefox Mobile (12 Beta) - Tested on Android 2.3 device\n ( t.is('Firefox') && t.version('Firefox')>=12 ) ||\n\n // Chrome for Android - Tested on Android 4.0, 4.1 device\n ( t.is('Chrome') && t.is('AndroidOS') && t.version('Android')>=4.0 ) ||\n\n // Skyfire 4.1 - Tested on Android 2.3 device\n ( t.is('Skyfire') && t.version('Skyfire')>=4.1 && t.is('AndroidOS') && t.version('Android')>=2.3 ) ||\n\n // Opera Mobile 11.5-12: Tested on Android 2.3\n ( t.is('Opera') && t.version('Opera Mobi')>11 && t.is('AndroidOS') ) ||\n\n // Meego 1.2 - Tested on Nokia 950 and N9\n t.is('MeeGoOS') ||\n\n // Tizen (pre-release) - Tested on early hardware\n t.is('Tizen') ||\n\n // Samsung Bada 2.0 - Tested on a Samsung Wave 3, Dolphin browser\n // @todo: more tests here!\n t.is('Dolfin') && t.version('Bada')>=2.0 ||\n\n // UC Browser - Tested on Android 2.3 device\n ( (t.is('UC Browser') || t.is('Dolfin')) && t.version('Android')>=2.3 ) ||\n\n // Kindle 3 and Fire - Tested on the built-in WebKit browser for each\n ( t.match('Kindle Fire') ||\n t.is('Kindle') && t.version('Kindle')>=3.0 ) ||\n\n // Nook Color 1.4.1 - Tested on original Nook Color, not Nook Tablet\n t.is('AndroidOS') && t.is('NookTablet') ||\n\n // Chrome Desktop 11-21 - Tested on OS X 10.7 and Windows 7\n t.version('Chrome')>=11 && !$isMobile ||\n\n // Safari Desktop 4-5 - Tested on OS X 10.7 and Windows 7\n t.version('Safari')>=5.0 && !$isMobile ||\n\n // Firefox Desktop 4-13 - Tested on OS X 10.7 and Windows 7\n t.version('Firefox')>=4.0 && !$isMobile ||\n\n // Internet Explorer 7-9 - Tested on Windows XP, Vista and 7\n t.version('MSIE')>=7.0 && !$isMobile ||\n\n // Opera Desktop 10-12 - Tested on OS X 10.7 and Windows 7\n // @reference: http://my.opera.com/community/openweb/idopera/\n t.version('Opera')>=10 && !$isMobile\n\n ){\n return 'A';\n }\n\n if (\n t.os('iOS') && t.version('iPad')<4.3 ||\n t.os('iOS') && t.version('iPhone')<3.1 ||\n t.os('iOS') && t.version('iPod')<3.1 ||\n\n // Blackberry 5.0: Tested on the Storm 2 9550, Bold 9770\n t.is('Blackberry') && t.version('BlackBerry')>=5 && t.version('BlackBerry')<6 ||\n\n //Opera Mini (5.0-6.5) - Tested on iOS 3.2/4.3 and Android 2.3\n ( t.version('Opera Mini')>=5.0 && t.version('Opera Mini')<=6.5 &&\n (t.version('Android')>=2.3 || t.is('iOS')) ) ||\n\n // Nokia Symbian^3 - Tested on Nokia N8 (Symbian^3), C7 (Symbian^3), also works on N97 (Symbian^1)\n t.match('NokiaN8|NokiaC7|N97.*Series60|Symbian/3') ||\n\n // @todo: report this (tested on Nokia N71)\n t.version('Opera Mobi')>=11 && t.is('SymbianOS')\n ){\n return 'B';\n }\n\n if (\n // Blackberry 4.x - Tested on the Curve 8330\n t.version('BlackBerry')<5.0 ||\n // Windows Mobile - Tested on the HTC Leo (WinMo 5.2)\n t.match('MSIEMobile|Windows CE.*Mobile') || t.version('Windows Mobile')<=5.2\n\n ){\n return 'C';\n }\n\n //All older smartphone platforms and featurephones - Any device that doesn't support media queries\n //will receive the basic, C grade experience.\n return 'C';\n };\n\n impl.detectOS = function (ua) {\n return impl.findMatch(impl.mobileDetectRules.oss0, ua) ||\n impl.findMatch(impl.mobileDetectRules.oss, ua);\n };\n\n impl.getDeviceSmallerSide = function () {\n return window.screen.width < window.screen.height ?\n window.screen.width :\n window.screen.height;\n };\n\n /**\n * Constructor for MobileDetect object.\n *
    \n * Such an object will keep a reference to the given user-agent string and cache most of the detect queries.
    \n *
    \n * Find information how to download and install:\n * github.com/hgoebl/mobile-detect.js/\n *
    \n *\n * @example
    \n     *     var md = new MobileDetect(window.navigator.userAgent);\n     *     if (md.mobile()) {\n     *         location.href = (md.mobileGrade() === 'A') ? '/mobile/' : '/lynx/';\n     *     }\n     * 
    \n *\n * @param {string} userAgent typically taken from window.navigator.userAgent or http_header['User-Agent']\n * @param {number} [maxPhoneWidth=600] only for browsers specify a value for the maximum\n * width of smallest device side (in logical \"CSS\" pixels) until a device detected as mobile will be handled\n * as phone.\n * This is only used in cases where the device cannot be classified as phone or tablet.
    \n * See Declaring Tablet Layouts\n * for Android.
    \n * If you provide a value < 0, then this \"fuzzy\" check is disabled.\n * @constructor\n * @global\n */\n function MobileDetect(userAgent, maxPhoneWidth) {\n this.ua = prepareUserAgent(userAgent);\n this._cache = {};\n //600dp is typical 7\" tablet minimum width\n this.maxPhoneWidth = maxPhoneWidth || 600;\n }\n\n MobileDetect.prototype = {\n constructor: MobileDetect,\n\n /**\n * Returns the detected phone or tablet type or null if it is not a mobile device.\n *
    \n * For a list of possible return values see {@link MobileDetect#phone} and {@link MobileDetect#tablet}.
    \n *
    \n * If the device is not detected by the regular expressions from Mobile-Detect, a test is made against\n * the patterns of detectmobilebrowsers.com. If this test\n * is positive, a value of UnknownPhone, UnknownTablet or\n * UnknownMobile is returned.
    \n * When used in browser, the decision whether phone or tablet is made based on screen.width/height.
    \n *
    \n * When used server-side (node.js), there is no way to tell the difference between UnknownTablet\n * and UnknownMobile, so you will get UnknownMobile here.
    \n * Be aware that since v1.0.0 in this special case you will get UnknownMobile only for:\n * {@link MobileDetect#mobile}, not for {@link MobileDetect#phone} and {@link MobileDetect#tablet}.\n * In versions before v1.0.0 all 3 methods returned UnknownMobile which was tedious to use.\n *
    \n * In most cases you will use the return value just as a boolean.\n *\n * @returns {String} the key for the phone family or tablet family, e.g. \"Nexus\".\n * @function MobileDetect#mobile\n */\n mobile: function () {\n impl.prepareDetectionCache(this._cache, this.ua, this.maxPhoneWidth);\n return this._cache.mobile;\n },\n\n /**\n * Returns the detected phone type/family string or null.\n *
    \n * The returned tablet (family or producer) is one of following keys:
    \n *
    iPhone, BlackBerry, Pixel, HTC, Nexus, Dell, Motorola, Samsung, LG, Sony, Asus,\n * Xiaomi, NokiaLumia, Micromax, Palm, Vertu, Pantech, Fly, Wiko, iMobile,\n * SimValley, Wolfgang, Alcatel, Nintendo, Amoi, INQ, OnePlus, GenericPhone
    \n *
    \n * If the device is not detected by the regular expressions from Mobile-Detect, a test is made against\n * the patterns of detectmobilebrowsers.com. If this test\n * is positive, a value of UnknownPhone or UnknownMobile is returned.
    \n * When used in browser, the decision whether phone or tablet is made based on screen.width/height.
    \n *
    \n * When used server-side (node.js), there is no way to tell the difference between UnknownTablet\n * and UnknownMobile, so you will get null here, while {@link MobileDetect#mobile}\n * will return UnknownMobile.
    \n * Be aware that since v1.0.0 in this special case you will get UnknownMobile only for:\n * {@link MobileDetect#mobile}, not for {@link MobileDetect#phone} and {@link MobileDetect#tablet}.\n * In versions before v1.0.0 all 3 methods returned UnknownMobile which was tedious to use.\n *
    \n * In most cases you will use the return value just as a boolean.\n *\n * @returns {String} the key of the phone family or producer, e.g. \"iPhone\"\n * @function MobileDetect#phone\n */\n phone: function () {\n impl.prepareDetectionCache(this._cache, this.ua, this.maxPhoneWidth);\n return this._cache.phone;\n },\n\n /**\n * Returns the detected tablet type/family string or null.\n *
    \n * The returned tablet (family or producer) is one of following keys:
    \n *
    iPad, NexusTablet, GoogleTablet, SamsungTablet, Kindle, SurfaceTablet,\n * HPTablet, AsusTablet, BlackBerryTablet, HTCtablet, MotorolaTablet, NookTablet,\n * AcerTablet, ToshibaTablet, LGTablet, FujitsuTablet, PrestigioTablet,\n * LenovoTablet, DellTablet, YarvikTablet, MedionTablet, ArnovaTablet,\n * IntensoTablet, IRUTablet, MegafonTablet, EbodaTablet, AllViewTablet,\n * ArchosTablet, AinolTablet, NokiaLumiaTablet, SonyTablet, PhilipsTablet,\n * CubeTablet, CobyTablet, MIDTablet, MSITablet, SMiTTablet, RockChipTablet,\n * FlyTablet, bqTablet, HuaweiTablet, NecTablet, PantechTablet, BronchoTablet,\n * VersusTablet, ZyncTablet, PositivoTablet, NabiTablet, KoboTablet, DanewTablet,\n * TexetTablet, PlaystationTablet, TrekstorTablet, PyleAudioTablet, AdvanTablet,\n * DanyTechTablet, GalapadTablet, MicromaxTablet, KarbonnTablet, AllFineTablet,\n * PROSCANTablet, YONESTablet, ChangJiaTablet, GUTablet, PointOfViewTablet,\n * OvermaxTablet, HCLTablet, DPSTablet, VistureTablet, CrestaTablet,\n * MediatekTablet, ConcordeTablet, GoCleverTablet, ModecomTablet, VoninoTablet,\n * ECSTablet, StorexTablet, VodafoneTablet, EssentielBTablet, RossMoorTablet,\n * iMobileTablet, TolinoTablet, AudioSonicTablet, AMPETablet, SkkTablet,\n * TecnoTablet, JXDTablet, iJoyTablet, FX2Tablet, XoroTablet, ViewsonicTablet,\n * VerizonTablet, OdysTablet, CaptivaTablet, IconbitTablet, TeclastTablet,\n * OndaTablet, JaytechTablet, BlaupunktTablet, DigmaTablet, EvolioTablet,\n * LavaTablet, AocTablet, MpmanTablet, CelkonTablet, WolderTablet, MediacomTablet,\n * MiTablet, NibiruTablet, NexoTablet, LeaderTablet, UbislateTablet,\n * PocketBookTablet, KocasoTablet, HisenseTablet, Hudl, TelstraTablet,\n * GenericTablet
    \n *
    \n * If the device is not detected by the regular expressions from Mobile-Detect, a test is made against\n * the patterns of detectmobilebrowsers.com. If this test\n * is positive, a value of UnknownTablet or UnknownMobile is returned.
    \n * When used in browser, the decision whether phone or tablet is made based on screen.width/height.
    \n *
    \n * When used server-side (node.js), there is no way to tell the difference between UnknownTablet\n * and UnknownMobile, so you will get null here, while {@link MobileDetect#mobile}\n * will return UnknownMobile.
    \n * Be aware that since v1.0.0 in this special case you will get UnknownMobile only for:\n * {@link MobileDetect#mobile}, not for {@link MobileDetect#phone} and {@link MobileDetect#tablet}.\n * In versions before v1.0.0 all 3 methods returned UnknownMobile which was tedious to use.\n *
    \n * In most cases you will use the return value just as a boolean.\n *\n * @returns {String} the key of the tablet family or producer, e.g. \"SamsungTablet\"\n * @function MobileDetect#tablet\n */\n tablet: function () {\n impl.prepareDetectionCache(this._cache, this.ua, this.maxPhoneWidth);\n return this._cache.tablet;\n },\n\n /**\n * Returns the (first) detected user-agent string or null.\n *
    \n * The returned user-agent is one of following keys:
    \n *
    Chrome, Dolfin, Opera, Skyfire, Edge, IE, Firefox, Bolt, TeaShark, Blazer,\n * Safari, WeChat, UCBrowser, baiduboxapp, baidubrowser, DiigoBrowser, Mercury,\n * ObigoBrowser, NetFront, GenericBrowser, PaleMoon
    \n *
    \n * In most cases calling {@link MobileDetect#userAgent} will be sufficient. But there are rare\n * cases where a mobile device pretends to be more than one particular browser. You can get the\n * list of all matches with {@link MobileDetect#userAgents} or check for a particular value by\n * providing one of the defined keys as first argument to {@link MobileDetect#is}.\n *\n * @returns {String} the key for the detected user-agent or null\n * @function MobileDetect#userAgent\n */\n userAgent: function () {\n if (this._cache.userAgent === undefined) {\n this._cache.userAgent = impl.findMatch(impl.mobileDetectRules.uas, this.ua);\n }\n return this._cache.userAgent;\n },\n\n /**\n * Returns all detected user-agent strings.\n *
    \n * The array is empty or contains one or more of following keys:
    \n *
    Chrome, Dolfin, Opera, Skyfire, Edge, IE, Firefox, Bolt, TeaShark, Blazer,\n * Safari, WeChat, UCBrowser, baiduboxapp, baidubrowser, DiigoBrowser, Mercury,\n * ObigoBrowser, NetFront, GenericBrowser, PaleMoon
    \n *
    \n * In most cases calling {@link MobileDetect#userAgent} will be sufficient. But there are rare\n * cases where a mobile device pretends to be more than one particular browser. You can get the\n * list of all matches with {@link MobileDetect#userAgents} or check for a particular value by\n * providing one of the defined keys as first argument to {@link MobileDetect#is}.\n *\n * @returns {Array} the array of detected user-agent keys or []\n * @function MobileDetect#userAgents\n */\n userAgents: function () {\n if (this._cache.userAgents === undefined) {\n this._cache.userAgents = impl.findMatches(impl.mobileDetectRules.uas, this.ua);\n }\n return this._cache.userAgents;\n },\n\n /**\n * Returns the detected operating system string or null.\n *
    \n * The operating system is one of following keys:
    \n *
    AndroidOS, BlackBerryOS, PalmOS, SymbianOS, WindowsMobileOS, WindowsPhoneOS,\n * iOS, iPadOS, SailfishOS, MeeGoOS, MaemoOS, JavaOS, webOS, badaOS, BREWOS
    \n *\n * @returns {String} the key for the detected operating system.\n * @function MobileDetect#os\n */\n os: function () {\n if (this._cache.os === undefined) {\n this._cache.os = impl.detectOS(this.ua);\n }\n return this._cache.os;\n },\n\n /**\n * Get the version (as Number) of the given property in the User-Agent.\n *
    \n * Will return a float number. (eg. 2_0 will return 2.0, 4.3.1 will return 4.31)\n *\n * @param {String} key a key defining a thing which has a version.
    \n * You can use one of following keys:
    \n *
    Mobile, Build, Version, VendorID, iPad, iPhone, iPod, Kindle, Chrome, Coast,\n * Dolfin, Firefox, Fennec, Edge, IE, NetFront, NokiaBrowser, Opera, Opera Mini,\n * Opera Mobi, UCBrowser, MQQBrowser, MicroMessenger, baiduboxapp, baidubrowser,\n * SamsungBrowser, Iron, Safari, Skyfire, Tizen, Webkit, PaleMoon,\n * SailfishBrowser, Gecko, Trident, Presto, Goanna, iOS, Android, Sailfish,\n * BlackBerry, BREW, Java, Windows Phone OS, Windows Phone, Windows CE, Windows\n * NT, Symbian, webOS
    \n *\n * @returns {Number} the version as float or NaN if User-Agent doesn't contain this version.\n * Be careful when comparing this value with '==' operator!\n * @function MobileDetect#version\n */\n version: function (key) {\n return impl.getVersion(key, this.ua);\n },\n\n /**\n * Get the version (as String) of the given property in the User-Agent.\n *
    \n *\n * @param {String} key a key defining a thing which has a version.
    \n * You can use one of following keys:
    \n *
    Mobile, Build, Version, VendorID, iPad, iPhone, iPod, Kindle, Chrome, Coast,\n * Dolfin, Firefox, Fennec, Edge, IE, NetFront, NokiaBrowser, Opera, Opera Mini,\n * Opera Mobi, UCBrowser, MQQBrowser, MicroMessenger, baiduboxapp, baidubrowser,\n * SamsungBrowser, Iron, Safari, Skyfire, Tizen, Webkit, PaleMoon,\n * SailfishBrowser, Gecko, Trident, Presto, Goanna, iOS, Android, Sailfish,\n * BlackBerry, BREW, Java, Windows Phone OS, Windows Phone, Windows CE, Windows\n * NT, Symbian, webOS
    \n *\n * @returns {String} the \"raw\" version as String or null if User-Agent doesn't contain this version.\n *\n * @function MobileDetect#versionStr\n */\n versionStr: function (key) {\n return impl.getVersionStr(key, this.ua);\n },\n\n /**\n * Global test key against userAgent, os, phone, tablet and some other properties of userAgent string.\n *\n * @param {String} key the key (case-insensitive) of a userAgent, an operating system, phone or\n * tablet family.
    \n * For a complete list of possible values, see {@link MobileDetect#userAgent},\n * {@link MobileDetect#os}, {@link MobileDetect#phone}, {@link MobileDetect#tablet}.
    \n * Additionally you have following keys:
    \n *
    Bot, MobileBot, DesktopMode, TV, WebKit, Console, Watch
    \n *\n * @returns {boolean} true when the given key is one of the defined keys of userAgent, os, phone,\n * tablet or one of the listed additional keys, otherwise false\n * @function MobileDetect#is\n */\n is: function (key) {\n return containsIC(this.userAgents(), key) ||\n equalIC(key, this.os()) ||\n equalIC(key, this.phone()) ||\n equalIC(key, this.tablet()) ||\n containsIC(impl.findMatches(impl.mobileDetectRules.utils, this.ua), key);\n },\n\n /**\n * Do a quick test against navigator::userAgent.\n *\n * @param {String|RegExp} pattern the pattern, either as String or RegExp\n * (a string will be converted to a case-insensitive RegExp).\n * @returns {boolean} true when the pattern matches, otherwise false\n * @function MobileDetect#match\n */\n match: function (pattern) {\n if (!(pattern instanceof RegExp)) {\n pattern = new RegExp(pattern, 'i');\n }\n return pattern.test(this.ua);\n },\n\n /**\n * Checks whether the mobile device can be considered as phone regarding screen.width.\n *
    \n * Obviously this method makes sense in browser environments only (not for Node.js)!\n * @param {number} [maxPhoneWidth] the maximum logical pixels (aka. CSS-pixels) to be considered as phone.
    \n * The argument is optional and if not present or falsy, the value of the constructor is taken.\n * @returns {boolean|undefined} undefined if screen size wasn't detectable, else true\n * when screen.width is less or equal to maxPhoneWidth, otherwise false.
    \n * Will always return undefined server-side.\n */\n isPhoneSized: function (maxPhoneWidth) {\n return MobileDetect.isPhoneSized(maxPhoneWidth || this.maxPhoneWidth);\n },\n\n /**\n * Returns the mobile grade ('A', 'B', 'C').\n *\n * @returns {String} one of the mobile grades ('A', 'B', 'C').\n * @function MobileDetect#mobileGrade\n */\n mobileGrade: function () {\n if (this._cache.grade === undefined) {\n this._cache.grade = impl.mobileGrade(this);\n }\n return this._cache.grade;\n }\n };\n\n // environment-dependent\n if (typeof window !== 'undefined' && window.screen) {\n MobileDetect.isPhoneSized = function (maxPhoneWidth) {\n return maxPhoneWidth < 0 ? undefined : impl.getDeviceSmallerSide() <= maxPhoneWidth;\n };\n } else {\n MobileDetect.isPhoneSized = function () {};\n }\n\n // should not be replaced by a completely new object - just overwrite existing methods\n MobileDetect._impl = impl;\n \n MobileDetect.version = '1.4.5 2021-03-13';\n\n return MobileDetect;\n}); // end of call of define()\n})((function (undefined) {\n if (typeof module !== 'undefined' && module.exports) {\n return function (factory) { module.exports = factory(); };\n } else if (typeof define === 'function' && define.amd) {\n return define;\n } else if (typeof window !== 'undefined') {\n return function (factory) { window.MobileDetect = factory(); };\n } else {\n // please file a bug if you get this error!\n throw new Error('unknown environment');\n }\n})());", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nclass CaretString {\n constructor(str, caretPosition) {\n this.str = str;\n this.caretPosition = caretPosition;\n }\n}\nexports.CaretString = CaretString;\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nclass Next {\n constructor(state, insert, pass, value) {\n this.state = state;\n this.insert = insert;\n this.pass = pass;\n this.value = value;\n }\n}\nexports.Next = Next;\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nclass Notation {\n constructor(character, characterSet, isOptional) {\n this.character = character;\n this.characterSet = characterSet;\n this.isOptional = isOptional;\n }\n}\nexports.Notation = Notation;\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nfunction isNull(value) {\n return value === null;\n}\nexports.isNull = isNull;\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst isNull_1 = require(\"../util/isNull\");\nclass State {\n constructor(child) {\n this.child = child;\n }\n autocomplete() {\n return null;\n }\n nextState() {\n if (!isNull_1.isNull(this.child)) {\n return this.child;\n }\n else {\n throw new Error('Value cannot be null');\n }\n }\n toString() {\n return 'BASE -> ' + !isNull_1.isNull(this.child) ? this.child.toString() : 'null';\n }\n}\nexports.State = State;\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst state_1 = require(\"../state\");\nclass EOLState extends state_1.State {\n constructor(child = null) {\n super(child);\n this.child = child;\n }\n accept(character) {\n return null;\n }\n toString() {\n return 'EOL';\n }\n}\nexports.EOLState = EOLState;\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst state_1 = require(\"../state\");\nconst next_1 = require(\"../next\");\nconst isNull_1 = require(\"../../util/isNull\");\nclass FixedState extends state_1.State {\n constructor(child, ownCharacter) {\n super(child);\n this.child = child;\n this.ownCharacter = ownCharacter;\n }\n accept(character) {\n if (this.ownCharacter === character) {\n return new next_1.Next(this.nextState(), character, true, character);\n }\n else {\n return new next_1.Next(this.nextState(), this.ownCharacter, false, this.ownCharacter);\n }\n }\n autocomplete() {\n return new next_1.Next(this.nextState(), this.ownCharacter, false, this.ownCharacter);\n }\n toString() {\n return `{${this.ownCharacter}} -> ` + (!isNull_1.isNull(this.child) ? this.child.toString() : 'null');\n }\n}\nexports.FixedState = FixedState;\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst state_1 = require(\"../state\");\nconst next_1 = require(\"../next\");\nconst isNull_1 = require(\"../../util/isNull\");\nclass FreeState extends state_1.State {\n constructor(child, ownCharacter) {\n super(child);\n this.child = child;\n this.ownCharacter = ownCharacter;\n }\n accept(character) {\n if (this.ownCharacter === character) {\n return new next_1.Next(this.nextState(), character, true, null);\n }\n else {\n return new next_1.Next(this.nextState(), this.ownCharacter, false, null);\n }\n }\n autocomplete() {\n return new next_1.Next(this.nextState(), this.ownCharacter, false, null);\n }\n toString() {\n return `${this.ownCharacter} -> ` + (!isNull_1.isNull(this.child) ? this.child.toString() : 'null');\n }\n}\nexports.FreeState = FreeState;\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nString.prototype.isDigit = function () {\n return this.search(/^[0-9]$/) !== -1;\n};\n/**\n * https://stackoverflow.com/questions/150033/regular-expression-to-match-non-ascii-characters\n */\nString.prototype.isLetter = function () {\n return this.search(/^[\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0\\u08A2-\\u08AC\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097F\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191C\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA697\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA793\\uA7A0-\\uA7AA\\uA7F8-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA80-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]$/) !== -1;\n};\nString.prototype.isLetterOrDigit = function () {\n return this.isDigit() || this.isLetter();\n};\nString.prototype.contains = function (char) {\n return this.search(char) !== -1;\n};\nString.prototype.isEmpty = function () {\n return this.length === 0;\n};\nString.prototype.first = function () {\n return this.charAt(0);\n};\nString.prototype.toCharArray = function () {\n return this.split('');\n};\nString.prototype.prefixIntersection = function (another) {\n if (this.isEmpty() || another.isEmpty())\n return '';\n let endIndex = 0;\n while (endIndex < this.length && endIndex < another.length) {\n if (this[endIndex] === another[endIndex]) {\n ++endIndex;\n }\n else {\n return this.substring(0, endIndex);\n }\n }\n return this.substring(0, endIndex);\n};\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst state_1 = require(\"../state\");\nconst next_1 = require(\"../next\");\nrequire(\"../../util/string\");\nconst isNull_1 = require(\"../../util/isNull\");\nclass OptionalValueState extends state_1.State {\n constructor(child, type) {\n super(child);\n this.child = child;\n this.type = type;\n }\n accept(character) {\n if (this.accepts(character)) {\n return new next_1.Next(this.nextState(), character, true, character);\n }\n else {\n return new next_1.Next(this.nextState(), null, false, null);\n }\n }\n toString() {\n const type = this.type;\n if (type instanceof OptionalValueState.Numeric) {\n return '[a] -> ' + (!isNull_1.isNull(this.child) ? this.child.toString() : 'null');\n }\n else if (type instanceof OptionalValueState.Literal) {\n return '[9] -> ' + (!isNull_1.isNull(this.child) ? this.child.toString() : 'null');\n }\n else if (type instanceof OptionalValueState.AlphaNumeric) {\n return '[-] -> ' + (!isNull_1.isNull(this.child) ? this.child.toString() : 'null');\n }\n else if (type instanceof OptionalValueState.Custom) {\n return `[${type.character}] -> ` + (!isNull_1.isNull(this.child) ? this.child.toString() : 'null');\n }\n else {\n throw new Error(\"Doesn't match any supported type\");\n }\n }\n accepts(character) {\n const type = this.type;\n if (type instanceof OptionalValueState.Numeric) {\n return character.isDigit();\n }\n else if (type instanceof OptionalValueState.Literal) {\n return character.isLetter();\n }\n else if (type instanceof OptionalValueState.AlphaNumeric) {\n return character.isLetterOrDigit();\n }\n else if (type instanceof OptionalValueState.Custom) {\n return type.characterSet.includes(character);\n }\n else {\n throw new Error(\"Doesn't match any supported type\");\n }\n }\n}\nexports.OptionalValueState = OptionalValueState;\n(function (OptionalValueState) {\n class StateType {\n }\n OptionalValueState.StateType = StateType;\n class Literal extends StateType {\n }\n OptionalValueState.Literal = Literal;\n class Numeric extends StateType {\n }\n OptionalValueState.Numeric = Numeric;\n class AlphaNumeric extends StateType {\n }\n OptionalValueState.AlphaNumeric = AlphaNumeric;\n class Ellipsis extends StateType {\n constructor(inheritedType) {\n super();\n this.inheritedType = inheritedType;\n }\n }\n OptionalValueState.Ellipsis = Ellipsis;\n class Custom extends StateType {\n constructor(character, characterSet) {\n super();\n this.character = character;\n this.characterSet = characterSet;\n }\n }\n OptionalValueState.Custom = Custom;\n})(OptionalValueState = exports.OptionalValueState || (exports.OptionalValueState = {}));\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst state_1 = require(\"../state\");\nconst next_1 = require(\"../next\");\nrequire(\"../../util/string\");\nconst isNull_1 = require(\"../../util/isNull\");\nclass ValueState extends state_1.State {\n constructor(child, type) {\n super(child);\n this.child = child;\n this.type = type;\n this.isElliptical = type instanceof ValueState.Ellipsis;\n }\n accept(character) {\n if (!this.accepts(character)) {\n return null;\n }\n return new next_1.Next(this.nextState(), character, true, character);\n }\n nextState() {\n if (this.type instanceof ValueState.Ellipsis) {\n return this;\n }\n else {\n return super.nextState();\n }\n }\n toString() {\n const type = this.type;\n if (type instanceof ValueState.Numeric) {\n return '[A] -> ' + (!isNull_1.isNull(this.child) ? this.child.toString() : 'null');\n }\n else if (type instanceof ValueState.Literal) {\n return '[0] -> ' + (!isNull_1.isNull(this.child) ? this.child.toString() : 'null');\n }\n else if (type instanceof ValueState.AlphaNumeric) {\n return '[_] -> ' + (!isNull_1.isNull(this.child) ? this.child.toString() : 'null');\n }\n else if (type instanceof ValueState.Ellipsis) {\n return '[...] -> ' + (!isNull_1.isNull(this.child) ? this.child.toString() : 'null');\n }\n else if (type instanceof ValueState.Custom) {\n return `[${type.character}] -> ` + (!isNull_1.isNull(this.child) ? this.child.toString() : 'null');\n }\n else {\n throw new Error(\"Doesn't match any supported type\");\n }\n }\n accepts(character) {\n const type = this.type;\n if (type instanceof ValueState.Numeric) {\n return character.isDigit();\n }\n else if (type instanceof ValueState.Literal) {\n return character.isLetter();\n }\n else if (type instanceof ValueState.AlphaNumeric) {\n return character.isLetterOrDigit();\n }\n else if (type instanceof ValueState.Ellipsis) {\n if (type instanceof ValueState.Numeric) {\n return character.isDigit();\n }\n else if (type instanceof ValueState.Literal) {\n return character.isLetter();\n }\n else if (type instanceof ValueState.AlphaNumeric) {\n return character.isLetterOrDigit();\n }\n else {\n return false;\n }\n }\n else if (type instanceof ValueState.Custom) {\n return type.characterSet.includes(character);\n }\n else {\n throw new Error(\"Doesn't match any supported type\");\n }\n }\n}\nexports.ValueState = ValueState;\n(function (ValueState) {\n class StateType {\n }\n ValueState.StateType = StateType;\n class Literal extends StateType {\n }\n ValueState.Literal = Literal;\n class Numeric extends StateType {\n }\n ValueState.Numeric = Numeric;\n class AlphaNumeric extends StateType {\n }\n ValueState.AlphaNumeric = AlphaNumeric;\n class Ellipsis extends StateType {\n constructor(inheritedType) {\n super();\n this.inheritedType = inheritedType;\n }\n }\n ValueState.Ellipsis = Ellipsis;\n class Custom extends StateType {\n constructor(character, characterSet) {\n super();\n this.character = character;\n this.characterSet = characterSet;\n }\n }\n ValueState.Custom = Custom;\n})(ValueState = exports.ValueState || (exports.ValueState = {}));\n", "\"use strict\";\nfunction __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n}\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__export(require(\"./caret-string\"));\n__export(require(\"./next\"));\n__export(require(\"./notation\"));\n__export(require(\"./state\"));\n__export(require(\"./state/e-o-l-state\"));\n__export(require(\"./state/fixed-state\"));\n__export(require(\"./state/free-state\"));\n__export(require(\"./state/optional-value-state\"));\n__export(require(\"./state/value-state\"));\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst model_1 = require(\"../model\");\nrequire(\"../util/string\");\nvar AffinityCalculationStrategy;\n(function (AffinityCalculationStrategy) {\n AffinityCalculationStrategy[AffinityCalculationStrategy[\"WHOLE_STRING\"] = 0] = \"WHOLE_STRING\";\n AffinityCalculationStrategy[AffinityCalculationStrategy[\"PREFIX\"] = 1] = \"PREFIX\";\n})(AffinityCalculationStrategy = exports.AffinityCalculationStrategy || (exports.AffinityCalculationStrategy = {}));\nclass AffinityCalculation {\n constructor(strategy) {\n this.strategy = strategy;\n }\n calculateAffinityOfMask(mask, text, autocomplete) {\n switch (this.strategy) {\n case AffinityCalculationStrategy.WHOLE_STRING: {\n return mask.apply(new model_1.CaretString(text.str, text.caretPosition), autocomplete).affinity;\n }\n case AffinityCalculationStrategy.PREFIX: {\n return mask.apply(new model_1.CaretString(text.str, text.caretPosition), autocomplete).formattedText.str.prefixIntersection(text.str).length;\n }\n }\n }\n}\nexports.AffinityCalculation = AffinityCalculation;\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nclass FormatSanitizer {\n static sanitize(formatString) {\n try {\n FormatSanitizer.checkOpenBraces(formatString);\n const blocks = FormatSanitizer.divideBlocksWithMixedCharacters(FormatSanitizer.getFormatBlocks(formatString));\n return FormatSanitizer.sortFormatBlocks(blocks).join('');\n }\n catch (e) {\n throw new Error('Wrong format');\n }\n }\n static getFormatBlocks(formatString) {\n const blocks = new Array();\n let currentBlock = '';\n let escape = false;\n for (const char of formatString.toCharArray()) {\n if (char === '\\\\') {\n if (!escape) {\n escape = true;\n currentBlock += char;\n continue;\n }\n }\n if ((char === '[' || char === '{') && !escape) {\n if (!currentBlock.isEmpty()) {\n blocks.push(currentBlock);\n }\n currentBlock = '';\n }\n currentBlock += char;\n if ((char === ']' || char === '}') && !escape) {\n blocks.push(currentBlock);\n currentBlock = '';\n }\n escape = false;\n }\n if (!currentBlock.isEmpty()) {\n blocks.push(currentBlock);\n }\n return blocks;\n }\n static divideBlocksWithMixedCharacters(blocks) {\n const resultingBlocks = new Array();\n for (const block of blocks) {\n if (block.startsWith('[')) {\n let blockBuffer = '';\n for (const blockCharacter of block) {\n if (blockCharacter === '[') {\n blockBuffer += blockCharacter;\n continue;\n }\n if (blockCharacter === ']' && !blockBuffer.endsWith('\\\\')) {\n blockBuffer += blockCharacter;\n resultingBlocks.push(blockBuffer);\n break;\n }\n if (blockCharacter === '0' || blockCharacter === '9') {\n if (blockBuffer.contains('A')\n || blockBuffer.contains('a')\n || blockBuffer.contains('-')\n || blockBuffer.contains('_')) {\n blockBuffer += ']';\n resultingBlocks.push(blockBuffer);\n blockBuffer = `[${blockCharacter}`;\n continue;\n }\n }\n if (blockCharacter === 'A' || blockCharacter === 'a') {\n if (blockBuffer.contains('0')\n || blockBuffer.contains('9')\n || blockBuffer.contains('-')\n || blockBuffer.contains('_')) {\n blockBuffer += ']';\n resultingBlocks.push(blockBuffer);\n blockBuffer = `[${blockCharacter}`;\n continue;\n }\n }\n if (blockCharacter === '-' || blockCharacter === '_') {\n if (blockBuffer.contains('0')\n || blockBuffer.contains('9')\n || blockBuffer.contains('A')\n || blockBuffer.contains('a')) {\n blockBuffer += ']';\n resultingBlocks.push(blockBuffer);\n blockBuffer = `[${blockCharacter}`;\n continue;\n }\n }\n blockBuffer += blockCharacter;\n }\n }\n else {\n resultingBlocks.push(block);\n }\n }\n return resultingBlocks;\n }\n static sortFormatBlocks(blocks) {\n const sortedBlocks = new Array();\n for (let block of blocks) {\n let sortedBlock;\n if (block.startsWith('[')) {\n if (block.contains('0') || block.contains('9')) {\n block = block.replace(/\\[/g, '')\n .replace(/]/g, '');\n sortedBlock = '[' + block\n .toCharArray()\n .sort()\n .join('') + ']';\n }\n else if (block.contains('a') || block.contains('A')) {\n block = block.replace(/\\[/g, '')\n .replace(/]/g, '');\n sortedBlock = '[' + block\n .toCharArray()\n .sort()\n .join('') + ']';\n }\n else {\n block = block.replace(/\\[/g, '')\n .replace(/]/g, '')\n .replace(/_/g, 'A')\n .replace(/-/g, 'a');\n sortedBlock = '[' + block\n .toCharArray()\n .sort()\n .join('') + ']';\n sortedBlock = sortedBlock\n .replace(/A/g, '_')\n .replace(/a/g, '-');\n }\n }\n else {\n sortedBlock = block;\n }\n sortedBlocks.push(sortedBlock);\n }\n return sortedBlocks;\n }\n static checkOpenBraces(str) {\n let escape = false;\n let squareBraceOpen = false;\n let curlyBraceOpen = false;\n for (const char of str.toCharArray()) {\n if (char === '\\\\') {\n escape = !escape;\n continue;\n }\n if (char === '[') {\n if (squareBraceOpen) {\n throw new Error('Wrong format');\n }\n squareBraceOpen = !escape;\n }\n if (char === ']' && !escape) {\n squareBraceOpen = false;\n }\n if (char === '{') {\n if (curlyBraceOpen) {\n throw new Error('Wrong format');\n }\n curlyBraceOpen = !escape;\n }\n if (char === '}' && !escape) {\n curlyBraceOpen = false;\n }\n escape = false;\n }\n }\n}\nexports.FormatSanitizer = FormatSanitizer;\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst model_1 = require(\"../model\");\nconst format_sanitizer_1 = require(\"./format-sanitizer\");\nclass Compiler {\n constructor(customNotations) {\n this.customNotations = customNotations;\n }\n compile(formatString) {\n try {\n const sanitizedString = format_sanitizer_1.FormatSanitizer.sanitize(formatString);\n return this._compile(sanitizedString, false, false, null);\n }\n catch (e) {\n throw new Error('Wrong format');\n }\n }\n _compile(formatString, valuable, fixed, lastCharacter) {\n if (formatString.isEmpty()) {\n return new model_1.EOLState();\n }\n const char = formatString.first();\n switch (char) {\n case '[': {\n if (lastCharacter !== '\\\\') {\n return this._compile(formatString.substring(1), true, false, char);\n }\n break;\n }\n case '{': {\n if (lastCharacter !== '\\\\') {\n return this._compile(formatString.substring(1), false, true, char);\n }\n break;\n }\n case ']': {\n if (lastCharacter !== '\\\\') {\n return this._compile(formatString.substring(1), false, false, char);\n }\n break;\n }\n case '}': {\n if (lastCharacter !== '\\\\') {\n return this._compile(formatString.substring(1), false, false, char);\n }\n break;\n }\n case '\\\\': {\n if (lastCharacter !== '\\\\') {\n return this._compile(formatString.substring(1), valuable, fixed, char);\n }\n break;\n }\n }\n if (valuable) {\n switch (char) {\n case '0': {\n return new model_1.ValueState(this._compile(formatString.substring(1), true, false, char), new model_1.ValueState.Numeric());\n }\n case 'A': {\n return new model_1.ValueState(this._compile(formatString.substring(1), true, false, char), new model_1.ValueState.Literal());\n }\n case '_': {\n return new model_1.ValueState(this._compile(formatString.substring(1), true, false, char), new model_1.ValueState.AlphaNumeric());\n }\n case '...': {\n return new model_1.ValueState(null, this.determineInheritedType(lastCharacter));\n }\n case '9': {\n return new model_1.OptionalValueState(this._compile(formatString.substring(1), true, false, char), new model_1.OptionalValueState.Numeric());\n }\n case 'a': {\n return new model_1.OptionalValueState(this._compile(formatString.substring(1), true, false, char), new model_1.OptionalValueState.Literal());\n }\n case '-': {\n return new model_1.OptionalValueState(this._compile(formatString.substring(1), true, false, char), new model_1.OptionalValueState.AlphaNumeric());\n }\n default: {\n return this.compileWithCustomNotations(char, formatString);\n }\n }\n }\n if (fixed) {\n return new model_1.FixedState(this._compile(formatString.substring(1), false, true, char), char);\n }\n return new model_1.FreeState(this._compile(formatString.substring(1), false, false, char), char);\n }\n determineInheritedType(lastCharacter) {\n switch (lastCharacter) {\n case '0' || '9': {\n return new model_1.ValueState.Numeric();\n }\n case 'A' || 'a': {\n return new model_1.ValueState.Literal();\n }\n case '_' || '_': {\n return new model_1.ValueState.AlphaNumeric();\n }\n case '...': {\n return new model_1.ValueState.AlphaNumeric();\n }\n case '[': {\n return new model_1.ValueState.AlphaNumeric();\n }\n default: {\n return this.determineTypeWithCustomNotation(lastCharacter);\n }\n }\n }\n compileWithCustomNotations(char, str) {\n const notation = this.customNotations.find(x => x.character === char);\n if (!notation)\n throw new Error('Wrong format');\n if (notation.isOptional) {\n return new model_1.OptionalValueState(this._compile(str.substring(1), true, false, char), new model_1.OptionalValueState.Custom(char, notation.characterSet));\n }\n else {\n return new model_1.ValueState(this._compile(str.substring(1), true, false, char), new model_1.ValueState.Custom(char, notation.characterSet));\n }\n }\n determineTypeWithCustomNotation(lastCharacter) {\n for (const notation of this.customNotations) {\n if (notation.character === lastCharacter) {\n return new model_1.ValueState.Custom(lastCharacter, notation.characterSet);\n }\n }\n throw new Error('Wrong format');\n }\n}\nexports.Compiler = Compiler;\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nclass CaretStringIterator {\n constructor(caretString, currentIndex = 0) {\n this.caretString = caretString;\n this.currentIndex = currentIndex;\n }\n beforeCaret() {\n return this.currentIndex <= this.caretString.caretPosition\n || (this.currentIndex === 0 && this.caretString.caretPosition === 0);\n }\n next() {\n if (this.currentIndex >= this.caretString.str.length) {\n return null;\n }\n const char = this.caretString.str.toCharArray()[this.currentIndex];\n ++this.currentIndex;\n return char;\n }\n}\nexports.CaretStringIterator = CaretStringIterator;\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst model_1 = require(\"../model\");\nconst compiler_1 = require(\"./compiler\");\nconst caret_string_iterator_1 = require(\"./caret-string-iterator\");\nclass Mask {\n constructor(format, customNotations) {\n this.format = format;\n this.customNotations = customNotations;\n this.initialState = new compiler_1.Compiler(this.customNotations).compile(this.format);\n this.placeholder = () => this.appendPlaceholder(this.initialState, '');\n }\n static getOrCreate(format, customNotations) {\n let cachedMask = Mask.cache.get(format);\n if (!cachedMask) {\n cachedMask = new Mask(format, customNotations);\n Mask.cache.set(format, cachedMask);\n }\n return cachedMask;\n }\n apply(text, autocomplete) {\n const iterator = new caret_string_iterator_1.CaretStringIterator(text);\n let affinity = 0;\n let extractedValue = '';\n let modifiedString = '';\n let modifiedCaretPosition = text.caretPosition;\n let state = this.initialState;\n let beforeCaret = iterator.beforeCaret();\n let character = iterator.next();\n let next;\n while (!!character) {\n next = state.accept(character);\n if (!!next) {\n state = next.state;\n modifiedString += !!next.insert ? next.insert : '';\n extractedValue += !!next.value ? next.value : '';\n if (next.pass) {\n beforeCaret = iterator.beforeCaret();\n character = iterator.next();\n ++affinity;\n }\n else {\n if (beforeCaret && next.insert !== null) {\n ++modifiedCaretPosition;\n }\n --affinity;\n }\n }\n else {\n if (iterator.beforeCaret()) {\n --modifiedCaretPosition;\n }\n beforeCaret = iterator.beforeCaret();\n character = iterator.next();\n --affinity;\n }\n }\n while (autocomplete && beforeCaret) {\n const nxt = state.autocomplete();\n if (nxt === null) {\n break;\n }\n state = nxt.state;\n modifiedString += !!nxt.insert ? nxt.insert : '';\n extractedValue += !!nxt.value ? nxt.value : '';\n if (nxt.insert !== null) {\n ++modifiedCaretPosition;\n }\n }\n return new Mask.Result(new model_1.CaretString(modifiedString, modifiedCaretPosition), extractedValue, affinity, this.noMandatoryCharactersLeftAfterState(state));\n }\n acceptableTextLength() {\n let state = this.initialState;\n let length = 0;\n while (!!state && !(state instanceof model_1.EOLState)) {\n if (state instanceof model_1.FixedState\n || state instanceof model_1.FreeState\n || state instanceof model_1.ValueState) {\n ++length;\n }\n state = state.child;\n }\n return length;\n }\n totalTextLength() {\n let state = this.initialState;\n let length = 0;\n while (!!state && !(state instanceof model_1.EOLState)) {\n if (state instanceof model_1.FixedState\n || state instanceof model_1.FreeState\n || state instanceof model_1.ValueState\n || state instanceof model_1.OptionalValueState) {\n ++length;\n }\n state = state.child;\n }\n return length;\n }\n acceptableValueLength() {\n let state = this.initialState;\n let length = 0;\n while (!!state && !(state instanceof model_1.EOLState)) {\n if (state instanceof model_1.FixedState\n || state instanceof model_1.ValueState) {\n ++length;\n }\n state = state.child;\n }\n return length;\n }\n totalValueLength() {\n let state = this.initialState;\n let length = 0;\n while (!!state && !(state instanceof model_1.EOLState)) {\n if (state instanceof model_1.FixedState\n || state instanceof model_1.ValueState\n || state instanceof model_1.OptionalValueState) {\n ++length;\n }\n state = state.child;\n }\n return length;\n }\n noMandatoryCharactersLeftAfterState(state) {\n if (state instanceof model_1.EOLState) {\n return true;\n }\n else if (state instanceof model_1.ValueState) {\n return state.isElliptical;\n }\n else if (state instanceof model_1.FixedState) {\n return false;\n }\n else {\n return this.noMandatoryCharactersLeftAfterState(state.nextState());\n }\n }\n appendPlaceholder(state, placeholder) {\n if (state === null) {\n return placeholder;\n }\n if (state instanceof model_1.EOLState) {\n return placeholder;\n }\n if (state instanceof model_1.FixedState) {\n return this.appendPlaceholder(state.child, placeholder.concat(state.ownCharacter.toString()));\n }\n if (state instanceof model_1.FreeState) {\n return this.appendPlaceholder(state.child, placeholder.concat(state.ownCharacter.toString()));\n }\n if (state instanceof model_1.OptionalValueState) {\n if (state.type instanceof model_1.OptionalValueState.AlphaNumeric) {\n return this.appendPlaceholder(state.child, placeholder + '-');\n }\n if (state.type instanceof model_1.OptionalValueState.Numeric) {\n return this.appendPlaceholder(state.child, placeholder + '0');\n }\n if (state.type instanceof model_1.OptionalValueState.Literal) {\n return this.appendPlaceholder(state.child, placeholder + 'a');\n }\n if (state.type instanceof model_1.OptionalValueState.Custom) {\n return this.appendPlaceholder(state.child, placeholder.concat(state.type.character.toString()));\n }\n }\n if (state instanceof model_1.ValueState) {\n if (state.type instanceof model_1.ValueState.AlphaNumeric) {\n return this.appendPlaceholder(state.child, placeholder + '-');\n }\n if (state.type instanceof model_1.ValueState.Numeric) {\n return this.appendPlaceholder(state.child, placeholder + '0');\n }\n if (state.type instanceof model_1.ValueState.Literal) {\n return this.appendPlaceholder(state.child, placeholder + 'a');\n }\n if (state.type instanceof model_1.ValueState.Ellipsis) {\n return placeholder;\n }\n if (state.type instanceof model_1.ValueState.Custom) {\n return this.appendPlaceholder(state.child, placeholder.concat(state.type.character.toString()));\n }\n }\n return placeholder;\n }\n}\nexports.Mask = Mask;\nMask.cache = new Map();\n(function (Mask) {\n class Result {\n constructor(formattedText, extractedValue, affinity, complete) {\n this.formattedText = formattedText;\n this.extractedValue = extractedValue;\n this.affinity = affinity;\n this.complete = complete;\n }\n }\n Mask.Result = Result;\n})(Mask = exports.Mask || (exports.Mask = {}));\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nclass MaskAffinity {\n constructor(mask, affinity) {\n this.mask = mask;\n this.affinity = affinity;\n }\n}\nexports.MaskAffinity = MaskAffinity;\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst model_1 = require(\"./model\");\nconst affinity_calculation_strategy_1 = require(\"./helper/affinity-calculation-strategy\");\nconst mask_1 = require(\"./helper/mask\");\nconst mask_affinity_1 = require(\"./helper/mask-affinity\");\nclass MaskedTextChangedListener {\n constructor(primaryFormat, field, listener, affineFormats = [], customNotations = [], affinityCalculationStrategy = new affinity_calculation_strategy_1.AffinityCalculation(affinity_calculation_strategy_1.AffinityCalculationStrategy.WHOLE_STRING), autocomplete = true) {\n this.primaryFormat = primaryFormat;\n this.field = field;\n this.listener = listener;\n this.affineFormats = affineFormats;\n this.customNotations = customNotations;\n this.affinityCalculationStrategy = affinityCalculationStrategy;\n this.autocomplete = autocomplete;\n this.afterText = '';\n this.caretPosition = 0;\n this.placeholder = () => this.primaryMask.placeholder();\n this.acceptableTextLength = () => this.primaryMask.acceptableTextLength();\n this.totalTextLength = () => this.primaryMask.totalTextLength();\n this.totalValueLength = () => this.primaryMask.totalValueLength();\n this.dispose = () => {\n this.field.removeEventListener('input', this.handleInputChange);\n this.field.removeEventListener('focus', this.handleFocus);\n this.field.removeEventListener('blur', this.handleBlur);\n };\n this.handleInputChange = (ev) => {\n this.onTextChanged(ev.target.value, ev);\n };\n this.handleFocus = () => this.onFocusChange(true);\n this.handleBlur = () => this.onFocusChange(false);\n this.primaryMask = mask_1.Mask.getOrCreate(this.primaryFormat, this.customNotations);\n this.addEvents(field);\n }\n static installOn(primaryFormat, field, listener, affineFormats = [], customNotations = [], affinityCalculationStrategy = new affinity_calculation_strategy_1.AffinityCalculation(affinity_calculation_strategy_1.AffinityCalculationStrategy.WHOLE_STRING), autocomplete = true) {\n return new MaskedTextChangedListener(primaryFormat, field, listener, affineFormats, customNotations, affinityCalculationStrategy, autocomplete);\n }\n setText(text) {\n let result = null;\n if (!this.field.value || this.field.value === '') {\n result = this._setText(text, this.field);\n this.afterText = result.formattedText.str;\n this.caretPosition = result.formattedText.caretPosition;\n if (!!this.listener) {\n this.listener.onTextChanged(result.complete, result.extractedValue, this.afterText);\n }\n }\n return result;\n }\n _setText(text, field) {\n const result = this.pickMask(text, text.length, this.autocomplete).apply(new model_1.CaretString(text, text.length), this.autocomplete);\n field.value = String(result.formattedText.str);\n field.setSelectionRange(result.formattedText.caretPosition, result.formattedText.caretPosition);\n return result;\n }\n pickMask(text, caretPosition, autocomplete) {\n text = String(text);\n if (this.affineFormats.length === 0) {\n return this.primaryMask;\n }\n const primaryAffinity = this.calculateAffinity(this.primaryMask, text, caretPosition, autocomplete);\n const maskAndAffinities = [];\n for (const format of this.affineFormats) {\n const mask = new mask_1.Mask(format, this.customNotations);\n const affinity = this.calculateAffinity(mask, text, caretPosition, autocomplete);\n maskAndAffinities.push(new mask_affinity_1.MaskAffinity(mask, affinity));\n }\n maskAndAffinities.sort((a, b) => b.affinity - a.affinity);\n let insertIndex = -1;\n maskAndAffinities.some((maskAffinity, index) => {\n if (primaryAffinity >= maskAffinity.affinity) {\n insertIndex = index;\n }\n return primaryAffinity >= maskAffinity.affinity;\n });\n if (insertIndex >= 0) {\n maskAndAffinities[insertIndex] = new mask_affinity_1.MaskAffinity(this.primaryMask, primaryAffinity);\n }\n else {\n maskAndAffinities.push(new mask_affinity_1.MaskAffinity(this.primaryMask, primaryAffinity));\n }\n return maskAndAffinities[0].mask;\n }\n calculateAffinity(mask, text, caretPosition, autocomplete) {\n return this.affinityCalculationStrategy.calculateAffinityOfMask(mask, new model_1.CaretString(text, caretPosition), autocomplete);\n }\n addEvents(field) {\n field.addEventListener('input', this.handleInputChange);\n field.addEventListener('focus', this.handleFocus);\n field.addEventListener('blur', this.handleBlur);\n }\n onFocusChange(hasFocus) {\n if (this.autocomplete && hasFocus) {\n const text = !!this.field.value ? this.field.value : '';\n const result = this.pickMask(text, text.length, this.autocomplete).apply(new model_1.CaretString(text, text.length), this.autocomplete);\n this.afterText = result.formattedText.str;\n this.caretPosition = result.formattedText.caretPosition;\n this.field.value = String(this.afterText);\n this.field.setSelectionRange(result.formattedText.caretPosition, result.formattedText.caretPosition);\n if (!!this.listener) {\n this.listener.onTextChanged(result.complete, result.extractedValue, this.afterText);\n }\n }\n }\n onTextChanged(text, event) {\n const isDeletion = event.inputType === 'deleteContentForward'\n || event.inputType === 'deleteContentBackward';\n const isInside = this.field.selectionStart < text.length;\n const caretPosition = (isDeletion || isInside) ? this.field.selectionStart : text.length;\n const result = this.pickMask(text, caretPosition, this.autocomplete && !isDeletion).apply(new model_1.CaretString(text, caretPosition), this.autocomplete && !isDeletion);\n this.afterText = result.formattedText.str;\n this.caretPosition = (isDeletion || isInside)\n ? this.field.selectionStart\n : result.formattedText.caretPosition;\n this.field.value = String(this.afterText);\n this.field.setSelectionRange(this.caretPosition, this.caretPosition);\n if (!!this.listener) {\n this.listener.onTextChanged(result.complete, result.extractedValue, this.afterText);\n }\n }\n}\nexports.MaskedTextChangedListener = MaskedTextChangedListener;\n", "\"use strict\";\nfunction __export(m) {\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n}\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__export(require(\"./helper/affinity-calculation-strategy\"));\n__export(require(\"./helper/mask\"));\n__export(require(\"./model/caret-string\"));\n__export(require(\"./model/notation\"));\n__export(require(\"./masked-text-changed-listener\"));\n", "/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport 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\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport 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\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n if (async) inner = dispose;\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n function next() {\n while (env.stack.length) {\n var rec = env.stack.pop();\n try {\n var result = rec.dispose && rec.dispose.call(rec.value);\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n catch (e) {\n fail(e);\n }\n }\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n};\n", "export class Map {\r\n private items: { [key: string]: T };\r\n private lengthC: number = 0;\r\n\r\n constructor() {\r\n this.items = {};\r\n }\r\n\r\n add(key: string, value: T): void {\r\n this.lengthC++;\r\n this.items[key] = value;\r\n }\r\n\r\n has(key: string): boolean {\r\n return key in this.items;\r\n }\r\n\r\n get(key: string): T {\r\n return this.items[key];\r\n }\r\n\r\n length() {\r\n return this.lengthC;\r\n }\r\n\r\n delete(key: string) {\r\n delete this.items[key];\r\n this.lengthC--;\r\n }\r\n}", "\r\nexport abstract class AxInit {\r\n abstract AxInit(init?: any): void;\r\n\r\n}\r\n\r\nexport function ModuleName(aliasName: string) {\r\n const orgName = aliasName;\r\n return function (target: Function) {\r\n target.prototype.moduleAliasName = orgName;\r\n }\r\n}", "import { Map } from \"../Types/Map\";\r\nimport { AxAfterInit } from \"./AxAfterInit\";\r\nimport { AxInit, ModuleName } from \"./AxInit\";\r\nimport { AxReloadable } from \"./AxReloadable\";\r\n\r\n@ModuleName(\"AxLoad\")\r\nexport class AxLoad {\r\n static availableProviders: Map = new Map();\r\n static loadedModules: Map = new Map();\r\n\r\n static GetModule(name: string): T {\r\n return AxLoad.loadedModules.get(name) as T;\r\n }\r\n\r\n static GetModuleWithoutType(name: string): object {\r\n return AxLoad.loadedModules.get(name);\r\n }\r\n\r\n static ReloadModule(name: string, init?: any, alias?: string, callLoaded: boolean = true) {\r\n let moduleInstance = this.GetModule(name);\r\n\r\n if (moduleInstance != null) {\r\n moduleInstance.AxReload(init);\r\n console.info(`%cAxLoad::ReloadModule reloaded Module %c${name}`, \"color: #ff8034\", \"color: #389AA4\");\r\n } else {\r\n this.LoadModule(name, init, alias, callLoaded);\r\n }\r\n }\r\n\r\n static LoadModule(name: string, init?: any, alias?: string, callLoaded: boolean = true) {\r\n $(() => {\r\n if (alias == null) {\r\n alias = name;\r\n }\r\n\r\n if (typeof this.availableProviders[name] != 'undefined') {\r\n let module: AxInit = new this.availableProviders[name];\r\n AxLoad.loadedModules.add(alias, module);\r\n module.AxInit(init);\r\n console.info(`%cAxLoad::LoadModule loaded Module %c${name}`, \"color: #ff8034\", \"color: #389AA4\");\r\n if (callLoaded && AxLoad.IsLoadAfterInit(module)) {\r\n (module).AxAfterInit;\r\n }\r\n } else {\r\n console.error(`AxLoad::LoadModule unknown Module ${name}`);\r\n }\r\n });\r\n return Promise.resolve();\r\n }\r\n\r\n static LoadModules(modules: ModuleLoad[], timeout: number = 1000) {\r\n for (let module of modules) {\r\n AxLoad.LoadModule(module.name, module.initData, module.alias, false);\r\n }\r\n\r\n setTimeout(function () {\r\n for (let module of modules) {\r\n let tmp: any = AxLoad.GetModule(module.alias || module.name);\r\n\r\n if (AxLoad.IsLoadAfterInit(tmp)) {\r\n tmp.AxAfterInit();\r\n }\r\n }\r\n }, timeout);\r\n }\r\n\r\n static IsLoadAfterInit(module: AxInit | AxAfterInit): module is AxAfterInit {\r\n return module !== undefined && (module).AxAfterInit !== undefined;\r\n }\r\n}\r\n\r\ninterface ModuleLoad {\r\n name: string;\r\n initData: any;\r\n alias?: string;\r\n}", "export class AxAlert {\r\n public constructor(selector: string) {\r\n $(selector).on('click', '.ax-close', e => {\r\n $(e.delegateTarget).addClass('d-none');\r\n });\r\n }\r\n}", "export class AxButton {\r\n Loading(btn: HTMLElement) {\r\n let $btn = $(btn);\r\n if (!$btn.hasClass(\"ax-loading\")) {\r\n $btn.prop(\"disabled\", true).addClass('ax-loading').append(\"\");\r\n }\r\n }\r\n\r\n StopLoading(btn: HTMLElement) {\r\n let $btn = $(btn);\r\n if ($btn.hasClass(\"ax-loading\")) {\r\n $btn.prop(\"disabled\", false).removeClass('ax-loading');\r\n $btn.find('.ax-btn-loading').remove();\r\n }\r\n }\r\n}", "export class AxPortletExpandable {\r\n\r\n Init() {\r\n $('.ax-portlet.ax-portlet--expandable').each((i, x) => {\r\n let $portlet = $(x);\r\n $portlet.find('button[data-dismiss=\"portlet\"]').each((i2, button) => {\r\n $(button).click(x => {\r\n let options = {\r\n detail: {\r\n elem: button\r\n },\r\n bubbles: true,\r\n cancelable: true,\r\n composed: false\r\n };\r\n\r\n let onOpen = new CustomEvent('ax-portlet--open', options);\r\n let onClose = new CustomEvent('ax-portlet--close', options);\r\n\r\n $portlet.toggleClass('active');\r\n\r\n if ($portlet.hasClass('active')) {\r\n button.dispatchEvent(onOpen);\r\n }\r\n if (!$portlet.hasClass('active')) {\r\n button.dispatchEvent(onClose);\r\n }\r\n });\r\n });\r\n });\r\n\r\n }\r\n\r\n OnOpen(selector: string, callback: (e: CustomEvent, elem: HTMLElement) => void) {\r\n let div_list = document.querySelectorAll(selector);\r\n div_list.forEach(div => {\r\n div.addEventListener(\"ax-portlet--open\", (event: CustomEvent) => {\r\n callback(event, event.detail.elem);\r\n });\r\n });\r\n\r\n }\r\n\r\n OnClose(selector: string, callback: (e: CustomEvent, elem: HTMLElement) => void) {\r\n document.querySelector(selector).addEventListener(\"ax-portlet--close\", (event: CustomEvent) => {\r\n callback(event, event.detail.elem);\r\n });\r\n }\r\n}\r\n", "export class AxTab {\r\n private TabHolders: TabHolder[] = [];\r\n private DefaultSelector: string = '.ax-tabs.ax-tabs--auto';\r\n\r\n Init(selector?: string) {\r\n selector = selector || this.DefaultSelector;\r\n\r\n if (selector != this.DefaultSelector && $(selector + '[data-ax-tab-header-for]').length == 0) {\r\n console.log(`AxTab: No Element or Target found for ${selector}`);\r\n }\r\n\r\n $(selector + '[data-ax-tab-header-for]').each((i, e) => {\r\n let $e = $(e);\r\n let startTarget = $e.attr('data-ax-tab-start');\r\n\r\n let holder: TabHolder = {\r\n Menu: e,\r\n TabContentHolder: [],\r\n EventListner: null\r\n };\r\n holder.EventListner = AxTabListener.Listener.bind(this, holder);\r\n\r\n let target = $($e.attr('data-ax-tab-header-for'));\r\n\r\n target.children('*[data-target]').each((i, c) => {\r\n let $c = $(c);\r\n let targetName = $c.attr('data-target');\r\n let active = (typeof startTarget != 'undefined' && targetName == startTarget);\r\n holder.TabContentHolder.push({\r\n TargetName: targetName,\r\n Active: false, //will be set in Activate Target\r\n TargetElement: c\r\n });\r\n\r\n if (active) {\r\n this.ActivateTarget(targetName, holder);\r\n }\r\n });\r\n\r\n holder.Menu.addEventListener(\"click\", holder.EventListner);\r\n this.TabHolders.push(holder);\r\n });\r\n }\r\n\r\n ActivateTab(targetName: string) {\r\n let tabHolders = this.TabHolders.filter(x => x.TabContentHolder.findIndex(y => y.TargetName == targetName) != -1);\r\n\r\n for (let holder of tabHolders) {\r\n this.ActivateTarget(targetName, holder);\r\n }\r\n }\r\n\r\n private ActivateTarget(targetName: string, tabHolder: TabHolder) {\r\n let $menu = $(tabHolder.Menu);\r\n $menu.children('*[data-target]').removeClass('active');\r\n $menu.children(`[data-target=${targetName}]`).addClass('active');\r\n\r\n let currentTarget = tabHolder.TabContentHolder.find(x => x.Active);\r\n\r\n if (typeof currentTarget == 'undefined' || currentTarget.TargetName != targetName) {\r\n if (typeof currentTarget != 'undefined') {\r\n currentTarget.Active = false;\r\n $(currentTarget.TargetElement).removeClass('active');\r\n }\r\n\r\n let contentTarget = tabHolder.TabContentHolder.find(x => x.TargetName == targetName);\r\n contentTarget.Active = true;\r\n $(contentTarget.TargetElement).addClass('active');\r\n }\r\n }\r\n}\r\n\r\nconst AxTabListener = {\r\n ///Element seems to be null\r\n Listener(tabHolder: TabHolder, event: PointerEvent) {\r\n let target = event.target;\r\n\r\n let targetName = $(target).attr('data-target');\r\n\r\n if (typeof targetName != 'undefined') {\r\n this.ActivateTarget(targetName, tabHolder);\r\n }\r\n }\r\n};\r\n\r\ninterface TabHolder {\r\n Menu: HTMLElement;\r\n TabContentHolder: ContentHolder[];\r\n EventListner: any;\r\n}\r\n\r\ninterface ContentHolder {\r\n TargetName: string;\r\n Active: boolean;\r\n TargetElement: HTMLElement;\r\n}", "import { AxAlert } from \"./AxAlert/AxAlert\";\r\nimport { AxButton } from \"./AxButton/AxButton\";\r\nimport { AxPortletExpandable } from \"./AxPortlet/AxPortletExpandable\";\r\nimport { AxTab } from \"./AxPortlet/AxTab\";\r\nimport { ModuleName } from \"../Lib/AxSystem/AxInit\";\r\n\r\n@ModuleName(\"AxLimeStone\")\r\nexport class AxLimeStone {\r\n private TabHandler: AxTab[] = [];\r\n\r\n constructor(private _AxButton = new AxButton(),\r\n private _AxPortletExpandable = new AxPortletExpandable()) { }\r\n\r\n public Init() {\r\n let portletTabHandler = new AxTab();\r\n this.TabHandler.push(portletTabHandler);\r\n\r\n portletTabHandler.Init();\r\n this._AxPortletExpandable.Init();\r\n window.addEventListener(\"pageshow\", this.WindowListener.bind(this));\r\n }\r\n\r\n WindowListener(event: PageTransitionEvent) {\r\n if (event.persisted) {\r\n this.UnlockAllButtons();\r\n }\r\n }\r\n\r\n public Alert(selector: string): void {\r\n new AxAlert(selector);\r\n }\r\n\r\n public LockButton(e: HTMLElement) {\r\n this._AxButton.Loading(e);\r\n }\r\n\r\n public UnlockButton(e: HTMLElement) {\r\n this._AxButton.StopLoading(e);\r\n }\r\n\r\n public UnlockAllButtons() {\r\n let buttons = document.querySelectorAll('.ax-btn.ax-loading');\r\n\r\n buttons.forEach((currentValue, currentIndex, listObj) => {\r\n this._AxButton.StopLoading(currentValue as HTMLElement);\r\n });\r\n }\r\n}", "/**\n * SSR Window 3.0.0\n * Better handling for window object in SSR environment\n * https://github.com/nolimits4web/ssr-window\n *\n * Copyright 2020, Vladimir Kharlampidi\n *\n * Licensed under MIT\n *\n * Released on: November 9, 2020\n */\n/* eslint-disable no-param-reassign */\nfunction isObject(obj) {\n return (obj !== null &&\n typeof obj === 'object' &&\n 'constructor' in obj &&\n obj.constructor === Object);\n}\nfunction extend(target, src) {\n if (target === void 0) { target = {}; }\n if (src === void 0) { src = {}; }\n Object.keys(src).forEach(function (key) {\n if (typeof target[key] === 'undefined')\n target[key] = src[key];\n else if (isObject(src[key]) &&\n isObject(target[key]) &&\n Object.keys(src[key]).length > 0) {\n extend(target[key], src[key]);\n }\n });\n}\n\nvar ssrDocument = {\n body: {},\n addEventListener: function () { },\n removeEventListener: function () { },\n activeElement: {\n blur: function () { },\n nodeName: '',\n },\n querySelector: function () {\n return null;\n },\n querySelectorAll: function () {\n return [];\n },\n getElementById: function () {\n return null;\n },\n createEvent: function () {\n return {\n initEvent: function () { },\n };\n },\n createElement: function () {\n return {\n children: [],\n childNodes: [],\n style: {},\n setAttribute: function () { },\n getElementsByTagName: function () {\n return [];\n },\n };\n },\n createElementNS: function () {\n return {};\n },\n importNode: function () {\n return null;\n },\n location: {\n hash: '',\n host: '',\n hostname: '',\n href: '',\n origin: '',\n pathname: '',\n protocol: '',\n search: '',\n },\n};\nfunction getDocument() {\n var doc = typeof document !== 'undefined' ? document : {};\n extend(doc, ssrDocument);\n return doc;\n}\n\nvar ssrWindow = {\n document: ssrDocument,\n navigator: {\n userAgent: '',\n },\n location: {\n hash: '',\n host: '',\n hostname: '',\n href: '',\n origin: '',\n pathname: '',\n protocol: '',\n search: '',\n },\n history: {\n replaceState: function () { },\n pushState: function () { },\n go: function () { },\n back: function () { },\n },\n CustomEvent: function CustomEvent() {\n return this;\n },\n addEventListener: function () { },\n removeEventListener: function () { },\n getComputedStyle: function () {\n return {\n getPropertyValue: function () {\n return '';\n },\n };\n },\n Image: function () { },\n Date: function () { },\n screen: {},\n setTimeout: function () { },\n clearTimeout: function () { },\n matchMedia: function () {\n return {};\n },\n requestAnimationFrame: function (callback) {\n if (typeof setTimeout === 'undefined') {\n callback();\n return null;\n }\n return setTimeout(callback, 0);\n },\n cancelAnimationFrame: function (id) {\n if (typeof setTimeout === 'undefined') {\n return;\n }\n clearTimeout(id);\n },\n};\nfunction getWindow() {\n var win = typeof window !== 'undefined' ? window : {};\n extend(win, ssrWindow);\n return win;\n}\n\nexport { extend, getDocument, getWindow, ssrDocument, ssrWindow };\n", "/**\n * Dom7 3.0.0\n * Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API\n * https://framework7.io/docs/dom7.html\n *\n * Copyright 2020, Vladimir Kharlampidi\n *\n * Licensed under MIT\n *\n * Released on: November 9, 2020\n */\nimport { getWindow, getDocument } from 'ssr-window';\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _construct(Parent, args, Class) {\n if (_isNativeReflectConstruct()) {\n _construct = Reflect.construct;\n } else {\n _construct = function _construct(Parent, args, Class) {\n var a = [null];\n a.push.apply(a, args);\n var Constructor = Function.bind.apply(Parent, a);\n var instance = new Constructor();\n if (Class) _setPrototypeOf(instance, Class.prototype);\n return instance;\n };\n }\n\n return _construct.apply(null, arguments);\n}\n\nfunction _isNativeFunction(fn) {\n return Function.toString.call(fn).indexOf(\"[native code]\") !== -1;\n}\n\nfunction _wrapNativeSuper(Class) {\n var _cache = typeof Map === \"function\" ? new Map() : undefined;\n\n _wrapNativeSuper = function _wrapNativeSuper(Class) {\n if (Class === null || !_isNativeFunction(Class)) return Class;\n\n if (typeof Class !== \"function\") {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n if (typeof _cache !== \"undefined\") {\n if (_cache.has(Class)) return _cache.get(Class);\n\n _cache.set(Class, Wrapper);\n }\n\n function Wrapper() {\n return _construct(Class, arguments, _getPrototypeOf(this).constructor);\n }\n\n Wrapper.prototype = Object.create(Class.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n return _setPrototypeOf(Wrapper, Class);\n };\n\n return _wrapNativeSuper(Class);\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\n/* eslint-disable no-proto */\nfunction makeReactive(obj) {\n var proto = obj.__proto__;\n Object.defineProperty(obj, '__proto__', {\n get: function get() {\n return proto;\n },\n set: function set(value) {\n proto.__proto__ = value;\n }\n });\n}\n\nvar Dom7 = /*#__PURE__*/function (_Array) {\n _inheritsLoose(Dom7, _Array);\n\n function Dom7(items) {\n var _this;\n\n _this = _Array.call.apply(_Array, [this].concat(items)) || this;\n makeReactive(_assertThisInitialized(_this));\n return _this;\n }\n\n return Dom7;\n}( /*#__PURE__*/_wrapNativeSuper(Array));\n\nfunction arrayFlat(arr) {\n if (arr === void 0) {\n arr = [];\n }\n\n var res = [];\n arr.forEach(function (el) {\n if (Array.isArray(el)) {\n res.push.apply(res, arrayFlat(el));\n } else {\n res.push(el);\n }\n });\n return res;\n}\nfunction arrayFilter(arr, callback) {\n return Array.prototype.filter.call(arr, callback);\n}\nfunction arrayUnique(arr) {\n var uniqueArray = [];\n\n for (var i = 0; i < arr.length; i += 1) {\n if (uniqueArray.indexOf(arr[i]) === -1) uniqueArray.push(arr[i]);\n }\n\n return uniqueArray;\n}\nfunction toCamelCase(string) {\n return string.toLowerCase().replace(/-(.)/g, function (match, group) {\n return group.toUpperCase();\n });\n}\n\nfunction qsa(selector, context) {\n if (typeof selector !== 'string') {\n return [selector];\n }\n\n var a = [];\n var res = context.querySelectorAll(selector);\n\n for (var i = 0; i < res.length; i += 1) {\n a.push(res[i]);\n }\n\n return a;\n}\n\nfunction $(selector, context) {\n var window = getWindow();\n var document = getDocument();\n var arr = [];\n\n if (!context && selector instanceof Dom7) {\n return selector;\n }\n\n if (!selector) {\n return new Dom7(arr);\n }\n\n if (typeof selector === 'string') {\n var html = selector.trim();\n\n if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) {\n var toCreate = 'div';\n if (html.indexOf(' 0;\n }).length > 0;\n}\n\nfunction attr(attrs, value) {\n if (arguments.length === 1 && typeof attrs === 'string') {\n // Get attr\n if (this[0]) return this[0].getAttribute(attrs);\n return undefined;\n } // Set attrs\n\n\n for (var i = 0; i < this.length; i += 1) {\n if (arguments.length === 2) {\n // String\n this[i].setAttribute(attrs, value);\n } else {\n // Object\n for (var attrName in attrs) {\n this[i][attrName] = attrs[attrName];\n this[i].setAttribute(attrName, attrs[attrName]);\n }\n }\n }\n\n return this;\n}\n\nfunction removeAttr(attr) {\n for (var i = 0; i < this.length; i += 1) {\n this[i].removeAttribute(attr);\n }\n\n return this;\n}\n\nfunction prop(props, value) {\n if (arguments.length === 1 && typeof props === 'string') {\n // Get prop\n if (this[0]) return this[0][props];\n } else {\n // Set props\n for (var i = 0; i < this.length; i += 1) {\n if (arguments.length === 2) {\n // String\n this[i][props] = value;\n } else {\n // Object\n for (var propName in props) {\n this[i][propName] = props[propName];\n }\n }\n }\n\n return this;\n }\n\n return this;\n}\n\nfunction data(key, value) {\n var el;\n\n if (typeof value === 'undefined') {\n el = this[0];\n if (!el) return undefined; // Get value\n\n if (el.dom7ElementDataStorage && key in el.dom7ElementDataStorage) {\n return el.dom7ElementDataStorage[key];\n }\n\n var dataKey = el.getAttribute(\"data-\" + key);\n\n if (dataKey) {\n return dataKey;\n }\n\n return undefined;\n } // Set value\n\n\n for (var i = 0; i < this.length; i += 1) {\n el = this[i];\n if (!el.dom7ElementDataStorage) el.dom7ElementDataStorage = {};\n el.dom7ElementDataStorage[key] = value;\n }\n\n return this;\n}\n\nfunction removeData(key) {\n for (var i = 0; i < this.length; i += 1) {\n var el = this[i];\n\n if (el.dom7ElementDataStorage && el.dom7ElementDataStorage[key]) {\n el.dom7ElementDataStorage[key] = null;\n delete el.dom7ElementDataStorage[key];\n }\n }\n}\n\nfunction dataset() {\n var el = this[0];\n if (!el) return undefined;\n var dataset = {}; // eslint-disable-line\n\n if (el.dataset) {\n for (var dataKey in el.dataset) {\n dataset[dataKey] = el.dataset[dataKey];\n }\n } else {\n for (var i = 0; i < el.attributes.length; i += 1) {\n var _attr = el.attributes[i];\n\n if (_attr.name.indexOf('data-') >= 0) {\n dataset[toCamelCase(_attr.name.split('data-')[1])] = _attr.value;\n }\n }\n }\n\n for (var key in dataset) {\n if (dataset[key] === 'false') dataset[key] = false;else if (dataset[key] === 'true') dataset[key] = true;else if (parseFloat(dataset[key]) === dataset[key] * 1) dataset[key] *= 1;\n }\n\n return dataset;\n}\n\nfunction val(value) {\n if (typeof value === 'undefined') {\n // get value\n var el = this[0];\n if (!el) return undefined;\n\n if (el.multiple && el.nodeName.toLowerCase() === 'select') {\n var values = [];\n\n for (var i = 0; i < el.selectedOptions.length; i += 1) {\n values.push(el.selectedOptions[i].value);\n }\n\n return values;\n }\n\n return el.value;\n } // set value\n\n\n for (var _i = 0; _i < this.length; _i += 1) {\n var _el = this[_i];\n\n if (Array.isArray(value) && _el.multiple && _el.nodeName.toLowerCase() === 'select') {\n for (var j = 0; j < _el.options.length; j += 1) {\n _el.options[j].selected = value.indexOf(_el.options[j].value) >= 0;\n }\n } else {\n _el.value = value;\n }\n }\n\n return this;\n}\n\nfunction value(value) {\n return this.val(value);\n}\n\nfunction transform(transform) {\n for (var i = 0; i < this.length; i += 1) {\n this[i].style.transform = transform;\n }\n\n return this;\n}\n\nfunction transition(duration) {\n for (var i = 0; i < this.length; i += 1) {\n this[i].style.transitionDuration = typeof duration !== 'string' ? duration + \"ms\" : duration;\n }\n\n return this;\n}\n\nfunction on() {\n for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n args[_key5] = arguments[_key5];\n }\n\n var eventType = args[0],\n targetSelector = args[1],\n listener = args[2],\n capture = args[3];\n\n if (typeof args[1] === 'function') {\n eventType = args[0];\n listener = args[1];\n capture = args[2];\n targetSelector = undefined;\n }\n\n if (!capture) capture = false;\n\n function handleLiveEvent(e) {\n var target = e.target;\n if (!target) return;\n var eventData = e.target.dom7EventData || [];\n\n if (eventData.indexOf(e) < 0) {\n eventData.unshift(e);\n }\n\n if ($(target).is(targetSelector)) listener.apply(target, eventData);else {\n var _parents = $(target).parents(); // eslint-disable-line\n\n\n for (var k = 0; k < _parents.length; k += 1) {\n if ($(_parents[k]).is(targetSelector)) listener.apply(_parents[k], eventData);\n }\n }\n }\n\n function handleEvent(e) {\n var eventData = e && e.target ? e.target.dom7EventData || [] : [];\n\n if (eventData.indexOf(e) < 0) {\n eventData.unshift(e);\n }\n\n listener.apply(this, eventData);\n }\n\n var events = eventType.split(' ');\n var j;\n\n for (var i = 0; i < this.length; i += 1) {\n var el = this[i];\n\n if (!targetSelector) {\n for (j = 0; j < events.length; j += 1) {\n var event = events[j];\n if (!el.dom7Listeners) el.dom7Listeners = {};\n if (!el.dom7Listeners[event]) el.dom7Listeners[event] = [];\n el.dom7Listeners[event].push({\n listener: listener,\n proxyListener: handleEvent\n });\n el.addEventListener(event, handleEvent, capture);\n }\n } else {\n // Live events\n for (j = 0; j < events.length; j += 1) {\n var _event = events[j];\n if (!el.dom7LiveListeners) el.dom7LiveListeners = {};\n if (!el.dom7LiveListeners[_event]) el.dom7LiveListeners[_event] = [];\n\n el.dom7LiveListeners[_event].push({\n listener: listener,\n proxyListener: handleLiveEvent\n });\n\n el.addEventListener(_event, handleLiveEvent, capture);\n }\n }\n }\n\n return this;\n}\n\nfunction off() {\n for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n args[_key6] = arguments[_key6];\n }\n\n var eventType = args[0],\n targetSelector = args[1],\n listener = args[2],\n capture = args[3];\n\n if (typeof args[1] === 'function') {\n eventType = args[0];\n listener = args[1];\n capture = args[2];\n targetSelector = undefined;\n }\n\n if (!capture) capture = false;\n var events = eventType.split(' ');\n\n for (var i = 0; i < events.length; i += 1) {\n var event = events[i];\n\n for (var j = 0; j < this.length; j += 1) {\n var el = this[j];\n var handlers = void 0;\n\n if (!targetSelector && el.dom7Listeners) {\n handlers = el.dom7Listeners[event];\n } else if (targetSelector && el.dom7LiveListeners) {\n handlers = el.dom7LiveListeners[event];\n }\n\n if (handlers && handlers.length) {\n for (var k = handlers.length - 1; k >= 0; k -= 1) {\n var handler = handlers[k];\n\n if (listener && handler.listener === listener) {\n el.removeEventListener(event, handler.proxyListener, capture);\n handlers.splice(k, 1);\n } else if (listener && handler.listener && handler.listener.dom7proxy && handler.listener.dom7proxy === listener) {\n el.removeEventListener(event, handler.proxyListener, capture);\n handlers.splice(k, 1);\n } else if (!listener) {\n el.removeEventListener(event, handler.proxyListener, capture);\n handlers.splice(k, 1);\n }\n }\n }\n }\n }\n\n return this;\n}\n\nfunction once() {\n var dom = this;\n\n for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {\n args[_key7] = arguments[_key7];\n }\n\n var eventName = args[0],\n targetSelector = args[1],\n listener = args[2],\n capture = args[3];\n\n if (typeof args[1] === 'function') {\n eventName = args[0];\n listener = args[1];\n capture = args[2];\n targetSelector = undefined;\n }\n\n function onceHandler() {\n for (var _len8 = arguments.length, eventArgs = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {\n eventArgs[_key8] = arguments[_key8];\n }\n\n listener.apply(this, eventArgs);\n dom.off(eventName, targetSelector, onceHandler, capture);\n\n if (onceHandler.dom7proxy) {\n delete onceHandler.dom7proxy;\n }\n }\n\n onceHandler.dom7proxy = listener;\n return dom.on(eventName, targetSelector, onceHandler, capture);\n}\n\nfunction trigger() {\n var window = getWindow();\n\n for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {\n args[_key9] = arguments[_key9];\n }\n\n var events = args[0].split(' ');\n var eventData = args[1];\n\n for (var i = 0; i < events.length; i += 1) {\n var event = events[i];\n\n for (var j = 0; j < this.length; j += 1) {\n var el = this[j];\n\n if (window.CustomEvent) {\n var evt = new window.CustomEvent(event, {\n detail: eventData,\n bubbles: true,\n cancelable: true\n });\n el.dom7EventData = args.filter(function (data, dataIndex) {\n return dataIndex > 0;\n });\n el.dispatchEvent(evt);\n el.dom7EventData = [];\n delete el.dom7EventData;\n }\n }\n }\n\n return this;\n}\n\nfunction transitionEnd(callback) {\n var dom = this;\n\n function fireCallBack(e) {\n if (e.target !== this) return;\n callback.call(this, e);\n dom.off('transitionend', fireCallBack);\n }\n\n if (callback) {\n dom.on('transitionend', fireCallBack);\n }\n\n return this;\n}\n\nfunction animationEnd(callback) {\n var dom = this;\n\n function fireCallBack(e) {\n if (e.target !== this) return;\n callback.call(this, e);\n dom.off('animationend', fireCallBack);\n }\n\n if (callback) {\n dom.on('animationend', fireCallBack);\n }\n\n return this;\n}\n\nfunction width() {\n var window = getWindow();\n\n if (this[0] === window) {\n return window.innerWidth;\n }\n\n if (this.length > 0) {\n return parseFloat(this.css('width'));\n }\n\n return null;\n}\n\nfunction outerWidth(includeMargins) {\n if (this.length > 0) {\n if (includeMargins) {\n var _styles = this.styles();\n\n return this[0].offsetWidth + parseFloat(_styles.getPropertyValue('margin-right')) + parseFloat(_styles.getPropertyValue('margin-left'));\n }\n\n return this[0].offsetWidth;\n }\n\n return null;\n}\n\nfunction height() {\n var window = getWindow();\n\n if (this[0] === window) {\n return window.innerHeight;\n }\n\n if (this.length > 0) {\n return parseFloat(this.css('height'));\n }\n\n return null;\n}\n\nfunction outerHeight(includeMargins) {\n if (this.length > 0) {\n if (includeMargins) {\n var _styles2 = this.styles();\n\n return this[0].offsetHeight + parseFloat(_styles2.getPropertyValue('margin-top')) + parseFloat(_styles2.getPropertyValue('margin-bottom'));\n }\n\n return this[0].offsetHeight;\n }\n\n return null;\n}\n\nfunction offset() {\n if (this.length > 0) {\n var window = getWindow();\n var document = getDocument();\n var el = this[0];\n var box = el.getBoundingClientRect();\n var body = document.body;\n var clientTop = el.clientTop || body.clientTop || 0;\n var clientLeft = el.clientLeft || body.clientLeft || 0;\n var scrollTop = el === window ? window.scrollY : el.scrollTop;\n var scrollLeft = el === window ? window.scrollX : el.scrollLeft;\n return {\n top: box.top + scrollTop - clientTop,\n left: box.left + scrollLeft - clientLeft\n };\n }\n\n return null;\n}\n\nfunction hide() {\n for (var i = 0; i < this.length; i += 1) {\n this[i].style.display = 'none';\n }\n\n return this;\n}\n\nfunction show() {\n var window = getWindow();\n\n for (var i = 0; i < this.length; i += 1) {\n var el = this[i];\n\n if (el.style.display === 'none') {\n el.style.display = '';\n }\n\n if (window.getComputedStyle(el, null).getPropertyValue('display') === 'none') {\n // Still not visible\n el.style.display = 'block';\n }\n }\n\n return this;\n}\n\nfunction styles() {\n var window = getWindow();\n if (this[0]) return window.getComputedStyle(this[0], null);\n return {};\n}\n\nfunction css(props, value) {\n var window = getWindow();\n var i;\n\n if (arguments.length === 1) {\n if (typeof props === 'string') {\n // .css('width')\n if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props);\n } else {\n // .css({ width: '100px' })\n for (i = 0; i < this.length; i += 1) {\n for (var _prop in props) {\n this[i].style[_prop] = props[_prop];\n }\n }\n\n return this;\n }\n }\n\n if (arguments.length === 2 && typeof props === 'string') {\n // .css('width', '100px')\n for (i = 0; i < this.length; i += 1) {\n this[i].style[props] = value;\n }\n\n return this;\n }\n\n return this;\n}\n\nfunction each(callback) {\n if (!callback) return this;\n this.forEach(function (el, index) {\n callback.apply(el, [el, index]);\n });\n return this;\n}\n\nfunction filter(callback) {\n var result = arrayFilter(this, callback);\n return $(result);\n}\n\nfunction html(html) {\n if (typeof html === 'undefined') {\n return this[0] ? this[0].innerHTML : null;\n }\n\n for (var i = 0; i < this.length; i += 1) {\n this[i].innerHTML = html;\n }\n\n return this;\n}\n\nfunction text(text) {\n if (typeof text === 'undefined') {\n return this[0] ? this[0].textContent.trim() : null;\n }\n\n for (var i = 0; i < this.length; i += 1) {\n this[i].textContent = text;\n }\n\n return this;\n}\n\nfunction is(selector) {\n var window = getWindow();\n var document = getDocument();\n var el = this[0];\n var compareWith;\n var i;\n if (!el || typeof selector === 'undefined') return false;\n\n if (typeof selector === 'string') {\n if (el.matches) return el.matches(selector);\n if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector);\n if (el.msMatchesSelector) return el.msMatchesSelector(selector);\n compareWith = $(selector);\n\n for (i = 0; i < compareWith.length; i += 1) {\n if (compareWith[i] === el) return true;\n }\n\n return false;\n }\n\n if (selector === document) {\n return el === document;\n }\n\n if (selector === window) {\n return el === window;\n }\n\n if (selector.nodeType || selector instanceof Dom7) {\n compareWith = selector.nodeType ? [selector] : selector;\n\n for (i = 0; i < compareWith.length; i += 1) {\n if (compareWith[i] === el) return true;\n }\n\n return false;\n }\n\n return false;\n}\n\nfunction index() {\n var child = this[0];\n var i;\n\n if (child) {\n i = 0; // eslint-disable-next-line\n\n while ((child = child.previousSibling) !== null) {\n if (child.nodeType === 1) i += 1;\n }\n\n return i;\n }\n\n return undefined;\n}\n\nfunction eq(index) {\n if (typeof index === 'undefined') return this;\n var length = this.length;\n\n if (index > length - 1) {\n return $([]);\n }\n\n if (index < 0) {\n var returnIndex = length + index;\n if (returnIndex < 0) return $([]);\n return $([this[returnIndex]]);\n }\n\n return $([this[index]]);\n}\n\nfunction append() {\n var newChild;\n var document = getDocument();\n\n for (var k = 0; k < arguments.length; k += 1) {\n newChild = k < 0 || arguments.length <= k ? undefined : arguments[k];\n\n for (var i = 0; i < this.length; i += 1) {\n if (typeof newChild === 'string') {\n var tempDiv = document.createElement('div');\n tempDiv.innerHTML = newChild;\n\n while (tempDiv.firstChild) {\n this[i].appendChild(tempDiv.firstChild);\n }\n } else if (newChild instanceof Dom7) {\n for (var j = 0; j < newChild.length; j += 1) {\n this[i].appendChild(newChild[j]);\n }\n } else {\n this[i].appendChild(newChild);\n }\n }\n }\n\n return this;\n}\n\nfunction appendTo(parent) {\n $(parent).append(this);\n return this;\n}\n\nfunction prepend(newChild) {\n var document = getDocument();\n var i;\n var j;\n\n for (i = 0; i < this.length; i += 1) {\n if (typeof newChild === 'string') {\n var tempDiv = document.createElement('div');\n tempDiv.innerHTML = newChild;\n\n for (j = tempDiv.childNodes.length - 1; j >= 0; j -= 1) {\n this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]);\n }\n } else if (newChild instanceof Dom7) {\n for (j = 0; j < newChild.length; j += 1) {\n this[i].insertBefore(newChild[j], this[i].childNodes[0]);\n }\n } else {\n this[i].insertBefore(newChild, this[i].childNodes[0]);\n }\n }\n\n return this;\n}\n\nfunction prependTo(parent) {\n $(parent).prepend(this);\n return this;\n}\n\nfunction insertBefore(selector) {\n var before = $(selector);\n\n for (var i = 0; i < this.length; i += 1) {\n if (before.length === 1) {\n before[0].parentNode.insertBefore(this[i], before[0]);\n } else if (before.length > 1) {\n for (var j = 0; j < before.length; j += 1) {\n before[j].parentNode.insertBefore(this[i].cloneNode(true), before[j]);\n }\n }\n }\n}\n\nfunction insertAfter(selector) {\n var after = $(selector);\n\n for (var i = 0; i < this.length; i += 1) {\n if (after.length === 1) {\n after[0].parentNode.insertBefore(this[i], after[0].nextSibling);\n } else if (after.length > 1) {\n for (var j = 0; j < after.length; j += 1) {\n after[j].parentNode.insertBefore(this[i].cloneNode(true), after[j].nextSibling);\n }\n }\n }\n}\n\nfunction next(selector) {\n if (this.length > 0) {\n if (selector) {\n if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) {\n return $([this[0].nextElementSibling]);\n }\n\n return $([]);\n }\n\n if (this[0].nextElementSibling) return $([this[0].nextElementSibling]);\n return $([]);\n }\n\n return $([]);\n}\n\nfunction nextAll(selector) {\n var nextEls = [];\n var el = this[0];\n if (!el) return $([]);\n\n while (el.nextElementSibling) {\n var _next = el.nextElementSibling; // eslint-disable-line\n\n if (selector) {\n if ($(_next).is(selector)) nextEls.push(_next);\n } else nextEls.push(_next);\n\n el = _next;\n }\n\n return $(nextEls);\n}\n\nfunction prev(selector) {\n if (this.length > 0) {\n var el = this[0];\n\n if (selector) {\n if (el.previousElementSibling && $(el.previousElementSibling).is(selector)) {\n return $([el.previousElementSibling]);\n }\n\n return $([]);\n }\n\n if (el.previousElementSibling) return $([el.previousElementSibling]);\n return $([]);\n }\n\n return $([]);\n}\n\nfunction prevAll(selector) {\n var prevEls = [];\n var el = this[0];\n if (!el) return $([]);\n\n while (el.previousElementSibling) {\n var _prev = el.previousElementSibling; // eslint-disable-line\n\n if (selector) {\n if ($(_prev).is(selector)) prevEls.push(_prev);\n } else prevEls.push(_prev);\n\n el = _prev;\n }\n\n return $(prevEls);\n}\n\nfunction siblings(selector) {\n return this.nextAll(selector).add(this.prevAll(selector));\n}\n\nfunction parent(selector) {\n var parents = []; // eslint-disable-line\n\n for (var i = 0; i < this.length; i += 1) {\n if (this[i].parentNode !== null) {\n if (selector) {\n if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode);\n } else {\n parents.push(this[i].parentNode);\n }\n }\n }\n\n return $(parents);\n}\n\nfunction parents(selector) {\n var parents = []; // eslint-disable-line\n\n for (var i = 0; i < this.length; i += 1) {\n var _parent = this[i].parentNode; // eslint-disable-line\n\n while (_parent) {\n if (selector) {\n if ($(_parent).is(selector)) parents.push(_parent);\n } else {\n parents.push(_parent);\n }\n\n _parent = _parent.parentNode;\n }\n }\n\n return $(parents);\n}\n\nfunction closest(selector) {\n var closest = this; // eslint-disable-line\n\n if (typeof selector === 'undefined') {\n return $([]);\n }\n\n if (!closest.is(selector)) {\n closest = closest.parents(selector).eq(0);\n }\n\n return closest;\n}\n\nfunction find(selector) {\n var foundElements = [];\n\n for (var i = 0; i < this.length; i += 1) {\n var found = this[i].querySelectorAll(selector);\n\n for (var j = 0; j < found.length; j += 1) {\n foundElements.push(found[j]);\n }\n }\n\n return $(foundElements);\n}\n\nfunction children(selector) {\n var children = []; // eslint-disable-line\n\n for (var i = 0; i < this.length; i += 1) {\n var childNodes = this[i].children;\n\n for (var j = 0; j < childNodes.length; j += 1) {\n if (!selector || $(childNodes[j]).is(selector)) {\n children.push(childNodes[j]);\n }\n }\n }\n\n return $(children);\n}\n\nfunction remove() {\n for (var i = 0; i < this.length; i += 1) {\n if (this[i].parentNode) this[i].parentNode.removeChild(this[i]);\n }\n\n return this;\n}\n\nfunction detach() {\n return this.remove();\n}\n\nfunction add() {\n var dom = this;\n var i;\n var j;\n\n for (var _len10 = arguments.length, els = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {\n els[_key10] = arguments[_key10];\n }\n\n for (i = 0; i < els.length; i += 1) {\n var toAdd = $(els[i]);\n\n for (j = 0; j < toAdd.length; j += 1) {\n dom.push(toAdd[j]);\n }\n }\n\n return dom;\n}\n\nfunction empty() {\n for (var i = 0; i < this.length; i += 1) {\n var el = this[i];\n\n if (el.nodeType === 1) {\n for (var j = 0; j < el.childNodes.length; j += 1) {\n if (el.childNodes[j].parentNode) {\n el.childNodes[j].parentNode.removeChild(el.childNodes[j]);\n }\n }\n\n el.textContent = '';\n }\n }\n\n return this;\n}\n\nfunction scrollTo() {\n var window = getWindow();\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var left = args[0],\n top = args[1],\n duration = args[2],\n easing = args[3],\n callback = args[4];\n\n if (args.length === 4 && typeof easing === 'function') {\n callback = easing;\n left = args[0];\n top = args[1];\n duration = args[2];\n callback = args[3];\n easing = args[4];\n }\n\n if (typeof easing === 'undefined') easing = 'swing';\n return this.each(function animate() {\n var el = this;\n var currentTop;\n var currentLeft;\n var maxTop;\n var maxLeft;\n var newTop;\n var newLeft;\n var scrollTop; // eslint-disable-line\n\n var scrollLeft; // eslint-disable-line\n\n var animateTop = top > 0 || top === 0;\n var animateLeft = left > 0 || left === 0;\n\n if (typeof easing === 'undefined') {\n easing = 'swing';\n }\n\n if (animateTop) {\n currentTop = el.scrollTop;\n\n if (!duration) {\n el.scrollTop = top;\n }\n }\n\n if (animateLeft) {\n currentLeft = el.scrollLeft;\n\n if (!duration) {\n el.scrollLeft = left;\n }\n }\n\n if (!duration) return;\n\n if (animateTop) {\n maxTop = el.scrollHeight - el.offsetHeight;\n newTop = Math.max(Math.min(top, maxTop), 0);\n }\n\n if (animateLeft) {\n maxLeft = el.scrollWidth - el.offsetWidth;\n newLeft = Math.max(Math.min(left, maxLeft), 0);\n }\n\n var startTime = null;\n if (animateTop && newTop === currentTop) animateTop = false;\n if (animateLeft && newLeft === currentLeft) animateLeft = false;\n\n function render(time) {\n if (time === void 0) {\n time = new Date().getTime();\n }\n\n if (startTime === null) {\n startTime = time;\n }\n\n var progress = Math.max(Math.min((time - startTime) / duration, 1), 0);\n var easeProgress = easing === 'linear' ? progress : 0.5 - Math.cos(progress * Math.PI) / 2;\n var done;\n if (animateTop) scrollTop = currentTop + easeProgress * (newTop - currentTop);\n if (animateLeft) scrollLeft = currentLeft + easeProgress * (newLeft - currentLeft);\n\n if (animateTop && newTop > currentTop && scrollTop >= newTop) {\n el.scrollTop = newTop;\n done = true;\n }\n\n if (animateTop && newTop < currentTop && scrollTop <= newTop) {\n el.scrollTop = newTop;\n done = true;\n }\n\n if (animateLeft && newLeft > currentLeft && scrollLeft >= newLeft) {\n el.scrollLeft = newLeft;\n done = true;\n }\n\n if (animateLeft && newLeft < currentLeft && scrollLeft <= newLeft) {\n el.scrollLeft = newLeft;\n done = true;\n }\n\n if (done) {\n if (callback) callback();\n return;\n }\n\n if (animateTop) el.scrollTop = scrollTop;\n if (animateLeft) el.scrollLeft = scrollLeft;\n window.requestAnimationFrame(render);\n }\n\n window.requestAnimationFrame(render);\n });\n} // scrollTop(top, duration, easing, callback) {\n\n\nfunction scrollTop() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n var top = args[0],\n duration = args[1],\n easing = args[2],\n callback = args[3];\n\n if (args.length === 3 && typeof easing === 'function') {\n top = args[0];\n duration = args[1];\n callback = args[2];\n easing = args[3];\n }\n\n var dom = this;\n\n if (typeof top === 'undefined') {\n if (dom.length > 0) return dom[0].scrollTop;\n return null;\n }\n\n return dom.scrollTo(undefined, top, duration, easing, callback);\n}\n\nfunction scrollLeft() {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n var left = args[0],\n duration = args[1],\n easing = args[2],\n callback = args[3];\n\n if (args.length === 3 && typeof easing === 'function') {\n left = args[0];\n duration = args[1];\n callback = args[2];\n easing = args[3];\n }\n\n var dom = this;\n\n if (typeof left === 'undefined') {\n if (dom.length > 0) return dom[0].scrollLeft;\n return null;\n }\n\n return dom.scrollTo(left, undefined, duration, easing, callback);\n}\n\nfunction animate(initialProps, initialParams) {\n var window = getWindow();\n var els = this;\n var a = {\n props: Object.assign({}, initialProps),\n params: Object.assign({\n duration: 300,\n easing: 'swing' // or 'linear'\n\n /* Callbacks\n begin(elements)\n complete(elements)\n progress(elements, complete, remaining, start, tweenValue)\n */\n\n }, initialParams),\n elements: els,\n animating: false,\n que: [],\n easingProgress: function easingProgress(easing, progress) {\n if (easing === 'swing') {\n return 0.5 - Math.cos(progress * Math.PI) / 2;\n }\n\n if (typeof easing === 'function') {\n return easing(progress);\n }\n\n return progress;\n },\n stop: function stop() {\n if (a.frameId) {\n window.cancelAnimationFrame(a.frameId);\n }\n\n a.animating = false;\n a.elements.each(function (el) {\n var element = el;\n delete element.dom7AnimateInstance;\n });\n a.que = [];\n },\n done: function done(complete) {\n a.animating = false;\n a.elements.each(function (el) {\n var element = el;\n delete element.dom7AnimateInstance;\n });\n if (complete) complete(els);\n\n if (a.que.length > 0) {\n var que = a.que.shift();\n a.animate(que[0], que[1]);\n }\n },\n animate: function animate(props, params) {\n if (a.animating) {\n a.que.push([props, params]);\n return a;\n }\n\n var elements = []; // Define & Cache Initials & Units\n\n a.elements.each(function (el, index) {\n var initialFullValue;\n var initialValue;\n var unit;\n var finalValue;\n var finalFullValue;\n if (!el.dom7AnimateInstance) a.elements[index].dom7AnimateInstance = a;\n elements[index] = {\n container: el\n };\n Object.keys(props).forEach(function (prop) {\n initialFullValue = window.getComputedStyle(el, null).getPropertyValue(prop).replace(',', '.');\n initialValue = parseFloat(initialFullValue);\n unit = initialFullValue.replace(initialValue, '');\n finalValue = parseFloat(props[prop]);\n finalFullValue = props[prop] + unit;\n elements[index][prop] = {\n initialFullValue: initialFullValue,\n initialValue: initialValue,\n unit: unit,\n finalValue: finalValue,\n finalFullValue: finalFullValue,\n currentValue: initialValue\n };\n });\n });\n var startTime = null;\n var time;\n var elementsDone = 0;\n var propsDone = 0;\n var done;\n var began = false;\n a.animating = true;\n\n function render() {\n time = new Date().getTime();\n var progress;\n var easeProgress; // let el;\n\n if (!began) {\n began = true;\n if (params.begin) params.begin(els);\n }\n\n if (startTime === null) {\n startTime = time;\n }\n\n if (params.progress) {\n // eslint-disable-next-line\n params.progress(els, Math.max(Math.min((time - startTime) / params.duration, 1), 0), startTime + params.duration - time < 0 ? 0 : startTime + params.duration - time, startTime);\n }\n\n elements.forEach(function (element) {\n var el = element;\n if (done || el.done) return;\n Object.keys(props).forEach(function (prop) {\n if (done || el.done) return;\n progress = Math.max(Math.min((time - startTime) / params.duration, 1), 0);\n easeProgress = a.easingProgress(params.easing, progress);\n var _el$prop = el[prop],\n initialValue = _el$prop.initialValue,\n finalValue = _el$prop.finalValue,\n unit = _el$prop.unit;\n el[prop].currentValue = initialValue + easeProgress * (finalValue - initialValue);\n var currentValue = el[prop].currentValue;\n\n if (finalValue > initialValue && currentValue >= finalValue || finalValue < initialValue && currentValue <= finalValue) {\n el.container.style[prop] = finalValue + unit;\n propsDone += 1;\n\n if (propsDone === Object.keys(props).length) {\n el.done = true;\n elementsDone += 1;\n }\n\n if (elementsDone === elements.length) {\n done = true;\n }\n }\n\n if (done) {\n a.done(params.complete);\n return;\n }\n\n el.container.style[prop] = currentValue + unit;\n });\n });\n if (done) return; // Then call\n\n a.frameId = window.requestAnimationFrame(render);\n }\n\n a.frameId = window.requestAnimationFrame(render);\n return a;\n }\n };\n\n if (a.elements.length === 0) {\n return els;\n }\n\n var animateInstance;\n\n for (var i = 0; i < a.elements.length; i += 1) {\n if (a.elements[i].dom7AnimateInstance) {\n animateInstance = a.elements[i].dom7AnimateInstance;\n } else a.elements[i].dom7AnimateInstance = a;\n }\n\n if (!animateInstance) {\n animateInstance = a;\n }\n\n if (initialProps === 'stop') {\n animateInstance.stop();\n } else {\n animateInstance.animate(a.props, a.params);\n }\n\n return els;\n}\n\nfunction stop() {\n var els = this;\n\n for (var i = 0; i < els.length; i += 1) {\n if (els[i].dom7AnimateInstance) {\n els[i].dom7AnimateInstance.stop();\n }\n }\n}\n\nvar noTrigger = 'resize scroll'.split(' ');\n\nfunction shortcut(name) {\n function eventHandler() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n if (typeof args[0] === 'undefined') {\n for (var i = 0; i < this.length; i += 1) {\n if (noTrigger.indexOf(name) < 0) {\n if (name in this[i]) this[i][name]();else {\n $(this[i]).trigger(name);\n }\n }\n }\n\n return this;\n }\n\n return this.on.apply(this, [name].concat(args));\n }\n\n return eventHandler;\n}\n\nvar click = shortcut('click');\nvar blur = shortcut('blur');\nvar focus = shortcut('focus');\nvar focusin = shortcut('focusin');\nvar focusout = shortcut('focusout');\nvar keyup = shortcut('keyup');\nvar keydown = shortcut('keydown');\nvar keypress = shortcut('keypress');\nvar submit = shortcut('submit');\nvar change = shortcut('change');\nvar mousedown = shortcut('mousedown');\nvar mousemove = shortcut('mousemove');\nvar mouseup = shortcut('mouseup');\nvar mouseenter = shortcut('mouseenter');\nvar mouseleave = shortcut('mouseleave');\nvar mouseout = shortcut('mouseout');\nvar mouseover = shortcut('mouseover');\nvar touchstart = shortcut('touchstart');\nvar touchend = shortcut('touchend');\nvar touchmove = shortcut('touchmove');\nvar resize = shortcut('resize');\nvar scroll = shortcut('scroll');\n\nexport default $;\nexport { $, add, addClass, animate, animationEnd, append, appendTo, attr, blur, change, children, click, closest, css, data, dataset, detach, each, empty, eq, filter, find, focus, focusin, focusout, hasClass, height, hide, html, index, insertAfter, insertBefore, is, keydown, keypress, keyup, mousedown, mouseenter, mouseleave, mousemove, mouseout, mouseover, mouseup, next, nextAll, off, offset, on, once, outerHeight, outerWidth, parent, parents, prepend, prependTo, prev, prevAll, prop, remove, removeAttr, removeClass, removeData, resize, scroll, scrollLeft, scrollTo, scrollTop, show, siblings, stop, styles, submit, text, toggleClass, touchend, touchmove, touchstart, transform, transition, transitionEnd, trigger, val, value, width };\n", "import { $, addClass, removeClass, hasClass, toggleClass, attr, removeAttr, transform, transition, on, off, trigger, transitionEnd, outerWidth, outerHeight, styles, offset, css, each, html, text, is, index, eq, append, prepend, next, nextAll, prev, prevAll, parent, parents, closest, find, children, filter, remove } from 'dom7';\nvar Methods = {\n addClass: addClass,\n removeClass: removeClass,\n hasClass: hasClass,\n toggleClass: toggleClass,\n attr: attr,\n removeAttr: removeAttr,\n transform: transform,\n transition: transition,\n on: on,\n off: off,\n trigger: trigger,\n transitionEnd: transitionEnd,\n outerWidth: outerWidth,\n outerHeight: outerHeight,\n styles: styles,\n offset: offset,\n css: css,\n each: each,\n html: html,\n text: text,\n is: is,\n index: index,\n eq: eq,\n append: append,\n prepend: prepend,\n next: next,\n nextAll: nextAll,\n prev: prev,\n prevAll: prevAll,\n parent: parent,\n parents: parents,\n closest: closest,\n find: find,\n children: children,\n filter: filter,\n remove: remove\n};\nObject.keys(Methods).forEach(function (methodName) {\n Object.defineProperty($.fn, methodName, {\n value: Methods[methodName],\n writable: true\n });\n});\nexport default $;", "import { getDocument, getWindow } from 'ssr-window';\n\nfunction deleteProps(obj) {\n var object = obj;\n Object.keys(object).forEach(function (key) {\n try {\n object[key] = null;\n } catch (e) {// no getter for object\n }\n\n try {\n delete object[key];\n } catch (e) {// something got wrong\n }\n });\n}\n\nfunction nextTick(callback, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n\n return setTimeout(callback, delay);\n}\n\nfunction now() {\n return Date.now();\n}\n\nfunction getComputedStyle(el) {\n var window = getWindow();\n var style;\n\n if (window.getComputedStyle) {\n style = window.getComputedStyle(el, null);\n }\n\n if (!style && el.currentStyle) {\n style = el.currentStyle;\n }\n\n if (!style) {\n style = el.style;\n }\n\n return style;\n}\n\nfunction getTranslate(el, axis) {\n if (axis === void 0) {\n axis = 'x';\n }\n\n var window = getWindow();\n var matrix;\n var curTransform;\n var transformMatrix;\n var curStyle = getComputedStyle(el, null);\n\n if (window.WebKitCSSMatrix) {\n curTransform = curStyle.transform || curStyle.webkitTransform;\n\n if (curTransform.split(',').length > 6) {\n curTransform = curTransform.split(', ').map(function (a) {\n return a.replace(',', '.');\n }).join(', ');\n } // Some old versions of Webkit choke when 'none' is passed; pass\n // empty string instead in this case\n\n\n transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);\n } else {\n transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');\n matrix = transformMatrix.toString().split(',');\n }\n\n if (axis === 'x') {\n // Latest Chrome and webkits Fix\n if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41; // Crazy IE10 Matrix\n else if (matrix.length === 16) curTransform = parseFloat(matrix[12]); // Normal Browsers\n else curTransform = parseFloat(matrix[4]);\n }\n\n if (axis === 'y') {\n // Latest Chrome and webkits Fix\n if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42; // Crazy IE10 Matrix\n else if (matrix.length === 16) curTransform = parseFloat(matrix[13]); // Normal Browsers\n else curTransform = parseFloat(matrix[5]);\n }\n\n return curTransform || 0;\n}\n\nfunction isObject(o) {\n return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object';\n}\n\nfunction isNode(node) {\n // eslint-disable-next-line\n if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') {\n return node instanceof HTMLElement;\n }\n\n return node && (node.nodeType === 1 || node.nodeType === 11);\n}\n\nfunction extend() {\n var to = Object(arguments.length <= 0 ? undefined : arguments[0]);\n var noExtend = ['__proto__', 'constructor', 'prototype'];\n\n for (var i = 1; i < arguments.length; i += 1) {\n var nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i];\n\n if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) {\n var keysArray = Object.keys(Object(nextSource)).filter(function (key) {\n return noExtend.indexOf(key) < 0;\n });\n\n for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {\n var nextKey = keysArray[nextIndex];\n var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);\n\n if (desc !== undefined && desc.enumerable) {\n if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) {\n if (nextSource[nextKey].__swiper__) {\n to[nextKey] = nextSource[nextKey];\n } else {\n extend(to[nextKey], nextSource[nextKey]);\n }\n } else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) {\n to[nextKey] = {};\n\n if (nextSource[nextKey].__swiper__) {\n to[nextKey] = nextSource[nextKey];\n } else {\n extend(to[nextKey], nextSource[nextKey]);\n }\n } else {\n to[nextKey] = nextSource[nextKey];\n }\n }\n }\n }\n }\n\n return to;\n}\n\nfunction bindModuleMethods(instance, obj) {\n Object.keys(obj).forEach(function (key) {\n if (isObject(obj[key])) {\n Object.keys(obj[key]).forEach(function (subKey) {\n if (typeof obj[key][subKey] === 'function') {\n obj[key][subKey] = obj[key][subKey].bind(instance);\n }\n });\n }\n\n instance[key] = obj[key];\n });\n}\n\nfunction classesToSelector(classes) {\n if (classes === void 0) {\n classes = '';\n }\n\n return \".\" + classes.trim().replace(/([\\.:!\\/])/g, '\\\\$1') // eslint-disable-line\n .replace(/ /g, '.');\n}\n\nfunction createElementIfNotDefined($container, params, createElements, checkProps) {\n var document = getDocument();\n\n if (createElements) {\n Object.keys(checkProps).forEach(function (key) {\n if (!params[key] && params.auto === true) {\n var element = document.createElement('div');\n element.className = checkProps[key];\n $container.append(element);\n params[key] = element;\n }\n });\n }\n\n return params;\n}\n\nexport { deleteProps, nextTick, now, getTranslate, isObject, extend, bindModuleMethods, getComputedStyle, classesToSelector, createElementIfNotDefined };", "import { getWindow, getDocument } from 'ssr-window';\nvar support;\n\nfunction calcSupport() {\n var window = getWindow();\n var document = getDocument();\n return {\n touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch),\n pointerEvents: !!window.PointerEvent && 'maxTouchPoints' in window.navigator && window.navigator.maxTouchPoints >= 0,\n observer: function checkObserver() {\n return 'MutationObserver' in window || 'WebkitMutationObserver' in window;\n }(),\n passiveListener: function checkPassiveListener() {\n var supportsPassive = false;\n\n try {\n var opts = Object.defineProperty({}, 'passive', {\n // eslint-disable-next-line\n get: function get() {\n supportsPassive = true;\n }\n });\n window.addEventListener('testPassiveListener', null, opts);\n } catch (e) {// No support\n }\n\n return supportsPassive;\n }(),\n gestures: function checkGestures() {\n return 'ongesturestart' in window;\n }()\n };\n}\n\nfunction getSupport() {\n if (!support) {\n support = calcSupport();\n }\n\n return support;\n}\n\nexport { getSupport };", "import { getWindow } from 'ssr-window';\nimport { getSupport } from './get-support';\nvar device;\n\nfunction calcDevice(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n userAgent = _ref.userAgent;\n\n var support = getSupport();\n var window = getWindow();\n var platform = window.navigator.platform;\n var ua = userAgent || window.navigator.userAgent;\n var device = {\n ios: false,\n android: false\n };\n var screenWidth = window.screen.width;\n var screenHeight = window.screen.height;\n var android = ua.match(/(Android);?[\\s\\/]+([\\d.]+)?/); // eslint-disable-line\n\n var ipad = ua.match(/(iPad).*OS\\s([\\d_]+)/);\n var ipod = ua.match(/(iPod)(.*OS\\s([\\d_]+))?/);\n var iphone = !ipad && ua.match(/(iPhone\\sOS|iOS)\\s([\\d_]+)/);\n var windows = platform === 'Win32';\n var macos = platform === 'MacIntel'; // iPadOs 13 fix\n\n var iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810'];\n\n if (!ipad && macos && support.touch && iPadScreens.indexOf(screenWidth + \"x\" + screenHeight) >= 0) {\n ipad = ua.match(/(Version)\\/([\\d.]+)/);\n if (!ipad) ipad = [0, 1, '13_0_0'];\n macos = false;\n } // Android\n\n\n if (android && !windows) {\n device.os = 'android';\n device.android = true;\n }\n\n if (ipad || iphone || ipod) {\n device.os = 'ios';\n device.ios = true;\n } // Export object\n\n\n return device;\n}\n\nfunction getDevice(overrides) {\n if (overrides === void 0) {\n overrides = {};\n }\n\n if (!device) {\n device = calcDevice(overrides);\n }\n\n return device;\n}\n\nexport { getDevice };", "import { getWindow } from 'ssr-window';\nvar browser;\n\nfunction calcBrowser() {\n var window = getWindow();\n\n function isSafari() {\n var ua = window.navigator.userAgent.toLowerCase();\n return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0;\n }\n\n return {\n isEdge: !!window.navigator.userAgent.match(/Edge/g),\n isSafari: isSafari(),\n isWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent)\n };\n}\n\nfunction getBrowser() {\n if (!browser) {\n browser = calcBrowser();\n }\n\n return browser;\n}\n\nexport { getBrowser };", "import { getWindow } from 'ssr-window';\nimport { extend } from '../../utils/utils';\n\nvar supportsResizeObserver = function supportsResizeObserver() {\n var window = getWindow();\n return typeof window.ResizeObserver !== 'undefined';\n};\n\nexport default {\n name: 'resize',\n create: function create() {\n var swiper = this;\n extend(swiper, {\n resize: {\n observer: null,\n createObserver: function createObserver() {\n if (!swiper || swiper.destroyed || !swiper.initialized) return;\n swiper.resize.observer = new ResizeObserver(function (entries) {\n var width = swiper.width,\n height = swiper.height;\n var newWidth = width;\n var newHeight = height;\n entries.forEach(function (_ref) {\n var contentBoxSize = _ref.contentBoxSize,\n contentRect = _ref.contentRect,\n target = _ref.target;\n if (target && target !== swiper.el) return;\n newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize;\n newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize;\n });\n\n if (newWidth !== width || newHeight !== height) {\n swiper.resize.resizeHandler();\n }\n });\n swiper.resize.observer.observe(swiper.el);\n },\n removeObserver: function removeObserver() {\n if (swiper.resize.observer && swiper.resize.observer.unobserve && swiper.el) {\n swiper.resize.observer.unobserve(swiper.el);\n swiper.resize.observer = null;\n }\n },\n resizeHandler: function resizeHandler() {\n if (!swiper || swiper.destroyed || !swiper.initialized) return;\n swiper.emit('beforeResize');\n swiper.emit('resize');\n },\n orientationChangeHandler: function orientationChangeHandler() {\n if (!swiper || swiper.destroyed || !swiper.initialized) return;\n swiper.emit('orientationchange');\n }\n }\n });\n },\n on: {\n init: function init(swiper) {\n var window = getWindow();\n\n if (swiper.params.resizeObserver && supportsResizeObserver()) {\n swiper.resize.createObserver();\n return;\n } // Emit resize\n\n\n window.addEventListener('resize', swiper.resize.resizeHandler); // Emit orientationchange\n\n window.addEventListener('orientationchange', swiper.resize.orientationChangeHandler);\n },\n destroy: function destroy(swiper) {\n var window = getWindow();\n swiper.resize.removeObserver();\n window.removeEventListener('resize', swiper.resize.resizeHandler);\n window.removeEventListener('orientationchange', swiper.resize.orientationChangeHandler);\n }\n }\n};", "function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nimport { getWindow } from 'ssr-window';\nimport { bindModuleMethods } from '../../utils/utils';\nvar Observer = {\n attach: function attach(target, options) {\n if (options === void 0) {\n options = {};\n }\n\n var window = getWindow();\n var swiper = this;\n var ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;\n var observer = new ObserverFunc(function (mutations) {\n // The observerUpdate event should only be triggered\n // once despite the number of mutations. Additional\n // triggers are redundant and are very costly\n if (mutations.length === 1) {\n swiper.emit('observerUpdate', mutations[0]);\n return;\n }\n\n var observerUpdate = function observerUpdate() {\n swiper.emit('observerUpdate', mutations[0]);\n };\n\n if (window.requestAnimationFrame) {\n window.requestAnimationFrame(observerUpdate);\n } else {\n window.setTimeout(observerUpdate, 0);\n }\n });\n observer.observe(target, {\n attributes: typeof options.attributes === 'undefined' ? true : options.attributes,\n childList: typeof options.childList === 'undefined' ? true : options.childList,\n characterData: typeof options.characterData === 'undefined' ? true : options.characterData\n });\n swiper.observer.observers.push(observer);\n },\n init: function init() {\n var swiper = this;\n if (!swiper.support.observer || !swiper.params.observer) return;\n\n if (swiper.params.observeParents) {\n var containerParents = swiper.$el.parents();\n\n for (var i = 0; i < containerParents.length; i += 1) {\n swiper.observer.attach(containerParents[i]);\n }\n } // Observe container\n\n\n swiper.observer.attach(swiper.$el[0], {\n childList: swiper.params.observeSlideChildren\n }); // Observe wrapper\n\n swiper.observer.attach(swiper.$wrapperEl[0], {\n attributes: false\n });\n },\n destroy: function destroy() {\n var swiper = this;\n swiper.observer.observers.forEach(function (observer) {\n observer.disconnect();\n });\n swiper.observer.observers = [];\n }\n};\nexport default {\n name: 'observer',\n params: {\n observer: false,\n observeParents: false,\n observeSlideChildren: false\n },\n create: function create() {\n var swiper = this;\n bindModuleMethods(swiper, {\n observer: _extends({}, Observer, {\n observers: []\n })\n });\n },\n on: {\n init: function init(swiper) {\n swiper.observer.init();\n },\n destroy: function destroy(swiper) {\n swiper.observer.destroy();\n }\n }\n};", "import { extend } from '../../utils/utils';\nexport default {\n useParams: function useParams(instanceParams) {\n var instance = this;\n if (!instance.modules) return;\n Object.keys(instance.modules).forEach(function (moduleName) {\n var module = instance.modules[moduleName]; // Extend params\n\n if (module.params) {\n extend(instanceParams, module.params);\n }\n });\n },\n useModules: function useModules(modulesParams) {\n if (modulesParams === void 0) {\n modulesParams = {};\n }\n\n var instance = this;\n if (!instance.modules) return;\n Object.keys(instance.modules).forEach(function (moduleName) {\n var module = instance.modules[moduleName];\n var moduleParams = modulesParams[moduleName] || {}; // Add event listeners\n\n if (module.on && instance.on) {\n Object.keys(module.on).forEach(function (moduleEventName) {\n instance.on(moduleEventName, module.on[moduleEventName]);\n });\n } // Module create callback\n\n\n if (module.create) {\n module.create.bind(instance)(moduleParams);\n }\n });\n }\n};", "/* eslint-disable no-underscore-dangle */\nexport default {\n on: function on(events, handler, priority) {\n var self = this;\n if (typeof handler !== 'function') return self;\n var method = priority ? 'unshift' : 'push';\n events.split(' ').forEach(function (event) {\n if (!self.eventsListeners[event]) self.eventsListeners[event] = [];\n self.eventsListeners[event][method](handler);\n });\n return self;\n },\n once: function once(events, handler, priority) {\n var self = this;\n if (typeof handler !== 'function') return self;\n\n function onceHandler() {\n self.off(events, onceHandler);\n\n if (onceHandler.__emitterProxy) {\n delete onceHandler.__emitterProxy;\n }\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n handler.apply(self, args);\n }\n\n onceHandler.__emitterProxy = handler;\n return self.on(events, onceHandler, priority);\n },\n onAny: function onAny(handler, priority) {\n var self = this;\n if (typeof handler !== 'function') return self;\n var method = priority ? 'unshift' : 'push';\n\n if (self.eventsAnyListeners.indexOf(handler) < 0) {\n self.eventsAnyListeners[method](handler);\n }\n\n return self;\n },\n offAny: function offAny(handler) {\n var self = this;\n if (!self.eventsAnyListeners) return self;\n var index = self.eventsAnyListeners.indexOf(handler);\n\n if (index >= 0) {\n self.eventsAnyListeners.splice(index, 1);\n }\n\n return self;\n },\n off: function off(events, handler) {\n var self = this;\n if (!self.eventsListeners) return self;\n events.split(' ').forEach(function (event) {\n if (typeof handler === 'undefined') {\n self.eventsListeners[event] = [];\n } else if (self.eventsListeners[event]) {\n self.eventsListeners[event].forEach(function (eventHandler, index) {\n if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) {\n self.eventsListeners[event].splice(index, 1);\n }\n });\n }\n });\n return self;\n },\n emit: function emit() {\n var self = this;\n if (!self.eventsListeners) return self;\n var events;\n var data;\n var context;\n\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n if (typeof args[0] === 'string' || Array.isArray(args[0])) {\n events = args[0];\n data = args.slice(1, args.length);\n context = self;\n } else {\n events = args[0].events;\n data = args[0].data;\n context = args[0].context || self;\n }\n\n data.unshift(context);\n var eventsArray = Array.isArray(events) ? events : events.split(' ');\n eventsArray.forEach(function (event) {\n if (self.eventsAnyListeners && self.eventsAnyListeners.length) {\n self.eventsAnyListeners.forEach(function (eventHandler) {\n eventHandler.apply(context, [event].concat(data));\n });\n }\n\n if (self.eventsListeners && self.eventsListeners[event]) {\n self.eventsListeners[event].forEach(function (eventHandler) {\n eventHandler.apply(context, data);\n });\n }\n });\n return self;\n }\n};", "import { extend } from '../../../utils/utils';\nexport default function updateSize() {\n var swiper = this;\n var width;\n var height;\n var $el = swiper.$el;\n\n if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) {\n width = swiper.params.width;\n } else {\n width = $el[0].clientWidth;\n }\n\n if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) {\n height = swiper.params.height;\n } else {\n height = $el[0].clientHeight;\n }\n\n if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) {\n return;\n } // Subtract paddings\n\n\n width = width - parseInt($el.css('padding-left') || 0, 10) - parseInt($el.css('padding-right') || 0, 10);\n height = height - parseInt($el.css('padding-top') || 0, 10) - parseInt($el.css('padding-bottom') || 0, 10);\n if (Number.isNaN(width)) width = 0;\n if (Number.isNaN(height)) height = 0;\n extend(swiper, {\n width: width,\n height: height,\n size: swiper.isHorizontal() ? width : height\n });\n}", "import { extend } from '../../../utils/utils';\nexport default function updateSlides() {\n var swiper = this;\n\n function getDirectionLabel(property) {\n if (swiper.isHorizontal()) {\n return property;\n } // prettier-ignore\n\n\n return {\n 'width': 'height',\n 'margin-top': 'margin-left',\n 'margin-bottom ': 'margin-right',\n 'margin-left': 'margin-top',\n 'margin-right': 'margin-bottom',\n 'padding-left': 'padding-top',\n 'padding-right': 'padding-bottom',\n 'marginRight': 'marginBottom'\n }[property];\n }\n\n function getDirectionPropertyValue(node, label) {\n return parseFloat(node.getPropertyValue(getDirectionLabel(label)) || 0);\n }\n\n var params = swiper.params;\n var $wrapperEl = swiper.$wrapperEl,\n swiperSize = swiper.size,\n rtl = swiper.rtlTranslate,\n wrongRTL = swiper.wrongRTL;\n var isVirtual = swiper.virtual && params.virtual.enabled;\n var previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length;\n var slides = $wrapperEl.children(\".\" + swiper.params.slideClass);\n var slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length;\n var snapGrid = [];\n var slidesGrid = [];\n var slidesSizesGrid = [];\n var offsetBefore = params.slidesOffsetBefore;\n\n if (typeof offsetBefore === 'function') {\n offsetBefore = params.slidesOffsetBefore.call(swiper);\n }\n\n var offsetAfter = params.slidesOffsetAfter;\n\n if (typeof offsetAfter === 'function') {\n offsetAfter = params.slidesOffsetAfter.call(swiper);\n }\n\n var previousSnapGridLength = swiper.snapGrid.length;\n var previousSlidesGridLength = swiper.slidesGrid.length;\n var spaceBetween = params.spaceBetween;\n var slidePosition = -offsetBefore;\n var prevSlideSize = 0;\n var index = 0;\n\n if (typeof swiperSize === 'undefined') {\n return;\n }\n\n if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {\n spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize;\n }\n\n swiper.virtualSize = -spaceBetween; // reset margins\n\n if (rtl) slides.css({\n marginLeft: '',\n marginBottom: '',\n marginTop: ''\n });else slides.css({\n marginRight: '',\n marginBottom: '',\n marginTop: ''\n });\n var slidesNumberEvenToRows;\n\n if (params.slidesPerColumn > 1) {\n if (Math.floor(slidesLength / params.slidesPerColumn) === slidesLength / swiper.params.slidesPerColumn) {\n slidesNumberEvenToRows = slidesLength;\n } else {\n slidesNumberEvenToRows = Math.ceil(slidesLength / params.slidesPerColumn) * params.slidesPerColumn;\n }\n\n if (params.slidesPerView !== 'auto' && params.slidesPerColumnFill === 'row') {\n slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, params.slidesPerView * params.slidesPerColumn);\n }\n } // Calc slides\n\n\n var slideSize;\n var slidesPerColumn = params.slidesPerColumn;\n var slidesPerRow = slidesNumberEvenToRows / slidesPerColumn;\n var numFullColumns = Math.floor(slidesLength / params.slidesPerColumn);\n\n for (var i = 0; i < slidesLength; i += 1) {\n slideSize = 0;\n var slide = slides.eq(i);\n\n if (params.slidesPerColumn > 1) {\n // Set slides order\n var newSlideOrderIndex = void 0;\n var column = void 0;\n var row = void 0;\n\n if (params.slidesPerColumnFill === 'row' && params.slidesPerGroup > 1) {\n var groupIndex = Math.floor(i / (params.slidesPerGroup * params.slidesPerColumn));\n var slideIndexInGroup = i - params.slidesPerColumn * params.slidesPerGroup * groupIndex;\n var columnsInGroup = groupIndex === 0 ? params.slidesPerGroup : Math.min(Math.ceil((slidesLength - groupIndex * slidesPerColumn * params.slidesPerGroup) / slidesPerColumn), params.slidesPerGroup);\n row = Math.floor(slideIndexInGroup / columnsInGroup);\n column = slideIndexInGroup - row * columnsInGroup + groupIndex * params.slidesPerGroup;\n newSlideOrderIndex = column + row * slidesNumberEvenToRows / slidesPerColumn;\n slide.css({\n '-webkit-box-ordinal-group': newSlideOrderIndex,\n '-moz-box-ordinal-group': newSlideOrderIndex,\n '-ms-flex-order': newSlideOrderIndex,\n '-webkit-order': newSlideOrderIndex,\n order: newSlideOrderIndex\n });\n } else if (params.slidesPerColumnFill === 'column') {\n column = Math.floor(i / slidesPerColumn);\n row = i - column * slidesPerColumn;\n\n if (column > numFullColumns || column === numFullColumns && row === slidesPerColumn - 1) {\n row += 1;\n\n if (row >= slidesPerColumn) {\n row = 0;\n column += 1;\n }\n }\n } else {\n row = Math.floor(i / slidesPerRow);\n column = i - row * slidesPerRow;\n }\n\n slide.css(getDirectionLabel('margin-top'), row !== 0 ? params.spaceBetween && params.spaceBetween + \"px\" : '');\n }\n\n if (slide.css('display') === 'none') continue; // eslint-disable-line\n\n if (params.slidesPerView === 'auto') {\n var slideStyles = getComputedStyle(slide[0]);\n var currentTransform = slide[0].style.transform;\n var currentWebKitTransform = slide[0].style.webkitTransform;\n\n if (currentTransform) {\n slide[0].style.transform = 'none';\n }\n\n if (currentWebKitTransform) {\n slide[0].style.webkitTransform = 'none';\n }\n\n if (params.roundLengths) {\n slideSize = swiper.isHorizontal() ? slide.outerWidth(true) : slide.outerHeight(true);\n } else {\n // eslint-disable-next-line\n var width = getDirectionPropertyValue(slideStyles, 'width');\n var paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left');\n var paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right');\n var marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left');\n var marginRight = getDirectionPropertyValue(slideStyles, 'margin-right');\n var boxSizing = slideStyles.getPropertyValue('box-sizing');\n\n if (boxSizing && boxSizing === 'border-box') {\n slideSize = width + marginLeft + marginRight;\n } else {\n var _slide$ = slide[0],\n clientWidth = _slide$.clientWidth,\n offsetWidth = _slide$.offsetWidth;\n slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth);\n }\n }\n\n if (currentTransform) {\n slide[0].style.transform = currentTransform;\n }\n\n if (currentWebKitTransform) {\n slide[0].style.webkitTransform = currentWebKitTransform;\n }\n\n if (params.roundLengths) slideSize = Math.floor(slideSize);\n } else {\n slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;\n if (params.roundLengths) slideSize = Math.floor(slideSize);\n\n if (slides[i]) {\n slides[i].style[getDirectionLabel('width')] = slideSize + \"px\";\n }\n }\n\n if (slides[i]) {\n slides[i].swiperSlideSize = slideSize;\n }\n\n slidesSizesGrid.push(slideSize);\n\n if (params.centeredSlides) {\n slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;\n if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;\n if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;\n if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;\n if (params.roundLengths) slidePosition = Math.floor(slidePosition);\n if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition);\n slidesGrid.push(slidePosition);\n } else {\n if (params.roundLengths) slidePosition = Math.floor(slidePosition);\n if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition);\n slidesGrid.push(slidePosition);\n slidePosition = slidePosition + slideSize + spaceBetween;\n }\n\n swiper.virtualSize += slideSize + spaceBetween;\n prevSlideSize = slideSize;\n index += 1;\n }\n\n swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter;\n var newSlidesGrid;\n\n if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) {\n $wrapperEl.css({\n width: swiper.virtualSize + params.spaceBetween + \"px\"\n });\n }\n\n if (params.setWrapperSize) {\n var _$wrapperEl$css;\n\n $wrapperEl.css((_$wrapperEl$css = {}, _$wrapperEl$css[getDirectionLabel('width')] = swiper.virtualSize + params.spaceBetween + \"px\", _$wrapperEl$css));\n }\n\n if (params.slidesPerColumn > 1) {\n var _$wrapperEl$css2;\n\n swiper.virtualSize = (slideSize + params.spaceBetween) * slidesNumberEvenToRows;\n swiper.virtualSize = Math.ceil(swiper.virtualSize / params.slidesPerColumn) - params.spaceBetween;\n $wrapperEl.css((_$wrapperEl$css2 = {}, _$wrapperEl$css2[getDirectionLabel('width')] = swiper.virtualSize + params.spaceBetween + \"px\", _$wrapperEl$css2));\n\n if (params.centeredSlides) {\n newSlidesGrid = [];\n\n for (var _i = 0; _i < snapGrid.length; _i += 1) {\n var slidesGridItem = snapGrid[_i];\n if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem);\n if (snapGrid[_i] < swiper.virtualSize + snapGrid[0]) newSlidesGrid.push(slidesGridItem);\n }\n\n snapGrid = newSlidesGrid;\n }\n } // Remove last grid elements depending on width\n\n\n if (!params.centeredSlides) {\n newSlidesGrid = [];\n\n for (var _i2 = 0; _i2 < snapGrid.length; _i2 += 1) {\n var _slidesGridItem = snapGrid[_i2];\n if (params.roundLengths) _slidesGridItem = Math.floor(_slidesGridItem);\n\n if (snapGrid[_i2] <= swiper.virtualSize - swiperSize) {\n newSlidesGrid.push(_slidesGridItem);\n }\n }\n\n snapGrid = newSlidesGrid;\n\n if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) {\n snapGrid.push(swiper.virtualSize - swiperSize);\n }\n }\n\n if (snapGrid.length === 0) snapGrid = [0];\n\n if (params.spaceBetween !== 0) {\n var _slides$filter$css;\n\n var key = swiper.isHorizontal() && rtl ? 'marginLeft' : getDirectionLabel('marginRight');\n slides.filter(function (_, slideIndex) {\n if (!params.cssMode) return true;\n\n if (slideIndex === slides.length - 1) {\n return false;\n }\n\n return true;\n }).css((_slides$filter$css = {}, _slides$filter$css[key] = spaceBetween + \"px\", _slides$filter$css));\n }\n\n if (params.centeredSlides && params.centeredSlidesBounds) {\n var allSlidesSize = 0;\n slidesSizesGrid.forEach(function (slideSizeValue) {\n allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0);\n });\n allSlidesSize -= params.spaceBetween;\n var maxSnap = allSlidesSize - swiperSize;\n snapGrid = snapGrid.map(function (snap) {\n if (snap < 0) return -offsetBefore;\n if (snap > maxSnap) return maxSnap + offsetAfter;\n return snap;\n });\n }\n\n if (params.centerInsufficientSlides) {\n var _allSlidesSize = 0;\n slidesSizesGrid.forEach(function (slideSizeValue) {\n _allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0);\n });\n _allSlidesSize -= params.spaceBetween;\n\n if (_allSlidesSize < swiperSize) {\n var allSlidesOffset = (swiperSize - _allSlidesSize) / 2;\n snapGrid.forEach(function (snap, snapIndex) {\n snapGrid[snapIndex] = snap - allSlidesOffset;\n });\n slidesGrid.forEach(function (snap, snapIndex) {\n slidesGrid[snapIndex] = snap + allSlidesOffset;\n });\n }\n }\n\n extend(swiper, {\n slides: slides,\n snapGrid: snapGrid,\n slidesGrid: slidesGrid,\n slidesSizesGrid: slidesSizesGrid\n });\n\n if (slidesLength !== previousSlidesLength) {\n swiper.emit('slidesLengthChange');\n }\n\n if (snapGrid.length !== previousSnapGridLength) {\n if (swiper.params.watchOverflow) swiper.checkOverflow();\n swiper.emit('snapGridLengthChange');\n }\n\n if (slidesGrid.length !== previousSlidesGridLength) {\n swiper.emit('slidesGridLengthChange');\n }\n\n if (params.watchSlidesProgress || params.watchSlidesVisibility) {\n swiper.updateSlidesOffset();\n }\n}", "export default function updateAutoHeight(speed) {\n var swiper = this;\n var activeSlides = [];\n var isVirtual = swiper.virtual && swiper.params.virtual.enabled;\n var newHeight = 0;\n var i;\n\n if (typeof speed === 'number') {\n swiper.setTransition(speed);\n } else if (speed === true) {\n swiper.setTransition(swiper.params.speed);\n }\n\n var getSlideByIndex = function getSlideByIndex(index) {\n if (isVirtual) {\n return swiper.slides.filter(function (el) {\n return parseInt(el.getAttribute('data-swiper-slide-index'), 10) === index;\n })[0];\n }\n\n return swiper.slides.eq(index)[0];\n }; // Find slides currently in view\n\n\n if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) {\n if (swiper.params.centeredSlides) {\n swiper.visibleSlides.each(function (slide) {\n activeSlides.push(slide);\n });\n } else {\n for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) {\n var index = swiper.activeIndex + i;\n if (index > swiper.slides.length && !isVirtual) break;\n activeSlides.push(getSlideByIndex(index));\n }\n }\n } else {\n activeSlides.push(getSlideByIndex(swiper.activeIndex));\n } // Find new height from highest slide in view\n\n\n for (i = 0; i < activeSlides.length; i += 1) {\n if (typeof activeSlides[i] !== 'undefined') {\n var height = activeSlides[i].offsetHeight;\n newHeight = height > newHeight ? height : newHeight;\n }\n } // Update Height\n\n\n if (newHeight) swiper.$wrapperEl.css('height', newHeight + \"px\");\n}", "export default function updateSlidesOffset() {\n var swiper = this;\n var slides = swiper.slides;\n\n for (var i = 0; i < slides.length; i += 1) {\n slides[i].swiperSlideOffset = swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop;\n }\n}", "import $ from '../../../utils/dom';\nexport default function updateSlidesProgress(translate) {\n if (translate === void 0) {\n translate = this && this.translate || 0;\n }\n\n var swiper = this;\n var params = swiper.params;\n var slides = swiper.slides,\n rtl = swiper.rtlTranslate;\n if (slides.length === 0) return;\n if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset();\n var offsetCenter = -translate;\n if (rtl) offsetCenter = translate; // Visible Slides\n\n slides.removeClass(params.slideVisibleClass);\n swiper.visibleSlidesIndexes = [];\n swiper.visibleSlides = [];\n\n for (var i = 0; i < slides.length; i += 1) {\n var slide = slides[i];\n var slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slide.swiperSlideOffset) / (slide.swiperSlideSize + params.spaceBetween);\n\n if (params.watchSlidesVisibility || params.centeredSlides && params.autoHeight) {\n var slideBefore = -(offsetCenter - slide.swiperSlideOffset);\n var slideAfter = slideBefore + swiper.slidesSizesGrid[i];\n var isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size;\n\n if (isVisible) {\n swiper.visibleSlides.push(slide);\n swiper.visibleSlidesIndexes.push(i);\n slides.eq(i).addClass(params.slideVisibleClass);\n }\n }\n\n slide.progress = rtl ? -slideProgress : slideProgress;\n }\n\n swiper.visibleSlides = $(swiper.visibleSlides);\n}", "import { extend } from '../../../utils/utils';\nexport default function updateProgress(translate) {\n var swiper = this;\n\n if (typeof translate === 'undefined') {\n var multiplier = swiper.rtlTranslate ? -1 : 1; // eslint-disable-next-line\n\n translate = swiper && swiper.translate && swiper.translate * multiplier || 0;\n }\n\n var params = swiper.params;\n var translatesDiff = swiper.maxTranslate() - swiper.minTranslate();\n var progress = swiper.progress,\n isBeginning = swiper.isBeginning,\n isEnd = swiper.isEnd;\n var wasBeginning = isBeginning;\n var wasEnd = isEnd;\n\n if (translatesDiff === 0) {\n progress = 0;\n isBeginning = true;\n isEnd = true;\n } else {\n progress = (translate - swiper.minTranslate()) / translatesDiff;\n isBeginning = progress <= 0;\n isEnd = progress >= 1;\n }\n\n extend(swiper, {\n progress: progress,\n isBeginning: isBeginning,\n isEnd: isEnd\n });\n if (params.watchSlidesProgress || params.watchSlidesVisibility || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate);\n\n if (isBeginning && !wasBeginning) {\n swiper.emit('reachBeginning toEdge');\n }\n\n if (isEnd && !wasEnd) {\n swiper.emit('reachEnd toEdge');\n }\n\n if (wasBeginning && !isBeginning || wasEnd && !isEnd) {\n swiper.emit('fromEdge');\n }\n\n swiper.emit('progress', progress);\n}", "export default function updateSlidesClasses() {\n var swiper = this;\n var slides = swiper.slides,\n params = swiper.params,\n $wrapperEl = swiper.$wrapperEl,\n activeIndex = swiper.activeIndex,\n realIndex = swiper.realIndex;\n var isVirtual = swiper.virtual && params.virtual.enabled;\n slides.removeClass(params.slideActiveClass + \" \" + params.slideNextClass + \" \" + params.slidePrevClass + \" \" + params.slideDuplicateActiveClass + \" \" + params.slideDuplicateNextClass + \" \" + params.slideDuplicatePrevClass);\n var activeSlide;\n\n if (isVirtual) {\n activeSlide = swiper.$wrapperEl.find(\".\" + params.slideClass + \"[data-swiper-slide-index=\\\"\" + activeIndex + \"\\\"]\");\n } else {\n activeSlide = slides.eq(activeIndex);\n } // Active classes\n\n\n activeSlide.addClass(params.slideActiveClass);\n\n if (params.loop) {\n // Duplicate to all looped slides\n if (activeSlide.hasClass(params.slideDuplicateClass)) {\n $wrapperEl.children(\".\" + params.slideClass + \":not(.\" + params.slideDuplicateClass + \")[data-swiper-slide-index=\\\"\" + realIndex + \"\\\"]\").addClass(params.slideDuplicateActiveClass);\n } else {\n $wrapperEl.children(\".\" + params.slideClass + \".\" + params.slideDuplicateClass + \"[data-swiper-slide-index=\\\"\" + realIndex + \"\\\"]\").addClass(params.slideDuplicateActiveClass);\n }\n } // Next Slide\n\n\n var nextSlide = activeSlide.nextAll(\".\" + params.slideClass).eq(0).addClass(params.slideNextClass);\n\n if (params.loop && nextSlide.length === 0) {\n nextSlide = slides.eq(0);\n nextSlide.addClass(params.slideNextClass);\n } // Prev Slide\n\n\n var prevSlide = activeSlide.prevAll(\".\" + params.slideClass).eq(0).addClass(params.slidePrevClass);\n\n if (params.loop && prevSlide.length === 0) {\n prevSlide = slides.eq(-1);\n prevSlide.addClass(params.slidePrevClass);\n }\n\n if (params.loop) {\n // Duplicate to all looped slides\n if (nextSlide.hasClass(params.slideDuplicateClass)) {\n $wrapperEl.children(\".\" + params.slideClass + \":not(.\" + params.slideDuplicateClass + \")[data-swiper-slide-index=\\\"\" + nextSlide.attr('data-swiper-slide-index') + \"\\\"]\").addClass(params.slideDuplicateNextClass);\n } else {\n $wrapperEl.children(\".\" + params.slideClass + \".\" + params.slideDuplicateClass + \"[data-swiper-slide-index=\\\"\" + nextSlide.attr('data-swiper-slide-index') + \"\\\"]\").addClass(params.slideDuplicateNextClass);\n }\n\n if (prevSlide.hasClass(params.slideDuplicateClass)) {\n $wrapperEl.children(\".\" + params.slideClass + \":not(.\" + params.slideDuplicateClass + \")[data-swiper-slide-index=\\\"\" + prevSlide.attr('data-swiper-slide-index') + \"\\\"]\").addClass(params.slideDuplicatePrevClass);\n } else {\n $wrapperEl.children(\".\" + params.slideClass + \".\" + params.slideDuplicateClass + \"[data-swiper-slide-index=\\\"\" + prevSlide.attr('data-swiper-slide-index') + \"\\\"]\").addClass(params.slideDuplicatePrevClass);\n }\n }\n\n swiper.emitSlidesClasses();\n}", "import { extend } from '../../../utils/utils';\nexport default function updateActiveIndex(newActiveIndex) {\n var swiper = this;\n var translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;\n var slidesGrid = swiper.slidesGrid,\n snapGrid = swiper.snapGrid,\n params = swiper.params,\n previousIndex = swiper.activeIndex,\n previousRealIndex = swiper.realIndex,\n previousSnapIndex = swiper.snapIndex;\n var activeIndex = newActiveIndex;\n var snapIndex;\n\n if (typeof activeIndex === 'undefined') {\n for (var i = 0; i < slidesGrid.length; i += 1) {\n if (typeof slidesGrid[i + 1] !== 'undefined') {\n if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) {\n activeIndex = i;\n } else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) {\n activeIndex = i + 1;\n }\n } else if (translate >= slidesGrid[i]) {\n activeIndex = i;\n }\n } // Normalize slideIndex\n\n\n if (params.normalizeSlideIndex) {\n if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0;\n }\n }\n\n if (snapGrid.indexOf(translate) >= 0) {\n snapIndex = snapGrid.indexOf(translate);\n } else {\n var skip = Math.min(params.slidesPerGroupSkip, activeIndex);\n snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup);\n }\n\n if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;\n\n if (activeIndex === previousIndex) {\n if (snapIndex !== previousSnapIndex) {\n swiper.snapIndex = snapIndex;\n swiper.emit('snapIndexChange');\n }\n\n return;\n } // Get real index\n\n\n var realIndex = parseInt(swiper.slides.eq(activeIndex).attr('data-swiper-slide-index') || activeIndex, 10);\n extend(swiper, {\n snapIndex: snapIndex,\n realIndex: realIndex,\n previousIndex: previousIndex,\n activeIndex: activeIndex\n });\n swiper.emit('activeIndexChange');\n swiper.emit('snapIndexChange');\n\n if (previousRealIndex !== realIndex) {\n swiper.emit('realIndexChange');\n }\n\n if (swiper.initialized || swiper.params.runCallbacksOnInit) {\n swiper.emit('slideChange');\n }\n}", "import $ from '../../../utils/dom';\nexport default function updateClickedSlide(e) {\n var swiper = this;\n var params = swiper.params;\n var slide = $(e.target).closest(\".\" + params.slideClass)[0];\n var slideFound = false;\n var slideIndex;\n\n if (slide) {\n for (var i = 0; i < swiper.slides.length; i += 1) {\n if (swiper.slides[i] === slide) {\n slideFound = true;\n slideIndex = i;\n break;\n }\n }\n }\n\n if (slide && slideFound) {\n swiper.clickedSlide = slide;\n\n if (swiper.virtual && swiper.params.virtual.enabled) {\n swiper.clickedIndex = parseInt($(slide).attr('data-swiper-slide-index'), 10);\n } else {\n swiper.clickedIndex = slideIndex;\n }\n } else {\n swiper.clickedSlide = undefined;\n swiper.clickedIndex = undefined;\n return;\n }\n\n if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) {\n swiper.slideToClickedSlide();\n }\n}", "import updateSize from './updateSize';\nimport updateSlides from './updateSlides';\nimport updateAutoHeight from './updateAutoHeight';\nimport updateSlidesOffset from './updateSlidesOffset';\nimport updateSlidesProgress from './updateSlidesProgress';\nimport updateProgress from './updateProgress';\nimport updateSlidesClasses from './updateSlidesClasses';\nimport updateActiveIndex from './updateActiveIndex';\nimport updateClickedSlide from './updateClickedSlide';\nexport default {\n updateSize: updateSize,\n updateSlides: updateSlides,\n updateAutoHeight: updateAutoHeight,\n updateSlidesOffset: updateSlidesOffset,\n updateSlidesProgress: updateSlidesProgress,\n updateProgress: updateProgress,\n updateSlidesClasses: updateSlidesClasses,\n updateActiveIndex: updateActiveIndex,\n updateClickedSlide: updateClickedSlide\n};", "import { getTranslate } from '../../../utils/utils';\nexport default function getSwiperTranslate(axis) {\n if (axis === void 0) {\n axis = this.isHorizontal() ? 'x' : 'y';\n }\n\n var swiper = this;\n var params = swiper.params,\n rtl = swiper.rtlTranslate,\n translate = swiper.translate,\n $wrapperEl = swiper.$wrapperEl;\n\n if (params.virtualTranslate) {\n return rtl ? -translate : translate;\n }\n\n if (params.cssMode) {\n return translate;\n }\n\n var currentTranslate = getTranslate($wrapperEl[0], axis);\n if (rtl) currentTranslate = -currentTranslate;\n return currentTranslate || 0;\n}", "export default function setTranslate(translate, byController) {\n var swiper = this;\n var rtl = swiper.rtlTranslate,\n params = swiper.params,\n $wrapperEl = swiper.$wrapperEl,\n wrapperEl = swiper.wrapperEl,\n progress = swiper.progress;\n var x = 0;\n var y = 0;\n var z = 0;\n\n if (swiper.isHorizontal()) {\n x = rtl ? -translate : translate;\n } else {\n y = translate;\n }\n\n if (params.roundLengths) {\n x = Math.floor(x);\n y = Math.floor(y);\n }\n\n if (params.cssMode) {\n wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y;\n } else if (!params.virtualTranslate) {\n $wrapperEl.transform(\"translate3d(\" + x + \"px, \" + y + \"px, \" + z + \"px)\");\n }\n\n swiper.previousTranslate = swiper.translate;\n swiper.translate = swiper.isHorizontal() ? x : y; // Check if we need to update progress\n\n var newProgress;\n var translatesDiff = swiper.maxTranslate() - swiper.minTranslate();\n\n if (translatesDiff === 0) {\n newProgress = 0;\n } else {\n newProgress = (translate - swiper.minTranslate()) / translatesDiff;\n }\n\n if (newProgress !== progress) {\n swiper.updateProgress(translate);\n }\n\n swiper.emit('setTranslate', swiper.translate, byController);\n}", "export default function minTranslate() {\n return -this.snapGrid[0];\n}", "export default function maxTranslate() {\n return -this.snapGrid[this.snapGrid.length - 1];\n}", "export default function translateTo(translate, speed, runCallbacks, translateBounds, internal) {\n if (translate === void 0) {\n translate = 0;\n }\n\n if (speed === void 0) {\n speed = this.params.speed;\n }\n\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n\n if (translateBounds === void 0) {\n translateBounds = true;\n }\n\n var swiper = this;\n var params = swiper.params,\n wrapperEl = swiper.wrapperEl;\n\n if (swiper.animating && params.preventInteractionOnTransition) {\n return false;\n }\n\n var minTranslate = swiper.minTranslate();\n var maxTranslate = swiper.maxTranslate();\n var newTranslate;\n if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate; // Update progress\n\n swiper.updateProgress(newTranslate);\n\n if (params.cssMode) {\n var isH = swiper.isHorizontal();\n\n if (speed === 0) {\n wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate;\n } else {\n // eslint-disable-next-line\n if (wrapperEl.scrollTo) {\n var _wrapperEl$scrollTo;\n\n wrapperEl.scrollTo((_wrapperEl$scrollTo = {}, _wrapperEl$scrollTo[isH ? 'left' : 'top'] = -newTranslate, _wrapperEl$scrollTo.behavior = 'smooth', _wrapperEl$scrollTo));\n } else {\n wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate;\n }\n }\n\n return true;\n }\n\n if (speed === 0) {\n swiper.setTransition(0);\n swiper.setTranslate(newTranslate);\n\n if (runCallbacks) {\n swiper.emit('beforeTransitionStart', speed, internal);\n swiper.emit('transitionEnd');\n }\n } else {\n swiper.setTransition(speed);\n swiper.setTranslate(newTranslate);\n\n if (runCallbacks) {\n swiper.emit('beforeTransitionStart', speed, internal);\n swiper.emit('transitionStart');\n }\n\n if (!swiper.animating) {\n swiper.animating = true;\n\n if (!swiper.onTranslateToWrapperTransitionEnd) {\n swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) {\n if (!swiper || swiper.destroyed) return;\n if (e.target !== this) return;\n swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);\n swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd);\n swiper.onTranslateToWrapperTransitionEnd = null;\n delete swiper.onTranslateToWrapperTransitionEnd;\n\n if (runCallbacks) {\n swiper.emit('transitionEnd');\n }\n };\n }\n\n swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);\n swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd);\n }\n }\n\n return true;\n}", "import getTranslate from './getTranslate';\nimport setTranslate from './setTranslate';\nimport minTranslate from './minTranslate';\nimport maxTranslate from './maxTranslate';\nimport translateTo from './translateTo';\nexport default {\n getTranslate: getTranslate,\n setTranslate: setTranslate,\n minTranslate: minTranslate,\n maxTranslate: maxTranslate,\n translateTo: translateTo\n};", "export default function setTransition(duration, byController) {\n var swiper = this;\n\n if (!swiper.params.cssMode) {\n swiper.$wrapperEl.transition(duration);\n }\n\n swiper.emit('setTransition', duration, byController);\n}", "export default function transitionStart(runCallbacks, direction) {\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n\n var swiper = this;\n var activeIndex = swiper.activeIndex,\n params = swiper.params,\n previousIndex = swiper.previousIndex;\n if (params.cssMode) return;\n\n if (params.autoHeight) {\n swiper.updateAutoHeight();\n }\n\n var dir = direction;\n\n if (!dir) {\n if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset';\n }\n\n swiper.emit('transitionStart');\n\n if (runCallbacks && activeIndex !== previousIndex) {\n if (dir === 'reset') {\n swiper.emit('slideResetTransitionStart');\n return;\n }\n\n swiper.emit('slideChangeTransitionStart');\n\n if (dir === 'next') {\n swiper.emit('slideNextTransitionStart');\n } else {\n swiper.emit('slidePrevTransitionStart');\n }\n }\n}", "export default function transitionEnd(runCallbacks, direction) {\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n\n var swiper = this;\n var activeIndex = swiper.activeIndex,\n previousIndex = swiper.previousIndex,\n params = swiper.params;\n swiper.animating = false;\n if (params.cssMode) return;\n swiper.setTransition(0);\n var dir = direction;\n\n if (!dir) {\n if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset';\n }\n\n swiper.emit('transitionEnd');\n\n if (runCallbacks && activeIndex !== previousIndex) {\n if (dir === 'reset') {\n swiper.emit('slideResetTransitionEnd');\n return;\n }\n\n swiper.emit('slideChangeTransitionEnd');\n\n if (dir === 'next') {\n swiper.emit('slideNextTransitionEnd');\n } else {\n swiper.emit('slidePrevTransitionEnd');\n }\n }\n}", "import setTransition from './setTransition';\nimport transitionStart from './transitionStart';\nimport transitionEnd from './transitionEnd';\nexport default {\n setTransition: setTransition,\n transitionStart: transitionStart,\n transitionEnd: transitionEnd\n};", "export default function slideTo(index, speed, runCallbacks, internal, initial) {\n if (index === void 0) {\n index = 0;\n }\n\n if (speed === void 0) {\n speed = this.params.speed;\n }\n\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n\n if (typeof index !== 'number' && typeof index !== 'string') {\n throw new Error(\"The 'index' argument cannot have type other than 'number' or 'string'. [\" + typeof index + \"] given.\");\n }\n\n if (typeof index === 'string') {\n /**\n * The `index` argument converted from `string` to `number`.\n * @type {number}\n */\n var indexAsNumber = parseInt(index, 10);\n /**\n * Determines whether the `index` argument is a valid `number`\n * after being converted from the `string` type.\n * @type {boolean}\n */\n\n var isValidNumber = isFinite(indexAsNumber);\n\n if (!isValidNumber) {\n throw new Error(\"The passed-in 'index' (string) couldn't be converted to 'number'. [\" + index + \"] given.\");\n } // Knowing that the converted `index` is a valid number,\n // we can update the original argument's value.\n\n\n index = indexAsNumber;\n }\n\n var swiper = this;\n var slideIndex = index;\n if (slideIndex < 0) slideIndex = 0;\n var params = swiper.params,\n snapGrid = swiper.snapGrid,\n slidesGrid = swiper.slidesGrid,\n previousIndex = swiper.previousIndex,\n activeIndex = swiper.activeIndex,\n rtl = swiper.rtlTranslate,\n wrapperEl = swiper.wrapperEl,\n enabled = swiper.enabled;\n\n if (swiper.animating && params.preventInteractionOnTransition || !enabled && !internal && !initial) {\n return false;\n }\n\n var skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex);\n var snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup);\n if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;\n\n if ((activeIndex || params.initialSlide || 0) === (previousIndex || 0) && runCallbacks) {\n swiper.emit('beforeSlideChangeStart');\n }\n\n var translate = -snapGrid[snapIndex]; // Update progress\n\n swiper.updateProgress(translate); // Normalize slideIndex\n\n if (params.normalizeSlideIndex) {\n for (var i = 0; i < slidesGrid.length; i += 1) {\n var normalizedTranslate = -Math.floor(translate * 100);\n var normalizedGird = Math.floor(slidesGrid[i] * 100);\n var normalizedGridNext = Math.floor(slidesGrid[i + 1] * 100);\n\n if (typeof slidesGrid[i + 1] !== 'undefined') {\n if (normalizedTranslate >= normalizedGird && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGird) / 2) {\n slideIndex = i;\n } else if (normalizedTranslate >= normalizedGird && normalizedTranslate < normalizedGridNext) {\n slideIndex = i + 1;\n }\n } else if (normalizedTranslate >= normalizedGird) {\n slideIndex = i;\n }\n }\n } // Directions locks\n\n\n if (swiper.initialized && slideIndex !== activeIndex) {\n if (!swiper.allowSlideNext && translate < swiper.translate && translate < swiper.minTranslate()) {\n return false;\n }\n\n if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) {\n if ((activeIndex || 0) !== slideIndex) return false;\n }\n }\n\n var direction;\n if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset'; // Update Index\n\n if (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate) {\n swiper.updateActiveIndex(slideIndex); // Update Height\n\n if (params.autoHeight) {\n swiper.updateAutoHeight();\n }\n\n swiper.updateSlidesClasses();\n\n if (params.effect !== 'slide') {\n swiper.setTranslate(translate);\n }\n\n if (direction !== 'reset') {\n swiper.transitionStart(runCallbacks, direction);\n swiper.transitionEnd(runCallbacks, direction);\n }\n\n return false;\n }\n\n if (params.cssMode) {\n var isH = swiper.isHorizontal();\n var t = -translate;\n\n if (rtl) {\n t = wrapperEl.scrollWidth - wrapperEl.offsetWidth - t;\n }\n\n if (speed === 0) {\n wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;\n } else {\n // eslint-disable-next-line\n if (wrapperEl.scrollTo) {\n var _wrapperEl$scrollTo;\n\n wrapperEl.scrollTo((_wrapperEl$scrollTo = {}, _wrapperEl$scrollTo[isH ? 'left' : 'top'] = t, _wrapperEl$scrollTo.behavior = 'smooth', _wrapperEl$scrollTo));\n } else {\n wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;\n }\n }\n\n return true;\n }\n\n if (speed === 0) {\n swiper.setTransition(0);\n swiper.setTranslate(translate);\n swiper.updateActiveIndex(slideIndex);\n swiper.updateSlidesClasses();\n swiper.emit('beforeTransitionStart', speed, internal);\n swiper.transitionStart(runCallbacks, direction);\n swiper.transitionEnd(runCallbacks, direction);\n } else {\n swiper.setTransition(speed);\n swiper.setTranslate(translate);\n swiper.updateActiveIndex(slideIndex);\n swiper.updateSlidesClasses();\n swiper.emit('beforeTransitionStart', speed, internal);\n swiper.transitionStart(runCallbacks, direction);\n\n if (!swiper.animating) {\n swiper.animating = true;\n\n if (!swiper.onSlideToWrapperTransitionEnd) {\n swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) {\n if (!swiper || swiper.destroyed) return;\n if (e.target !== this) return;\n swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);\n swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd);\n swiper.onSlideToWrapperTransitionEnd = null;\n delete swiper.onSlideToWrapperTransitionEnd;\n swiper.transitionEnd(runCallbacks, direction);\n };\n }\n\n swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);\n swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd);\n }\n }\n\n return true;\n}", "export default function slideToLoop(index, speed, runCallbacks, internal) {\n if (index === void 0) {\n index = 0;\n }\n\n if (speed === void 0) {\n speed = this.params.speed;\n }\n\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n\n var swiper = this;\n var newIndex = index;\n\n if (swiper.params.loop) {\n newIndex += swiper.loopedSlides;\n }\n\n return swiper.slideTo(newIndex, speed, runCallbacks, internal);\n}", "/* eslint no-unused-vars: \"off\" */\nexport default function slideNext(speed, runCallbacks, internal) {\n if (speed === void 0) {\n speed = this.params.speed;\n }\n\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n\n var swiper = this;\n var params = swiper.params,\n animating = swiper.animating,\n enabled = swiper.enabled;\n if (!enabled) return swiper;\n var increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup;\n\n if (params.loop) {\n if (animating && params.loopPreventsSlide) return false;\n swiper.loopFix(); // eslint-disable-next-line\n\n swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;\n }\n\n return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);\n}", "/* eslint no-unused-vars: \"off\" */\nexport default function slidePrev(speed, runCallbacks, internal) {\n if (speed === void 0) {\n speed = this.params.speed;\n }\n\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n\n var swiper = this;\n var params = swiper.params,\n animating = swiper.animating,\n snapGrid = swiper.snapGrid,\n slidesGrid = swiper.slidesGrid,\n rtlTranslate = swiper.rtlTranslate,\n enabled = swiper.enabled;\n if (!enabled) return swiper;\n\n if (params.loop) {\n if (animating && params.loopPreventsSlide) return false;\n swiper.loopFix(); // eslint-disable-next-line\n\n swiper._clientLeft = swiper.$wrapperEl[0].clientLeft;\n }\n\n var translate = rtlTranslate ? swiper.translate : -swiper.translate;\n\n function normalize(val) {\n if (val < 0) return -Math.floor(Math.abs(val));\n return Math.floor(val);\n }\n\n var normalizedTranslate = normalize(translate);\n var normalizedSnapGrid = snapGrid.map(function (val) {\n return normalize(val);\n });\n var prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1];\n\n if (typeof prevSnap === 'undefined' && params.cssMode) {\n snapGrid.forEach(function (snap) {\n if (!prevSnap && normalizedTranslate >= snap) prevSnap = snap;\n });\n }\n\n var prevIndex;\n\n if (typeof prevSnap !== 'undefined') {\n prevIndex = slidesGrid.indexOf(prevSnap);\n if (prevIndex < 0) prevIndex = swiper.activeIndex - 1;\n }\n\n return swiper.slideTo(prevIndex, speed, runCallbacks, internal);\n}", "/* eslint no-unused-vars: \"off\" */\nexport default function slideReset(speed, runCallbacks, internal) {\n if (speed === void 0) {\n speed = this.params.speed;\n }\n\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n\n var swiper = this;\n return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);\n}", "/* eslint no-unused-vars: \"off\" */\nexport default function slideToClosest(speed, runCallbacks, internal, threshold) {\n if (speed === void 0) {\n speed = this.params.speed;\n }\n\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n\n if (threshold === void 0) {\n threshold = 0.5;\n }\n\n var swiper = this;\n var index = swiper.activeIndex;\n var skip = Math.min(swiper.params.slidesPerGroupSkip, index);\n var snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup);\n var translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;\n\n if (translate >= swiper.snapGrid[snapIndex]) {\n // The current translate is on or after the current snap index, so the choice\n // is between the current index and the one after it.\n var currentSnap = swiper.snapGrid[snapIndex];\n var nextSnap = swiper.snapGrid[snapIndex + 1];\n\n if (translate - currentSnap > (nextSnap - currentSnap) * threshold) {\n index += swiper.params.slidesPerGroup;\n }\n } else {\n // The current translate is before the current snap index, so the choice\n // is between the current index and the one before it.\n var prevSnap = swiper.snapGrid[snapIndex - 1];\n var _currentSnap = swiper.snapGrid[snapIndex];\n\n if (translate - prevSnap <= (_currentSnap - prevSnap) * threshold) {\n index -= swiper.params.slidesPerGroup;\n }\n }\n\n index = Math.max(index, 0);\n index = Math.min(index, swiper.slidesGrid.length - 1);\n return swiper.slideTo(index, speed, runCallbacks, internal);\n}", "import $ from '../../../utils/dom';\nimport { nextTick } from '../../../utils/utils';\nexport default function slideToClickedSlide() {\n var swiper = this;\n var params = swiper.params,\n $wrapperEl = swiper.$wrapperEl;\n var slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView;\n var slideToIndex = swiper.clickedIndex;\n var realIndex;\n\n if (params.loop) {\n if (swiper.animating) return;\n realIndex = parseInt($(swiper.clickedSlide).attr('data-swiper-slide-index'), 10);\n\n if (params.centeredSlides) {\n if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) {\n swiper.loopFix();\n slideToIndex = $wrapperEl.children(\".\" + params.slideClass + \"[data-swiper-slide-index=\\\"\" + realIndex + \"\\\"]:not(.\" + params.slideDuplicateClass + \")\").eq(0).index();\n nextTick(function () {\n swiper.slideTo(slideToIndex);\n });\n } else {\n swiper.slideTo(slideToIndex);\n }\n } else if (slideToIndex > swiper.slides.length - slidesPerView) {\n swiper.loopFix();\n slideToIndex = $wrapperEl.children(\".\" + params.slideClass + \"[data-swiper-slide-index=\\\"\" + realIndex + \"\\\"]:not(.\" + params.slideDuplicateClass + \")\").eq(0).index();\n nextTick(function () {\n swiper.slideTo(slideToIndex);\n });\n } else {\n swiper.slideTo(slideToIndex);\n }\n } else {\n swiper.slideTo(slideToIndex);\n }\n}", "import slideTo from './slideTo';\nimport slideToLoop from './slideToLoop';\nimport slideNext from './slideNext';\nimport slidePrev from './slidePrev';\nimport slideReset from './slideReset';\nimport slideToClosest from './slideToClosest';\nimport slideToClickedSlide from './slideToClickedSlide';\nexport default {\n slideTo: slideTo,\n slideToLoop: slideToLoop,\n slideNext: slideNext,\n slidePrev: slidePrev,\n slideReset: slideReset,\n slideToClosest: slideToClosest,\n slideToClickedSlide: slideToClickedSlide\n};", "import { getDocument } from 'ssr-window';\nimport $ from '../../../utils/dom';\nexport default function loopCreate() {\n var swiper = this;\n var document = getDocument();\n var params = swiper.params,\n $wrapperEl = swiper.$wrapperEl; // Remove duplicated slides\n\n $wrapperEl.children(\".\" + params.slideClass + \".\" + params.slideDuplicateClass).remove();\n var slides = $wrapperEl.children(\".\" + params.slideClass);\n\n if (params.loopFillGroupWithBlank) {\n var blankSlidesNum = params.slidesPerGroup - slides.length % params.slidesPerGroup;\n\n if (blankSlidesNum !== params.slidesPerGroup) {\n for (var i = 0; i < blankSlidesNum; i += 1) {\n var blankNode = $(document.createElement('div')).addClass(params.slideClass + \" \" + params.slideBlankClass);\n $wrapperEl.append(blankNode);\n }\n\n slides = $wrapperEl.children(\".\" + params.slideClass);\n }\n }\n\n if (params.slidesPerView === 'auto' && !params.loopedSlides) params.loopedSlides = slides.length;\n swiper.loopedSlides = Math.ceil(parseFloat(params.loopedSlides || params.slidesPerView, 10));\n swiper.loopedSlides += params.loopAdditionalSlides;\n\n if (swiper.loopedSlides > slides.length) {\n swiper.loopedSlides = slides.length;\n }\n\n var prependSlides = [];\n var appendSlides = [];\n slides.each(function (el, index) {\n var slide = $(el);\n\n if (index < swiper.loopedSlides) {\n appendSlides.push(el);\n }\n\n if (index < slides.length && index >= slides.length - swiper.loopedSlides) {\n prependSlides.push(el);\n }\n\n slide.attr('data-swiper-slide-index', index);\n });\n\n for (var _i = 0; _i < appendSlides.length; _i += 1) {\n $wrapperEl.append($(appendSlides[_i].cloneNode(true)).addClass(params.slideDuplicateClass));\n }\n\n for (var _i2 = prependSlides.length - 1; _i2 >= 0; _i2 -= 1) {\n $wrapperEl.prepend($(prependSlides[_i2].cloneNode(true)).addClass(params.slideDuplicateClass));\n }\n}", "export default function loopFix() {\n var swiper = this;\n swiper.emit('beforeLoopFix');\n var activeIndex = swiper.activeIndex,\n slides = swiper.slides,\n loopedSlides = swiper.loopedSlides,\n allowSlidePrev = swiper.allowSlidePrev,\n allowSlideNext = swiper.allowSlideNext,\n snapGrid = swiper.snapGrid,\n rtl = swiper.rtlTranslate;\n var newIndex;\n swiper.allowSlidePrev = true;\n swiper.allowSlideNext = true;\n var snapTranslate = -snapGrid[activeIndex];\n var diff = snapTranslate - swiper.getTranslate(); // Fix For Negative Oversliding\n\n if (activeIndex < loopedSlides) {\n newIndex = slides.length - loopedSlides * 3 + activeIndex;\n newIndex += loopedSlides;\n var slideChanged = swiper.slideTo(newIndex, 0, false, true);\n\n if (slideChanged && diff !== 0) {\n swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff);\n }\n } else if (activeIndex >= slides.length - loopedSlides) {\n // Fix For Positive Oversliding\n newIndex = -slides.length + activeIndex + loopedSlides;\n newIndex += loopedSlides;\n\n var _slideChanged = swiper.slideTo(newIndex, 0, false, true);\n\n if (_slideChanged && diff !== 0) {\n swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff);\n }\n }\n\n swiper.allowSlidePrev = allowSlidePrev;\n swiper.allowSlideNext = allowSlideNext;\n swiper.emit('loopFix');\n}", "export default function loopDestroy() {\n var swiper = this;\n var $wrapperEl = swiper.$wrapperEl,\n params = swiper.params,\n slides = swiper.slides;\n $wrapperEl.children(\".\" + params.slideClass + \".\" + params.slideDuplicateClass + \",.\" + params.slideClass + \".\" + params.slideBlankClass).remove();\n slides.removeAttr('data-swiper-slide-index');\n}", "import loopCreate from './loopCreate';\nimport loopFix from './loopFix';\nimport loopDestroy from './loopDestroy';\nexport default {\n loopCreate: loopCreate,\n loopFix: loopFix,\n loopDestroy: loopDestroy\n};", "export default function setGrabCursor(moving) {\n var swiper = this;\n if (swiper.support.touch || !swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return;\n var el = swiper.el;\n el.style.cursor = 'move';\n el.style.cursor = moving ? '-webkit-grabbing' : '-webkit-grab';\n el.style.cursor = moving ? '-moz-grabbin' : '-moz-grab';\n el.style.cursor = moving ? 'grabbing' : 'grab';\n}", "export default function unsetGrabCursor() {\n var swiper = this;\n\n if (swiper.support.touch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) {\n return;\n }\n\n swiper.el.style.cursor = '';\n}", "import setGrabCursor from './setGrabCursor';\nimport unsetGrabCursor from './unsetGrabCursor';\nexport default {\n setGrabCursor: setGrabCursor,\n unsetGrabCursor: unsetGrabCursor\n};", "export default function appendSlide(slides) {\n var swiper = this;\n var $wrapperEl = swiper.$wrapperEl,\n params = swiper.params;\n\n if (params.loop) {\n swiper.loopDestroy();\n }\n\n if (typeof slides === 'object' && 'length' in slides) {\n for (var i = 0; i < slides.length; i += 1) {\n if (slides[i]) $wrapperEl.append(slides[i]);\n }\n } else {\n $wrapperEl.append(slides);\n }\n\n if (params.loop) {\n swiper.loopCreate();\n }\n\n if (!(params.observer && swiper.support.observer)) {\n swiper.update();\n }\n}", "export default function prependSlide(slides) {\n var swiper = this;\n var params = swiper.params,\n $wrapperEl = swiper.$wrapperEl,\n activeIndex = swiper.activeIndex;\n\n if (params.loop) {\n swiper.loopDestroy();\n }\n\n var newActiveIndex = activeIndex + 1;\n\n if (typeof slides === 'object' && 'length' in slides) {\n for (var i = 0; i < slides.length; i += 1) {\n if (slides[i]) $wrapperEl.prepend(slides[i]);\n }\n\n newActiveIndex = activeIndex + slides.length;\n } else {\n $wrapperEl.prepend(slides);\n }\n\n if (params.loop) {\n swiper.loopCreate();\n }\n\n if (!(params.observer && swiper.support.observer)) {\n swiper.update();\n }\n\n swiper.slideTo(newActiveIndex, 0, false);\n}", "export default function addSlide(index, slides) {\n var swiper = this;\n var $wrapperEl = swiper.$wrapperEl,\n params = swiper.params,\n activeIndex = swiper.activeIndex;\n var activeIndexBuffer = activeIndex;\n\n if (params.loop) {\n activeIndexBuffer -= swiper.loopedSlides;\n swiper.loopDestroy();\n swiper.slides = $wrapperEl.children(\".\" + params.slideClass);\n }\n\n var baseLength = swiper.slides.length;\n\n if (index <= 0) {\n swiper.prependSlide(slides);\n return;\n }\n\n if (index >= baseLength) {\n swiper.appendSlide(slides);\n return;\n }\n\n var newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + 1 : activeIndexBuffer;\n var slidesBuffer = [];\n\n for (var i = baseLength - 1; i >= index; i -= 1) {\n var currentSlide = swiper.slides.eq(i);\n currentSlide.remove();\n slidesBuffer.unshift(currentSlide);\n }\n\n if (typeof slides === 'object' && 'length' in slides) {\n for (var _i = 0; _i < slides.length; _i += 1) {\n if (slides[_i]) $wrapperEl.append(slides[_i]);\n }\n\n newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + slides.length : activeIndexBuffer;\n } else {\n $wrapperEl.append(slides);\n }\n\n for (var _i2 = 0; _i2 < slidesBuffer.length; _i2 += 1) {\n $wrapperEl.append(slidesBuffer[_i2]);\n }\n\n if (params.loop) {\n swiper.loopCreate();\n }\n\n if (!(params.observer && swiper.support.observer)) {\n swiper.update();\n }\n\n if (params.loop) {\n swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false);\n } else {\n swiper.slideTo(newActiveIndex, 0, false);\n }\n}", "export default function removeSlide(slidesIndexes) {\n var swiper = this;\n var params = swiper.params,\n $wrapperEl = swiper.$wrapperEl,\n activeIndex = swiper.activeIndex;\n var activeIndexBuffer = activeIndex;\n\n if (params.loop) {\n activeIndexBuffer -= swiper.loopedSlides;\n swiper.loopDestroy();\n swiper.slides = $wrapperEl.children(\".\" + params.slideClass);\n }\n\n var newActiveIndex = activeIndexBuffer;\n var indexToRemove;\n\n if (typeof slidesIndexes === 'object' && 'length' in slidesIndexes) {\n for (var i = 0; i < slidesIndexes.length; i += 1) {\n indexToRemove = slidesIndexes[i];\n if (swiper.slides[indexToRemove]) swiper.slides.eq(indexToRemove).remove();\n if (indexToRemove < newActiveIndex) newActiveIndex -= 1;\n }\n\n newActiveIndex = Math.max(newActiveIndex, 0);\n } else {\n indexToRemove = slidesIndexes;\n if (swiper.slides[indexToRemove]) swiper.slides.eq(indexToRemove).remove();\n if (indexToRemove < newActiveIndex) newActiveIndex -= 1;\n newActiveIndex = Math.max(newActiveIndex, 0);\n }\n\n if (params.loop) {\n swiper.loopCreate();\n }\n\n if (!(params.observer && swiper.support.observer)) {\n swiper.update();\n }\n\n if (params.loop) {\n swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false);\n } else {\n swiper.slideTo(newActiveIndex, 0, false);\n }\n}", "export default function removeAllSlides() {\n var swiper = this;\n var slidesIndexes = [];\n\n for (var i = 0; i < swiper.slides.length; i += 1) {\n slidesIndexes.push(i);\n }\n\n swiper.removeSlide(slidesIndexes);\n}", "import appendSlide from './appendSlide';\nimport prependSlide from './prependSlide';\nimport addSlide from './addSlide';\nimport removeSlide from './removeSlide';\nimport removeAllSlides from './removeAllSlides';\nexport default {\n appendSlide: appendSlide,\n prependSlide: prependSlide,\n addSlide: addSlide,\n removeSlide: removeSlide,\n removeAllSlides: removeAllSlides\n};", "import { getWindow, getDocument } from 'ssr-window';\nimport $ from '../../../utils/dom';\nimport { extend, now } from '../../../utils/utils'; // Modified from https://stackoverflow.com/questions/54520554/custom-element-getrootnode-closest-function-crossing-multiple-parent-shadowd\n\nfunction closestElement(selector, base) {\n if (base === void 0) {\n base = this;\n }\n\n function __closestFrom(el) {\n if (!el || el === getDocument() || el === getWindow()) return null;\n if (el.assignedSlot) el = el.assignedSlot;\n var found = el.closest(selector);\n return found || __closestFrom(el.getRootNode().host);\n }\n\n return __closestFrom(base);\n}\n\nexport default function onTouchStart(event) {\n var swiper = this;\n var document = getDocument();\n var window = getWindow();\n var data = swiper.touchEventsData;\n var params = swiper.params,\n touches = swiper.touches,\n enabled = swiper.enabled;\n if (!enabled) return;\n\n if (swiper.animating && params.preventInteractionOnTransition) {\n return;\n }\n\n var e = event;\n if (e.originalEvent) e = e.originalEvent;\n var $targetEl = $(e.target);\n\n if (params.touchEventsTarget === 'wrapper') {\n if (!$targetEl.closest(swiper.wrapperEl).length) return;\n }\n\n data.isTouchEvent = e.type === 'touchstart';\n if (!data.isTouchEvent && 'which' in e && e.which === 3) return;\n if (!data.isTouchEvent && 'button' in e && e.button > 0) return;\n if (data.isTouched && data.isMoved) return; // change target el for shadow root component\n\n var swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== '';\n\n if (swipingClassHasValue && e.target && e.target.shadowRoot && event.path && event.path[0]) {\n $targetEl = $(event.path[0]);\n }\n\n var noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : \".\" + params.noSwipingClass;\n var isTargetShadow = !!(e.target && e.target.shadowRoot); // use closestElement for shadow root element to get the actual closest for nested shadow root element\n\n if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, e.target) : $targetEl.closest(noSwipingSelector)[0])) {\n swiper.allowClick = true;\n return;\n }\n\n if (params.swipeHandler) {\n if (!$targetEl.closest(params.swipeHandler)[0]) return;\n }\n\n touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n var startX = touches.currentX;\n var startY = touches.currentY; // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore\n\n var edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection;\n var edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold;\n\n if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {\n if (edgeSwipeDetection === 'prevent') {\n event.preventDefault();\n } else {\n return;\n }\n }\n\n extend(data, {\n isTouched: true,\n isMoved: false,\n allowTouchCallbacks: true,\n isScrolling: undefined,\n startMoving: undefined\n });\n touches.startX = startX;\n touches.startY = startY;\n data.touchStartTime = now();\n swiper.allowClick = true;\n swiper.updateSize();\n swiper.swipeDirection = undefined;\n if (params.threshold > 0) data.allowThresholdMove = false;\n\n if (e.type !== 'touchstart') {\n var preventDefault = true;\n if ($targetEl.is(data.focusableElements)) preventDefault = false;\n\n if (document.activeElement && $(document.activeElement).is(data.focusableElements) && document.activeElement !== $targetEl[0]) {\n document.activeElement.blur();\n }\n\n var shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault;\n\n if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !$targetEl[0].isContentEditable) {\n e.preventDefault();\n }\n }\n\n swiper.emit('touchStart', e);\n}", "import { getDocument } from 'ssr-window';\nimport $ from '../../../utils/dom';\nimport { extend, now } from '../../../utils/utils';\nexport default function onTouchMove(event) {\n var document = getDocument();\n var swiper = this;\n var data = swiper.touchEventsData;\n var params = swiper.params,\n touches = swiper.touches,\n rtl = swiper.rtlTranslate,\n enabled = swiper.enabled;\n if (!enabled) return;\n var e = event;\n if (e.originalEvent) e = e.originalEvent;\n\n if (!data.isTouched) {\n if (data.startMoving && data.isScrolling) {\n swiper.emit('touchMoveOpposite', e);\n }\n\n return;\n }\n\n if (data.isTouchEvent && e.type !== 'touchmove') return;\n var targetTouch = e.type === 'touchmove' && e.targetTouches && (e.targetTouches[0] || e.changedTouches[0]);\n var pageX = e.type === 'touchmove' ? targetTouch.pageX : e.pageX;\n var pageY = e.type === 'touchmove' ? targetTouch.pageY : e.pageY;\n\n if (e.preventedByNestedSwiper) {\n touches.startX = pageX;\n touches.startY = pageY;\n return;\n }\n\n if (!swiper.allowTouchMove) {\n // isMoved = true;\n swiper.allowClick = false;\n\n if (data.isTouched) {\n extend(touches, {\n startX: pageX,\n startY: pageY,\n currentX: pageX,\n currentY: pageY\n });\n data.touchStartTime = now();\n }\n\n return;\n }\n\n if (data.isTouchEvent && params.touchReleaseOnEdges && !params.loop) {\n if (swiper.isVertical()) {\n // Vertical\n if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) {\n data.isTouched = false;\n data.isMoved = false;\n return;\n }\n } else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate()) {\n return;\n }\n }\n\n if (data.isTouchEvent && document.activeElement) {\n if (e.target === document.activeElement && $(e.target).is(data.focusableElements)) {\n data.isMoved = true;\n swiper.allowClick = false;\n return;\n }\n }\n\n if (data.allowTouchCallbacks) {\n swiper.emit('touchMove', e);\n }\n\n if (e.targetTouches && e.targetTouches.length > 1) return;\n touches.currentX = pageX;\n touches.currentY = pageY;\n var diffX = touches.currentX - touches.startX;\n var diffY = touches.currentY - touches.startY;\n if (swiper.params.threshold && Math.sqrt(Math.pow(diffX, 2) + Math.pow(diffY, 2)) < swiper.params.threshold) return;\n\n if (typeof data.isScrolling === 'undefined') {\n var touchAngle;\n\n if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) {\n data.isScrolling = false;\n } else {\n // eslint-disable-next-line\n if (diffX * diffX + diffY * diffY >= 25) {\n touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI;\n data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle;\n }\n }\n }\n\n if (data.isScrolling) {\n swiper.emit('touchMoveOpposite', e);\n }\n\n if (typeof data.startMoving === 'undefined') {\n if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) {\n data.startMoving = true;\n }\n }\n\n if (data.isScrolling) {\n data.isTouched = false;\n return;\n }\n\n if (!data.startMoving) {\n return;\n }\n\n swiper.allowClick = false;\n\n if (!params.cssMode && e.cancelable) {\n e.preventDefault();\n }\n\n if (params.touchMoveStopPropagation && !params.nested) {\n e.stopPropagation();\n }\n\n if (!data.isMoved) {\n if (params.loop) {\n swiper.loopFix();\n }\n\n data.startTranslate = swiper.getTranslate();\n swiper.setTransition(0);\n\n if (swiper.animating) {\n swiper.$wrapperEl.trigger('webkitTransitionEnd transitionend');\n }\n\n data.allowMomentumBounce = false; // Grab Cursor\n\n if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {\n swiper.setGrabCursor(true);\n }\n\n swiper.emit('sliderFirstMove', e);\n }\n\n swiper.emit('sliderMove', e);\n data.isMoved = true;\n var diff = swiper.isHorizontal() ? diffX : diffY;\n touches.diff = diff;\n diff *= params.touchRatio;\n if (rtl) diff = -diff;\n swiper.swipeDirection = diff > 0 ? 'prev' : 'next';\n data.currentTranslate = diff + data.startTranslate;\n var disableParentSwiper = true;\n var resistanceRatio = params.resistanceRatio;\n\n if (params.touchReleaseOnEdges) {\n resistanceRatio = 0;\n }\n\n if (diff > 0 && data.currentTranslate > swiper.minTranslate()) {\n disableParentSwiper = false;\n if (params.resistance) data.currentTranslate = swiper.minTranslate() - 1 + Math.pow(-swiper.minTranslate() + data.startTranslate + diff, resistanceRatio);\n } else if (diff < 0 && data.currentTranslate < swiper.maxTranslate()) {\n disableParentSwiper = false;\n if (params.resistance) data.currentTranslate = swiper.maxTranslate() + 1 - Math.pow(swiper.maxTranslate() - data.startTranslate - diff, resistanceRatio);\n }\n\n if (disableParentSwiper) {\n e.preventedByNestedSwiper = true;\n } // Directions locks\n\n\n if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) {\n data.currentTranslate = data.startTranslate;\n }\n\n if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) {\n data.currentTranslate = data.startTranslate;\n }\n\n if (!swiper.allowSlidePrev && !swiper.allowSlideNext) {\n data.currentTranslate = data.startTranslate;\n } // Threshold\n\n\n if (params.threshold > 0) {\n if (Math.abs(diff) > params.threshold || data.allowThresholdMove) {\n if (!data.allowThresholdMove) {\n data.allowThresholdMove = true;\n touches.startX = touches.currentX;\n touches.startY = touches.currentY;\n data.currentTranslate = data.startTranslate;\n touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY;\n return;\n }\n } else {\n data.currentTranslate = data.startTranslate;\n return;\n }\n }\n\n if (!params.followFinger || params.cssMode) return; // Update active index in free mode\n\n if (params.freeMode || params.watchSlidesProgress || params.watchSlidesVisibility) {\n swiper.updateActiveIndex();\n swiper.updateSlidesClasses();\n }\n\n if (params.freeMode) {\n // Velocity\n if (data.velocities.length === 0) {\n data.velocities.push({\n position: touches[swiper.isHorizontal() ? 'startX' : 'startY'],\n time: data.touchStartTime\n });\n }\n\n data.velocities.push({\n position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'],\n time: now()\n });\n } // Update progress\n\n\n swiper.updateProgress(data.currentTranslate); // Update translate\n\n swiper.setTranslate(data.currentTranslate);\n}", "import { now, nextTick } from '../../../utils/utils';\nexport default function onTouchEnd(event) {\n var swiper = this;\n var data = swiper.touchEventsData;\n var params = swiper.params,\n touches = swiper.touches,\n rtl = swiper.rtlTranslate,\n $wrapperEl = swiper.$wrapperEl,\n slidesGrid = swiper.slidesGrid,\n snapGrid = swiper.snapGrid,\n enabled = swiper.enabled;\n if (!enabled) return;\n var e = event;\n if (e.originalEvent) e = e.originalEvent;\n\n if (data.allowTouchCallbacks) {\n swiper.emit('touchEnd', e);\n }\n\n data.allowTouchCallbacks = false;\n\n if (!data.isTouched) {\n if (data.isMoved && params.grabCursor) {\n swiper.setGrabCursor(false);\n }\n\n data.isMoved = false;\n data.startMoving = false;\n return;\n } // Return Grab Cursor\n\n\n if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {\n swiper.setGrabCursor(false);\n } // Time diff\n\n\n var touchEndTime = now();\n var timeDiff = touchEndTime - data.touchStartTime; // Tap, doubleTap, Click\n\n if (swiper.allowClick) {\n swiper.updateClickedSlide(e);\n swiper.emit('tap click', e);\n\n if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) {\n swiper.emit('doubleTap doubleClick', e);\n }\n }\n\n data.lastClickTime = now();\n nextTick(function () {\n if (!swiper.destroyed) swiper.allowClick = true;\n });\n\n if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) {\n data.isTouched = false;\n data.isMoved = false;\n data.startMoving = false;\n return;\n }\n\n data.isTouched = false;\n data.isMoved = false;\n data.startMoving = false;\n var currentPos;\n\n if (params.followFinger) {\n currentPos = rtl ? swiper.translate : -swiper.translate;\n } else {\n currentPos = -data.currentTranslate;\n }\n\n if (params.cssMode) {\n return;\n }\n\n if (params.freeMode) {\n if (currentPos < -swiper.minTranslate()) {\n swiper.slideTo(swiper.activeIndex);\n return;\n }\n\n if (currentPos > -swiper.maxTranslate()) {\n if (swiper.slides.length < snapGrid.length) {\n swiper.slideTo(snapGrid.length - 1);\n } else {\n swiper.slideTo(swiper.slides.length - 1);\n }\n\n return;\n }\n\n if (params.freeModeMomentum) {\n if (data.velocities.length > 1) {\n var lastMoveEvent = data.velocities.pop();\n var velocityEvent = data.velocities.pop();\n var distance = lastMoveEvent.position - velocityEvent.position;\n var time = lastMoveEvent.time - velocityEvent.time;\n swiper.velocity = distance / time;\n swiper.velocity /= 2;\n\n if (Math.abs(swiper.velocity) < params.freeModeMinimumVelocity) {\n swiper.velocity = 0;\n } // this implies that the user stopped moving a finger then released.\n // There would be no events with distance zero, so the last event is stale.\n\n\n if (time > 150 || now() - lastMoveEvent.time > 300) {\n swiper.velocity = 0;\n }\n } else {\n swiper.velocity = 0;\n }\n\n swiper.velocity *= params.freeModeMomentumVelocityRatio;\n data.velocities.length = 0;\n var momentumDuration = 1000 * params.freeModeMomentumRatio;\n var momentumDistance = swiper.velocity * momentumDuration;\n var newPosition = swiper.translate + momentumDistance;\n if (rtl) newPosition = -newPosition;\n var doBounce = false;\n var afterBouncePosition;\n var bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeModeMomentumBounceRatio;\n var needsLoopFix;\n\n if (newPosition < swiper.maxTranslate()) {\n if (params.freeModeMomentumBounce) {\n if (newPosition + swiper.maxTranslate() < -bounceAmount) {\n newPosition = swiper.maxTranslate() - bounceAmount;\n }\n\n afterBouncePosition = swiper.maxTranslate();\n doBounce = true;\n data.allowMomentumBounce = true;\n } else {\n newPosition = swiper.maxTranslate();\n }\n\n if (params.loop && params.centeredSlides) needsLoopFix = true;\n } else if (newPosition > swiper.minTranslate()) {\n if (params.freeModeMomentumBounce) {\n if (newPosition - swiper.minTranslate() > bounceAmount) {\n newPosition = swiper.minTranslate() + bounceAmount;\n }\n\n afterBouncePosition = swiper.minTranslate();\n doBounce = true;\n data.allowMomentumBounce = true;\n } else {\n newPosition = swiper.minTranslate();\n }\n\n if (params.loop && params.centeredSlides) needsLoopFix = true;\n } else if (params.freeModeSticky) {\n var nextSlide;\n\n for (var j = 0; j < snapGrid.length; j += 1) {\n if (snapGrid[j] > -newPosition) {\n nextSlide = j;\n break;\n }\n }\n\n if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') {\n newPosition = snapGrid[nextSlide];\n } else {\n newPosition = snapGrid[nextSlide - 1];\n }\n\n newPosition = -newPosition;\n }\n\n if (needsLoopFix) {\n swiper.once('transitionEnd', function () {\n swiper.loopFix();\n });\n } // Fix duration\n\n\n if (swiper.velocity !== 0) {\n if (rtl) {\n momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity);\n } else {\n momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity);\n }\n\n if (params.freeModeSticky) {\n // If freeModeSticky is active and the user ends a swipe with a slow-velocity\n // event, then durations can be 20+ seconds to slide one (or zero!) slides.\n // It's easy to see this when simulating touch with mouse events. To fix this,\n // limit single-slide swipes to the default slide duration. This also has the\n // nice side effect of matching slide speed if the user stopped moving before\n // lifting finger or mouse vs. moving slowly before lifting the finger/mouse.\n // For faster swipes, also apply limits (albeit higher ones).\n var moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate);\n var currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex];\n\n if (moveDistance < currentSlideSize) {\n momentumDuration = params.speed;\n } else if (moveDistance < 2 * currentSlideSize) {\n momentumDuration = params.speed * 1.5;\n } else {\n momentumDuration = params.speed * 2.5;\n }\n }\n } else if (params.freeModeSticky) {\n swiper.slideToClosest();\n return;\n }\n\n if (params.freeModeMomentumBounce && doBounce) {\n swiper.updateProgress(afterBouncePosition);\n swiper.setTransition(momentumDuration);\n swiper.setTranslate(newPosition);\n swiper.transitionStart(true, swiper.swipeDirection);\n swiper.animating = true;\n $wrapperEl.transitionEnd(function () {\n if (!swiper || swiper.destroyed || !data.allowMomentumBounce) return;\n swiper.emit('momentumBounce');\n swiper.setTransition(params.speed);\n setTimeout(function () {\n swiper.setTranslate(afterBouncePosition);\n $wrapperEl.transitionEnd(function () {\n if (!swiper || swiper.destroyed) return;\n swiper.transitionEnd();\n });\n }, 0);\n });\n } else if (swiper.velocity) {\n swiper.updateProgress(newPosition);\n swiper.setTransition(momentumDuration);\n swiper.setTranslate(newPosition);\n swiper.transitionStart(true, swiper.swipeDirection);\n\n if (!swiper.animating) {\n swiper.animating = true;\n $wrapperEl.transitionEnd(function () {\n if (!swiper || swiper.destroyed) return;\n swiper.transitionEnd();\n });\n }\n } else {\n swiper.emit('_freeModeNoMomentumRelease');\n swiper.updateProgress(newPosition);\n }\n\n swiper.updateActiveIndex();\n swiper.updateSlidesClasses();\n } else if (params.freeModeSticky) {\n swiper.slideToClosest();\n return;\n } else if (params.freeMode) {\n swiper.emit('_freeModeNoMomentumRelease');\n }\n\n if (!params.freeModeMomentum || timeDiff >= params.longSwipesMs) {\n swiper.updateProgress();\n swiper.updateActiveIndex();\n swiper.updateSlidesClasses();\n }\n\n return;\n } // Find current slide\n\n\n var stopIndex = 0;\n var groupSize = swiper.slidesSizesGrid[0];\n\n for (var i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) {\n var _increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;\n\n if (typeof slidesGrid[i + _increment] !== 'undefined') {\n if (currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + _increment]) {\n stopIndex = i;\n groupSize = slidesGrid[i + _increment] - slidesGrid[i];\n }\n } else if (currentPos >= slidesGrid[i]) {\n stopIndex = i;\n groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2];\n }\n } // Find current slide size\n\n\n var ratio = (currentPos - slidesGrid[stopIndex]) / groupSize;\n var increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;\n\n if (timeDiff > params.longSwipesMs) {\n // Long touches\n if (!params.longSwipes) {\n swiper.slideTo(swiper.activeIndex);\n return;\n }\n\n if (swiper.swipeDirection === 'next') {\n if (ratio >= params.longSwipesRatio) swiper.slideTo(stopIndex + increment);else swiper.slideTo(stopIndex);\n }\n\n if (swiper.swipeDirection === 'prev') {\n if (ratio > 1 - params.longSwipesRatio) swiper.slideTo(stopIndex + increment);else swiper.slideTo(stopIndex);\n }\n } else {\n // Short swipes\n if (!params.shortSwipes) {\n swiper.slideTo(swiper.activeIndex);\n return;\n }\n\n var isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl);\n\n if (!isNavButtonTarget) {\n if (swiper.swipeDirection === 'next') {\n swiper.slideTo(stopIndex + increment);\n }\n\n if (swiper.swipeDirection === 'prev') {\n swiper.slideTo(stopIndex);\n }\n } else if (e.target === swiper.navigation.nextEl) {\n swiper.slideTo(stopIndex + increment);\n } else {\n swiper.slideTo(stopIndex);\n }\n }\n}", "export default function onResize() {\n var swiper = this;\n var params = swiper.params,\n el = swiper.el;\n if (el && el.offsetWidth === 0) return; // Breakpoints\n\n if (params.breakpoints) {\n swiper.setBreakpoint();\n } // Save locks\n\n\n var allowSlideNext = swiper.allowSlideNext,\n allowSlidePrev = swiper.allowSlidePrev,\n snapGrid = swiper.snapGrid; // Disable locks on resize\n\n swiper.allowSlideNext = true;\n swiper.allowSlidePrev = true;\n swiper.updateSize();\n swiper.updateSlides();\n swiper.updateSlidesClasses();\n\n if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides) {\n swiper.slideTo(swiper.slides.length - 1, 0, false, true);\n } else {\n swiper.slideTo(swiper.activeIndex, 0, false, true);\n }\n\n if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {\n swiper.autoplay.run();\n } // Return locks after resize\n\n\n swiper.allowSlidePrev = allowSlidePrev;\n swiper.allowSlideNext = allowSlideNext;\n\n if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) {\n swiper.checkOverflow();\n }\n}", "export default function onClick(e) {\n var swiper = this;\n if (!swiper.enabled) return;\n\n if (!swiper.allowClick) {\n if (swiper.params.preventClicks) e.preventDefault();\n\n if (swiper.params.preventClicksPropagation && swiper.animating) {\n e.stopPropagation();\n e.stopImmediatePropagation();\n }\n }\n}", "export default function onScroll() {\n var swiper = this;\n var wrapperEl = swiper.wrapperEl,\n rtlTranslate = swiper.rtlTranslate,\n enabled = swiper.enabled;\n if (!enabled) return;\n swiper.previousTranslate = swiper.translate;\n\n if (swiper.isHorizontal()) {\n if (rtlTranslate) {\n swiper.translate = wrapperEl.scrollWidth - wrapperEl.offsetWidth - wrapperEl.scrollLeft;\n } else {\n swiper.translate = -wrapperEl.scrollLeft;\n }\n } else {\n swiper.translate = -wrapperEl.scrollTop;\n } // eslint-disable-next-line\n\n\n if (swiper.translate === -0) swiper.translate = 0;\n swiper.updateActiveIndex();\n swiper.updateSlidesClasses();\n var newProgress;\n var translatesDiff = swiper.maxTranslate() - swiper.minTranslate();\n\n if (translatesDiff === 0) {\n newProgress = 0;\n } else {\n newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff;\n }\n\n if (newProgress !== swiper.progress) {\n swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate);\n }\n\n swiper.emit('setTranslate', swiper.translate, false);\n}", "import { getDocument } from 'ssr-window';\nimport onTouchStart from './onTouchStart';\nimport onTouchMove from './onTouchMove';\nimport onTouchEnd from './onTouchEnd';\nimport onResize from './onResize';\nimport onClick from './onClick';\nimport onScroll from './onScroll';\nvar dummyEventAttached = false;\n\nfunction dummyEventListener() {}\n\nfunction attachEvents() {\n var swiper = this;\n var document = getDocument();\n var params = swiper.params,\n touchEvents = swiper.touchEvents,\n el = swiper.el,\n wrapperEl = swiper.wrapperEl,\n device = swiper.device,\n support = swiper.support;\n swiper.onTouchStart = onTouchStart.bind(swiper);\n swiper.onTouchMove = onTouchMove.bind(swiper);\n swiper.onTouchEnd = onTouchEnd.bind(swiper);\n\n if (params.cssMode) {\n swiper.onScroll = onScroll.bind(swiper);\n }\n\n swiper.onClick = onClick.bind(swiper);\n var capture = !!params.nested; // Touch Events\n\n if (!support.touch && support.pointerEvents) {\n el.addEventListener(touchEvents.start, swiper.onTouchStart, false);\n document.addEventListener(touchEvents.move, swiper.onTouchMove, capture);\n document.addEventListener(touchEvents.end, swiper.onTouchEnd, false);\n } else {\n if (support.touch) {\n var passiveListener = touchEvents.start === 'touchstart' && support.passiveListener && params.passiveListeners ? {\n passive: true,\n capture: false\n } : false;\n el.addEventListener(touchEvents.start, swiper.onTouchStart, passiveListener);\n el.addEventListener(touchEvents.move, swiper.onTouchMove, support.passiveListener ? {\n passive: false,\n capture: capture\n } : capture);\n el.addEventListener(touchEvents.end, swiper.onTouchEnd, passiveListener);\n\n if (touchEvents.cancel) {\n el.addEventListener(touchEvents.cancel, swiper.onTouchEnd, passiveListener);\n }\n\n if (!dummyEventAttached) {\n document.addEventListener('touchstart', dummyEventListener);\n dummyEventAttached = true;\n }\n }\n\n if (params.simulateTouch && !device.ios && !device.android || params.simulateTouch && !support.touch && device.ios) {\n el.addEventListener('mousedown', swiper.onTouchStart, false);\n document.addEventListener('mousemove', swiper.onTouchMove, capture);\n document.addEventListener('mouseup', swiper.onTouchEnd, false);\n }\n } // Prevent Links Clicks\n\n\n if (params.preventClicks || params.preventClicksPropagation) {\n el.addEventListener('click', swiper.onClick, true);\n }\n\n if (params.cssMode) {\n wrapperEl.addEventListener('scroll', swiper.onScroll);\n } // Resize handler\n\n\n if (params.updateOnWindowResize) {\n swiper.on(device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true);\n } else {\n swiper.on('observerUpdate', onResize, true);\n }\n}\n\nfunction detachEvents() {\n var swiper = this;\n var document = getDocument();\n var params = swiper.params,\n touchEvents = swiper.touchEvents,\n el = swiper.el,\n wrapperEl = swiper.wrapperEl,\n device = swiper.device,\n support = swiper.support;\n var capture = !!params.nested; // Touch Events\n\n if (!support.touch && support.pointerEvents) {\n el.removeEventListener(touchEvents.start, swiper.onTouchStart, false);\n document.removeEventListener(touchEvents.move, swiper.onTouchMove, capture);\n document.removeEventListener(touchEvents.end, swiper.onTouchEnd, false);\n } else {\n if (support.touch) {\n var passiveListener = touchEvents.start === 'onTouchStart' && support.passiveListener && params.passiveListeners ? {\n passive: true,\n capture: false\n } : false;\n el.removeEventListener(touchEvents.start, swiper.onTouchStart, passiveListener);\n el.removeEventListener(touchEvents.move, swiper.onTouchMove, capture);\n el.removeEventListener(touchEvents.end, swiper.onTouchEnd, passiveListener);\n\n if (touchEvents.cancel) {\n el.removeEventListener(touchEvents.cancel, swiper.onTouchEnd, passiveListener);\n }\n }\n\n if (params.simulateTouch && !device.ios && !device.android || params.simulateTouch && !support.touch && device.ios) {\n el.removeEventListener('mousedown', swiper.onTouchStart, false);\n document.removeEventListener('mousemove', swiper.onTouchMove, capture);\n document.removeEventListener('mouseup', swiper.onTouchEnd, false);\n }\n } // Prevent Links Clicks\n\n\n if (params.preventClicks || params.preventClicksPropagation) {\n el.removeEventListener('click', swiper.onClick, true);\n }\n\n if (params.cssMode) {\n wrapperEl.removeEventListener('scroll', swiper.onScroll);\n } // Resize handler\n\n\n swiper.off(device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize);\n}\n\nexport default {\n attachEvents: attachEvents,\n detachEvents: detachEvents\n};", "import { extend } from '../../../utils/utils';\nexport default function setBreakpoint() {\n var swiper = this;\n var activeIndex = swiper.activeIndex,\n initialized = swiper.initialized,\n _swiper$loopedSlides = swiper.loopedSlides,\n loopedSlides = _swiper$loopedSlides === void 0 ? 0 : _swiper$loopedSlides,\n params = swiper.params,\n $el = swiper.$el;\n var breakpoints = params.breakpoints;\n if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return; // Get breakpoint for window width and update parameters\n\n var breakpoint = swiper.getBreakpoint(breakpoints, swiper.params.breakpointsBase, swiper.el);\n if (!breakpoint || swiper.currentBreakpoint === breakpoint) return;\n var breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined;\n\n if (breakpointOnlyParams) {\n ['slidesPerView', 'spaceBetween', 'slidesPerGroup', 'slidesPerGroupSkip', 'slidesPerColumn'].forEach(function (param) {\n var paramValue = breakpointOnlyParams[param];\n if (typeof paramValue === 'undefined') return;\n\n if (param === 'slidesPerView' && (paramValue === 'AUTO' || paramValue === 'auto')) {\n breakpointOnlyParams[param] = 'auto';\n } else if (param === 'slidesPerView') {\n breakpointOnlyParams[param] = parseFloat(paramValue);\n } else {\n breakpointOnlyParams[param] = parseInt(paramValue, 10);\n }\n });\n }\n\n var breakpointParams = breakpointOnlyParams || swiper.originalParams;\n var wasMultiRow = params.slidesPerColumn > 1;\n var isMultiRow = breakpointParams.slidesPerColumn > 1;\n var wasEnabled = params.enabled;\n\n if (wasMultiRow && !isMultiRow) {\n $el.removeClass(params.containerModifierClass + \"multirow \" + params.containerModifierClass + \"multirow-column\");\n swiper.emitContainerClasses();\n } else if (!wasMultiRow && isMultiRow) {\n $el.addClass(params.containerModifierClass + \"multirow\");\n\n if (breakpointParams.slidesPerColumnFill && breakpointParams.slidesPerColumnFill === 'column' || !breakpointParams.slidesPerColumnFill && params.slidesPerColumnFill === 'column') {\n $el.addClass(params.containerModifierClass + \"multirow-column\");\n }\n\n swiper.emitContainerClasses();\n }\n\n var directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction;\n var needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged);\n\n if (directionChanged && initialized) {\n swiper.changeDirection();\n }\n\n extend(swiper.params, breakpointParams);\n var isEnabled = swiper.params.enabled;\n extend(swiper, {\n allowTouchMove: swiper.params.allowTouchMove,\n allowSlideNext: swiper.params.allowSlideNext,\n allowSlidePrev: swiper.params.allowSlidePrev\n });\n\n if (wasEnabled && !isEnabled) {\n swiper.disable();\n } else if (!wasEnabled && isEnabled) {\n swiper.enable();\n }\n\n swiper.currentBreakpoint = breakpoint;\n swiper.emit('_beforeBreakpoint', breakpointParams);\n\n if (needsReLoop && initialized) {\n swiper.loopDestroy();\n swiper.loopCreate();\n swiper.updateSlides();\n swiper.slideTo(activeIndex - loopedSlides + swiper.loopedSlides, 0, false);\n }\n\n swiper.emit('breakpoint', breakpointParams);\n}", "import { getWindow } from 'ssr-window';\nexport default function getBreakpoint(breakpoints, base, containerEl) {\n if (base === void 0) {\n base = 'window';\n }\n\n if (!breakpoints || base === 'container' && !containerEl) return undefined;\n var breakpoint = false;\n var window = getWindow();\n var currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight;\n var points = Object.keys(breakpoints).map(function (point) {\n if (typeof point === 'string' && point.indexOf('@') === 0) {\n var minRatio = parseFloat(point.substr(1));\n var value = currentHeight * minRatio;\n return {\n value: value,\n point: point\n };\n }\n\n return {\n value: point,\n point: point\n };\n });\n points.sort(function (a, b) {\n return parseInt(a.value, 10) - parseInt(b.value, 10);\n });\n\n for (var i = 0; i < points.length; i += 1) {\n var _points$i = points[i],\n point = _points$i.point,\n value = _points$i.value;\n\n if (base === 'window') {\n if (window.matchMedia(\"(min-width: \" + value + \"px)\").matches) {\n breakpoint = point;\n }\n } else if (value <= containerEl.clientWidth) {\n breakpoint = point;\n }\n }\n\n return breakpoint || 'max';\n}", "import setBreakpoint from './setBreakpoint';\nimport getBreakpoint from './getBreakpoint';\nexport default {\n setBreakpoint: setBreakpoint,\n getBreakpoint: getBreakpoint\n};", "function prepareClasses(entries, prefix) {\n var resultClasses = [];\n entries.forEach(function (item) {\n if (typeof item === 'object') {\n Object.keys(item).forEach(function (classNames) {\n if (item[classNames]) {\n resultClasses.push(prefix + classNames);\n }\n });\n } else if (typeof item === 'string') {\n resultClasses.push(prefix + item);\n }\n });\n return resultClasses;\n}\n\nexport default function addClasses() {\n var swiper = this;\n var classNames = swiper.classNames,\n params = swiper.params,\n rtl = swiper.rtl,\n $el = swiper.$el,\n device = swiper.device,\n support = swiper.support; // prettier-ignore\n\n var suffixes = prepareClasses(['initialized', params.direction, {\n 'pointer-events': support.pointerEvents && !support.touch\n }, {\n 'free-mode': params.freeMode\n }, {\n 'autoheight': params.autoHeight\n }, {\n 'rtl': rtl\n }, {\n 'multirow': params.slidesPerColumn > 1\n }, {\n 'multirow-column': params.slidesPerColumn > 1 && params.slidesPerColumnFill === 'column'\n }, {\n 'android': device.android\n }, {\n 'ios': device.ios\n }, {\n 'css-mode': params.cssMode\n }], params.containerModifierClass);\n classNames.push.apply(classNames, suffixes);\n $el.addClass([].concat(classNames).join(' '));\n swiper.emitContainerClasses();\n}", "export default function removeClasses() {\n var swiper = this;\n var $el = swiper.$el,\n classNames = swiper.classNames;\n $el.removeClass(classNames.join(' '));\n swiper.emitContainerClasses();\n}", "import addClasses from './addClasses';\nimport removeClasses from './removeClasses';\nexport default {\n addClasses: addClasses,\n removeClasses: removeClasses\n};", "import { getWindow } from 'ssr-window';\nimport $ from '../../../utils/dom';\nexport default function loadImage(imageEl, src, srcset, sizes, checkForComplete, callback) {\n var window = getWindow();\n var image;\n\n function onReady() {\n if (callback) callback();\n }\n\n var isPicture = $(imageEl).parent('picture')[0];\n\n if (!isPicture && (!imageEl.complete || !checkForComplete)) {\n if (src) {\n image = new window.Image();\n image.onload = onReady;\n image.onerror = onReady;\n\n if (sizes) {\n image.sizes = sizes;\n }\n\n if (srcset) {\n image.srcset = srcset;\n }\n\n if (src) {\n image.src = src;\n }\n } else {\n onReady();\n }\n } else {\n // image already loaded...\n onReady();\n }\n}", "export default function preloadImages() {\n var swiper = this;\n swiper.imagesToLoad = swiper.$el.find('img');\n\n function onReady() {\n if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper.destroyed) return;\n if (swiper.imagesLoaded !== undefined) swiper.imagesLoaded += 1;\n\n if (swiper.imagesLoaded === swiper.imagesToLoad.length) {\n if (swiper.params.updateOnImagesReady) swiper.update();\n swiper.emit('imagesReady');\n }\n }\n\n for (var i = 0; i < swiper.imagesToLoad.length; i += 1) {\n var imageEl = swiper.imagesToLoad[i];\n swiper.loadImage(imageEl, imageEl.currentSrc || imageEl.getAttribute('src'), imageEl.srcset || imageEl.getAttribute('srcset'), imageEl.sizes || imageEl.getAttribute('sizes'), true, onReady);\n }\n}", "import loadImage from './loadImage';\nimport preloadImages from './preloadImages';\nexport default {\n loadImage: loadImage,\n preloadImages: preloadImages\n};", "function checkOverflow() {\n var swiper = this;\n var params = swiper.params;\n var wasLocked = swiper.isLocked;\n var lastSlidePosition = swiper.slides.length > 0 && params.slidesOffsetBefore + params.spaceBetween * (swiper.slides.length - 1) + swiper.slides[0].offsetWidth * swiper.slides.length;\n\n if (params.slidesOffsetBefore && params.slidesOffsetAfter && lastSlidePosition) {\n swiper.isLocked = lastSlidePosition <= swiper.size;\n } else {\n swiper.isLocked = swiper.snapGrid.length === 1;\n }\n\n swiper.allowSlideNext = !swiper.isLocked;\n swiper.allowSlidePrev = !swiper.isLocked; // events\n\n if (wasLocked !== swiper.isLocked) swiper.emit(swiper.isLocked ? 'lock' : 'unlock');\n\n if (wasLocked && wasLocked !== swiper.isLocked) {\n swiper.isEnd = false;\n if (swiper.navigation) swiper.navigation.update();\n }\n}\n\nexport default {\n checkOverflow: checkOverflow\n};", "export default {\n init: true,\n direction: 'horizontal',\n touchEventsTarget: 'container',\n initialSlide: 0,\n speed: 300,\n cssMode: false,\n updateOnWindowResize: true,\n resizeObserver: false,\n nested: false,\n createElements: false,\n enabled: true,\n focusableElements: 'input, select, option, textarea, button, video, label',\n // Overrides\n width: null,\n height: null,\n //\n preventInteractionOnTransition: false,\n // ssr\n userAgent: null,\n url: null,\n // To support iOS's swipe-to-go-back gesture (when being used in-app).\n edgeSwipeDetection: false,\n edgeSwipeThreshold: 20,\n // Free mode\n freeMode: false,\n freeModeMomentum: true,\n freeModeMomentumRatio: 1,\n freeModeMomentumBounce: true,\n freeModeMomentumBounceRatio: 1,\n freeModeMomentumVelocityRatio: 1,\n freeModeSticky: false,\n freeModeMinimumVelocity: 0.02,\n // Autoheight\n autoHeight: false,\n // Set wrapper width\n setWrapperSize: false,\n // Virtual Translate\n virtualTranslate: false,\n // Effects\n effect: 'slide',\n // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'\n // Breakpoints\n breakpoints: undefined,\n breakpointsBase: 'window',\n // Slides grid\n spaceBetween: 0,\n slidesPerView: 1,\n slidesPerColumn: 1,\n slidesPerColumnFill: 'column',\n slidesPerGroup: 1,\n slidesPerGroupSkip: 0,\n centeredSlides: false,\n centeredSlidesBounds: false,\n slidesOffsetBefore: 0,\n // in px\n slidesOffsetAfter: 0,\n // in px\n normalizeSlideIndex: true,\n centerInsufficientSlides: false,\n // Disable swiper and hide navigation when container not overflow\n watchOverflow: false,\n // Round length\n roundLengths: false,\n // Touches\n touchRatio: 1,\n touchAngle: 45,\n simulateTouch: true,\n shortSwipes: true,\n longSwipes: true,\n longSwipesRatio: 0.5,\n longSwipesMs: 300,\n followFinger: true,\n allowTouchMove: true,\n threshold: 0,\n touchMoveStopPropagation: false,\n touchStartPreventDefault: true,\n touchStartForcePreventDefault: false,\n touchReleaseOnEdges: false,\n // Unique Navigation Elements\n uniqueNavElements: true,\n // Resistance\n resistance: true,\n resistanceRatio: 0.85,\n // Progress\n watchSlidesProgress: false,\n watchSlidesVisibility: false,\n // Cursor\n grabCursor: false,\n // Clicks\n preventClicks: true,\n preventClicksPropagation: true,\n slideToClickedSlide: false,\n // Images\n preloadImages: true,\n updateOnImagesReady: true,\n // loop\n loop: false,\n loopAdditionalSlides: 0,\n loopedSlides: null,\n loopFillGroupWithBlank: false,\n loopPreventsSlide: true,\n // Swiping/no swiping\n allowSlidePrev: true,\n allowSlideNext: true,\n swipeHandler: null,\n // '.swipe-handler',\n noSwiping: true,\n noSwipingClass: 'swiper-no-swiping',\n noSwipingSelector: null,\n // Passive Listeners\n passiveListeners: true,\n // NS\n containerModifierClass: 'swiper-container-',\n // NEW\n slideClass: 'swiper-slide',\n slideBlankClass: 'swiper-slide-invisible-blank',\n slideActiveClass: 'swiper-slide-active',\n slideDuplicateActiveClass: 'swiper-slide-duplicate-active',\n slideVisibleClass: 'swiper-slide-visible',\n slideDuplicateClass: 'swiper-slide-duplicate',\n slideNextClass: 'swiper-slide-next',\n slideDuplicateNextClass: 'swiper-slide-duplicate-next',\n slidePrevClass: 'swiper-slide-prev',\n slideDuplicatePrevClass: 'swiper-slide-duplicate-prev',\n wrapperClass: 'swiper-wrapper',\n // Callbacks\n runCallbacksOnInit: true,\n // Internals\n _emitClasses: false\n};", "function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/* eslint no-param-reassign: \"off\" */\nimport { getDocument } from 'ssr-window';\nimport $ from '../../utils/dom';\nimport { extend, now, deleteProps } from '../../utils/utils';\nimport { getSupport } from '../../utils/get-support';\nimport { getDevice } from '../../utils/get-device';\nimport { getBrowser } from '../../utils/get-browser';\nimport Resize from '../../modules/resize/resize';\nimport Observer from '../../modules/observer/observer';\nimport modular from './modular';\nimport eventsEmitter from './events-emitter';\nimport update from './update/index';\nimport translate from './translate/index';\nimport transition from './transition/index';\nimport slide from './slide/index';\nimport loop from './loop/index';\nimport grabCursor from './grab-cursor/index';\nimport manipulation from './manipulation/index';\nimport events from './events/index';\nimport breakpoints from './breakpoints/index';\nimport classes from './classes/index';\nimport images from './images/index';\nimport checkOverflow from './check-overflow/index';\nimport defaults from './defaults';\nvar prototypes = {\n modular: modular,\n eventsEmitter: eventsEmitter,\n update: update,\n translate: translate,\n transition: transition,\n slide: slide,\n loop: loop,\n grabCursor: grabCursor,\n manipulation: manipulation,\n events: events,\n breakpoints: breakpoints,\n checkOverflow: checkOverflow,\n classes: classes,\n images: images\n};\nvar extendedDefaults = {};\n\nvar Swiper = /*#__PURE__*/function () {\n function Swiper() {\n var el;\n var params;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') {\n params = args[0];\n } else {\n el = args[0];\n params = args[1];\n }\n\n if (!params) params = {};\n params = extend({}, params);\n if (el && !params.el) params.el = el;\n\n if (params.el && $(params.el).length > 1) {\n var swipers = [];\n $(params.el).each(function (containerEl) {\n var newParams = extend({}, params, {\n el: containerEl\n });\n swipers.push(new Swiper(newParams));\n });\n return swipers;\n } // Swiper Instance\n\n\n var swiper = this;\n swiper.__swiper__ = true;\n swiper.support = getSupport();\n swiper.device = getDevice({\n userAgent: params.userAgent\n });\n swiper.browser = getBrowser();\n swiper.eventsListeners = {};\n swiper.eventsAnyListeners = [];\n\n if (typeof swiper.modules === 'undefined') {\n swiper.modules = {};\n }\n\n Object.keys(swiper.modules).forEach(function (moduleName) {\n var module = swiper.modules[moduleName];\n\n if (module.params) {\n var moduleParamName = Object.keys(module.params)[0];\n var moduleParams = module.params[moduleParamName];\n if (typeof moduleParams !== 'object' || moduleParams === null) return;\n\n if (['navigation', 'pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] === true) {\n params[moduleParamName] = {\n auto: true\n };\n }\n\n if (!(moduleParamName in params && 'enabled' in moduleParams)) return;\n\n if (params[moduleParamName] === true) {\n params[moduleParamName] = {\n enabled: true\n };\n }\n\n if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) {\n params[moduleParamName].enabled = true;\n }\n\n if (!params[moduleParamName]) params[moduleParamName] = {\n enabled: false\n };\n }\n }); // Extend defaults with modules params\n\n var swiperParams = extend({}, defaults);\n swiper.useParams(swiperParams); // Extend defaults with passed params\n\n swiper.params = extend({}, swiperParams, extendedDefaults, params);\n swiper.originalParams = extend({}, swiper.params);\n swiper.passedParams = extend({}, params); // add event listeners\n\n if (swiper.params && swiper.params.on) {\n Object.keys(swiper.params.on).forEach(function (eventName) {\n swiper.on(eventName, swiper.params.on[eventName]);\n });\n }\n\n if (swiper.params && swiper.params.onAny) {\n swiper.onAny(swiper.params.onAny);\n } // Save Dom lib\n\n\n swiper.$ = $; // Extend Swiper\n\n extend(swiper, {\n enabled: swiper.params.enabled,\n el: el,\n // Classes\n classNames: [],\n // Slides\n slides: $(),\n slidesGrid: [],\n snapGrid: [],\n slidesSizesGrid: [],\n // isDirection\n isHorizontal: function isHorizontal() {\n return swiper.params.direction === 'horizontal';\n },\n isVertical: function isVertical() {\n return swiper.params.direction === 'vertical';\n },\n // Indexes\n activeIndex: 0,\n realIndex: 0,\n //\n isBeginning: true,\n isEnd: false,\n // Props\n translate: 0,\n previousTranslate: 0,\n progress: 0,\n velocity: 0,\n animating: false,\n // Locks\n allowSlideNext: swiper.params.allowSlideNext,\n allowSlidePrev: swiper.params.allowSlidePrev,\n // Touch Events\n touchEvents: function touchEvents() {\n var touch = ['touchstart', 'touchmove', 'touchend', 'touchcancel'];\n var desktop = ['mousedown', 'mousemove', 'mouseup'];\n\n if (swiper.support.pointerEvents) {\n desktop = ['pointerdown', 'pointermove', 'pointerup'];\n }\n\n swiper.touchEventsTouch = {\n start: touch[0],\n move: touch[1],\n end: touch[2],\n cancel: touch[3]\n };\n swiper.touchEventsDesktop = {\n start: desktop[0],\n move: desktop[1],\n end: desktop[2]\n };\n return swiper.support.touch || !swiper.params.simulateTouch ? swiper.touchEventsTouch : swiper.touchEventsDesktop;\n }(),\n touchEventsData: {\n isTouched: undefined,\n isMoved: undefined,\n allowTouchCallbacks: undefined,\n touchStartTime: undefined,\n isScrolling: undefined,\n currentTranslate: undefined,\n startTranslate: undefined,\n allowThresholdMove: undefined,\n // Form elements to match\n focusableElements: swiper.params.focusableElements,\n // Last click time\n lastClickTime: now(),\n clickTimeout: undefined,\n // Velocities\n velocities: [],\n allowMomentumBounce: undefined,\n isTouchEvent: undefined,\n startMoving: undefined\n },\n // Clicks\n allowClick: true,\n // Touches\n allowTouchMove: swiper.params.allowTouchMove,\n touches: {\n startX: 0,\n startY: 0,\n currentX: 0,\n currentY: 0,\n diff: 0\n },\n // Images\n imagesToLoad: [],\n imagesLoaded: 0\n }); // Install Modules\n\n swiper.useModules();\n swiper.emit('_swiper'); // Init\n\n if (swiper.params.init) {\n swiper.init();\n } // Return app instance\n\n\n return swiper;\n }\n\n var _proto = Swiper.prototype;\n\n _proto.enable = function enable() {\n var swiper = this;\n if (swiper.enabled) return;\n swiper.enabled = true;\n\n if (swiper.params.grabCursor) {\n swiper.setGrabCursor();\n }\n\n swiper.emit('enable');\n };\n\n _proto.disable = function disable() {\n var swiper = this;\n if (!swiper.enabled) return;\n swiper.enabled = false;\n\n if (swiper.params.grabCursor) {\n swiper.unsetGrabCursor();\n }\n\n swiper.emit('disable');\n };\n\n _proto.setProgress = function setProgress(progress, speed) {\n var swiper = this;\n progress = Math.min(Math.max(progress, 0), 1);\n var min = swiper.minTranslate();\n var max = swiper.maxTranslate();\n var current = (max - min) * progress + min;\n swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed);\n swiper.updateActiveIndex();\n swiper.updateSlidesClasses();\n };\n\n _proto.emitContainerClasses = function emitContainerClasses() {\n var swiper = this;\n if (!swiper.params._emitClasses || !swiper.el) return;\n var classes = swiper.el.className.split(' ').filter(function (className) {\n return className.indexOf('swiper-container') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0;\n });\n swiper.emit('_containerClasses', classes.join(' '));\n };\n\n _proto.getSlideClasses = function getSlideClasses(slideEl) {\n var swiper = this;\n return slideEl.className.split(' ').filter(function (className) {\n return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0;\n }).join(' ');\n };\n\n _proto.emitSlidesClasses = function emitSlidesClasses() {\n var swiper = this;\n if (!swiper.params._emitClasses || !swiper.el) return;\n var updates = [];\n swiper.slides.each(function (slideEl) {\n var classNames = swiper.getSlideClasses(slideEl);\n updates.push({\n slideEl: slideEl,\n classNames: classNames\n });\n swiper.emit('_slideClass', slideEl, classNames);\n });\n swiper.emit('_slideClasses', updates);\n };\n\n _proto.slidesPerViewDynamic = function slidesPerViewDynamic() {\n var swiper = this;\n var params = swiper.params,\n slides = swiper.slides,\n slidesGrid = swiper.slidesGrid,\n swiperSize = swiper.size,\n activeIndex = swiper.activeIndex;\n var spv = 1;\n\n if (params.centeredSlides) {\n var slideSize = slides[activeIndex].swiperSlideSize;\n var breakLoop;\n\n for (var i = activeIndex + 1; i < slides.length; i += 1) {\n if (slides[i] && !breakLoop) {\n slideSize += slides[i].swiperSlideSize;\n spv += 1;\n if (slideSize > swiperSize) breakLoop = true;\n }\n }\n\n for (var _i = activeIndex - 1; _i >= 0; _i -= 1) {\n if (slides[_i] && !breakLoop) {\n slideSize += slides[_i].swiperSlideSize;\n spv += 1;\n if (slideSize > swiperSize) breakLoop = true;\n }\n }\n } else {\n for (var _i2 = activeIndex + 1; _i2 < slides.length; _i2 += 1) {\n if (slidesGrid[_i2] - slidesGrid[activeIndex] < swiperSize) {\n spv += 1;\n }\n }\n }\n\n return spv;\n };\n\n _proto.update = function update() {\n var swiper = this;\n if (!swiper || swiper.destroyed) return;\n var snapGrid = swiper.snapGrid,\n params = swiper.params; // Breakpoints\n\n if (params.breakpoints) {\n swiper.setBreakpoint();\n }\n\n swiper.updateSize();\n swiper.updateSlides();\n swiper.updateProgress();\n swiper.updateSlidesClasses();\n\n function setTranslate() {\n var translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate;\n var newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate());\n swiper.setTranslate(newTranslate);\n swiper.updateActiveIndex();\n swiper.updateSlidesClasses();\n }\n\n var translated;\n\n if (swiper.params.freeMode) {\n setTranslate();\n\n if (swiper.params.autoHeight) {\n swiper.updateAutoHeight();\n }\n } else {\n if ((swiper.params.slidesPerView === 'auto' || swiper.params.slidesPerView > 1) && swiper.isEnd && !swiper.params.centeredSlides) {\n translated = swiper.slideTo(swiper.slides.length - 1, 0, false, true);\n } else {\n translated = swiper.slideTo(swiper.activeIndex, 0, false, true);\n }\n\n if (!translated) {\n setTranslate();\n }\n }\n\n if (params.watchOverflow && snapGrid !== swiper.snapGrid) {\n swiper.checkOverflow();\n }\n\n swiper.emit('update');\n };\n\n _proto.changeDirection = function changeDirection(newDirection, needUpdate) {\n if (needUpdate === void 0) {\n needUpdate = true;\n }\n\n var swiper = this;\n var currentDirection = swiper.params.direction;\n\n if (!newDirection) {\n // eslint-disable-next-line\n newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal';\n }\n\n if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') {\n return swiper;\n }\n\n swiper.$el.removeClass(\"\" + swiper.params.containerModifierClass + currentDirection).addClass(\"\" + swiper.params.containerModifierClass + newDirection);\n swiper.emitContainerClasses();\n swiper.params.direction = newDirection;\n swiper.slides.each(function (slideEl) {\n if (newDirection === 'vertical') {\n slideEl.style.width = '';\n } else {\n slideEl.style.height = '';\n }\n });\n swiper.emit('changeDirection');\n if (needUpdate) swiper.update();\n return swiper;\n };\n\n _proto.mount = function mount(el) {\n var swiper = this;\n if (swiper.mounted) return true; // Find el\n\n var $el = $(el || swiper.params.el);\n el = $el[0];\n\n if (!el) {\n return false;\n }\n\n el.swiper = swiper;\n\n var getWrapperSelector = function getWrapperSelector() {\n return \".\" + (swiper.params.wrapperClass || '').trim().split(' ').join('.');\n };\n\n var getWrapper = function getWrapper() {\n if (el && el.shadowRoot && el.shadowRoot.querySelector) {\n var res = $(el.shadowRoot.querySelector(getWrapperSelector())); // Children needs to return slot items\n\n res.children = function (options) {\n return $el.children(options);\n };\n\n return res;\n }\n\n return $el.children(getWrapperSelector());\n }; // Find Wrapper\n\n\n var $wrapperEl = getWrapper();\n\n if ($wrapperEl.length === 0 && swiper.params.createElements) {\n var document = getDocument();\n var wrapper = document.createElement('div');\n $wrapperEl = $(wrapper);\n wrapper.className = swiper.params.wrapperClass;\n $el.append(wrapper);\n $el.children(\".\" + swiper.params.slideClass).each(function (slideEl) {\n $wrapperEl.append(slideEl);\n });\n }\n\n extend(swiper, {\n $el: $el,\n el: el,\n $wrapperEl: $wrapperEl,\n wrapperEl: $wrapperEl[0],\n mounted: true,\n // RTL\n rtl: el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl',\n rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl'),\n wrongRTL: $wrapperEl.css('display') === '-webkit-box'\n });\n return true;\n };\n\n _proto.init = function init(el) {\n var swiper = this;\n if (swiper.initialized) return swiper;\n var mounted = swiper.mount(el);\n if (mounted === false) return swiper;\n swiper.emit('beforeInit'); // Set breakpoint\n\n if (swiper.params.breakpoints) {\n swiper.setBreakpoint();\n } // Add Classes\n\n\n swiper.addClasses(); // Create loop\n\n if (swiper.params.loop) {\n swiper.loopCreate();\n } // Update size\n\n\n swiper.updateSize(); // Update slides\n\n swiper.updateSlides();\n\n if (swiper.params.watchOverflow) {\n swiper.checkOverflow();\n } // Set Grab Cursor\n\n\n if (swiper.params.grabCursor && swiper.enabled) {\n swiper.setGrabCursor();\n }\n\n if (swiper.params.preloadImages) {\n swiper.preloadImages();\n } // Slide To Initial Slide\n\n\n if (swiper.params.loop) {\n swiper.slideTo(swiper.params.initialSlide + swiper.loopedSlides, 0, swiper.params.runCallbacksOnInit, false, true);\n } else {\n swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true);\n } // Attach events\n\n\n swiper.attachEvents(); // Init Flag\n\n swiper.initialized = true; // Emit\n\n swiper.emit('init');\n swiper.emit('afterInit');\n return swiper;\n };\n\n _proto.destroy = function destroy(deleteInstance, cleanStyles) {\n if (deleteInstance === void 0) {\n deleteInstance = true;\n }\n\n if (cleanStyles === void 0) {\n cleanStyles = true;\n }\n\n var swiper = this;\n var params = swiper.params,\n $el = swiper.$el,\n $wrapperEl = swiper.$wrapperEl,\n slides = swiper.slides;\n\n if (typeof swiper.params === 'undefined' || swiper.destroyed) {\n return null;\n }\n\n swiper.emit('beforeDestroy'); // Init Flag\n\n swiper.initialized = false; // Detach events\n\n swiper.detachEvents(); // Destroy loop\n\n if (params.loop) {\n swiper.loopDestroy();\n } // Cleanup styles\n\n\n if (cleanStyles) {\n swiper.removeClasses();\n $el.removeAttr('style');\n $wrapperEl.removeAttr('style');\n\n if (slides && slides.length) {\n slides.removeClass([params.slideVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass].join(' ')).removeAttr('style').removeAttr('data-swiper-slide-index');\n }\n }\n\n swiper.emit('destroy'); // Detach emitter events\n\n Object.keys(swiper.eventsListeners).forEach(function (eventName) {\n swiper.off(eventName);\n });\n\n if (deleteInstance !== false) {\n swiper.$el[0].swiper = null;\n deleteProps(swiper);\n }\n\n swiper.destroyed = true;\n return null;\n };\n\n Swiper.extendDefaults = function extendDefaults(newDefaults) {\n extend(extendedDefaults, newDefaults);\n };\n\n Swiper.installModule = function installModule(module) {\n if (!Swiper.prototype.modules) Swiper.prototype.modules = {};\n var name = module.name || Object.keys(Swiper.prototype.modules).length + \"_\" + now();\n Swiper.prototype.modules[name] = module;\n };\n\n Swiper.use = function use(module) {\n if (Array.isArray(module)) {\n module.forEach(function (m) {\n return Swiper.installModule(m);\n });\n return Swiper;\n }\n\n Swiper.installModule(module);\n return Swiper;\n };\n\n _createClass(Swiper, null, [{\n key: \"extendedDefaults\",\n get: function get() {\n return extendedDefaults;\n }\n }, {\n key: \"defaults\",\n get: function get() {\n return defaults;\n }\n }]);\n\n return Swiper;\n}();\n\nObject.keys(prototypes).forEach(function (prototypeGroup) {\n Object.keys(prototypes[prototypeGroup]).forEach(function (protoMethod) {\n Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod];\n });\n});\nSwiper.use([Resize, Observer]);\nexport default Swiper;", "function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nimport $ from '../../utils/dom';\nimport { extend, bindModuleMethods, createElementIfNotDefined } from '../../utils/utils';\nvar Navigation = {\n toggleEl: function toggleEl($el, disabled) {\n $el[disabled ? 'addClass' : 'removeClass'](this.params.navigation.disabledClass);\n if ($el[0] && $el[0].tagName === 'BUTTON') $el[0].disabled = disabled;\n },\n update: function update() {\n // Update Navigation Buttons\n var swiper = this;\n var params = swiper.params.navigation;\n var toggleEl = swiper.navigation.toggleEl;\n if (swiper.params.loop) return;\n var _swiper$navigation = swiper.navigation,\n $nextEl = _swiper$navigation.$nextEl,\n $prevEl = _swiper$navigation.$prevEl;\n\n if ($prevEl && $prevEl.length > 0) {\n if (swiper.isBeginning) {\n toggleEl($prevEl, true);\n } else {\n toggleEl($prevEl, false);\n }\n\n if (swiper.params.watchOverflow && swiper.enabled) {\n $prevEl[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);\n }\n }\n\n if ($nextEl && $nextEl.length > 0) {\n if (swiper.isEnd) {\n toggleEl($nextEl, true);\n } else {\n toggleEl($nextEl, false);\n }\n\n if (swiper.params.watchOverflow && swiper.enabled) {\n $nextEl[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);\n }\n }\n },\n onPrevClick: function onPrevClick(e) {\n var swiper = this;\n e.preventDefault();\n if (swiper.isBeginning && !swiper.params.loop) return;\n swiper.slidePrev();\n },\n onNextClick: function onNextClick(e) {\n var swiper = this;\n e.preventDefault();\n if (swiper.isEnd && !swiper.params.loop) return;\n swiper.slideNext();\n },\n init: function init() {\n var swiper = this;\n var params = swiper.params.navigation;\n swiper.params.navigation = createElementIfNotDefined(swiper.$el, swiper.params.navigation, swiper.params.createElements, {\n nextEl: 'swiper-button-next',\n prevEl: 'swiper-button-prev'\n });\n if (!(params.nextEl || params.prevEl)) return;\n var $nextEl;\n var $prevEl;\n\n if (params.nextEl) {\n $nextEl = $(params.nextEl);\n\n if (swiper.params.uniqueNavElements && typeof params.nextEl === 'string' && $nextEl.length > 1 && swiper.$el.find(params.nextEl).length === 1) {\n $nextEl = swiper.$el.find(params.nextEl);\n }\n }\n\n if (params.prevEl) {\n $prevEl = $(params.prevEl);\n\n if (swiper.params.uniqueNavElements && typeof params.prevEl === 'string' && $prevEl.length > 1 && swiper.$el.find(params.prevEl).length === 1) {\n $prevEl = swiper.$el.find(params.prevEl);\n }\n }\n\n if ($nextEl && $nextEl.length > 0) {\n $nextEl.on('click', swiper.navigation.onNextClick);\n }\n\n if ($prevEl && $prevEl.length > 0) {\n $prevEl.on('click', swiper.navigation.onPrevClick);\n }\n\n extend(swiper.navigation, {\n $nextEl: $nextEl,\n nextEl: $nextEl && $nextEl[0],\n $prevEl: $prevEl,\n prevEl: $prevEl && $prevEl[0]\n });\n\n if (!swiper.enabled) {\n if ($nextEl) $nextEl.addClass(params.lockClass);\n if ($prevEl) $prevEl.addClass(params.lockClass);\n }\n },\n destroy: function destroy() {\n var swiper = this;\n var _swiper$navigation2 = swiper.navigation,\n $nextEl = _swiper$navigation2.$nextEl,\n $prevEl = _swiper$navigation2.$prevEl;\n\n if ($nextEl && $nextEl.length) {\n $nextEl.off('click', swiper.navigation.onNextClick);\n $nextEl.removeClass(swiper.params.navigation.disabledClass);\n }\n\n if ($prevEl && $prevEl.length) {\n $prevEl.off('click', swiper.navigation.onPrevClick);\n $prevEl.removeClass(swiper.params.navigation.disabledClass);\n }\n }\n};\nexport default {\n name: 'navigation',\n params: {\n navigation: {\n nextEl: null,\n prevEl: null,\n hideOnClick: false,\n disabledClass: 'swiper-button-disabled',\n hiddenClass: 'swiper-button-hidden',\n lockClass: 'swiper-button-lock'\n }\n },\n create: function create() {\n var swiper = this;\n bindModuleMethods(swiper, {\n navigation: _extends({}, Navigation)\n });\n },\n on: {\n init: function init(swiper) {\n swiper.navigation.init();\n swiper.navigation.update();\n },\n toEdge: function toEdge(swiper) {\n swiper.navigation.update();\n },\n fromEdge: function fromEdge(swiper) {\n swiper.navigation.update();\n },\n destroy: function destroy(swiper) {\n swiper.navigation.destroy();\n },\n 'enable disable': function enableDisable(swiper) {\n var _swiper$navigation3 = swiper.navigation,\n $nextEl = _swiper$navigation3.$nextEl,\n $prevEl = _swiper$navigation3.$prevEl;\n\n if ($nextEl) {\n $nextEl[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.navigation.lockClass);\n }\n\n if ($prevEl) {\n $prevEl[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.navigation.lockClass);\n }\n },\n click: function click(swiper, e) {\n var _swiper$navigation4 = swiper.navigation,\n $nextEl = _swiper$navigation4.$nextEl,\n $prevEl = _swiper$navigation4.$prevEl;\n var targetEl = e.target;\n\n if (swiper.params.navigation.hideOnClick && !$(targetEl).is($prevEl) && !$(targetEl).is($nextEl)) {\n if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return;\n var isHidden;\n\n if ($nextEl) {\n isHidden = $nextEl.hasClass(swiper.params.navigation.hiddenClass);\n } else if ($prevEl) {\n isHidden = $prevEl.hasClass(swiper.params.navigation.hiddenClass);\n }\n\n if (isHidden === true) {\n swiper.emit('navigationShow');\n } else {\n swiper.emit('navigationHide');\n }\n\n if ($nextEl) {\n $nextEl.toggleClass(swiper.params.navigation.hiddenClass);\n }\n\n if ($prevEl) {\n $prevEl.toggleClass(swiper.params.navigation.hiddenClass);\n }\n }\n }\n }\n};", "function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nimport $ from '../../utils/dom';\nimport { extend, bindModuleMethods, classesToSelector, createElementIfNotDefined } from '../../utils/utils';\nvar Pagination = {\n update: function update() {\n // Render || Update Pagination bullets/items\n var swiper = this;\n var rtl = swiper.rtl;\n var params = swiper.params.pagination;\n if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) return;\n var slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;\n var $el = swiper.pagination.$el; // Current/Total\n\n var current;\n var total = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length;\n\n if (swiper.params.loop) {\n current = Math.ceil((swiper.activeIndex - swiper.loopedSlides) / swiper.params.slidesPerGroup);\n\n if (current > slidesLength - 1 - swiper.loopedSlides * 2) {\n current -= slidesLength - swiper.loopedSlides * 2;\n }\n\n if (current > total - 1) current -= total;\n if (current < 0 && swiper.params.paginationType !== 'bullets') current = total + current;\n } else if (typeof swiper.snapIndex !== 'undefined') {\n current = swiper.snapIndex;\n } else {\n current = swiper.activeIndex || 0;\n } // Types\n\n\n if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) {\n var bullets = swiper.pagination.bullets;\n var firstIndex;\n var lastIndex;\n var midIndex;\n\n if (params.dynamicBullets) {\n swiper.pagination.bulletSize = bullets.eq(0)[swiper.isHorizontal() ? 'outerWidth' : 'outerHeight'](true);\n $el.css(swiper.isHorizontal() ? 'width' : 'height', swiper.pagination.bulletSize * (params.dynamicMainBullets + 4) + \"px\");\n\n if (params.dynamicMainBullets > 1 && swiper.previousIndex !== undefined) {\n swiper.pagination.dynamicBulletIndex += current - swiper.previousIndex;\n\n if (swiper.pagination.dynamicBulletIndex > params.dynamicMainBullets - 1) {\n swiper.pagination.dynamicBulletIndex = params.dynamicMainBullets - 1;\n } else if (swiper.pagination.dynamicBulletIndex < 0) {\n swiper.pagination.dynamicBulletIndex = 0;\n }\n }\n\n firstIndex = current - swiper.pagination.dynamicBulletIndex;\n lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1);\n midIndex = (lastIndex + firstIndex) / 2;\n }\n\n bullets.removeClass(params.bulletActiveClass + \" \" + params.bulletActiveClass + \"-next \" + params.bulletActiveClass + \"-next-next \" + params.bulletActiveClass + \"-prev \" + params.bulletActiveClass + \"-prev-prev \" + params.bulletActiveClass + \"-main\");\n\n if ($el.length > 1) {\n bullets.each(function (bullet) {\n var $bullet = $(bullet);\n var bulletIndex = $bullet.index();\n\n if (bulletIndex === current) {\n $bullet.addClass(params.bulletActiveClass);\n }\n\n if (params.dynamicBullets) {\n if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) {\n $bullet.addClass(params.bulletActiveClass + \"-main\");\n }\n\n if (bulletIndex === firstIndex) {\n $bullet.prev().addClass(params.bulletActiveClass + \"-prev\").prev().addClass(params.bulletActiveClass + \"-prev-prev\");\n }\n\n if (bulletIndex === lastIndex) {\n $bullet.next().addClass(params.bulletActiveClass + \"-next\").next().addClass(params.bulletActiveClass + \"-next-next\");\n }\n }\n });\n } else {\n var $bullet = bullets.eq(current);\n var bulletIndex = $bullet.index();\n $bullet.addClass(params.bulletActiveClass);\n\n if (params.dynamicBullets) {\n var $firstDisplayedBullet = bullets.eq(firstIndex);\n var $lastDisplayedBullet = bullets.eq(lastIndex);\n\n for (var i = firstIndex; i <= lastIndex; i += 1) {\n bullets.eq(i).addClass(params.bulletActiveClass + \"-main\");\n }\n\n if (swiper.params.loop) {\n if (bulletIndex >= bullets.length - params.dynamicMainBullets) {\n for (var _i = params.dynamicMainBullets; _i >= 0; _i -= 1) {\n bullets.eq(bullets.length - _i).addClass(params.bulletActiveClass + \"-main\");\n }\n\n bullets.eq(bullets.length - params.dynamicMainBullets - 1).addClass(params.bulletActiveClass + \"-prev\");\n } else {\n $firstDisplayedBullet.prev().addClass(params.bulletActiveClass + \"-prev\").prev().addClass(params.bulletActiveClass + \"-prev-prev\");\n $lastDisplayedBullet.next().addClass(params.bulletActiveClass + \"-next\").next().addClass(params.bulletActiveClass + \"-next-next\");\n }\n } else {\n $firstDisplayedBullet.prev().addClass(params.bulletActiveClass + \"-prev\").prev().addClass(params.bulletActiveClass + \"-prev-prev\");\n $lastDisplayedBullet.next().addClass(params.bulletActiveClass + \"-next\").next().addClass(params.bulletActiveClass + \"-next-next\");\n }\n }\n }\n\n if (params.dynamicBullets) {\n var dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4);\n var bulletsOffset = (swiper.pagination.bulletSize * dynamicBulletsLength - swiper.pagination.bulletSize) / 2 - midIndex * swiper.pagination.bulletSize;\n var offsetProp = rtl ? 'right' : 'left';\n bullets.css(swiper.isHorizontal() ? offsetProp : 'top', bulletsOffset + \"px\");\n }\n }\n\n if (params.type === 'fraction') {\n $el.find(classesToSelector(params.currentClass)).text(params.formatFractionCurrent(current + 1));\n $el.find(classesToSelector(params.totalClass)).text(params.formatFractionTotal(total));\n }\n\n if (params.type === 'progressbar') {\n var progressbarDirection;\n\n if (params.progressbarOpposite) {\n progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal';\n } else {\n progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical';\n }\n\n var scale = (current + 1) / total;\n var scaleX = 1;\n var scaleY = 1;\n\n if (progressbarDirection === 'horizontal') {\n scaleX = scale;\n } else {\n scaleY = scale;\n }\n\n $el.find(classesToSelector(params.progressbarFillClass)).transform(\"translate3d(0,0,0) scaleX(\" + scaleX + \") scaleY(\" + scaleY + \")\").transition(swiper.params.speed);\n }\n\n if (params.type === 'custom' && params.renderCustom) {\n $el.html(params.renderCustom(swiper, current + 1, total));\n swiper.emit('paginationRender', $el[0]);\n } else {\n swiper.emit('paginationUpdate', $el[0]);\n }\n\n if (swiper.params.watchOverflow && swiper.enabled) {\n $el[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass);\n }\n },\n render: function render() {\n // Render Container\n var swiper = this;\n var params = swiper.params.pagination;\n if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) return;\n var slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;\n var $el = swiper.pagination.$el;\n var paginationHTML = '';\n\n if (params.type === 'bullets') {\n var numberOfBullets = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length;\n\n if (swiper.params.freeMode && !swiper.params.loop && numberOfBullets > slidesLength) {\n numberOfBullets = slidesLength;\n }\n\n for (var i = 0; i < numberOfBullets; i += 1) {\n if (params.renderBullet) {\n paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass);\n } else {\n paginationHTML += \"<\" + params.bulletElement + \" class=\\\"\" + params.bulletClass + \"\\\">\";\n }\n }\n\n $el.html(paginationHTML);\n swiper.pagination.bullets = $el.find(classesToSelector(params.bulletClass));\n }\n\n if (params.type === 'fraction') {\n if (params.renderFraction) {\n paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass);\n } else {\n paginationHTML = \"\" + ' / ' + (\"\");\n }\n\n $el.html(paginationHTML);\n }\n\n if (params.type === 'progressbar') {\n if (params.renderProgressbar) {\n paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass);\n } else {\n paginationHTML = \"\";\n }\n\n $el.html(paginationHTML);\n }\n\n if (params.type !== 'custom') {\n swiper.emit('paginationRender', swiper.pagination.$el[0]);\n }\n },\n init: function init() {\n var swiper = this;\n swiper.params.pagination = createElementIfNotDefined(swiper.$el, swiper.params.pagination, swiper.params.createElements, {\n el: 'swiper-pagination'\n });\n var params = swiper.params.pagination;\n if (!params.el) return;\n var $el = $(params.el);\n if ($el.length === 0) return;\n\n if (swiper.params.uniqueNavElements && typeof params.el === 'string' && $el.length > 1) {\n $el = swiper.$el.find(params.el);\n }\n\n if (params.type === 'bullets' && params.clickable) {\n $el.addClass(params.clickableClass);\n }\n\n $el.addClass(params.modifierClass + params.type);\n\n if (params.type === 'bullets' && params.dynamicBullets) {\n $el.addClass(\"\" + params.modifierClass + params.type + \"-dynamic\");\n swiper.pagination.dynamicBulletIndex = 0;\n\n if (params.dynamicMainBullets < 1) {\n params.dynamicMainBullets = 1;\n }\n }\n\n if (params.type === 'progressbar' && params.progressbarOpposite) {\n $el.addClass(params.progressbarOppositeClass);\n }\n\n if (params.clickable) {\n $el.on('click', classesToSelector(params.bulletClass), function onClick(e) {\n e.preventDefault();\n var index = $(this).index() * swiper.params.slidesPerGroup;\n if (swiper.params.loop) index += swiper.loopedSlides;\n swiper.slideTo(index);\n });\n }\n\n extend(swiper.pagination, {\n $el: $el,\n el: $el[0]\n });\n\n if (!swiper.enabled) {\n $el.addClass(params.lockClass);\n }\n },\n destroy: function destroy() {\n var swiper = this;\n var params = swiper.params.pagination;\n if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) return;\n var $el = swiper.pagination.$el;\n $el.removeClass(params.hiddenClass);\n $el.removeClass(params.modifierClass + params.type);\n if (swiper.pagination.bullets) swiper.pagination.bullets.removeClass(params.bulletActiveClass);\n\n if (params.clickable) {\n $el.off('click', classesToSelector(params.bulletClass));\n }\n }\n};\nexport default {\n name: 'pagination',\n params: {\n pagination: {\n el: null,\n bulletElement: 'span',\n clickable: false,\n hideOnClick: false,\n renderBullet: null,\n renderProgressbar: null,\n renderFraction: null,\n renderCustom: null,\n progressbarOpposite: false,\n type: 'bullets',\n // 'bullets' or 'progressbar' or 'fraction' or 'custom'\n dynamicBullets: false,\n dynamicMainBullets: 1,\n formatFractionCurrent: function formatFractionCurrent(number) {\n return number;\n },\n formatFractionTotal: function formatFractionTotal(number) {\n return number;\n },\n bulletClass: 'swiper-pagination-bullet',\n bulletActiveClass: 'swiper-pagination-bullet-active',\n modifierClass: 'swiper-pagination-',\n // NEW\n currentClass: 'swiper-pagination-current',\n totalClass: 'swiper-pagination-total',\n hiddenClass: 'swiper-pagination-hidden',\n progressbarFillClass: 'swiper-pagination-progressbar-fill',\n progressbarOppositeClass: 'swiper-pagination-progressbar-opposite',\n clickableClass: 'swiper-pagination-clickable',\n // NEW\n lockClass: 'swiper-pagination-lock'\n }\n },\n create: function create() {\n var swiper = this;\n bindModuleMethods(swiper, {\n pagination: _extends({\n dynamicBulletIndex: 0\n }, Pagination)\n });\n },\n on: {\n init: function init(swiper) {\n swiper.pagination.init();\n swiper.pagination.render();\n swiper.pagination.update();\n },\n activeIndexChange: function activeIndexChange(swiper) {\n if (swiper.params.loop) {\n swiper.pagination.update();\n } else if (typeof swiper.snapIndex === 'undefined') {\n swiper.pagination.update();\n }\n },\n snapIndexChange: function snapIndexChange(swiper) {\n if (!swiper.params.loop) {\n swiper.pagination.update();\n }\n },\n slidesLengthChange: function slidesLengthChange(swiper) {\n if (swiper.params.loop) {\n swiper.pagination.render();\n swiper.pagination.update();\n }\n },\n snapGridLengthChange: function snapGridLengthChange(swiper) {\n if (!swiper.params.loop) {\n swiper.pagination.render();\n swiper.pagination.update();\n }\n },\n destroy: function destroy(swiper) {\n swiper.pagination.destroy();\n },\n 'enable disable': function enableDisable(swiper) {\n var $el = swiper.pagination.$el;\n\n if ($el) {\n $el[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.pagination.lockClass);\n }\n },\n click: function click(swiper, e) {\n var targetEl = e.target;\n\n if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && swiper.pagination.$el.length > 0 && !$(targetEl).hasClass(swiper.params.pagination.bulletClass)) {\n if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return;\n var isHidden = swiper.pagination.$el.hasClass(swiper.params.pagination.hiddenClass);\n\n if (isHidden === true) {\n swiper.emit('paginationShow');\n } else {\n swiper.emit('paginationHide');\n }\n\n swiper.pagination.$el.toggleClass(swiper.params.pagination.hiddenClass);\n }\n }\n }\n};", "import { number } from 'jquery';\r\nimport Swiper from 'swiper';\r\nimport SwiperCore, { Navigation, Pagination } from \"swiper/core\";\r\nimport { AxInit, ModuleName } from \"../../Lib/AxSystem/AxInit\";\r\nimport * as basicLightbox from 'basiclightbox';\r\n\r\nSwiperCore.use([Navigation, Pagination]);\r\n\r\n@ModuleName(\"AxProdDetail\")\r\nexport class AxProdDetail implements AxInit {\r\n private Swiper: Swiper;\r\n private Swiper2: Swiper;\r\n private SwiperModal: Swiper;\r\n\r\n AxInit(init: any): void {\r\n const observer = new IntersectionObserver(\r\n ([e]) => {\r\n e.target.toggleAttribute('stuck', e.intersectionRatio < 1)\r\n },\r\n { threshold: [1] }\r\n );\r\n let count: number = init.count;\r\n observer.observe(document.querySelector('.ax-pill_menu'));\r\n observer.observe(document.querySelector('.details__hero-price'));\r\n this.Swiper = new Swiper('.swiper1', {\r\n pagination: {\r\n el: \".swiper-pagination\",\r\n clickable: true\r\n },\r\n breakpoints: {\r\n 576: {\r\n slidesPerView: 'auto', \r\n pagination: {\r\n el: \".swiper-pagination\",\r\n clickable: true\r\n }\r\n },\r\n 120: {\r\n spaceBetween: 0,\r\n pagination: {\r\n el: \".swiper-pagination\",\r\n clickable: true\r\n }\r\n\r\n }\r\n }\r\n });\r\n if (count > 1) {\r\n this.Swiper2 = new Swiper('.swiper2', {\r\n //pagination: {\r\n // el: \".swiper-pagination\",\r\n // clickable: true\r\n //},\r\n breakpoints: {\r\n 768: {\r\n spaceBetween: 20,\r\n slidesPerView: 'auto',\r\n centeredSlides: true,\r\n roundLengths: false,\r\n loop: true,\r\n loopAdditionalSlides: 20,\r\n navigation: {\r\n nextEl: \".swiper-button-next\",\r\n prevEl: \".swiper-button-prev\",\r\n },\r\n pagination: {\r\n el: \".swiper-pagination\",\r\n clickable: true\r\n }\r\n },\r\n 120: {\r\n slidesPerView: 'auto',\r\n centeredSlides: true,\r\n loop: true,\r\n loopAdditionalSlides: 5,\r\n spaceBetween: 0\r\n }\r\n }\r\n\r\n });\r\n } else {\r\n this.Swiper2 = new Swiper('.swiper2', {\r\n breakpoints: {\r\n 768: {\r\n slidesPerView: 'auto',\r\n centeredSlides: true,\r\n roundLengths: false,\r\n navigation: {\r\n nextEl: \".swiper-button-next\",\r\n prevEl: \".swiper-button-prev\",\r\n },\r\n pagination: {\r\n el: \".swiper-pagination\",\r\n clickable: true\r\n }\r\n },\r\n 120: {\r\n spaceBetween: 0,\r\n }\r\n }\r\n\r\n });\r\n }\r\n if (count > 1) {\r\n this.SwiperModal = new Swiper('.swiper-Modal', {\r\n breakpoints: {\r\n 700: {\r\n spaceBetween: 20,\r\n slidesPerView: 'auto',\r\n centeredSlides: true,\r\n roundLengths: false,\r\n loop: true,\r\n loopAdditionalSlides: 20,\r\n navigation: {\r\n nextEl: \".swiper-button-next\",\r\n prevEl: \".swiper-button-prev\",\r\n },\r\n pagination: {\r\n el: \".swiper-pagination\",\r\n clickable: true\r\n }\r\n },\r\n 120: {\r\n slidesPerView: 'auto',\r\n centeredSlides: true,\r\n loop: true,\r\n loopAdditionalSlides: 5,\r\n spaceBetween: 0,\r\n pagination: {\r\n el: \".swiper-pagination\",\r\n clickable: true\r\n }\r\n }\r\n }\r\n });\r\n } else {\r\n this.SwiperModal = new Swiper('.swiper-Modal', {\r\n breakpoints: {\r\n 700: {\r\n slidesPerView: 'auto',\r\n centeredSlides: true,\r\n roundLengths: false,\r\n navigation: {\r\n nextEl: \".swiper-button-next\",\r\n prevEl: \".swiper-button-prev\",\r\n },\r\n pagination: {\r\n el: \".swiper-pagination\",\r\n clickable: true\r\n }\r\n },\r\n 120: {\r\n spaceBetween: 0,\r\n }\r\n }\r\n\r\n });\r\n } \r\n let modalOpenBtn = $('.swiper-vid-expand-btn');\r\n modalOpenBtn.on('click', () => {\r\n $('.swiper-modal').attr('style', '');\r\n });\r\n let mediaPoint = window.matchMedia(\"(max-width: 768px)\");\r\n mediaPoint.addListener(() => changeMediaPoint());\r\n changeMediaPoint();\r\n $(\".ax-scroll-btn\").on('click', () => { topFunction(); });\r\n window.onscroll = function () { scrollFunction() };\r\n setIndex();\r\n this.Swiper2.on('slideChangeTransitionEnd', () => {\r\n setIndex();\r\n }); \r\n function setIndex() {\r\n let contentCount = $('.content-count-span');\r\n let numb: number = +$('.swiper-slide-active').get(1).getAttribute('data-swiper-slide-index') + 1;\r\n contentCount.text(numb + '/' + count);\r\n }\r\n function changeMediaPoint() {\r\n let imageContainer = $('.imageContainer');\r\n let videoContainer = $('.videoContainer');\r\n let imageContainerModal = $('.imageContainer-modal');\r\n let videoContainerModal = $('.videoContainer-modal');\r\n let modal = $('.swiper-modal');\r\n let modalClose = $('.close-vid-modal');\r\n let modalExpand = $('.swiper-vid-expand-btn');\r\n let modalCount = $('.swiper-content-count');\r\n if (!window.matchMedia(\"(max-width: 768px)\").matches) {\r\n modalClose.click((e) => { modal.attr('style', 'display:none;') });\r\n modalExpand.attr('style', 'display:none;');\r\n modalCount.attr('style', 'display:none;');\r\n modal.attr('style', 'display:none;');\r\n if (imageContainer.length > 0) {\r\n imageContainer.each((i, e) => {\r\n $(e).unbind('click');\r\n $(e).click((e) => {\r\n bslContent(e.currentTarget as HTMLElement);\r\n });\r\n });\r\n }\r\n if (videoContainer.length > 0) {\r\n videoContainer.each((i, e) => {\r\n $(e).unbind('click');\r\n $(e).click((e) => {\r\n bslContent(e.currentTarget as HTMLElement);\r\n });\r\n });\r\n }\r\n } else if (window.matchMedia(\"(max-width: 768px)\").matches) {\r\n modalExpand.removeAttr('style');\r\n modalCount.removeAttr('style');\r\n modalClose.click((e) => { modal.attr('style', 'display:none;') });\r\n imageContainerModal.click(e => {\r\n bslContentModal(e.currentTarget as HTMLElement);\r\n });\r\n videoContainerModal.click((e) => {\r\n bslContentModal(e.currentTarget as HTMLElement);\r\n });\r\n\r\n if (imageContainer.length > 0) {\r\n imageContainer.each((i, e) => {\r\n $(e).unbind('click');\r\n $(e).click((e) => {\r\n modal.removeAttr('style');\r\n });\r\n });\r\n }\r\n if (videoContainer.length > 0) {\r\n videoContainer.each((i, e) => {\r\n $(e).unbind('click');\r\n $(e).click((e) => {\r\n modal.removeAttr('style');\r\n });\r\n });\r\n }\r\n }\r\n }\r\n function scrollFunction() {\r\n let scrollBtn = $(\".ax-scroll-btn\").get(0);\r\n if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {\r\n scrollBtn.style.display = \"\";\r\n } else {\r\n scrollBtn.style.display = \"none\";\r\n }\r\n }\r\n function topFunction() {\r\n document.body.scrollTop = 0;\r\n document.documentElement.scrollTop = 0;\r\n }\r\n function bslContentModal(html: HTMLElement) {\r\n let outer = document.createElement('div');\r\n const btnClose = document.createElement('div');\r\n btnClose.setAttribute('class', 'close-vid-btn cursor');\r\n let ele: HTMLMediaElement;\r\n console.log(html);\r\n if (html.hasChildNodes && html.children[0] != null || html.children[0] != undefined) {\r\n ele = html.children[0] as HTMLMediaElement;\r\n html.appendChild(btnClose);\r\n }\r\n else {\r\n ele = html as HTMLMediaElement;\r\n html.appendChild(btnClose);\r\n }\r\n let clonedNode = null;\r\n outer.appendChild(html.cloneNode(true)); \r\n html.removeChild(btnClose);\r\n if (ele.tagName.toLowerCase() == 'video') {\r\n clonedNode = outer.querySelector('video') as HTMLVideoElement;\r\n }\r\n else {\r\n clonedNode = outer.querySelector('img') as HTMLImageElement;\r\n } \r\n \r\n if (clonedNode.tagName.toLowerCase() == 'video') {\r\n if (clonedNode != null) {\r\n clonedNode.classList.remove('vid-shadow');\r\n clonedNode.setAttribute('autoplay', \"\");\r\n clonedNode.setAttribute('muted', \"\"); \r\n }\r\n }\r\n clonedNode.setAttribute(\"style\", \"z-index:9999 !important;\");\r\n const instance = basicLightbox.create(outer.innerHTML, {\r\n onShow: (instance) => {\r\n $(document).keyup(function (e) {\r\n if (e.key == \"Escape\") {\r\n instance.close();\r\n }\r\n });\r\n instance.element().querySelector('.close-vid-btn').onclick = () => instance.close();\r\n if (ele.tagName.toLowerCase() == 'video') {\r\n setupVidControlsModal(instance.element().querySelector('.videoContainer-modal'));\r\n }\r\n },\r\n onClose: (instance) => {\r\n if (clonedNode != null && clonedNode.tagName.toLowerCase() == 'video') {\r\n clonedNode.pause();\r\n clonedNode.remove();\r\n btnClose.remove();\r\n }\r\n outer.remove();\r\n }\r\n });\r\n instance.show();\r\n const bslightbox = $('.basicLightbox');\r\n if (bslightbox != null) {\r\n bslightbox.attr('style', 'z-index:9000 !important;'); \r\n }\r\n if (clonedNode != null) {\r\n clonedNode.removeAttribute('autoplay');\r\n clonedNode.removeAttribute('controls');\r\n clonedNode.removeAttribute('style');\r\n }\r\n }\r\n function bslContent(html: HTMLElement) {\r\n let outer = document.createElement('div');\r\n const btnClose = document.createElement('div');\r\n btnClose.setAttribute('class', 'close-vid-btn cursor');\r\n let ele: HTMLElement;\r\n if ((html.hasChildNodes && html.children[0] != null || html.children[0] != undefined) && html.children[0].tagName.toLowerCase() == 'video') {\r\n ele = html.children[0] as HTMLMediaElement;\r\n html.appendChild(btnClose); \r\n }\r\n else {\r\n ele = html.children[0] as HTMLElement;\r\n html.appendChild(btnClose);\r\n }\r\n let clonedNode= null; \r\n outer.appendChild(html.cloneNode(true)); \r\n html.removeChild(btnClose);\r\n if (ele.tagName.toLowerCase() == 'video') {\r\n clonedNode = outer.querySelector('video') as HTMLVideoElement;\r\n }\r\n else { \r\n clonedNode = outer.querySelector('img') as HTMLElement;\r\n } \r\n let figure = outer.querySelector('figure');\r\n figure.classList.remove('figure-swiper'); \r\n if (clonedNode.tagName.toLowerCase() == 'video') {\r\n if (clonedNode != null) {\r\n clonedNode.classList.remove('vid-shadow'); \r\n figure.classList.add('figure-swiper-lightbox-vid');\r\n clonedNode.setAttribute('autoplay', \"\");\r\n clonedNode.setAttribute('muted', \"\");\r\n clonedNode.classList.remove('vid');\r\n clonedNode.classList.add('vid-lightbox');\r\n clonedNode.classList.add('vid-lightbox');\r\n }\r\n }\r\n if (clonedNode.tagName.toLowerCase() == 'img') {\r\n let imgEle = html.querySelector('img.img-vid') as HTMLElement;\r\n let styleUri = imgEle.style.backgroundImage; \r\n figure.classList.add('figure-swiper-lightbox-img');\r\n clonedNode.classList.remove('img-vid');\r\n clonedNode.style.backgroundImage = styleUri;\r\n }\r\n clonedNode.style.zIndex = '9999 !important';\r\n const instance = basicLightbox.create(outer.innerHTML, {\r\n onShow: (instance) => {\r\n $(document).keyup(function (e) {\r\n if (e.key == \"Escape\") {\r\n instance.close();\r\n }\r\n });\r\n instance.element().querySelector('.close-vid-btn').onclick = () => instance.close();\r\n if (ele.tagName.toLowerCase() == 'video') {\r\n setupVidControls(instance.element().querySelector('.videoContainer'));\r\n }\r\n },\r\n onClose: (instance) => {\r\n if (clonedNode != null && clonedNode.tagName.toLowerCase() == 'video') {\r\n clonedNode.pause();\r\n clonedNode.remove();\r\n btnClose.remove();\r\n }\r\n outer.remove();\r\n }\r\n });\r\n instance.show();\r\n const bslightbox = $('.basicLightbox');\r\n if (bslightbox != null) {\r\n bslightbox.attr('style', 'z-index:9000 !important;');\r\n const placeholder = $('.basicLightbox__placeholder');\r\n if (placeholder != null) {\r\n placeholder.attr('style', ' max-width: 95% !important; transform: scale(.9)!important; ')\r\n }\r\n }\r\n if (clonedNode != null) {\r\n clonedNode.removeAttribute('autoplay');\r\n clonedNode.removeAttribute('controls');\r\n clonedNode.removeAttribute('style');\r\n }\r\n }\r\n function setupVidControlsModal(container: HTMLElement) {\r\n const video = container.querySelector(\".vid-modal\") as unknown as HTMLMediaElement;\r\n const playpauseVidBtn = container.querySelector(\".playpause-vid-btn\") as unknown as HTMLElement;\r\n playpauseVidBtn.setAttribute(\"style\", \"display:none;\");\r\n video.controls = true;\r\n video.preload = 'metadata';\r\n video.addEventListener(\"touchstart\", (e) => {\r\n if (video.paused || video.ended) {\r\n \r\n video.play();\r\n } else {\r\n \r\n video.pause();\r\n }\r\n });\r\n }\r\n function setupVidControls(container: HTMLElement) {\r\n const supportsVideo = !!document.createElement(\"video\").canPlayType;\r\n if (supportsVideo) {\r\n const videoContainer = container as HTMLElement;\r\n videoContainer.removeAttribute(\"display\");\r\n //const video = container.querySelector(\".vid\") as unknown as HTMLMediaElement;\r\n const video = container.querySelector(\".vid-lightbox\") as unknown as HTMLMediaElement;\r\n const videoControls = container.querySelector(\".video-controls\") as unknown as HTMLElement;\r\n const playpauseVidBtn = container.querySelector(\".playpause-vid-btn\") as unknown as HTMLElement;\r\n //videoControls.setAttribute(\"style\", \"display:none;\");\r\n playpauseVidBtn.setAttribute(\"style\", \"display:none;\");\r\n //video.controls = false;\r\n video.controls = true;\r\n video.preload = 'metadata';\r\n //videoControls.style.display = \"flex\";\r\n videoControls.style.display = \"none\";\r\n const playpause = container.querySelector(\".playpause\") as unknown as HTMLElement;\r\n playpause.setAttribute('data-state', 'pause');\r\n const stop = container.querySelector(\".stop\") as unknown as HTMLElement;\r\n const mute = container.querySelector(\".mute\") as unknown as HTMLElement;\r\n const volinc = container.querySelector(\".volinc\") as unknown as HTMLElement;\r\n const voldec = container.querySelector(\".voldec\") as unknown as HTMLElement;\r\n const progress = container.querySelector(\".progress-id\") as unknown as HTMLProgressElement;\r\n const progressBar = container.querySelector(\".progress-bar\") as unknown as HTMLElement;\r\n const fullscreen = container.querySelector(\".fs\") as unknown as HTMLElement;\r\n video.addEventListener(\"touchstart\", (e) => {\r\n if (video.paused || video.ended) {\r\n playpause.setAttribute('data-state', 'pause');\r\n video.play();\r\n } else {\r\n playpause.setAttribute('data-state', 'play');\r\n video.pause();\r\n }\r\n });\r\n playpause.addEventListener(\"click\", (e) => {\r\n if (video.paused || video.ended) {\r\n playpause.setAttribute('data-state', 'pause');\r\n video.play();\r\n } else {\r\n playpause.setAttribute('data-state', 'play');\r\n video.pause();\r\n }\r\n });\r\n stop.addEventListener(\"click\", (e) => {\r\n video.pause();\r\n //video.currentTime = 0;\r\n //progress.value = 0;\r\n });\r\n mute.addEventListener(\"click\", (e) => {\r\n video.muted = !video.muted;\r\n });\r\n volinc.addEventListener(\"click\", (e) => {\r\n alterVolume(\"+\", video, videoContainer);\r\n });\r\n voldec.addEventListener(\"click\", (e) => {\r\n alterVolume(\"-\", video, videoContainer);\r\n });\r\n\r\n video.addEventListener(\"loadedmetadata\", () => {\r\n progress.setAttribute(\"max\", video.duration.toString());\r\n });\r\n video.addEventListener(\"timeupdate\", () => {\r\n progress.value = video.currentTime;\r\n progressBar.style.width = `${Math.floor(\r\n (video.currentTime * 100) / video.duration\r\n )}%`;\r\n });\r\n video.addEventListener(\"timeupdate\", () => {\r\n if (!progress.getAttribute(\"max\"))\r\n progress.setAttribute(\"max\", video.duration.toString());\r\n progress.value = video.currentTime;\r\n progressBar.style.width = `${Math.floor(\r\n (video.currentTime * 100) / video.duration\r\n )}%`;\r\n });\r\n progress.addEventListener(\"click\", (e) => {\r\n const rect = progress.getBoundingClientRect();\r\n const pos = (e.pageX - rect.left) / progress.offsetWidth;\r\n video.currentTime = pos * video.duration;\r\n });\r\n if (!document?.fullscreenEnabled) {\r\n fullscreen.style.display = \"none\";\r\n }\r\n fullscreen.addEventListener(\"click\", (e) => {\r\n handleFullscreen(videoContainer);\r\n });\r\n }\r\n }\r\n function alterVolume(dir: string, video: HTMLMediaElement, videoContainer: HTMLElement) {\r\n const currentVolume = Math.floor(video.volume * 10) / 10;\r\n if (dir === \"+\" && currentVolume < 1) {\r\n video.volume += 0.1;\r\n } else if (dir === \"-\" && currentVolume > 0) {\r\n video.volume -= 0.1;\r\n }\r\n document.addEventListener(\"fullscreenchange\", (e) => {\r\n setFullscreenData(!!document.fullscreenElement, videoContainer);\r\n });\r\n }\r\n function handleFullscreen(videoContainer: HTMLElement) {\r\n if (document.fullscreenElement !== null) {\r\n document.exitFullscreen();\r\n setFullscreenData(false, videoContainer);\r\n } else {\r\n videoContainer.requestFullscreen();\r\n setFullscreenData(true, videoContainer);\r\n }\r\n }\r\n function setFullscreenData(state: boolean, videoContainer: HTMLElement) {\r\n let stateString = state.toString()\r\n videoContainer.setAttribute(\"data-fullscreen\", stateString);\r\n }\r\n }\r\n}\r\n", "/*!\n * Glide.js v3.4.1\n * (c) 2013-2019 J\u0119drzej Cha\u0142ubek (http://jedrzejchalubek.com/)\n * Released under the MIT License.\n */\n\nvar defaults = {\n /**\n * Type of the movement.\n *\n * Available types:\n * `slider` - Rewinds slider to the start/end when it reaches the first or last slide.\n * `carousel` - Changes slides without starting over when it reaches the first or last slide.\n *\n * @type {String}\n */\n type: 'slider',\n\n /**\n * Start at specific slide number defined with zero-based index.\n *\n * @type {Number}\n */\n startAt: 0,\n\n /**\n * A number of slides visible on the single viewport.\n *\n * @type {Number}\n */\n perView: 1,\n\n /**\n * Focus currently active slide at a specified position in the track.\n *\n * Available inputs:\n * `center` - Current slide will be always focused at the center of a track.\n * `0,1,2,3...` - Current slide will be focused on the specified zero-based index.\n *\n * @type {String|Number}\n */\n focusAt: 0,\n\n /**\n * A size of the gap added between slides.\n *\n * @type {Number}\n */\n gap: 10,\n\n /**\n * Change slides after a specified interval. Use `false` for turning off autoplay.\n *\n * @type {Number|Boolean}\n */\n autoplay: false,\n\n /**\n * Stop autoplay on mouseover event.\n *\n * @type {Boolean}\n */\n hoverpause: true,\n\n /**\n * Allow for changing slides with left and right keyboard arrows.\n *\n * @type {Boolean}\n */\n keyboard: true,\n\n /**\n * Stop running `perView` number of slides from the end. Use this\n * option if you don't want to have an empty space after\n * a slider. Works only with `slider` type and a\n * non-centered `focusAt` setting.\n *\n * @type {Boolean}\n */\n bound: false,\n\n /**\n * Minimal swipe distance needed to change the slide. Use `false` for turning off a swiping.\n *\n * @type {Number|Boolean}\n */\n swipeThreshold: 80,\n\n /**\n * Minimal mouse drag distance needed to change the slide. Use `false` for turning off a dragging.\n *\n * @type {Number|Boolean}\n */\n dragThreshold: 120,\n\n /**\n * A maximum number of slides to which movement will be made on swiping or dragging. Use `false` for unlimited.\n *\n * @type {Number|Boolean}\n */\n perTouch: false,\n\n /**\n * Moving distance ratio of the slides on a swiping and dragging.\n *\n * @type {Number}\n */\n touchRatio: 0.5,\n\n /**\n * Angle required to activate slides moving on swiping or dragging.\n *\n * @type {Number}\n */\n touchAngle: 45,\n\n /**\n * Duration of the animation in milliseconds.\n *\n * @type {Number}\n */\n animationDuration: 400,\n\n /**\n * Allows looping the `slider` type. Slider will rewind to the first/last slide when it's at the start/end.\n *\n * @type {Boolean}\n */\n rewind: true,\n\n /**\n * Duration of the rewinding animation of the `slider` type in milliseconds.\n *\n * @type {Number}\n */\n rewindDuration: 800,\n\n /**\n * Easing function for the animation.\n *\n * @type {String}\n */\n animationTimingFunc: 'cubic-bezier(.165, .840, .440, 1)',\n\n /**\n * Throttle costly events at most once per every wait milliseconds.\n *\n * @type {Number}\n */\n throttle: 10,\n\n /**\n * Moving direction mode.\n *\n * Available inputs:\n * - 'ltr' - left to right movement,\n * - 'rtl' - right to left movement.\n *\n * @type {String}\n */\n direction: 'ltr',\n\n /**\n * The distance value of the next and previous viewports which\n * have to peek in the current view. Accepts number and\n * pixels as a string. Left and right peeking can be\n * set up separately with a directions object.\n *\n * For example:\n * `100` - Peek 100px on the both sides.\n * { before: 100, after: 50 }` - Peek 100px on the left side and 50px on the right side.\n *\n * @type {Number|String|Object}\n */\n peek: 0,\n\n /**\n * Collection of options applied at specified media breakpoints.\n * For example: display two slides per view under 800px.\n * `{\n * '800px': {\n * perView: 2\n * }\n * }`\n */\n breakpoints: {},\n\n /**\n * Collection of internally used HTML classes.\n *\n * @todo Refactor `slider` and `carousel` properties to single `type: { slider: '', carousel: '' }` object\n * @type {Object}\n */\n classes: {\n direction: {\n ltr: 'glide--ltr',\n rtl: 'glide--rtl'\n },\n slider: 'glide--slider',\n carousel: 'glide--carousel',\n swipeable: 'glide--swipeable',\n dragging: 'glide--dragging',\n cloneSlide: 'glide__slide--clone',\n activeNav: 'glide__bullet--active',\n activeSlide: 'glide__slide--active',\n disabledArrow: 'glide__arrow--disabled'\n }\n};\n\n/**\n * Outputs warning message to the bowser console.\n *\n * @param {String} msg\n * @return {Void}\n */\nfunction warn(msg) {\n console.error(\"[Glide warn]: \" + msg);\n}\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n return typeof obj;\n} : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n};\n\nvar classCallCheck = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n};\n\nvar createClass = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n}();\n\nvar _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n};\n\nvar get = function get(object, property, receiver) {\n if (object === null) object = Function.prototype;\n var desc = Object.getOwnPropertyDescriptor(object, property);\n\n if (desc === undefined) {\n var parent = Object.getPrototypeOf(object);\n\n if (parent === null) {\n return undefined;\n } else {\n return get(parent, property, receiver);\n }\n } else if (\"value\" in desc) {\n return desc.value;\n } else {\n var getter = desc.get;\n\n if (getter === undefined) {\n return undefined;\n }\n\n return getter.call(receiver);\n }\n};\n\nvar inherits = function (subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass);\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;\n};\n\nvar possibleConstructorReturn = function (self, call) {\n if (!self) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self;\n};\n\n/**\n * Converts value entered as number\n * or string to integer value.\n *\n * @param {String} value\n * @returns {Number}\n */\nfunction toInt(value) {\n return parseInt(value);\n}\n\n/**\n * Converts value entered as number\n * or string to flat value.\n *\n * @param {String} value\n * @returns {Number}\n */\nfunction toFloat(value) {\n return parseFloat(value);\n}\n\n/**\n * Indicates whether the specified value is a string.\n *\n * @param {*} value\n * @return {Boolean}\n */\nfunction isString(value) {\n return typeof value === 'string';\n}\n\n/**\n * Indicates whether the specified value is an object.\n *\n * @param {*} value\n * @return {Boolean}\n *\n * @see https://github.com/jashkenas/underscore\n */\nfunction isObject(value) {\n var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);\n\n return type === 'function' || type === 'object' && !!value; // eslint-disable-line no-mixed-operators\n}\n\n/**\n * Indicates whether the specified value is a number.\n *\n * @param {*} value\n * @return {Boolean}\n */\nfunction isNumber(value) {\n return typeof value === 'number';\n}\n\n/**\n * Indicates whether the specified value is a function.\n *\n * @param {*} value\n * @return {Boolean}\n */\nfunction isFunction(value) {\n return typeof value === 'function';\n}\n\n/**\n * Indicates whether the specified value is undefined.\n *\n * @param {*} value\n * @return {Boolean}\n */\nfunction isUndefined(value) {\n return typeof value === 'undefined';\n}\n\n/**\n * Indicates whether the specified value is an array.\n *\n * @param {*} value\n * @return {Boolean}\n */\nfunction isArray(value) {\n return value.constructor === Array;\n}\n\n/**\n * Creates and initializes specified collection of extensions.\n * Each extension receives access to instance of glide and rest of components.\n *\n * @param {Object} glide\n * @param {Object} extensions\n *\n * @returns {Object}\n */\nfunction mount(glide, extensions, events) {\n var components = {};\n\n for (var name in extensions) {\n if (isFunction(extensions[name])) {\n components[name] = extensions[name](glide, components, events);\n } else {\n warn('Extension must be a function');\n }\n }\n\n for (var _name in components) {\n if (isFunction(components[_name].mount)) {\n components[_name].mount();\n }\n }\n\n return components;\n}\n\n/**\n * Defines getter and setter property on the specified object.\n *\n * @param {Object} obj Object where property has to be defined.\n * @param {String} prop Name of the defined property.\n * @param {Object} definition Get and set definitions for the property.\n * @return {Void}\n */\nfunction define(obj, prop, definition) {\n Object.defineProperty(obj, prop, definition);\n}\n\n/**\n * Sorts aphabetically object keys.\n *\n * @param {Object} obj\n * @return {Object}\n */\nfunction sortKeys(obj) {\n return Object.keys(obj).sort().reduce(function (r, k) {\n r[k] = obj[k];\n\n return r[k], r;\n }, {});\n}\n\n/**\n * Merges passed settings object with default options.\n *\n * @param {Object} defaults\n * @param {Object} settings\n * @return {Object}\n */\nfunction mergeOptions(defaults, settings) {\n var options = _extends({}, defaults, settings);\n\n // `Object.assign` do not deeply merge objects, so we\n // have to do it manually for every nested object\n // in options. Although it does not look smart,\n // it's smaller and faster than some fancy\n // merging deep-merge algorithm script.\n if (settings.hasOwnProperty('classes')) {\n options.classes = _extends({}, defaults.classes, settings.classes);\n\n if (settings.classes.hasOwnProperty('direction')) {\n options.classes.direction = _extends({}, defaults.classes.direction, settings.classes.direction);\n }\n }\n\n if (settings.hasOwnProperty('breakpoints')) {\n options.breakpoints = _extends({}, defaults.breakpoints, settings.breakpoints);\n }\n\n return options;\n}\n\nvar EventsBus = function () {\n /**\n * Construct a EventBus instance.\n *\n * @param {Object} events\n */\n function EventsBus() {\n var events = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n classCallCheck(this, EventsBus);\n\n this.events = events;\n this.hop = events.hasOwnProperty;\n }\n\n /**\n * Adds listener to the specifed event.\n *\n * @param {String|Array} event\n * @param {Function} handler\n */\n\n\n createClass(EventsBus, [{\n key: 'on',\n value: function on(event, handler) {\n if (isArray(event)) {\n for (var i = 0; i < event.length; i++) {\n this.on(event[i], handler);\n }\n }\n\n // Create the event's object if not yet created\n if (!this.hop.call(this.events, event)) {\n this.events[event] = [];\n }\n\n // Add the handler to queue\n var index = this.events[event].push(handler) - 1;\n\n // Provide handle back for removal of event\n return {\n remove: function remove() {\n delete this.events[event][index];\n }\n };\n }\n\n /**\n * Runs registered handlers for specified event.\n *\n * @param {String|Array} event\n * @param {Object=} context\n */\n\n }, {\n key: 'emit',\n value: function emit(event, context) {\n if (isArray(event)) {\n for (var i = 0; i < event.length; i++) {\n this.emit(event[i], context);\n }\n }\n\n // If the event doesn't exist, or there's no handlers in queue, just leave\n if (!this.hop.call(this.events, event)) {\n return;\n }\n\n // Cycle through events queue, fire!\n this.events[event].forEach(function (item) {\n item(context || {});\n });\n }\n }]);\n return EventsBus;\n}();\n\nvar Glide = function () {\n /**\r\n * Construct glide.\r\n *\r\n * @param {String} selector\r\n * @param {Object} options\r\n */\n function Glide(selector) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n classCallCheck(this, Glide);\n\n this._c = {};\n this._t = [];\n this._e = new EventsBus();\n\n this.disabled = false;\n this.selector = selector;\n this.settings = mergeOptions(defaults, options);\n this.index = this.settings.startAt;\n }\n\n /**\r\n * Initializes glide.\r\n *\r\n * @param {Object} extensions Collection of extensions to initialize.\r\n * @return {Glide}\r\n */\n\n\n createClass(Glide, [{\n key: 'mount',\n value: function mount$$1() {\n var extensions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n this._e.emit('mount.before');\n\n if (isObject(extensions)) {\n this._c = mount(this, extensions, this._e);\n } else {\n warn('You need to provide a object on `mount()`');\n }\n\n this._e.emit('mount.after');\n\n return this;\n }\n\n /**\r\n * Collects an instance `translate` transformers.\r\n *\r\n * @param {Array} transformers Collection of transformers.\r\n * @return {Void}\r\n */\n\n }, {\n key: 'mutate',\n value: function mutate() {\n var transformers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n\n if (isArray(transformers)) {\n this._t = transformers;\n } else {\n warn('You need to provide a array on `mutate()`');\n }\n\n return this;\n }\n\n /**\r\n * Updates glide with specified settings.\r\n *\r\n * @param {Object} settings\r\n * @return {Glide}\r\n */\n\n }, {\n key: 'update',\n value: function update() {\n var settings = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n this.settings = mergeOptions(this.settings, settings);\n\n if (settings.hasOwnProperty('startAt')) {\n this.index = settings.startAt;\n }\n\n this._e.emit('update');\n\n return this;\n }\n\n /**\r\n * Change slide with specified pattern. A pattern must be in the special format:\r\n * `>` - Move one forward\r\n * `<` - Move one backward\r\n * `={i}` - Go to {i} zero-based slide (eq. '=1', will go to second slide)\r\n * `>>` - Rewinds to end (last slide)\r\n * `<<` - Rewinds to start (first slide)\r\n *\r\n * @param {String} pattern\r\n * @return {Glide}\r\n */\n\n }, {\n key: 'go',\n value: function go(pattern) {\n this._c.Run.make(pattern);\n\n return this;\n }\n\n /**\r\n * Move track by specified distance.\r\n *\r\n * @param {String} distance\r\n * @return {Glide}\r\n */\n\n }, {\n key: 'move',\n value: function move(distance) {\n this._c.Transition.disable();\n this._c.Move.make(distance);\n\n return this;\n }\n\n /**\r\n * Destroy instance and revert all changes done by this._c.\r\n *\r\n * @return {Glide}\r\n */\n\n }, {\n key: 'destroy',\n value: function destroy() {\n this._e.emit('destroy');\n\n return this;\n }\n\n /**\r\n * Start instance autoplaying.\r\n *\r\n * @param {Boolean|Number} interval Run autoplaying with passed interval regardless of `autoplay` settings\r\n * @return {Glide}\r\n */\n\n }, {\n key: 'play',\n value: function play() {\n var interval = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n if (interval) {\n this.settings.autoplay = interval;\n }\n\n this._e.emit('play');\n\n return this;\n }\n\n /**\r\n * Stop instance autoplaying.\r\n *\r\n * @return {Glide}\r\n */\n\n }, {\n key: 'pause',\n value: function pause() {\n this._e.emit('pause');\n\n return this;\n }\n\n /**\r\n * Sets glide into a idle status.\r\n *\r\n * @return {Glide}\r\n */\n\n }, {\n key: 'disable',\n value: function disable() {\n this.disabled = true;\n\n return this;\n }\n\n /**\r\n * Sets glide into a active status.\r\n *\r\n * @return {Glide}\r\n */\n\n }, {\n key: 'enable',\n value: function enable() {\n this.disabled = false;\n\n return this;\n }\n\n /**\r\n * Adds cuutom event listener with handler.\r\n *\r\n * @param {String|Array} event\r\n * @param {Function} handler\r\n * @return {Glide}\r\n */\n\n }, {\n key: 'on',\n value: function on(event, handler) {\n this._e.on(event, handler);\n\n return this;\n }\n\n /**\r\n * Checks if glide is a precised type.\r\n *\r\n * @param {String} name\r\n * @return {Boolean}\r\n */\n\n }, {\n key: 'isType',\n value: function isType(name) {\n return this.settings.type === name;\n }\n\n /**\r\n * Gets value of the core options.\r\n *\r\n * @return {Object}\r\n */\n\n }, {\n key: 'settings',\n get: function get$$1() {\n return this._o;\n }\n\n /**\r\n * Sets value of the core options.\r\n *\r\n * @param {Object} o\r\n * @return {Void}\r\n */\n ,\n set: function set$$1(o) {\n if (isObject(o)) {\n this._o = o;\n } else {\n warn('Options must be an `object` instance.');\n }\n }\n\n /**\r\n * Gets current index of the slider.\r\n *\r\n * @return {Object}\r\n */\n\n }, {\n key: 'index',\n get: function get$$1() {\n return this._i;\n }\n\n /**\r\n * Sets current index a slider.\r\n *\r\n * @return {Object}\r\n */\n ,\n set: function set$$1(i) {\n this._i = toInt(i);\n }\n\n /**\r\n * Gets type name of the slider.\r\n *\r\n * @return {String}\r\n */\n\n }, {\n key: 'type',\n get: function get$$1() {\n return this.settings.type;\n }\n\n /**\r\n * Gets value of the idle status.\r\n *\r\n * @return {Boolean}\r\n */\n\n }, {\n key: 'disabled',\n get: function get$$1() {\n return this._d;\n }\n\n /**\r\n * Sets value of the idle status.\r\n *\r\n * @return {Boolean}\r\n */\n ,\n set: function set$$1(status) {\n this._d = !!status;\n }\n }]);\n return Glide;\n}();\n\nfunction Run (Glide, Components, Events) {\n var Run = {\n /**\n * Initializes autorunning of the glide.\n *\n * @return {Void}\n */\n mount: function mount() {\n this._o = false;\n },\n\n\n /**\n * Makes glides running based on the passed moving schema.\n *\n * @param {String} move\n */\n make: function make(move) {\n var _this = this;\n\n if (!Glide.disabled) {\n Glide.disable();\n\n this.move = move;\n\n Events.emit('run.before', this.move);\n\n this.calculate();\n\n Events.emit('run', this.move);\n\n Components.Transition.after(function () {\n if (_this.isStart()) {\n Events.emit('run.start', _this.move);\n }\n\n if (_this.isEnd()) {\n Events.emit('run.end', _this.move);\n }\n\n if (_this.isOffset('<') || _this.isOffset('>')) {\n _this._o = false;\n\n Events.emit('run.offset', _this.move);\n }\n\n Events.emit('run.after', _this.move);\n\n Glide.enable();\n });\n }\n },\n\n\n /**\n * Calculates current index based on defined move.\n *\n * @return {Void}\n */\n calculate: function calculate() {\n var move = this.move,\n length = this.length;\n var steps = move.steps,\n direction = move.direction;\n\n\n var countableSteps = isNumber(toInt(steps)) && toInt(steps) !== 0;\n\n switch (direction) {\n case '>':\n if (steps === '>') {\n Glide.index = length;\n } else if (this.isEnd()) {\n if (!(Glide.isType('slider') && !Glide.settings.rewind)) {\n this._o = true;\n\n Glide.index = 0;\n }\n } else if (countableSteps) {\n Glide.index += Math.min(length - Glide.index, -toInt(steps));\n } else {\n Glide.index++;\n }\n break;\n\n case '<':\n if (steps === '<') {\n Glide.index = 0;\n } else if (this.isStart()) {\n if (!(Glide.isType('slider') && !Glide.settings.rewind)) {\n this._o = true;\n\n Glide.index = length;\n }\n } else if (countableSteps) {\n Glide.index -= Math.min(Glide.index, toInt(steps));\n } else {\n Glide.index--;\n }\n break;\n\n case '=':\n Glide.index = steps;\n break;\n\n default:\n warn('Invalid direction pattern [' + direction + steps + '] has been used');\n break;\n }\n },\n\n\n /**\n * Checks if we are on the first slide.\n *\n * @return {Boolean}\n */\n isStart: function isStart() {\n return Glide.index === 0;\n },\n\n\n /**\n * Checks if we are on the last slide.\n *\n * @return {Boolean}\n */\n isEnd: function isEnd() {\n return Glide.index === this.length;\n },\n\n\n /**\n * Checks if we are making a offset run.\n *\n * @param {String} direction\n * @return {Boolean}\n */\n isOffset: function isOffset(direction) {\n return this._o && this.move.direction === direction;\n }\n };\n\n define(Run, 'move', {\n /**\n * Gets value of the move schema.\n *\n * @returns {Object}\n */\n get: function get() {\n return this._m;\n },\n\n\n /**\n * Sets value of the move schema.\n *\n * @returns {Object}\n */\n set: function set(value) {\n var step = value.substr(1);\n\n this._m = {\n direction: value.substr(0, 1),\n steps: step ? toInt(step) ? toInt(step) : step : 0\n };\n }\n });\n\n define(Run, 'length', {\n /**\n * Gets value of the running distance based\n * on zero-indexing number of slides.\n *\n * @return {Number}\n */\n get: function get() {\n var settings = Glide.settings;\n var length = Components.Html.slides.length;\n\n // If the `bound` option is acitve, a maximum running distance should be\n // reduced by `perView` and `focusAt` settings. Running distance\n // should end before creating an empty space after instance.\n\n if (Glide.isType('slider') && settings.focusAt !== 'center' && settings.bound) {\n return length - 1 - (toInt(settings.perView) - 1) + toInt(settings.focusAt);\n }\n\n return length - 1;\n }\n });\n\n define(Run, 'offset', {\n /**\n * Gets status of the offsetting flag.\n *\n * @return {Boolean}\n */\n get: function get() {\n return this._o;\n }\n });\n\n return Run;\n}\n\n/**\n * Returns a current time.\n *\n * @return {Number}\n */\nfunction now() {\n return new Date().getTime();\n}\n\n/**\n * Returns a function, that, when invoked, will only be triggered\n * at most once during a given window of time.\n *\n * @param {Function} func\n * @param {Number} wait\n * @param {Object=} options\n * @return {Function}\n *\n * @see https://github.com/jashkenas/underscore\n */\nfunction throttle(func, wait, options) {\n var timeout = void 0,\n context = void 0,\n args = void 0,\n result = void 0;\n var previous = 0;\n if (!options) options = {};\n\n var later = function later() {\n previous = options.leading === false ? 0 : now();\n timeout = null;\n result = func.apply(context, args);\n if (!timeout) context = args = null;\n };\n\n var throttled = function throttled() {\n var at = now();\n if (!previous && options.leading === false) previous = at;\n var remaining = wait - (at - previous);\n context = this;\n args = arguments;\n if (remaining <= 0 || remaining > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n previous = at;\n result = func.apply(context, args);\n if (!timeout) context = args = null;\n } else if (!timeout && options.trailing !== false) {\n timeout = setTimeout(later, remaining);\n }\n return result;\n };\n\n throttled.cancel = function () {\n clearTimeout(timeout);\n previous = 0;\n timeout = context = args = null;\n };\n\n return throttled;\n}\n\nvar MARGIN_TYPE = {\n ltr: ['marginLeft', 'marginRight'],\n rtl: ['marginRight', 'marginLeft']\n};\n\nfunction Gaps (Glide, Components, Events) {\n var Gaps = {\n /**\n * Applies gaps between slides. First and last\n * slides do not receive it's edge margins.\n *\n * @param {HTMLCollection} slides\n * @return {Void}\n */\n apply: function apply(slides) {\n for (var i = 0, len = slides.length; i < len; i++) {\n var style = slides[i].style;\n var direction = Components.Direction.value;\n\n if (i !== 0) {\n style[MARGIN_TYPE[direction][0]] = this.value / 2 + 'px';\n } else {\n style[MARGIN_TYPE[direction][0]] = '';\n }\n\n if (i !== slides.length - 1) {\n style[MARGIN_TYPE[direction][1]] = this.value / 2 + 'px';\n } else {\n style[MARGIN_TYPE[direction][1]] = '';\n }\n }\n },\n\n\n /**\n * Removes gaps from the slides.\n *\n * @param {HTMLCollection} slides\n * @returns {Void}\n */\n remove: function remove(slides) {\n for (var i = 0, len = slides.length; i < len; i++) {\n var style = slides[i].style;\n\n style.marginLeft = '';\n style.marginRight = '';\n }\n }\n };\n\n define(Gaps, 'value', {\n /**\n * Gets value of the gap.\n *\n * @returns {Number}\n */\n get: function get() {\n return toInt(Glide.settings.gap);\n }\n });\n\n define(Gaps, 'grow', {\n /**\n * Gets additional dimentions value caused by gaps.\n * Used to increase width of the slides wrapper.\n *\n * @returns {Number}\n */\n get: function get() {\n return Gaps.value * (Components.Sizes.length - 1);\n }\n });\n\n define(Gaps, 'reductor', {\n /**\n * Gets reduction value caused by gaps.\n * Used to subtract width of the slides.\n *\n * @returns {Number}\n */\n get: function get() {\n var perView = Glide.settings.perView;\n\n return Gaps.value * (perView - 1) / perView;\n }\n });\n\n /**\n * Apply calculated gaps:\n * - after building, so slides (including clones) will receive proper margins\n * - on updating via API, to recalculate gaps with new options\n */\n Events.on(['build.after', 'update'], throttle(function () {\n Gaps.apply(Components.Html.wrapper.children);\n }, 30));\n\n /**\n * Remove gaps:\n * - on destroying to bring markup to its inital state\n */\n Events.on('destroy', function () {\n Gaps.remove(Components.Html.wrapper.children);\n });\n\n return Gaps;\n}\n\n/**\n * Finds siblings nodes of the passed node.\n *\n * @param {Element} node\n * @return {Array}\n */\nfunction siblings(node) {\n if (node && node.parentNode) {\n var n = node.parentNode.firstChild;\n var matched = [];\n\n for (; n; n = n.nextSibling) {\n if (n.nodeType === 1 && n !== node) {\n matched.push(n);\n }\n }\n\n return matched;\n }\n\n return [];\n}\n\n/**\n * Checks if passed node exist and is a valid element.\n *\n * @param {Element} node\n * @return {Boolean}\n */\nfunction exist(node) {\n if (node && node instanceof window.HTMLElement) {\n return true;\n }\n\n return false;\n}\n\nvar TRACK_SELECTOR = '[data-glide-el=\"track\"]';\n\nfunction Html (Glide, Components) {\n var Html = {\n /**\n * Setup slider HTML nodes.\n *\n * @param {Glide} glide\n */\n mount: function mount() {\n this.root = Glide.selector;\n this.track = this.root.querySelector(TRACK_SELECTOR);\n this.slides = Array.prototype.slice.call(this.wrapper.children).filter(function (slide) {\n return !slide.classList.contains(Glide.settings.classes.cloneSlide);\n });\n }\n };\n\n define(Html, 'root', {\n /**\n * Gets node of the glide main element.\n *\n * @return {Object}\n */\n get: function get() {\n return Html._r;\n },\n\n\n /**\n * Sets node of the glide main element.\n *\n * @return {Object}\n */\n set: function set(r) {\n if (isString(r)) {\n r = document.querySelector(r);\n }\n\n if (exist(r)) {\n Html._r = r;\n } else {\n warn('Root element must be a existing Html node');\n }\n }\n });\n\n define(Html, 'track', {\n /**\n * Gets node of the glide track with slides.\n *\n * @return {Object}\n */\n get: function get() {\n return Html._t;\n },\n\n\n /**\n * Sets node of the glide track with slides.\n *\n * @return {Object}\n */\n set: function set(t) {\n if (exist(t)) {\n Html._t = t;\n } else {\n warn('Could not find track element. Please use ' + TRACK_SELECTOR + ' attribute.');\n }\n }\n });\n\n define(Html, 'wrapper', {\n /**\n * Gets node of the slides wrapper.\n *\n * @return {Object}\n */\n get: function get() {\n return Html.track.children[0];\n }\n });\n\n return Html;\n}\n\nfunction Peek (Glide, Components, Events) {\n var Peek = {\n /**\n * Setups how much to peek based on settings.\n *\n * @return {Void}\n */\n mount: function mount() {\n this.value = Glide.settings.peek;\n }\n };\n\n define(Peek, 'value', {\n /**\n * Gets value of the peek.\n *\n * @returns {Number|Object}\n */\n get: function get() {\n return Peek._v;\n },\n\n\n /**\n * Sets value of the peek.\n *\n * @param {Number|Object} value\n * @return {Void}\n */\n set: function set(value) {\n if (isObject(value)) {\n value.before = toInt(value.before);\n value.after = toInt(value.after);\n } else {\n value = toInt(value);\n }\n\n Peek._v = value;\n }\n });\n\n define(Peek, 'reductor', {\n /**\n * Gets reduction value caused by peek.\n *\n * @returns {Number}\n */\n get: function get() {\n var value = Peek.value;\n var perView = Glide.settings.perView;\n\n if (isObject(value)) {\n return value.before / perView + value.after / perView;\n }\n\n return value * 2 / perView;\n }\n });\n\n /**\n * Recalculate peeking sizes on:\n * - when resizing window to update to proper percents\n */\n Events.on(['resize', 'update'], function () {\n Peek.mount();\n });\n\n return Peek;\n}\n\nfunction Move (Glide, Components, Events) {\n var Move = {\n /**\n * Constructs move component.\n *\n * @returns {Void}\n */\n mount: function mount() {\n this._o = 0;\n },\n\n\n /**\n * Calculates a movement value based on passed offset and currently active index.\n *\n * @param {Number} offset\n * @return {Void}\n */\n make: function make() {\n var _this = this;\n\n var offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n\n this.offset = offset;\n\n Events.emit('move', {\n movement: this.value\n });\n\n Components.Transition.after(function () {\n Events.emit('move.after', {\n movement: _this.value\n });\n });\n }\n };\n\n define(Move, 'offset', {\n /**\n * Gets an offset value used to modify current translate.\n *\n * @return {Object}\n */\n get: function get() {\n return Move._o;\n },\n\n\n /**\n * Sets an offset value used to modify current translate.\n *\n * @return {Object}\n */\n set: function set(value) {\n Move._o = !isUndefined(value) ? toInt(value) : 0;\n }\n });\n\n define(Move, 'translate', {\n /**\n * Gets a raw movement value.\n *\n * @return {Number}\n */\n get: function get() {\n return Components.Sizes.slideWidth * Glide.index;\n }\n });\n\n define(Move, 'value', {\n /**\n * Gets an actual movement value corrected by offset.\n *\n * @return {Number}\n */\n get: function get() {\n var offset = this.offset;\n var translate = this.translate;\n\n if (Components.Direction.is('rtl')) {\n return translate + offset;\n }\n\n return translate - offset;\n }\n });\n\n /**\n * Make movement to proper slide on:\n * - before build, so glide will start at `startAt` index\n * - on each standard run to move to newly calculated index\n */\n Events.on(['build.before', 'run'], function () {\n Move.make();\n });\n\n return Move;\n}\n\nfunction Sizes (Glide, Components, Events) {\n var Sizes = {\n /**\n * Setups dimentions of slides.\n *\n * @return {Void}\n */\n setupSlides: function setupSlides() {\n var width = this.slideWidth + 'px';\n var slides = Components.Html.slides;\n\n for (var i = 0; i < slides.length; i++) {\n slides[i].style.width = width;\n }\n },\n\n\n /**\n * Setups dimentions of slides wrapper.\n *\n * @return {Void}\n */\n setupWrapper: function setupWrapper(dimention) {\n Components.Html.wrapper.style.width = this.wrapperSize + 'px';\n },\n\n\n /**\n * Removes applied styles from HTML elements.\n *\n * @returns {Void}\n */\n remove: function remove() {\n var slides = Components.Html.slides;\n\n for (var i = 0; i < slides.length; i++) {\n slides[i].style.width = '';\n }\n\n Components.Html.wrapper.style.width = '';\n }\n };\n\n define(Sizes, 'length', {\n /**\n * Gets count number of the slides.\n *\n * @return {Number}\n */\n get: function get() {\n return Components.Html.slides.length;\n }\n });\n\n define(Sizes, 'width', {\n /**\n * Gets width value of the glide.\n *\n * @return {Number}\n */\n get: function get() {\n return Components.Html.root.offsetWidth;\n }\n });\n\n define(Sizes, 'wrapperSize', {\n /**\n * Gets size of the slides wrapper.\n *\n * @return {Number}\n */\n get: function get() {\n return Sizes.slideWidth * Sizes.length + Components.Gaps.grow + Components.Clones.grow;\n }\n });\n\n define(Sizes, 'slideWidth', {\n /**\n * Gets width value of the single slide.\n *\n * @return {Number}\n */\n get: function get() {\n return Sizes.width / Glide.settings.perView - Components.Peek.reductor - Components.Gaps.reductor;\n }\n });\n\n /**\n * Apply calculated glide's dimensions:\n * - before building, so other dimentions (e.g. translate) will be calculated propertly\n * - when resizing window to recalculate sildes dimensions\n * - on updating via API, to calculate dimensions based on new options\n */\n Events.on(['build.before', 'resize', 'update'], function () {\n Sizes.setupSlides();\n Sizes.setupWrapper();\n });\n\n /**\n * Remove calculated glide's dimensions:\n * - on destoting to bring markup to its inital state\n */\n Events.on('destroy', function () {\n Sizes.remove();\n });\n\n return Sizes;\n}\n\nfunction Build (Glide, Components, Events) {\n var Build = {\n /**\n * Init glide building. Adds classes, sets\n * dimensions and setups initial state.\n *\n * @return {Void}\n */\n mount: function mount() {\n Events.emit('build.before');\n\n this.typeClass();\n this.activeClass();\n\n Events.emit('build.after');\n },\n\n\n /**\n * Adds `type` class to the glide element.\n *\n * @return {Void}\n */\n typeClass: function typeClass() {\n Components.Html.root.classList.add(Glide.settings.classes[Glide.settings.type]);\n },\n\n\n /**\n * Sets active class to current slide.\n *\n * @return {Void}\n */\n activeClass: function activeClass() {\n var classes = Glide.settings.classes;\n var slide = Components.Html.slides[Glide.index];\n\n if (slide) {\n slide.classList.add(classes.activeSlide);\n\n siblings(slide).forEach(function (sibling) {\n sibling.classList.remove(classes.activeSlide);\n });\n }\n },\n\n\n /**\n * Removes HTML classes applied at building.\n *\n * @return {Void}\n */\n removeClasses: function removeClasses() {\n var classes = Glide.settings.classes;\n\n Components.Html.root.classList.remove(classes[Glide.settings.type]);\n\n Components.Html.slides.forEach(function (sibling) {\n sibling.classList.remove(classes.activeSlide);\n });\n }\n };\n\n /**\n * Clear building classes:\n * - on destroying to bring HTML to its initial state\n * - on updating to remove classes before remounting component\n */\n Events.on(['destroy', 'update'], function () {\n Build.removeClasses();\n });\n\n /**\n * Remount component:\n * - on resizing of the window to calculate new dimentions\n * - on updating settings via API\n */\n Events.on(['resize', 'update'], function () {\n Build.mount();\n });\n\n /**\n * Swap active class of current slide:\n * - after each move to the new index\n */\n Events.on('move.after', function () {\n Build.activeClass();\n });\n\n return Build;\n}\n\nfunction Clones (Glide, Components, Events) {\n var Clones = {\n /**\n * Create pattern map and collect slides to be cloned.\n */\n mount: function mount() {\n this.items = [];\n\n if (Glide.isType('carousel')) {\n this.items = this.collect();\n }\n },\n\n\n /**\n * Collect clones with pattern.\n *\n * @return {Void}\n */\n collect: function collect() {\n var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var slides = Components.Html.slides;\n var _Glide$settings = Glide.settings,\n perView = _Glide$settings.perView,\n classes = _Glide$settings.classes;\n\n\n var peekIncrementer = +!!Glide.settings.peek;\n var part = perView + peekIncrementer;\n var start = slides.slice(0, part);\n var end = slides.slice(-part);\n\n for (var r = 0; r < Math.max(1, Math.floor(perView / slides.length)); r++) {\n for (var i = 0; i < start.length; i++) {\n var clone = start[i].cloneNode(true);\n\n clone.classList.add(classes.cloneSlide);\n\n items.push(clone);\n }\n\n for (var _i = 0; _i < end.length; _i++) {\n var _clone = end[_i].cloneNode(true);\n\n _clone.classList.add(classes.cloneSlide);\n\n items.unshift(_clone);\n }\n }\n\n return items;\n },\n\n\n /**\n * Append cloned slides with generated pattern.\n *\n * @return {Void}\n */\n append: function append() {\n var items = this.items;\n var _Components$Html = Components.Html,\n wrapper = _Components$Html.wrapper,\n slides = _Components$Html.slides;\n\n\n var half = Math.floor(items.length / 2);\n var prepend = items.slice(0, half).reverse();\n var append = items.slice(half, items.length);\n var width = Components.Sizes.slideWidth + 'px';\n\n for (var i = 0; i < append.length; i++) {\n wrapper.appendChild(append[i]);\n }\n\n for (var _i2 = 0; _i2 < prepend.length; _i2++) {\n wrapper.insertBefore(prepend[_i2], slides[0]);\n }\n\n for (var _i3 = 0; _i3 < items.length; _i3++) {\n items[_i3].style.width = width;\n }\n },\n\n\n /**\n * Remove all cloned slides.\n *\n * @return {Void}\n */\n remove: function remove() {\n var items = this.items;\n\n\n for (var i = 0; i < items.length; i++) {\n Components.Html.wrapper.removeChild(items[i]);\n }\n }\n };\n\n define(Clones, 'grow', {\n /**\n * Gets additional dimentions value caused by clones.\n *\n * @return {Number}\n */\n get: function get() {\n return (Components.Sizes.slideWidth + Components.Gaps.value) * Clones.items.length;\n }\n });\n\n /**\n * Append additional slide's clones:\n * - while glide's type is `carousel`\n */\n Events.on('update', function () {\n Clones.remove();\n Clones.mount();\n Clones.append();\n });\n\n /**\n * Append additional slide's clones:\n * - while glide's type is `carousel`\n */\n Events.on('build.before', function () {\n if (Glide.isType('carousel')) {\n Clones.append();\n }\n });\n\n /**\n * Remove clones HTMLElements:\n * - on destroying, to bring HTML to its initial state\n */\n Events.on('destroy', function () {\n Clones.remove();\n });\n\n return Clones;\n}\n\nvar EventsBinder = function () {\n /**\n * Construct a EventsBinder instance.\n */\n function EventsBinder() {\n var listeners = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n classCallCheck(this, EventsBinder);\n\n this.listeners = listeners;\n }\n\n /**\n * Adds events listeners to arrows HTML elements.\n *\n * @param {String|Array} events\n * @param {Element|Window|Document} el\n * @param {Function} closure\n * @param {Boolean|Object} capture\n * @return {Void}\n */\n\n\n createClass(EventsBinder, [{\n key: 'on',\n value: function on(events, el, closure) {\n var capture = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n\n if (isString(events)) {\n events = [events];\n }\n\n for (var i = 0; i < events.length; i++) {\n this.listeners[events[i]] = closure;\n\n el.addEventListener(events[i], this.listeners[events[i]], capture);\n }\n }\n\n /**\n * Removes event listeners from arrows HTML elements.\n *\n * @param {String|Array} events\n * @param {Element|Window|Document} el\n * @param {Boolean|Object} capture\n * @return {Void}\n */\n\n }, {\n key: 'off',\n value: function off(events, el) {\n var capture = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n if (isString(events)) {\n events = [events];\n }\n\n for (var i = 0; i < events.length; i++) {\n el.removeEventListener(events[i], this.listeners[events[i]], capture);\n }\n }\n\n /**\n * Destroy collected listeners.\n *\n * @returns {Void}\n */\n\n }, {\n key: 'destroy',\n value: function destroy() {\n delete this.listeners;\n }\n }]);\n return EventsBinder;\n}();\n\nfunction Resize (Glide, Components, Events) {\n /**\n * Instance of the binder for DOM Events.\n *\n * @type {EventsBinder}\n */\n var Binder = new EventsBinder();\n\n var Resize = {\n /**\n * Initializes window bindings.\n */\n mount: function mount() {\n this.bind();\n },\n\n\n /**\n * Binds `rezsize` listener to the window.\n * It's a costly event, so we are debouncing it.\n *\n * @return {Void}\n */\n bind: function bind() {\n Binder.on('resize', window, throttle(function () {\n Events.emit('resize');\n }, Glide.settings.throttle));\n },\n\n\n /**\n * Unbinds listeners from the window.\n *\n * @return {Void}\n */\n unbind: function unbind() {\n Binder.off('resize', window);\n }\n };\n\n /**\n * Remove bindings from window:\n * - on destroying, to remove added EventListener\n */\n Events.on('destroy', function () {\n Resize.unbind();\n Binder.destroy();\n });\n\n return Resize;\n}\n\nvar VALID_DIRECTIONS = ['ltr', 'rtl'];\nvar FLIPED_MOVEMENTS = {\n '>': '<',\n '<': '>',\n '=': '='\n};\n\nfunction Direction (Glide, Components, Events) {\n var Direction = {\n /**\n * Setups gap value based on settings.\n *\n * @return {Void}\n */\n mount: function mount() {\n this.value = Glide.settings.direction;\n },\n\n\n /**\n * Resolves pattern based on direction value\n *\n * @param {String} pattern\n * @returns {String}\n */\n resolve: function resolve(pattern) {\n var token = pattern.slice(0, 1);\n\n if (this.is('rtl')) {\n return pattern.split(token).join(FLIPED_MOVEMENTS[token]);\n }\n\n return pattern;\n },\n\n\n /**\n * Checks value of direction mode.\n *\n * @param {String} direction\n * @returns {Boolean}\n */\n is: function is(direction) {\n return this.value === direction;\n },\n\n\n /**\n * Applies direction class to the root HTML element.\n *\n * @return {Void}\n */\n addClass: function addClass() {\n Components.Html.root.classList.add(Glide.settings.classes.direction[this.value]);\n },\n\n\n /**\n * Removes direction class from the root HTML element.\n *\n * @return {Void}\n */\n removeClass: function removeClass() {\n Components.Html.root.classList.remove(Glide.settings.classes.direction[this.value]);\n }\n };\n\n define(Direction, 'value', {\n /**\n * Gets value of the direction.\n *\n * @returns {Number}\n */\n get: function get() {\n return Direction._v;\n },\n\n\n /**\n * Sets value of the direction.\n *\n * @param {String} value\n * @return {Void}\n */\n set: function set(value) {\n if (VALID_DIRECTIONS.indexOf(value) > -1) {\n Direction._v = value;\n } else {\n warn('Direction value must be `ltr` or `rtl`');\n }\n }\n });\n\n /**\n * Clear direction class:\n * - on destroy to bring HTML to its initial state\n * - on update to remove class before reappling bellow\n */\n Events.on(['destroy', 'update'], function () {\n Direction.removeClass();\n });\n\n /**\n * Remount component:\n * - on update to reflect changes in direction value\n */\n Events.on('update', function () {\n Direction.mount();\n });\n\n /**\n * Apply direction class:\n * - before building to apply class for the first time\n * - on updating to reapply direction class that may changed\n */\n Events.on(['build.before', 'update'], function () {\n Direction.addClass();\n });\n\n return Direction;\n}\n\n/**\n * Reflects value of glide movement.\n *\n * @param {Object} Glide\n * @param {Object} Components\n * @return {Object}\n */\nfunction Rtl (Glide, Components) {\n return {\n /**\n * Negates the passed translate if glide is in RTL option.\n *\n * @param {Number} translate\n * @return {Number}\n */\n modify: function modify(translate) {\n if (Components.Direction.is('rtl')) {\n return -translate;\n }\n\n return translate;\n }\n };\n}\n\n/**\n * Updates glide movement with a `gap` settings.\n *\n * @param {Object} Glide\n * @param {Object} Components\n * @return {Object}\n */\nfunction Gap (Glide, Components) {\n return {\n /**\n * Modifies passed translate value with number in the `gap` settings.\n *\n * @param {Number} translate\n * @return {Number}\n */\n modify: function modify(translate) {\n return translate + Components.Gaps.value * Glide.index;\n }\n };\n}\n\n/**\n * Updates glide movement with width of additional clones width.\n *\n * @param {Object} Glide\n * @param {Object} Components\n * @return {Object}\n */\nfunction Grow (Glide, Components) {\n return {\n /**\n * Adds to the passed translate width of the half of clones.\n *\n * @param {Number} translate\n * @return {Number}\n */\n modify: function modify(translate) {\n return translate + Components.Clones.grow / 2;\n }\n };\n}\n\n/**\n * Updates glide movement with a `peek` settings.\n *\n * @param {Object} Glide\n * @param {Object} Components\n * @return {Object}\n */\nfunction Peeking (Glide, Components) {\n return {\n /**\n * Modifies passed translate value with a `peek` setting.\n *\n * @param {Number} translate\n * @return {Number}\n */\n modify: function modify(translate) {\n if (Glide.settings.focusAt >= 0) {\n var peek = Components.Peek.value;\n\n if (isObject(peek)) {\n return translate - peek.before;\n }\n\n return translate - peek;\n }\n\n return translate;\n }\n };\n}\n\n/**\n * Updates glide movement with a `focusAt` settings.\n *\n * @param {Object} Glide\n * @param {Object} Components\n * @return {Object}\n */\nfunction Focusing (Glide, Components) {\n return {\n /**\n * Modifies passed translate value with index in the `focusAt` setting.\n *\n * @param {Number} translate\n * @return {Number}\n */\n modify: function modify(translate) {\n var gap = Components.Gaps.value;\n var width = Components.Sizes.width;\n var focusAt = Glide.settings.focusAt;\n var slideWidth = Components.Sizes.slideWidth;\n\n if (focusAt === 'center') {\n return translate - (width / 2 - slideWidth / 2);\n }\n\n return translate - slideWidth * focusAt - gap * focusAt;\n }\n };\n}\n\n/**\n * Applies diffrent transformers on translate value.\n *\n * @param {Object} Glide\n * @param {Object} Components\n * @return {Object}\n */\nfunction mutator (Glide, Components, Events) {\n /**\n * Merge instance transformers with collection of default transformers.\n * It's important that the Rtl component be last on the list,\n * so it reflects all previous transformations.\n *\n * @type {Array}\n */\n var TRANSFORMERS = [Gap, Grow, Peeking, Focusing].concat(Glide._t, [Rtl]);\n\n return {\n /**\n * Piplines translate value with registered transformers.\n *\n * @param {Number} translate\n * @return {Number}\n */\n mutate: function mutate(translate) {\n for (var i = 0; i < TRANSFORMERS.length; i++) {\n var transformer = TRANSFORMERS[i];\n\n if (isFunction(transformer) && isFunction(transformer().modify)) {\n translate = transformer(Glide, Components, Events).modify(translate);\n } else {\n warn('Transformer should be a function that returns an object with `modify()` method');\n }\n }\n\n return translate;\n }\n };\n}\n\nfunction Translate (Glide, Components, Events) {\n var Translate = {\n /**\n * Sets value of translate on HTML element.\n *\n * @param {Number} value\n * @return {Void}\n */\n set: function set(value) {\n var transform = mutator(Glide, Components).mutate(value);\n\n Components.Html.wrapper.style.transform = 'translate3d(' + -1 * transform + 'px, 0px, 0px)';\n },\n\n\n /**\n * Removes value of translate from HTML element.\n *\n * @return {Void}\n */\n remove: function remove() {\n Components.Html.wrapper.style.transform = '';\n }\n };\n\n /**\n * Set new translate value:\n * - on move to reflect index change\n * - on updating via API to reflect possible changes in options\n */\n Events.on('move', function (context) {\n var gap = Components.Gaps.value;\n var length = Components.Sizes.length;\n var width = Components.Sizes.slideWidth;\n\n if (Glide.isType('carousel') && Components.Run.isOffset('<')) {\n Components.Transition.after(function () {\n Events.emit('translate.jump');\n\n Translate.set(width * (length - 1));\n });\n\n return Translate.set(-width - gap * length);\n }\n\n if (Glide.isType('carousel') && Components.Run.isOffset('>')) {\n Components.Transition.after(function () {\n Events.emit('translate.jump');\n\n Translate.set(0);\n });\n\n return Translate.set(width * length + gap * length);\n }\n\n return Translate.set(context.movement);\n });\n\n /**\n * Remove translate:\n * - on destroying to bring markup to its inital state\n */\n Events.on('destroy', function () {\n Translate.remove();\n });\n\n return Translate;\n}\n\nfunction Transition (Glide, Components, Events) {\n /**\n * Holds inactivity status of transition.\n * When true transition is not applied.\n *\n * @type {Boolean}\n */\n var disabled = false;\n\n var Transition = {\n /**\n * Composes string of the CSS transition.\n *\n * @param {String} property\n * @return {String}\n */\n compose: function compose(property) {\n var settings = Glide.settings;\n\n if (!disabled) {\n return property + ' ' + this.duration + 'ms ' + settings.animationTimingFunc;\n }\n\n return property + ' 0ms ' + settings.animationTimingFunc;\n },\n\n\n /**\n * Sets value of transition on HTML element.\n *\n * @param {String=} property\n * @return {Void}\n */\n set: function set() {\n var property = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transform';\n\n Components.Html.wrapper.style.transition = this.compose(property);\n },\n\n\n /**\n * Removes value of transition from HTML element.\n *\n * @return {Void}\n */\n remove: function remove() {\n Components.Html.wrapper.style.transition = '';\n },\n\n\n /**\n * Runs callback after animation.\n *\n * @param {Function} callback\n * @return {Void}\n */\n after: function after(callback) {\n setTimeout(function () {\n callback();\n }, this.duration);\n },\n\n\n /**\n * Enable transition.\n *\n * @return {Void}\n */\n enable: function enable() {\n disabled = false;\n\n this.set();\n },\n\n\n /**\n * Disable transition.\n *\n * @return {Void}\n */\n disable: function disable() {\n disabled = true;\n\n this.set();\n }\n };\n\n define(Transition, 'duration', {\n /**\n * Gets duration of the transition based\n * on currently running animation type.\n *\n * @return {Number}\n */\n get: function get() {\n var settings = Glide.settings;\n\n if (Glide.isType('slider') && Components.Run.offset) {\n return settings.rewindDuration;\n }\n\n return settings.animationDuration;\n }\n });\n\n /**\n * Set transition `style` value:\n * - on each moving, because it may be cleared by offset move\n */\n Events.on('move', function () {\n Transition.set();\n });\n\n /**\n * Disable transition:\n * - before initial build to avoid transitioning from `0` to `startAt` index\n * - while resizing window and recalculating dimentions\n * - on jumping from offset transition at start and end edges in `carousel` type\n */\n Events.on(['build.before', 'resize', 'translate.jump'], function () {\n Transition.disable();\n });\n\n /**\n * Enable transition:\n * - on each running, because it may be disabled by offset move\n */\n Events.on('run', function () {\n Transition.enable();\n });\n\n /**\n * Remove transition:\n * - on destroying to bring markup to its inital state\n */\n Events.on('destroy', function () {\n Transition.remove();\n });\n\n return Transition;\n}\n\n/**\n * Test via a getter in the options object to see\n * if the passive property is accessed.\n *\n * @see https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection\n */\n\nvar supportsPassive = false;\n\ntry {\n var opts = Object.defineProperty({}, 'passive', {\n get: function get() {\n supportsPassive = true;\n }\n });\n\n window.addEventListener('testPassive', null, opts);\n window.removeEventListener('testPassive', null, opts);\n} catch (e) {}\n\nvar supportsPassive$1 = supportsPassive;\n\nvar START_EVENTS = ['touchstart', 'mousedown'];\nvar MOVE_EVENTS = ['touchmove', 'mousemove'];\nvar END_EVENTS = ['touchend', 'touchcancel', 'mouseup', 'mouseleave'];\nvar MOUSE_EVENTS = ['mousedown', 'mousemove', 'mouseup', 'mouseleave'];\n\nfunction Swipe (Glide, Components, Events) {\n /**\n * Instance of the binder for DOM Events.\n *\n * @type {EventsBinder}\n */\n var Binder = new EventsBinder();\n\n var swipeSin = 0;\n var swipeStartX = 0;\n var swipeStartY = 0;\n var disabled = false;\n var capture = supportsPassive$1 ? { passive: true } : false;\n\n var Swipe = {\n /**\n * Initializes swipe bindings.\n *\n * @return {Void}\n */\n mount: function mount() {\n this.bindSwipeStart();\n },\n\n\n /**\n * Handler for `swipestart` event. Calculates entry points of the user's tap.\n *\n * @param {Object} event\n * @return {Void}\n */\n start: function start(event) {\n if (!disabled && !Glide.disabled) {\n this.disable();\n\n var swipe = this.touches(event);\n\n swipeSin = null;\n swipeStartX = toInt(swipe.pageX);\n swipeStartY = toInt(swipe.pageY);\n\n this.bindSwipeMove();\n this.bindSwipeEnd();\n\n Events.emit('swipe.start');\n }\n },\n\n\n /**\n * Handler for `swipemove` event. Calculates user's tap angle and distance.\n *\n * @param {Object} event\n */\n move: function move(event) {\n if (!Glide.disabled) {\n var _Glide$settings = Glide.settings,\n touchAngle = _Glide$settings.touchAngle,\n touchRatio = _Glide$settings.touchRatio,\n classes = _Glide$settings.classes;\n\n\n var swipe = this.touches(event);\n\n var subExSx = toInt(swipe.pageX) - swipeStartX;\n var subEySy = toInt(swipe.pageY) - swipeStartY;\n var powEX = Math.abs(subExSx << 2);\n var powEY = Math.abs(subEySy << 2);\n var swipeHypotenuse = Math.sqrt(powEX + powEY);\n var swipeCathetus = Math.sqrt(powEY);\n\n swipeSin = Math.asin(swipeCathetus / swipeHypotenuse);\n\n if (swipeSin * 180 / Math.PI < touchAngle) {\n event.stopPropagation();\n\n Components.Move.make(subExSx * toFloat(touchRatio));\n\n Components.Html.root.classList.add(classes.dragging);\n\n Events.emit('swipe.move');\n } else {\n return false;\n }\n }\n },\n\n\n /**\n * Handler for `swipeend` event. Finitializes user's tap and decides about glide move.\n *\n * @param {Object} event\n * @return {Void}\n */\n end: function end(event) {\n if (!Glide.disabled) {\n var settings = Glide.settings;\n\n var swipe = this.touches(event);\n var threshold = this.threshold(event);\n\n var swipeDistance = swipe.pageX - swipeStartX;\n var swipeDeg = swipeSin * 180 / Math.PI;\n var steps = Math.round(swipeDistance / Components.Sizes.slideWidth);\n\n this.enable();\n\n if (swipeDistance > threshold && swipeDeg < settings.touchAngle) {\n // While swipe is positive and greater than threshold move backward.\n if (settings.perTouch) {\n steps = Math.min(steps, toInt(settings.perTouch));\n }\n\n if (Components.Direction.is('rtl')) {\n steps = -steps;\n }\n\n Components.Run.make(Components.Direction.resolve('<' + steps));\n } else if (swipeDistance < -threshold && swipeDeg < settings.touchAngle) {\n // While swipe is negative and lower than negative threshold move forward.\n if (settings.perTouch) {\n steps = Math.max(steps, -toInt(settings.perTouch));\n }\n\n if (Components.Direction.is('rtl')) {\n steps = -steps;\n }\n\n Components.Run.make(Components.Direction.resolve('>' + steps));\n } else {\n // While swipe don't reach distance apply previous transform.\n Components.Move.make();\n }\n\n Components.Html.root.classList.remove(settings.classes.dragging);\n\n this.unbindSwipeMove();\n this.unbindSwipeEnd();\n\n Events.emit('swipe.end');\n }\n },\n\n\n /**\n * Binds swipe's starting event.\n *\n * @return {Void}\n */\n bindSwipeStart: function bindSwipeStart() {\n var _this = this;\n\n var settings = Glide.settings;\n\n if (settings.swipeThreshold) {\n Binder.on(START_EVENTS[0], Components.Html.wrapper, function (event) {\n _this.start(event);\n }, capture);\n }\n\n if (settings.dragThreshold) {\n Binder.on(START_EVENTS[1], Components.Html.wrapper, function (event) {\n _this.start(event);\n }, capture);\n }\n },\n\n\n /**\n * Unbinds swipe's starting event.\n *\n * @return {Void}\n */\n unbindSwipeStart: function unbindSwipeStart() {\n Binder.off(START_EVENTS[0], Components.Html.wrapper, capture);\n Binder.off(START_EVENTS[1], Components.Html.wrapper, capture);\n },\n\n\n /**\n * Binds swipe's moving event.\n *\n * @return {Void}\n */\n bindSwipeMove: function bindSwipeMove() {\n var _this2 = this;\n\n Binder.on(MOVE_EVENTS, Components.Html.wrapper, throttle(function (event) {\n _this2.move(event);\n }, Glide.settings.throttle), capture);\n },\n\n\n /**\n * Unbinds swipe's moving event.\n *\n * @return {Void}\n */\n unbindSwipeMove: function unbindSwipeMove() {\n Binder.off(MOVE_EVENTS, Components.Html.wrapper, capture);\n },\n\n\n /**\n * Binds swipe's ending event.\n *\n * @return {Void}\n */\n bindSwipeEnd: function bindSwipeEnd() {\n var _this3 = this;\n\n Binder.on(END_EVENTS, Components.Html.wrapper, function (event) {\n _this3.end(event);\n });\n },\n\n\n /**\n * Unbinds swipe's ending event.\n *\n * @return {Void}\n */\n unbindSwipeEnd: function unbindSwipeEnd() {\n Binder.off(END_EVENTS, Components.Html.wrapper);\n },\n\n\n /**\n * Normalizes event touches points accorting to different types.\n *\n * @param {Object} event\n */\n touches: function touches(event) {\n if (MOUSE_EVENTS.indexOf(event.type) > -1) {\n return event;\n }\n\n return event.touches[0] || event.changedTouches[0];\n },\n\n\n /**\n * Gets value of minimum swipe distance settings based on event type.\n *\n * @return {Number}\n */\n threshold: function threshold(event) {\n var settings = Glide.settings;\n\n if (MOUSE_EVENTS.indexOf(event.type) > -1) {\n return settings.dragThreshold;\n }\n\n return settings.swipeThreshold;\n },\n\n\n /**\n * Enables swipe event.\n *\n * @return {self}\n */\n enable: function enable() {\n disabled = false;\n\n Components.Transition.enable();\n\n return this;\n },\n\n\n /**\n * Disables swipe event.\n *\n * @return {self}\n */\n disable: function disable() {\n disabled = true;\n\n Components.Transition.disable();\n\n return this;\n }\n };\n\n /**\n * Add component class:\n * - after initial building\n */\n Events.on('build.after', function () {\n Components.Html.root.classList.add(Glide.settings.classes.swipeable);\n });\n\n /**\n * Remove swiping bindings:\n * - on destroying, to remove added EventListeners\n */\n Events.on('destroy', function () {\n Swipe.unbindSwipeStart();\n Swipe.unbindSwipeMove();\n Swipe.unbindSwipeEnd();\n Binder.destroy();\n });\n\n return Swipe;\n}\n\nfunction Images (Glide, Components, Events) {\n /**\n * Instance of the binder for DOM Events.\n *\n * @type {EventsBinder}\n */\n var Binder = new EventsBinder();\n\n var Images = {\n /**\n * Binds listener to glide wrapper.\n *\n * @return {Void}\n */\n mount: function mount() {\n this.bind();\n },\n\n\n /**\n * Binds `dragstart` event on wrapper to prevent dragging images.\n *\n * @return {Void}\n */\n bind: function bind() {\n Binder.on('dragstart', Components.Html.wrapper, this.dragstart);\n },\n\n\n /**\n * Unbinds `dragstart` event on wrapper.\n *\n * @return {Void}\n */\n unbind: function unbind() {\n Binder.off('dragstart', Components.Html.wrapper);\n },\n\n\n /**\n * Event handler. Prevents dragging.\n *\n * @return {Void}\n */\n dragstart: function dragstart(event) {\n event.preventDefault();\n }\n };\n\n /**\n * Remove bindings from images:\n * - on destroying, to remove added EventListeners\n */\n Events.on('destroy', function () {\n Images.unbind();\n Binder.destroy();\n });\n\n return Images;\n}\n\nfunction Anchors (Glide, Components, Events) {\n /**\n * Instance of the binder for DOM Events.\n *\n * @type {EventsBinder}\n */\n var Binder = new EventsBinder();\n\n /**\n * Holds detaching status of anchors.\n * Prevents detaching of already detached anchors.\n *\n * @private\n * @type {Boolean}\n */\n var detached = false;\n\n /**\n * Holds preventing status of anchors.\n * If `true` redirection after click will be disabled.\n *\n * @private\n * @type {Boolean}\n */\n var prevented = false;\n\n var Anchors = {\n /**\n * Setups a initial state of anchors component.\n *\n * @returns {Void}\n */\n mount: function mount() {\n /**\n * Holds collection of anchors elements.\n *\n * @private\n * @type {HTMLCollection}\n */\n this._a = Components.Html.wrapper.querySelectorAll('a');\n\n this.bind();\n },\n\n\n /**\n * Binds events to anchors inside a track.\n *\n * @return {Void}\n */\n bind: function bind() {\n Binder.on('click', Components.Html.wrapper, this.click);\n },\n\n\n /**\n * Unbinds events attached to anchors inside a track.\n *\n * @return {Void}\n */\n unbind: function unbind() {\n Binder.off('click', Components.Html.wrapper);\n },\n\n\n /**\n * Handler for click event. Prevents clicks when glide is in `prevent` status.\n *\n * @param {Object} event\n * @return {Void}\n */\n click: function click(event) {\n if (prevented) {\n event.stopPropagation();\n event.preventDefault();\n }\n },\n\n\n /**\n * Detaches anchors click event inside glide.\n *\n * @return {self}\n */\n detach: function detach() {\n prevented = true;\n\n if (!detached) {\n for (var i = 0; i < this.items.length; i++) {\n this.items[i].draggable = false;\n\n this.items[i].setAttribute('data-href', this.items[i].getAttribute('href'));\n\n this.items[i].removeAttribute('href');\n }\n\n detached = true;\n }\n\n return this;\n },\n\n\n /**\n * Attaches anchors click events inside glide.\n *\n * @return {self}\n */\n attach: function attach() {\n prevented = false;\n\n if (detached) {\n for (var i = 0; i < this.items.length; i++) {\n this.items[i].draggable = true;\n\n this.items[i].setAttribute('href', this.items[i].getAttribute('data-href'));\n }\n\n detached = false;\n }\n\n return this;\n }\n };\n\n define(Anchors, 'items', {\n /**\n * Gets collection of the arrows HTML elements.\n *\n * @return {HTMLElement[]}\n */\n get: function get() {\n return Anchors._a;\n }\n });\n\n /**\n * Detach anchors inside slides:\n * - on swiping, so they won't redirect to its `href` attributes\n */\n Events.on('swipe.move', function () {\n Anchors.detach();\n });\n\n /**\n * Attach anchors inside slides:\n * - after swiping and transitions ends, so they can redirect after click again\n */\n Events.on('swipe.end', function () {\n Components.Transition.after(function () {\n Anchors.attach();\n });\n });\n\n /**\n * Unbind anchors inside slides:\n * - on destroying, to bring anchors to its initial state\n */\n Events.on('destroy', function () {\n Anchors.attach();\n Anchors.unbind();\n Binder.destroy();\n });\n\n return Anchors;\n}\n\nvar NAV_SELECTOR = '[data-glide-el=\"controls[nav]\"]';\nvar CONTROLS_SELECTOR = '[data-glide-el^=\"controls\"]';\n\nfunction Controls (Glide, Components, Events) {\n /**\n * Instance of the binder for DOM Events.\n *\n * @type {EventsBinder}\n */\n var Binder = new EventsBinder();\n\n var capture = supportsPassive$1 ? { passive: true } : false;\n\n var Controls = {\n /**\n * Inits arrows. Binds events listeners\n * to the arrows HTML elements.\n *\n * @return {Void}\n */\n mount: function mount() {\n /**\n * Collection of navigation HTML elements.\n *\n * @private\n * @type {HTMLCollection}\n */\n this._n = Components.Html.root.querySelectorAll(NAV_SELECTOR);\n\n /**\n * Collection of controls HTML elements.\n *\n * @private\n * @type {HTMLCollection}\n */\n this._c = Components.Html.root.querySelectorAll(CONTROLS_SELECTOR);\n\n this.addBindings();\n },\n\n\n /**\n * Sets active class to current slide.\n *\n * @return {Void}\n */\n setActive: function setActive() {\n for (var i = 0; i < this._n.length; i++) {\n this.addClass(this._n[i].children);\n }\n },\n\n\n /**\n * Removes active class to current slide.\n *\n * @return {Void}\n */\n removeActive: function removeActive() {\n for (var i = 0; i < this._n.length; i++) {\n this.removeClass(this._n[i].children);\n }\n },\n\n\n /**\n * Toggles active class on items inside navigation.\n *\n * @param {HTMLElement} controls\n * @return {Void}\n */\n addClass: function addClass(controls) {\n var settings = Glide.settings;\n var item = controls[Glide.index];\n\n if (item) {\n item.classList.add(settings.classes.activeNav);\n\n siblings(item).forEach(function (sibling) {\n sibling.classList.remove(settings.classes.activeNav);\n });\n }\n },\n\n\n /**\n * Removes active class from active control.\n *\n * @param {HTMLElement} controls\n * @return {Void}\n */\n removeClass: function removeClass(controls) {\n var item = controls[Glide.index];\n\n if (item) {\n item.classList.remove(Glide.settings.classes.activeNav);\n }\n },\n\n\n /**\n * Adds handles to the each group of controls.\n *\n * @return {Void}\n */\n addBindings: function addBindings() {\n for (var i = 0; i < this._c.length; i++) {\n this.bind(this._c[i].children);\n }\n },\n\n\n /**\n * Removes handles from the each group of controls.\n *\n * @return {Void}\n */\n removeBindings: function removeBindings() {\n for (var i = 0; i < this._c.length; i++) {\n this.unbind(this._c[i].children);\n }\n },\n\n\n /**\n * Binds events to arrows HTML elements.\n *\n * @param {HTMLCollection} elements\n * @return {Void}\n */\n bind: function bind(elements) {\n for (var i = 0; i < elements.length; i++) {\n Binder.on('click', elements[i], this.click);\n Binder.on('touchstart', elements[i], this.click, capture);\n }\n },\n\n\n /**\n * Unbinds events binded to the arrows HTML elements.\n *\n * @param {HTMLCollection} elements\n * @return {Void}\n */\n unbind: function unbind(elements) {\n for (var i = 0; i < elements.length; i++) {\n Binder.off(['click', 'touchstart'], elements[i]);\n }\n },\n\n\n /**\n * Handles `click` event on the arrows HTML elements.\n * Moves slider in driection precised in\n * `data-glide-dir` attribute.\n *\n * @param {Object} event\n * @return {Void}\n */\n click: function click(event) {\n event.preventDefault();\n\n Components.Run.make(Components.Direction.resolve(event.currentTarget.getAttribute('data-glide-dir')));\n }\n };\n\n define(Controls, 'items', {\n /**\n * Gets collection of the controls HTML elements.\n *\n * @return {HTMLElement[]}\n */\n get: function get() {\n return Controls._c;\n }\n });\n\n /**\n * Swap active class of current navigation item:\n * - after mounting to set it to initial index\n * - after each move to the new index\n */\n Events.on(['mount.after', 'move.after'], function () {\n Controls.setActive();\n });\n\n /**\n * Remove bindings and HTML Classes:\n * - on destroying, to bring markup to its initial state\n */\n Events.on('destroy', function () {\n Controls.removeBindings();\n Controls.removeActive();\n Binder.destroy();\n });\n\n return Controls;\n}\n\nfunction Keyboard (Glide, Components, Events) {\n /**\n * Instance of the binder for DOM Events.\n *\n * @type {EventsBinder}\n */\n var Binder = new EventsBinder();\n\n var Keyboard = {\n /**\n * Binds keyboard events on component mount.\n *\n * @return {Void}\n */\n mount: function mount() {\n if (Glide.settings.keyboard) {\n this.bind();\n }\n },\n\n\n /**\n * Adds keyboard press events.\n *\n * @return {Void}\n */\n bind: function bind() {\n Binder.on('keyup', document, this.press);\n },\n\n\n /**\n * Removes keyboard press events.\n *\n * @return {Void}\n */\n unbind: function unbind() {\n Binder.off('keyup', document);\n },\n\n\n /**\n * Handles keyboard's arrows press and moving glide foward and backward.\n *\n * @param {Object} event\n * @return {Void}\n */\n press: function press(event) {\n if (event.keyCode === 39) {\n Components.Run.make(Components.Direction.resolve('>'));\n }\n\n if (event.keyCode === 37) {\n Components.Run.make(Components.Direction.resolve('<'));\n }\n }\n };\n\n /**\n * Remove bindings from keyboard:\n * - on destroying to remove added events\n * - on updating to remove events before remounting\n */\n Events.on(['destroy', 'update'], function () {\n Keyboard.unbind();\n });\n\n /**\n * Remount component\n * - on updating to reflect potential changes in settings\n */\n Events.on('update', function () {\n Keyboard.mount();\n });\n\n /**\n * Destroy binder:\n * - on destroying to remove listeners\n */\n Events.on('destroy', function () {\n Binder.destroy();\n });\n\n return Keyboard;\n}\n\nfunction Autoplay (Glide, Components, Events) {\n /**\n * Instance of the binder for DOM Events.\n *\n * @type {EventsBinder}\n */\n var Binder = new EventsBinder();\n\n var Autoplay = {\n /**\n * Initializes autoplaying and events.\n *\n * @return {Void}\n */\n mount: function mount() {\n this.start();\n\n if (Glide.settings.hoverpause) {\n this.bind();\n }\n },\n\n\n /**\n * Starts autoplaying in configured interval.\n *\n * @param {Boolean|Number} force Run autoplaying with passed interval regardless of `autoplay` settings\n * @return {Void}\n */\n start: function start() {\n var _this = this;\n\n if (Glide.settings.autoplay) {\n if (isUndefined(this._i)) {\n this._i = setInterval(function () {\n _this.stop();\n\n Components.Run.make('>');\n\n _this.start();\n }, this.time);\n }\n }\n },\n\n\n /**\n * Stops autorunning of the glide.\n *\n * @return {Void}\n */\n stop: function stop() {\n this._i = clearInterval(this._i);\n },\n\n\n /**\n * Stops autoplaying while mouse is over glide's area.\n *\n * @return {Void}\n */\n bind: function bind() {\n var _this2 = this;\n\n Binder.on('mouseover', Components.Html.root, function () {\n _this2.stop();\n });\n\n Binder.on('mouseout', Components.Html.root, function () {\n _this2.start();\n });\n },\n\n\n /**\n * Unbind mouseover events.\n *\n * @returns {Void}\n */\n unbind: function unbind() {\n Binder.off(['mouseover', 'mouseout'], Components.Html.root);\n }\n };\n\n define(Autoplay, 'time', {\n /**\n * Gets time period value for the autoplay interval. Prioritizes\n * times in `data-glide-autoplay` attrubutes over options.\n *\n * @return {Number}\n */\n get: function get() {\n var autoplay = Components.Html.slides[Glide.index].getAttribute('data-glide-autoplay');\n\n if (autoplay) {\n return toInt(autoplay);\n }\n\n return toInt(Glide.settings.autoplay);\n }\n });\n\n /**\n * Stop autoplaying and unbind events:\n * - on destroying, to clear defined interval\n * - on updating via API to reset interval that may changed\n */\n Events.on(['destroy', 'update'], function () {\n Autoplay.unbind();\n });\n\n /**\n * Stop autoplaying:\n * - before each run, to restart autoplaying\n * - on pausing via API\n * - on destroying, to clear defined interval\n * - while starting a swipe\n * - on updating via API to reset interval that may changed\n */\n Events.on(['run.before', 'pause', 'destroy', 'swipe.start', 'update'], function () {\n Autoplay.stop();\n });\n\n /**\n * Start autoplaying:\n * - after each run, to restart autoplaying\n * - on playing via API\n * - while ending a swipe\n */\n Events.on(['run.after', 'play', 'swipe.end'], function () {\n Autoplay.start();\n });\n\n /**\n * Remount autoplaying:\n * - on updating via API to reset interval that may changed\n */\n Events.on('update', function () {\n Autoplay.mount();\n });\n\n /**\n * Destroy a binder:\n * - on destroying glide instance to clearup listeners\n */\n Events.on('destroy', function () {\n Binder.destroy();\n });\n\n return Autoplay;\n}\n\n/**\n * Sorts keys of breakpoint object so they will be ordered from lower to bigger.\n *\n * @param {Object} points\n * @returns {Object}\n */\nfunction sortBreakpoints(points) {\n if (isObject(points)) {\n return sortKeys(points);\n } else {\n warn('Breakpoints option must be an object');\n }\n\n return {};\n}\n\nfunction Breakpoints (Glide, Components, Events) {\n /**\n * Instance of the binder for DOM Events.\n *\n * @type {EventsBinder}\n */\n var Binder = new EventsBinder();\n\n /**\n * Holds reference to settings.\n *\n * @type {Object}\n */\n var settings = Glide.settings;\n\n /**\n * Holds reference to breakpoints object in settings. Sorts breakpoints\n * from smaller to larger. It is required in order to proper\n * matching currently active breakpoint settings.\n *\n * @type {Object}\n */\n var points = sortBreakpoints(settings.breakpoints);\n\n /**\n * Cache initial settings before overwritting.\n *\n * @type {Object}\n */\n var defaults = _extends({}, settings);\n\n var Breakpoints = {\n /**\n * Matches settings for currectly matching media breakpoint.\n *\n * @param {Object} points\n * @returns {Object}\n */\n match: function match(points) {\n if (typeof window.matchMedia !== 'undefined') {\n for (var point in points) {\n if (points.hasOwnProperty(point)) {\n if (window.matchMedia('(max-width: ' + point + 'px)').matches) {\n return points[point];\n }\n }\n }\n }\n\n return defaults;\n }\n };\n\n /**\n * Overwrite instance settings with currently matching breakpoint settings.\n * This happens right after component initialization.\n */\n _extends(settings, Breakpoints.match(points));\n\n /**\n * Update glide with settings of matched brekpoint:\n * - window resize to update slider\n */\n Binder.on('resize', window, throttle(function () {\n Glide.settings = mergeOptions(settings, Breakpoints.match(points));\n }, Glide.settings.throttle));\n\n /**\n * Resort and update default settings:\n * - on reinit via API, so breakpoint matching will be performed with options\n */\n Events.on('update', function () {\n points = sortBreakpoints(points);\n\n defaults = _extends({}, settings);\n });\n\n /**\n * Unbind resize listener:\n * - on destroying, to bring markup to its initial state\n */\n Events.on('destroy', function () {\n Binder.off('resize', window);\n });\n\n return Breakpoints;\n}\n\nvar COMPONENTS = {\n // Required\n Html: Html,\n Translate: Translate,\n Transition: Transition,\n Direction: Direction,\n Peek: Peek,\n Sizes: Sizes,\n Gaps: Gaps,\n Move: Move,\n Clones: Clones,\n Resize: Resize,\n Build: Build,\n Run: Run,\n\n // Optional\n Swipe: Swipe,\n Images: Images,\n Anchors: Anchors,\n Controls: Controls,\n Keyboard: Keyboard,\n Autoplay: Autoplay,\n Breakpoints: Breakpoints\n};\n\nvar Glide$1 = function (_Core) {\n inherits(Glide$$1, _Core);\n\n function Glide$$1() {\n classCallCheck(this, Glide$$1);\n return possibleConstructorReturn(this, (Glide$$1.__proto__ || Object.getPrototypeOf(Glide$$1)).apply(this, arguments));\n }\n\n createClass(Glide$$1, [{\n key: 'mount',\n value: function mount() {\n var extensions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n return get(Glide$$1.prototype.__proto__ || Object.getPrototypeOf(Glide$$1.prototype), 'mount', this).call(this, _extends({}, COMPONENTS, extensions));\n }\n }]);\n return Glide$$1;\n}(Glide);\n\nexport default Glide$1;\n", "import { ComponentFunction } from \"@glidejs/glide\";\r\nimport Glide from \"@glidejs/glide\";\r\nimport { AxInit, ModuleName } from \"../../Lib/AxSystem/AxInit\";\r\n\r\n@ModuleName(\"AxProdMain\")\r\nexport class AxProdMain implements AxInit {\r\n private Glides: Map = new Map();\r\n\r\n constructor() { }\r\n\r\n AxInit(init: any): void {\r\n\r\n $('.ax-products__groupList[data-display-mode=\"swiper\"]').each((i, x) => {\r\n let glideID: string = $(x).attr('id');\r\n let rows: number = $(x).data('rows');\r\n\r\n let glide = new Glide('#' + glideID, {\r\n type: 'slider',\r\n perView: rows,\r\n rewind: false,\r\n bound: true,\r\n animationDuration: 300,\r\n breakpoints: {\r\n 800: {\r\n perView: 2\r\n },\r\n 480: {\r\n perView: 1\r\n }\r\n },\r\n classes: {\r\n activeSlide: 'glide__slide--active',\r\n disabledArrow: 'glide__arrow--disabled'\r\n },\r\n gap: 0\r\n });\r\n\r\n this.Glides.set(glideID, glide);\r\n\r\n glide.on('run.before', e => {\r\n e.steps = e.direction === '>' ? -glide.settings.perView : glide.settings.perView\r\n })\r\n glide.mount({\r\n 'DisableControls': this.updateGlideFunc\r\n });\r\n });\r\n }\r\n\r\n private updateGlideFunc: ComponentFunction = (glide: Glide.Static, Components: any, Events: any) => {\r\n\r\n const PREV_CONTROL_SELECTOR = \"[data-glide-dir='<']\";\r\n const NEXT_CONTROL_SELECTOR = \"[data-glide-dir='>']\";\r\n const component = {\r\n buildAfter() {\r\n this.prevBtn = Components.Html.root.querySelector(PREV_CONTROL_SELECTOR);\r\n this.nextBtn = Components.Html.root.querySelector(NEXT_CONTROL_SELECTOR);\r\n },\r\n handleDisable() {\r\n const perView = glide.settings.perView;\r\n const slidesCount = Components.Html.slides.length;\r\n\r\n this.prevBtn.disabled = (glide.index <= 0);\r\n this.nextBtn.disabled = (glide.index >= slidesCount - perView);\r\n },\r\n mount() {\r\n }\r\n };\r\n\r\n Events.on(\"build.after\", function () {\r\n component.buildAfter();\r\n component.handleDisable();\r\n });\r\n Events.on(\"run.after\", function () {\r\n component.handleDisable();\r\n });\r\n return component;\r\n }\r\n}\r\n\r\ninterface GliderMovement {\r\n direction: string;\r\n steps: string;\r\n}\r\n", "import { PackagePosition } from \"../../Models/Package/PackagePosition\";\r\nimport { PersonType } from \"../../Models/Tickets/PersonType\";\r\nimport { Product } from \"../../Models/Tickets/Product\";\r\n\r\nexport class ProductMapper {\r\n GetPersonTypeList(productList: Product[]): PersonType[] {\r\n let personTypes: PersonType[] = [];\r\n for (let prod of productList) {\r\n if (prod.Quantity > 0) {\r\n personTypes.push({\r\n PersonTypeId: prod.SubProductIdentifier,\r\n Quantity: prod.Quantity\r\n });\r\n }\r\n }\r\n return personTypes;\r\n }\r\n\r\n GetPackagePositionList(productList: Product[]): PackagePosition[] {\r\n let positions: PackagePosition[] = [];\r\n for (let prod of productList) {\r\n positions.push({\r\n PackPos: prod.SubProductIdentifier,\r\n Quantity: prod.Quantity,\r\n PackSort: prod.Sort\r\n });\r\n }\r\n return positions;\r\n }\r\n}", "import { Map } from \"../Types/Map\";\r\n\r\nexport class I18nHelper {\r\n static TransList: Map = new Map();\r\n private static Loaded: boolean = false;\r\n\r\n constructor() {\r\n if (!I18nHelper.Loaded) {\r\n if (typeof Translation == 'undefined' || Translation == null) {\r\n return;\r\n }\r\n\r\n for (let trans of Translation) {\r\n I18nHelper.TransList.add(trans[0].charAt(0).toUpperCase() + trans[0].slice(1), trans[1]);\r\n }\r\n }\r\n }\r\n\r\n GetTranslation(key: Translations, ...args: any[]): string {\r\n let translation = I18nHelper.TransList.get(Translations[key]);\r\n return (translation || \"\").replace(/\\{[0-9]\\}/g, (substring) => args[substring.substring(1, substring.length - 1)] ?? '');\r\n }\r\n}\r\n\r\n//Always Uppercase\r\nexport enum Translations {\r\n Ticket,\r\n Tickets,\r\n Reserve,\r\n Summary,\r\n Checkout,\r\n Timings,\r\n QuantityDate,\r\n Error,\r\n TicketVerification,\r\n ReservationManagement,\r\n DateTimeReservation,\r\n Confirmation,\r\n Next,\r\n CountAvailable,\r\n AreYouSure,\r\n OneWayReservation,\r\n ConfirmReservation,\r\n DeleteReservationPopup,\r\n DeleteConfirmationPopup,\r\n NotValidSerialNumber,\r\n ValueMissing,\r\n CartAdd,\r\n OnlyNumbers,\r\n NotValidWtp,\r\n DrpZneDefaultMessage,\r\n Various,\r\n People,\r\n DrpZneFallbackMessage,\r\n Location,\r\n DrpZneFallbackText,\r\n DrpZneFileTooBig,\r\n DrpZneInvalidFileType,\r\n SlotsN,\r\n WTPNumberNotFound,\r\n LevelsAll,\r\n DrpZneResponseError,\r\n DrpZneCancelUpload,\r\n DrpZneCancelUploadConfirmation,\r\n DrpZneRemoveFile,\r\n DrpZneMaxFilesExceeded,\r\n Success,\r\n FeldErforderlich,\r\n AddressPleaseAdd,\r\n BookNow,\r\n PasswordNotValid,\r\n PasswordUnequal,\r\n SelectTicket,\r\n AmountAndDesign,\r\n Personalize,\r\n ValidationMail,\r\n From,\r\n To,\r\n Message,\r\n PleaseSelectGiftCardTemplate,\r\n Cancel,\r\n SelectCard,\r\n SlotsAvailable,\r\n DeviceNotSupported,\r\n ServerErrorText1,\r\n ServerErrorText2,\r\n Oops,\r\n Ok,\r\n OutOfX,\r\n VoucherCurrentlyNotRedeemable,\r\n VoucherNotPartlyRedeemable,\r\n CartCart,\r\n ProductSelectionRequired,\r\n WtpPleaseInsert,\r\n ShowXResults,\r\n LegitimationCheckError,\r\n SelectDate,\r\n Continue,\r\n SelectAtLeastOneTicket,\r\n State,\r\n LoginCredentialsWrong,\r\n LoginSuccess,\r\n AddCoverPoster,\r\n AddCoverForVideo,\r\n YesPlease,\r\n NoThanks,\r\n Whoops,\r\n MaxQuantity,\r\n MinQuantity,\r\n MaximumFileSize,\r\n AcceptableFilesExtention,\r\n ConfirmationEmailSent,\r\n Free,\r\n SoldOut,\r\n MyTicketsInfoBarCode,\r\n MyTicketsInfoVoucher,\r\n MyTicketsInfoBLE,\r\n LinkCopiedToClipboard,\r\n WrongDay,\r\n WrongSelectedDay,\r\n AdminClose,\r\n Rentals,\r\n MandatoryRentalDataMissing,\r\n RentalNoPersonSelected,\r\n OneRISKProcessIsRequiredBeforeProceed,\r\n OneRISKNecessityMessage,\r\n Warning,\r\n WaiverSaveFail,\r\n WaiverIsCompleted,\r\n BodyLoggingEnabledAlert,\r\n RentalAdditionalOptions,\r\n RentalYouCanSkipThisPart,\r\n RentalNoProperties,\r\n ProceedToCheckout,\r\n QuantityTicket,\r\n SelectCategoryFirst,\r\n SelectDateFirst,\r\n SelectTicketFirst,\r\n TicketsX,\r\n SelectACategory,\r\n SelectAStartingDate,\r\n NumberOfTickets,\r\n WaiverModal,\r\n ResetSelection,\r\n}\r\n", "export class AxProgressBar {\r\n private Target: JQuery;\r\n private Options: Options;\r\n\r\n private working = false;\r\n\r\n Init(options: Options) {\r\n this.Options = options;\r\n this.Target = $(this.Options.target);\r\n\r\n if (this.Target.length > 0) {\r\n this.Target.addClass('ax-progressbar').addClass('ax-progressbar--header');\r\n\r\n for (let step of this.Options.steps) {\r\n let outer = document.createElement('div');\r\n if (step.type != 'divider') {\r\n outer.classList.add('ax-progressbar-step');\r\n\r\n if (step.type != 'inactive') {\r\n outer.classList.add('ax-progressbar-step--' + step.type);\r\n }\r\n\r\n let icon = document.createElement('i');\r\n outer.appendChild(icon);\r\n\r\n let label = document.createElement('div');\r\n label.innerHTML = step.label;\r\n outer.appendChild(label);\r\n } else {\r\n outer.classList.add('ax-progressbar--header-divider');\r\n }\r\n this.Target.append(outer);\r\n step.elem = outer;\r\n }\r\n\r\n this.checkProgressBarSize();\r\n\r\n $(window).on(\"resize\", () => {\r\n this.checkProgressBarSize();\r\n });\r\n }\r\n }\r\n\r\n checkProgressBarSize() {\r\n let isOverflow: boolean = true;\r\n\r\n if (!this.working) {\r\n this.working = true;\r\n const currentActiveIndex = this.Options.steps.findIndex(x => x.type === 'active');\r\n ;\r\n while (isOverflow) { isOverflow = this.checkOverflow(currentActiveIndex) }\r\n\r\n if (!isOverflow) {\r\n this.checkNoOverflow(currentActiveIndex);\r\n }\r\n this.working = false;\r\n }\r\n }\r\n\r\n checkNoOverflow(currentActiveIndex: number) {\r\n const firstInactive = this.Options.steps.findIndex(x => x.type === 'hidden');\r\n\r\n if (this.isOverflown(this.Target[0]) || firstInactive === -1) {\r\n return;\r\n }\r\n\r\n const startIndexDif = firstInactive < currentActiveIndex ? (currentActiveIndex - this.Options.steps.findIndex(x => x.type !== 'hidden')) + 1 : -1;\r\n\r\n const firstInactiveEnd = this.Options.steps.slice(currentActiveIndex).findIndex(x => x.type === 'hidden');\r\n const endIndexDif = firstInactiveEnd !== -1 ? firstInactiveEnd : startIndexDif + 1;\r\n\r\n let stepToShow: Step;\r\n if (startIndexDif >= 0 && startIndexDif < endIndexDif) {\r\n stepToShow = this.Options.steps[currentActiveIndex - startIndexDif];\r\n } else {\r\n stepToShow = this.Options.steps[currentActiveIndex + endIndexDif];\r\n }\r\n stepToShow.type = stepToShow.orgType;\r\n stepToShow.elem.style.visibility = 'hidden';\r\n stepToShow.elem.classList.remove('ax-progressbar-step--hidden');\r\n\r\n this.checkOverflow(currentActiveIndex);\r\n stepToShow.elem.style.visibility = 'visible';\r\n }\r\n\r\n checkOverflow(currentActiveIndex: number): boolean {\r\n if (!this.isOverflown(this.Target[0])) {\r\n return false;\r\n }\r\n const reverseSteps = this.Options.steps.slice().reverse();\r\n const startIndexDif = currentActiveIndex - this.Options.steps.findIndex(x => x.type !== 'hidden');\r\n const endIndexDif = (currentActiveIndex - (reverseSteps.length - reverseSteps.findIndex(x => x.type !== 'hidden'))) * -1 - 1;\r\n\r\n let stepToRemove: Step;\r\n if (startIndexDif >= endIndexDif) {\r\n stepToRemove = this.Options.steps[currentActiveIndex - startIndexDif];\r\n } else {\r\n stepToRemove = this.Options.steps[currentActiveIndex + endIndexDif];\r\n }\r\n\r\n stepToRemove.orgType = stepToRemove.type;\r\n stepToRemove.type = 'hidden';\r\n stepToRemove.elem.classList.add('ax-progressbar-step--hidden');\r\n\r\n return true;\r\n }\r\n\r\n isOverflown(element: HTMLElement) {\r\n return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;\r\n }\r\n\r\n destroy() {\r\n this.Target.html('');\r\n }\r\n}\r\n\r\nexport interface Options {\r\n target: string;\r\n steps: Step[];\r\n}\r\n\r\nexport interface Step {\r\n label?: string;\r\n type: 'inactive' | 'active' | 'done' | 'divider' | 'hidden';\r\n orgType?: 'inactive' | 'active' | 'done' | 'divider' | 'hidden';\r\n elem?: HTMLDivElement;\r\n alias?: string;\r\n}", "import { I18nHelper, Translations } from \"../../Lib/Helper/I18nHelper\";\r\nimport { AxProgressBar, Step } from \"../../Limestone/AxProgressBar/AxProgressBar\";\r\nimport { AxLoad } from \"../../Lib/AxSystem/AxLoad\";\r\nimport { AxStaticConfigModule } from \"../AxConfig/AxStaticConfigModule\";\r\n\r\nexport class ProgressBar {\r\n constructor(private i18nHelper = new I18nHelper()) { }\r\n\r\n Init(initData: ProgressBarInit) {\r\n let progressBar = new AxProgressBar();\r\n\r\n let count = -1;\r\n let steps: Step[];\r\n \r\n switch (initData.Mode) {\r\n case ProgressBarMode.Suballotment:\r\n steps = this.GetSuballotmentSteps();\r\n break;\r\n case\r\n ProgressBarMode.Reservation:\r\n steps = this.GetReservationSteps();\r\n break;\r\n default:\r\n steps = this.GetDefaultSteps();\r\n break;\r\n }\r\n\r\n\r\n if (initData.Mode == ProgressBarMode.Default || initData.Mode == ProgressBarMode.Suballotment) {\r\n let configModule = AxLoad.GetModule('AxStaticConfigModule');\r\n\r\n if (configModule.skipSummary) {\r\n if (initData.Progress >= steps.findIndex(x => x.alias === 'summary')) {\r\n initData.Progress--;\r\n }\r\n steps = steps.filter(x => x.alias !== 'summary');\r\n }\r\n }\r\n\r\n for (let step of steps) {\r\n if (count != -1) {\r\n if (count < initData.Progress) {\r\n step.type = 'done';\r\n } else if (count == initData.Progress) {\r\n step.type = 'active';\r\n } else if (count > initData.Progress) {\r\n step.type = 'inactive';\r\n }\r\n }\r\n count++;\r\n }\r\n\r\n progressBar.Init({\r\n target: '.header__progressbar',\r\n steps: steps\r\n });\r\n }\r\n\r\n GetDefaultSteps(): Step[] {\r\n return [\r\n {\r\n label: this.i18nHelper.GetTranslation(Translations.Ticket),\r\n type: 'done'\r\n },\r\n {\r\n label: this.i18nHelper.GetTranslation(Translations.QuantityDate),\r\n type: 'active'\r\n },\r\n {\r\n label: this.i18nHelper.GetTranslation(Translations.Summary),\r\n type: 'inactive',\r\n alias: 'summary'\r\n },\r\n {\r\n label: this.i18nHelper.GetTranslation(Translations.CartCart),\r\n type: 'inactive'\r\n },\r\n {\r\n label: this.i18nHelper.GetTranslation(Translations.Checkout),\r\n type: 'inactive'\r\n }\r\n ];\r\n }\r\n\r\n GetSuballotmentSteps(): Step[] {\r\n return [\r\n {\r\n label: this.i18nHelper.GetTranslation(Translations.Ticket),\r\n type: 'done'\r\n },\r\n {\r\n label: this.i18nHelper.GetTranslation(Translations.QuantityDate),\r\n type: 'active'\r\n },\r\n {\r\n label: this.i18nHelper.GetTranslation(Translations.Timings),\r\n type: 'inactive'\r\n },\r\n {\r\n label: this.i18nHelper.GetTranslation(Translations.Summary),\r\n type: 'inactive',\r\n alias: 'summary'\r\n },\r\n {\r\n label: this.i18nHelper.GetTranslation(Translations.CartCart),\r\n type: 'inactive'\r\n },\r\n {\r\n label: this.i18nHelper.GetTranslation(Translations.Checkout),\r\n type: 'inactive'\r\n }\r\n ];\r\n }\r\n\r\n GetReservationSteps(): Step[] {\r\n return [\r\n {\r\n label: this.i18nHelper.GetTranslation(Translations.TicketVerification),\r\n type: 'active'\r\n },\r\n {\r\n label: this.i18nHelper.GetTranslation(Translations.ReservationManagement),\r\n type: 'inactive'\r\n },\r\n {\r\n label: this.i18nHelper.GetTranslation(Translations.DateTimeReservation),\r\n type: 'inactive'\r\n },\r\n\r\n ];\r\n }\r\n}\r\n\r\nexport interface ProgressBarInit {\r\n Progress: number;\r\n Mode: ProgressBarMode\r\n}\r\n\r\nexport enum ProgressBarMode {\r\n Default,\r\n Suballotment,\r\n Reservation\r\n}", "const consoleLogger = {\n type: 'logger',\n log(args) {\n this.output('log', args);\n },\n warn(args) {\n this.output('warn', args);\n },\n error(args) {\n this.output('error', args);\n },\n output(type, args) {\n if (console && console[type]) console[type].apply(console, args);\n }\n};\nclass Logger {\n constructor(concreteLogger) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n this.init(concreteLogger, options);\n }\n init(concreteLogger) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n this.prefix = options.prefix || 'i18next:';\n this.logger = concreteLogger || consoleLogger;\n this.options = options;\n this.debug = options.debug;\n }\n log() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return this.forward(args, 'log', '', true);\n }\n warn() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return this.forward(args, 'warn', '', true);\n }\n error() {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n return this.forward(args, 'error', '');\n }\n deprecate() {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);\n }\n forward(args, lvl, prefix, debugOnly) {\n if (debugOnly && !this.debug) return null;\n if (typeof args[0] === 'string') args[0] = `${prefix}${this.prefix} ${args[0]}`;\n return this.logger[lvl](args);\n }\n create(moduleName) {\n return new Logger(this.logger, {\n ...{\n prefix: `${this.prefix}:${moduleName}:`\n },\n ...this.options\n });\n }\n clone(options) {\n options = options || this.options;\n options.prefix = options.prefix || this.prefix;\n return new Logger(this.logger, options);\n }\n}\nvar baseLogger = new Logger();\n\nclass EventEmitter {\n constructor() {\n this.observers = {};\n }\n on(events, listener) {\n events.split(' ').forEach(event => {\n this.observers[event] = this.observers[event] || [];\n this.observers[event].push(listener);\n });\n return this;\n }\n off(event, listener) {\n if (!this.observers[event]) return;\n if (!listener) {\n delete this.observers[event];\n return;\n }\n this.observers[event] = this.observers[event].filter(l => l !== listener);\n }\n emit(event) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n if (this.observers[event]) {\n const cloned = [].concat(this.observers[event]);\n cloned.forEach(observer => {\n observer(...args);\n });\n }\n if (this.observers['*']) {\n const cloned = [].concat(this.observers['*']);\n cloned.forEach(observer => {\n observer.apply(observer, [event, ...args]);\n });\n }\n }\n}\n\nfunction defer() {\n let res;\n let rej;\n const promise = new Promise((resolve, reject) => {\n res = resolve;\n rej = reject;\n });\n promise.resolve = res;\n promise.reject = rej;\n return promise;\n}\nfunction makeString(object) {\n if (object == null) return '';\n return '' + object;\n}\nfunction copy(a, s, t) {\n a.forEach(m => {\n if (s[m]) t[m] = s[m];\n });\n}\nfunction getLastOfPath(object, path, Empty) {\n function cleanKey(key) {\n return key && key.indexOf('###') > -1 ? key.replace(/###/g, '.') : key;\n }\n function canNotTraverseDeeper() {\n return !object || typeof object === 'string';\n }\n const stack = typeof path !== 'string' ? [].concat(path) : path.split('.');\n while (stack.length > 1) {\n if (canNotTraverseDeeper()) return {};\n const key = cleanKey(stack.shift());\n if (!object[key] && Empty) object[key] = new Empty();\n if (Object.prototype.hasOwnProperty.call(object, key)) {\n object = object[key];\n } else {\n object = {};\n }\n }\n if (canNotTraverseDeeper()) return {};\n return {\n obj: object,\n k: cleanKey(stack.shift())\n };\n}\nfunction setPath(object, path, newValue) {\n const {\n obj,\n k\n } = getLastOfPath(object, path, Object);\n obj[k] = newValue;\n}\nfunction pushPath(object, path, newValue, concat) {\n const {\n obj,\n k\n } = getLastOfPath(object, path, Object);\n obj[k] = obj[k] || [];\n if (concat) obj[k] = obj[k].concat(newValue);\n if (!concat) obj[k].push(newValue);\n}\nfunction getPath(object, path) {\n const {\n obj,\n k\n } = getLastOfPath(object, path);\n if (!obj) return undefined;\n return obj[k];\n}\nfunction getPathWithDefaults(data, defaultData, key) {\n const value = getPath(data, key);\n if (value !== undefined) {\n return value;\n }\n return getPath(defaultData, key);\n}\nfunction deepExtend(target, source, overwrite) {\n for (const prop in source) {\n if (prop !== '__proto__' && prop !== 'constructor') {\n if (prop in target) {\n if (typeof target[prop] === 'string' || target[prop] instanceof String || typeof source[prop] === 'string' || source[prop] instanceof String) {\n if (overwrite) target[prop] = source[prop];\n } else {\n deepExtend(target[prop], source[prop], overwrite);\n }\n } else {\n target[prop] = source[prop];\n }\n }\n }\n return target;\n}\nfunction regexEscape(str) {\n return str.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, '\\\\$&');\n}\nvar _entityMap = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": ''',\n '/': '/'\n};\nfunction escape(data) {\n if (typeof data === 'string') {\n return data.replace(/[&<>\"'\\/]/g, s => _entityMap[s]);\n }\n return data;\n}\nconst chars = [' ', ',', '?', '!', ';'];\nfunction looksLikeObjectPath(key, nsSeparator, keySeparator) {\n nsSeparator = nsSeparator || '';\n keySeparator = keySeparator || '';\n const possibleChars = chars.filter(c => nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0);\n if (possibleChars.length === 0) return true;\n const r = new RegExp(`(${possibleChars.map(c => c === '?' ? '\\\\?' : c).join('|')})`);\n let matched = !r.test(key);\n if (!matched) {\n const ki = key.indexOf(keySeparator);\n if (ki > 0 && !r.test(key.substring(0, ki))) {\n matched = true;\n }\n }\n return matched;\n}\nfunction deepFind(obj, path) {\n let keySeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.';\n if (!obj) return undefined;\n if (obj[path]) return obj[path];\n const paths = path.split(keySeparator);\n let current = obj;\n for (let i = 0; i < paths.length; ++i) {\n if (!current) return undefined;\n if (typeof current[paths[i]] === 'string' && i + 1 < paths.length) {\n return undefined;\n }\n if (current[paths[i]] === undefined) {\n let j = 2;\n let p = paths.slice(i, i + j).join(keySeparator);\n let mix = current[p];\n while (mix === undefined && paths.length > i + j) {\n j++;\n p = paths.slice(i, i + j).join(keySeparator);\n mix = current[p];\n }\n if (mix === undefined) return undefined;\n if (mix === null) return null;\n if (path.endsWith(p)) {\n if (typeof mix === 'string') return mix;\n if (p && typeof mix[p] === 'string') return mix[p];\n }\n const joinedPath = paths.slice(i + j).join(keySeparator);\n if (joinedPath) return deepFind(mix, joinedPath, keySeparator);\n return undefined;\n }\n current = current[paths[i]];\n }\n return current;\n}\nfunction getCleanedCode(code) {\n if (code && code.indexOf('_') > 0) return code.replace('_', '-');\n return code;\n}\n\nclass ResourceStore extends EventEmitter {\n constructor(data) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n ns: ['translation'],\n defaultNS: 'translation'\n };\n super();\n this.data = data || {};\n this.options = options;\n if (this.options.keySeparator === undefined) {\n this.options.keySeparator = '.';\n }\n if (this.options.ignoreJSONStructure === undefined) {\n this.options.ignoreJSONStructure = true;\n }\n }\n addNamespaces(ns) {\n if (this.options.ns.indexOf(ns) < 0) {\n this.options.ns.push(ns);\n }\n }\n removeNamespaces(ns) {\n const index = this.options.ns.indexOf(ns);\n if (index > -1) {\n this.options.ns.splice(index, 1);\n }\n }\n getResource(lng, ns, key) {\n let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;\n const ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;\n let path = [lng, ns];\n if (key && typeof key !== 'string') path = path.concat(key);\n if (key && typeof key === 'string') path = path.concat(keySeparator ? key.split(keySeparator) : key);\n if (lng.indexOf('.') > -1) {\n path = lng.split('.');\n }\n const result = getPath(this.data, path);\n if (result || !ignoreJSONStructure || typeof key !== 'string') return result;\n return deepFind(this.data && this.data[lng] && this.data[lng][ns], key, keySeparator);\n }\n addResource(lng, ns, key, value) {\n let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {\n silent: false\n };\n const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;\n let path = [lng, ns];\n if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);\n if (lng.indexOf('.') > -1) {\n path = lng.split('.');\n value = ns;\n ns = path[1];\n }\n this.addNamespaces(ns);\n setPath(this.data, path, value);\n if (!options.silent) this.emit('added', lng, ns, key, value);\n }\n addResources(lng, ns, resources) {\n let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {\n silent: false\n };\n for (const m in resources) {\n if (typeof resources[m] === 'string' || Object.prototype.toString.apply(resources[m]) === '[object Array]') this.addResource(lng, ns, m, resources[m], {\n silent: true\n });\n }\n if (!options.silent) this.emit('added', lng, ns, resources);\n }\n addResourceBundle(lng, ns, resources, deep, overwrite) {\n let options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {\n silent: false\n };\n let path = [lng, ns];\n if (lng.indexOf('.') > -1) {\n path = lng.split('.');\n deep = resources;\n resources = ns;\n ns = path[1];\n }\n this.addNamespaces(ns);\n let pack = getPath(this.data, path) || {};\n if (deep) {\n deepExtend(pack, resources, overwrite);\n } else {\n pack = {\n ...pack,\n ...resources\n };\n }\n setPath(this.data, path, pack);\n if (!options.silent) this.emit('added', lng, ns, resources);\n }\n removeResourceBundle(lng, ns) {\n if (this.hasResourceBundle(lng, ns)) {\n delete this.data[lng][ns];\n }\n this.removeNamespaces(ns);\n this.emit('removed', lng, ns);\n }\n hasResourceBundle(lng, ns) {\n return this.getResource(lng, ns) !== undefined;\n }\n getResourceBundle(lng, ns) {\n if (!ns) ns = this.options.defaultNS;\n if (this.options.compatibilityAPI === 'v1') return {\n ...{},\n ...this.getResource(lng, ns)\n };\n return this.getResource(lng, ns);\n }\n getDataByLanguage(lng) {\n return this.data[lng];\n }\n hasLanguageSomeTranslations(lng) {\n const data = this.getDataByLanguage(lng);\n const n = data && Object.keys(data) || [];\n return !!n.find(v => data[v] && Object.keys(data[v]).length > 0);\n }\n toJSON() {\n return this.data;\n }\n}\n\nvar postProcessor = {\n processors: {},\n addPostProcessor(module) {\n this.processors[module.name] = module;\n },\n handle(processors, value, key, options, translator) {\n processors.forEach(processor => {\n if (this.processors[processor]) value = this.processors[processor].process(value, key, options, translator);\n });\n return value;\n }\n};\n\nconst checkedLoadedFor = {};\nclass Translator extends EventEmitter {\n constructor(services) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n super();\n copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector', 'i18nFormat', 'utils'], services, this);\n this.options = options;\n if (this.options.keySeparator === undefined) {\n this.options.keySeparator = '.';\n }\n this.logger = baseLogger.create('translator');\n }\n changeLanguage(lng) {\n if (lng) this.language = lng;\n }\n exists(key) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n interpolation: {}\n };\n if (key === undefined || key === null) {\n return false;\n }\n const resolved = this.resolve(key, options);\n return resolved && resolved.res !== undefined;\n }\n extractFromKey(key, options) {\n let nsSeparator = options.nsSeparator !== undefined ? options.nsSeparator : this.options.nsSeparator;\n if (nsSeparator === undefined) nsSeparator = ':';\n const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;\n let namespaces = options.ns || this.options.defaultNS || [];\n const wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;\n const seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !options.keySeparator && !this.options.userDefinedNsSeparator && !options.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);\n if (wouldCheckForNsInKey && !seemsNaturalLanguage) {\n const m = key.match(this.interpolator.nestingRegexp);\n if (m && m.length > 0) {\n return {\n key,\n namespaces\n };\n }\n const parts = key.split(nsSeparator);\n if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();\n key = parts.join(keySeparator);\n }\n if (typeof namespaces === 'string') namespaces = [namespaces];\n return {\n key,\n namespaces\n };\n }\n translate(keys, options, lastKey) {\n if (typeof options !== 'object' && this.options.overloadTranslationOptionHandler) {\n options = this.options.overloadTranslationOptionHandler(arguments);\n }\n if (typeof options === 'object') options = {\n ...options\n };\n if (!options) options = {};\n if (keys === undefined || keys === null) return '';\n if (!Array.isArray(keys)) keys = [String(keys)];\n const returnDetails = options.returnDetails !== undefined ? options.returnDetails : this.options.returnDetails;\n const keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;\n const {\n key,\n namespaces\n } = this.extractFromKey(keys[keys.length - 1], options);\n const namespace = namespaces[namespaces.length - 1];\n const lng = options.lng || this.language;\n const appendNamespaceToCIMode = options.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;\n if (lng && lng.toLowerCase() === 'cimode') {\n if (appendNamespaceToCIMode) {\n const nsSeparator = options.nsSeparator || this.options.nsSeparator;\n if (returnDetails) {\n return {\n res: `${namespace}${nsSeparator}${key}`,\n usedKey: key,\n exactUsedKey: key,\n usedLng: lng,\n usedNS: namespace,\n usedParams: this.getUsedParamsDetails(options)\n };\n }\n return `${namespace}${nsSeparator}${key}`;\n }\n if (returnDetails) {\n return {\n res: key,\n usedKey: key,\n exactUsedKey: key,\n usedLng: lng,\n usedNS: namespace,\n usedParams: this.getUsedParamsDetails(options)\n };\n }\n return key;\n }\n const resolved = this.resolve(keys, options);\n let res = resolved && resolved.res;\n const resUsedKey = resolved && resolved.usedKey || key;\n const resExactUsedKey = resolved && resolved.exactUsedKey || key;\n const resType = Object.prototype.toString.apply(res);\n const noObject = ['[object Number]', '[object Function]', '[object RegExp]'];\n const joinArrays = options.joinArrays !== undefined ? options.joinArrays : this.options.joinArrays;\n const handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;\n const handleAsObject = typeof res !== 'string' && typeof res !== 'boolean' && typeof res !== 'number';\n if (handleAsObjectInI18nFormat && res && handleAsObject && noObject.indexOf(resType) < 0 && !(typeof joinArrays === 'string' && resType === '[object Array]')) {\n if (!options.returnObjects && !this.options.returnObjects) {\n if (!this.options.returnedObjectHandler) {\n this.logger.warn('accessing an object - but returnObjects options is not enabled!');\n }\n const r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, {\n ...options,\n ns: namespaces\n }) : `key '${key} (${this.language})' returned an object instead of string.`;\n if (returnDetails) {\n resolved.res = r;\n resolved.usedParams = this.getUsedParamsDetails(options);\n return resolved;\n }\n return r;\n }\n if (keySeparator) {\n const resTypeIsArray = resType === '[object Array]';\n const copy = resTypeIsArray ? [] : {};\n const newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;\n for (const m in res) {\n if (Object.prototype.hasOwnProperty.call(res, m)) {\n const deepKey = `${newKeyToUse}${keySeparator}${m}`;\n copy[m] = this.translate(deepKey, {\n ...options,\n ...{\n joinArrays: false,\n ns: namespaces\n }\n });\n if (copy[m] === deepKey) copy[m] = res[m];\n }\n }\n res = copy;\n }\n } else if (handleAsObjectInI18nFormat && typeof joinArrays === 'string' && resType === '[object Array]') {\n res = res.join(joinArrays);\n if (res) res = this.extendTranslation(res, keys, options, lastKey);\n } else {\n let usedDefault = false;\n let usedKey = false;\n const needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';\n const hasDefaultValue = Translator.hasDefaultValue(options);\n const defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, options) : '';\n const defaultValueSuffixOrdinalFallback = options.ordinal && needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, {\n ordinal: false\n }) : '';\n const defaultValue = options[`defaultValue${defaultValueSuffix}`] || options[`defaultValue${defaultValueSuffixOrdinalFallback}`] || options.defaultValue;\n if (!this.isValidLookup(res) && hasDefaultValue) {\n usedDefault = true;\n res = defaultValue;\n }\n if (!this.isValidLookup(res)) {\n usedKey = true;\n res = key;\n }\n const missingKeyNoValueFallbackToKey = options.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;\n const resForMissing = missingKeyNoValueFallbackToKey && usedKey ? undefined : res;\n const updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;\n if (usedKey || usedDefault || updateMissing) {\n this.logger.log(updateMissing ? 'updateKey' : 'missingKey', lng, namespace, key, updateMissing ? defaultValue : res);\n if (keySeparator) {\n const fk = this.resolve(key, {\n ...options,\n keySeparator: false\n });\n if (fk && fk.res) this.logger.warn('Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.');\n }\n let lngs = [];\n const fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, options.lng || this.language);\n if (this.options.saveMissingTo === 'fallback' && fallbackLngs && fallbackLngs[0]) {\n for (let i = 0; i < fallbackLngs.length; i++) {\n lngs.push(fallbackLngs[i]);\n }\n } else if (this.options.saveMissingTo === 'all') {\n lngs = this.languageUtils.toResolveHierarchy(options.lng || this.language);\n } else {\n lngs.push(options.lng || this.language);\n }\n const send = (l, k, specificDefaultValue) => {\n const defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;\n if (this.options.missingKeyHandler) {\n this.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, options);\n } else if (this.backendConnector && this.backendConnector.saveMissing) {\n this.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, options);\n }\n this.emit('missingKey', l, namespace, k, res);\n };\n if (this.options.saveMissing) {\n if (this.options.saveMissingPlurals && needsPluralHandling) {\n lngs.forEach(language => {\n this.pluralResolver.getSuffixes(language, options).forEach(suffix => {\n send([language], key + suffix, options[`defaultValue${suffix}`] || defaultValue);\n });\n });\n } else {\n send(lngs, key, defaultValue);\n }\n }\n }\n res = this.extendTranslation(res, keys, options, resolved, lastKey);\n if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = `${namespace}:${key}`;\n if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {\n if (this.options.compatibilityAPI !== 'v1') {\n res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}:${key}` : key, usedDefault ? res : undefined);\n } else {\n res = this.options.parseMissingKeyHandler(res);\n }\n }\n }\n if (returnDetails) {\n resolved.res = res;\n resolved.usedParams = this.getUsedParamsDetails(options);\n return resolved;\n }\n return res;\n }\n extendTranslation(res, key, options, resolved, lastKey) {\n var _this = this;\n if (this.i18nFormat && this.i18nFormat.parse) {\n res = this.i18nFormat.parse(res, {\n ...this.options.interpolation.defaultVariables,\n ...options\n }, options.lng || this.language || resolved.usedLng, resolved.usedNS, resolved.usedKey, {\n resolved\n });\n } else if (!options.skipInterpolation) {\n if (options.interpolation) this.interpolator.init({\n ...options,\n ...{\n interpolation: {\n ...this.options.interpolation,\n ...options.interpolation\n }\n }\n });\n const skipOnVariables = typeof res === 'string' && (options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);\n let nestBef;\n if (skipOnVariables) {\n const nb = res.match(this.interpolator.nestingRegexp);\n nestBef = nb && nb.length;\n }\n let data = options.replace && typeof options.replace !== 'string' ? options.replace : options;\n if (this.options.interpolation.defaultVariables) data = {\n ...this.options.interpolation.defaultVariables,\n ...data\n };\n res = this.interpolator.interpolate(res, data, options.lng || this.language, options);\n if (skipOnVariables) {\n const na = res.match(this.interpolator.nestingRegexp);\n const nestAft = na && na.length;\n if (nestBef < nestAft) options.nest = false;\n }\n if (!options.lng && this.options.compatibilityAPI !== 'v1' && resolved && resolved.res) options.lng = resolved.usedLng;\n if (options.nest !== false) res = this.interpolator.nest(res, function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (lastKey && lastKey[0] === args[0] && !options.context) {\n _this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`);\n return null;\n }\n return _this.translate(...args, key);\n }, options);\n if (options.interpolation) this.interpolator.reset();\n }\n const postProcess = options.postProcess || this.options.postProcess;\n const postProcessorNames = typeof postProcess === 'string' ? [postProcess] : postProcess;\n if (res !== undefined && res !== null && postProcessorNames && postProcessorNames.length && options.applyPostProcessor !== false) {\n res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? {\n i18nResolved: {\n ...resolved,\n usedParams: this.getUsedParamsDetails(options)\n },\n ...options\n } : options, this);\n }\n return res;\n }\n resolve(keys) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n let found;\n let usedKey;\n let exactUsedKey;\n let usedLng;\n let usedNS;\n if (typeof keys === 'string') keys = [keys];\n keys.forEach(k => {\n if (this.isValidLookup(found)) return;\n const extracted = this.extractFromKey(k, options);\n const key = extracted.key;\n usedKey = key;\n let namespaces = extracted.namespaces;\n if (this.options.fallbackNS) namespaces = namespaces.concat(this.options.fallbackNS);\n const needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';\n const needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0 && this.pluralResolver.shouldUseIntlApi();\n const needsContextHandling = options.context !== undefined && (typeof options.context === 'string' || typeof options.context === 'number') && options.context !== '';\n const codes = options.lngs ? options.lngs : this.languageUtils.toResolveHierarchy(options.lng || this.language, options.fallbackLng);\n namespaces.forEach(ns => {\n if (this.isValidLookup(found)) return;\n usedNS = ns;\n if (!checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils && this.utils.hasLoadedNamespace && !this.utils.hasLoadedNamespace(usedNS)) {\n checkedLoadedFor[`${codes[0]}-${ns}`] = true;\n this.logger.warn(`key \"${usedKey}\" for languages \"${codes.join(', ')}\" won't get resolved as namespace \"${usedNS}\" was not yet loaded`, 'This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!');\n }\n codes.forEach(code => {\n if (this.isValidLookup(found)) return;\n usedLng = code;\n const finalKeys = [key];\n if (this.i18nFormat && this.i18nFormat.addLookupKeys) {\n this.i18nFormat.addLookupKeys(finalKeys, key, code, ns, options);\n } else {\n let pluralSuffix;\n if (needsPluralHandling) pluralSuffix = this.pluralResolver.getSuffix(code, options.count, options);\n const zeroSuffix = `${this.options.pluralSeparator}zero`;\n const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;\n if (needsPluralHandling) {\n finalKeys.push(key + pluralSuffix);\n if (options.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {\n finalKeys.push(key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));\n }\n if (needsZeroSuffixLookup) {\n finalKeys.push(key + zeroSuffix);\n }\n }\n if (needsContextHandling) {\n const contextKey = `${key}${this.options.contextSeparator}${options.context}`;\n finalKeys.push(contextKey);\n if (needsPluralHandling) {\n finalKeys.push(contextKey + pluralSuffix);\n if (options.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {\n finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));\n }\n if (needsZeroSuffixLookup) {\n finalKeys.push(contextKey + zeroSuffix);\n }\n }\n }\n }\n let possibleKey;\n while (possibleKey = finalKeys.pop()) {\n if (!this.isValidLookup(found)) {\n exactUsedKey = possibleKey;\n found = this.getResource(code, ns, possibleKey, options);\n }\n }\n });\n });\n });\n return {\n res: found,\n usedKey,\n exactUsedKey,\n usedLng,\n usedNS\n };\n }\n isValidLookup(res) {\n return res !== undefined && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === '');\n }\n getResource(code, ns, key) {\n let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n if (this.i18nFormat && this.i18nFormat.getResource) return this.i18nFormat.getResource(code, ns, key, options);\n return this.resourceStore.getResource(code, ns, key, options);\n }\n getUsedParamsDetails() {\n let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n const optionsKeys = ['defaultValue', 'ordinal', 'context', 'replace', 'lng', 'lngs', 'fallbackLng', 'ns', 'keySeparator', 'nsSeparator', 'returnObjects', 'returnDetails', 'joinArrays', 'postProcess', 'interpolation'];\n const useOptionsReplaceForData = options.replace && typeof options.replace !== 'string';\n let data = useOptionsReplaceForData ? options.replace : options;\n if (useOptionsReplaceForData && typeof options.count !== 'undefined') {\n data.count = options.count;\n }\n if (this.options.interpolation.defaultVariables) {\n data = {\n ...this.options.interpolation.defaultVariables,\n ...data\n };\n }\n if (!useOptionsReplaceForData) {\n data = {\n ...data\n };\n for (const key of optionsKeys) {\n delete data[key];\n }\n }\n return data;\n }\n static hasDefaultValue(options) {\n const prefix = 'defaultValue';\n for (const option in options) {\n if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && undefined !== options[option]) {\n return true;\n }\n }\n return false;\n }\n}\n\nfunction capitalize(string) {\n return string.charAt(0).toUpperCase() + string.slice(1);\n}\nclass LanguageUtil {\n constructor(options) {\n this.options = options;\n this.supportedLngs = this.options.supportedLngs || false;\n this.logger = baseLogger.create('languageUtils');\n }\n getScriptPartFromCode(code) {\n code = getCleanedCode(code);\n if (!code || code.indexOf('-') < 0) return null;\n const p = code.split('-');\n if (p.length === 2) return null;\n p.pop();\n if (p[p.length - 1].toLowerCase() === 'x') return null;\n return this.formatLanguageCode(p.join('-'));\n }\n getLanguagePartFromCode(code) {\n code = getCleanedCode(code);\n if (!code || code.indexOf('-') < 0) return code;\n const p = code.split('-');\n return this.formatLanguageCode(p[0]);\n }\n formatLanguageCode(code) {\n if (typeof code === 'string' && code.indexOf('-') > -1) {\n const specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab'];\n let p = code.split('-');\n if (this.options.lowerCaseLng) {\n p = p.map(part => part.toLowerCase());\n } else if (p.length === 2) {\n p[0] = p[0].toLowerCase();\n p[1] = p[1].toUpperCase();\n if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());\n } else if (p.length === 3) {\n p[0] = p[0].toLowerCase();\n if (p[1].length === 2) p[1] = p[1].toUpperCase();\n if (p[0] !== 'sgn' && p[2].length === 2) p[2] = p[2].toUpperCase();\n if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());\n if (specialCases.indexOf(p[2].toLowerCase()) > -1) p[2] = capitalize(p[2].toLowerCase());\n }\n return p.join('-');\n }\n return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;\n }\n isSupportedCode(code) {\n if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {\n code = this.getLanguagePartFromCode(code);\n }\n return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;\n }\n getBestMatchFromCodes(codes) {\n if (!codes) return null;\n let found;\n codes.forEach(code => {\n if (found) return;\n const cleanedLng = this.formatLanguageCode(code);\n if (!this.options.supportedLngs || this.isSupportedCode(cleanedLng)) found = cleanedLng;\n });\n if (!found && this.options.supportedLngs) {\n codes.forEach(code => {\n if (found) return;\n const lngOnly = this.getLanguagePartFromCode(code);\n if (this.isSupportedCode(lngOnly)) return found = lngOnly;\n found = this.options.supportedLngs.find(supportedLng => {\n if (supportedLng === lngOnly) return supportedLng;\n if (supportedLng.indexOf('-') < 0 && lngOnly.indexOf('-') < 0) return;\n if (supportedLng.indexOf(lngOnly) === 0) return supportedLng;\n });\n });\n }\n if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];\n return found;\n }\n getFallbackCodes(fallbacks, code) {\n if (!fallbacks) return [];\n if (typeof fallbacks === 'function') fallbacks = fallbacks(code);\n if (typeof fallbacks === 'string') fallbacks = [fallbacks];\n if (Object.prototype.toString.apply(fallbacks) === '[object Array]') return fallbacks;\n if (!code) return fallbacks.default || [];\n let found = fallbacks[code];\n if (!found) found = fallbacks[this.getScriptPartFromCode(code)];\n if (!found) found = fallbacks[this.formatLanguageCode(code)];\n if (!found) found = fallbacks[this.getLanguagePartFromCode(code)];\n if (!found) found = fallbacks.default;\n return found || [];\n }\n toResolveHierarchy(code, fallbackCode) {\n const fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);\n const codes = [];\n const addCode = c => {\n if (!c) return;\n if (this.isSupportedCode(c)) {\n codes.push(c);\n } else {\n this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`);\n }\n };\n if (typeof code === 'string' && (code.indexOf('-') > -1 || code.indexOf('_') > -1)) {\n if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));\n if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));\n if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));\n } else if (typeof code === 'string') {\n addCode(this.formatLanguageCode(code));\n }\n fallbackCodes.forEach(fc => {\n if (codes.indexOf(fc) < 0) addCode(this.formatLanguageCode(fc));\n });\n return codes;\n }\n}\n\nlet sets = [{\n lngs: ['ach', 'ak', 'am', 'arn', 'br', 'fil', 'gun', 'ln', 'mfe', 'mg', 'mi', 'oc', 'pt', 'pt-BR', 'tg', 'tl', 'ti', 'tr', 'uz', 'wa'],\n nr: [1, 2],\n fc: 1\n}, {\n lngs: ['af', 'an', 'ast', 'az', 'bg', 'bn', 'ca', 'da', 'de', 'dev', 'el', 'en', 'eo', 'es', 'et', 'eu', 'fi', 'fo', 'fur', 'fy', 'gl', 'gu', 'ha', 'hi', 'hu', 'hy', 'ia', 'it', 'kk', 'kn', 'ku', 'lb', 'mai', 'ml', 'mn', 'mr', 'nah', 'nap', 'nb', 'ne', 'nl', 'nn', 'no', 'nso', 'pa', 'pap', 'pms', 'ps', 'pt-PT', 'rm', 'sco', 'se', 'si', 'so', 'son', 'sq', 'sv', 'sw', 'ta', 'te', 'tk', 'ur', 'yo'],\n nr: [1, 2],\n fc: 2\n}, {\n lngs: ['ay', 'bo', 'cgg', 'fa', 'ht', 'id', 'ja', 'jbo', 'ka', 'km', 'ko', 'ky', 'lo', 'ms', 'sah', 'su', 'th', 'tt', 'ug', 'vi', 'wo', 'zh'],\n nr: [1],\n fc: 3\n}, {\n lngs: ['be', 'bs', 'cnr', 'dz', 'hr', 'ru', 'sr', 'uk'],\n nr: [1, 2, 5],\n fc: 4\n}, {\n lngs: ['ar'],\n nr: [0, 1, 2, 3, 11, 100],\n fc: 5\n}, {\n lngs: ['cs', 'sk'],\n nr: [1, 2, 5],\n fc: 6\n}, {\n lngs: ['csb', 'pl'],\n nr: [1, 2, 5],\n fc: 7\n}, {\n lngs: ['cy'],\n nr: [1, 2, 3, 8],\n fc: 8\n}, {\n lngs: ['fr'],\n nr: [1, 2],\n fc: 9\n}, {\n lngs: ['ga'],\n nr: [1, 2, 3, 7, 11],\n fc: 10\n}, {\n lngs: ['gd'],\n nr: [1, 2, 3, 20],\n fc: 11\n}, {\n lngs: ['is'],\n nr: [1, 2],\n fc: 12\n}, {\n lngs: ['jv'],\n nr: [0, 1],\n fc: 13\n}, {\n lngs: ['kw'],\n nr: [1, 2, 3, 4],\n fc: 14\n}, {\n lngs: ['lt'],\n nr: [1, 2, 10],\n fc: 15\n}, {\n lngs: ['lv'],\n nr: [1, 2, 0],\n fc: 16\n}, {\n lngs: ['mk'],\n nr: [1, 2],\n fc: 17\n}, {\n lngs: ['mnk'],\n nr: [0, 1, 2],\n fc: 18\n}, {\n lngs: ['mt'],\n nr: [1, 2, 11, 20],\n fc: 19\n}, {\n lngs: ['or'],\n nr: [2, 1],\n fc: 2\n}, {\n lngs: ['ro'],\n nr: [1, 2, 20],\n fc: 20\n}, {\n lngs: ['sl'],\n nr: [5, 1, 2, 3],\n fc: 21\n}, {\n lngs: ['he', 'iw'],\n nr: [1, 2, 20, 21],\n fc: 22\n}];\nlet _rulesPluralsTypes = {\n 1: function (n) {\n return Number(n > 1);\n },\n 2: function (n) {\n return Number(n != 1);\n },\n 3: function (n) {\n return 0;\n },\n 4: function (n) {\n return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);\n },\n 5: function (n) {\n return Number(n == 0 ? 0 : n == 1 ? 1 : n == 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5);\n },\n 6: function (n) {\n return Number(n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2);\n },\n 7: function (n) {\n return Number(n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);\n },\n 8: function (n) {\n return Number(n == 1 ? 0 : n == 2 ? 1 : n != 8 && n != 11 ? 2 : 3);\n },\n 9: function (n) {\n return Number(n >= 2);\n },\n 10: function (n) {\n return Number(n == 1 ? 0 : n == 2 ? 1 : n < 7 ? 2 : n < 11 ? 3 : 4);\n },\n 11: function (n) {\n return Number(n == 1 || n == 11 ? 0 : n == 2 || n == 12 ? 1 : n > 2 && n < 20 ? 2 : 3);\n },\n 12: function (n) {\n return Number(n % 10 != 1 || n % 100 == 11);\n },\n 13: function (n) {\n return Number(n !== 0);\n },\n 14: function (n) {\n return Number(n == 1 ? 0 : n == 2 ? 1 : n == 3 ? 2 : 3);\n },\n 15: function (n) {\n return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);\n },\n 16: function (n) {\n return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n !== 0 ? 1 : 2);\n },\n 17: function (n) {\n return Number(n == 1 || n % 10 == 1 && n % 100 != 11 ? 0 : 1);\n },\n 18: function (n) {\n return Number(n == 0 ? 0 : n == 1 ? 1 : 2);\n },\n 19: function (n) {\n return Number(n == 1 ? 0 : n == 0 || n % 100 > 1 && n % 100 < 11 ? 1 : n % 100 > 10 && n % 100 < 20 ? 2 : 3);\n },\n 20: function (n) {\n return Number(n == 1 ? 0 : n == 0 || n % 100 > 0 && n % 100 < 20 ? 1 : 2);\n },\n 21: function (n) {\n return Number(n % 100 == 1 ? 1 : n % 100 == 2 ? 2 : n % 100 == 3 || n % 100 == 4 ? 3 : 0);\n },\n 22: function (n) {\n return Number(n == 1 ? 0 : n == 2 ? 1 : (n < 0 || n > 10) && n % 10 == 0 ? 2 : 3);\n }\n};\nconst nonIntlVersions = ['v1', 'v2', 'v3'];\nconst intlVersions = ['v4'];\nconst suffixesOrder = {\n zero: 0,\n one: 1,\n two: 2,\n few: 3,\n many: 4,\n other: 5\n};\nfunction createRules() {\n const rules = {};\n sets.forEach(set => {\n set.lngs.forEach(l => {\n rules[l] = {\n numbers: set.nr,\n plurals: _rulesPluralsTypes[set.fc]\n };\n });\n });\n return rules;\n}\nclass PluralResolver {\n constructor(languageUtils) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n this.languageUtils = languageUtils;\n this.options = options;\n this.logger = baseLogger.create('pluralResolver');\n if ((!this.options.compatibilityJSON || intlVersions.includes(this.options.compatibilityJSON)) && (typeof Intl === 'undefined' || !Intl.PluralRules)) {\n this.options.compatibilityJSON = 'v3';\n this.logger.error('Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.');\n }\n this.rules = createRules();\n }\n addRule(lng, obj) {\n this.rules[lng] = obj;\n }\n getRule(code) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n if (this.shouldUseIntlApi()) {\n try {\n return new Intl.PluralRules(getCleanedCode(code), {\n type: options.ordinal ? 'ordinal' : 'cardinal'\n });\n } catch (err) {\n return;\n }\n }\n return this.rules[code] || this.rules[this.languageUtils.getLanguagePartFromCode(code)];\n }\n needsPlural(code) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n const rule = this.getRule(code, options);\n if (this.shouldUseIntlApi()) {\n return rule && rule.resolvedOptions().pluralCategories.length > 1;\n }\n return rule && rule.numbers.length > 1;\n }\n getPluralFormsOfKey(code, key) {\n let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n return this.getSuffixes(code, options).map(suffix => `${key}${suffix}`);\n }\n getSuffixes(code) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n const rule = this.getRule(code, options);\n if (!rule) {\n return [];\n }\n if (this.shouldUseIntlApi()) {\n return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map(pluralCategory => `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ''}${pluralCategory}`);\n }\n return rule.numbers.map(number => this.getSuffix(code, number, options));\n }\n getSuffix(code, count) {\n let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n const rule = this.getRule(code, options);\n if (rule) {\n if (this.shouldUseIntlApi()) {\n return `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ''}${rule.select(count)}`;\n }\n return this.getSuffixRetroCompatible(rule, count);\n }\n this.logger.warn(`no plural rule found for: ${code}`);\n return '';\n }\n getSuffixRetroCompatible(rule, count) {\n const idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count));\n let suffix = rule.numbers[idx];\n if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {\n if (suffix === 2) {\n suffix = 'plural';\n } else if (suffix === 1) {\n suffix = '';\n }\n }\n const returnSuffix = () => this.options.prepend && suffix.toString() ? this.options.prepend + suffix.toString() : suffix.toString();\n if (this.options.compatibilityJSON === 'v1') {\n if (suffix === 1) return '';\n if (typeof suffix === 'number') return `_plural_${suffix.toString()}`;\n return returnSuffix();\n } else if (this.options.compatibilityJSON === 'v2') {\n return returnSuffix();\n } else if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {\n return returnSuffix();\n }\n return this.options.prepend && idx.toString() ? this.options.prepend + idx.toString() : idx.toString();\n }\n shouldUseIntlApi() {\n return !nonIntlVersions.includes(this.options.compatibilityJSON);\n }\n}\n\nfunction deepFindWithDefaults(data, defaultData, key) {\n let keySeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '.';\n let ignoreJSONStructure = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;\n let path = getPathWithDefaults(data, defaultData, key);\n if (!path && ignoreJSONStructure && typeof key === 'string') {\n path = deepFind(data, key, keySeparator);\n if (path === undefined) path = deepFind(defaultData, key, keySeparator);\n }\n return path;\n}\nclass Interpolator {\n constructor() {\n let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.logger = baseLogger.create('interpolator');\n this.options = options;\n this.format = options.interpolation && options.interpolation.format || (value => value);\n this.init(options);\n }\n init() {\n let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n if (!options.interpolation) options.interpolation = {\n escapeValue: true\n };\n const iOpts = options.interpolation;\n this.escape = iOpts.escape !== undefined ? iOpts.escape : escape;\n this.escapeValue = iOpts.escapeValue !== undefined ? iOpts.escapeValue : true;\n this.useRawValueToEscape = iOpts.useRawValueToEscape !== undefined ? iOpts.useRawValueToEscape : false;\n this.prefix = iOpts.prefix ? regexEscape(iOpts.prefix) : iOpts.prefixEscaped || '{{';\n this.suffix = iOpts.suffix ? regexEscape(iOpts.suffix) : iOpts.suffixEscaped || '}}';\n this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';\n this.unescapePrefix = iOpts.unescapeSuffix ? '' : iOpts.unescapePrefix || '-';\n this.unescapeSuffix = this.unescapePrefix ? '' : iOpts.unescapeSuffix || '';\n this.nestingPrefix = iOpts.nestingPrefix ? regexEscape(iOpts.nestingPrefix) : iOpts.nestingPrefixEscaped || regexEscape('$t(');\n this.nestingSuffix = iOpts.nestingSuffix ? regexEscape(iOpts.nestingSuffix) : iOpts.nestingSuffixEscaped || regexEscape(')');\n this.nestingOptionsSeparator = iOpts.nestingOptionsSeparator ? iOpts.nestingOptionsSeparator : iOpts.nestingOptionsSeparator || ',';\n this.maxReplaces = iOpts.maxReplaces ? iOpts.maxReplaces : 1000;\n this.alwaysFormat = iOpts.alwaysFormat !== undefined ? iOpts.alwaysFormat : false;\n this.resetRegExp();\n }\n reset() {\n if (this.options) this.init(this.options);\n }\n resetRegExp() {\n const regexpStr = `${this.prefix}(.+?)${this.suffix}`;\n this.regexp = new RegExp(regexpStr, 'g');\n const regexpUnescapeStr = `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;\n this.regexpUnescape = new RegExp(regexpUnescapeStr, 'g');\n const nestingRegexpStr = `${this.nestingPrefix}(.+?)${this.nestingSuffix}`;\n this.nestingRegexp = new RegExp(nestingRegexpStr, 'g');\n }\n interpolate(str, data, lng, options) {\n let match;\n let value;\n let replaces;\n const defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};\n function regexSafe(val) {\n return val.replace(/\\$/g, '$$$$');\n }\n const handleFormat = key => {\n if (key.indexOf(this.formatSeparator) < 0) {\n const path = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure);\n return this.alwaysFormat ? this.format(path, undefined, lng, {\n ...options,\n ...data,\n interpolationkey: key\n }) : path;\n }\n const p = key.split(this.formatSeparator);\n const k = p.shift().trim();\n const f = p.join(this.formatSeparator).trim();\n return this.format(deepFindWithDefaults(data, defaultData, k, this.options.keySeparator, this.options.ignoreJSONStructure), f, lng, {\n ...options,\n ...data,\n interpolationkey: k\n });\n };\n this.resetRegExp();\n const missingInterpolationHandler = options && options.missingInterpolationHandler || this.options.missingInterpolationHandler;\n const skipOnVariables = options && options.interpolation && options.interpolation.skipOnVariables !== undefined ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;\n const todos = [{\n regex: this.regexpUnescape,\n safeValue: val => regexSafe(val)\n }, {\n regex: this.regexp,\n safeValue: val => this.escapeValue ? regexSafe(this.escape(val)) : regexSafe(val)\n }];\n todos.forEach(todo => {\n replaces = 0;\n while (match = todo.regex.exec(str)) {\n const matchedVar = match[1].trim();\n value = handleFormat(matchedVar);\n if (value === undefined) {\n if (typeof missingInterpolationHandler === 'function') {\n const temp = missingInterpolationHandler(str, match, options);\n value = typeof temp === 'string' ? temp : '';\n } else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {\n value = '';\n } else if (skipOnVariables) {\n value = match[0];\n continue;\n } else {\n this.logger.warn(`missed to pass in variable ${matchedVar} for interpolating ${str}`);\n value = '';\n }\n } else if (typeof value !== 'string' && !this.useRawValueToEscape) {\n value = makeString(value);\n }\n const safeValue = todo.safeValue(value);\n str = str.replace(match[0], safeValue);\n if (skipOnVariables) {\n todo.regex.lastIndex += value.length;\n todo.regex.lastIndex -= match[0].length;\n } else {\n todo.regex.lastIndex = 0;\n }\n replaces++;\n if (replaces >= this.maxReplaces) {\n break;\n }\n }\n });\n return str;\n }\n nest(str, fc) {\n let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n let match;\n let value;\n let clonedOptions;\n function handleHasOptions(key, inheritedOptions) {\n const sep = this.nestingOptionsSeparator;\n if (key.indexOf(sep) < 0) return key;\n const c = key.split(new RegExp(`${sep}[ ]*{`));\n let optionsString = `{${c[1]}`;\n key = c[0];\n optionsString = this.interpolate(optionsString, clonedOptions);\n const matchedSingleQuotes = optionsString.match(/'/g);\n const matchedDoubleQuotes = optionsString.match(/\"/g);\n if (matchedSingleQuotes && matchedSingleQuotes.length % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) {\n optionsString = optionsString.replace(/'/g, '\"');\n }\n try {\n clonedOptions = JSON.parse(optionsString);\n if (inheritedOptions) clonedOptions = {\n ...inheritedOptions,\n ...clonedOptions\n };\n } catch (e) {\n this.logger.warn(`failed parsing options string in nesting for key ${key}`, e);\n return `${key}${sep}${optionsString}`;\n }\n delete clonedOptions.defaultValue;\n return key;\n }\n while (match = this.nestingRegexp.exec(str)) {\n let formatters = [];\n clonedOptions = {\n ...options\n };\n clonedOptions = clonedOptions.replace && typeof clonedOptions.replace !== 'string' ? clonedOptions.replace : clonedOptions;\n clonedOptions.applyPostProcessor = false;\n delete clonedOptions.defaultValue;\n let doReduce = false;\n if (match[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(match[1])) {\n const r = match[1].split(this.formatSeparator).map(elem => elem.trim());\n match[1] = r.shift();\n formatters = r;\n doReduce = true;\n }\n value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);\n if (value && match[0] === str && typeof value !== 'string') return value;\n if (typeof value !== 'string') value = makeString(value);\n if (!value) {\n this.logger.warn(`missed to resolve ${match[1]} for nesting ${str}`);\n value = '';\n }\n if (doReduce) {\n value = formatters.reduce((v, f) => this.format(v, f, options.lng, {\n ...options,\n interpolationkey: match[1].trim()\n }), value.trim());\n }\n str = str.replace(match[0], value);\n this.regexp.lastIndex = 0;\n }\n return str;\n }\n}\n\nfunction parseFormatStr(formatStr) {\n let formatName = formatStr.toLowerCase().trim();\n const formatOptions = {};\n if (formatStr.indexOf('(') > -1) {\n const p = formatStr.split('(');\n formatName = p[0].toLowerCase().trim();\n const optStr = p[1].substring(0, p[1].length - 1);\n if (formatName === 'currency' && optStr.indexOf(':') < 0) {\n if (!formatOptions.currency) formatOptions.currency = optStr.trim();\n } else if (formatName === 'relativetime' && optStr.indexOf(':') < 0) {\n if (!formatOptions.range) formatOptions.range = optStr.trim();\n } else {\n const opts = optStr.split(';');\n opts.forEach(opt => {\n if (!opt) return;\n const [key, ...rest] = opt.split(':');\n const val = rest.join(':').trim().replace(/^'+|'+$/g, '');\n if (!formatOptions[key.trim()]) formatOptions[key.trim()] = val;\n if (val === 'false') formatOptions[key.trim()] = false;\n if (val === 'true') formatOptions[key.trim()] = true;\n if (!isNaN(val)) formatOptions[key.trim()] = parseInt(val, 10);\n });\n }\n }\n return {\n formatName,\n formatOptions\n };\n}\nfunction createCachedFormatter(fn) {\n const cache = {};\n return function invokeFormatter(val, lng, options) {\n const key = lng + JSON.stringify(options);\n let formatter = cache[key];\n if (!formatter) {\n formatter = fn(getCleanedCode(lng), options);\n cache[key] = formatter;\n }\n return formatter(val);\n };\n}\nclass Formatter {\n constructor() {\n let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.logger = baseLogger.create('formatter');\n this.options = options;\n this.formats = {\n number: createCachedFormatter((lng, opt) => {\n const formatter = new Intl.NumberFormat(lng, {\n ...opt\n });\n return val => formatter.format(val);\n }),\n currency: createCachedFormatter((lng, opt) => {\n const formatter = new Intl.NumberFormat(lng, {\n ...opt,\n style: 'currency'\n });\n return val => formatter.format(val);\n }),\n datetime: createCachedFormatter((lng, opt) => {\n const formatter = new Intl.DateTimeFormat(lng, {\n ...opt\n });\n return val => formatter.format(val);\n }),\n relativetime: createCachedFormatter((lng, opt) => {\n const formatter = new Intl.RelativeTimeFormat(lng, {\n ...opt\n });\n return val => formatter.format(val, opt.range || 'day');\n }),\n list: createCachedFormatter((lng, opt) => {\n const formatter = new Intl.ListFormat(lng, {\n ...opt\n });\n return val => formatter.format(val);\n })\n };\n this.init(options);\n }\n init(services) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n interpolation: {}\n };\n const iOpts = options.interpolation;\n this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';\n }\n add(name, fc) {\n this.formats[name.toLowerCase().trim()] = fc;\n }\n addCached(name, fc) {\n this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);\n }\n format(value, format, lng) {\n let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n const formats = format.split(this.formatSeparator);\n const result = formats.reduce((mem, f) => {\n const {\n formatName,\n formatOptions\n } = parseFormatStr(f);\n if (this.formats[formatName]) {\n let formatted = mem;\n try {\n const valOptions = options && options.formatParams && options.formatParams[options.interpolationkey] || {};\n const l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;\n formatted = this.formats[formatName](mem, l, {\n ...formatOptions,\n ...options,\n ...valOptions\n });\n } catch (error) {\n this.logger.warn(error);\n }\n return formatted;\n } else {\n this.logger.warn(`there was no format function for ${formatName}`);\n }\n return mem;\n }, value);\n return result;\n }\n}\n\nfunction removePending(q, name) {\n if (q.pending[name] !== undefined) {\n delete q.pending[name];\n q.pendingCount--;\n }\n}\nclass Connector extends EventEmitter {\n constructor(backend, store, services) {\n let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n super();\n this.backend = backend;\n this.store = store;\n this.services = services;\n this.languageUtils = services.languageUtils;\n this.options = options;\n this.logger = baseLogger.create('backendConnector');\n this.waitingReads = [];\n this.maxParallelReads = options.maxParallelReads || 10;\n this.readingCalls = 0;\n this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;\n this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;\n this.state = {};\n this.queue = [];\n if (this.backend && this.backend.init) {\n this.backend.init(services, options.backend, options);\n }\n }\n queueLoad(languages, namespaces, options, callback) {\n const toLoad = {};\n const pending = {};\n const toLoadLanguages = {};\n const toLoadNamespaces = {};\n languages.forEach(lng => {\n let hasAllNamespaces = true;\n namespaces.forEach(ns => {\n const name = `${lng}|${ns}`;\n if (!options.reload && this.store.hasResourceBundle(lng, ns)) {\n this.state[name] = 2;\n } else if (this.state[name] < 0) ; else if (this.state[name] === 1) {\n if (pending[name] === undefined) pending[name] = true;\n } else {\n this.state[name] = 1;\n hasAllNamespaces = false;\n if (pending[name] === undefined) pending[name] = true;\n if (toLoad[name] === undefined) toLoad[name] = true;\n if (toLoadNamespaces[ns] === undefined) toLoadNamespaces[ns] = true;\n }\n });\n if (!hasAllNamespaces) toLoadLanguages[lng] = true;\n });\n if (Object.keys(toLoad).length || Object.keys(pending).length) {\n this.queue.push({\n pending,\n pendingCount: Object.keys(pending).length,\n loaded: {},\n errors: [],\n callback\n });\n }\n return {\n toLoad: Object.keys(toLoad),\n pending: Object.keys(pending),\n toLoadLanguages: Object.keys(toLoadLanguages),\n toLoadNamespaces: Object.keys(toLoadNamespaces)\n };\n }\n loaded(name, err, data) {\n const s = name.split('|');\n const lng = s[0];\n const ns = s[1];\n if (err) this.emit('failedLoading', lng, ns, err);\n if (data) {\n this.store.addResourceBundle(lng, ns, data);\n }\n this.state[name] = err ? -1 : 2;\n const loaded = {};\n this.queue.forEach(q => {\n pushPath(q.loaded, [lng], ns);\n removePending(q, name);\n if (err) q.errors.push(err);\n if (q.pendingCount === 0 && !q.done) {\n Object.keys(q.loaded).forEach(l => {\n if (!loaded[l]) loaded[l] = {};\n const loadedKeys = q.loaded[l];\n if (loadedKeys.length) {\n loadedKeys.forEach(n => {\n if (loaded[l][n] === undefined) loaded[l][n] = true;\n });\n }\n });\n q.done = true;\n if (q.errors.length) {\n q.callback(q.errors);\n } else {\n q.callback();\n }\n }\n });\n this.emit('loaded', loaded);\n this.queue = this.queue.filter(q => !q.done);\n }\n read(lng, ns, fcName) {\n let tried = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;\n let wait = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : this.retryTimeout;\n let callback = arguments.length > 5 ? arguments[5] : undefined;\n if (!lng.length) return callback(null, {});\n if (this.readingCalls >= this.maxParallelReads) {\n this.waitingReads.push({\n lng,\n ns,\n fcName,\n tried,\n wait,\n callback\n });\n return;\n }\n this.readingCalls++;\n const resolver = (err, data) => {\n this.readingCalls--;\n if (this.waitingReads.length > 0) {\n const next = this.waitingReads.shift();\n this.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);\n }\n if (err && data && tried < this.maxRetries) {\n setTimeout(() => {\n this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback);\n }, wait);\n return;\n }\n callback(err, data);\n };\n const fc = this.backend[fcName].bind(this.backend);\n if (fc.length === 2) {\n try {\n const r = fc(lng, ns);\n if (r && typeof r.then === 'function') {\n r.then(data => resolver(null, data)).catch(resolver);\n } else {\n resolver(null, r);\n }\n } catch (err) {\n resolver(err);\n }\n return;\n }\n return fc(lng, ns, resolver);\n }\n prepareLoading(languages, namespaces) {\n let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n let callback = arguments.length > 3 ? arguments[3] : undefined;\n if (!this.backend) {\n this.logger.warn('No backend was added via i18next.use. Will not load resources.');\n return callback && callback();\n }\n if (typeof languages === 'string') languages = this.languageUtils.toResolveHierarchy(languages);\n if (typeof namespaces === 'string') namespaces = [namespaces];\n const toLoad = this.queueLoad(languages, namespaces, options, callback);\n if (!toLoad.toLoad.length) {\n if (!toLoad.pending.length) callback();\n return null;\n }\n toLoad.toLoad.forEach(name => {\n this.loadOne(name);\n });\n }\n load(languages, namespaces, callback) {\n this.prepareLoading(languages, namespaces, {}, callback);\n }\n reload(languages, namespaces, callback) {\n this.prepareLoading(languages, namespaces, {\n reload: true\n }, callback);\n }\n loadOne(name) {\n let prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n const s = name.split('|');\n const lng = s[0];\n const ns = s[1];\n this.read(lng, ns, 'read', undefined, undefined, (err, data) => {\n if (err) this.logger.warn(`${prefix}loading namespace ${ns} for language ${lng} failed`, err);\n if (!err && data) this.logger.log(`${prefix}loaded namespace ${ns} for language ${lng}`, data);\n this.loaded(name, err, data);\n });\n }\n saveMissing(languages, namespace, key, fallbackValue, isUpdate) {\n let options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};\n let clb = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : () => {};\n if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(namespace)) {\n this.logger.warn(`did not save key \"${key}\" as the namespace \"${namespace}\" was not yet loaded`, 'This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!');\n return;\n }\n if (key === undefined || key === null || key === '') return;\n if (this.backend && this.backend.create) {\n const opts = {\n ...options,\n isUpdate\n };\n const fc = this.backend.create.bind(this.backend);\n if (fc.length < 6) {\n try {\n let r;\n if (fc.length === 5) {\n r = fc(languages, namespace, key, fallbackValue, opts);\n } else {\n r = fc(languages, namespace, key, fallbackValue);\n }\n if (r && typeof r.then === 'function') {\n r.then(data => clb(null, data)).catch(clb);\n } else {\n clb(null, r);\n }\n } catch (err) {\n clb(err);\n }\n } else {\n fc(languages, namespace, key, fallbackValue, clb, opts);\n }\n }\n if (!languages || !languages[0]) return;\n this.store.addResource(languages[0], namespace, key, fallbackValue);\n }\n}\n\nfunction get() {\n return {\n debug: false,\n initImmediate: true,\n ns: ['translation'],\n defaultNS: ['translation'],\n fallbackLng: ['dev'],\n fallbackNS: false,\n supportedLngs: false,\n nonExplicitSupportedLngs: false,\n load: 'all',\n preload: false,\n simplifyPluralSuffix: true,\n keySeparator: '.',\n nsSeparator: ':',\n pluralSeparator: '_',\n contextSeparator: '_',\n partialBundledLanguages: false,\n saveMissing: false,\n updateMissing: false,\n saveMissingTo: 'fallback',\n saveMissingPlurals: true,\n missingKeyHandler: false,\n missingInterpolationHandler: false,\n postProcess: false,\n postProcessPassResolved: false,\n returnNull: false,\n returnEmptyString: true,\n returnObjects: false,\n joinArrays: false,\n returnedObjectHandler: false,\n parseMissingKeyHandler: false,\n appendNamespaceToMissingKey: false,\n appendNamespaceToCIMode: false,\n overloadTranslationOptionHandler: function handle(args) {\n let ret = {};\n if (typeof args[1] === 'object') ret = args[1];\n if (typeof args[1] === 'string') ret.defaultValue = args[1];\n if (typeof args[2] === 'string') ret.tDescription = args[2];\n if (typeof args[2] === 'object' || typeof args[3] === 'object') {\n const options = args[3] || args[2];\n Object.keys(options).forEach(key => {\n ret[key] = options[key];\n });\n }\n return ret;\n },\n interpolation: {\n escapeValue: true,\n format: value => value,\n prefix: '{{',\n suffix: '}}',\n formatSeparator: ',',\n unescapePrefix: '-',\n nestingPrefix: '$t(',\n nestingSuffix: ')',\n nestingOptionsSeparator: ',',\n maxReplaces: 1000,\n skipOnVariables: true\n }\n };\n}\nfunction transformOptions(options) {\n if (typeof options.ns === 'string') options.ns = [options.ns];\n if (typeof options.fallbackLng === 'string') options.fallbackLng = [options.fallbackLng];\n if (typeof options.fallbackNS === 'string') options.fallbackNS = [options.fallbackNS];\n if (options.supportedLngs && options.supportedLngs.indexOf('cimode') < 0) {\n options.supportedLngs = options.supportedLngs.concat(['cimode']);\n }\n return options;\n}\n\nfunction noop() {}\nfunction bindMemberFunctions(inst) {\n const mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));\n mems.forEach(mem => {\n if (typeof inst[mem] === 'function') {\n inst[mem] = inst[mem].bind(inst);\n }\n });\n}\nclass I18n extends EventEmitter {\n constructor() {\n let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let callback = arguments.length > 1 ? arguments[1] : undefined;\n super();\n this.options = transformOptions(options);\n this.services = {};\n this.logger = baseLogger;\n this.modules = {\n external: []\n };\n bindMemberFunctions(this);\n if (callback && !this.isInitialized && !options.isClone) {\n if (!this.options.initImmediate) {\n this.init(options, callback);\n return this;\n }\n setTimeout(() => {\n this.init(options, callback);\n }, 0);\n }\n }\n init() {\n var _this = this;\n let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let callback = arguments.length > 1 ? arguments[1] : undefined;\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n if (!options.defaultNS && options.defaultNS !== false && options.ns) {\n if (typeof options.ns === 'string') {\n options.defaultNS = options.ns;\n } else if (options.ns.indexOf('translation') < 0) {\n options.defaultNS = options.ns[0];\n }\n }\n const defOpts = get();\n this.options = {\n ...defOpts,\n ...this.options,\n ...transformOptions(options)\n };\n if (this.options.compatibilityAPI !== 'v1') {\n this.options.interpolation = {\n ...defOpts.interpolation,\n ...this.options.interpolation\n };\n }\n if (options.keySeparator !== undefined) {\n this.options.userDefinedKeySeparator = options.keySeparator;\n }\n if (options.nsSeparator !== undefined) {\n this.options.userDefinedNsSeparator = options.nsSeparator;\n }\n function createClassOnDemand(ClassOrObject) {\n if (!ClassOrObject) return null;\n if (typeof ClassOrObject === 'function') return new ClassOrObject();\n return ClassOrObject;\n }\n if (!this.options.isClone) {\n if (this.modules.logger) {\n baseLogger.init(createClassOnDemand(this.modules.logger), this.options);\n } else {\n baseLogger.init(null, this.options);\n }\n let formatter;\n if (this.modules.formatter) {\n formatter = this.modules.formatter;\n } else if (typeof Intl !== 'undefined') {\n formatter = Formatter;\n }\n const lu = new LanguageUtil(this.options);\n this.store = new ResourceStore(this.options.resources, this.options);\n const s = this.services;\n s.logger = baseLogger;\n s.resourceStore = this.store;\n s.languageUtils = lu;\n s.pluralResolver = new PluralResolver(lu, {\n prepend: this.options.pluralSeparator,\n compatibilityJSON: this.options.compatibilityJSON,\n simplifyPluralSuffix: this.options.simplifyPluralSuffix\n });\n if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {\n s.formatter = createClassOnDemand(formatter);\n s.formatter.init(s, this.options);\n this.options.interpolation.format = s.formatter.format.bind(s.formatter);\n }\n s.interpolator = new Interpolator(this.options);\n s.utils = {\n hasLoadedNamespace: this.hasLoadedNamespace.bind(this)\n };\n s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);\n s.backendConnector.on('*', function (event) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n _this.emit(event, ...args);\n });\n if (this.modules.languageDetector) {\n s.languageDetector = createClassOnDemand(this.modules.languageDetector);\n if (s.languageDetector.init) s.languageDetector.init(s, this.options.detection, this.options);\n }\n if (this.modules.i18nFormat) {\n s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);\n if (s.i18nFormat.init) s.i18nFormat.init(this);\n }\n this.translator = new Translator(this.services, this.options);\n this.translator.on('*', function (event) {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n _this.emit(event, ...args);\n });\n this.modules.external.forEach(m => {\n if (m.init) m.init(this);\n });\n }\n this.format = this.options.interpolation.format;\n if (!callback) callback = noop;\n if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {\n const codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);\n if (codes.length > 0 && codes[0] !== 'dev') this.options.lng = codes[0];\n }\n if (!this.services.languageDetector && !this.options.lng) {\n this.logger.warn('init: no languageDetector is used and no lng is defined');\n }\n const storeApi = ['getResource', 'hasResourceBundle', 'getResourceBundle', 'getDataByLanguage'];\n storeApi.forEach(fcName => {\n this[fcName] = function () {\n return _this.store[fcName](...arguments);\n };\n });\n const storeApiChained = ['addResource', 'addResources', 'addResourceBundle', 'removeResourceBundle'];\n storeApiChained.forEach(fcName => {\n this[fcName] = function () {\n _this.store[fcName](...arguments);\n return _this;\n };\n });\n const deferred = defer();\n const load = () => {\n const finish = (err, t) => {\n if (this.isInitialized && !this.initializedStoreOnce) this.logger.warn('init: i18next is already initialized. You should call init just once!');\n this.isInitialized = true;\n if (!this.options.isClone) this.logger.log('initialized', this.options);\n this.emit('initialized', this.options);\n deferred.resolve(t);\n callback(err, t);\n };\n if (this.languages && this.options.compatibilityAPI !== 'v1' && !this.isInitialized) return finish(null, this.t.bind(this));\n this.changeLanguage(this.options.lng, finish);\n };\n if (this.options.resources || !this.options.initImmediate) {\n load();\n } else {\n setTimeout(load, 0);\n }\n return deferred;\n }\n loadResources(language) {\n let callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;\n let usedCallback = callback;\n const usedLng = typeof language === 'string' ? language : this.language;\n if (typeof language === 'function') usedCallback = language;\n if (!this.options.resources || this.options.partialBundledLanguages) {\n if (usedLng && usedLng.toLowerCase() === 'cimode' && (!this.options.preload || this.options.preload.length === 0)) return usedCallback();\n const toLoad = [];\n const append = lng => {\n if (!lng) return;\n if (lng === 'cimode') return;\n const lngs = this.services.languageUtils.toResolveHierarchy(lng);\n lngs.forEach(l => {\n if (l === 'cimode') return;\n if (toLoad.indexOf(l) < 0) toLoad.push(l);\n });\n };\n if (!usedLng) {\n const fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);\n fallbacks.forEach(l => append(l));\n } else {\n append(usedLng);\n }\n if (this.options.preload) {\n this.options.preload.forEach(l => append(l));\n }\n this.services.backendConnector.load(toLoad, this.options.ns, e => {\n if (!e && !this.resolvedLanguage && this.language) this.setResolvedLanguage(this.language);\n usedCallback(e);\n });\n } else {\n usedCallback(null);\n }\n }\n reloadResources(lngs, ns, callback) {\n const deferred = defer();\n if (!lngs) lngs = this.languages;\n if (!ns) ns = this.options.ns;\n if (!callback) callback = noop;\n this.services.backendConnector.reload(lngs, ns, err => {\n deferred.resolve();\n callback(err);\n });\n return deferred;\n }\n use(module) {\n if (!module) throw new Error('You are passing an undefined module! Please check the object you are passing to i18next.use()');\n if (!module.type) throw new Error('You are passing a wrong module! Please check the object you are passing to i18next.use()');\n if (module.type === 'backend') {\n this.modules.backend = module;\n }\n if (module.type === 'logger' || module.log && module.warn && module.error) {\n this.modules.logger = module;\n }\n if (module.type === 'languageDetector') {\n this.modules.languageDetector = module;\n }\n if (module.type === 'i18nFormat') {\n this.modules.i18nFormat = module;\n }\n if (module.type === 'postProcessor') {\n postProcessor.addPostProcessor(module);\n }\n if (module.type === 'formatter') {\n this.modules.formatter = module;\n }\n if (module.type === '3rdParty') {\n this.modules.external.push(module);\n }\n return this;\n }\n setResolvedLanguage(l) {\n if (!l || !this.languages) return;\n if (['cimode', 'dev'].indexOf(l) > -1) return;\n for (let li = 0; li < this.languages.length; li++) {\n const lngInLngs = this.languages[li];\n if (['cimode', 'dev'].indexOf(lngInLngs) > -1) continue;\n if (this.store.hasLanguageSomeTranslations(lngInLngs)) {\n this.resolvedLanguage = lngInLngs;\n break;\n }\n }\n }\n changeLanguage(lng, callback) {\n var _this2 = this;\n this.isLanguageChangingTo = lng;\n const deferred = defer();\n this.emit('languageChanging', lng);\n const setLngProps = l => {\n this.language = l;\n this.languages = this.services.languageUtils.toResolveHierarchy(l);\n this.resolvedLanguage = undefined;\n this.setResolvedLanguage(l);\n };\n const done = (err, l) => {\n if (l) {\n setLngProps(l);\n this.translator.changeLanguage(l);\n this.isLanguageChangingTo = undefined;\n this.emit('languageChanged', l);\n this.logger.log('languageChanged', l);\n } else {\n this.isLanguageChangingTo = undefined;\n }\n deferred.resolve(function () {\n return _this2.t(...arguments);\n });\n if (callback) callback(err, function () {\n return _this2.t(...arguments);\n });\n };\n const setLng = lngs => {\n if (!lng && !lngs && this.services.languageDetector) lngs = [];\n const l = typeof lngs === 'string' ? lngs : this.services.languageUtils.getBestMatchFromCodes(lngs);\n if (l) {\n if (!this.language) {\n setLngProps(l);\n }\n if (!this.translator.language) this.translator.changeLanguage(l);\n if (this.services.languageDetector && this.services.languageDetector.cacheUserLanguage) this.services.languageDetector.cacheUserLanguage(l);\n }\n this.loadResources(l, err => {\n done(err, l);\n });\n };\n if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {\n setLng(this.services.languageDetector.detect());\n } else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {\n if (this.services.languageDetector.detect.length === 0) {\n this.services.languageDetector.detect().then(setLng);\n } else {\n this.services.languageDetector.detect(setLng);\n }\n } else {\n setLng(lng);\n }\n return deferred;\n }\n getFixedT(lng, ns, keyPrefix) {\n var _this3 = this;\n const fixedT = function (key, opts) {\n let options;\n if (typeof opts !== 'object') {\n for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {\n rest[_key3 - 2] = arguments[_key3];\n }\n options = _this3.options.overloadTranslationOptionHandler([key, opts].concat(rest));\n } else {\n options = {\n ...opts\n };\n }\n options.lng = options.lng || fixedT.lng;\n options.lngs = options.lngs || fixedT.lngs;\n options.ns = options.ns || fixedT.ns;\n options.keyPrefix = options.keyPrefix || keyPrefix || fixedT.keyPrefix;\n const keySeparator = _this3.options.keySeparator || '.';\n let resultKey;\n if (options.keyPrefix && Array.isArray(key)) {\n resultKey = key.map(k => `${options.keyPrefix}${keySeparator}${k}`);\n } else {\n resultKey = options.keyPrefix ? `${options.keyPrefix}${keySeparator}${key}` : key;\n }\n return _this3.t(resultKey, options);\n };\n if (typeof lng === 'string') {\n fixedT.lng = lng;\n } else {\n fixedT.lngs = lng;\n }\n fixedT.ns = ns;\n fixedT.keyPrefix = keyPrefix;\n return fixedT;\n }\n t() {\n return this.translator && this.translator.translate(...arguments);\n }\n exists() {\n return this.translator && this.translator.exists(...arguments);\n }\n setDefaultNamespace(ns) {\n this.options.defaultNS = ns;\n }\n hasLoadedNamespace(ns) {\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n if (!this.isInitialized) {\n this.logger.warn('hasLoadedNamespace: i18next was not initialized', this.languages);\n return false;\n }\n if (!this.languages || !this.languages.length) {\n this.logger.warn('hasLoadedNamespace: i18n.languages were undefined or empty', this.languages);\n return false;\n }\n const lng = options.lng || this.resolvedLanguage || this.languages[0];\n const fallbackLng = this.options ? this.options.fallbackLng : false;\n const lastLng = this.languages[this.languages.length - 1];\n if (lng.toLowerCase() === 'cimode') return true;\n const loadNotPending = (l, n) => {\n const loadState = this.services.backendConnector.state[`${l}|${n}`];\n return loadState === -1 || loadState === 2;\n };\n if (options.precheck) {\n const preResult = options.precheck(this, loadNotPending);\n if (preResult !== undefined) return preResult;\n }\n if (this.hasResourceBundle(lng, ns)) return true;\n if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages) return true;\n if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;\n return false;\n }\n loadNamespaces(ns, callback) {\n const deferred = defer();\n if (!this.options.ns) {\n if (callback) callback();\n return Promise.resolve();\n }\n if (typeof ns === 'string') ns = [ns];\n ns.forEach(n => {\n if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);\n });\n this.loadResources(err => {\n deferred.resolve();\n if (callback) callback(err);\n });\n return deferred;\n }\n loadLanguages(lngs, callback) {\n const deferred = defer();\n if (typeof lngs === 'string') lngs = [lngs];\n const preloaded = this.options.preload || [];\n const newLngs = lngs.filter(lng => preloaded.indexOf(lng) < 0);\n if (!newLngs.length) {\n if (callback) callback();\n return Promise.resolve();\n }\n this.options.preload = preloaded.concat(newLngs);\n this.loadResources(err => {\n deferred.resolve();\n if (callback) callback(err);\n });\n return deferred;\n }\n dir(lng) {\n if (!lng) lng = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language);\n if (!lng) return 'rtl';\n const rtlLngs = ['ar', 'shu', 'sqr', 'ssh', 'xaa', 'yhd', 'yud', 'aao', 'abh', 'abv', 'acm', 'acq', 'acw', 'acx', 'acy', 'adf', 'ads', 'aeb', 'aec', 'afb', 'ajp', 'apc', 'apd', 'arb', 'arq', 'ars', 'ary', 'arz', 'auz', 'avl', 'ayh', 'ayl', 'ayn', 'ayp', 'bbz', 'pga', 'he', 'iw', 'ps', 'pbt', 'pbu', 'pst', 'prp', 'prd', 'ug', 'ur', 'ydd', 'yds', 'yih', 'ji', 'yi', 'hbo', 'men', 'xmn', 'fa', 'jpr', 'peo', 'pes', 'prs', 'dv', 'sam', 'ckb'];\n const languageUtils = this.services && this.services.languageUtils || new LanguageUtil(get());\n return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf('-arab') > 1 ? 'rtl' : 'ltr';\n }\n static createInstance() {\n let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let callback = arguments.length > 1 ? arguments[1] : undefined;\n return new I18n(options, callback);\n }\n cloneInstance() {\n let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;\n const forkResourceStore = options.forkResourceStore;\n if (forkResourceStore) delete options.forkResourceStore;\n const mergedOptions = {\n ...this.options,\n ...options,\n ...{\n isClone: true\n }\n };\n const clone = new I18n(mergedOptions);\n if (options.debug !== undefined || options.prefix !== undefined) {\n clone.logger = clone.logger.clone(options);\n }\n const membersToCopy = ['store', 'services', 'language'];\n membersToCopy.forEach(m => {\n clone[m] = this[m];\n });\n clone.services = {\n ...this.services\n };\n clone.services.utils = {\n hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)\n };\n if (forkResourceStore) {\n clone.store = new ResourceStore(this.store.data, mergedOptions);\n clone.services.resourceStore = clone.store;\n }\n clone.translator = new Translator(clone.services, mergedOptions);\n clone.translator.on('*', function (event) {\n for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n args[_key4 - 1] = arguments[_key4];\n }\n clone.emit(event, ...args);\n });\n clone.init(mergedOptions, callback);\n clone.translator.options = mergedOptions;\n clone.translator.backendConnector.services.utils = {\n hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)\n };\n return clone;\n }\n toJSON() {\n return {\n options: this.options,\n store: this.store,\n language: this.language,\n languages: this.languages,\n resolvedLanguage: this.resolvedLanguage\n };\n }\n}\nconst instance = I18n.createInstance();\ninstance.createInstance = I18n.createInstance;\n\nconst createInstance = instance.createInstance;\nconst dir = instance.dir;\nconst init = instance.init;\nconst loadResources = instance.loadResources;\nconst reloadResources = instance.reloadResources;\nconst use = instance.use;\nconst changeLanguage = instance.changeLanguage;\nconst getFixedT = instance.getFixedT;\nconst t = instance.t;\nconst exists = instance.exists;\nconst setDefaultNamespace = instance.setDefaultNamespace;\nconst hasLoadedNamespace = instance.hasLoadedNamespace;\nconst loadNamespaces = instance.loadNamespaces;\nconst loadLanguages = instance.loadLanguages;\n\nexport { changeLanguage, createInstance, instance as default, dir, exists, getFixedT, hasLoadedNamespace, init, loadLanguages, loadNamespaces, loadResources, reloadResources, setDefaultNamespace, t, use };\n", "{\n \"form\": {\n \"required\": \"This field is required\",\n \"msgRadioCheck\": \"Please select an option\",\n \"msgDropdown\": \"Please make a selection\",\n \"msgPhoneRequired\": \"Please fill in a valid phone number\",\n \"msgPasswordInvalid\": \"Password must match the criteria below. Please try again.\",\n \"msgPasswordUppercase\": \"Password must contain at least one uppercase.\",\n \"msgPasswordLowercase\": \"Password must contain at least one lowercase.\",\n \"msgPasswordDigit\": \"Password must contain at least one digit.\",\n \"msgPasswordSpecChar\": \"Password must contain special characters from @#$%&.\",\n \"msgEmail\": \"This is not a correct email format\",\n \"msgEmailGuestConfirm\": \"Password not matching\"\n },\n \"dropdown\": {\n \"noresult\": \"No results found\"\n }\n}\n", "import i18next from 'i18next';\nimport enNs1 from '../i18n/en.json';\nexport const defaultNS = 'limestone';\ni18next.init({\n debug: false,\n fallbackLng: 'en',\n defaultNS,\n resources: {\n en: {\n limestone: enNs1,\n }\n },\n});\nexport default i18next;\n", "export class JQElementHelper {\n iterateSelector($parent, func) {\n for (let elem of $parent) {\n func($(elem));\n }\n }\n}\n", "import { Direction } from \"../AxDropdown\";\nimport i18next from '../../i18n';\nexport class AxDropdownInteraction {\n constructor(options) {\n this.options = options;\n }\n getTippyInstance($parent) {\n //@ts-ignore\n const instance = $parent[0]._tippy;\n return instance;\n }\n open($target) {\n let instance = this.getTippyInstance($target);\n instance.show();\n }\n close($target) {\n let instance = this.getTippyInstance($target);\n instance.hide();\n }\n afterOpen($parent, $popperElem) {\n $popperElem\n .children(\".ax-dropdown__search\")\n .children(\".ax-dropdown__search-input\")\n .focus();\n this.openSubject.next(true);\n if (this.options.onOpen != null) {\n this.options.onOpen($parent);\n }\n }\n afterOnShown($parent, $popperElem) {\n // $popperElem\n // .children(\".ax-dropdown__search\")\n // .children(\".ax-dropdown__search-input\")\n // .focus();\n this.onShownSubject.next(true);\n if (this.options.onOpened != null) {\n this.options.onOpened($parent);\n }\n }\n search($target, $parent, $popperElem) {\n let isHero = $parent.hasClass('ax-dropdown--hero');\n let value = $target.val();\n if (isHero) {\n $parent.find('.ax-dropdown__selection').toggleClass('d-none', value != '');\n }\n let results = 0;\n $(\".ax-dropdown__menu .ax-dropdown__item:not(.ax-dropdown__search):not(.noresults)\", $popperElem).each(function (index) {\n $(this).hide();\n if ($(this).is(':contains(\"' + value + '\")')) {\n $(this).show();\n results = 1;\n }\n });\n if (results == 0) {\n if (!$(\".noresults\", $popperElem).length) {\n $(\".ax-dropdown__menu\", $popperElem).append(`
  • ${i18next.t('dropdown.noresult')}
  • `);\n }\n }\n else {\n $(\".noresults\", $popperElem).remove();\n }\n }\n select($target, $parent) {\n const hasMultiSelect = this.hasMultiSelectClass($parent);\n const tippyInstance = this.getTippyInstance($parent);\n const popperInstance = tippyInstance.popperInstance;\n const currentValue = this.getValue($parent);\n if ($target.is(\"[disabled]\")) {\n return;\n }\n if (hasMultiSelect) {\n this.selectMulti($target, $parent);\n popperInstance === null || popperInstance === void 0 ? void 0 : popperInstance.update();\n }\n else {\n this.selectSingle($target, $parent);\n tippyInstance === null || tippyInstance === void 0 ? void 0 : tippyInstance.hide();\n }\n let value = this.getValue($parent);\n this.changeSubject.next(value);\n if (this.options.onSelect != null) {\n this.options.onSelect($parent, value);\n }\n if (this.options.onChange != null) {\n if (currentValue != null && !hasMultiSelect) {\n this.options.onChange($parent, currentValue, Direction.removed, value);\n }\n this.options.onChange($parent, $target.attr('data-value'), Direction.added, value);\n }\n }\n getValue($parent) {\n var _a, _b;\n const tippyInstance = this.getTippyInstance($parent);\n const $popperElement = $(tippyInstance.popper);\n if (!this.hasMultiSelectClass($parent)) {\n return (_b = (_a = $popperElement.find('.ax-dropdown__menu .ax-dropdown__item.selected')) === null || _a === void 0 ? void 0 : _a.attr('data-value')) !== null && _b !== void 0 ? _b : null;\n }\n let retVal = [];\n for (let elem of $popperElement.find('.ax-dropdown__menu .ax-dropdown__item.selected')) {\n retVal.push($(elem).attr('data-value'));\n }\n return retVal;\n }\n setValue(value, $parent) {\n const currentValue = this.getValue($parent);\n const isMultiSelect = this.hasMultiSelectClass($parent);\n const $selection = this.getOptionByValue(value, $parent);\n if ($selection.length === 0) {\n $parent.find(\".ax-dropdown__trigger\").addClass(\"has-selection\");\n $parent.find(\".ax-dropdown__trigger .ax-dropdown__selection\").text(value);\n $parent.find(\".hidden-input\").val(value).addClass(\"value\");\n return;\n }\n if ($selection.is(\"[disabled]\")) {\n return;\n }\n if (isMultiSelect) {\n this.selectMulti($selection, $parent);\n }\n else {\n this.selectSingle($selection, $parent);\n }\n if (this.options.onSelect != null) {\n this.options.onSelect($parent, value);\n }\n if (this.options.onChange != null) {\n if (currentValue != null && !isMultiSelect) {\n this.options.onChange($parent, currentValue, Direction.removed, value);\n }\n this.options.onChange($parent, value, Direction.added, this.getValue($parent));\n }\n }\n resetSelection($parent) {\n const value = this.getValue($parent);\n const tippyInstance = this.getTippyInstance($parent);\n const $popperElement = $(tippyInstance.popper);\n $parent.find(\".ax-dropdown__trigger\").removeClass(\"active\");\n $parent.find(\".ax-dropdown__trigger\").removeClass(\"has-selection\");\n $parent.find(\".ax-dropdown__trigger .ax-dropdown__selection\").text('');\n $popperElement.find('.ax-dropdown__menu .ax-dropdown__item').removeClass('selected');\n $parent.find(\".hidden-input\").val('').removeClass(\"value\");\n if (this.options.onChange != null) {\n if (this.hasMultiSelectClass($parent)) {\n for (let val of value) {\n this.options.onChange($parent, val, Direction.removed, []);\n }\n }\n else {\n this.options.onChange($parent, value, Direction.added, null);\n }\n }\n }\n hasMultiSelectClass($parent) {\n return $parent.hasClass('ax-dropdown--multiselect');\n }\n toggleDisabled(option, disabled, $parent) {\n let $option;\n if (typeof option === 'string') {\n $option = this.getOptionByValue(option, $parent);\n }\n else {\n $option = option;\n }\n let newValue = disabled;\n if (typeof disabled == 'undefined' || disabled == null) {\n var existingAttr = $option.attr('disabled');\n newValue = (typeof existingAttr == undefined || existingAttr == null);\n }\n if (newValue) {\n $option.attr('disabled', 'disabled');\n }\n else {\n $option.removeAttr('disabled');\n }\n $option.prop('disabled', disabled);\n return newValue;\n }\n getOptionByValue(value, $parent) {\n const tippyInstance = this.getTippyInstance($parent);\n const $popperElement = $(tippyInstance.popper);\n return $popperElement.find(`.ax-dropdown__menu .ax-dropdown__item[data-value=\"${value}\"]`);\n }\n selectSingle($target, $parent) {\n var _a;\n const $singleTarget = $($target[0]);\n const lineText = $singleTarget.text();\n $singleTarget.addClass(\"selected\").siblings().removeClass(\"selected\");\n $singleTarget.parent(\".ax-dropdown__menu\").hide();\n $parent.find(\".ax-dropdown__trigger\").addClass(\"has-selection\");\n $parent.find(\".ax-dropdown__trigger .ax-dropdown__selection\").text(lineText);\n $parent.find(\".hidden-input\").val((_a = $singleTarget.attr('data-value')) !== null && _a !== void 0 ? _a : lineText).addClass(\"value\");\n $parent.find(\".ax-dropdown__trigger\").removeClass(\"active\");\n const $hero = $singleTarget.parents(\".ax-dropdown--hero\").find(\".ax-dropdown__trigger\");\n if ($hero.hasClass(\"has-selection\")) {\n if ($hero.find($(\".ax-dropdown--reset\")).length === 0) {\n $hero.append('');\n }\n }\n if ($parent.find(\".ax-dropdown__trigger\").hasClass(\"has-selection\")) {\n $parent.find(\".ax-dropdown__trigger\").removeClass(\"has-error\");\n $parent.parent(\".ax-form-group\").find(\"label.field-error\").hide();\n }\n if ($parent.find(\".ax-form-group input\").hasClass(\"value\")) {\n $parent\n .find(\".ax-form-group input\")\n .removeClass(\"field-error\");\n }\n $singleTarget\n .siblings(\".ax-dropdown__search\")\n .children(\".ax-dropdown__search-input\")\n .val(\"\");\n }\n selectMulti($target, $parent) {\n const lineText = $target.text();\n const $newLabel = $('
    ' +\n lineText +\n '
    ');\n $target.each((i, elem) => {\n const $elem = $(elem);\n const items = $elem.data(\"value\");\n const $existingLabel = $parent.find(`.ax-dropdown__multi-label[data-value=\"${items}\"]`);\n if ($existingLabel.length === 0) {\n $parent\n .find(\".ax-dropdown__trigger .ax-dropdown__selection\")\n .append($newLabel.attr(\"data-value\", items));\n }\n else {\n $existingLabel.remove();\n }\n });\n $target.toggleClass('selected');\n $target\n .siblings(\".ax-dropdown__search\")\n .children(\".ax-dropdown__search-input\")\n .val(\"\");\n $parent.find(\".ax-dropdown__trigger\").toggleClass(\"has-selection\", $parent.find(\".ax-dropdown__selection\").children(\".ax-dropdown__multi-label\").length > 0);\n //$parent[0]._tippy.popperInstance.update();\n }\n deleteMultiSelection($parent, targetId, $popperElem) {\n const $label = $popperElem.find(\".ax-dropdown__menu .ax-dropdown__item\");\n const $target = $popperElem.find(`.ax-dropdown__menu .ax-dropdown__item[data-value=\"${targetId}\"]`);\n const targetSelected = $target.hasClass(\"selected\");\n $target.removeClass(\"selected\");\n $parent.find(`.ax-dropdown__multi-label[data-value=\"${targetId}\"]`).remove();\n $label.each(() => {\n if (!$popperElem.find(\".ax-dropdown__menu .ax-dropdown__item\")\n .hasClass(\"selected\")) {\n $parent.find(\".ax-dropdown__trigger\")\n .removeClass(\"has-selection\");\n }\n });\n if (targetSelected && this.options.onChange != null) {\n this.options.onChange($parent, targetId, Direction.removed, this.getValue($parent));\n }\n }\n}\n", "/**\n * Returns true if the object is a function.\n * @param value The value to check\n */\nexport function isFunction(value: any): value is (...args: any[]) => any {\n return typeof value === 'function';\n}\n", "/**\n * Used to create Error subclasses until the community moves away from ES5.\n *\n * This is because compiling from TypeScript down to ES5 has issues with subclassing Errors\n * as well as other built-in types: https://github.com/Microsoft/TypeScript/issues/12123\n *\n * @param createImpl A factory function to create the actual constructor implementation. The returned\n * function should be a named function that calls `_super` internally.\n */\nexport function createErrorClass(createImpl: (_super: any) => any): T {\n const _super = (instance: any) => {\n Error.call(instance);\n instance.stack = new Error().stack;\n };\n\n const ctorFunc = createImpl(_super);\n ctorFunc.prototype = Object.create(Error.prototype);\n ctorFunc.prototype.constructor = ctorFunc;\n return ctorFunc;\n}\n", "import { createErrorClass } from './createErrorClass';\n\nexport interface UnsubscriptionError extends Error {\n readonly errors: any[];\n}\n\nexport interface UnsubscriptionErrorCtor {\n /**\n * @deprecated Internal implementation detail. Do not construct error instances.\n * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269\n */\n new (errors: any[]): UnsubscriptionError;\n}\n\n/**\n * An error thrown when one or more errors have occurred during the\n * `unsubscribe` of a {@link Subscription}.\n */\nexport const UnsubscriptionError: UnsubscriptionErrorCtor = createErrorClass(\n (_super) =>\n function UnsubscriptionErrorImpl(this: any, errors: (Error | string)[]) {\n _super(this);\n this.message = errors\n ? `${errors.length} errors occurred during unsubscription:\n${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\\n ')}`\n : '';\n this.name = 'UnsubscriptionError';\n this.errors = errors;\n }\n);\n", "/**\n * Removes an item from an array, mutating it.\n * @param arr The array to remove the item from\n * @param item The item to remove\n */\nexport function arrRemove(arr: T[] | undefined | null, item: T) {\n if (arr) {\n const index = arr.indexOf(item);\n 0 <= index && arr.splice(index, 1);\n }\n}\n", "import { isFunction } from './util/isFunction';\nimport { UnsubscriptionError } from './util/UnsubscriptionError';\nimport { SubscriptionLike, TeardownLogic, Unsubscribable } from './types';\nimport { arrRemove } from './util/arrRemove';\n\n/**\n * Represents a disposable resource, such as the execution of an Observable. A\n * Subscription has one important method, `unsubscribe`, that takes no argument\n * and just disposes the resource held by the subscription.\n *\n * Additionally, subscriptions may be grouped together through the `add()`\n * method, which will attach a child Subscription to the current Subscription.\n * When a Subscription is unsubscribed, all its children (and its grandchildren)\n * will be unsubscribed as well.\n *\n * @class Subscription\n */\nexport class Subscription implements SubscriptionLike {\n /** @nocollapse */\n public static EMPTY = (() => {\n const empty = new Subscription();\n empty.closed = true;\n return empty;\n })();\n\n /**\n * A flag to indicate whether this Subscription has already been unsubscribed.\n */\n public closed = false;\n\n private _parentage: Subscription[] | Subscription | null = null;\n\n /**\n * The list of registered finalizers to execute upon unsubscription. Adding and removing from this\n * list occurs in the {@link #add} and {@link #remove} methods.\n */\n private _finalizers: Exclude[] | null = null;\n\n /**\n * @param initialTeardown A function executed first as part of the finalization\n * process that is kicked off when {@link #unsubscribe} is called.\n */\n constructor(private initialTeardown?: () => void) {}\n\n /**\n * Disposes the resources held by the subscription. May, for instance, cancel\n * an ongoing Observable execution or cancel any other type of work that\n * started when the Subscription was created.\n * @return {void}\n */\n unsubscribe(): void {\n let errors: any[] | undefined;\n\n if (!this.closed) {\n this.closed = true;\n\n // Remove this from it's parents.\n const { _parentage } = this;\n if (_parentage) {\n this._parentage = null;\n if (Array.isArray(_parentage)) {\n for (const parent of _parentage) {\n parent.remove(this);\n }\n } else {\n _parentage.remove(this);\n }\n }\n\n const { initialTeardown: initialFinalizer } = this;\n if (isFunction(initialFinalizer)) {\n try {\n initialFinalizer();\n } catch (e) {\n errors = e instanceof UnsubscriptionError ? e.errors : [e];\n }\n }\n\n const { _finalizers } = this;\n if (_finalizers) {\n this._finalizers = null;\n for (const finalizer of _finalizers) {\n try {\n execFinalizer(finalizer);\n } catch (err) {\n errors = errors ?? [];\n if (err instanceof UnsubscriptionError) {\n errors = [...errors, ...err.errors];\n } else {\n errors.push(err);\n }\n }\n }\n }\n\n if (errors) {\n throw new UnsubscriptionError(errors);\n }\n }\n }\n\n /**\n * Adds a finalizer to this subscription, so that finalization will be unsubscribed/called\n * when this subscription is unsubscribed. If this subscription is already {@link #closed},\n * because it has already been unsubscribed, then whatever finalizer is passed to it\n * will automatically be executed (unless the finalizer itself is also a closed subscription).\n *\n * Closed Subscriptions cannot be added as finalizers to any subscription. Adding a closed\n * subscription to a any subscription will result in no operation. (A noop).\n *\n * Adding a subscription to itself, or adding `null` or `undefined` will not perform any\n * operation at all. (A noop).\n *\n * `Subscription` instances that are added to this instance will automatically remove themselves\n * if they are unsubscribed. Functions and {@link Unsubscribable} objects that you wish to remove\n * will need to be removed manually with {@link #remove}\n *\n * @param teardown The finalization logic to add to this subscription.\n */\n add(teardown: TeardownLogic): void {\n // Only add the finalizer if it's not undefined\n // and don't add a subscription to itself.\n if (teardown && teardown !== this) {\n if (this.closed) {\n // If this subscription is already closed,\n // execute whatever finalizer is handed to it automatically.\n execFinalizer(teardown);\n } else {\n if (teardown instanceof Subscription) {\n // We don't add closed subscriptions, and we don't add the same subscription\n // twice. Subscription unsubscribe is idempotent.\n if (teardown.closed || teardown._hasParent(this)) {\n return;\n }\n teardown._addParent(this);\n }\n (this._finalizers = this._finalizers ?? []).push(teardown);\n }\n }\n }\n\n /**\n * Checks to see if a this subscription already has a particular parent.\n * This will signal that this subscription has already been added to the parent in question.\n * @param parent the parent to check for\n */\n private _hasParent(parent: Subscription) {\n const { _parentage } = this;\n return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));\n }\n\n /**\n * Adds a parent to this subscription so it can be removed from the parent if it\n * unsubscribes on it's own.\n *\n * NOTE: THIS ASSUMES THAT {@link _hasParent} HAS ALREADY BEEN CHECKED.\n * @param parent The parent subscription to add\n */\n private _addParent(parent: Subscription) {\n const { _parentage } = this;\n this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;\n }\n\n /**\n * Called on a child when it is removed via {@link #remove}.\n * @param parent The parent to remove\n */\n private _removeParent(parent: Subscription) {\n const { _parentage } = this;\n if (_parentage === parent) {\n this._parentage = null;\n } else if (Array.isArray(_parentage)) {\n arrRemove(_parentage, parent);\n }\n }\n\n /**\n * Removes a finalizer from this subscription that was previously added with the {@link #add} method.\n *\n * Note that `Subscription` instances, when unsubscribed, will automatically remove themselves\n * from every other `Subscription` they have been added to. This means that using the `remove` method\n * is not a common thing and should be used thoughtfully.\n *\n * If you add the same finalizer instance of a function or an unsubscribable object to a `Subscription` instance\n * more than once, you will need to call `remove` the same number of times to remove all instances.\n *\n * All finalizer instances are removed to free up memory upon unsubscription.\n *\n * @param teardown The finalizer to remove from this subscription\n */\n remove(teardown: Exclude): void {\n const { _finalizers } = this;\n _finalizers && arrRemove(_finalizers, teardown);\n\n if (teardown instanceof Subscription) {\n teardown._removeParent(this);\n }\n }\n}\n\nexport const EMPTY_SUBSCRIPTION = Subscription.EMPTY;\n\nexport function isSubscription(value: any): value is Subscription {\n return (\n value instanceof Subscription ||\n (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe))\n );\n}\n\nfunction execFinalizer(finalizer: Unsubscribable | (() => void)) {\n if (isFunction(finalizer)) {\n finalizer();\n } else {\n finalizer.unsubscribe();\n }\n}\n", "import { Subscriber } from './Subscriber';\nimport { ObservableNotification } from './types';\n\n/**\n * The {@link GlobalConfig} object for RxJS. It is used to configure things\n * like how to react on unhandled errors.\n */\nexport const config: GlobalConfig = {\n onUnhandledError: null,\n onStoppedNotification: null,\n Promise: undefined,\n useDeprecatedSynchronousErrorHandling: false,\n useDeprecatedNextContext: false,\n};\n\n/**\n * The global configuration object for RxJS, used to configure things\n * like how to react on unhandled errors. Accessible via {@link config}\n * object.\n */\nexport interface GlobalConfig {\n /**\n * A registration point for unhandled errors from RxJS. These are errors that\n * cannot were not handled by consuming code in the usual subscription path. For\n * example, if you have this configured, and you subscribe to an observable without\n * providing an error handler, errors from that subscription will end up here. This\n * will _always_ be called asynchronously on another job in the runtime. This is because\n * we do not want errors thrown in this user-configured handler to interfere with the\n * behavior of the library.\n */\n onUnhandledError: ((err: any) => void) | null;\n\n /**\n * A registration point for notifications that cannot be sent to subscribers because they\n * have completed, errored or have been explicitly unsubscribed. By default, next, complete\n * and error notifications sent to stopped subscribers are noops. However, sometimes callers\n * might want a different behavior. For example, with sources that attempt to report errors\n * to stopped subscribers, a caller can configure RxJS to throw an unhandled error instead.\n * This will _always_ be called asynchronously on another job in the runtime. This is because\n * we do not want errors thrown in this user-configured handler to interfere with the\n * behavior of the library.\n */\n onStoppedNotification: ((notification: ObservableNotification, subscriber: Subscriber) => void) | null;\n\n /**\n * The promise constructor used by default for {@link Observable#toPromise toPromise} and {@link Observable#forEach forEach}\n * methods.\n *\n * @deprecated As of version 8, RxJS will no longer support this sort of injection of a\n * Promise constructor. If you need a Promise implementation other than native promises,\n * please polyfill/patch Promise as you see appropriate. Will be removed in v8.\n */\n Promise?: PromiseConstructorLike;\n\n /**\n * If true, turns on synchronous error rethrowing, which is a deprecated behavior\n * in v6 and higher. This behavior enables bad patterns like wrapping a subscribe\n * call in a try/catch block. It also enables producer interference, a nasty bug\n * where a multicast can be broken for all observers by a downstream consumer with\n * an unhandled error. DO NOT USE THIS FLAG UNLESS IT'S NEEDED TO BUY TIME\n * FOR MIGRATION REASONS.\n *\n * @deprecated As of version 8, RxJS will no longer support synchronous throwing\n * of unhandled errors. All errors will be thrown on a separate call stack to prevent bad\n * behaviors described above. Will be removed in v8.\n */\n useDeprecatedSynchronousErrorHandling: boolean;\n\n /**\n * If true, enables an as-of-yet undocumented feature from v5: The ability to access\n * `unsubscribe()` via `this` context in `next` functions created in observers passed\n * to `subscribe`.\n *\n * This is being removed because the performance was severely problematic, and it could also cause\n * issues when types other than POJOs are passed to subscribe as subscribers, as they will likely have\n * their `this` context overwritten.\n *\n * @deprecated As of version 8, RxJS will no longer support altering the\n * context of next functions provided as part of an observer to Subscribe. Instead,\n * you will have access to a subscription or a signal or token that will allow you to do things like\n * unsubscribe and test closed status. Will be removed in v8.\n */\n useDeprecatedNextContext: boolean;\n}\n", "import type { TimerHandle } from './timerHandle';\ntype SetTimeoutFunction = (handler: () => void, timeout?: number, ...args: any[]) => TimerHandle;\ntype ClearTimeoutFunction = (handle: TimerHandle) => void;\n\ninterface TimeoutProvider {\n setTimeout: SetTimeoutFunction;\n clearTimeout: ClearTimeoutFunction;\n delegate:\n | {\n setTimeout: SetTimeoutFunction;\n clearTimeout: ClearTimeoutFunction;\n }\n | undefined;\n}\n\nexport const timeoutProvider: TimeoutProvider = {\n // When accessing the delegate, use the variable rather than `this` so that\n // the functions can be called without being bound to the provider.\n setTimeout(handler: () => void, timeout?: number, ...args) {\n const { delegate } = timeoutProvider;\n if (delegate?.setTimeout) {\n return delegate.setTimeout(handler, timeout, ...args);\n }\n return setTimeout(handler, timeout, ...args);\n },\n clearTimeout(handle) {\n const { delegate } = timeoutProvider;\n return (delegate?.clearTimeout || clearTimeout)(handle as any);\n },\n delegate: undefined,\n};\n", "import { config } from '../config';\nimport { timeoutProvider } from '../scheduler/timeoutProvider';\n\n/**\n * Handles an error on another job either with the user-configured {@link onUnhandledError},\n * or by throwing it on that new job so it can be picked up by `window.onerror`, `process.on('error')`, etc.\n *\n * This should be called whenever there is an error that is out-of-band with the subscription\n * or when an error hits a terminal boundary of the subscription and no error handler was provided.\n *\n * @param err the error to report\n */\nexport function reportUnhandledError(err: any) {\n timeoutProvider.setTimeout(() => {\n const { onUnhandledError } = config;\n if (onUnhandledError) {\n // Execute the user-configured error handler.\n onUnhandledError(err);\n } else {\n // Throw so it is picked up by the runtime's uncaught error mechanism.\n throw err;\n }\n });\n}\n", "/* tslint:disable:no-empty */\nexport function noop() { }\n", "import { CompleteNotification, NextNotification, ErrorNotification } from './types';\n\n/**\n * A completion object optimized for memory use and created to be the\n * same \"shape\" as other notifications in v8.\n * @internal\n */\nexport const COMPLETE_NOTIFICATION = (() => createNotification('C', undefined, undefined) as CompleteNotification)();\n\n/**\n * Internal use only. Creates an optimized error notification that is the same \"shape\"\n * as other notifications.\n * @internal\n */\nexport function errorNotification(error: any): ErrorNotification {\n return createNotification('E', undefined, error) as any;\n}\n\n/**\n * Internal use only. Creates an optimized next notification that is the same \"shape\"\n * as other notifications.\n * @internal\n */\nexport function nextNotification(value: T) {\n return createNotification('N', value, undefined) as NextNotification;\n}\n\n/**\n * Ensures that all notifications created internally have the same \"shape\" in v8.\n *\n * TODO: This is only exported to support a crazy legacy test in `groupBy`.\n * @internal\n */\nexport function createNotification(kind: 'N' | 'E' | 'C', value: any, error: any) {\n return {\n kind,\n value,\n error,\n };\n}\n", "import { config } from '../config';\n\nlet context: { errorThrown: boolean; error: any } | null = null;\n\n/**\n * Handles dealing with errors for super-gross mode. Creates a context, in which\n * any synchronously thrown errors will be passed to {@link captureError}. Which\n * will record the error such that it will be rethrown after the call back is complete.\n * TODO: Remove in v8\n * @param cb An immediately executed function.\n */\nexport function errorContext(cb: () => void) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n const isRoot = !context;\n if (isRoot) {\n context = { errorThrown: false, error: null };\n }\n cb();\n if (isRoot) {\n const { errorThrown, error } = context!;\n context = null;\n if (errorThrown) {\n throw error;\n }\n }\n } else {\n // This is the general non-deprecated path for everyone that\n // isn't crazy enough to use super-gross mode (useDeprecatedSynchronousErrorHandling)\n cb();\n }\n}\n\n/**\n * Captures errors only in super-gross mode.\n * @param err the error to capture\n */\nexport function captureError(err: any) {\n if (config.useDeprecatedSynchronousErrorHandling && context) {\n context.errorThrown = true;\n context.error = err;\n }\n}\n", "import { isFunction } from './util/isFunction';\nimport { Observer, ObservableNotification } from './types';\nimport { isSubscription, Subscription } from './Subscription';\nimport { config } from './config';\nimport { reportUnhandledError } from './util/reportUnhandledError';\nimport { noop } from './util/noop';\nimport { nextNotification, errorNotification, COMPLETE_NOTIFICATION } from './NotificationFactories';\nimport { timeoutProvider } from './scheduler/timeoutProvider';\nimport { captureError } from './util/errorContext';\n\n/**\n * Implements the {@link Observer} interface and extends the\n * {@link Subscription} class. While the {@link Observer} is the public API for\n * consuming the values of an {@link Observable}, all Observers get converted to\n * a Subscriber, in order to provide Subscription-like capabilities such as\n * `unsubscribe`. Subscriber is a common type in RxJS, and crucial for\n * implementing operators, but it is rarely used as a public API.\n *\n * @class Subscriber\n */\nexport class Subscriber extends Subscription implements Observer {\n /**\n * A static factory for a Subscriber, given a (potentially partial) definition\n * of an Observer.\n * @param next The `next` callback of an Observer.\n * @param error The `error` callback of an\n * Observer.\n * @param complete The `complete` callback of an\n * Observer.\n * @return A Subscriber wrapping the (partially defined)\n * Observer represented by the given arguments.\n * @nocollapse\n * @deprecated Do not use. Will be removed in v8. There is no replacement for this\n * method, and there is no reason to be creating instances of `Subscriber` directly.\n * If you have a specific use case, please file an issue.\n */\n static create(next?: (x?: T) => void, error?: (e?: any) => void, complete?: () => void): Subscriber {\n return new SafeSubscriber(next, error, complete);\n }\n\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n protected isStopped: boolean = false;\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n protected destination: Subscriber | Observer; // this `any` is the escape hatch to erase extra type param (e.g. R)\n\n /**\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n * There is no reason to directly create an instance of Subscriber. This type is exported for typings reasons.\n */\n constructor(destination?: Subscriber | Observer) {\n super();\n if (destination) {\n this.destination = destination;\n // Automatically chain subscriptions together here.\n // if destination is a Subscription, then it is a Subscriber.\n if (isSubscription(destination)) {\n destination.add(this);\n }\n } else {\n this.destination = EMPTY_OBSERVER;\n }\n }\n\n /**\n * The {@link Observer} callback to receive notifications of type `next` from\n * the Observable, with a value. The Observable may call this method 0 or more\n * times.\n * @param {T} [value] The `next` value.\n * @return {void}\n */\n next(value?: T): void {\n if (this.isStopped) {\n handleStoppedNotification(nextNotification(value), this);\n } else {\n this._next(value!);\n }\n }\n\n /**\n * The {@link Observer} callback to receive notifications of type `error` from\n * the Observable, with an attached `Error`. Notifies the Observer that\n * the Observable has experienced an error condition.\n * @param {any} [err] The `error` exception.\n * @return {void}\n */\n error(err?: any): void {\n if (this.isStopped) {\n handleStoppedNotification(errorNotification(err), this);\n } else {\n this.isStopped = true;\n this._error(err);\n }\n }\n\n /**\n * The {@link Observer} callback to receive a valueless notification of type\n * `complete` from the Observable. Notifies the Observer that the Observable\n * has finished sending push-based notifications.\n * @return {void}\n */\n complete(): void {\n if (this.isStopped) {\n handleStoppedNotification(COMPLETE_NOTIFICATION, this);\n } else {\n this.isStopped = true;\n this._complete();\n }\n }\n\n unsubscribe(): void {\n if (!this.closed) {\n this.isStopped = true;\n super.unsubscribe();\n this.destination = null!;\n }\n }\n\n protected _next(value: T): void {\n this.destination.next(value);\n }\n\n protected _error(err: any): void {\n try {\n this.destination.error(err);\n } finally {\n this.unsubscribe();\n }\n }\n\n protected _complete(): void {\n try {\n this.destination.complete();\n } finally {\n this.unsubscribe();\n }\n }\n}\n\n/**\n * This bind is captured here because we want to be able to have\n * compatibility with monoid libraries that tend to use a method named\n * `bind`. In particular, a library called Monio requires this.\n */\nconst _bind = Function.prototype.bind;\n\nfunction bind any>(fn: Fn, thisArg: any): Fn {\n return _bind.call(fn, thisArg);\n}\n\n/**\n * Internal optimization only, DO NOT EXPOSE.\n * @internal\n */\nclass ConsumerObserver implements Observer {\n constructor(private partialObserver: Partial>) {}\n\n next(value: T): void {\n const { partialObserver } = this;\n if (partialObserver.next) {\n try {\n partialObserver.next(value);\n } catch (error) {\n handleUnhandledError(error);\n }\n }\n }\n\n error(err: any): void {\n const { partialObserver } = this;\n if (partialObserver.error) {\n try {\n partialObserver.error(err);\n } catch (error) {\n handleUnhandledError(error);\n }\n } else {\n handleUnhandledError(err);\n }\n }\n\n complete(): void {\n const { partialObserver } = this;\n if (partialObserver.complete) {\n try {\n partialObserver.complete();\n } catch (error) {\n handleUnhandledError(error);\n }\n }\n }\n}\n\nexport class SafeSubscriber extends Subscriber {\n constructor(\n observerOrNext?: Partial> | ((value: T) => void) | null,\n error?: ((e?: any) => void) | null,\n complete?: (() => void) | null\n ) {\n super();\n\n let partialObserver: Partial>;\n if (isFunction(observerOrNext) || !observerOrNext) {\n // The first argument is a function, not an observer. The next\n // two arguments *could* be observers, or they could be empty.\n partialObserver = {\n next: (observerOrNext ?? undefined) as (((value: T) => void) | undefined),\n error: error ?? undefined,\n complete: complete ?? undefined,\n };\n } else {\n // The first argument is a partial observer.\n let context: any;\n if (this && config.useDeprecatedNextContext) {\n // This is a deprecated path that made `this.unsubscribe()` available in\n // next handler functions passed to subscribe. This only exists behind a flag\n // now, as it is *very* slow.\n context = Object.create(observerOrNext);\n context.unsubscribe = () => this.unsubscribe();\n partialObserver = {\n next: observerOrNext.next && bind(observerOrNext.next, context),\n error: observerOrNext.error && bind(observerOrNext.error, context),\n complete: observerOrNext.complete && bind(observerOrNext.complete, context),\n };\n } else {\n // The \"normal\" path. Just use the partial observer directly.\n partialObserver = observerOrNext;\n }\n }\n\n // Wrap the partial observer to ensure it's a full observer, and\n // make sure proper error handling is accounted for.\n this.destination = new ConsumerObserver(partialObserver);\n }\n}\n\nfunction handleUnhandledError(error: any) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n captureError(error);\n } else {\n // Ideal path, we report this as an unhandled error,\n // which is thrown on a new call stack.\n reportUnhandledError(error);\n }\n}\n\n/**\n * An error handler used when no error handler was supplied\n * to the SafeSubscriber -- meaning no error handler was supplied\n * do the `subscribe` call on our observable.\n * @param err The error to handle\n */\nfunction defaultErrorHandler(err: any) {\n throw err;\n}\n\n/**\n * A handler for notifications that cannot be sent to a stopped subscriber.\n * @param notification The notification being sent\n * @param subscriber The stopped subscriber\n */\nfunction handleStoppedNotification(notification: ObservableNotification, subscriber: Subscriber) {\n const { onStoppedNotification } = config;\n onStoppedNotification && timeoutProvider.setTimeout(() => onStoppedNotification(notification, subscriber));\n}\n\n/**\n * The observer used as a stub for subscriptions where the user did not\n * pass any arguments to `subscribe`. Comes with the default error handling\n * behavior.\n */\nexport const EMPTY_OBSERVER: Readonly> & { closed: true } = {\n closed: true,\n next: noop,\n error: defaultErrorHandler,\n complete: noop,\n};\n", "/**\n * Symbol.observable or a string \"@@observable\". Used for interop\n *\n * @deprecated We will no longer be exporting this symbol in upcoming versions of RxJS.\n * Instead polyfill and use Symbol.observable directly *or* use https://www.npmjs.com/package/symbol-observable\n */\nexport const observable: string | symbol = (() => (typeof Symbol === 'function' && Symbol.observable) || '@@observable')();\n", "/**\n * This function takes one parameter and just returns it. Simply put,\n * this is like `(x: T): T => x`.\n *\n * ## Examples\n *\n * This is useful in some cases when using things like `mergeMap`\n *\n * ```ts\n * import { interval, take, map, range, mergeMap, identity } from 'rxjs';\n *\n * const source$ = interval(1000).pipe(take(5));\n *\n * const result$ = source$.pipe(\n * map(i => range(i)),\n * mergeMap(identity) // same as mergeMap(x => x)\n * );\n *\n * result$.subscribe({\n * next: console.log\n * });\n * ```\n *\n * Or when you want to selectively apply an operator\n *\n * ```ts\n * import { interval, take, identity } from 'rxjs';\n *\n * const shouldLimit = () => Math.random() < 0.5;\n *\n * const source$ = interval(1000);\n *\n * const result$ = source$.pipe(shouldLimit() ? take(5) : identity);\n *\n * result$.subscribe({\n * next: console.log\n * });\n * ```\n *\n * @param x Any value that is returned by this function\n * @returns The value passed as the first parameter to this function\n */\nexport function identity(x: T): T {\n return x;\n}\n", "import { identity } from './identity';\nimport { UnaryFunction } from '../types';\n\nexport function pipe(): typeof identity;\nexport function pipe(fn1: UnaryFunction): UnaryFunction;\nexport function pipe(fn1: UnaryFunction, fn2: UnaryFunction): UnaryFunction;\nexport function pipe(fn1: UnaryFunction, fn2: UnaryFunction, fn3: UnaryFunction): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction,\n fn6: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction,\n fn6: UnaryFunction,\n fn7: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction,\n fn6: UnaryFunction,\n fn7: UnaryFunction,\n fn8: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction,\n fn6: UnaryFunction,\n fn7: UnaryFunction,\n fn8: UnaryFunction,\n fn9: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction,\n fn6: UnaryFunction,\n fn7: UnaryFunction,\n fn8: UnaryFunction,\n fn9: UnaryFunction,\n ...fns: UnaryFunction[]\n): UnaryFunction;\n\n/**\n * pipe() can be called on one or more functions, each of which can take one argument (\"UnaryFunction\")\n * and uses it to return a value.\n * It returns a function that takes one argument, passes it to the first UnaryFunction, and then\n * passes the result to the next one, passes that result to the next one, and so on. \n */\nexport function pipe(...fns: Array>): UnaryFunction {\n return pipeFromArray(fns);\n}\n\n/** @internal */\nexport function pipeFromArray(fns: Array>): UnaryFunction {\n if (fns.length === 0) {\n return identity as UnaryFunction;\n }\n\n if (fns.length === 1) {\n return fns[0];\n }\n\n return function piped(input: T): R {\n return fns.reduce((prev: any, fn: UnaryFunction) => fn(prev), input as any);\n };\n}\n", "import { Operator } from './Operator';\nimport { SafeSubscriber, Subscriber } from './Subscriber';\nimport { isSubscription, Subscription } from './Subscription';\nimport { TeardownLogic, OperatorFunction, Subscribable, Observer } from './types';\nimport { observable as Symbol_observable } from './symbol/observable';\nimport { pipeFromArray } from './util/pipe';\nimport { config } from './config';\nimport { isFunction } from './util/isFunction';\nimport { errorContext } from './util/errorContext';\n\n/**\n * A representation of any set of values over any amount of time. This is the most basic building block\n * of RxJS.\n *\n * @class Observable\n */\nexport class Observable implements Subscribable {\n /**\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n */\n source: Observable | undefined;\n\n /**\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n */\n operator: Operator | undefined;\n\n /**\n * @constructor\n * @param {Function} subscribe the function that is called when the Observable is\n * initially subscribed to. This function is given a Subscriber, to which new values\n * can be `next`ed, or an `error` method can be called to raise an error, or\n * `complete` can be called to notify of a successful completion.\n */\n constructor(subscribe?: (this: Observable, subscriber: Subscriber) => TeardownLogic) {\n if (subscribe) {\n this._subscribe = subscribe;\n }\n }\n\n // HACK: Since TypeScript inherits static properties too, we have to\n // fight against TypeScript here so Subject can have a different static create signature\n /**\n * Creates a new Observable by calling the Observable constructor\n * @owner Observable\n * @method create\n * @param {Function} subscribe? the subscriber function to be passed to the Observable constructor\n * @return {Observable} a new observable\n * @nocollapse\n * @deprecated Use `new Observable()` instead. Will be removed in v8.\n */\n static create: (...args: any[]) => any = (subscribe?: (subscriber: Subscriber) => TeardownLogic) => {\n return new Observable(subscribe);\n };\n\n /**\n * Creates a new Observable, with this Observable instance as the source, and the passed\n * operator defined as the new observable's operator.\n * @method lift\n * @param operator the operator defining the operation to take on the observable\n * @return a new observable with the Operator applied\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n * If you have implemented an operator using `lift`, it is recommended that you create an\n * operator by simply returning `new Observable()` directly. See \"Creating new operators from\n * scratch\" section here: https://rxjs.dev/guide/operators\n */\n lift(operator?: Operator): Observable {\n const observable = new Observable();\n observable.source = this;\n observable.operator = operator;\n return observable;\n }\n\n subscribe(observerOrNext?: Partial> | ((value: T) => void)): Subscription;\n /** @deprecated Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8. Details: https://rxjs.dev/deprecations/subscribe-arguments */\n subscribe(next?: ((value: T) => void) | null, error?: ((error: any) => void) | null, complete?: (() => void) | null): Subscription;\n /**\n * Invokes an execution of an Observable and registers Observer handlers for notifications it will emit.\n *\n * Use it when you have all these Observables, but still nothing is happening.\n *\n * `subscribe` is not a regular operator, but a method that calls Observable's internal `subscribe` function. It\n * might be for example a function that you passed to Observable's constructor, but most of the time it is\n * a library implementation, which defines what will be emitted by an Observable, and when it be will emitted. This means\n * that calling `subscribe` is actually the moment when Observable starts its work, not when it is created, as it is often\n * the thought.\n *\n * Apart from starting the execution of an Observable, this method allows you to listen for values\n * that an Observable emits, as well as for when it completes or errors. You can achieve this in two\n * of the following ways.\n *\n * The first way is creating an object that implements {@link Observer} interface. It should have methods\n * defined by that interface, but note that it should be just a regular JavaScript object, which you can create\n * yourself in any way you want (ES6 class, classic function constructor, object literal etc.). In particular, do\n * not attempt to use any RxJS implementation details to create Observers - you don't need them. Remember also\n * that your object does not have to implement all methods. If you find yourself creating a method that doesn't\n * do anything, you can simply omit it. Note however, if the `error` method is not provided and an error happens,\n * it will be thrown asynchronously. Errors thrown asynchronously cannot be caught using `try`/`catch`. Instead,\n * use the {@link onUnhandledError} configuration option or use a runtime handler (like `window.onerror` or\n * `process.on('error)`) to be notified of unhandled errors. Because of this, it's recommended that you provide\n * an `error` method to avoid missing thrown errors.\n *\n * The second way is to give up on Observer object altogether and simply provide callback functions in place of its methods.\n * This means you can provide three functions as arguments to `subscribe`, where the first function is equivalent\n * of a `next` method, the second of an `error` method and the third of a `complete` method. Just as in case of an Observer,\n * if you do not need to listen for something, you can omit a function by passing `undefined` or `null`,\n * since `subscribe` recognizes these functions by where they were placed in function call. When it comes\n * to the `error` function, as with an Observer, if not provided, errors emitted by an Observable will be thrown asynchronously.\n *\n * You can, however, subscribe with no parameters at all. This may be the case where you're not interested in terminal events\n * and you also handled emissions internally by using operators (e.g. using `tap`).\n *\n * Whichever style of calling `subscribe` you use, in both cases it returns a Subscription object.\n * This object allows you to call `unsubscribe` on it, which in turn will stop the work that an Observable does and will clean\n * up all resources that an Observable used. Note that cancelling a subscription will not call `complete` callback\n * provided to `subscribe` function, which is reserved for a regular completion signal that comes from an Observable.\n *\n * Remember that callbacks provided to `subscribe` are not guaranteed to be called asynchronously.\n * It is an Observable itself that decides when these functions will be called. For example {@link of}\n * by default emits all its values synchronously. Always check documentation for how given Observable\n * will behave when subscribed and if its default behavior can be modified with a `scheduler`.\n *\n * #### Examples\n *\n * Subscribe with an {@link guide/observer Observer}\n *\n * ```ts\n * import { of } from 'rxjs';\n *\n * const sumObserver = {\n * sum: 0,\n * next(value) {\n * console.log('Adding: ' + value);\n * this.sum = this.sum + value;\n * },\n * error() {\n * // We actually could just remove this method,\n * // since we do not really care about errors right now.\n * },\n * complete() {\n * console.log('Sum equals: ' + this.sum);\n * }\n * };\n *\n * of(1, 2, 3) // Synchronously emits 1, 2, 3 and then completes.\n * .subscribe(sumObserver);\n *\n * // Logs:\n * // 'Adding: 1'\n * // 'Adding: 2'\n * // 'Adding: 3'\n * // 'Sum equals: 6'\n * ```\n *\n * Subscribe with functions ({@link deprecations/subscribe-arguments deprecated})\n *\n * ```ts\n * import { of } from 'rxjs'\n *\n * let sum = 0;\n *\n * of(1, 2, 3).subscribe(\n * value => {\n * console.log('Adding: ' + value);\n * sum = sum + value;\n * },\n * undefined,\n * () => console.log('Sum equals: ' + sum)\n * );\n *\n * // Logs:\n * // 'Adding: 1'\n * // 'Adding: 2'\n * // 'Adding: 3'\n * // 'Sum equals: 6'\n * ```\n *\n * Cancel a subscription\n *\n * ```ts\n * import { interval } from 'rxjs';\n *\n * const subscription = interval(1000).subscribe({\n * next(num) {\n * console.log(num)\n * },\n * complete() {\n * // Will not be called, even when cancelling subscription.\n * console.log('completed!');\n * }\n * });\n *\n * setTimeout(() => {\n * subscription.unsubscribe();\n * console.log('unsubscribed!');\n * }, 2500);\n *\n * // Logs:\n * // 0 after 1s\n * // 1 after 2s\n * // 'unsubscribed!' after 2.5s\n * ```\n *\n * @param {Observer|Function} observerOrNext (optional) Either an observer with methods to be called,\n * or the first of three possible handlers, which is the handler for each value emitted from the subscribed\n * Observable.\n * @param {Function} error (optional) A handler for a terminal event resulting from an error. If no error handler is provided,\n * the error will be thrown asynchronously as unhandled.\n * @param {Function} complete (optional) A handler for a terminal event resulting from successful completion.\n * @return {Subscription} a subscription reference to the registered handlers\n * @method subscribe\n */\n subscribe(\n observerOrNext?: Partial> | ((value: T) => void) | null,\n error?: ((error: any) => void) | null,\n complete?: (() => void) | null\n ): Subscription {\n const subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);\n\n errorContext(() => {\n const { operator, source } = this;\n subscriber.add(\n operator\n ? // We're dealing with a subscription in the\n // operator chain to one of our lifted operators.\n operator.call(subscriber, source)\n : source\n ? // If `source` has a value, but `operator` does not, something that\n // had intimate knowledge of our API, like our `Subject`, must have\n // set it. We're going to just call `_subscribe` directly.\n this._subscribe(subscriber)\n : // In all other cases, we're likely wrapping a user-provided initializer\n // function, so we need to catch errors and handle them appropriately.\n this._trySubscribe(subscriber)\n );\n });\n\n return subscriber;\n }\n\n /** @internal */\n protected _trySubscribe(sink: Subscriber): TeardownLogic {\n try {\n return this._subscribe(sink);\n } catch (err) {\n // We don't need to return anything in this case,\n // because it's just going to try to `add()` to a subscription\n // above.\n sink.error(err);\n }\n }\n\n /**\n * Used as a NON-CANCELLABLE means of subscribing to an observable, for use with\n * APIs that expect promises, like `async/await`. You cannot unsubscribe from this.\n *\n * **WARNING**: Only use this with observables you *know* will complete. If the source\n * observable does not complete, you will end up with a promise that is hung up, and\n * potentially all of the state of an async function hanging out in memory. To avoid\n * this situation, look into adding something like {@link timeout}, {@link take},\n * {@link takeWhile}, or {@link takeUntil} amongst others.\n *\n * #### Example\n *\n * ```ts\n * import { interval, take } from 'rxjs';\n *\n * const source$ = interval(1000).pipe(take(4));\n *\n * async function getTotal() {\n * let total = 0;\n *\n * await source$.forEach(value => {\n * total += value;\n * console.log('observable -> ' + value);\n * });\n *\n * return total;\n * }\n *\n * getTotal().then(\n * total => console.log('Total: ' + total)\n * );\n *\n * // Expected:\n * // 'observable -> 0'\n * // 'observable -> 1'\n * // 'observable -> 2'\n * // 'observable -> 3'\n * // 'Total: 6'\n * ```\n *\n * @param next a handler for each value emitted by the observable\n * @return a promise that either resolves on observable completion or\n * rejects with the handled error\n */\n forEach(next: (value: T) => void): Promise;\n\n /**\n * @param next a handler for each value emitted by the observable\n * @param promiseCtor a constructor function used to instantiate the Promise\n * @return a promise that either resolves on observable completion or\n * rejects with the handled error\n * @deprecated Passing a Promise constructor will no longer be available\n * in upcoming versions of RxJS. This is because it adds weight to the library, for very\n * little benefit. If you need this functionality, it is recommended that you either\n * polyfill Promise, or you create an adapter to convert the returned native promise\n * to whatever promise implementation you wanted. Will be removed in v8.\n */\n forEach(next: (value: T) => void, promiseCtor: PromiseConstructorLike): Promise;\n\n forEach(next: (value: T) => void, promiseCtor?: PromiseConstructorLike): Promise {\n promiseCtor = getPromiseCtor(promiseCtor);\n\n return new promiseCtor((resolve, reject) => {\n const subscriber = new SafeSubscriber({\n next: (value) => {\n try {\n next(value);\n } catch (err) {\n reject(err);\n subscriber.unsubscribe();\n }\n },\n error: reject,\n complete: resolve,\n });\n this.subscribe(subscriber);\n }) as Promise;\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber): TeardownLogic {\n return this.source?.subscribe(subscriber);\n }\n\n /**\n * An interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable\n * @method Symbol.observable\n * @return {Observable} this instance of the observable\n */\n [Symbol_observable]() {\n return this;\n }\n\n /* tslint:disable:max-line-length */\n pipe(): Observable;\n pipe(op1: OperatorFunction): Observable;\n pipe(op1: OperatorFunction, op2: OperatorFunction): Observable;\n pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction,\n op6: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction,\n op6: OperatorFunction,\n op7: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction,\n op6: OperatorFunction,\n op7: OperatorFunction,\n op8: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction,\n op6: OperatorFunction,\n op7: OperatorFunction,\n op8: OperatorFunction,\n op9: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction,\n op6: OperatorFunction,\n op7: OperatorFunction,\n op8: OperatorFunction,\n op9: OperatorFunction,\n ...operations: OperatorFunction[]\n ): Observable;\n /* tslint:enable:max-line-length */\n\n /**\n * Used to stitch together functional operators into a chain.\n * @method pipe\n * @return {Observable} the Observable result of all of the operators having\n * been called in the order they were passed in.\n *\n * ## Example\n *\n * ```ts\n * import { interval, filter, map, scan } from 'rxjs';\n *\n * interval(1000)\n * .pipe(\n * filter(x => x % 2 === 0),\n * map(x => x + x),\n * scan((acc, x) => acc + x)\n * )\n * .subscribe(x => console.log(x));\n * ```\n */\n pipe(...operations: OperatorFunction[]): Observable {\n return pipeFromArray(operations)(this);\n }\n\n /* tslint:disable:max-line-length */\n /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */\n toPromise(): Promise;\n /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */\n toPromise(PromiseCtor: typeof Promise): Promise;\n /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */\n toPromise(PromiseCtor: PromiseConstructorLike): Promise;\n /* tslint:enable:max-line-length */\n\n /**\n * Subscribe to this Observable and get a Promise resolving on\n * `complete` with the last emission (if any).\n *\n * **WARNING**: Only use this with observables you *know* will complete. If the source\n * observable does not complete, you will end up with a promise that is hung up, and\n * potentially all of the state of an async function hanging out in memory. To avoid\n * this situation, look into adding something like {@link timeout}, {@link take},\n * {@link takeWhile}, or {@link takeUntil} amongst others.\n *\n * @method toPromise\n * @param [promiseCtor] a constructor function used to instantiate\n * the Promise\n * @return A Promise that resolves with the last value emit, or\n * rejects on an error. If there were no emissions, Promise\n * resolves with undefined.\n * @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise\n */\n toPromise(promiseCtor?: PromiseConstructorLike): Promise {\n promiseCtor = getPromiseCtor(promiseCtor);\n\n return new promiseCtor((resolve, reject) => {\n let value: T | undefined;\n this.subscribe(\n (x: T) => (value = x),\n (err: any) => reject(err),\n () => resolve(value)\n );\n }) as Promise;\n }\n}\n\n/**\n * Decides between a passed promise constructor from consuming code,\n * A default configured promise constructor, and the native promise\n * constructor and returns it. If nothing can be found, it will throw\n * an error.\n * @param promiseCtor The optional promise constructor to passed by consuming code\n */\nfunction getPromiseCtor(promiseCtor: PromiseConstructorLike | undefined) {\n return promiseCtor ?? config.Promise ?? Promise;\n}\n\nfunction isObserver(value: any): value is Observer {\n return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);\n}\n\nfunction isSubscriber(value: any): value is Subscriber {\n return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));\n}\n", "import { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { OperatorFunction } from '../types';\nimport { isFunction } from './isFunction';\n\n/**\n * Used to determine if an object is an Observable with a lift function.\n */\nexport function hasLift(source: any): source is { lift: InstanceType['lift'] } {\n return isFunction(source?.lift);\n}\n\n/**\n * Creates an `OperatorFunction`. Used to define operators throughout the library in a concise way.\n * @param init The logic to connect the liftedSource to the subscriber at the moment of subscription.\n */\nexport function operate(\n init: (liftedSource: Observable, subscriber: Subscriber) => (() => void) | void\n): OperatorFunction {\n return (source: Observable) => {\n if (hasLift(source)) {\n return source.lift(function (this: Subscriber, liftedSource: Observable) {\n try {\n return init(liftedSource, this);\n } catch (err) {\n this.error(err);\n }\n });\n }\n throw new TypeError('Unable to lift unknown Observable type');\n };\n}\n", "import { Subscriber } from '../Subscriber';\n\n/**\n * Creates an instance of an `OperatorSubscriber`.\n * @param destination The downstream subscriber.\n * @param onNext Handles next values, only called if this subscriber is not stopped or closed. Any\n * error that occurs in this function is caught and sent to the `error` method of this subscriber.\n * @param onError Handles errors from the subscription, any errors that occur in this handler are caught\n * and send to the `destination` error handler.\n * @param onComplete Handles completion notification from the subscription. Any errors that occur in\n * this handler are sent to the `destination` error handler.\n * @param onFinalize Additional teardown logic here. This will only be called on teardown if the\n * subscriber itself is not already closed. This is called after all other teardown logic is executed.\n */\nexport function createOperatorSubscriber(\n destination: Subscriber,\n onNext?: (value: T) => void,\n onComplete?: () => void,\n onError?: (err: any) => void,\n onFinalize?: () => void\n): Subscriber {\n return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);\n}\n\n/**\n * A generic helper for allowing operators to be created with a Subscriber and\n * use closures to capture necessary state from the operator function itself.\n */\nexport class OperatorSubscriber extends Subscriber {\n /**\n * Creates an instance of an `OperatorSubscriber`.\n * @param destination The downstream subscriber.\n * @param onNext Handles next values, only called if this subscriber is not stopped or closed. Any\n * error that occurs in this function is caught and sent to the `error` method of this subscriber.\n * @param onError Handles errors from the subscription, any errors that occur in this handler are caught\n * and send to the `destination` error handler.\n * @param onComplete Handles completion notification from the subscription. Any errors that occur in\n * this handler are sent to the `destination` error handler.\n * @param onFinalize Additional finalization logic here. This will only be called on finalization if the\n * subscriber itself is not already closed. This is called after all other finalization logic is executed.\n * @param shouldUnsubscribe An optional check to see if an unsubscribe call should truly unsubscribe.\n * NOTE: This currently **ONLY** exists to support the strange behavior of {@link groupBy}, where unsubscription\n * to the resulting observable does not actually disconnect from the source if there are active subscriptions\n * to any grouped observable. (DO NOT EXPOSE OR USE EXTERNALLY!!!)\n */\n constructor(\n destination: Subscriber,\n onNext?: (value: T) => void,\n onComplete?: () => void,\n onError?: (err: any) => void,\n private onFinalize?: () => void,\n private shouldUnsubscribe?: () => boolean\n ) {\n // It's important - for performance reasons - that all of this class's\n // members are initialized and that they are always initialized in the same\n // order. This will ensure that all OperatorSubscriber instances have the\n // same hidden class in V8. This, in turn, will help keep the number of\n // hidden classes involved in property accesses within the base class as\n // low as possible. If the number of hidden classes involved exceeds four,\n // the property accesses will become megamorphic and performance penalties\n // will be incurred - i.e. inline caches won't be used.\n //\n // The reasons for ensuring all instances have the same hidden class are\n // further discussed in this blog post from Benedikt Meurer:\n // https://benediktmeurer.de/2018/03/23/impact-of-polymorphism-on-component-based-frameworks-like-react/\n super(destination);\n this._next = onNext\n ? function (this: OperatorSubscriber, value: T) {\n try {\n onNext(value);\n } catch (err) {\n destination.error(err);\n }\n }\n : super._next;\n this._error = onError\n ? function (this: OperatorSubscriber, err: any) {\n try {\n onError(err);\n } catch (err) {\n // Send any errors that occur down stream.\n destination.error(err);\n } finally {\n // Ensure finalization.\n this.unsubscribe();\n }\n }\n : super._error;\n this._complete = onComplete\n ? function (this: OperatorSubscriber) {\n try {\n onComplete();\n } catch (err) {\n // Send any errors that occur down stream.\n destination.error(err);\n } finally {\n // Ensure finalization.\n this.unsubscribe();\n }\n }\n : super._complete;\n }\n\n unsubscribe() {\n if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {\n const { closed } = this;\n super.unsubscribe();\n // Execute additional teardown if we have any and we didn't already do so.\n !closed && this.onFinalize?.();\n }\n }\n}\n", "import { createErrorClass } from './createErrorClass';\n\nexport interface ObjectUnsubscribedError extends Error {}\n\nexport interface ObjectUnsubscribedErrorCtor {\n /**\n * @deprecated Internal implementation detail. Do not construct error instances.\n * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269\n */\n new (): ObjectUnsubscribedError;\n}\n\n/**\n * An error thrown when an action is invalid because the object has been\n * unsubscribed.\n *\n * @see {@link Subject}\n * @see {@link BehaviorSubject}\n *\n * @class ObjectUnsubscribedError\n */\nexport const ObjectUnsubscribedError: ObjectUnsubscribedErrorCtor = createErrorClass(\n (_super) =>\n function ObjectUnsubscribedErrorImpl(this: any) {\n _super(this);\n this.name = 'ObjectUnsubscribedError';\n this.message = 'object unsubscribed';\n }\n);\n", "import { Operator } from './Operator';\nimport { Observable } from './Observable';\nimport { Subscriber } from './Subscriber';\nimport { Subscription, EMPTY_SUBSCRIPTION } from './Subscription';\nimport { Observer, SubscriptionLike, TeardownLogic } from './types';\nimport { ObjectUnsubscribedError } from './util/ObjectUnsubscribedError';\nimport { arrRemove } from './util/arrRemove';\nimport { errorContext } from './util/errorContext';\n\n/**\n * A Subject is a special type of Observable that allows values to be\n * multicasted to many Observers. Subjects are like EventEmitters.\n *\n * Every Subject is an Observable and an Observer. You can subscribe to a\n * Subject, and you can call next to feed values as well as error and complete.\n */\nexport class Subject extends Observable implements SubscriptionLike {\n closed = false;\n\n private currentObservers: Observer[] | null = null;\n\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n observers: Observer[] = [];\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n isStopped = false;\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n hasError = false;\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n thrownError: any = null;\n\n /**\n * Creates a \"subject\" by basically gluing an observer to an observable.\n *\n * @nocollapse\n * @deprecated Recommended you do not use. Will be removed at some point in the future. Plans for replacement still under discussion.\n */\n static create: (...args: any[]) => any = (destination: Observer, source: Observable): AnonymousSubject => {\n return new AnonymousSubject(destination, source);\n };\n\n constructor() {\n // NOTE: This must be here to obscure Observable's constructor.\n super();\n }\n\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n lift(operator: Operator): Observable {\n const subject = new AnonymousSubject(this, this);\n subject.operator = operator as any;\n return subject as any;\n }\n\n /** @internal */\n protected _throwIfClosed() {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n }\n\n next(value: T) {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n if (!this.currentObservers) {\n this.currentObservers = Array.from(this.observers);\n }\n for (const observer of this.currentObservers) {\n observer.next(value);\n }\n }\n });\n }\n\n error(err: any) {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n this.hasError = this.isStopped = true;\n this.thrownError = err;\n const { observers } = this;\n while (observers.length) {\n observers.shift()!.error(err);\n }\n }\n });\n }\n\n complete() {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n this.isStopped = true;\n const { observers } = this;\n while (observers.length) {\n observers.shift()!.complete();\n }\n }\n });\n }\n\n unsubscribe() {\n this.isStopped = this.closed = true;\n this.observers = this.currentObservers = null!;\n }\n\n get observed() {\n return this.observers?.length > 0;\n }\n\n /** @internal */\n protected _trySubscribe(subscriber: Subscriber): TeardownLogic {\n this._throwIfClosed();\n return super._trySubscribe(subscriber);\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber): Subscription {\n this._throwIfClosed();\n this._checkFinalizedStatuses(subscriber);\n return this._innerSubscribe(subscriber);\n }\n\n /** @internal */\n protected _innerSubscribe(subscriber: Subscriber) {\n const { hasError, isStopped, observers } = this;\n if (hasError || isStopped) {\n return EMPTY_SUBSCRIPTION;\n }\n this.currentObservers = null;\n observers.push(subscriber);\n return new Subscription(() => {\n this.currentObservers = null;\n arrRemove(observers, subscriber);\n });\n }\n\n /** @internal */\n protected _checkFinalizedStatuses(subscriber: Subscriber) {\n const { hasError, thrownError, isStopped } = this;\n if (hasError) {\n subscriber.error(thrownError);\n } else if (isStopped) {\n subscriber.complete();\n }\n }\n\n /**\n * Creates a new Observable with this Subject as the source. You can do this\n * to create custom Observer-side logic of the Subject and conceal it from\n * code that uses the Observable.\n * @return {Observable} Observable that the Subject casts to\n */\n asObservable(): Observable {\n const observable: any = new Observable();\n observable.source = this;\n return observable;\n }\n}\n\n/**\n * @class AnonymousSubject\n */\nexport class AnonymousSubject extends Subject {\n constructor(\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n public destination?: Observer,\n source?: Observable\n ) {\n super();\n this.source = source;\n }\n\n next(value: T) {\n this.destination?.next?.(value);\n }\n\n error(err: any) {\n this.destination?.error?.(err);\n }\n\n complete() {\n this.destination?.complete?.();\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber): Subscription {\n return this.source?.subscribe(subscriber) ?? EMPTY_SUBSCRIPTION;\n }\n}\n", "import { Subject } from './Subject';\nimport { Subscriber } from './Subscriber';\nimport { Subscription } from './Subscription';\n\n/**\n * A variant of Subject that requires an initial value and emits its current\n * value whenever it is subscribed to.\n *\n * @class BehaviorSubject\n */\nexport class BehaviorSubject extends Subject {\n constructor(private _value: T) {\n super();\n }\n\n get value(): T {\n return this.getValue();\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber): Subscription {\n const subscription = super._subscribe(subscriber);\n !subscription.closed && subscriber.next(this._value);\n return subscription;\n }\n\n getValue(): T {\n const { hasError, thrownError, _value } = this;\n if (hasError) {\n throw thrownError;\n }\n this._throwIfClosed();\n return _value;\n }\n\n next(value: T): void {\n super.next((this._value = value));\n }\n}\n", "import { TimestampProvider } from '../types';\n\ninterface DateTimestampProvider extends TimestampProvider {\n delegate: TimestampProvider | undefined;\n}\n\nexport const dateTimestampProvider: DateTimestampProvider = {\n now() {\n // Use the variable rather than `this` so that the function can be called\n // without being bound to the provider.\n return (dateTimestampProvider.delegate || Date).now();\n },\n delegate: undefined,\n};\n", "import { Scheduler } from '../Scheduler';\nimport { Subscription } from '../Subscription';\nimport { SchedulerAction } from '../types';\n\n/**\n * A unit of work to be executed in a `scheduler`. An action is typically\n * created from within a {@link SchedulerLike} and an RxJS user does not need to concern\n * themselves about creating and manipulating an Action.\n *\n * ```ts\n * class Action extends Subscription {\n * new (scheduler: Scheduler, work: (state?: T) => void);\n * schedule(state?: T, delay: number = 0): Subscription;\n * }\n * ```\n *\n * @class Action\n */\nexport class Action extends Subscription {\n constructor(scheduler: Scheduler, work: (this: SchedulerAction, state?: T) => void) {\n super();\n }\n /**\n * Schedules this action on its parent {@link SchedulerLike} for execution. May be passed\n * some context object, `state`. May happen at some point in the future,\n * according to the `delay` parameter, if specified.\n * @param {T} [state] Some contextual data that the `work` function uses when\n * called by the Scheduler.\n * @param {number} [delay] Time to wait before executing the work, where the\n * time unit is implicit and defined by the Scheduler.\n * @return {void}\n */\n public schedule(state?: T, delay: number = 0): Subscription {\n return this;\n }\n}\n", "import type { TimerHandle } from './timerHandle';\ntype SetIntervalFunction = (handler: () => void, timeout?: number, ...args: any[]) => TimerHandle;\ntype ClearIntervalFunction = (handle: TimerHandle) => void;\n\ninterface IntervalProvider {\n setInterval: SetIntervalFunction;\n clearInterval: ClearIntervalFunction;\n delegate:\n | {\n setInterval: SetIntervalFunction;\n clearInterval: ClearIntervalFunction;\n }\n | undefined;\n}\n\nexport const intervalProvider: IntervalProvider = {\n // When accessing the delegate, use the variable rather than `this` so that\n // the functions can be called without being bound to the provider.\n setInterval(handler: () => void, timeout?: number, ...args) {\n const { delegate } = intervalProvider;\n if (delegate?.setInterval) {\n return delegate.setInterval(handler, timeout, ...args);\n }\n return setInterval(handler, timeout, ...args);\n },\n clearInterval(handle) {\n const { delegate } = intervalProvider;\n return (delegate?.clearInterval || clearInterval)(handle as any);\n },\n delegate: undefined,\n};\n", "import { Action } from './Action';\nimport { SchedulerAction } from '../types';\nimport { Subscription } from '../Subscription';\nimport { AsyncScheduler } from './AsyncScheduler';\nimport { intervalProvider } from './intervalProvider';\nimport { arrRemove } from '../util/arrRemove';\nimport { TimerHandle } from './timerHandle';\n\nexport class AsyncAction extends Action {\n public id: TimerHandle | undefined;\n public state?: T;\n // @ts-ignore: Property has no initializer and is not definitely assigned\n public delay: number;\n protected pending: boolean = false;\n\n constructor(protected scheduler: AsyncScheduler, protected work: (this: SchedulerAction, state?: T) => void) {\n super(scheduler, work);\n }\n\n public schedule(state?: T, delay: number = 0): Subscription {\n if (this.closed) {\n return this;\n }\n\n // Always replace the current state with the new state.\n this.state = state;\n\n const id = this.id;\n const scheduler = this.scheduler;\n\n //\n // Important implementation note:\n //\n // Actions only execute once by default, unless rescheduled from within the\n // scheduled callback. This allows us to implement single and repeat\n // actions via the same code path, without adding API surface area, as well\n // as mimic traditional recursion but across asynchronous boundaries.\n //\n // However, JS runtimes and timers distinguish between intervals achieved by\n // serial `setTimeout` calls vs. a single `setInterval` call. An interval of\n // serial `setTimeout` calls can be individually delayed, which delays\n // scheduling the next `setTimeout`, and so on. `setInterval` attempts to\n // guarantee the interval callback will be invoked more precisely to the\n // interval period, regardless of load.\n //\n // Therefore, we use `setInterval` to schedule single and repeat actions.\n // If the action reschedules itself with the same delay, the interval is not\n // canceled. If the action doesn't reschedule, or reschedules with a\n // different delay, the interval will be canceled after scheduled callback\n // execution.\n //\n if (id != null) {\n this.id = this.recycleAsyncId(scheduler, id, delay);\n }\n\n // Set the pending flag indicating that this action has been scheduled, or\n // has recursively rescheduled itself.\n this.pending = true;\n\n this.delay = delay;\n // If this action has already an async Id, don't request a new one.\n this.id = this.id ?? this.requestAsyncId(scheduler, this.id, delay);\n\n return this;\n }\n\n protected requestAsyncId(scheduler: AsyncScheduler, _id?: TimerHandle, delay: number = 0): TimerHandle {\n return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);\n }\n\n protected recycleAsyncId(_scheduler: AsyncScheduler, id?: TimerHandle, delay: number | null = 0): TimerHandle | undefined {\n // If this action is rescheduled with the same delay time, don't clear the interval id.\n if (delay != null && this.delay === delay && this.pending === false) {\n return id;\n }\n // Otherwise, if the action's delay time is different from the current delay,\n // or the action has been rescheduled before it's executed, clear the interval id\n if (id != null) {\n intervalProvider.clearInterval(id);\n }\n\n return undefined;\n }\n\n /**\n * Immediately executes this action and the `work` it contains.\n * @return {any}\n */\n public execute(state: T, delay: number): any {\n if (this.closed) {\n return new Error('executing a cancelled action');\n }\n\n this.pending = false;\n const error = this._execute(state, delay);\n if (error) {\n return error;\n } else if (this.pending === false && this.id != null) {\n // Dequeue if the action didn't reschedule itself. Don't call\n // unsubscribe(), because the action could reschedule later.\n // For example:\n // ```\n // scheduler.schedule(function doWork(counter) {\n // /* ... I'm a busy worker bee ... */\n // var originalAction = this;\n // /* wait 100ms before rescheduling the action */\n // setTimeout(function () {\n // originalAction.schedule(counter + 1);\n // }, 100);\n // }, 1000);\n // ```\n this.id = this.recycleAsyncId(this.scheduler, this.id, null);\n }\n }\n\n protected _execute(state: T, _delay: number): any {\n let errored: boolean = false;\n let errorValue: any;\n try {\n this.work(state);\n } catch (e) {\n errored = true;\n // HACK: Since code elsewhere is relying on the \"truthiness\" of the\n // return here, we can't have it return \"\" or 0 or false.\n // TODO: Clean this up when we refactor schedulers mid-version-8 or so.\n errorValue = e ? e : new Error('Scheduled action threw falsy error');\n }\n if (errored) {\n this.unsubscribe();\n return errorValue;\n }\n }\n\n unsubscribe() {\n if (!this.closed) {\n const { id, scheduler } = this;\n const { actions } = scheduler;\n\n this.work = this.state = this.scheduler = null!;\n this.pending = false;\n\n arrRemove(actions, this);\n if (id != null) {\n this.id = this.recycleAsyncId(scheduler, id, null);\n }\n\n this.delay = null!;\n super.unsubscribe();\n }\n }\n}\n", "import { Action } from './scheduler/Action';\nimport { Subscription } from './Subscription';\nimport { SchedulerLike, SchedulerAction } from './types';\nimport { dateTimestampProvider } from './scheduler/dateTimestampProvider';\n\n/**\n * An execution context and a data structure to order tasks and schedule their\n * execution. Provides a notion of (potentially virtual) time, through the\n * `now()` getter method.\n *\n * Each unit of work in a Scheduler is called an `Action`.\n *\n * ```ts\n * class Scheduler {\n * now(): number;\n * schedule(work, delay?, state?): Subscription;\n * }\n * ```\n *\n * @class Scheduler\n * @deprecated Scheduler is an internal implementation detail of RxJS, and\n * should not be used directly. Rather, create your own class and implement\n * {@link SchedulerLike}. Will be made internal in v8.\n */\nexport class Scheduler implements SchedulerLike {\n public static now: () => number = dateTimestampProvider.now;\n\n constructor(private schedulerActionCtor: typeof Action, now: () => number = Scheduler.now) {\n this.now = now;\n }\n\n /**\n * A getter method that returns a number representing the current time\n * (at the time this function was called) according to the scheduler's own\n * internal clock.\n * @return {number} A number that represents the current time. May or may not\n * have a relation to wall-clock time. May or may not refer to a time unit\n * (e.g. milliseconds).\n */\n public now: () => number;\n\n /**\n * Schedules a function, `work`, for execution. May happen at some point in\n * the future, according to the `delay` parameter, if specified. May be passed\n * some context object, `state`, which will be passed to the `work` function.\n *\n * The given arguments will be processed an stored as an Action object in a\n * queue of actions.\n *\n * @param {function(state: ?T): ?Subscription} work A function representing a\n * task, or some unit of work to be executed by the Scheduler.\n * @param {number} [delay] Time to wait before executing the work, where the\n * time unit is implicit and defined by the Scheduler itself.\n * @param {T} [state] Some contextual data that the `work` function uses when\n * called by the Scheduler.\n * @return {Subscription} A subscription in order to be able to unsubscribe\n * the scheduled work.\n */\n public schedule(work: (this: SchedulerAction, state?: T) => void, delay: number = 0, state?: T): Subscription {\n return new this.schedulerActionCtor(this, work).schedule(state, delay);\n }\n}\n", "import { Scheduler } from '../Scheduler';\nimport { Action } from './Action';\nimport { AsyncAction } from './AsyncAction';\nimport { TimerHandle } from './timerHandle';\n\nexport class AsyncScheduler extends Scheduler {\n public actions: Array> = [];\n /**\n * A flag to indicate whether the Scheduler is currently executing a batch of\n * queued actions.\n * @type {boolean}\n * @internal\n */\n public _active: boolean = false;\n /**\n * An internal ID used to track the latest asynchronous task such as those\n * coming from `setTimeout`, `setInterval`, `requestAnimationFrame`, and\n * others.\n * @type {any}\n * @internal\n */\n public _scheduled: TimerHandle | undefined;\n\n constructor(SchedulerAction: typeof Action, now: () => number = Scheduler.now) {\n super(SchedulerAction, now);\n }\n\n public flush(action: AsyncAction): void {\n const { actions } = this;\n\n if (this._active) {\n actions.push(action);\n return;\n }\n\n let error: any;\n this._active = true;\n\n do {\n if ((error = action.execute(action.state, action.delay))) {\n break;\n }\n } while ((action = actions.shift()!)); // exhaust the scheduler queue\n\n this._active = false;\n\n if (error) {\n while ((action = actions.shift()!)) {\n action.unsubscribe();\n }\n throw error;\n }\n }\n}\n", "import { AsyncAction } from './AsyncAction';\nimport { AsyncScheduler } from './AsyncScheduler';\n\n/**\n *\n * Async Scheduler\n *\n * Schedule task as if you used setTimeout(task, duration)\n *\n * `async` scheduler schedules tasks asynchronously, by putting them on the JavaScript\n * event loop queue. It is best used to delay tasks in time or to schedule tasks repeating\n * in intervals.\n *\n * If you just want to \"defer\" task, that is to perform it right after currently\n * executing synchronous code ends (commonly achieved by `setTimeout(deferredTask, 0)`),\n * better choice will be the {@link asapScheduler} scheduler.\n *\n * ## Examples\n * Use async scheduler to delay task\n * ```ts\n * import { asyncScheduler } from 'rxjs';\n *\n * const task = () => console.log('it works!');\n *\n * asyncScheduler.schedule(task, 2000);\n *\n * // After 2 seconds logs:\n * // \"it works!\"\n * ```\n *\n * Use async scheduler to repeat task in intervals\n * ```ts\n * import { asyncScheduler } from 'rxjs';\n *\n * function task(state) {\n * console.log(state);\n * this.schedule(state + 1, 1000); // `this` references currently executing Action,\n * // which we reschedule with new state and delay\n * }\n *\n * asyncScheduler.schedule(task, 3000, 0);\n *\n * // Logs:\n * // 0 after 3s\n * // 1 after 4s\n * // 2 after 5s\n * // 3 after 6s\n * ```\n */\n\nexport const asyncScheduler = new AsyncScheduler(AsyncAction);\n\n/**\n * @deprecated Renamed to {@link asyncScheduler}. Will be removed in v8.\n */\nexport const async = asyncScheduler;\n", "export const isArrayLike = ((x: any): x is ArrayLike => x && typeof x.length === 'number' && typeof x !== 'function');", "import { isFunction } from \"./isFunction\";\n\n/**\n * Tests to see if the object is \"thennable\".\n * @param value the object to test\n */\nexport function isPromise(value: any): value is PromiseLike {\n return isFunction(value?.then);\n}\n", "import { InteropObservable } from '../types';\nimport { observable as Symbol_observable } from '../symbol/observable';\nimport { isFunction } from './isFunction';\n\n/** Identifies an input as being Observable (but not necessary an Rx Observable) */\nexport function isInteropObservable(input: any): input is InteropObservable {\n return isFunction(input[Symbol_observable]);\n}\n", "import { isFunction } from './isFunction';\n\nexport function isAsyncIterable(obj: any): obj is AsyncIterable {\n return Symbol.asyncIterator && isFunction(obj?.[Symbol.asyncIterator]);\n}\n", "/**\n * Creates the TypeError to throw if an invalid object is passed to `from` or `scheduled`.\n * @param input The object that was passed.\n */\nexport function createInvalidObservableTypeError(input: any) {\n // TODO: We should create error codes that can be looked up, so this can be less verbose.\n return new TypeError(\n `You provided ${\n input !== null && typeof input === 'object' ? 'an invalid object' : `'${input}'`\n } where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`\n );\n}\n", "export function getSymbolIterator(): symbol {\n if (typeof Symbol !== 'function' || !Symbol.iterator) {\n return '@@iterator' as any;\n }\n\n return Symbol.iterator;\n}\n\nexport const iterator = getSymbolIterator();\n", "import { iterator as Symbol_iterator } from '../symbol/iterator';\nimport { isFunction } from './isFunction';\n\n/** Identifies an input as being an Iterable */\nexport function isIterable(input: any): input is Iterable {\n return isFunction(input?.[Symbol_iterator]);\n}\n", "import { ReadableStreamLike } from '../types';\nimport { isFunction } from './isFunction';\n\nexport async function* readableStreamLikeToAsyncGenerator(readableStream: ReadableStreamLike): AsyncGenerator {\n const reader = readableStream.getReader();\n try {\n while (true) {\n const { value, done } = await reader.read();\n if (done) {\n return;\n }\n yield value!;\n }\n } finally {\n reader.releaseLock();\n }\n}\n\nexport function isReadableStreamLike(obj: any): obj is ReadableStreamLike {\n // We don't want to use instanceof checks because they would return\n // false for instances from another Realm, like an