{"version":3,"file":"main.dfd2214ee0e933e3.js","sources":["webpack:///./src/app/accounts/enums/register-types.enums.ts","webpack:///./src/app/accounts/guards/verified.guard.ts","webpack:///./src/app/accounts/services/accounts.service.ts","webpack:///./src/app/analyses/components/add/from-to.validator.ts","webpack:///./src/app/analyses/interfaces/analyses.types.ts","webpack:///./src/app/analyses/interfaces/analysis-id.enum.ts","webpack:///./src/app/analyses/interfaces/analytics-form-key.interface.ts","webpack:///./src/app/analyses/modals/bf-circumference-instructions/bf-circumference-instructions.modal.ts","webpack:///./src/app/analyses/modals/bf-circumference-instructions/bf-circumference-instructions.modal.html","webpack:///./src/app/analyses/modals/circumference-instructions/circumference-instructions.modal.html","webpack:///./src/app/analyses/modals/circumference-instructions/circumference-instructions.modal.ts","webpack:///./src/app/analyses/modals/heart-rate-instructions/heart-rate-instructions.modal.html","webpack:///./src/app/analyses/modals/heart-rate-instructions/heart-rate-instructions.modal.ts","webpack:///./src/app/analyses/modals/servings/servings.component.html","webpack:///./src/app/analyses/modals/servings/servings.component.ts","webpack:///./src/app/analyses/services/analyses.service.ts","webpack:///./src/app/analyses/util/link-util.ts","webpack:///./src/app/ancestry/services/ancestry-api.service.ts","webpack:///./src/app/ancestry/services/ancestry.service.ts","webpack:///./src/app/app.constants.ts","webpack:///./node_modules/@angular/common/locales/en-CH.mjs","webpack:///./node_modules/@angular/common/locales/en-DE.mjs","webpack:///./node_modules/@angular/common/locales/en-GB.mjs","webpack:///./node_modules/@angular/common/locales/en.mjs","webpack:///./node_modules/@angular/common/locales/pl.mjs","webpack:///./node_modules/@angular/common/locales/sl.mjs","webpack:///./node_modules/@angular/common/locales/sk.mjs","webpack:///./node_modules/@angular/common/locales/th.mjs","webpack:///./src/app/app.utils.ts","webpack:///./src/app/blood/components/blood-add-choice/blood-add-choice.component.html","webpack:///./src/app/blood/components/blood-add-choice/blood-add-choice.component.ts","webpack:///./src/app/blood/directives/blood-add-host.directive.ts","webpack:///./src/app/blood/components/blood-add-host/blood-add-host.component.html","webpack:///./src/app/blood/components/blood-add-host/blood-add-host.component.ts","webpack:///./src/app/blood/components/blood-add-host/blood-add.service.ts","webpack:///./src/app/blood/components/blood-add-marker-modal/blood-add-marker-modal.component.ts","webpack:///./src/app/blood/components/blood-add-marker-modal/blood-add-marker-modal.component.html","webpack:///./src/app/blood/components/blood-add-value/blood-add-value.component.html","webpack:///./src/app/blood/components/blood-add-value/blood-add-value.component.ts","webpack:///./src/app/body-measurements/directives/measurement-add-host.directive.ts","webpack:///./src/app/body-measurements/directives/measurement-add-base.directive.ts","webpack:///./src/app/body-measurements/validators/pattern.validator.ts","webpack:///./src/app/body-measurements/components/forms/measurement-add-blood-pressure/systolic-diastolic.validator.ts","webpack:///./src/app/body-measurements/components/measurement-add-buttons/measurement-add-buttons.component.html","webpack:///./src/app/body-measurements/components/measurement-add-buttons/measurement-add-buttons.component.ts","webpack:///./src/app/body-measurements/components/forms/measurement-add-blood-pressure/measurement-add-blood-pressure.component.html","webpack:///./src/app/body-measurements/components/forms/measurement-add-blood-pressure/measurement-add-blood-pressure.component.ts","webpack:///./src/app/body-measurements/components/forms/measurement-add-bmi/measurement-add-bmi.component.html","webpack:///./src/app/body-measurements/components/forms/measurement-add-bmi/measurement-add-bmi.component.ts","webpack:///./src/app/body-measurements/components/forms/measurement-add-body-fat-manual/measurement-add-body-fat-manual.component.html","webpack:///./src/app/body-measurements/components/forms/measurement-add-body-fat-manual/measurement-add-body-fat-manual.component.ts","webpack:///./src/app/body-measurements/components/forms/measurement-add-body-fat/measurement-add-body-fat.component.html","webpack:///./src/app/body-measurements/components/forms/measurement-add-body-fat/measurement-add-body-fat.component.ts","webpack:///./src/app/body-measurements/components/forms/measurement-add-weight/measurement-add-weight.component.html","webpack:///./src/app/body-measurements/components/forms/measurement-add-weight/measurement-add-weight.component.ts","webpack:///./src/app/body-measurements/components/forms/measurement-add-heart-rate/measurement-add-heart-rate.component.html","webpack:///./src/app/body-measurements/components/forms/measurement-add-heart-rate/measurement-add-heart-rate.component.ts","webpack:///./src/app/body-measurements/components/forms/measurement-add-height/measurement-add-height.component.html","webpack:///./src/app/body-measurements/components/forms/measurement-add-height/measurement-add-height.component.ts","webpack:///./src/app/body-measurements/components/forms/measurement-add-waist-circumference/measurement-add-waist-circumference.component.html","webpack:///./src/app/body-measurements/components/forms/measurement-add-waist-circumference/measurement-add-waist-circumference.component.ts","webpack:///./src/app/body-measurements/components/measurement-add-host/measurement-add-host.component.html","webpack:///./src/app/body-measurements/components/measurement-add-host/measurement-add-host.component.ts","webpack:///./src/app/body-measurements/components/measurement-add-host/measurement-add-host.service.ts","webpack:///./src/app/body-measurements/components/measurement-add-modal/measurement-add-modal.component.html","webpack:///./src/app/body-measurements/components/measurement-add-modal/measurement-add-modal.component.ts","webpack:///./src/app/core/constants/local-storage-keys.ts","webpack:///./src/app/core/interceptors/http-interceptor.ts","webpack:///./src/app/core/interceptors/internal-server-error-interceptor.ts","webpack:///./src/app/core/services/layout.service.ts","webpack:///./src/app/core/services/results.service.ts","webpack:///./src/app/core/services/side-menu.service.ts","webpack:///./src/app/customers/guards/exists.guard.ts","webpack:///./src/app/healthscore/constants/healthscore-tabs.ts","webpack:///./src/app/healthscore/services/questionnaire.service.ts","webpack:///./src/app/lokalise/lokalise-translate.service.ts","webpack:///./src/app/lokalise/index.ts","webpack:///./src/app/lokalise/lokalise-translate.pipe.ts","webpack:///./src/app/lokalise/lokalise.service.ts","webpack:///./src/app/lokalise/provider.ts","webpack:///./src/app/me/services/me.service.ts","webpack:///./src/app/nipt/services/nipt-api.service.ts","webpack:///./src/app/onboarding/lab/enums/lab.enum.ts","webpack:///./src/app/questionnaire/components/add-modal/add-modal.component.ts","webpack:///./src/app/questionnaire/components/add-modal/add-modal.component.html","webpack:///./src/app/questionnaire/directives/questionnaire-host.directive.ts","webpack:///./src/app/questionnaire/constants/control-container-provider.ts","webpack:///./src/app/questionnaire/answers/simple-options/simple-options.component.html","webpack:///./src/app/questionnaire/answers/simple-options/simple-options.component.ts","webpack:///./src/app/questionnaire/answers/number-input/number-input.component.html","webpack:///./src/app/questionnaire/answers/number-input/number-input.component.ts","webpack:///./src/app/questionnaire/answers/input-options/input-options.component.html","webpack:///./src/app/questionnaire/answers/input-options/input-options.component.ts","webpack:///./src/app/questionnaire/answers/number-slider/number-slider.component.html","webpack:///./src/app/questionnaire/answers/number-slider/number-slider.component.ts","webpack:///./src/app/questionnaire/answers/time-dropdown/time-dropdown.component.html","webpack:///./src/app/questionnaire/answers/time-dropdown/time-dropdown.component.ts","webpack:///./src/app/questionnaire/components/examples-modal-buttons/examples-modal-buttons.component.html","webpack:///./src/app/questionnaire/components/examples-modal-buttons/examples-modal-buttons.component.ts","webpack:///./src/app/questionnaire/components/simple-questionnaire/simple-questionnaire.component.html","webpack:///./src/app/questionnaire/components/simple-questionnaire/simple-questionnaire.component.ts","webpack:///./src/app/questionnaire/components/physical-questionnaire/physical-questionnaire.component.html","webpack:///./src/app/questionnaire/components/physical-questionnaire/physical-questionnaire.component.ts","webpack:///./src/app/questionnaire/components/questionnaire-date/questionnaire-date.component.html","webpack:///./src/app/questionnaire/components/questionnaire-date/questionnaire-date.component.ts","webpack:///./src/app/questionnaire/components/questionnaire-host/questionnaire-host.component.html","webpack:///./src/app/questionnaire/components/questionnaire-host/questionnaire-host.component.ts","webpack:///./src/app/shared/components/add-data-list/add-data-list.component.ts","webpack:///./src/app/shared/components/add-data-list/add-data-list.component.html","webpack:///./src/app/shared/components/analyses-groups/analyses-groups.component.html","webpack:///./src/app/shared/components/analyses-groups/analyses-groups.component.ts","webpack:///./src/app/shared/components/analyses-list/analyses-list.component.html","webpack:///./src/app/shared/components/analyses-list/analyses-list.component.ts","webpack:///./src/app/shared/components/analysis-header/analysis-header.component.html","webpack:///./src/app/shared/components/analysis-header/analysis-header.component.ts","webpack:///./src/app/shared/components/analysis-header/components/button/button.component.ts","webpack:///./src/app/shared/components/analysis-header/components/button/button.component.html","webpack:///./src/app/shared/components/analysis-header/components/subtitle/subtitle.component.ts","webpack:///./src/app/shared/components/analysis-header/components/subtitle/subtitle.component.html","webpack:///./src/app/shared/components/analysis-header/components/tab/tab.component.ts","webpack:///./src/app/shared/components/analysis-header/components/tab/tab.component.html","webpack:///./src/app/shared/components/analysis-header/components/title/title.component.ts","webpack:///./src/app/shared/components/analysis-header/components/title/title.component.html","webpack:///./src/app/shared/components/analysis-header/components/top-content/top-content.component.ts","webpack:///./src/app/shared/components/analysis-header/components/top-content/top-content.component.html","webpack:///./src/app/shared/components/analysis-link/analysis-link.component.html","webpack:///./src/app/shared/components/analysis-link/analysis-link.component.ts","webpack:///./src/app/shared/components/bottom-offset/bottom-offset.component.html","webpack:///./src/app/shared/components/bottom-offset/bottom-offset.component.ts","webpack:///./src/app/shared/components/card-nav-item/card-nav-item.component.html","webpack:///./src/app/shared/components/card-nav-item/card-nav-item.component.ts","webpack:///./src/app/shared/components/chapter-card/chapter-card.component.ts","webpack:///./src/app/shared/components/chapter-card/chapter-card.component.html","webpack:///./src/app/shared/components/chapter-card/components/image/image.component.ts","webpack:///./src/app/shared/components/chapter-card/components/image/image.component.html","webpack:///./src/app/shared/components/chapter-card/components/title/title.component.ts","webpack:///./src/app/shared/components/chapter-card/components/title/title.component.html","webpack:///./src/app/shared/components/claimed-kit-progress/claimed-kit-progress.component.html","webpack:///./src/app/shared/components/claimed-kit-progress/claimed-kit-progress.component.ts","webpack:///./src/app/shared/components/consulting/consulting.constants.ts","webpack:///./src/app/shared/components/consulting/consulting.component.html","webpack:///./src/app/shared/components/consulting/consulting.component.ts","webpack:///./src/app/shared/components/container-popover/container-popover.component.ts","webpack:///./src/app/shared/components/container-popover/container-popover.component.html","webpack:///./src/app/shared/components/counter/counter.component.ts","webpack:///./src/app/shared/components/evidence-level/evidence-level.component.html","webpack:///./src/app/shared/components/evidence-level/evidence-level.component.ts","webpack:///./src/app/shared/components/form-page-footer/form-page-footer.component.ts","webpack:///./src/app/shared/components/image-card/components/button/button.component.ts","webpack:///./src/app/shared/components/image-card/components/button/button.component.html","webpack:///./src/app/shared/components/image-card/components/description/description.component.ts","webpack:///./src/app/shared/components/image-card/components/description/description.component.html","webpack:///./src/app/shared/components/image-card/components/tag/tag.component.ts","webpack:///./src/app/shared/components/image-card/components/tag/tag.component.html","webpack:///./src/app/shared/components/image-card/components/title/title.component.ts","webpack:///./src/app/shared/components/image-card/components/title/title.component.html","webpack:///./src/app/shared/components/image-card/image-card.component.ts","webpack:///./src/app/shared/components/image-card/image-card.component.html","webpack:///./src/app/shared/components/image-header/image-header.component.ts","webpack:///./src/app/shared/components/image-header/image-header.component.html","webpack:///./src/app/shared/components/jotform-modal/close-modal/close-modal.component.ts","webpack:///./src/app/shared/components/jotform-modal/close-modal/close-modal.component.html","webpack:///./src/app/shared/components/jotform-modal/jotfrom-types.ts","webpack:///./src/app/shared/util/checkbox-required.ts","webpack:///./src/app/shared/services/jotfrom-api.service.ts","webpack:///./src/app/shared/components/jotform-modal/jotform-modal.component.html","webpack:///./src/app/shared/components/jotform-modal/jotform-modal.component.ts","webpack:///./src/app/shared/components/list/item/content/content.component.ts","webpack:///./src/app/shared/components/list/item/content/content.component.html","webpack:///./src/app/shared/components/list/item/description/description.component.ts","webpack:///./src/app/shared/components/list/item/description/description.component.html","webpack:///./src/app/shared/components/list/item/icon/icon.component.ts","webpack:///./src/app/shared/components/list/item/icon/icon.component.html","webpack:///./src/app/shared/components/list/item/item.component.ts","webpack:///./src/app/shared/components/list/item/item.component.html","webpack:///./src/app/shared/components/list/item/title/title.component.ts","webpack:///./src/app/shared/components/list/item/title/title.component.html","webpack:///./src/app/shared/components/list/list.component.ts","webpack:///./src/app/shared/components/list/list.component.html","webpack:///./src/app/shared/components/modals/video-modal.component.ts","webpack:///./src/app/shared/components/modals/video-modal.component.html","webpack:///./src/app/shared/components/new-analyses-list/new-analyses-list.component.html","webpack:///./src/app/shared/components/new-analyses-list/new-analyses-list.component.ts","webpack:///./src/app/shared/components/onboarding-footer/onboarding-footer.component.ts","webpack:///./src/app/shared/components/onboarding-welcome/onboarding-welcome.component.ts","webpack:///./src/app/shared/components/onboarding-welcome/onboarding-welcome.component.html","webpack:///./src/app/shared/components/onboarding-wrapper/onboarding-wrapper.component.ts","webpack:///./src/app/shared/components/onboarding-wrapper/onboarding-wrapper.component.html","webpack:///./src/app/shared/components/population-chart/population-chart.component.html","webpack:///./src/app/shared/components/population-chart/population-chart.component.ts","webpack:///./src/app/shared/components/recommendations-list/recommendations-list.component.html","webpack:///./src/app/shared/components/recommendations-list/recommendations-list.component.ts","webpack:///./node_modules/detect-it/dist/detect-it.esm.js","webpack:///./node_modules/ngx-slider-v2/fesm2022/ngx-slider-v2.mjs","webpack:///./src/app/shared/components/slider/slider.component.html","webpack:///./src/app/shared/components/slider/slider.component.ts","webpack:///./src/app/shared/components/sources-list/sources-list.component.html","webpack:///./src/app/shared/components/sources-list/sources-list.component.ts","webpack:///./src/app/shared/components/step-progress/step-progress.component.ts","webpack:///./src/app/shared/components/step-progress/step-progress.component.html","webpack:///./src/app/shared/components/step-progress/step/step.component.ts","webpack:///./src/app/shared/components/step-progress/step/step.component.html","webpack:///./src/app/shared/components/unsupported-browser-banner/unsupported-browser-banner.component.ts","webpack:///./src/app/shared/components/unsupported-browser-banner/unsupported-browser-banner.component.html","webpack:///./src/app/shared/components/walk-trough-popover/walk-trough-popover.component.html","webpack:///./src/app/shared/components/walk-trough-popover/walk-trough-popover.component.ts","webpack:///./src/app/shared/constants/error-codes.ts","webpack:///./src/app/shared/constants/semantic-type.ts","webpack:///./src/app/shared/directives/scroll-on-focus.directive.ts","webpack:///./src/app/shared/enums/intent.enum.ts","webpack:///./src/app/shared/enums/intro-id.enum.ts","webpack:///./src/app/shared/enums/intro-modal-type.enum.ts","webpack:///./src/app/shared/guards/feature.guard.ts","webpack:///./src/app/shared/modals/full-image-modal/full-image-modal.component.html","webpack:///./src/app/shared/modals/full-image-modal/full-image-modal.component.ts","webpack:///./src/app/shared/modals/image-swiper-modal/image-swiper-modal.component.html","webpack:///./src/app/shared/modals/image-swiper-modal/image-swiper-modal.component.ts","webpack:///./src/app/shared/modals/swiper-modal/swiper-modal.component.html","webpack:///./src/app/shared/modals/swiper-modal/swiper-modal.component.ts","webpack:///./src/app/shared/modals/wearables-modal/wearables-modal.component.html","webpack:///./src/app/shared/modals/wearables-modal/wearables-modal.component.ts","webpack:///./src/app/shared/operators/extract-account.ts","webpack:///./src/app/shared/pages/results-view/results-view.component.html","webpack:///./src/app/shared/pages/results-view/results-view.component.ts","webpack:///./src/app/shared/pipes/age.pipe.ts","webpack:///./src/app/shared/pipes/chapter-image.pipe.ts","webpack:///./src/app/shared/pipes/colorize.pipe.ts","webpack:///./src/app/shared/pipes/decimal-places.pipe.ts","webpack:///./src/app/shared/pipes/feature-active.pipe.ts","webpack:///./src/app/shared/pipes/index.ts","webpack:///./src/app/shared/pipes/local-date.pipe.ts","webpack:///./src/app/shared/pipes/ref-min-max.pipe.ts","webpack:///./src/app/shared/pipes/safe-html.pipe.ts","webpack:///./src/app/shared/pipes/time-ago.pipe.ts","webpack:///./src/app/shared/pipes/toTypeId.pipe.ts","webpack:///./src/app/shared/pipes/transform-units.pipe.ts","webpack:///./src/app/shared/pipes/youtube-captions.pipe.ts","webpack:///./src/app/shared/services/customer-check.service.ts","webpack:///./src/app/shared/services/intent/strategies/general-intent.strategy.ts","webpack:///./src/app/shared/services/intent/strategies/intent.strategy.ts","webpack:///./src/app/shared/services/intent/intent-strategy.service.ts","webpack:///./src/app/shared/services/intent/intent-api.service.ts","webpack:///./src/app/shared/services/intent/intent.service.ts","webpack:///./src/app/shared/services/intent/steps/adrialab.steps.ts","webpack:///./src/app/shared/services/intent/steps/biolab.steps.ts","webpack:///./src/app/shared/services/intent/steps/blood.steps.ts","webpack:///./src/app/shared/services/intent/steps/dna.steps.ts","webpack:///./src/app/shared/services/intent/steps/nipt.steps.ts","webpack:///./node_modules/rxjs/dist/esm/internal/operators/isEmpty.js","webpack:///./src/app/shared/services/intent/strategies/kit-intent.strategy.ts","webpack:///./src/app/shared/services/intent/strategies/lab-intent.strategy.ts","webpack:///./src/app/shared/services/intent/strategies/nipt-intent.strategy.ts","webpack:///./src/app/shared/services/tags-api.service.ts","webpack:///./src/app/shared/services/intro-modal.service.ts","webpack:///./src/app/core/services/custom-localize-router.service.ts","webpack:///./src/app/shared/services/language.service.ts","webpack:///./src/app/shared/services/modal.service.ts","webpack:///./src/app/shared/services/platform.service.ts","webpack:///./src/app/shared/services/walk-trough-popover.service.ts","webpack:///./src/app/shared/shared.module.ts","webpack:///./src/app/shared/util/color-util.ts","webpack:///./src/app/shared/util/date-util.ts","webpack:///./src/app/shared/util/feature-active.ts","webpack:///./src/app/shared/util/is-mobile-app.ts","webpack:///./src/app/shared/util/link-util.ts","webpack:///./src/app/shared/util/util.ts","webpack:///./src/environments/environment.ts","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/integration.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/integrations/inboundfilters.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/integrations/functiontostring.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/integrations/dedupe.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/dsn.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/api.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/supports.js","webpack:///./node_modules/@sentry-internal/browser-utils/node_modules/@sentry/utils/build/esm/debug-build.js","webpack:///./node_modules/@sentry-internal/browser-utils/node_modules/@sentry/utils/build/esm/worldwide.js","webpack:///./node_modules/@sentry-internal/browser-utils/node_modules/@sentry/utils/build/esm/logger.js","webpack:///./node_modules/@sentry-internal/browser-utils/node_modules/@sentry/utils/build/esm/stacktrace.js","webpack:///./node_modules/@sentry-internal/browser-utils/node_modules/@sentry/utils/build/esm/instrument/handlers.js","webpack:///./node_modules/@sentry-internal/browser-utils/node_modules/@sentry/utils/build/esm/vendor/supportsHistory.js","webpack:///./node_modules/@sentry-internal/browser-utils/node_modules/@sentry/utils/build/esm/object.js","webpack:///./node_modules/@sentry-internal/browser-utils/build/esm/types.js","webpack:///./node_modules/@sentry-internal/browser-utils/build/esm/instrument/history.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/envelope.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/error.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/baseclient.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/envelope.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/utils/parseSampleRate.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/utils/sdkMetadata.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/browser/build/npm/esm/debug-build.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/browser/build/npm/esm/eventbuilder.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/browser/build/npm/esm/helpers.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/browser/build/npm/esm/client.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/env.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/browser/build/npm/esm/userfeedback.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/clientreport.js","webpack:///./node_modules/@sentry-internal/browser-utils/build/esm/instrument/dom.js","webpack:///./node_modules/@sentry-internal/browser-utils/node_modules/@sentry/utils/build/esm/misc.js","webpack:///./node_modules/@sentry-internal/browser-utils/node_modules/@sentry/utils/build/esm/time.js","webpack:///./node_modules/@sentry-internal/browser-utils/node_modules/@sentry/utils/build/esm/is.js","webpack:///./node_modules/@sentry-internal/browser-utils/build/esm/instrument/xhr.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/breadcrumbs.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/instrument/handlers.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/instrument/console.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/instrument/fetch.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/severity.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/url.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/browser/build/npm/esm/integrations/breadcrumbs.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/browser/build/npm/esm/integrations/browserapierrors.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/instrument/globalError.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/instrument/globalUnhandledRejection.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/browser/build/npm/esm/integrations/globalhandlers.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/browser/build/npm/esm/integrations/httpcontext.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/aggregate-errors.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/browser/build/npm/esm/integrations/linkederrors.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/browser/build/npm/esm/stack-parsers.js","webpack:///./node_modules/@sentry-internal/browser-utils/build/esm/debug-build.js","webpack:///./node_modules/@sentry-internal/browser-utils/build/esm/getNativeImplementation.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/ratelimit.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/transports/base.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/promisebuffer.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/browser/build/npm/esm/transports/fetch.js","webpack:///./node_modules/@sentry-internal/browser-utils/node_modules/@sentry/utils/build/esm/supports.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/browser/build/npm/esm/sdk.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/sdk.js","webpack:///./node_modules/@sentry/angular/fesm2020/sentry-angular.mjs","webpack:///./node_modules/ng-recaptcha/fesm2022/ng-recaptcha.mjs","webpack:///./node_modules/@angular/animations/fesm2022/browser.mjs","webpack:///./node_modules/@angular/platform-browser/fesm2022/animations.mjs","webpack:///./src/app/multiple-files-http-translations-loader.ts","webpack:///./node_modules/angular-google-tag-manager/fesm2022/angular-google-tag-manager.mjs","webpack:///./src/app/analytics.service.ts","webpack:///./src/app/sentry-error.service.ts","webpack:///./src/app/cookie-policy/cookie-settings/cookie.types.ts","webpack:///./src/app/cookie-policy/cookie.service.ts","webpack:///./node_modules/@geneplanet/ngx-ui/fesm2022/geneplanet-ngx-ui-src-lib-switch.mjs","webpack:///./src/app/cookie-policy/cookie-settings/cookie-settings-modal.component.html","webpack:///./src/app/cookie-policy/cookie-settings/cookie-settings-modal.component.ts","webpack:///./src/app/cookie-policy/cookie-consent/cookie-consent.component.ts","webpack:///./src/app/cookie-policy/cookie-consent/cookie-consent.component.html","webpack:///./node_modules/@geneplanet/ngx-shop/fesm2022/geneplanet-ngx-shop-src-lib-cart-count-badge.mjs","webpack:///./src/app/core/components/header/header-language-switcher/header-language-switcher.component.html","webpack:///./src/app/core/components/header/header-language-switcher/header-language-switcher.component.ts","webpack:///./src/app/core/components/header/header.component.html","webpack:///./src/app/core/components/header/header.component.ts","webpack:///./src/app/core/pages/results-menu/results-menu.component.html","webpack:///./src/app/core/pages/results-menu/results-menu.component.ts","webpack:///./src/app/core/components/side-menu/side-menu.component.ts","webpack:///./src/app/core/components/side-menu/side-menu.component.html","webpack:///./src/app/core/components/mobile-footer/mobile-footer.component.html","webpack:///./src/app/core/components/mobile-footer/mobile-footer.component.ts","webpack:///./src/app/app.component.html","webpack:///./src/app/app.component.ts","webpack:///./src/app/core/interceptors/http-error-redirect-interceptor.ts","webpack:///./src/app/core/interceptors/no-internet-toast-interceptor.ts","webpack:///./src/app/core/interceptors/index.ts","webpack:///./src/app/cookie-policy/cookies.module.ts","webpack:///./src/app/core/services/custom-translate.service.ts","webpack:///./src/app/core/utils/custom-preload-strategy.ts","webpack:///./src/app/core/pages/add-data-menu/add-data-menu.component.html","webpack:///./src/app/core/pages/add-data-menu/add-data-menu.component.ts","webpack:///./src/app/core/guards/mobile.guard.ts","webpack:///./src/app/app-routing.module.ts","webpack:///./src/app/shared/guards/feature-active.guard.ts","webpack:///./src/app/core/core.module.ts","webpack:///./node_modules/rxjs/dist/esm/internal/operators/timeout.js","webpack:///./src/app/core/utils/custom-datepicker-i18n.ts","webpack:///./src/app/app.module.ts","webpack:///./src/environments/buildInfo.ts","webpack:///./src/main.ts","webpack:///./node_modules/@auth0/angular-jwt/fesm2015/auth0-angular-jwt.js","webpack:///./node_modules/hammerjs/hammer.js","webpack:///./node_modules/ng-inline-svg-2/lib_esmodule/inline-svg.config.js","webpack:///./node_modules/ng-inline-svg-2/lib_esmodule/inline-svg.service.js","webpack:///./node_modules/ng-inline-svg-2/lib_esmodule/inline-svg.component.js","webpack:///./node_modules/ng-inline-svg-2/lib_esmodule/svg-cache.service.js","webpack:///./node_modules/ng-inline-svg-2/lib_esmodule/svg-util.js","webpack:///./node_modules/ng-inline-svg-2/lib_esmodule/inline-svg.directive.js","webpack:///./node_modules/ng-inline-svg-2/lib_esmodule/inline-svg.module.js","webpack:///./node_modules/rxjs/dist/esm/internal/BehaviorSubject.js","webpack:///./node_modules/rxjs/dist/esm/internal/Observable.js","webpack:///./node_modules/rxjs/dist/esm/internal/ReplaySubject.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/ObjectUnsubscribedError.js","webpack:///./node_modules/rxjs/dist/esm/internal/Subject.js","webpack:///./node_modules/rxjs/dist/esm/internal/NotificationFactories.js","webpack:///./node_modules/rxjs/dist/esm/internal/Subscriber.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/UnsubscriptionError.js","webpack:///./node_modules/rxjs/dist/esm/internal/Subscription.js","webpack:///./node_modules/rxjs/dist/esm/internal/config.js","webpack:///./node_modules/rxjs/dist/esm/internal/observable/ConnectableObservable.js","webpack:///./node_modules/rxjs/dist/esm/internal/observable/combineLatest.js","webpack:///./node_modules/rxjs/dist/esm/internal/observable/concat.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/concatAll.js","webpack:///./node_modules/rxjs/dist/esm/internal/observable/defer.js","webpack:///./node_modules/rxjs/dist/esm/internal/observable/empty.js","webpack:///./node_modules/rxjs/dist/esm/internal/observable/forkJoin.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/observeOn.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/subscribeOn.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduled/scheduleAsyncIterable.js","webpack:///./node_modules/rxjs/dist/esm/internal/observable/from.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduled/scheduled.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduled/scheduleObservable.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduled/scheduleArray.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduled/schedulePromise.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduled/scheduleIterable.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduled/scheduleReadableStreamLike.js","webpack:///./node_modules/rxjs/dist/esm/internal/observable/fromEvent.js","webpack:///./node_modules/rxjs/dist/esm/internal/observable/iif.js","webpack:///./node_modules/rxjs/dist/esm/internal/observable/innerFrom.js","webpack:///./node_modules/rxjs/dist/esm/internal/observable/interval.js","webpack:///./node_modules/rxjs/dist/esm/internal/observable/merge.js","webpack:///./node_modules/rxjs/dist/esm/internal/observable/of.js","webpack:///./node_modules/rxjs/dist/esm/internal/observable/throwError.js","webpack:///./node_modules/rxjs/dist/esm/internal/observable/timer.js","webpack:///./node_modules/rxjs/dist/esm/internal/observable/zip.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/OperatorSubscriber.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/catchError.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/concatMap.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/debounceTime.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/defaultIfEmpty.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/delayWhen.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/ignoreElements.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/delay.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/distinctUntilChanged.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/filter.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/finalize.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/first.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/map.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/mapTo.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/mergeAll.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/mergeMap.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/mergeInternals.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/pluck.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/refCount.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/retry.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/scan.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/scanInternals.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/share.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/shareReplay.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/skip.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/startWith.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/switchMap.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/take.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/takeLast.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/takeUntil.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/takeWhile.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/tap.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/throttleTime.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/throttle.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/throwIfEmpty.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduler/Action.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduler/intervalProvider.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduler/AsyncAction.js","webpack:///./node_modules/rxjs/dist/esm/internal/Scheduler.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduler/AsyncScheduler.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduler/animationFrameProvider.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduler/animationFrame.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduler/AnimationFrameScheduler.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduler/AnimationFrameAction.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduler/async.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduler/dateTimestampProvider.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduler/timeoutProvider.js","webpack:///./node_modules/rxjs/dist/esm/internal/symbol/iterator.js","webpack:///./node_modules/rxjs/dist/esm/internal/symbol/observable.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/EmptyError.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/args.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/argsArgArrayOrObject.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/argsOrArgArray.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/arrRemove.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/createErrorClass.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/createObject.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/errorContext.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/executeSchedule.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/identity.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/isArrayLike.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/isAsyncIterable.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/isDate.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/isFunction.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/isInteropObservable.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/isIterable.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/isObservable.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/isPromise.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/isReadableStreamLike.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/isScheduler.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/lift.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/mapOneOrManyArgs.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/noop.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/pipe.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/reportUnhandledError.js","webpack:///./node_modules/rxjs/dist/esm/internal/util/throwUnobservableError.js","webpack:///./node_modules/@angular/animations/fesm2022/animations.mjs","webpack:///./node_modules/@angular/cdk/fesm2022/coercion.mjs","webpack:///./node_modules/@angular/cdk/fesm2022/layout.mjs","webpack:///./node_modules/rxjs/dist/esm/internal/util/Immediate.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduler/immediateProvider.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduler/asap.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduler/AsapScheduler.js","webpack:///./node_modules/rxjs/dist/esm/internal/scheduler/AsapAction.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/auditTime.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/audit.js","webpack:///./node_modules/@angular/cdk/fesm2022/bidi.mjs","webpack:///./node_modules/@angular/cdk/fesm2022/scrolling.mjs","webpack:///./node_modules/@angular/cdk/fesm2022/overlay.mjs","webpack:///./node_modules/@angular/cdk/fesm2022/keycodes.mjs","webpack:///./node_modules/@angular/cdk/fesm2022/platform.mjs","webpack:///./node_modules/@angular/cdk/fesm2022/portal.mjs","webpack:///./node_modules/@angular/common/fesm2022/common.mjs","webpack:///./node_modules/@angular/common/fesm2022/http.mjs","webpack:///./node_modules/@angular/core/fesm2022/primitives/signals.mjs","webpack:///./node_modules/@angular/core/fesm2022/primitives/event-dispatch.mjs","webpack:///./node_modules/@angular/core/fesm2022/core.mjs","webpack:///./node_modules/@angular/core/fesm2022/rxjs-interop.mjs","webpack:///./node_modules/@angular/forms/fesm2022/forms.mjs","webpack:///./node_modules/@angular/platform-browser/fesm2022/platform-browser.mjs","webpack:///./node_modules/@angular/router/fesm2022/router.mjs","webpack:///./node_modules/rxjs/dist/esm/internal/operators/last.js","webpack:///./node_modules/rxjs/dist/esm/internal/observable/fromEventPattern.js","webpack:///./node_modules/@angular/youtube-player/fesm2022/youtube-player.mjs","webpack:///./node_modules/auth0-js/dist/auth0.min.esm.js","webpack:///./node_modules/@geneplanet/ngx-auth0/fesm2022/geneplanet-ngx-auth0.mjs","webpack:///./node_modules/@geneplanet/ngx-utils/fesm2022/geneplanet-ngx-utils-src-lib-swipe-detect.mjs","webpack:///./node_modules/@geneplanet/ngx-shop/fesm2022/geneplanet-ngx-shop-src-lib-shared.mjs","webpack:///./node_modules/@geneplanet/ngx-ui/fesm2022/geneplanet-ngx-ui-src-lib-carousel.mjs","webpack:///./node_modules/@geneplanet/ngx-ui/fesm2022/geneplanet-ngx-ui-src-lib-checkbox.mjs","webpack:///./node_modules/@geneplanet/ngx-ui/fesm2022/geneplanet-ngx-ui-src-lib-collapse.mjs","webpack:///./node_modules/@angular/cdk/fesm2022/observers.mjs","webpack:///./node_modules/@geneplanet/ngx-ui/fesm2022/geneplanet-ngx-ui-src-lib-form-field.mjs","webpack:///./node_modules/@geneplanet/ngx-ui/fesm2022/geneplanet-ngx-ui-src-lib-layout.mjs","webpack:///./node_modules/@geneplanet/ngx-ui/fesm2022/geneplanet-ngx-ui-src-lib-loading.mjs","webpack:///./node_modules/@geneplanet/ngx-ui/fesm2022/geneplanet-ngx-ui-src-lib-modal.mjs","webpack:///./node_modules/@geneplanet/ngx-ui/fesm2022/geneplanet-ngx-ui-src-lib-radio-group.mjs","webpack:///./node_modules/@geneplanet/ngx-ui/fesm2022/geneplanet-ngx-ui-src-lib-shared.mjs","webpack:///./node_modules/ssr-window/ssr-window.esm.js","webpack:///./node_modules/dom7/dom7.esm.js","webpack:///./node_modules/swiper/shared/dom.js","webpack:///./node_modules/swiper/shared/utils.js","webpack:///./node_modules/swiper/shared/get-support.js","webpack:///./node_modules/swiper/shared/get-device.js","webpack:///./node_modules/swiper/shared/get-browser.js","webpack:///./node_modules/swiper/core/transition/transitionEmit.js","webpack:///./node_modules/swiper/core/events/onTouchStart.js","webpack:///./node_modules/swiper/core/events/onTouchMove.js","webpack:///./node_modules/swiper/core/events/onTouchEnd.js","webpack:///./node_modules/swiper/core/events/onResize.js","webpack:///./node_modules/swiper/core/events/onClick.js","webpack:///./node_modules/swiper/core/events/onScroll.js","webpack:///./node_modules/swiper/core/events/index.js","webpack:///./node_modules/swiper/core/breakpoints/setBreakpoint.js","webpack:///./node_modules/swiper/core/defaults.js","webpack:///./node_modules/swiper/core/moduleExtendParams.js","webpack:///./node_modules/swiper/core/core.js","webpack:///./node_modules/swiper/core/events-emitter.js","webpack:///./node_modules/swiper/core/update/index.js","webpack:///./node_modules/swiper/core/update/updateSize.js","webpack:///./node_modules/swiper/core/update/updateSlides.js","webpack:///./node_modules/swiper/core/update/updateAutoHeight.js","webpack:///./node_modules/swiper/core/update/updateSlidesOffset.js","webpack:///./node_modules/swiper/core/update/updateSlidesProgress.js","webpack:///./node_modules/swiper/core/update/updateProgress.js","webpack:///./node_modules/swiper/core/update/updateSlidesClasses.js","webpack:///./node_modules/swiper/core/update/updateActiveIndex.js","webpack:///./node_modules/swiper/core/update/updateClickedSlide.js","webpack:///./node_modules/swiper/core/translate/index.js","webpack:///./node_modules/swiper/core/translate/getTranslate.js","webpack:///./node_modules/swiper/core/translate/setTranslate.js","webpack:///./node_modules/swiper/core/translate/minTranslate.js","webpack:///./node_modules/swiper/core/translate/maxTranslate.js","webpack:///./node_modules/swiper/core/translate/translateTo.js","webpack:///./node_modules/swiper/core/transition/index.js","webpack:///./node_modules/swiper/core/transition/setTransition.js","webpack:///./node_modules/swiper/core/transition/transitionStart.js","webpack:///./node_modules/swiper/core/transition/transitionEnd.js","webpack:///./node_modules/swiper/core/slide/index.js","webpack:///./node_modules/swiper/core/slide/slideTo.js","webpack:///./node_modules/swiper/core/slide/slideToLoop.js","webpack:///./node_modules/swiper/core/slide/slideNext.js","webpack:///./node_modules/swiper/core/slide/slidePrev.js","webpack:///./node_modules/swiper/core/slide/slideReset.js","webpack:///./node_modules/swiper/core/slide/slideToClosest.js","webpack:///./node_modules/swiper/core/slide/slideToClickedSlide.js","webpack:///./node_modules/swiper/core/loop/index.js","webpack:///./node_modules/swiper/core/loop/loopCreate.js","webpack:///./node_modules/swiper/core/loop/loopFix.js","webpack:///./node_modules/swiper/core/loop/loopDestroy.js","webpack:///./node_modules/swiper/core/grab-cursor/index.js","webpack:///./node_modules/swiper/core/grab-cursor/setGrabCursor.js","webpack:///./node_modules/swiper/core/grab-cursor/unsetGrabCursor.js","webpack:///./node_modules/swiper/core/breakpoints/index.js","webpack:///./node_modules/swiper/core/breakpoints/getBreakpoint.js","webpack:///./node_modules/swiper/core/check-overflow/index.js","webpack:///./node_modules/swiper/core/classes/index.js","webpack:///./node_modules/swiper/core/classes/addClasses.js","webpack:///./node_modules/swiper/core/classes/removeClasses.js","webpack:///./node_modules/swiper/core/images/index.js","webpack:///./node_modules/swiper/core/images/loadImage.js","webpack:///./node_modules/swiper/core/images/preloadImages.js","webpack:///./node_modules/swiper/core/modules/resize/resize.js","webpack:///./node_modules/swiper/core/modules/observer/observer.js","webpack:///./node_modules/swiper/shared/create-element-if-not-defined.js","webpack:///./node_modules/swiper/modules/navigation/navigation.js","webpack:///./node_modules/swiper/shared/classes-to-selector.js","webpack:///./node_modules/swiper/modules/pagination/pagination.js","webpack:///./node_modules/swiper/modules/lazy/lazy.js","webpack:///./node_modules/swiper/modules/free-mode/free-mode.js","webpack:///./node_modules/swiper/shared/effect-target.js","webpack:///./node_modules/swiper/modules/effect-fade/effect-fade.js","webpack:///./node_modules/swiper/shared/effect-init.js","webpack:///./node_modules/swiper/shared/effect-virtual-transition-end.js","webpack:///./node_modules/@geneplanet/ngx-ui/fesm2022/geneplanet-ngx-ui-src-lib-swiper-carousel.mjs","webpack:///./node_modules/@geneplanet/ngx-ui/fesm2022/geneplanet-ngx-ui-src-lib-toast.mjs","webpack:///./node_modules/@geneplanet/ngx-utils/fesm2022/geneplanet-ngx-utils-src-lib-analytics.mjs","webpack:///./node_modules/@geneplanet/ngx-utils/fesm2022/geneplanet-ngx-utils-src-lib-localization.mjs","webpack:///./node_modules/@geneplanet/ngx-utils/fesm2022/geneplanet-ngx-utils-src-lib-router-back.mjs","webpack:///./node_modules/@gilsdav/ngx-translate-router/fesm2022/gilsdav-ngx-translate-router.mjs","webpack:///./node_modules/rxjs/dist/esm/internal/firstValueFrom.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/pairwise.js","webpack:///./node_modules/rxjs/dist/esm/internal/observable/race.js","webpack:///./node_modules/rxjs/dist/esm/internal/operators/withLatestFrom.js","webpack:///./node_modules/@popperjs/core/lib/utils/getOppositePlacement.js","webpack:///./node_modules/@popperjs/core/lib/utils/getBasePlacement.js","webpack:///./node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js","webpack:///./node_modules/@popperjs/core/lib/enums.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getWindow.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js","webpack:///./node_modules/@popperjs/core/lib/utils/math.js","webpack:///./node_modules/@popperjs/core/lib/utils/userAgent.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getParentNode.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/isTableElement.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/contains.js","webpack:///./node_modules/@popperjs/core/lib/utils/rectToClientRect.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js","webpack:///./node_modules/@popperjs/core/lib/utils/getVariation.js","webpack:///./node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js","webpack:///./node_modules/@popperjs/core/lib/utils/computeOffsets.js","webpack:///./node_modules/@popperjs/core/lib/utils/mergePaddingObject.js","webpack:///./node_modules/@popperjs/core/lib/utils/getFreshSideObject.js","webpack:///./node_modules/@popperjs/core/lib/utils/expandToHashMap.js","webpack:///./node_modules/@popperjs/core/lib/utils/detectOverflow.js","webpack:///./node_modules/@popperjs/core/lib/modifiers/flip.js","webpack:///./node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js","webpack:///./node_modules/@popperjs/core/lib/utils/within.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js","webpack:///./node_modules/@popperjs/core/lib/modifiers/preventOverflow.js","webpack:///./node_modules/@popperjs/core/lib/utils/getAltAxis.js","webpack:///./node_modules/@popperjs/core/lib/modifiers/arrow.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js","webpack:///./node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js","webpack:///./node_modules/@popperjs/core/lib/utils/orderModifiers.js","webpack:///./node_modules/@popperjs/core/lib/utils/debounce.js","webpack:///./node_modules/@popperjs/core/lib/createPopper.js","webpack:///./node_modules/@popperjs/core/lib/utils/mergeByName.js","webpack:///./node_modules/@popperjs/core/lib/modifiers/eventListeners.js","webpack:///./node_modules/@popperjs/core/lib/modifiers/computeStyles.js","webpack:///./node_modules/@popperjs/core/lib/popper-lite.js","webpack:///./node_modules/@popperjs/core/lib/modifiers/popperOffsets.js","webpack:///./node_modules/@popperjs/core/lib/modifiers/applyStyles.js","webpack:///./node_modules/@popperjs/core/lib/modifiers/offset.js","webpack:///./node_modules/@ng-bootstrap/ng-bootstrap/fesm2022/ng-bootstrap.mjs","webpack:///./node_modules/rxjs/dist/esm/internal/operators/endWith.js","webpack:///./node_modules/@ngneat/until-destroy/fesm2020/ngneat-until-destroy.mjs","webpack:///./node_modules/@ngx-translate/core/dist/fesm2022/ngx-translate-core.mjs","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/constants.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/carrier.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/asyncContext/stackStrategy.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/defaultScopes.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/asyncContext/index.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/currentScopes.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/debug-build.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/exports.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/propagationContext.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/utils/spanOnScope.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/scope.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/semanticAttributes.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/session.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/baggage.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/tracing/dynamicSamplingContext.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/eventProcessors.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/utils/applyScopeDataToEvent.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/utils/prepareEvent.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/metrics/metric-summary.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/tracing/spanstatus.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/core/build/esm/utils/spanUtils.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/browser.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/debug-build.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/is.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/logger.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/misc.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/normalize.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/memo.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/object.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/stacktrace.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/string.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/syncpromise.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/time.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/version.js","webpack:///./node_modules/@sentry/angular/node_modules/@sentry/utils/build/esm/worldwide.js","webpack:///./node_modules/ngx-cookie-service/fesm2022/ngx-cookie-service.mjs","webpack:///./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js","webpack:///./node_modules/tslib/tslib.es6.mjs"],"sourceRoot":"webpack:///","sourcesContent":["export enum RegisterTypes {\n NORMAL = 'hi-normal',\n QUESTIONNAIRE = 'hi-questionnaire',\n NIPT = 'nipt',\n LAB_ADRIALAB = 'lab-adrialab',\n LAB_BIOLAB = 'lab-biolab',\n}\n","import { Injectable } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n CanActivate,\n CanActivateChild,\n UrlTree,\n} from '@angular/router';\nimport { Observable, of } from 'rxjs';\nimport { switchMap } from 'rxjs/operators';\nimport { JwtHelperService } from '@auth0/angular-jwt';\nimport { Auth0Service } from '@geneplanet/ngx-auth0';\nimport { IntentStrategyService } from 'src/app/shared/services/intent/intent-strategy.service';\n\n@Injectable({ providedIn: 'root' })\nexport class AccountsVerifiedGuard implements CanActivate, CanActivateChild {\n constructor(\n private readonly auth0: Auth0Service,\n private readonly intentStrategyService: IntentStrategyService\n ) {}\n\n canActivateChild(\n route: ActivatedRouteSnapshot\n ): Observable {\n return this.isActive(route);\n }\n\n canActivate(route: ActivatedRouteSnapshot): Observable {\n return this.isActive(route);\n }\n\n private isActive(\n route: ActivatedRouteSnapshot\n ): Observable {\n // Logic to skip onboarding steps - Questioner onboarding\n if (route.queryParams?.skip && !!JSON.parse(route.queryParams?.skip)) {\n return of(true);\n }\n\n return this.auth0.token$.pipe(\n switchMap((token) => {\n const account = new JwtHelperService().decodeToken(\n JSON.parse(token || '{}').idToken\n );\n\n if (!account) {\n return this.intentStrategyService.context.onUserNotExists();\n } else if (account?.email_verified) {\n return of(true);\n // Redirect to verify screen\n } else if (!account?.email_verified) {\n return this.intentStrategyService.context.onNotValidatedEmail();\n }\n })\n );\n }\n}\n","import { HttpClient, HttpContext } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { TokensService } from '@geneplanet/ngx-auth0';\nimport { BehaviorSubject, Observable } from 'rxjs';\nimport { map, tap } from 'rxjs/operators';\nimport { IGNORE_SENTRY } from 'src/app/core/interceptors/http-interceptor';\nimport { environment } from 'src/environments/environment';\nimport {\n CreateAccount,\n CreateAccountResponse,\n ResetPassword,\n} from '../interfaces/accounts.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AccountsService {\n newPassword$ = new BehaviorSubject(false);\n\n constructor(\n private http: HttpClient,\n private readonly tokenService: TokensService\n ) {}\n\n check(email: string, pass: string): Observable {\n return this.http\n .post(`${environment.api}/accounts/token`, {\n username: email,\n password: pass,\n audience: environment.auth0.audience,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n client_id: environment.auth0.clientID,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n grant_type: 'http://auth0.com/oauth/grant-type/password-realm',\n realm: 'Username-Password-Authentication',\n scope: 'openid offline_access',\n }, {\n context: new HttpContext().set(IGNORE_SENTRY, true),\n })\n .pipe(\n map((token) => {\n return {\n accessToken: token.access_token,\n expiresIn: token.expires_in,\n idToken: token.id_token,\n refreshToken: token.refresh_token,\n scope: token.scope,\n tokenType: token.token_type,\n };\n }),\n tap((token) => this.tokenService.set(JSON.stringify(token)))\n );\n }\n\n create(\n account: Omit\n ): Observable {\n return this.http.post(\n `${environment.api}/accounts`,\n account\n );\n }\n\n createNipt(email: string, password: string, reference: string) {\n const data = {\n email,\n password,\n reference,\n };\n return this.http.post(`/api/nipt-online/register`, data);\n }\n\n reset(reset: ResetPassword): Observable {\n return this.http.post(\n `${environment.api}/accounts/reset`,\n reset\n );\n }\n\n password(password: string): Observable {\n return this.http.post(\n `${environment.api}/accounts/password/new`,\n password\n );\n }\n\n verify(token: string): Observable {\n return this.http.get(\n `${environment.api}/accounts/password/verify?token=${token}`\n );\n }\n\n resend(): Observable {\n return this.http.get(`${environment.api}/accounts/verify`);\n }\n}\n","import { ValidatorFn, AbstractControl, ValidationErrors } from '@angular/forms';\n\nexport const isInvalidValue = (value: string | undefined | number): boolean => {\n return value === undefined || value === null || value === '';\n};\n\nexport const fromToValidator: ValidatorFn = (\n form: AbstractControl\n): ValidationErrors | null => {\n const from = form.get('from').value;\n const to = form.get('to').value;\n\n if (isInvalidValue(from) || isInvalidValue(to)) {\n return null;\n }\n\n return Number(from) >= Number(to) ? { invalidFromTo: true } : null;\n};\n","import { UntypedFormGroup, UntypedFormArray } from '@angular/forms';\nimport { Source } from '../../shared/interfaces';\n\nexport enum AnalysesTypes {\n DNA = 'DNA',\n WGS = 'DNA-WGS',\n DNALifestyle = 'DNA Lifestyle',\n PRS = 'PRS',\n Blood = 'Blood',\n BloodSimple = 'Blood/Simple',\n Measurements = 'Measurement',\n MeasurementsSimple = 'Measurement/Simple',\n Questionnaire = 'Questionnaire',\n Habits = 'Habits',\n Healthscore = 'Healthscore',\n NIPT = 'NIPT', // TODO: Verify this\n}\n\n// TODO - this enum should be used when comparing it to type retrieved from url param...\n// Why we also use enum AnalysesTypes? -because backend is still returning Capitalized strings in some responses... this should be fixed.\nexport enum AnalysesTypesLowercase {\n DNA = 'dna',\n PRS = 'prs',\n Blood = 'blood',\n Measurements = 'measurement',\n Habits = 'habits',\n Healthscore = 'healthscore',\n NIPT = 'nipt',\n Ancestry = 'ancestry',\n PhysicalTraits = 'physical-traits',\n}\n\nexport enum AnalysesProcessingType {\n Qualitative = 'Qualitative',\n Simple = 'Simple',\n Ratio = 'Ratio',\n Correlation = 'Correlation',\n}\n\nexport enum BloodPressureType {\n Diastolic = 'Diastolic',\n Systolic = 'Systolic',\n}\n\nexport interface Type {\n id: string;\n type: string;\n}\n\nexport interface AboutAnalysis {\n description: string;\n otherReferences: any[];\n scienceBehind: [{ link: string; title: string }];\n scientificSources: [{ link: string; title: string }];\n}\n\nexport interface MeasurementTrackingResult {\n calculationId: string;\n generated: string;\n requestId: string;\n results: [{ value: number; unit: Unit }];\n semanticType: string;\n}\n\nexport interface BloodTrackingResult {\n canAdd: boolean;\n canEdit: boolean;\n generated: string;\n id: string;\n processed: string;\n semanticType: string;\n unit: Unit;\n value: number;\n optimalLevel: OptimalLevel;\n rawMarker: RawMarker;\n}\n\nexport interface RawMarker {\n id: string;\n value: number;\n unit: Unit;\n}\n\nexport interface OptimalLevel {\n id: string;\n semanticType: string;\n from: number;\n to: number;\n isOptimal: boolean;\n}\n\nexport interface HabitsTrackingReuslt {\n calculatedDate: string;\n calculationId: string;\n generatedDate: string;\n result: string;\n semanticType: string;\n value: number;\n}\n\nexport type HistoryResult =\n | HabitsTrackingReuslt\n | BloodTrackingResult\n | MeasurementTrackingResult;\n\n// ========================\n// CONFIGURATIONS\n// ========================\n\nexport interface BloodMarker {\n id: string;\n name: string;\n units: BloodMarkerUnit[];\n}\n\nexport interface MeasurementMarker {\n id: string;\n shortName: string;\n longName: string;\n analysisType: string;\n measurementMetrics?: unknown[];\n}\n\nexport interface HabitsQuestion {\n id: string;\n name: string;\n type: string;\n sequenceNumber: number;\n hint?: string; // TODO BE: update schema, to include this property\n description?: string; // Unused\n answers: {\n id: string;\n name: string;\n type: string;\n sequenceNumber: number;\n decimalPlaces?: number;\n min?: number;\n max?: number;\n answersToDisableOnSelection: unknown[];\n description?: string; // Unused\n }[];\n}\n\nexport interface Unit {\n id: string;\n name: string;\n decimalPlaces: number;\n isVisibleResult?: boolean;\n}\n\nexport interface BloodMarkerUnit extends Unit {\n isDefault: boolean;\n minValue: number;\n maxValue: number;\n}\n\nexport interface MeasurementMarkerUnit extends Unit {\n isDefault: boolean;\n min: number;\n max: number;\n}\n\nexport interface Configuration {\n id: string;\n shortName: string;\n longName: string;\n analysisType: string;\n}\n\nexport interface BloodConfigurationOld extends Configuration {\n markers?: {\n id: string;\n name: string;\n units: BloodMarkerUnit[];\n }[];\n synonyms?: string[];\n processingType?: AnalysesProcessingType;\n}\n\nexport interface HabitsConfiguration extends Configuration {\n questions?: HabitsQuestion[];\n}\n\nexport interface MeasurementConfiguration extends Configuration {\n measurementMetrics?: MeasurementsResponseMetrics[];\n}\n\nexport type MarkerUnit = BloodMarkerUnit | MeasurementMarkerUnit; // TODO - extend to other vertical types\nexport type AnalysisMarker = BloodMarker | HabitsQuestion | MeasurementMarker;\nexport type AnalysisConfiguration = MeasurementConfiguration &\n BloodConfigurationOld &\n HabitsConfiguration;\n\nexport interface AnalysisLevel {\n id: string;\n name: string;\n semanticType: string;\n from?: number;\n to?: number;\n isOptimal?: boolean;\n sequenceId?: number;\n}\n\nexport interface AnalysisResult {\n analysisId?: string;\n shortName?: string;\n longName?: string;\n description?: string;\n analysisLevels?: AnalysisLevel[];\n generated?: string;\n processingType?: string;\n result?: {\n id?: string;\n calculationId: string;\n value?: number;\n resultValue?: string;\n canEdit?: boolean;\n canAdd?: boolean;\n markers?: Marker[];\n unit?: Unit;\n level?: {\n id?: string;\n name?: string;\n description?: string;\n semanticType?: string;\n };\n generated?: string;\n processed?: string;\n calculatedDate?: string;\n results?: any[]; //currently no interface for this\n };\n}\n\nexport interface AnalysisPopulation {\n populationPercentage: number;\n semanticType: string;\n}\n\nexport interface AnalysisResponse {\n analysisId: string;\n calculationId: string;\n shortName: string;\n longName: string;\n name: string;\n result: MeasurementResult[] | BloodResult | HabitsResult;\n semanticType: string;\n type: string;\n color?: string;\n}\n\nexport interface MeasurementResult {\n result: number;\n unitName: string;\n}\n\nexport interface BloodResult {\n id: string;\n value: number;\n semanticType: string;\n canEdit: true;\n canAdd: true;\n unit: Unit;\n generated?: string;\n}\n\nexport type HabitsResult = string;\n\nexport interface Analysis {\n id: string;\n analysisId?: string;\n shortName?: string;\n longName?: string;\n pictureSmall?: string;\n pictureLarge?: string;\n type: string;\n name?: string;\n levels?: any[];\n result?: any;\n hasHistoryTracking: boolean;\n dataDistribution?: any;\n genes?: Gene[];\n influence?: any;\n codeName?: string;\n sources?: Source[];\n otherReferences?: Source[];\n genesVsEnvironment?: GenesVsEnvironment[];\n processingType?: string;\n facts?: any;\n didYouKnow?: any;\n description?: string;\n analysisLevels?: any[];\n genetics?: string;\n valueLabels?: any;\n}\n\nexport interface Gene {\n gene?: string;\n description: string;\n genotype?: string;\n snpId: string;\n allele1: string;\n allele1SemanticType?: string;\n allele2: string;\n allele2SemanticType?: string;\n}\n\nexport interface GenesVsEnvironment {\n title: string;\n description: string;\n ratio: string;\n genesRatio: number;\n environmentRatio: number;\n}\n\nexport interface Result {\n id: string;\n reportId: string;\n type: string;\n metrics: Metric[];\n date: string;\n}\n\nexport interface Metric {\n id: string;\n unit: {\n id: string;\n isDefault: boolean;\n };\n value: string;\n from: string;\n to: string;\n}\n\nexport interface Next {\n id: string;\n name: string;\n domain: string;\n isProduct: boolean;\n}\n\nexport interface IDateObject {\n year?: number;\n month?: number;\n day?: number;\n hours?: number;\n minutes?: number;\n seconds?: number;\n milliseconds?: number;\n}\n\nexport class MetricsExtensions {\n static toArray(\n metrics: UntypedFormArray,\n ignoreNullValues: boolean,\n analysisType: AnalysesTypesLowercase\n ): NewResultMetric[] {\n const resultArray = [];\n metrics.controls\n .filter(\n (element: UntypedFormGroup) => element.controls.value.value !== null\n )\n .forEach((element: UntypedFormGroup) => {\n if (ignoreNullValues && !element.controls.value.value) {\n return;\n }\n const {\n id,\n unit,\n units,\n type,\n qualitative,\n value,\n value1,\n from,\n to,\n } = element.controls;\n\n switch (analysisType) {\n case AnalysesTypesLowercase.Blood: {\n const currentUnit = units.value.find((u) => u.id === unit.value);\n\n const result: NewResultMetric = {\n markerId: id.value,\n unitId: unit?.value,\n value: parseFloat(value.value),\n };\n // Qualitative analyses do not require from/to\n if (qualitative.value) {\n const selected = qualitative.value.find(\n (x) => x.value === result.value\n );\n result.descriptive = selected.key;\n resultArray.push(result);\n break;\n }\n result.from = parseFloat(from.value);\n result.to = parseFloat(to.value);\n result.unitName = currentUnit.name; // TODO - this probably should not be part of post request, but is needed to be displayed in report summary\n result.isVisibleResult = currentUnit.isVisibleResult;\n\n resultArray.push(result);\n break;\n }\n case AnalysesTypesLowercase.Measurements:\n resultArray.push({\n id: id.value,\n unitId: unit?.value,\n value: value.value,\n });\n break;\n case AnalysesTypesLowercase.Habits:\n resultArray.push({\n id: id.value,\n answers:\n type.value === 'SingleChoice'\n ? [\n {\n id: value.value, // selected option id\n value: value1.value, // optional input value for selected option (for example cigarettes per day)\n },\n ]\n : value.value,\n });\n break;\n case AnalysesTypesLowercase.DNA:\n alert('DNA Not imeplemented!');\n break;\n }\n });\n return resultArray;\n }\n}\n\nexport interface DnaReportAnalysis {\n analysisId: string;\n longName: string;\n result?: string;\n semanticType?: string;\n shortName: string;\n type: AnalysesTypes;\n}\n\nexport interface NewMeasurementsResult {\n measurements: Measurement[];\n generated: string;\n}\n\nexport interface NewHabitsResult {\n questions: Question[];\n generated: string;\n}\n\nexport interface Question {\n answers: { id: string; value?: string }[];\n id: string;\n}\n\nexport interface QuestionnaireCreate {\n questions: Question[];\n generated?: string;\n}\n\ninterface Measurement {\n id: string;\n value: string;\n unitId: string;\n}\n\nexport interface NewBloodResult {\n inventoryItemId?: string;\n productInventoryItemId?: string;\n laboratoryName?: string;\n generated: string;\n markers: Marker[];\n process?: string;\n processBy?: string;\n processReason?: string;\n}\n\nexport interface Marker {\n markerId: string;\n unitName?: string;\n unitId?: string;\n unit?: string;\n value: number;\n from?: number;\n to?: number;\n descriptive?: string;\n isVisibleResult?: boolean;\n}\n\nexport type NewResultModel =\n | NewMeasurementsResult\n | NewBloodResult\n | NewHabitsResult;\ntype NewResultMetric = Measurement | Marker | Question;\n\nexport class ResultExtensions {\n static prepareBloodPayload(\n form: UntypedFormGroup,\n ignoreNullValues: boolean\n ) {\n const markers = MetricsExtensions.toArray(\n form.controls.metrics as UntypedFormArray,\n ignoreNullValues,\n AnalysesTypesLowercase.Blood\n );\n const generatedDate = this.objectToDate(\n form.controls.date.value\n ).toISOString();\n return {\n generated: generatedDate,\n markers: markers as Marker[],\n };\n }\n\n static prepareMeasurementPayload(\n form: UntypedFormGroup,\n ignoreNullValues: boolean\n ): NewMeasurementsResult {\n const generatedDate = this.objectToDate(\n form.controls.date.value\n ).toISOString();\n const measurements = MetricsExtensions.toArray(\n form.controls.metrics as UntypedFormArray,\n ignoreNullValues,\n AnalysesTypesLowercase.Measurements\n );\n return {\n measurements: measurements as Measurement[],\n generated: generatedDate,\n };\n }\n\n static prepareHabitsPayload(\n form: UntypedFormGroup,\n ignoreNullValues: boolean\n ): NewHabitsResult {\n const generatedDate = this.objectToDate(\n form.controls.date.value\n ).toISOString();\n const questions = MetricsExtensions.toArray(\n form.controls.metrics as UntypedFormArray,\n ignoreNullValues,\n AnalysesTypesLowercase.Habits\n );\n return {\n questions: questions as Question[],\n generated: generatedDate,\n };\n }\n\n static toResult(\n form: UntypedFormGroup,\n ignoreNullValues = false,\n type: AnalysesTypesLowercase\n ): NewResultModel {\n switch (type) {\n case AnalysesTypesLowercase.Blood:\n return this.prepareBloodPayload(form, ignoreNullValues);\n case AnalysesTypesLowercase.Measurements:\n return this.prepareMeasurementPayload(form, ignoreNullValues);\n case AnalysesTypesLowercase.Habits:\n return this.prepareHabitsPayload(form, ignoreNullValues);\n }\n }\n\n static objectToDate(obj: IDateObject): Date {\n const dateNow = new Date();\n return new Date(\n obj.year ? obj.year : dateNow.getFullYear(),\n obj.month ? obj.month - 1 : dateNow.getMonth(),\n obj.day ? obj.day : dateNow.getDate(),\n obj.hours ? obj.hours : dateNow.getHours(),\n obj.minutes ? obj.minutes : dateNow.getMinutes(),\n obj.seconds ? obj.seconds : dateNow.getSeconds(),\n obj.milliseconds ? obj.milliseconds : dateNow.getMilliseconds()\n );\n }\n\n static GetGenesRatio(genesVsEnvironment: GenesVsEnvironment): number {\n const ratioSplit = genesVsEnvironment.ratio.split('/');\n const ratio = parseInt(ratioSplit[0], 10);\n return Number.isNaN(ratio) ? 0 : ratio;\n }\n\n static GetEnvironmentRatio(genesVsEnvironment: GenesVsEnvironment): number {\n const ratioSplit = genesVsEnvironment.ratio.split('/');\n const ratio = parseInt(ratioSplit[1], 10);\n return Number.isNaN(ratio) ? 0 : ratio;\n }\n}\n\nexport interface MeasurementsResponse {\n analysisType: string;\n id: string;\n longName: string;\n measurementMetrics: MeasurementsResponseMetrics[];\n shortName: string;\n}\n\nexport interface MeasurementsResponseMetrics {\n id: string;\n name: string;\n units: MeasurementsResponseMetricsUnits[];\n}\n\nexport interface MeasurementsResponseMetricsUnits {\n decimalPlaces: number;\n id: string;\n isDefault: boolean;\n max: number;\n min: number;\n name: string;\n}\n\nexport interface Report {\n id: string;\n kitId?: string; // TODO update when added on API\n productId: string;\n type: string;\n status: string;\n title: string;\n description: string;\n claimed: string;\n received: string; // TODO update when added on API\n completed: string;\n date: string;\n image: string;\n}\n\nexport interface StatisticsLevel {\n count: number;\n semanticType: string;\n}\n\nexport interface KitInProgress {\n kitId: string;\n interactions: KitInProgressInteraction[];\n}\n\nexport interface KitInProgressInteraction {\n interaction: KitInProgressInteractionType;\n interactedOn: string;\n}\n\nexport enum KitInProgressInteractionType {\n CLAIMED = 'Claimed',\n UNCLAIMED = 'Unclaimed',\n RETURNED = 'Returned',\n SENT_TO_LABORATORY = 'SentToLaboratory',\n}\n\n// About\nexport interface Fact {\n description: string;\n}\n\nexport interface ScientificSource {\n title: string;\n link: string;\n}\n\nexport interface DNAAbout {\n type: string;\n description: string;\n facts: Fact[];\n scientificSources: ScientificSource[];\n genesVsEnvironment: any[];\n}\n\nexport interface OtherReference {\n title: string;\n link: string;\n}\n\nexport interface HealthscoreAbout {\n description: string;\n scientificSources: any[];\n scienceBehind: any[];\n otherReferences: OtherReference[];\n}\n\nexport interface AnalysesResultDetails {\n analysisId: string;\n calculated: string;\n measurements?: AnalysesResultMeasurement[];\n}\n\nexport interface AnalysesResultMeasurement {\n measurementId: string;\n unitId: string;\n from?: number;\n to?: number;\n value?: number;\n}\n\n// Blood catalogue\n\nexport interface CatalogueAnalysis {\n analysisId: string;\n shortName: string;\n longName: string;\n description: string;\n}\n\nexport interface BloodCatalogue {\n id: string;\n sequenceNumber: number;\n name: string;\n image: string;\n analyses: CatalogueAnalysis[];\n}\n\nexport interface ScienceBehind {\n link: string;\n title: string;\n}\n\nexport interface CatalogueAnalysisAbout {\n description: string;\n scientificSources: ScientificSource[];\n scienceBehind: ScienceBehind[];\n otherReferences: any[];\n}\n\nexport interface BloodPanel {\n id: string;\n name: string;\n image: string;\n analyses: BloodPanelAnalysis[];\n}\n\nexport interface BloodPanelAnalysis {\n analysisId: string;\n shortName: string;\n longName: string;\n result: BloodPanelAnalysisResult;\n}\n\nexport interface BloodPanelAnalysisResult {\n id: string;\n value: number;\n semanticType: string;\n canEdit: boolean;\n canAdd: boolean;\n unit: Unit;\n generated: string;\n}\n\nexport interface HSScore {\n result: {\n average: number;\n level: {\n name: string;\n type: string;\n description: string;\n from: number;\n to: number;\n };\n value: number;\n };\n levels: any[];\n}\n","export enum AnalysisId {\n BloodPressure = '0d3f297b-cf67-48f0-9a40-bfb4101a2ab6',\n BodyMassIndexMale = '35bdef46-0dc2-4ab2-813a-36794964dc2f',\n BodyMassIndexFemale = '832dabdb-7de4-45eb-9f4b-0128a349e12f',\n BodyWeight = '2a6bdd92-5de0-410d-818d-d2221aab481f',\n BodyHeight = '35321d0b-9ecf-4d03-a07b-35e76352cfa7',\n HeartRate = '6298cf02-230a-48bd-9b35-0ceb59f41225',\n WaistCircumference = '27a9366e-38b6-410f-9cb4-c0403869d54a',\n FatPercentageMale = '378c4e1e-2e69-41fd-9b5b-06ffcac30891',\n FatPercentageFemale = '7fe5ea30-eb5b-4364-bf49-68163b8aafff',\n AlcoholConsumption = '667bf34d-0494-4fac-b06d-c7dbfdf3e3ae',\n Stress = '335aace7-c714-4049-b083-fe6b93fa3fe1',\n Covid19 = '201131ed-a73c-46c3-89c8-f00c685c1c8d',\n // eslint-disable-next-line @typescript-eslint/naming-convention\n dietTypeId = '87b94881-ca34-4017-8a4c-886f8aa99508',\n // eslint-disable-next-line @typescript-eslint/naming-convention\n physicalActivityId = '85c0adce-e9ad-4e90-b327-7cb55410f975',\n // eslint-disable-next-line @typescript-eslint/naming-convention\n stepsId = '64124de9-9504-4752-adb4-7aa58a71131a',\n // eslint-disable-next-line @typescript-eslint/naming-convention\n tgHDL = 'a85e870b-3cd4-46ff-ad44-ce77e75b3475',\n}\n","/* eslint-disable @typescript-eslint/naming-convention */\nexport enum AnalyticsFormKey {\n from = 'from',\n to = 'to',\n value = 'value',\n value1 = 'value1',\n unit = 'unit',\n date = 'date',\n minutes = 'minutes'\n}\n\nexport interface AnalyticsFormKeyInterface {\n id: string,\n index: number,\n value?: number\n}\n","import { Component } from '@angular/core';\nimport { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';\n\n@Component({\n selector: 'app-modal-bf-circumference-inscturctions',\n templateUrl: './bf-circumference-instructions.modal.html',\n})\nexport class BodyFatCircumferenceInstructionsModalComponent {\n constructor(public readonly modal: NgbActiveModal) {}\n}\n","
\n \n
\n\n
\n
\n
\n {{ 'RESULTS.ADD.BODY_FAT_INSTRUCTIONS.TITLE' | translate }}\n
\n\n

\n {{ 'RESULTS.ADD.BODY_FAT_INSTRUCTIONS.SUBTITLE1' | translate }}\n

\n

\n {{ 'RESULTS.ADD.BODY_FAT_INSTRUCTIONS.CONTENT1' | translate }}\n

\n\n

\n {{ 'RESULTS.ADD.BODY_FAT_INSTRUCTIONS.SUBTITLE2' | translate }}\n

\n

\n {{ 'RESULTS.ADD.BODY_FAT_INSTRUCTIONS.CONTENT2' | translate }}\n

\n\n

\n {{ 'RESULTS.ADD.BODY_FAT_INSTRUCTIONS.SUBTITLE3' | translate }}\n

\n

\n {{ 'RESULTS.ADD.BODY_FAT_INSTRUCTIONS.CONTENT3' | translate }}\n

\n
\n
\n","
\n \n
\n\n
\n
\n {{ 'RESULTS.ADD.CIRCUMFERENCE_INSTRUCTIONS.TITLE' | translate }}\n
\n

\n {{ 'RESULTS.ADD.CIRCUMFERENCE_INSTRUCTIONS.HEADER' | translate }}\n

\n
\n {{step}}.\n

\n {{ ('RESULTS.ADD.CIRCUMFERENCE_INSTRUCTIONS.STEP' + step) | translate }}\n

\n
\n
\n","import { Component } from '@angular/core';\nimport { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';\n\n@Component({\n selector: 'app-modal-circumference',\n templateUrl: './circumference-instructions.modal.html',\n})\nexport class AnalysesCircumferenceInstructionsModalComponent {\n constructor(public readonly modal: NgbActiveModal) {}\n}\n","
\n \n
\n\n
\n
\n
\n {{ 'RESULTS.ADD.HEART_RATE_INSCTURCTIONS.TITLE' | translate }}\n
\n

\n {{ 'RESULTS.ADD.HEART_RATE_INSCTURCTIONS.DESCRIPTION' | translate }}\n

\n

\n {{ 'RESULTS.ADD.HEART_RATE_INSCTURCTIONS.SUBTITLE' | translate }}\n

\n
\n
\n {{step}}.\n

\n {{ ('RESULTS.ADD.HEART_RATE_INSCTURCTIONS.STEP' + step) | translate }}\n

\n
\n
\n
\n
\n","import { Component } from '@angular/core';\nimport { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';\n\n@Component({\n selector: 'app-modal-heart-rate-instructions',\n templateUrl: './heart-rate-instructions.modal.html',\n})\nexport class HeartRateInstructionsModalComponent {\n constructor(public readonly modal: NgbActiveModal) {}\n}\n","
\n \n
\n\n
\n
\n

\n {{ title | translate }}\n

\n
\n \n \"serving\"\n

\n {{ item.translation | translate }}\n

\n
\n
\n
\n\n","import { Component, Input, OnInit } from '@angular/core';\nimport { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';\n\n@Component({\n selector: 'app-analyses-id-results-metrics-servings',\n templateUrl: './servings.component.html',\n})\nexport class AnalysesIdResultsMetricsServingsComponent implements OnInit {\n @Input() type: 'vegetables' | 'meat' = 'vegetables';\n title: string;\n servings: { src: string; translation: string }[];\n\n readonly vegetables = [\n {\n src: '/assets/images/servings/serving1.png',\n translation: 'ANALYSES.RESULTS.METRICS.SERVINGS.APPLE',\n },\n {\n src: '/assets/images/servings/serving2.png',\n translation: 'ANALYSES.RESULTS.METRICS.SERVINGS.BANANA',\n },\n {\n src: '/assets/images/servings/serving3.png',\n translation: 'ANALYSES.RESULTS.METRICS.SERVINGS.KIWI',\n },\n {\n src: '/assets/images/servings/serving4.png',\n translation: 'ANALYSES.RESULTS.METRICS.SERVINGS.APRICOTS',\n },\n {\n src: '/assets/images/servings/serving5.png',\n translation: 'ANALYSES.RESULTS.METRICS.SERVINGS.BERRIES',\n },\n {\n src: '/assets/images/servings/serving7.png',\n translation: 'ANALYSES.RESULTS.METRICS.SERVINGS.SULTANAS',\n },\n {\n src: '/assets/images/servings/serving9.png',\n translation: 'ANALYSES.RESULTS.METRICS.SERVINGS.BEET',\n },\n {\n src: '/assets/images/servings/serving10.png',\n translation: 'ANALYSES.RESULTS.METRICS.SERVINGS.BROCCOLI',\n },\n {\n src: '/assets/images/servings/serving11.png',\n translation: 'ANALYSES.RESULTS.METRICS.SERVINGS.STRING_BEANS',\n },\n {\n src: '/assets/images/servings/serving12.png',\n translation: 'ANALYSES.RESULTS.METRICS.SERVINGS.LETTUCE',\n },\n {\n src: '/assets/images/servings/serving13.png',\n translation: 'ANALYSES.RESULTS.METRICS.SERVINGS.TOMATO',\n },\n {\n src: '/assets/images/servings/serving14.png',\n translation: 'ANALYSES.RESULTS.METRICS.SERVINGS.SPINACH',\n },\n {\n src: '/assets/images/servings/serving15.png',\n translation: 'ANALYSES.RESULTS.METRICS.SERVINGS.BELL_PEPPER',\n },\n {\n src: '/assets/images/servings/serving16.png',\n translation: 'ANALYSES.RESULTS.METRICS.SERVINGS.BABY_CARROTS',\n },\n ];\n\n readonly meat = [\n {\n src: '/assets/images/servings/meat1.png',\n translation: 'ANALYSES.RESULTS.METRICS.MEAT.SALAMI',\n },\n {\n src: '/assets/images/servings/meat2.png',\n translation: 'ANALYSES.RESULTS.METRICS.MEAT.HOTDOG',\n },\n {\n src: '/assets/images/servings/meat3.png',\n translation: 'ANALYSES.RESULTS.METRICS.MEAT.SAUSAGE',\n },\n {\n src: '/assets/images/servings/meat4.png',\n translation: 'ANALYSES.RESULTS.METRICS.MEAT.PROSCIUTTO',\n },\n {\n src: '/assets/images/servings/meat5.png',\n translation: 'ANALYSES.RESULTS.METRICS.MEAT.BACON',\n },\n ];\n\n constructor(public readonly modal: NgbActiveModal) {}\n\n ngOnInit() {\n if (this.type === 'vegetables') {\n this.title = 'ANALYSES.RESULTS.METRICS.SERVINGS.TITLE';\n this.servings = this.vegetables;\n } else {\n this.title = 'ANALYSES.RESULTS.METRICS.MEAT.TITLE';\n this.servings = this.meat;\n }\n }\n}\n","import { Injectable } from '@angular/core';\nimport { HttpClient, HttpParams, HttpResponse } from '@angular/common/http';\nimport { Observable, of } from 'rxjs';\nimport { map, shareReplay } from 'rxjs/operators';\n\nimport { environment } from 'src/environments/environment';\n\nimport {\n AnalysesTypes,\n AnalysisResponse,\n HistoryResult,\n AboutAnalysis,\n AnalysisResult,\n AnalysisConfiguration,\n AnalysesTypesLowercase,\n NewResultModel,\n Type,\n MeasurementsResponse,\n Question,\n NewHabitsResult,\n HealthscoreAbout,\n AnalysesResultDetails,\n BloodCatalogue,\n CatalogueAnalysisAbout,\n BloodPanel,\n HSScore,\n AnalysisPopulation,\n DnaReportAnalysis,\n MeasurementConfiguration,\n NewMeasurementsResult,\n HabitsConfiguration,\n QuestionnaireCreate,\n} from 'src/app/analyses/interfaces/analyses.types';\nimport {\n HealthScoreFactorResultResponse,\n HealthScoreHistoryResponse,\n HealthScoreStatusResponse,\n HealthScoreComparisonResponse,\n HealthScoreParticipantsResponse,\n} from '../../healthscore/interfaces/healthscore-api.interface';\nimport {\n SemanticType,\n SemanticTypeValue,\n} from '../../shared/constants/semantic-type';\nimport { resolveTypePath } from '../util/link-util';\nimport {\n Recommendation,\n RecommendationDNAResponse,\n} from '../../shared/interfaces/recommendation.interface';\nimport { BloodConfiguration } from 'src/app/blood/interfaces/blood-configuration.interface';\nimport { AnalysisId } from '../interfaces/analysis-id.enum';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AnalysesService {\n analyses: {\n [id: string]: {\n name: string;\n id: string;\n metrics?: [];\n type?: string;\n results?: { [id: string]: any };\n };\n } = {};\n questionnaire: {\n questions: Question[];\n inventoryItemId: string;\n } = this.getEmptyQuestionnaire();\n\n private readonly headers = {\n xPagingContinuation: 'X-Paging-Continuation',\n xPagingTop: 'X-Paging-Top',\n };\n\n constructor(private http: HttpClient) {}\n\n about(\n analysisId: string,\n type: AnalysesTypesLowercase\n ): Observable {\n const typePath = resolveTypePath(type);\n return this.http.get(\n `/api/${typePath}/analyses/${analysisId}/about`\n );\n }\n\n all(\n type: AnalysesTypesLowercase,\n search: string = null,\n filter: string = null\n ): Observable {\n let queryParams = new HttpParams();\n\n if (search) {\n queryParams = queryParams.append('searchQuery', search);\n }\n\n if (filter) {\n queryParams = queryParams.append('levelTypes', filter);\n }\n\n const typePath = resolveTypePath(type);\n return this.http.get(`/api/${typePath}/analyses`, {\n params: queryParams,\n });\n }\n\n getDnaReportAnalyses(id: string): Observable {\n return this.http.get(`/api/dna/analyses/${id}`);\n }\n\n getMeasurement(\n id: string,\n unitSystem: string = null,\n sex: string = null,\n ethnicity: string = null\n ) {\n let queryParams = new HttpParams();\n if (unitSystem) {\n queryParams = queryParams.append('unitSystem', unitSystem);\n }\n if (sex) {\n queryParams = queryParams.append('sex', sex);\n }\n if (ethnicity) {\n queryParams = queryParams.append('ethnicity', ethnicity);\n }\n return this.http.get(\n `/api/measurement/configurations/onboarding/${id}`,\n {\n params: queryParams,\n }\n );\n }\n\n getHSScore(): Observable {\n return this.http.get(`/api/healthscore/score`).pipe(\n shareReplay({\n bufferSize: 1,\n refCount: true,\n })\n );\n }\n\n getHSAbout(): Observable {\n return this.http.get(`/api/healthscore/about`).pipe(\n shareReplay({\n bufferSize: 1,\n refCount: true,\n })\n );\n }\n\n getHSStatus(): Observable {\n return this.http.get(`/api/healthscore/status`);\n }\n\n getHSPopulation(): Observable {\n return this.http.get(\n `/api/healthscore/comparison`\n );\n }\n getHSHistory(days: number): Observable {\n return this.http.get(\n `/api/healthscore/history?days=${days}`\n );\n }\n getHSFactors(): Observable {\n return this.http.get(\n `/api/healthscore/factors`\n );\n }\n\n getResultDetails(\n id: string,\n resultId: string,\n type: AnalysesTypesLowercase\n ): Observable {\n return this.http.get(\n `/api/${resolveTypePath(type)}/analyses/${id}/results/${resultId}/details`\n );\n }\n\n participants(): Observable {\n return this.http.get(\n `/api/healthscore/participants`\n );\n }\n\n getTypes(): Observable {\n return this.http\n .get(`${environment.api}/analyses/types`)\n .pipe(shareReplay());\n }\n\n listRecommendations(\n analysisId: string,\n resultId: string,\n type: AnalysesTypesLowercase\n ): Observable {\n if (type == AnalysesTypesLowercase.DNA) {\n return this.http.get(\n `/api/dna/analyses/${analysisId}/recommendations`\n );\n }\n\n return this.http\n .get(\n `/api/${resolveTypePath(\n type\n )}/analyses/${analysisId}/results/${resultId}/recommendations`\n )\n .pipe(map((items) => items.filter((item) => item.title && item.image)));\n }\n\n getDnaAnalysis(analysisId: string): Observable {\n return this.http.get(\n `/api/dna/analyses/${analysisId}/result`\n );\n }\n\n getPopulation(\n type: AnalysesTypesLowercase,\n analysisId: string\n ): Observable {\n return this.http.get(\n `/api/${type}/statistics/population/${analysisId}`\n );\n }\n\n getCalculationId(\n analysisId: string,\n requestId: string,\n type: AnalysesTypesLowercase\n ): Observable {\n const params = new HttpParams().append('requestId', requestId);\n return this.http.get(\n `/api/${resolveTypePath(type)}/analyses/${analysisId}/result`,\n { params }\n );\n }\n\n getAnalysis(\n id: string,\n resultId: string,\n publicCall = false,\n type: AnalysesTypesLowercase\n ): Observable {\n // TODO - refactor this to a meaningful method. nobody knows why public call indicates questionnaire call...s\n if (publicCall) {\n return this.http.get(\n `${environment.publicApi}/questionnaire/analyses/${id}`\n );\n }\n const typePath = resolveTypePath(type);\n return this.http\n .get(\n `/api/${typePath}/analyses/${id}/results/${resultId}/result`\n )\n .pipe(\n shareReplay({\n bufferSize: 1,\n refCount: true,\n })\n );\n }\n\n relatedAnalyses(\n id: string,\n type: AnalysesTypesLowercase\n ): Observable {\n return this.http.get(\n `/api/${resolveTypePath(type)}/analyses/${id}/related-analyses`\n );\n }\n\n configurations(\n id: string,\n publicCall = false,\n type: AnalysesTypesLowercase,\n measurementAnalysisType?: 'Measurement' | 'Correlation'\n ): Observable {\n // TODO - remove any\n if (publicCall) {\n return this.http.get(\n `${environment.publicApi}/habits/configurations/${id}`\n );\n }\n\n if (\n type == AnalysesTypesLowercase.Measurements &&\n measurementAnalysisType\n ) {\n return this.http.get(\n `/api/${resolveTypePath(\n type\n )}/configurations/${id}?analysisType=${measurementAnalysisType}`\n );\n } else {\n return this.http.get(\n `/api/${resolveTypePath(type)}/configurations/${id}`\n );\n }\n }\n\n public bloodConfigurations(): Observable {\n return this.http.get(`/api/blood/configurations`);\n }\n\n public bloodConfiguration(id: string): Observable {\n return this.http.get(`/api/blood/configurations/${id}`);\n }\n \n public habitsConfiguration(id: string): Observable {\n return this.http.get(`/api/habits/configurations/${id}`);\n }\n\n public measurementConfiguration(\n id: string\n ): Observable {\n const type = id == AnalysisId.BloodPressure ? 'Correlation' : 'Measurement';\n\n return this.http.get(\n `/api/measurement/configurations/${id}`,\n { params: { analysisType: type } }\n );\n }\n\n public measurementCreate(\n data: NewMeasurementsResult\n ): Observable<{ requestId: string }> {\n return this.http.post<{ requestId: string }>(\n `/api/measurement/results`,\n data\n );\n }\n\n public measurementUpdate(\n calculationId: string,\n data: NewMeasurementsResult\n ): Observable<{ requestId: string }> {\n return this.http.put<{ requestId: string }>(\n `/api/measurement/results/${calculationId}`,\n data\n );\n }\n\n saveQuestionnaire(data: QuestionnaireCreate): Observable<{ id: string }> {\n return this.http.post<{ id: string }>(`/api/habits/results`, data);\n }\n\n get results(): Results {\n return {\n list: (\n id: string,\n type: AnalysesTypesLowercase,\n days?: number,\n token?: string,\n count = 20,\n page?: number\n ) => {\n let params: { [key: string]: any } = {};\n const headers = {};\n if (days) {\n params.days = String(days);\n params.count = -1; // To return all available\n } else if (token) {\n headers[this.headers.xPagingContinuation] = String(token);\n params.count = count;\n } else if (count >= 0 && Number(page) >= 0) {\n params = {};\n params.pageSize = count;\n params.page = page;\n } else if (count) {\n params.count = count;\n }\n\n return this.http\n .get(\n `/api/${resolveTypePath(type)}/analyses/${id}/history`,\n {\n headers,\n observe: 'response',\n params,\n }\n )\n .pipe(\n map((res: HttpResponse) => {\n return {\n results: res.body,\n token: res.headers.get(this.headers.xPagingContinuation),\n };\n })\n );\n },\n get: (id: string, resultId: string, type: AnalysesTypesLowercase) => {\n return this.http.get(\n `/api/${resolveTypePath(\n type\n )}/analyses/${id}/results/${resultId}/result`\n );\n },\n save: (\n id: string,\n result: NewResultModel,\n type: AnalysesTypesLowercase,\n editMode: boolean,\n singleBlood = false\n ) => {\n if (editMode) {\n return this.http.put<{ requestId: string }>(\n `/api/${resolveTypePath(type)}/results/${id}`,\n result\n );\n } else {\n if (type === AnalysesTypesLowercase.Blood && !singleBlood) {\n return this.http.post<{ requestId: string }>(\n `/api/blood/reports`,\n result\n );\n }\n return this.http.post<{ requestId: string }>(\n `/api/${resolveTypePath(type)}/results`,\n result\n );\n }\n },\n delete: (resultId: string, type: AnalysesTypesLowercase) => {\n return this.http.delete(\n `/api/${resolveTypePath(type)}/results/${resultId}`\n );\n },\n };\n }\n\n allGroups(): Observable {\n return this.http.get('/api/blood/panels-all');\n }\n\n get groups(): Groups {\n return {\n list: () => this.http.get('/api/blood/panels'),\n get: (id: string) =>\n this.http.get(`/api/blood/panels/${id}`),\n };\n }\n\n get catalogue() {\n return {\n list: () => this.http.get('/api/blood/analyses/about'),\n get: (id: string) =>\n this.http.get(\n `/api/blood/analyses/about/${id}`\n ),\n };\n }\n\n sortDnaBySemanticType(analyses: DnaReportAnalysis[]) {\n return analyses.sort((a: DnaReportAnalysis, b: DnaReportAnalysis) => {\n // sort first by semantic type, and second by analysis name\n if (a?.semanticType === b?.semanticType) {\n return a?.longName > b?.longName ? 1 : -1;\n } else if (a?.semanticType === SemanticType.NEUTRAL) {\n return 1;\n } else if (b?.semanticType === SemanticType.NEUTRAL) {\n return -1;\n } else if (\n SemanticTypeValue[a?.semanticType] > SemanticTypeValue[b?.semanticType]\n ) {\n return 1;\n }\n\n return -1;\n });\n }\n\n hideAnalysesWithoutResults(analyses: any[]) {\n return analyses.filter((analysis) => analysis.result);\n }\n\n get local(): Local {\n return {\n getQuestionnaire: () => {\n return this.questionnaire;\n },\n clearQuestionnaire: () => {\n this.questionnaire = this.getEmptyQuestionnaire();\n },\n\n saveQuestionnaire: (questionnaire: NewHabitsResult) => {\n questionnaire.questions.forEach((question) => {\n const index = this.questionnaire.questions.findIndex(\n ({ id }) => id === question.id\n );\n if (index > -1) {\n this.questionnaire.questions[index].answers = question.answers;\n } else {\n this.questionnaire.questions.push(question);\n }\n });\n return of([]);\n },\n results: {\n list: () => {\n return of(this.analyses);\n },\n get: (id: string) => {\n return of(this.analyses[id]?.results[id]);\n },\n\n save: (id: string, name: string, result: NewResultModel) => {\n if (!this.analyses[id]) {\n this.analyses[id] = {\n id,\n name,\n results: {},\n };\n this.analyses[id].results[id] = result;\n return of(result);\n } else {\n this.analyses[id].results[id] = result;\n return of(result);\n }\n },\n delete: (id: string = null) => {\n if (id) {\n delete this.analyses[id];\n } else {\n this.analyses = {};\n }\n return of();\n },\n },\n };\n }\n\n private getEmptyQuestionnaire() {\n return {\n inventoryItemId: null,\n questions: [],\n };\n }\n}\n\ninterface Results {\n list: (\n id: string,\n type: AnalysesTypesLowercase,\n days?: number,\n token?: string,\n count?: number,\n page?: number\n ) => Observable<{ results: HistoryResult[]; token?: any }>;\n save: (\n id: string,\n result: NewResultModel,\n type: AnalysesTypesLowercase,\n editMode: boolean,\n singleBlood?: boolean\n ) => Observable;\n get(\n id: string,\n resultId: string,\n type: AnalysesTypesLowercase\n ): Observable;\n delete(id: string, resultId?: string, type?: AnalysesTypes): Observable;\n}\ninterface Local {\n results: {\n list: () => Observable;\n save: (id: string, name: string, result: NewResultModel) => any;\n get(id: string): Observable;\n delete(\n id: string,\n resultId?: string,\n type?: AnalysesTypes\n ): Observable;\n };\n getQuestionnaire(): any;\n saveQuestionnaire(questionnaire: NewHabitsResult): any;\n clearQuestionnaire(): void;\n}\n\ninterface Groups {\n list(): Observable;\n get(id: string): Observable;\n}\n\ninterface BloodPanelGroup {\n id: string;\n image: string;\n name: string;\n analyses$?: Observable;\n}\n\ninterface BloodPanelGroupAnalysis {\n canAdd: boolean;\n canEdit: boolean;\n id: string;\n isVisibleResult: boolean;\n name: string;\n result: string;\n shortName: string;\n synonyms: any[];\n type: string;\n}\n\ninterface BloodPanelGroupAnalyses {\n analyses: BloodPanelGroupAnalysis[];\n id: string;\n name: string;\n}\n","import {\n AnalysesTypes,\n AnalysesTypesLowercase,\n} from '../interfaces/analyses.types';\n\nexport function resolveTypePath(\n type: AnalysesTypes | string\n): AnalysesTypesLowercase | string {\n switch (type) {\n case AnalysesTypes.Measurements:\n case AnalysesTypes.MeasurementsSimple:\n case AnalysesTypesLowercase.Measurements:\n case 'MeasurementValueAnalysis':\n return AnalysesTypesLowercase.Measurements;\n case AnalysesTypes.Blood:\n case AnalysesTypes.BloodSimple:\n case AnalysesTypesLowercase.Blood:\n case 'BloodAnalysis':\n return AnalysesTypesLowercase.Blood;\n case AnalysesTypes.Questionnaire:\n case AnalysesTypes.Habits:\n return AnalysesTypesLowercase.Habits;\n case AnalysesTypes.DNA:\n return AnalysesTypesLowercase.DNA;\n case AnalysesTypes.PRS:\n return AnalysesTypesLowercase.PRS;\n case AnalysesTypes.NIPT:\n return AnalysesTypesLowercase.NIPT;\n default:\n return type;\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { Analysis } from 'src/app/analyses/interfaces/analyses.types';\nimport {\n AncestryQuestionnaireAnswered,\n AncestryResult,\n ChromosomePainting,\n EthnicityEstimate,\n Haplogroups,\n NeanderthalIntrogression,\n PhysicalTraits,\n} from '../ancestry.interface';\n\n@Injectable({ providedIn: 'root' })\nexport class AncestryApiService {\n constructor(private http: HttpClient) {}\n\n fetchAncestryResults(): Observable {\n return this.http.get(`/api/ancestry/results`);\n }\n\n fetchEthnicityEstimate(analysisId: string): Observable {\n return this.http.get(\n `/api/ancestry/results/ethnicity-estimate/${analysisId}`\n );\n }\n\n fetchChromosomePainting(analysisId: string): Observable {\n return this.http.get(\n `/api/ancestry/results/chromosome-painting/${analysisId}`\n );\n }\n\n fetchHaplogroups(analysisId: string): Observable {\n return this.http.get(\n `/api/ancestry/results/mathernal-haplogroup/${analysisId}`\n );\n }\n\n fetchNeanderthalIntrogression(\n analysisId: string\n ): Observable {\n return this.http.get(\n `/api/ancestry/results/neanderthal-introgression/${analysisId}`\n );\n }\n\n fetchPhysicalTraits(\n productInventoryItemId: string\n ): Observable {\n return this.http.get(\n `/api/dna/analyses/${productInventoryItemId}`\n );\n }\n\n fetchPhysicalTraitAnalysis(analysisId: string): Observable {\n return this.http.get(`/api/dna/analyses/${analysisId}/result`);\n }\n\n getUserAnswered(): Observable {\n return this.http.get(\n `/api/ancestry/questionnaire`\n );\n }\n\n saveQuestionnaire(id: string): Observable {\n return this.http.post(`/api/ancestry/questionnaire`, {\n submissionId: id,\n });\n }\n\n skipQuestionnaire(): Observable {\n return this.http.post(`/api/ancestry/questionnaire/skip`, {});\n }\n}\n","import { Injectable } from '@angular/core';\nimport { EMPTY, Observable, ReplaySubject } from 'rxjs';\nimport { AncestryApiService } from './ancestry-api.service';\nimport {\n AncestryResult,\n ChromosomePainting,\n EthnicityEstimate,\n EthnicityEstimateResult,\n Haplogroups,\n NeanderthalIntrogression,\n PhysicalTraits as PhysicalTraits,\n} from '../ancestry.interface';\nimport { catchError, distinctUntilChanged, map } from 'rxjs/operators';\nimport { UntilDestroy } from '@ngneat/until-destroy';\nimport { Analysis } from 'src/app/analyses/interfaces/analyses.types';\n\n@UntilDestroy()\n@Injectable({ providedIn: 'root' })\nexport class AncestryService {\n private ancestryResults$: ReplaySubject;\n private ethnicityEstimate$: ReplaySubject;\n private chromosomePainting$: ReplaySubject;\n private haplogroups$: ReplaySubject;\n private neanderthalIntrogression$: ReplaySubject;\n private physicalTraits$: ReplaySubject;\n private physicalTraitsResult$: ReplaySubject;\n\n private ethnicityEstimateInitialized: boolean;\n private ancestryResultsInitialized: boolean;\n private chromosomePaintingInitialized: boolean;\n private haplogroupsInitialized: boolean;\n private neanderthalIntrogressionInitialized: boolean;\n private physicalTraitsInitialized: boolean;\n private physicalTraitsResultsInitialized: boolean;\n\n constructor(private ancestryApiService: AncestryApiService) {\n this.init();\n }\n\n init() {\n this.ancestryResults$ = new ReplaySubject(1);\n this.ethnicityEstimate$ = new ReplaySubject(1);\n this.chromosomePainting$ = new ReplaySubject(1);\n this.haplogroups$ = new ReplaySubject(1);\n this.neanderthalIntrogression$ =\n new ReplaySubject(1);\n this.physicalTraits$ = new ReplaySubject(1);\n this.physicalTraitsResult$ = new ReplaySubject(1);\n }\n\n cleanup() {\n this.init();\n\n this.ethnicityEstimateInitialized = false;\n this.ancestryResultsInitialized = false;\n this.chromosomePaintingInitialized = false;\n this.haplogroupsInitialized = false;\n this.neanderthalIntrogressionInitialized = false;\n this.physicalTraitsInitialized = false;\n this.physicalTraitsResultsInitialized = false;\n }\n\n getAncestryResults(refresh?: boolean): Observable {\n if (refresh || !this.ancestryResultsInitialized) {\n this.ancestryResultsInitialized = true;\n this.ancestryApiService\n .fetchAncestryResults()\n .pipe(\n catchError((err) => {\n this.ancestryResultsInitialized = false;\n this.ancestryResults$.error(err);\n return EMPTY;\n })\n )\n .subscribe((results) => {\n this.ancestryResults$.next(results);\n });\n }\n\n return this.ancestryResults$.pipe(distinctUntilChanged());\n }\n\n getEthnicityEstimate(\n analysisId?: string,\n refresh?: boolean\n ): Observable {\n if (analysisId && (refresh || !this.ethnicityEstimateInitialized)) {\n this.ethnicityEstimateInitialized = true;\n this.ancestryApiService\n .fetchEthnicityEstimate(analysisId)\n .pipe(\n catchError((err) => {\n this.ethnicityEstimateInitialized = false;\n this.ethnicityEstimate$.error(err);\n return EMPTY;\n })\n )\n .subscribe((ethnicityEstimate) => {\n this.ethnicityEstimate$.next(ethnicityEstimate);\n });\n }\n\n return this.ethnicityEstimate$.pipe(distinctUntilChanged());\n }\n\n getEthnicityEstimateResultById(\n resultId: string\n ): Observable {\n return this.getEthnicityEstimate().pipe(\n map(({ results }) => results.find((r) => r.id === resultId))\n );\n }\n\n getHaplogroups(\n analysisId: string,\n refresh?: boolean\n ): Observable {\n if (analysisId && (refresh || !this.haplogroupsInitialized)) {\n this.haplogroupsInitialized = true;\n this.ancestryApiService\n .fetchHaplogroups(analysisId)\n .pipe(\n catchError((err) => {\n this.haplogroupsInitialized = false;\n this.haplogroups$.error(err);\n return EMPTY;\n })\n )\n .subscribe((haplogroups) => {\n this.haplogroups$.next(haplogroups);\n });\n }\n\n return this.haplogroups$.pipe(distinctUntilChanged());\n }\n\n getChromosomePainting(\n analysisId?: string,\n refresh?: boolean\n ): Observable {\n if (analysisId && (refresh || !this.chromosomePaintingInitialized)) {\n this.chromosomePaintingInitialized = true;\n this.ancestryApiService\n .fetchChromosomePainting(analysisId)\n .pipe(\n catchError((err) => {\n this.chromosomePaintingInitialized = false;\n this.chromosomePainting$.error(err);\n return EMPTY;\n })\n )\n .subscribe((chromosomePainting) => {\n this.chromosomePainting$.next(chromosomePainting);\n });\n }\n\n return this.chromosomePainting$.pipe(distinctUntilChanged());\n }\n\n getNeanderthalIntrogression(\n analysisId?: string,\n refresh?: boolean\n ): Observable {\n if (analysisId && (refresh || !this.neanderthalIntrogressionInitialized)) {\n this.neanderthalIntrogressionInitialized = true;\n this.ancestryApiService\n .fetchNeanderthalIntrogression(analysisId)\n .pipe(\n catchError((err) => {\n this.neanderthalIntrogressionInitialized = false;\n this.neanderthalIntrogression$.error(err);\n return EMPTY;\n })\n )\n .subscribe((neanderthalIntrogression) => {\n this.neanderthalIntrogression$.next(neanderthalIntrogression);\n });\n }\n\n return this.neanderthalIntrogression$.pipe(distinctUntilChanged());\n }\n\n getPhysicalTraitsResults(\n productInventoryItemId?: string,\n refresh?: boolean\n ): Observable {\n if (\n productInventoryItemId &&\n (refresh || !this.physicalTraitsInitialized)\n ) {\n this.physicalTraitsInitialized = true;\n this.ancestryApiService\n .fetchPhysicalTraits(productInventoryItemId)\n .pipe(\n map((traits: PhysicalTraits[]) => sortByName(traits)),\n catchError((err) => {\n this.physicalTraitsInitialized = false;\n this.physicalTraits$.error(err);\n return EMPTY;\n })\n )\n .subscribe((results) => {\n this.physicalTraits$.next(results);\n });\n }\n\n return this.physicalTraits$.pipe(distinctUntilChanged());\n }\n\n getPhysicalTraitsAnalysisResult(\n analysisId: string,\n refresh?: boolean\n ): Observable {\n if (analysisId && (refresh || !this.physicalTraitsResultsInitialized)) {\n this.physicalTraitsResultsInitialized = true;\n this.physicalTraitsResult$.next(undefined);\n this.ancestryApiService\n .fetchPhysicalTraitAnalysis(analysisId)\n .pipe(\n catchError((err) => {\n this.physicalTraitsResultsInitialized = false;\n this.physicalTraitsResult$.error(err);\n this.physicalTraitsResult$ = new ReplaySubject(1);\n return EMPTY;\n })\n )\n .subscribe((results) => {\n this.physicalTraitsResult$.next(results);\n });\n }\n\n return this.physicalTraitsResult$.pipe(distinctUntilChanged());\n }\n}\n\nexport const sortByName = (traits: PhysicalTraits[]) => {\n return traits.sort((a: PhysicalTraits, b: PhysicalTraits) =>\n a.shortName.toLowerCase().localeCompare(b.shortName.toLowerCase())\n );\n};\n","export const RECAPTCHA = {\n siteKey: '6LdA9bwZAAAAADe16Ysz-a4tiv8-PYv_q-ERF7Yo',\n};\n\nexport const COOKIE_LANG = 'pref_lang';\nexport const ANALYTICS_SERVICE = 'UtilsAnalyticsService';\n\nexport const COOKIE_DOMAIN =\n window.location.href.indexOf('localhost') !== -1\n ? 'localhost'\n : '.geneplanet.com';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n// THIS CODE IS GENERATED - DO NOT MODIFY.\nconst u = undefined;\nfunction plural(val) {\n const n = val, i = Math.floor(Math.abs(val)), v = val.toString().replace(/^[^.]*\\.?/, '').length;\n if (i === 1 && v === 0)\n return 1;\n return 5;\n}\nexport default [\"en-CH\", [[\"a\", \"p\"], [\"am\", \"pm\"], u], [[\"am\", \"pm\"], u, u], [[\"S\", \"M\", \"T\", \"W\", \"T\", \"F\", \"S\"], [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"]], u, [[\"J\", \"F\", \"M\", \"A\", \"M\", \"J\", \"J\", \"A\", \"S\", \"O\", \"N\", \"D\"], [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sept\", \"Oct\", \"Nov\", \"Dec\"], [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"]], u, [[\"B\", \"A\"], [\"BC\", \"AD\"], [\"Before Christ\", \"Anno Domini\"]], 1, [6, 0], [\"dd/MM/y\", \"d MMM y\", \"d MMMM y\", \"EEEE, d MMMM y\"], [\"HH:mm\", \"HH:mm:ss\", \"HH:mm:ss z\", \"HH:mm:ss zzzz\"], [\"{1}, {0}\", u, \"{1} 'at' {0}\", u], [\".\", \"’\", \";\", \"%\", \"+\", \"-\", \"E\", \"·\", \"‰\", \"∞\", \"NaN\", \":\"], [\"#,##0.###\", \"#,##0%\", \"¤ #,##0.00;¤-#,##0.00\", \"#E0\"], \"CHF\", \"CHF\", \"Swiss Franc\", { \"JPY\": [\"JP¥\", \"¥\"], \"USD\": [\"US$\", \"$\"] }, \"ltr\", plural];\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n// THIS CODE IS GENERATED - DO NOT MODIFY.\nconst u = undefined;\nfunction plural(val) {\n const n = val, i = Math.floor(Math.abs(val)), v = val.toString().replace(/^[^.]*\\.?/, '').length;\n if (i === 1 && v === 0)\n return 1;\n return 5;\n}\nexport default [\"en-DE\", [[\"a\", \"p\"], [\"am\", \"pm\"], u], [[\"am\", \"pm\"], u, u], [[\"S\", \"M\", \"T\", \"W\", \"T\", \"F\", \"S\"], [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"]], u, [[\"J\", \"F\", \"M\", \"A\", \"M\", \"J\", \"J\", \"A\", \"S\", \"O\", \"N\", \"D\"], [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sept\", \"Oct\", \"Nov\", \"Dec\"], [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"]], u, [[\"B\", \"A\"], [\"BC\", \"AD\"], [\"Before Christ\", \"Anno Domini\"]], 1, [6, 0], [\"dd/MM/y\", \"d MMM y\", \"d MMMM y\", \"EEEE, d MMMM y\"], [\"HH:mm\", \"HH:mm:ss\", \"HH:mm:ss z\", \"HH:mm:ss zzzz\"], [\"{1}, {0}\", u, \"{1} 'at' {0}\", u], [\",\", \".\", \";\", \"%\", \"+\", \"-\", \"E\", \"·\", \"‰\", \"∞\", \"NaN\", \":\"], [\"#,##0.###\", \"#,##0 %\", \"#,##0.00 ¤\", \"#E0\"], \"EUR\", \"€\", \"Euro\", { \"JPY\": [\"JP¥\", \"¥\"], \"USD\": [\"US$\", \"$\"] }, \"ltr\", plural];\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n// THIS CODE IS GENERATED - DO NOT MODIFY.\nconst u = undefined;\nfunction plural(val) {\n const n = val, i = Math.floor(Math.abs(val)), v = val.toString().replace(/^[^.]*\\.?/, '').length;\n if (i === 1 && v === 0)\n return 1;\n return 5;\n}\nexport default [\"en-GB\", [[\"a\", \"p\"], [\"am\", \"pm\"], u], [[\"am\", \"pm\"], u, u], [[\"S\", \"M\", \"T\", \"W\", \"T\", \"F\", \"S\"], [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"]], u, [[\"J\", \"F\", \"M\", \"A\", \"M\", \"J\", \"J\", \"A\", \"S\", \"O\", \"N\", \"D\"], [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sept\", \"Oct\", \"Nov\", \"Dec\"], [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"]], u, [[\"B\", \"A\"], [\"BC\", \"AD\"], [\"Before Christ\", \"Anno Domini\"]], 1, [6, 0], [\"dd/MM/y\", \"d MMM y\", \"d MMMM y\", \"EEEE, d MMMM y\"], [\"HH:mm\", \"HH:mm:ss\", \"HH:mm:ss z\", \"HH:mm:ss zzzz\"], [\"{1}, {0}\", u, \"{1} 'at' {0}\", u], [\".\", \",\", \";\", \"%\", \"+\", \"-\", \"E\", \"×\", \"‰\", \"∞\", \"NaN\", \":\"], [\"#,##0.###\", \"#,##0%\", \"¤#,##0.00\", \"#E0\"], \"GBP\", \"£\", \"British Pound\", { \"JPY\": [\"JP¥\", \"¥\"], \"USD\": [\"US$\", \"$\"] }, \"ltr\", plural];\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n// THIS CODE IS GENERATED - DO NOT MODIFY.\nconst u = undefined;\nfunction plural(val) {\n const n = val, i = Math.floor(Math.abs(val)), v = val.toString().replace(/^[^.]*\\.?/, '').length;\n if (i === 1 && v === 0)\n return 1;\n return 5;\n}\nexport default [\"en\", [[\"a\", \"p\"], [\"AM\", \"PM\"], u], [[\"AM\", \"PM\"], u, u], [[\"S\", \"M\", \"T\", \"W\", \"T\", \"F\", \"S\"], [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"], [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"], [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"]], u, [[\"J\", \"F\", \"M\", \"A\", \"M\", \"J\", \"J\", \"A\", \"S\", \"O\", \"N\", \"D\"], [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"], [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"]], u, [[\"B\", \"A\"], [\"BC\", \"AD\"], [\"Before Christ\", \"Anno Domini\"]], 0, [6, 0], [\"M/d/yy\", \"MMM d, y\", \"MMMM d, y\", \"EEEE, MMMM d, y\"], [\"h:mm a\", \"h:mm:ss a\", \"h:mm:ss a z\", \"h:mm:ss a zzzz\"], [\"{1}, {0}\", u, \"{1} 'at' {0}\", u], [\".\", \",\", \";\", \"%\", \"+\", \"-\", \"E\", \"×\", \"‰\", \"∞\", \"NaN\", \":\"], [\"#,##0.###\", \"#,##0%\", \"¤#,##0.00\", \"#E0\"], \"USD\", \"$\", \"US Dollar\", {}, \"ltr\", plural];\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n// THIS CODE IS GENERATED - DO NOT MODIFY.\nconst u = undefined;\nfunction plural(val) {\n const n = val, i = Math.floor(Math.abs(val)), v = val.toString().replace(/^[^.]*\\.?/, '').length;\n if (i === 1 && v === 0)\n return 1;\n if (v === 0 && (i % 10 === Math.floor(i % 10) && (i % 10 >= 2 && i % 10 <= 4) && !(i % 100 >= 12 && i % 100 <= 14)))\n return 3;\n if (v === 0 && (!(i === 1) && (i % 10 === Math.floor(i % 10) && (i % 10 >= 0 && i % 10 <= 1))) || (v === 0 && (i % 10 === Math.floor(i % 10) && (i % 10 >= 5 && i % 10 <= 9)) || v === 0 && (i % 100 === Math.floor(i % 100) && (i % 100 >= 12 && i % 100 <= 14))))\n return 4;\n return 5;\n}\nexport default [\"pl\", [[\"a\", \"p\"], [\"AM\", \"PM\"], u], u, [[\"n\", \"p\", \"w\", \"ś\", \"c\", \"p\", \"s\"], [\"niedz.\", \"pon.\", \"wt.\", \"śr.\", \"czw.\", \"pt.\", \"sob.\"], [\"niedziela\", \"poniedziałek\", \"wtorek\", \"środa\", \"czwartek\", \"piątek\", \"sobota\"], [\"nie\", \"pon\", \"wto\", \"śro\", \"czw\", \"pią\", \"sob\"]], [[\"N\", \"P\", \"W\", \"Ś\", \"C\", \"P\", \"S\"], [\"niedz.\", \"pon.\", \"wt.\", \"śr.\", \"czw.\", \"pt.\", \"sob.\"], [\"niedziela\", \"poniedziałek\", \"wtorek\", \"środa\", \"czwartek\", \"piątek\", \"sobota\"], [\"nie\", \"pon\", \"wto\", \"śro\", \"czw\", \"pią\", \"sob\"]], [[\"s\", \"l\", \"m\", \"k\", \"m\", \"c\", \"l\", \"s\", \"w\", \"p\", \"l\", \"g\"], [\"sty\", \"lut\", \"mar\", \"kwi\", \"maj\", \"cze\", \"lip\", \"sie\", \"wrz\", \"paź\", \"lis\", \"gru\"], [\"stycznia\", \"lutego\", \"marca\", \"kwietnia\", \"maja\", \"czerwca\", \"lipca\", \"sierpnia\", \"września\", \"października\", \"listopada\", \"grudnia\"]], [[\"S\", \"L\", \"M\", \"K\", \"M\", \"C\", \"L\", \"S\", \"W\", \"P\", \"L\", \"G\"], [\"sty\", \"lut\", \"mar\", \"kwi\", \"maj\", \"cze\", \"lip\", \"sie\", \"wrz\", \"paź\", \"lis\", \"gru\"], [\"styczeń\", \"luty\", \"marzec\", \"kwiecień\", \"maj\", \"czerwiec\", \"lipiec\", \"sierpień\", \"wrzesień\", \"październik\", \"listopad\", \"grudzień\"]], [[\"p.n.e.\", \"n.e.\"], u, [\"przed naszą erą\", \"naszej ery\"]], 1, [6, 0], [\"d.MM.y\", \"d MMM y\", \"d MMMM y\", \"EEEE, d MMMM y\"], [\"HH:mm\", \"HH:mm:ss\", \"HH:mm:ss z\", \"HH:mm:ss zzzz\"], [\"{1}, {0}\", u, \"{1} {0}\", u], [\",\", \" \", \";\", \"%\", \"+\", \"-\", \"E\", \"×\", \"‰\", \"∞\", \"NaN\", \":\"], [\"#,##0.###\", \"#,##0%\", \"#,##0.00 ¤\", \"#E0\"], \"PLN\", \"zł\", \"złoty polski\", { \"AUD\": [u, \"$\"], \"CAD\": [u, \"$\"], \"CNY\": [u, \"¥\"], \"GBP\": [u, \"£\"], \"HKD\": [u, \"$\"], \"ILS\": [u, \"₪\"], \"INR\": [u, \"₹\"], \"JPY\": [u, \"¥\"], \"KRW\": [u, \"₩\"], \"MXN\": [u, \"$\"], \"NZD\": [u, \"$\"], \"PHP\": [u, \"₱\"], \"PLN\": [\"zł\"], \"RON\": [u, \"lej\"], \"TWD\": [u, \"NT$\"], \"USD\": [u, \"$\"], \"VND\": [u, \"₫\"] }, \"ltr\", plural];\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n// THIS CODE IS GENERATED - DO NOT MODIFY.\nconst u = undefined;\nfunction plural(val) {\n const n = val, i = Math.floor(Math.abs(val)), v = val.toString().replace(/^[^.]*\\.?/, '').length;\n if (v === 0 && i % 100 === 1)\n return 1;\n if (v === 0 && i % 100 === 2)\n return 2;\n if (v === 0 && (i % 100 === Math.floor(i % 100) && (i % 100 >= 3 && i % 100 <= 4)) || !(v === 0))\n return 3;\n return 5;\n}\nexport default [\"sl\", [[\"d\", \"p\"], [\"dop.\", \"pop.\"], u], [[\"d\", \"p\"], [\"dop.\", \"pop.\"], [\"dopoldne\", \"popoldne\"]], [[\"n\", \"p\", \"t\", \"s\", \"č\", \"p\", \"s\"], [\"ned.\", \"pon.\", \"tor.\", \"sre.\", \"čet.\", \"pet.\", \"sob.\"], [\"nedelja\", \"ponedeljek\", \"torek\", \"sreda\", \"četrtek\", \"petek\", \"sobota\"], [\"ned.\", \"pon.\", \"tor.\", \"sre.\", \"čet.\", \"pet.\", \"sob.\"]], u, [[\"j\", \"f\", \"m\", \"a\", \"m\", \"j\", \"j\", \"a\", \"s\", \"o\", \"n\", \"d\"], [\"jan.\", \"feb.\", \"mar.\", \"apr.\", \"maj\", \"jun.\", \"jul.\", \"avg.\", \"sep.\", \"okt.\", \"nov.\", \"dec.\"], [\"januar\", \"februar\", \"marec\", \"april\", \"maj\", \"junij\", \"julij\", \"avgust\", \"september\", \"oktober\", \"november\", \"december\"]], u, [[\"pr. Kr.\", \"po Kr.\"], u, [\"pred Kristusom\", \"po Kristusu\"]], 1, [6, 0], [\"d. MM. yy\", \"d. MMM y\", \"d. MMMM y\", \"EEEE, d. MMMM y\"], [\"HH:mm\", \"HH:mm:ss\", \"HH:mm:ss z\", \"HH:mm:ss zzzz\"], [\"{1}, {0}\", u, \"{1} {0}\", u], [\",\", \".\", \";\", \"%\", \"+\", \"−\", \"e\", \"×\", \"‰\", \"∞\", \"NaN\", \":\"], [\"#,##0.###\", \"#,##0 %\", \"#,##0.00 ¤\", \"#E0\"], \"EUR\", \"€\", \"evro\", { \"AUD\": [u, \"$\"], \"BRL\": [u, \"R$\"], \"BYN\": [u, \"р.\"], \"CAD\": [u, \"$\"], \"GBP\": [u, \"£\"], \"MXN\": [u, \"$\"], \"NZD\": [u, \"$\"], \"PHP\": [u, \"₱\"], \"TWD\": [u, \"NT$\"], \"XCD\": [u, \"$\"] }, \"ltr\", plural];\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n// THIS CODE IS GENERATED - DO NOT MODIFY.\nconst u = undefined;\nfunction plural(val) {\n const n = val, i = Math.floor(Math.abs(val)), v = val.toString().replace(/^[^.]*\\.?/, '').length;\n if (i === 1 && v === 0)\n return 1;\n if (i === Math.floor(i) && (i >= 2 && i <= 4) && v === 0)\n return 3;\n if (!(v === 0))\n return 4;\n return 5;\n}\nexport default [\"sk\", [[\"AM\", \"PM\"], u, u], u, [[\"n\", \"p\", \"u\", \"s\", \"š\", \"p\", \"s\"], [\"ne\", \"po\", \"ut\", \"st\", \"št\", \"pi\", \"so\"], [\"nedeľa\", \"pondelok\", \"utorok\", \"streda\", \"štvrtok\", \"piatok\", \"sobota\"], [\"ne\", \"po\", \"ut\", \"st\", \"št\", \"pi\", \"so\"]], u, [[\"j\", \"f\", \"m\", \"a\", \"m\", \"j\", \"j\", \"a\", \"s\", \"o\", \"n\", \"d\"], [\"jan\", \"feb\", \"mar\", \"apr\", \"máj\", \"jún\", \"júl\", \"aug\", \"sep\", \"okt\", \"nov\", \"dec\"], [\"januára\", \"februára\", \"marca\", \"apríla\", \"mája\", \"júna\", \"júla\", \"augusta\", \"septembra\", \"októbra\", \"novembra\", \"decembra\"]], [[\"j\", \"f\", \"m\", \"a\", \"m\", \"j\", \"j\", \"a\", \"s\", \"o\", \"n\", \"d\"], [\"jan\", \"feb\", \"mar\", \"apr\", \"máj\", \"jún\", \"júl\", \"aug\", \"sep\", \"okt\", \"nov\", \"dec\"], [\"január\", \"február\", \"marec\", \"apríl\", \"máj\", \"jún\", \"júl\", \"august\", \"september\", \"október\", \"november\", \"december\"]], [[\"pred Kr.\", \"po Kr.\"], u, [\"pred Kristom\", \"po Kristovi\"]], 1, [6, 0], [\"d. M. y\", u, \"d. MMMM y\", \"EEEE d. MMMM y\"], [\"H:mm\", \"H:mm:ss\", \"H:mm:ss z\", \"H:mm:ss zzzz\"], [\"{1} {0}\", \"{1}, {0}\", u, u], [\",\", \" \", \";\", \"%\", \"+\", \"-\", \"e\", \"×\", \"‰\", \"∞\", \"NaN\", \":\"], [\"#,##0.###\", \"#,##0 %\", \"#,##0.00 ¤\", \"#E0\"], \"EUR\", \"€\", \"euro\", { \"AUD\": [u, \"$\"], \"BRL\": [u, \"R$\"], \"BYN\": [u, \"р.\"], \"CAD\": [u, \"$\"], \"CNY\": [u, \"¥\"], \"GBP\": [u, \"£\"], \"HKD\": [u, \"$\"], \"ILS\": [\"NIS\", \"₪\"], \"INR\": [u, \"₹\"], \"JPY\": [u, \"¥\"], \"KRW\": [u, \"₩\"], \"NZD\": [u, \"$\"], \"PHP\": [u, \"₱\"], \"RUR\": [u, \"р.\"], \"TWD\": [u, \"NT$\"], \"USD\": [u, \"$\"], \"VND\": [u, \"₫\"], \"XXX\": [] }, \"ltr\", plural];\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n// THIS CODE IS GENERATED - DO NOT MODIFY.\nconst u = undefined;\nfunction plural(val) {\n const n = val;\n return 5;\n}\nexport default [\"th\", [[\"a\", \"p\"], [\"ก่อนเที่ยง\", \"หลังเที่ยง\"], u], [[\"ก่อนเที่ยง\", \"หลังเที่ยง\"], u, u], [[\"อา\", \"จ\", \"อ\", \"พ\", \"พฤ\", \"ศ\", \"ส\"], [\"อา.\", \"จ.\", \"อ.\", \"พ.\", \"พฤ.\", \"ศ.\", \"ส.\"], [\"วันอาทิตย์\", \"วันจันทร์\", \"วันอังคาร\", \"วันพุธ\", \"วันพฤหัสบดี\", \"วันศุกร์\", \"วันเสาร์\"], [\"อา.\", \"จ.\", \"อ.\", \"พ.\", \"พฤ.\", \"ศ.\", \"ส.\"]], u, [[\"ม.ค.\", \"ก.พ.\", \"มี.ค.\", \"เม.ย.\", \"พ.ค.\", \"มิ.ย.\", \"ก.ค.\", \"ส.ค.\", \"ก.ย.\", \"ต.ค.\", \"พ.ย.\", \"ธ.ค.\"], u, [\"มกราคม\", \"กุมภาพันธ์\", \"มีนาคม\", \"เมษายน\", \"พฤษภาคม\", \"มิถุนายน\", \"กรกฎาคม\", \"สิงหาคม\", \"กันยายน\", \"ตุลาคม\", \"พฤศจิกายน\", \"ธันวาคม\"]], u, [[\"ก่อน ค.ศ.\", \"ค.ศ.\"], u, [\"ปีก่อนคริสตกาล\", \"คริสต์ศักราช\"]], 0, [6, 0], [\"d/M/yy\", \"d MMM y\", \"d MMMM G y\", \"EEEEที่ d MMMM G y\"], [\"HH:mm\", \"HH:mm:ss\", \"H นาฬิกา mm นาที ss วินาที z\", \"H นาฬิกา mm นาที ss วินาที zzzz\"], [\"{1} {0}\", u, u, u], [\".\", \",\", \";\", \"%\", \"+\", \"-\", \"E\", \"×\", \"‰\", \"∞\", \"NaN\", \":\"], [\"#,##0.###\", \"#,##0%\", \"¤#,##0.00\", \"#E0\"], \"THB\", \"฿\", \"บาท\", { \"AUD\": [\"AU$\", \"$\"], \"BYN\": [u, \"р.\"], \"PHP\": [u, \"₱\"], \"THB\": [\"฿\"], \"TWD\": [\"NT$\"], \"USD\": [\"US$\", \"$\"], \"XXX\": [] }, \"ltr\", plural];\n","import { LocationCode } from '@geneplanet/ngx-utils/src/lib/localization';\n\nimport { Location, registerLocaleData } from '@angular/common';\nimport localeCh from '@angular/common/locales/en-CH';\nimport localeEnDe from '@angular/common/locales/en-DE';\nimport localeEnGb from '@angular/common/locales/en-GB';\nimport localeEnUs from '@angular/common/locales/en';\nimport localePl from '@angular/common/locales/pl';\nimport localeSl from '@angular/common/locales/sl';\nimport localeSk from '@angular/common/locales/sk';\nimport localeTh from '@angular/common/locales/th';\nimport {\n LocalizeRouterSettings,\n ManualParserLoader,\n} from '@gilsdav/ngx-translate-router';\nimport { TranslateService } from '@ngx-translate/core';\nimport { environment } from 'src/environments/environment';\n\nexport function setLocaleData(locationCode: LocationCode) {\n switch (locationCode) {\n case LocationCode.CH: {\n registerLocaleData(localeCh);\n break;\n }\n case LocationCode.UK: {\n registerLocaleData(localeEnGb);\n break;\n }\n case LocationCode.US: {\n registerLocaleData(localeEnUs);\n break;\n }\n case LocationCode.SL: {\n registerLocaleData(localeSl);\n break;\n }\n case LocationCode.PL: {\n registerLocaleData(localePl);\n break;\n }\n case LocationCode.SK: {\n registerLocaleData(localeSk);\n break;\n }\n case LocationCode.EU: {\n registerLocaleData(localeEnDe);\n break;\n }\n case LocationCode.TH: {\n registerLocaleData(localeTh);\n break;\n }\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function ManualLoaderFactory(\n translate: TranslateService,\n location: Location,\n settings: LocalizeRouterSettings\n) {\n return new ManualParserLoader(\n translate,\n location,\n settings,\n environment.locations.map((l) => l.code)\n );\n}\n","
\n \n {{ 'ANALYSES.SINGLE.RESULT' | translate }}\n \n {{ option.key }}\n \n \n \n\n \n \n {{ 'ANALYSES.ADD.DATE' | translate }}\n \n \n \n \n {{ 'ANALYSES.ADD.REQUIRED' | translate }}\n \n \n \n \n
\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n} from '@angular/core';\nimport { FormBuilder, Validators } from '@angular/forms';\nimport { GpuFormFieldAppearance } from '@geneplanet/ngx-ui';\nimport {\n IDateObject,\n Marker,\n} from 'src/app/analyses/interfaces/analyses.types';\nimport {\n objectToDate,\n subtractCurrentDateYear,\n} from 'src/app/shared/util/date-util';\nimport { BloodAddBase } from '../../interfaces/blood-add-base.interface';\nimport { BloodConfigurationChoice } from '../../interfaces/blood-configuration.interface';\nimport { BloodResultChoice } from '../../interfaces/blood-analysis-result.interface';\nimport { AnalyticsService, AnalyticsValue } from '@geneplanet/ngx-utils';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport {\n ngbDateFromDate,\n ngbDateFromISO,\n ngbDateToISO,\n} from 'src/app/shared/util/date-util';\nimport { Subject } from 'rxjs';\nimport { BloodPost } from '../../interfaces/blood-post.inteface';\n\n@UntilDestroy()\n@Component({\n selector: 'app-blood-add-choice',\n templateUrl: './blood-add-choice.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BloodAddChoiceComponent implements BloodAddBase {\n public form = this.fb.group({\n value: [null, Validators.required],\n date: [ngbDateFromDate(new Date()), Validators.required],\n });\n public analysisResult: BloodResultChoice;\n public showDate = true;\n public configuration: BloodConfigurationChoice;\n public formFieldAppearance: GpuFormFieldAppearance;\n public submitted = new Subject();\n\n protected now = ngbDateFromDate(new Date());\n protected minDate = ngbDateFromDate(subtractCurrentDateYear(10));\n\n constructor(\n private fb: FormBuilder,\n private cdRef: ChangeDetectorRef,\n private analyticsService: AnalyticsService\n ) {\n this.trackForm();\n }\n\n public init(): void {\n if (this.analysisResult) {\n this.form.patchValue({\n value: this.analysisResult.result.markers[0].value,\n date: ngbDateFromISO(this.analysisResult.result.generated),\n });\n this.cdRef.markForCheck();\n }\n }\n\n public onSubmit() {\n if (this.form.invalid) {\n return null;\n }\n\n const configMarker = this.configuration.markers[0];\n\n const descriptive = configMarker.qualitativeValueWeights.find(\n (weight) => weight.value === this.form.value.value\n ).key;\n\n const marker: Marker = {\n markerId: configMarker.id,\n unitId: configMarker.units[0].id,\n value: Number(this.form.value.value),\n descriptive,\n };\n\n const generatedDate = objectToDate(\n (this.form.value.date as Partial) ?? {}\n ).toISOString();\n\n const payload: BloodPost = {\n generated: generatedDate,\n markers: [marker],\n };\n return payload;\n }\n\n private trackForm() {\n Object.keys(this.form.controls).forEach((key) => {\n this.form.controls[key].valueChanges\n .pipe(untilDestroyed(this))\n .subscribe((value: any) => {\n const valueObj: AnalyticsValue = {\n isValid: this.form.controls[key].valid,\n };\n\n if (key === 'value') {\n valueObj['value'] = String(value);\n } else {\n valueObj['value'] = ngbDateToISO(value);\n }\n\n this.analyticsService.trackFormValue(\n this.analysisResult ? 'analyses-edit' : 'analyses-add',\n key,\n valueObj,\n this.configuration.id,\n this.configuration.markers[0].id\n );\n });\n });\n }\n}\n","import { Directive, ViewContainerRef } from '@angular/core';\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: '[bloodAddHost]'\n})\nexport class BloodAddHostDirective {\n\n constructor(public viewContainerRef: ViewContainerRef) { }\n\n}\n","\n\n
\n\n\n\n\n \n
\n \n \n {{ 'ANALYSES.DELETE.ACTION' | translate }}\n \n \n {{ 'ANALYSES.DELETE.ACTION_MOBILE' | translate }}\n \n \n\n \n {{\n (editMode ? 'ANALYSES.EDIT.ACTION' : 'ANALYSES.ADD.TITLE') | translate\n }}\n \n
\n
\n
\n\n\n
\n {{ 'ERROR' | translate }}\n {{ 'FAILURE.GENERAL_ERROR.CONTENT' | translate }}\n
\n
\n\n\n \n \n \n\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ComponentRef,\n EventEmitter,\n Input,\n OnChanges,\n Optional,\n Output,\n ViewChild,\n} from '@angular/core';\nimport { GpuFormFieldAppearance } from '@geneplanet/ngx-ui';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport { Observable, startWith } from 'rxjs';\nimport { AnalysesProcessingType } from 'src/app/analyses/interfaces/analyses.types';\nimport { BloodAddHostDirective } from '../../directives/blood-add-host.directive';\nimport { BloodAddBase } from '../../interfaces/blood-add-base.interface';\nimport { BloodConfiguration } from '../../interfaces/blood-configuration.interface';\nimport { BloodAnalysisResult } from '../../interfaces/blood-analysis-result.interface';\nimport { BloodAddChoiceComponent } from '../blood-add-choice/blood-add-choice.component';\nimport { BloodAddValueComponent } from '../blood-add-value/blood-add-value.component';\nimport { BloodAddService } from './blood-add.service';\nimport { LocalBloodAnalysis } from '../../interfaces/blood-local-analysis';\nimport { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';\n\nenum ComponentState {\n LOADING = 'loading',\n ERROR = 'error',\n FORM = 'form',\n}\n\n@UntilDestroy()\n@Component({\n selector: 'app-blood-add-host',\n templateUrl: './blood-add-host.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BloodAddHostComponent implements OnChanges {\n @ViewChild(BloodAddHostDirective, { static: true })\n bloodAddHost!: BloodAddHostDirective;\n\n @Input() configuration: BloodConfiguration;\n @Input() analysisResult: BloodAnalysisResult;\n @Input() backVisible = true;\n @Input() formFieldAppearance = GpuFormFieldAppearance.Card;\n @Input() editMode = false;\n @Input() local = false;\n\n // When saving we return resultId\n @Output() saved = new EventEmitter();\n // Can be dismissed with no action, or \"delete\"\n @Output() closed = new EventEmitter();\n\n protected isValidForm = false;\n protected state = ComponentState.LOADING;\n\n private componentRef: ComponentRef;\n\n constructor(\n @Optional() protected modal: NgbActiveModal,\n private cdRef: ChangeDetectorRef,\n private addService: BloodAddService\n ) {}\n\n ngOnChanges(): void {\n // Result is only required if we're editing result\n if (this.configuration && this.editMode === !!this.analysisResult) {\n this.loadComponent(this.configuration);\n }\n }\n\n protected onSubmit(): void {\n const value = this.componentRef.instance.onSubmit();\n\n if (!value) {\n // Form is invalid\n return;\n }\n\n this.state = ComponentState.LOADING;\n this.bloodAddHost.viewContainerRef.clear();\n this.cdRef.markForCheck();\n\n if (this.local) {\n const localData: LocalBloodAnalysis = {\n name: this.configuration.longName,\n analysisId: this.configuration.id,\n result: { markers: value.markers },\n };\n\n if (this.editMode) {\n this.addService.updateLocal(localData);\n } else {\n this.addService.addLocal(localData);\n }\n\n this.saved.emit('');\n } else {\n let action: Observable<{ id: string }>;\n\n if (this.editMode) {\n action = this.addService.update(this.analysisResult.result.id, value);\n } else {\n action = this.addService.create(value);\n }\n\n action.subscribe({\n next: (response) => {\n this.saved.emit(response.id);\n },\n error: () => {\n this.state = ComponentState.ERROR;\n this.cdRef.markForCheck();\n },\n });\n }\n }\n\n private loadComponent(configuration: BloodConfiguration) {\n const component = this.selectComponent(configuration.processingType);\n\n this.state = ComponentState.FORM;\n\n const viewContainerRef = this.bloodAddHost.viewContainerRef;\n viewContainerRef.clear();\n\n this.componentRef = viewContainerRef.createComponent(\n component\n );\n this.componentRef.instance.configuration = configuration;\n this.componentRef.instance.formFieldAppearance = this.formFieldAppearance;\n this.componentRef.instance.analysisResult = this.analysisResult;\n // Don't show date field when adding report & saving it locally\n this.componentRef.instance.showDate = !this.local;\n\n // Init is optional\n if (this.componentRef.instance.init) {\n this.componentRef.instance.init();\n }\n\n this.componentRef.instance.form.statusChanges\n .pipe(untilDestroyed(this), startWith(null))\n .subscribe(() => {\n this.isValidForm = this.componentRef.instance.form.valid;\n this.cdRef.markForCheck();\n });\n\n this.componentRef.instance.submitted\n .pipe(untilDestroyed(this))\n .subscribe(() => this.onSubmit());\n\n this.cdRef.markForCheck();\n }\n\n private selectComponent(processingType: AnalysesProcessingType) {\n if (processingType === AnalysesProcessingType.Qualitative) {\n return BloodAddChoiceComponent;\n }\n return BloodAddValueComponent;\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { LocalBloodAnalysis } from '../../interfaces/blood-local-analysis';\nimport { BloodPost } from '../../interfaces/blood-post.inteface';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class BloodAddService {\n public localAnalyses: LocalBloodAnalysis[] = [];\n\n constructor(private http: HttpClient) {}\n\n public create(data: BloodPost): Observable<{ id: string }> {\n return this.http.post<{ id: string }>('/api/blood/results', data);\n }\n\n public update(resultId: string, data: BloodPost): Observable<{ id: string }> {\n return this.http.put<{ id: string }>(\n `/api/blood/results/${resultId}`,\n data\n );\n }\n\n public addLocal(data: LocalBloodAnalysis) {\n this.localAnalyses.push(data);\n }\n\n public updateLocal(data: LocalBloodAnalysis) {\n const index = this.localAnalyses.findIndex(\n (localAnalysis) => localAnalysis.analysisId === data.analysisId\n );\n\n this.localAnalyses[index] = data;\n }\n\n public removeLocal(data: LocalBloodAnalysis) {\n this.localAnalyses = this.localAnalyses.filter(\n (localAnalysis) => localAnalysis.analysisId !== data.analysisId\n );\n }\n}\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n} from '@angular/core';\nimport { GpuFormFieldAppearance } from '@geneplanet/ngx-ui/src/lib/form-field';\nimport { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';\nimport { AnalysesTypesLowercase } from 'src/app/analyses/interfaces/analyses.types';\nimport { AnalysesService } from 'src/app/analyses/services/analyses.service';\nimport { BloodConfiguration } from '../../interfaces/blood-configuration.interface';\nimport { BloodAnalysisResult } from '../../interfaces/blood-analysis-result.interface';\n\n@Component({\n templateUrl: './blood-add-marker-modal.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BloodAddMarkerModalComponent implements AfterViewInit {\n public analysisId: string;\n public resultId: string | null = null;\n public editMode = false;\n public local = false;\n public analysisResult: BloodAnalysisResult;\n\n protected GpuFormFieldAppearance = GpuFormFieldAppearance;\n protected configuration: BloodConfiguration;\n protected showBackButton = false;\n\n constructor(\n public modal: NgbActiveModal,\n private cdRef: ChangeDetectorRef,\n private analysesService: AnalysesService\n ) {}\n\n ngAfterViewInit() {\n // To avoid possible ExpressionChangedAfterItHasBeenCheckedError\n setTimeout(() => {\n this.loadAnalysis();\n\n // When editing already server saved\n if (this.resultId) {\n this.loadResult();\n }\n });\n }\n\n private loadAnalysis() {\n this.analysesService\n .bloodConfiguration(this.analysisId)\n .subscribe((configuration: BloodConfiguration) => {\n this.configuration = configuration;\n this.cdRef.markForCheck();\n });\n }\n\n private loadResult() {\n this.analysesService\n .getAnalysis(\n this.analysisId,\n this.resultId,\n false,\n AnalysesTypesLowercase.Blood\n )\n .subscribe((analysisResult: BloodAnalysisResult) => {\n this.analysisResult = analysisResult;\n this.cdRef.markForCheck();\n });\n }\n}\n","
\n \n \n \n
\n\n
\n \n

\n

\n\n \n
\n\n","
\n
\n \n \n \n {{ 'ANALYSES.SINGLE.RESULT' | translate }}\n \n \n \n {{ 'ANALYSES.VALUE_REQUIRED' | translate }}\n \n \n {{ 'ANALYSES.VALUE_INVALID' | translate }}\n \n \n {{ 'MIN_VALUE' | translate }}\n \n \n {{ 'MAX_VALUE' | translate }}\n \n \n {{ 'FAILURE.ERROR_CODES.' + errorCodes.INVALID_VALUE | translate }}\n \n \n
\n\n
\n \n {{ 'ANALYSES.UNIT' | translate }}\n \n \n \n \n \n \n {{ 'ANALYSES.UNIT_REQUIRED' | translate }}\n \n \n
\n \n\n
\n {{ 'ANALYSES.SINGLE.REF_TOOLTIP' | translate }}\n
\n\n
\n \n \n {{ 'ANALYSES.SINGLE.MIN_REF' | translate }}\n \n \n \n {{ 'ANALYSES.SINGLE.MIN_REFERENCE' | translate }}\n \n \n {{ 'ANALYSES.SINGLE.MIN_REFERENCE_VALUE' | translate }}\n \n \n {{ 'ANALYSES.VALUE_INVALID' | translate }}\n \n \n
\n\n
\n \n \n {{ 'ANALYSES.SINGLE.MAX_REF' | translate }}\n \n \n \n {{ 'ANALYSES.SINGLE.MAX_REFERENCE' | translate }}\n \n \n {{ 'ANALYSES.SINGLE.MAX_REFERENCE_VALUE' | translate }}\n \n \n {{ 'ANALYSES.VALUE_INVALID' | translate }}\n \n \n\n \n {{ 'ANALYSES.SINGLE.MIN_LOWER_THAN_MAX' | translate }}\n \n
\n\n \n \n {{ 'ANALYSES.ADD.DATE' | translate }}\n \n \n \n \n {{ 'ANALYSES.ADD.REQUIRED' | translate }}\n \n \n \n \n
\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n OnInit,\n} from '@angular/core';\nimport { AbstractControl, FormBuilder, Validators } from '@angular/forms';\nimport { GpuFormFieldAppearance } from '@geneplanet/ngx-ui/src/lib/form-field';\nimport {\n BloodMarkerUnit,\n Marker,\n} from 'src/app/analyses/interfaces/analyses.types';\nimport {\n objectToDate,\n subtractCurrentDateYear,\n} from 'src/app/shared/util/date-util';\nimport { BloodAddBase } from '../../interfaces/blood-add-base.interface';\nimport errorCodes from 'src/app/shared/constants/error-codes';\nimport { fromToValidator } from 'src/app/analyses/components/add/from-to.validator';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport { BloodResultValue } from '../../interfaces/blood-analysis-result.interface';\nimport { BloodConfigurationValue } from '../../interfaces/blood-configuration.interface';\nimport { AnalyticsService } from '@geneplanet/ngx-utils/src/lib/analytics';\nimport { ngbDateFromDate, ngbDateToISO } from 'src/app/shared/util/date-util';\nimport { ngbDateFromISO } from 'src/app/shared/util/date-util';\nimport { Subject } from 'rxjs';\nimport { BloodPost } from '../../interfaces/blood-post.inteface';\n\n@UntilDestroy()\n@Component({\n selector: 'app-blood-add-value',\n templateUrl: './blood-add-value.component.html',\n styleUrls: ['./blood-add-value.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BloodAddValueComponent implements OnInit, BloodAddBase {\n public configuration: BloodConfigurationValue;\n public analysisResult: BloodResultValue;\n public formFieldAppearance: GpuFormFieldAppearance;\n public showDate = true;\n public submitted = new Subject();\n\n public form = this.fb.nonNullable.group(\n {\n value: ['', Validators.required],\n from: [''],\n to: [''],\n unit: [''],\n date: [ngbDateFromDate(new Date()), Validators.required],\n },\n { validators: fromToValidator }\n );\n\n protected errorCodes = errorCodes;\n\n protected now = ngbDateFromDate(new Date());\n protected minDate = ngbDateFromDate(subtractCurrentDateYear(10));\n\n constructor(\n private fb: FormBuilder,\n private cdRef: ChangeDetectorRef,\n private analyticsService: AnalyticsService\n ) {}\n\n public ngOnInit(): void {\n this.form.controls.unit.valueChanges\n .pipe(untilDestroyed(this))\n .subscribe((unitId: string) => {\n this.setValidators(this.getUnitByUnitId(unitId));\n });\n\n const unitId = () => {\n if (this.analysisResult?.result?.unit) {\n return this.analysisResult.result.unit.id;\n } else if (this.analysisResult?.result?.markers) {\n return this.analysisResult.result.markers[0].unitId;\n } else {\n return this.configuration.markers[0].units[0].id;\n }\n };\n this.setValidators(this.getUnitByUnitId(unitId()));\n\n this.trackDate();\n this.trackUnit();\n }\n\n public init(): void {\n const unit = this.configuration.markers[0].units[0];\n\n this.form.controls.unit.patchValue(unit.id);\n\n if (this.analysisResult) {\n this.fillForm();\n }\n\n this.cdRef.markForCheck();\n }\n\n public onSubmit() {\n if (this.form.invalid) {\n return null;\n }\n\n const { from, to, value, unit } = this.form.value;\n\n const selectedUnit = this.configuration.markers[0].units.find(\n (markerUnit) => markerUnit.id === unit\n );\n\n const marker: Marker = {\n markerId: this.configuration.markers[0].id,\n unitId: unit,\n value: Number(value),\n from: from !== '' ? Number(from) : null,\n to: to !== '' ? Number(to) : null,\n unitName: selectedUnit.name,\n isVisibleResult: selectedUnit.isVisibleResult,\n };\n\n const generatedDate = objectToDate(\n (this.form.value.date as any) ?? {}\n ).toISOString();\n\n const payload: BloodPost = {\n generated: generatedDate,\n markers: [marker],\n };\n return payload;\n }\n\n protected trackInput(input: string, control: AbstractControl) {\n this.analyticsService.trackFormValue(\n this.analysisResult ? 'analyses-edit' : 'analyses-add',\n input,\n {\n value: control.value,\n isValid: String(control.valid),\n }\n );\n }\n\n private trackDate() {\n this.form.controls.date.valueChanges\n .pipe(untilDestroyed(this))\n .subscribe((value) => {\n this.analyticsService.trackFormValue(\n this.analysisResult ? 'analyses-edit' : 'analyses-add',\n 'date',\n { value: ngbDateToISO(value) }\n );\n });\n }\n\n private trackUnit() {\n this.form.controls.unit.valueChanges\n .pipe(untilDestroyed(this))\n .subscribe((value) => {\n this.analyticsService.trackFormValue(\n this.analysisResult ? 'analyses-edit' : 'analyses-add',\n 'unit',\n { id: value }\n );\n });\n }\n\n private setValidators(unit: BloodMarkerUnit) {\n this.form.controls.value.clearValidators();\n this.form.controls.from.clearValidators();\n this.form.controls.to.clearValidators();\n\n this.form.controls.value.addValidators([\n Validators.required,\n Validators.min(unit.minValue),\n Validators.max(unit.maxValue),\n ]);\n\n this.form.controls.from.addValidators(Validators.min(unit.minValue));\n this.form.controls.to.addValidators(Validators.max(unit.maxValue));\n\n // Do not emit event as it breaks analytics\n this.form.controls.value.updateValueAndValidity({ emitEvent: false });\n this.form.controls.from.updateValueAndValidity({ emitEvent: false });\n this.form.controls.to.updateValueAndValidity({ emitEvent: false });\n\n if (!this.showDate) {\n this.form.controls.date.clearValidators();\n this.form.controls.date.updateValueAndValidity({ emitEvent: false });\n }\n }\n\n private fillForm(): void {\n const marker = this.analysisResult.result.markers[0];\n\n let optimal = { from: null, to: null } as any;\n if (this.analysisResult.analysisLevels) {\n // When editing marker from lab report it doesn't have analysisLevels\n optimal = this.analysisResult.analysisLevels.find(\n (level) => level.isOptimal\n );\n }\n\n this.form.patchValue({\n value: String(marker.value),\n from: String(\n marker.referenceValueMin ?? optimal?.from ?? (marker as any).from\n ),\n to: String(marker.referenceValueMax ?? optimal?.to ?? (marker as any).to),\n unit: marker.unitId,\n date: ngbDateFromISO(this.analysisResult.result.generated),\n });\n }\n\n private getUnitByUnitId(unitId: string): BloodMarkerUnit {\n return this.configuration.markers[0].units.find(\n (item) => item.id === unitId\n );\n }\n}\n","import { Directive, ViewContainerRef } from '@angular/core';\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: '[measurementAddHost]'\n})\nexport class MeasurementAddHostDirective {\n\n constructor(public viewContainerRef: ViewContainerRef) { }\n\n}\n","import { ChangeDetectorRef, Directive, inject } from '@angular/core';\nimport { FormGroup } from '@angular/forms';\nimport { GpuFormFieldAppearance } from '@geneplanet/ngx-ui/src/lib/form-field';\nimport { AnalyticsService } from '@geneplanet/ngx-utils/src/lib/analytics';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport { Subject } from 'rxjs';\nimport {\n AnalysesResultDetails,\n MeasurementConfiguration,\n} from 'src/app/analyses/interfaces/analyses.types';\nimport { AnalyticsFormKey } from 'src/app/analyses/interfaces/analytics-form-key.interface';\nimport { ngbDateToISO } from 'src/app/shared/util/date-util';\nimport {\n ErrorResponse,\n MeasurementAnalysisResult,\n} from '../interfaces/measurement.interface';\n\n@UntilDestroy()\n@Directive({\n selector: '[appMeasurementAddBase]',\n})\nexport class MeasurementAddBaseDirective {\n public formFieldAppearance: GpuFormFieldAppearance;\n public submitted = new Subject();\n public configuration!: MeasurementConfiguration;\n\n public analysisResult: MeasurementAnalysisResult;\n public detailedResult: AnalysesResultDetails;\n protected error: ErrorResponse = null;\n\n protected form: FormGroup;\n // This is for analytics only\n protected get formName(): string {\n return `analyses-${this.editMode ? 'edit' : 'add'}`;\n }\n\n protected analyticsService = inject(AnalyticsService);\n private cdRef = inject(ChangeDetectorRef);\n\n public get editMode(): boolean {\n return !!this.analysisResult;\n }\n\n public trackInput(event: any, id: string | undefined): void {\n this.analyticsService.trackFormValue(\n this.formName,\n AnalyticsFormKey.value,\n { value: this.form.get(event.target.name).value },\n this.configuration.id,\n id\n );\n }\n\n public init(): void {\n this.updateValidators();\n\n this.fillDefaultForm();\n\n if (this.editMode) {\n this.fillForm();\n }\n\n this.cdRef.markForCheck();\n\n if (this.form.controls.date) {\n this.form.controls.date.valueChanges\n .pipe(untilDestroyed(this))\n .subscribe(() =>\n this.analyticsService.trackFormValue(\n this.formName,\n 'date',\n { value: ngbDateToISO(this.form.controls.date.value) },\n this.configuration.id\n )\n );\n }\n }\n\n public setError(error: ErrorResponse | null) {\n this.error = error;\n this.cdRef.markForCheck();\n }\n\n // This is for default values that need to be inserted (when not on edit)\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n protected fillDefaultForm() {}\n\n // This is for values when editing form\n protected fillForm() {\n throw new Error('Method not implemented.');\n }\n\n protected updateValidators() {\n throw new Error('Method not implemented.');\n }\n}\n","export const inputPattern = (decimalPlaces: number) =>\n new RegExp(`^\\\\d+${decimalPlaces > 0 ? `\\\\.?\\\\d{0,${decimalPlaces}}` : ''}$`);\n","import { ValidatorFn, AbstractControl } from '@angular/forms';\nimport { isInvalidValue } from 'src/app/analyses/components/add/from-to.validator';\n\nexport const systolicDiastolicValidator: ValidatorFn = (\n form: AbstractControl\n) => {\n const systolic = form.get('systolic').value;\n const diastolic = form.get('diastolic').value;\n\n if (isInvalidValue(systolic) || isInvalidValue(diastolic)) {\n return null;\n }\n\n if (Number(systolic) <= Number(diastolic)) {\n return { smallerGreater: true };\n }\n return null;\n};\n","
\n\n\n
\n \n \n {{ 'ANALYSES.DELETE.ACTION' | translate }}\n \n \n {{ 'ANALYSES.DELETE.ACTION_MOBILE' | translate }}\n \n \n\n \n \n \n {{\n (editMode ? 'ANALYSES.EDIT.ACTION' : 'ANALYSES.ADD.TITLE') | translate\n }}\n \n \n {{\n (editMode ? 'ANALYSES.EDIT.ACTION_MOBILE' : 'ANALYSES.ADD.TITLE')\n | translate\n }}\n \n \n
\n
\n","import {\n ChangeDetectionStrategy,\n Component,\n Input,\n Optional,\n} from '@angular/core';\nimport { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';\n\n@Component({\n selector: 'app-measurement-add-buttons',\n templateUrl: './measurement-add-buttons.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MeasurementAddButtonsComponent {\n @Input() editMode: boolean;\n @Input() isLoading: boolean;\n @Input() formValid: boolean;\n\n constructor(@Optional() protected modal: NgbActiveModal) {}\n\n protected openDeleteConfirmation(): void {\n this.modal.dismiss('delete');\n }\n}\n","
\n
\n
\n \n
\n
\n \n
\n
\n\n
\n \n {{ 'UNIT' | translate }}\n \n \n {{ option.name }}\n \n \n \n
\n\n \n \n {{ 'ANALYSES.ADD.DATE' | translate }}\n \n \n \n \n {{ 'ANALYSES.ADD.REQUIRED' | translate }}\n \n \n\n \n\n \n \n {{ metric.name }}\n \n \n {{ 'ANALYSES.VALUE_REQUIRED' | translate }}\n \n \n {{ 'ANALYSES.VALUE_INVALID' | translate }}\n \n\n \n {{\n 'RESULTS.ADD.VALUEBETWEEN'\n | translate\n : {\n min: metric.units[0].min,\n max: metric.units[0].max\n }\n }}\n \n \n \n {{ smallerGreaterMessage | translate }}\n \n \n\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\nimport { Validators, FormBuilder } from '@angular/forms';\nimport { IDateObject } from 'src/app/analyses/interfaces/analyses.types';\nimport { MeasurementAddBaseDirective } from 'src/app/body-measurements/directives/measurement-add-base.directive';\nimport { MeasurementAddBase } from 'src/app/body-measurements/interfaces/measurement-add.interface';\nimport { inputPattern } from 'src/app/body-measurements/validators/pattern.validator';\nimport {\n ngbDateFromDate,\n subtractCurrentDateYear,\n objectToDate,\n ngbDateFromISO,\n} from 'src/app/shared/util/date-util';\nimport { systolicDiastolicValidator } from './systolic-diastolic.validator';\n\n@Component({\n selector: 'app-measurement-add-blood-pressure',\n templateUrl: './measurement-add-blood-pressure.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MeasurementAddBloodPressureComponent\n extends MeasurementAddBaseDirective\n implements MeasurementAddBase {\n protected form = this.fb.group(\n {\n systolic: ['', Validators.required],\n diastolic: ['', Validators.required],\n unit: ['', Validators.required],\n date: [ngbDateFromDate(new Date()), Validators.required],\n },\n { validators: systolicDiastolicValidator }\n );\n\n protected now = ngbDateFromDate(new Date());\n protected minDate = ngbDateFromDate(subtractCurrentDateYear(10));\n\n constructor(private fb: FormBuilder) {\n super();\n }\n\n onSubmit() {\n if (this.form.invalid) {\n return;\n }\n\n const { systolic, diastolic, unit, date } = this.form.value;\n const generatedDate = objectToDate(\n (date as Partial) ?? {}\n ).toISOString();\n\n return {\n measurements: [\n {\n id: this.configuration.measurementMetrics[0].id,\n unitId: unit,\n value: systolic,\n },\n {\n id: this.configuration.measurementMetrics[1].id,\n unitId: unit,\n value: diastolic,\n },\n ],\n generated: generatedDate,\n };\n }\n\n protected updateValidators(): void {\n const metrics = this.configuration.measurementMetrics;\n\n this.form\n .get('systolic')\n .addValidators([\n Validators.min(metrics[0].units[0].min),\n Validators.max(metrics[0].units[0].max),\n Validators.pattern(inputPattern(metrics[0].units[0].decimalPlaces)),\n ]);\n this.form\n .get('diastolic')\n .addValidators([\n Validators.min(metrics[1].units[0].min),\n Validators.max(metrics[1].units[0].max),\n Validators.pattern(inputPattern(metrics[1].units[0].decimalPlaces)),\n ]);\n }\n\n protected fillDefaultForm(): void {\n this.form.controls.unit.patchValue(\n this.configuration.measurementMetrics[0].units[0].id\n );\n }\n\n protected fillForm(): void {\n this.form.patchValue({\n systolic: String(this.detailedResult.measurements[0].value),\n diastolic: String(this.detailedResult.measurements[1].value),\n unit: this.detailedResult.measurements[0].unitId,\n date: ngbDateFromISO(this.analysisResult.generated),\n });\n }\n\n protected trackUnitChange() {\n // TODO: Add tracking!\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 {{ 'ANALYSES.ADD.DATE' | translate }}\n \n \n \n \n {{ 'ANALYSES.ADD.REQUIRED' | translate }}\n \n \n\n \n\n \n \n \n {{ metric.name }} ({{ metric.units[unitIndex].name }})\n \n \n \n {{ 'ANALYSES.VALUE_REQUIRED' | translate }}\n \n \n {{ 'ANALYSES.VALUE_INVALID' | translate }}\n \n \n {{ 'MIN_VALUE' | translate }}\n \n \n {{ 'MAX_VALUE' | translate }}\n \n \n \n\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\nimport { Validators, FormBuilder } from '@angular/forms';\nimport { IDateObject } from 'src/app/analyses/interfaces/analyses.types';\nimport { MeasurementAddBaseDirective } from 'src/app/body-measurements/directives/measurement-add-base.directive';\nimport { MeasurementAddBase } from 'src/app/body-measurements/interfaces/measurement-add.interface';\nimport { inputPattern } from 'src/app/body-measurements/validators/pattern.validator';\nimport {\n ngbDateFromDate,\n subtractCurrentDateYear,\n objectToDate,\n ngbDateFromISO,\n} from 'src/app/shared/util/date-util';\nimport { MeasurementAddHostService } from '../../measurement-add-host/measurement-add-host.service';\n\n@Component({\n selector: 'app-measurement-add-bmi',\n templateUrl: './measurement-add-bmi.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MeasurementAddBmiComponent\n extends MeasurementAddBaseDirective\n implements MeasurementAddBase {\n protected isMetric = true;\n\n protected form = this.fb.group({\n weight: ['', Validators.required], // ADD VALIDATORS\n heightCM: [''],\n heightFT: [''],\n heightIN: [''],\n date: [ngbDateFromDate(new Date()), Validators.required],\n });\n\n protected now = ngbDateFromDate(new Date());\n protected minDate = ngbDateFromDate(subtractCurrentDateYear(10));\n\n constructor(\n private fb: FormBuilder,\n private measurementHost: MeasurementAddHostService\n ) {\n super();\n }\n\n init(): void {\n // Imperial will have two units (ft, in)\n this.isMetric = this.configuration.measurementMetrics[1].units.length === 1;\n\n super.init();\n }\n\n onSubmit() {\n if (this.form.invalid) {\n return;\n }\n\n const { weight, heightCM, heightFT, heightIN, date } = this.form.value;\n const generatedDate = objectToDate(\n (date as Partial) ?? {}\n ).toISOString();\n\n let height = [];\n if (this.isMetric) {\n height = [\n {\n id: this.configuration.measurementMetrics[1].id,\n unitId: this.configuration.measurementMetrics[1].units[0].id,\n value: heightCM,\n },\n ];\n } else {\n height = [\n {\n id: this.configuration.measurementMetrics[1].id,\n unitId: this.configuration.measurementMetrics[1].units[0].id,\n value: heightFT,\n },\n {\n id: this.configuration.measurementMetrics[1].id,\n unitId: this.configuration.measurementMetrics[1].units[1].id,\n value: heightIN,\n },\n ];\n }\n\n return {\n measurements: [\n {\n id: this.configuration.measurementMetrics[0].id,\n unitId: this.configuration.measurementMetrics[0].units[0].id,\n value: weight,\n },\n ...height,\n ],\n generated: generatedDate,\n };\n }\n\n protected showBfpDetailed() {\n this.measurementHost.changeComponent('bfpManual', this.configuration.id);\n }\n\n protected updateValidators(): void {\n const unitWeight = this.configuration.measurementMetrics[0].units[0];\n this.form.controls.weight.addValidators([\n Validators.min(unitWeight.min),\n Validators.max(unitWeight.max),\n Validators.pattern(inputPattern(unitWeight.decimalPlaces)),\n ]);\n\n if (this.isMetric) {\n const unit = this.configuration.measurementMetrics[1].units[0];\n this.form.controls.heightCM.addValidators([\n Validators.required,\n Validators.min(unit.min),\n Validators.max(unit.max),\n Validators.pattern(inputPattern(unit.decimalPlaces)),\n ]);\n } else {\n const unitFT = this.configuration.measurementMetrics[1].units[0];\n this.form.controls.heightFT.addValidators([\n Validators.required,\n Validators.min(unitFT.min),\n Validators.max(unitFT.max),\n Validators.pattern(inputPattern(unitFT.decimalPlaces)),\n ]);\n const unitIN = this.configuration.measurementMetrics[1].units[1];\n this.form.controls.heightIN.addValidators([\n Validators.required,\n Validators.min(unitIN.min),\n Validators.max(unitIN.max),\n Validators.pattern(inputPattern(unitIN.decimalPlaces)),\n ]);\n }\n }\n\n protected fillForm(): void {\n const measurements = this.detailedResult.measurements;\n\n if (this.isMetric) {\n this.form.controls.heightCM.patchValue(String(measurements[1].value));\n } else {\n this.form.patchValue({\n heightFT: String(measurements[1].value),\n heightIN: String(measurements[2].value),\n });\n }\n\n this.form.patchValue({\n weight: String(measurements[0].value),\n date: ngbDateFromISO(this.analysisResult.result.generated),\n });\n }\n}\n","
\n

\n {{ 'RESULTS.ADD.MEASUREFAT' | translate }}\n

\n \n {{ 'RESULTS.ADD.BODY_FAT_INSTRUCTIONS.BUTTON_LABEL' | translate }}\n \n\n \n \n {{ 'FAILURE.BAD_REQUEST.BFP_MALE' | translate }}\n \n \n {{ 'FAILURE.BAD_REQUEST.BFP_FEMALE' | translate }}\n \n \n \n\n \n \n \n {{ control.meta.metric.name }} ({{ control.meta.unit.name }})\n \n \n \n {{ 'ANALYSES.VALUE_REQUIRED' | translate }}\n \n \n {{ 'ANALYSES.VALUE_INVALID' | translate }}\n \n \n {{ 'MIN_VALUE' | translate }}\n \n \n {{ 'MAX_VALUE' | translate }}\n \n \n \n\n \n\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\nimport { FormBuilder, FormControl, Validators } from '@angular/forms';\nimport { NgbModal } from '@ng-bootstrap/ng-bootstrap';\nimport {\n MeasurementsResponseMetrics,\n MeasurementsResponseMetricsUnits,\n} from 'src/app/analyses/interfaces/analyses.types';\nimport { AnalysisId } from 'src/app/analyses/interfaces/analysis-id.enum';\nimport { AnalyticsFormKey } from 'src/app/analyses/interfaces/analytics-form-key.interface';\nimport { BodyFatCircumferenceInstructionsModalComponent } from 'src/app/analyses/modals/bf-circumference-instructions/bf-circumference-instructions.modal';\nimport { MeasurementAddBaseDirective } from 'src/app/body-measurements/directives/measurement-add-base.directive';\nimport { MeasurementAddBase } from 'src/app/body-measurements/interfaces/measurement-add.interface';\nimport { inputPattern } from 'src/app/body-measurements/validators/pattern.validator';\n\n//This adds `meta` to form control in this component\ndeclare module '@angular/forms' {\n // eslint-disable-next-line no-unused-vars\n interface FormControl {\n meta: any;\n }\n}\nFormControl.prototype.meta = {};\n\nconst getControlName = (analysisId: string, unitId: string) => {\n return `${analysisId}|${unitId}`;\n};\n\n@Component({\n selector: 'app-measurement-add-body-fat-manual',\n templateUrl: './measurement-add-body-fat-manual.component.html',\n styleUrls: ['./measurement-add-body-fat-manual.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MeasurementAddBodyFatManualComponent\n extends MeasurementAddBaseDirective\n implements MeasurementAddBase {\n protected form = this.fb.record({});\n\n protected isFemale = false;\n protected AnalysisId = AnalysisId;\n\n constructor(private fb: FormBuilder, private modals: NgbModal) {\n super();\n }\n\n init(): void {\n this.isFemale = this.configuration.id === AnalysisId.FatPercentageFemale;\n\n this.addControls();\n\n super.init();\n }\n\n onSubmit() {\n if (this.form.invalid) {\n return;\n }\n\n const measurements = this.controlArray.map((control) => {\n return {\n id: control.meta.metric.id,\n unitId: control.meta.unit.id,\n value: control.value,\n };\n });\n\n return {\n measurements,\n generated: new Date().toISOString(),\n };\n }\n\n public trackInput(event: any, inputId: string): void {\n this.analyticsService.trackFormValue(\n this.formName,\n AnalyticsFormKey.value,\n { value: this.form.get(event.target.id).value },\n this.configuration.id,\n inputId\n );\n }\n\n protected fillForm(): void {\n if (this.detailedResult.measurements.length === 1) {\n return;\n }\n\n this.detailedResult.measurements.forEach((measurement) => {\n this.form\n .get(getControlName(measurement.measurementId, measurement.unitId))\n .patchValue(String(measurement.value));\n });\n }\n\n protected openModal() {\n this.modals.open(BodyFatCircumferenceInstructionsModalComponent, {\n backdrop: 'static',\n keyboard: false,\n windowClass: 'tall-modal',\n backdropClass: 'basic-modal-backdrop',\n });\n }\n\n protected getMeasurementByIndex(idx: number): MeasurementsResponseMetrics {\n return this.configuration.measurementMetrics[idx];\n }\n\n protected getUnitByIndex(\n measurementIndex: number,\n unitIndex: number\n ): MeasurementsResponseMetricsUnits {\n return this.getMeasurementByIndex(measurementIndex).units[unitIndex];\n }\n\n protected updateValidators() {\n this.controlArray.forEach((control) => {\n control.addValidators([\n Validators.required,\n Validators.min(control.meta.unit.min),\n Validators.max(control.meta.unit.max),\n Validators.pattern(inputPattern(control.meta.unit.decimalPlaces)),\n ]);\n });\n }\n\n protected get controlArray(): FormControl[] {\n return Object.keys(this.form.controls).map(\n (controlName) => this.form.get(controlName) as FormControl\n );\n }\n\n private addControls() {\n this.configuration.measurementMetrics.slice(1).forEach((metric) => {\n metric.units.forEach((unit, index) => {\n const name = getControlName(metric.id, unit.id);\n const meta = {\n metric,\n unit,\n halfWidth: metric.units.length > 1,\n unitIndex: index,\n };\n const control = this.fb.control('');\n control.meta = meta;\n this.form.addControl(name, control);\n });\n });\n }\n}\n","
\n
\n
\n \n \n {{ metric.name }} ({{ metric.units[0].name }})\n \n \n \n {{ 'ANALYSES.VALUE_REQUIRED' | translate }}\n \n \n {{ 'ANALYSES.VALUE_INVALID' | translate }}\n \n \n {{ 'MIN_VALUE' | translate }}\n \n \n {{ 'MAX_VALUE' | translate }}\n \n \n
\n
\n\n \n \n {{ 'ANALYSES.ADD.DATE' | translate }}\n \n \n \n \n {{ 'ANALYSES.ADD.REQUIRED' | translate }}\n \n \n\n \n {{ 'ANALYSES.BFP.FAT' | translate }}\n \n \n\n","import { Component } from '@angular/core';\nimport { Validators, FormBuilder } from '@angular/forms';\nimport { IDateObject } from 'src/app/analyses/interfaces/analyses.types';\nimport { MeasurementAddBaseDirective } from 'src/app/body-measurements/directives/measurement-add-base.directive';\nimport { MeasurementAddBase } from 'src/app/body-measurements/interfaces/measurement-add.interface';\nimport { inputPattern } from 'src/app/body-measurements/validators/pattern.validator';\nimport {\n ngbDateFromDate,\n subtractCurrentDateYear,\n ngbDateFromISO,\n objectToDate,\n} from 'src/app/shared/util/date-util';\nimport { MeasurementAddHostService } from '../../measurement-add-host/measurement-add-host.service';\n\n@Component({\n selector: 'app-measurement-add-body-fat',\n templateUrl: './measurement-add-body-fat.component.html',\n styleUrls: ['./measurement-add-body-fat.component.scss'],\n})\nexport class MeasurementAddBodyFatComponent\n extends MeasurementAddBaseDirective\n implements MeasurementAddBase {\n //\n protected form = this.fb.group({\n value: ['', Validators.required],\n date: [ngbDateFromDate(new Date()), Validators.required],\n });\n\n protected now = ngbDateFromDate(new Date());\n protected minDate = ngbDateFromDate(subtractCurrentDateYear(10));\n\n constructor(\n private fb: FormBuilder,\n private measurementHost: MeasurementAddHostService\n ) {\n super();\n }\n\n onSubmit() {\n if (this.form.invalid) {\n return;\n }\n\n const { value, date } = this.form.value;\n const generatedDate = objectToDate(\n (date as Partial) ?? {}\n ).toISOString();\n\n return {\n measurements: [\n {\n id: this.configuration.measurementMetrics[0].id,\n unitId: this.configuration.measurementMetrics[0].units[0].id,\n value: value,\n },\n ],\n generated: generatedDate,\n };\n }\n\n protected showBfpDetailed() {\n this.measurementHost.changeComponent('bfpManual', this.configuration.id);\n }\n\n protected updateValidators(): void {\n const unit = this.configuration.measurementMetrics[0].units[0];\n this.form.controls.value.addValidators([\n Validators.min(unit.min),\n Validators.max(unit.max),\n Validators.pattern(inputPattern(unit.decimalPlaces)),\n ]);\n }\n\n protected fillForm(): void {\n this.form.patchValue({\n value: String(this.analysisResult.result.results[0].result),\n date: ngbDateFromISO(this.analysisResult.result.generated),\n });\n }\n}\n","
\n
\n
\n \n \n {{ metric.name }} ({{ metric.units[0].name }})\n \n \n \n {{ 'ANALYSES.VALUE_REQUIRED' | translate }}\n \n \n {{ 'ANALYSES.VALUE_INVALID' | translate }}\n \n \n {{ 'MIN_VALUE' | translate }}\n \n \n {{ 'MAX_VALUE' | translate }}\n \n \n
\n
\n\n \n \n {{ 'ANALYSES.ADD.DATE' | translate }}\n \n \n \n \n {{ 'ANALYSES.ADD.REQUIRED' | translate }}\n \n \n\n \n\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\nimport { FormBuilder, Validators } from '@angular/forms';\nimport { GpuFormFieldAppearance } from '@geneplanet/ngx-ui/src/lib/form-field';\nimport {\n IDateObject,\n MeasurementConfiguration,\n} from 'src/app/analyses/interfaces/analyses.types';\nimport { MeasurementAddBaseDirective } from 'src/app/body-measurements/directives/measurement-add-base.directive';\nimport { MeasurementAddBase } from 'src/app/body-measurements/interfaces/measurement-add.interface';\nimport { inputPattern } from 'src/app/body-measurements/validators/pattern.validator';\nimport {\n ngbDateFromDate,\n ngbDateFromISO,\n objectToDate,\n subtractCurrentDateYear,\n} from 'src/app/shared/util/date-util';\n\n@Component({\n selector: 'app-measurement-add-weight',\n templateUrl: './measurement-add-weight.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MeasurementAddWeightComponent\n extends MeasurementAddBaseDirective\n implements MeasurementAddBase {\n public configuration!: MeasurementConfiguration;\n public formFieldAppearance: GpuFormFieldAppearance;\n\n form = this.fb.group({\n value: ['', Validators.required], // ADD VALIDATORS\n date: [ngbDateFromDate(new Date()), Validators.required],\n });\n\n protected now = ngbDateFromDate(new Date());\n protected minDate = ngbDateFromDate(subtractCurrentDateYear(10));\n\n constructor(private fb: FormBuilder) {\n super();\n }\n\n onSubmit() {\n if (this.form.invalid) {\n return;\n }\n\n const { value, date } = this.form.value;\n const generatedDate = objectToDate(\n (date as Partial) ?? {}\n ).toISOString();\n\n return {\n measurements: [\n {\n id: this.configuration.measurementMetrics[0].id,\n unitId: this.configuration.measurementMetrics[0].units[0].id,\n value: value,\n },\n ],\n generated: generatedDate,\n };\n }\n\n protected updateValidators(): void {\n const {\n min,\n max,\n decimalPlaces,\n } = this.configuration.measurementMetrics[0].units[0];\n this.form.controls.value.addValidators([\n Validators.min(min),\n Validators.max(max),\n Validators.pattern(inputPattern(decimalPlaces)),\n ]);\n }\n\n protected fillForm(): void {\n this.form.patchValue({\n value: String(this.analysisResult.result.results[0].result),\n date: ngbDateFromISO(this.analysisResult.result.generated),\n });\n }\n}\n","
\n
\n
\n \n \n {{ metric.name }} ({{ metric.units[0].name }})\n \n \n \n {{ 'ANALYSES.VALUE_REQUIRED' | translate }}\n \n \n {{ 'ANALYSES.VALUE_INVALID' | translate }}\n \n \n {{ 'MIN_VALUE' | translate }}\n \n \n {{ 'MAX_VALUE' | translate }}\n \n \n
\n
\n\n \n \n {{ 'ANALYSES.ADD.DATE' | translate }}\n \n \n \n \n {{ 'ANALYSES.ADD.REQUIRED' | translate }}\n \n \n\n \n {{ 'RESULTS.ADD.HEART_RATE_INSCTURCTIONS.BUTTON_LABEL' | translate }}\n \n\n \n\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\nimport { Validators, FormBuilder } from '@angular/forms';\nimport { NgbModal } from '@ng-bootstrap/ng-bootstrap';\nimport { IDateObject } from 'src/app/analyses/interfaces/analyses.types';\nimport { HeartRateInstructionsModalComponent } from 'src/app/analyses/modals/heart-rate-instructions/heart-rate-instructions.modal';\nimport { MeasurementAddBaseDirective } from 'src/app/body-measurements/directives/measurement-add-base.directive';\nimport { MeasurementAddBase } from 'src/app/body-measurements/interfaces/measurement-add.interface';\nimport { inputPattern } from 'src/app/body-measurements/validators/pattern.validator';\nimport {\n ngbDateFromDate,\n subtractCurrentDateYear,\n objectToDate,\n ngbDateFromISO,\n} from 'src/app/shared/util/date-util';\n\n@Component({\n selector: 'app-measurement-add-heart-rate',\n templateUrl: './measurement-add-heart-rate.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MeasurementAddHeartRateComponent\n extends MeasurementAddBaseDirective\n implements MeasurementAddBase {\n protected form = this.fb.group({\n value: ['', Validators.required],\n date: [ngbDateFromDate(new Date()), Validators.required],\n });\n\n protected now = ngbDateFromDate(new Date());\n protected minDate = ngbDateFromDate(subtractCurrentDateYear(10));\n\n constructor(private fb: FormBuilder, private modals: NgbModal) {\n super();\n }\n\n onSubmit() {\n if (this.form.invalid) {\n return;\n }\n\n const { value, date } = this.form.value;\n const generatedDate = objectToDate(\n (date as Partial) ?? {}\n ).toISOString();\n\n return {\n measurements: [\n {\n id: this.configuration.measurementMetrics[0].id,\n unitId: this.configuration.measurementMetrics[0].units[0].id,\n value: value,\n },\n ],\n generated: generatedDate,\n };\n }\n\n protected updateValidators(): void {\n const unit = this.configuration.measurementMetrics[0].units[0];\n this.form.controls.value.addValidators([\n Validators.min(unit.min),\n Validators.max(unit.max),\n Validators.pattern(inputPattern(unit.decimalPlaces)),\n ]);\n }\n\n protected fillForm(): void {\n this.form.patchValue({\n value: String(this.analysisResult.result.results[0].result),\n date: ngbDateFromISO(this.analysisResult.result.generated),\n });\n }\n\n protected openModal(): void {\n this.modals.open(HeartRateInstructionsModalComponent, {\n backdrop: 'static',\n keyboard: false,\n windowClass: 'basic-modal',\n backdropClass: 'basic-modal-backdrop',\n });\n }\n}\n","
\n
\n \n \n \n \n
\n \n
\n
\n \n
\n
\n
\n\n \n \n {{ 'ANALYSES.ADD.DATE' | translate }}\n \n \n \n \n {{ 'ANALYSES.ADD.REQUIRED' | translate }}\n \n \n\n \n\n \n \n \n {{ configuration.measurementMetrics[0].name }} ({{\n configuration.measurementMetrics[0].units[unitIndex].name\n }})\n \n \n \n {{ 'ANALYSES.VALUE_REQUIRED' | translate }}\n \n \n {{ 'ANALYSES.VALUE_INVALID' | translate }}\n \n \n {{ 'MIN_VALUE' | translate }}\n \n \n {{ 'MAX_VALUE' | translate }}\n \n \n \n\n\n","import { ChangeDetectionStrategy, Component, inject } from '@angular/core';\nimport { Validators, FormBuilder } from '@angular/forms';\nimport { IDateObject } from 'src/app/analyses/interfaces/analyses.types';\nimport { MeasurementAddBaseDirective } from 'src/app/body-measurements/directives/measurement-add-base.directive';\nimport { MeasurementAddBase } from 'src/app/body-measurements/interfaces/measurement-add.interface';\nimport { inputPattern } from 'src/app/body-measurements/validators/pattern.validator';\nimport {\n ngbDateFromDate,\n subtractCurrentDateYear,\n objectToDate,\n ngbDateFromISO,\n} from 'src/app/shared/util/date-util';\n\n@Component({\n selector: 'app-measurement-add-height',\n templateUrl: './measurement-add-height.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MeasurementAddHeightComponent\n extends MeasurementAddBaseDirective\n implements MeasurementAddBase {\n\n protected isMetric = true;\n\n protected form = inject(FormBuilder).group({\n heightCM: [''],\n heightFT: [''],\n heightIN: [''],\n date: [ngbDateFromDate(new Date()), Validators.required],\n });\n\n protected now = ngbDateFromDate(new Date());\n protected minDate = ngbDateFromDate(subtractCurrentDateYear(10));\n\n init(): void {\n // Imperial will have two units (ft, in)\n this.isMetric = this.configuration.measurementMetrics[0].units.length === 1;\n\n super.init();\n }\n\n onSubmit() {\n if (this.form.invalid) {\n return;\n }\n\n const { heightCM, heightFT, heightIN, date } = this.form.value;\n const generatedDate = objectToDate(\n (date as Partial) ?? {}\n ).toISOString();\n\n const metric = this.configuration.measurementMetrics[0];\n let height = [];\n if (this.isMetric) {\n height = [\n {\n id: metric.id,\n unitId: metric.units[0].id,\n value: heightCM,\n },\n ];\n } else {\n height = [\n {\n id: metric.id,\n unitId: metric.units[0].id,\n value: heightFT,\n },\n {\n id: metric.id,\n unitId: metric.units[1].id,\n value: heightIN,\n },\n ];\n }\n\n return {\n measurements: height,\n generated: generatedDate,\n };\n }\n\n protected updateValidators(): void {\n if (this.isMetric) {\n const {\n min,\n max,\n decimalPlaces,\n } = this.configuration.measurementMetrics[0].units[0];\n this.form.controls.heightCM.addValidators([\n Validators.required,\n Validators.min(min),\n Validators.max(max),\n Validators.pattern(inputPattern(decimalPlaces)),\n ]);\n } else {\n const unitFT = this.configuration.measurementMetrics[0].units[0];\n this.form.controls.heightFT.addValidators([\n Validators.required,\n Validators.min(unitFT.min),\n Validators.max(unitFT.max),\n Validators.pattern(inputPattern(unitFT.decimalPlaces)),\n ]);\n const unitIN = this.configuration.measurementMetrics[0].units[1];\n this.form.controls.heightIN.addValidators([\n Validators.required,\n Validators.min(unitIN.min),\n Validators.max(unitIN.max),\n Validators.pattern(inputPattern(unitIN.decimalPlaces)),\n ]);\n }\n }\n\n protected fillForm(): void {\n const measurements = this.detailedResult.measurements;\n\n if (this.isMetric) {\n this.form.controls.heightCM.patchValue(String(measurements[0].value));\n } else {\n this.form.patchValue({\n heightFT: String(measurements[0].value),\n heightIN: String(measurements[1].value),\n });\n }\n\n this.form.patchValue({\n date: ngbDateFromISO(this.analysisResult.result.generated),\n });\n }\n}\n","
\n
\n
\n \n \n {{ metric.name }} ({{ metric.units[0].name }})\n \n \n \n {{ 'ANALYSES.VALUE_REQUIRED' | translate }}\n \n \n {{ 'ANALYSES.VALUE_INVALID' | translate }}\n \n \n {{ 'MIN_VALUE' | translate }}\n \n \n {{ 'MAX_VALUE' | translate }}\n \n \n
\n
\n\n \n \n {{ 'ANALYSES.ADD.DATE' | translate }}\n \n \n \n \n {{ 'ANALYSES.ADD.REQUIRED' | translate }}\n \n \n\n \n {{ 'RESULTS.ADD.CIRCUMFERENCE_INSTRUCTIONS.BUTTON_LABEL' | translate }}\n \n\n \n\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\nimport { Validators, FormBuilder } from '@angular/forms';\nimport { NgbModal } from '@ng-bootstrap/ng-bootstrap';\nimport { IDateObject } from 'src/app/analyses/interfaces/analyses.types';\nimport { AnalysesCircumferenceInstructionsModalComponent } from 'src/app/analyses/modals/circumference-instructions/circumference-instructions.modal';\nimport { MeasurementAddBaseDirective } from 'src/app/body-measurements/directives/measurement-add-base.directive';\nimport { MeasurementAddBase } from 'src/app/body-measurements/interfaces/measurement-add.interface';\nimport { inputPattern } from 'src/app/body-measurements/validators/pattern.validator';\nimport {\n ngbDateFromDate,\n subtractCurrentDateYear,\n objectToDate,\n ngbDateFromISO,\n} from 'src/app/shared/util/date-util';\n\n@Component({\n selector: 'app-measurement-add-waist-circumference',\n templateUrl: './measurement-add-waist-circumference.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MeasurementAddWaistCircumferenceComponent\n extends MeasurementAddBaseDirective\n implements MeasurementAddBase {\n protected form = this.fb.group({\n value: ['', Validators.required],\n date: [ngbDateFromDate(new Date()), Validators.required],\n });\n\n protected now = ngbDateFromDate(new Date());\n protected minDate = ngbDateFromDate(subtractCurrentDateYear(10));\n\n constructor(\n private fb: FormBuilder,\n private modals: NgbModal,\n ) {\n super();\n }\n\n onSubmit() {\n if (this.form.invalid) {\n return;\n }\n\n const { value, date } = this.form.value;\n const generatedDate = objectToDate(\n (date as Partial) ?? {}\n ).toISOString();\n\n return {\n measurements: [\n {\n id: this.configuration.measurementMetrics[0].id,\n unitId: this.configuration.measurementMetrics[0].units[0].id,\n value: value,\n },\n ],\n generated: generatedDate,\n };\n }\n\n protected updateValidators(): void {\n const { min, max, decimalPlaces } = this.configuration.measurementMetrics[0].units[0];\n this.form.controls.value.addValidators([\n Validators.min(min),\n Validators.max(max),\n Validators.pattern(inputPattern(decimalPlaces))\n ]);\n }\n\n protected fillForm(): void {\n this.form.patchValue({\n value: String(this.analysisResult.result.results[0].result),\n date: ngbDateFromISO(this.analysisResult.result.generated),\n });\n }\n\n protected openModal(): void {\n this.modals.open(AnalysesCircumferenceInstructionsModalComponent, {\n backdrop: 'static',\n keyboard: false,\n windowClass: 'basic-modal',\n backdropClass: 'basic-modal-backdrop',\n });\n }\n}\n","\n\n\n\n\n\n
\n {{ 'ERROR' | translate }}\n {{ 'FAILURE.GENERAL_ERROR.CONTENT' | translate }}\n
\n
\n\n\n \n \n \n\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ComponentRef,\n EventEmitter,\n Input,\n OnChanges,\n OnInit,\n Output,\n ViewChild,\n} from '@angular/core';\nimport { GpuFormFieldAppearance } from '@geneplanet/ngx-ui/src/lib/form-field';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport {\n AnalysesResultDetails,\n MeasurementConfiguration,\n} from 'src/app/analyses/interfaces/analyses.types';\nimport { AnalysisId } from 'src/app/analyses/interfaces/analysis-id.enum';\nimport { AnalysesService } from 'src/app/analyses/services/analyses.service';\nimport { MeasurementAddHostDirective } from '../../directives/measurement-add-host.directive';\nimport { MeasurementAddBase } from '../../interfaces/measurement-add.interface';\nimport { MeasurementAnalysisResult } from '../../interfaces/measurement.interface';\nimport { MeasurementAddBloodPressureComponent } from '../forms/measurement-add-blood-pressure/measurement-add-blood-pressure.component';\nimport { MeasurementAddBmiComponent } from '../forms/measurement-add-bmi/measurement-add-bmi.component';\nimport { MeasurementAddBodyFatManualComponent } from '../forms/measurement-add-body-fat-manual/measurement-add-body-fat-manual.component';\nimport { MeasurementAddBodyFatComponent } from '../forms/measurement-add-body-fat/measurement-add-body-fat.component';\nimport { MeasurementAddWeightComponent } from '../forms/measurement-add-weight/measurement-add-weight.component';\nimport { MeasurementAddHeartRateComponent } from '../forms/measurement-add-heart-rate/measurement-add-heart-rate.component';\nimport { MeasurementAddHeightComponent } from '../forms/measurement-add-height/measurement-add-height.component';\nimport { MeasurementAddWaistCircumferenceComponent } from '../forms/measurement-add-waist-circumference/measurement-add-waist-circumference.component';\nimport { MeasurementAddHostService } from './measurement-add-host.service';\nimport { finalize, Observable } from 'rxjs';\n\nenum ComponentState {\n LOADING = 'loading',\n ERROR = 'error',\n FORM = 'form',\n}\n\n@UntilDestroy()\n@Component({\n selector: 'app-measurement-add-host',\n templateUrl: './measurement-add-host.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MeasurementAddHostComponent implements OnInit, OnChanges {\n @ViewChild(MeasurementAddHostDirective, { static: true })\n measurementAddHost!: MeasurementAddHostDirective;\n\n @Input() editMode = false;\n @Input() configuration: MeasurementConfiguration;\n @Input() analysisResult: MeasurementAnalysisResult;\n @Input() detailedResult: AnalysesResultDetails;\n @Input() formFieldAppearance = GpuFormFieldAppearance.Card;\n @Input() backVisible = true;\n\n @Output() saved = new EventEmitter();\n @Output() closed = new EventEmitter();\n\n protected state = ComponentState.LOADING;\n\n private componentRef: ComponentRef;\n\n constructor(\n private cdRef: ChangeDetectorRef,\n private analysesService: AnalysesService,\n private hostService: MeasurementAddHostService\n ) {}\n\n ngOnInit() {\n this.hostService.changeComponent$\n .pipe(untilDestroyed(this))\n .subscribe((selector: AnalysisId | string) =>\n this.loadComponent(selector)\n );\n }\n\n ngOnChanges(): void {\n // Result is only required if we're editing result\n if (\n this.configuration &&\n this.editMode === !!(this.analysisResult && this.detailedResult)\n ) {\n this.loadComponent(this.configuration.id as AnalysisId);\n }\n }\n\n private loadComponent(componentSelector: AnalysisId | string) {\n const component = this.selectComponent(componentSelector);\n this.state = ComponentState.FORM;\n\n const viewContainerRef = this.measurementAddHost.viewContainerRef;\n viewContainerRef.clear();\n\n this.componentRef = viewContainerRef.createComponent(\n component\n );\n this.componentRef.instance.configuration = this.configuration;\n this.componentRef.instance.formFieldAppearance = this.formFieldAppearance;\n this.componentRef.instance.analysisResult = this.analysisResult;\n this.componentRef.instance.detailedResult = this.detailedResult;\n\n // Init is optional\n if (this.componentRef.instance.init) {\n this.componentRef.instance.init();\n }\n\n this.componentRef.instance.submitted\n .pipe(untilDestroyed(this))\n .subscribe(() => this.onSubmit());\n\n this.cdRef.markForCheck();\n }\n\n private onSubmit() {\n const data = this.componentRef.instance.onSubmit();\n this.state = ComponentState.LOADING;\n // Hide form while loading animation is visible\n this.componentRef.location.nativeElement.style.display = 'none';\n\n let method: Observable<{ requestId: string }>;\n if (!this.editMode) {\n method = this.analysesService.measurementCreate(data);\n } else {\n const id = this.analysisResult.result.requestId;\n method = this.analysesService.measurementUpdate(id, data);\n }\n\n method.pipe(finalize(() => (this.state = ComponentState.FORM))).subscribe({\n next: ({ requestId }) => this.saved.emit(requestId),\n error: (error) => {\n this.componentRef.instance.setError(error.error);\n this.componentRef.location.nativeElement.style.display = '';\n },\n });\n }\n\n private selectComponent(analysisId: AnalysisId | string) {\n return (\n {\n [AnalysisId.BodyWeight]: MeasurementAddWeightComponent,\n [AnalysisId.FatPercentageMale]: MeasurementAddBodyFatComponent,\n [AnalysisId.FatPercentageFemale]: MeasurementAddBodyFatComponent,\n [AnalysisId.BodyMassIndexMale]: MeasurementAddBmiComponent,\n [AnalysisId.BodyMassIndexFemale]: MeasurementAddBmiComponent,\n [AnalysisId.WaistCircumference]: MeasurementAddWaistCircumferenceComponent,\n [AnalysisId.BloodPressure]: MeasurementAddBloodPressureComponent,\n [AnalysisId.HeartRate]: MeasurementAddHeartRateComponent,\n [AnalysisId.BodyHeight]: MeasurementAddHeightComponent,\n bfpManual: MeasurementAddBodyFatManualComponent,\n }[analysisId] ?? null\n );\n }\n}\n","import { Injectable } from '@angular/core';\nimport { Subject } from 'rxjs';\nimport { AnalysisId } from 'src/app/analyses/interfaces/analysis-id.enum';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MeasurementAddHostService {\n public changeComponent$ = new Subject();\n // Selector of root page to redirect back to\n public rootPage = '';\n\n public changeComponent(\n componentSelector: AnalysisId | string,\n rootPage = ''\n ): void {\n this.changeComponent$.next(componentSelector);\n\n this.rootPage = rootPage;\n }\n\n public resetRootPage() {\n this.rootPage = '';\n }\n}\n","
\n \n\n \n \n \n
\n\n
\n \n \n\n \n
\n\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n} from '@angular/core';\nimport { GpuFormFieldAppearance } from '@geneplanet/ngx-ui/src/lib/form-field';\nimport { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';\nimport {\n AnalysesResultDetails,\n AnalysesTypesLowercase,\n MeasurementConfiguration,\n} from 'src/app/analyses/interfaces/analyses.types';\nimport { AnalysesService } from 'src/app/analyses/services/analyses.service';\nimport { MeasurementAddHostService } from '../measurement-add-host/measurement-add-host.service';\n\n@Component({\n selector: 'app-measurement-add-modal',\n templateUrl: './measurement-add-modal.component.html',\n styleUrls: ['./measurement-add-modal.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MeasurementAddModalComponent implements AfterViewInit {\n public analysisId: string;\n public resultId: string | null = null;\n public editMode = false;\n public local = false;\n public analysisResult: any;\n\n protected GpuFormFieldAppearance = GpuFormFieldAppearance;\n protected configuration: MeasurementConfiguration;\n protected detailedResult: AnalysesResultDetails;\n protected showBackButton = false;\n\n constructor(\n private cdRef: ChangeDetectorRef,\n private analysesService: AnalysesService,\n protected modal: NgbActiveModal,\n protected hostService: MeasurementAddHostService\n ) {\n this.hostService.resetRootPage();\n }\n\n ngAfterViewInit() {\n // To avoid possible ExpressionChangedAfterItHasBeenCheckedError\n setTimeout(() => {\n this.loadAnalysis();\n\n // When editing already server saved\n if (this.resultId) {\n this.loadResult();\n this.loadResultDetails();\n }\n });\n }\n\n protected goBack() {\n this.hostService.changeComponent(this.hostService.rootPage);\n }\n\n private loadAnalysis() {\n this.analysesService\n .measurementConfiguration(this.analysisId)\n .subscribe((configuration: MeasurementConfiguration) => {\n this.configuration = configuration;\n this.cdRef.markForCheck();\n });\n }\n\n private loadResult() {\n this.analysesService\n .getAnalysis(\n this.analysisId,\n this.resultId,\n false,\n AnalysesTypesLowercase.Measurements\n )\n .subscribe((analysisResult: any) => {\n this.analysisResult = analysisResult;\n this.cdRef.markForCheck();\n });\n }\n\n private loadResultDetails() {\n this.analysesService\n .getResultDetails(\n this.analysisId,\n this.resultId,\n AnalysesTypesLowercase.Measurements\n )\n .subscribe((detailedResult: AnalysesResultDetails) => {\n this.detailedResult = detailedResult;\n this.cdRef.markForCheck();\n });\n }\n}\n","export enum LocalStorageKey {\n USER_INTENT = 'user-intent-id',\n NO_INTENT = 'noIntent',\n RE_CHECK = 're-check',\n WT_COMPLETED = 'wt-completed',\n INTRO_COMPLETED = 'intro-completed',\n}\n\n// ids for WT_COMPLETED\nexport enum WalkThroughId {\n FOOD_ID = 'foodid',\n DASHBOARD = 'dashboard',\n}\n","import { Injectable } from '@angular/core';\nimport {\n HttpEvent,\n HttpInterceptor,\n HttpHandler,\n HttpRequest,\n HttpResponse,\n HttpErrorResponse,\n HttpStatusCode,\n HttpContextToken,\n} from '@angular/common/http';\nimport { EMPTY, Observable, throwError } from 'rxjs';\nimport { TranslateService } from '@ngx-translate/core';\nimport { environment } from 'src/environments/environment';\nimport { catchError, tap } from 'rxjs/operators';\n// eslint-disable-next-line @typescript-eslint/naming-convention\nimport * as Sentry from '@sentry/angular';\nimport { Router } from '@angular/router';\n\nexport const IGNORE_SENTRY = new HttpContextToken(() => false);\n\n@Injectable()\nexport class RequestInterceptor implements HttpInterceptor {\n constructor(private router: Router, private translate: TranslateService) {}\n\n intercept(\n req: HttpRequest,\n next: HttpHandler\n ): Observable> {\n // TODO - remove this, when language as get parameter is no longer needed\n const isOldApi =\n req.url.match('health-intelligence') ||\n req.url.match('/api/dna/reports') ||\n req.url.match('/api/habits/analyses') ||\n req.url.match('/api/dna/analyses');\n\n let clone = req.clone();\n const currentLang = this.translate?.currentLang;\n\n if (currentLang) {\n const langLongCode =\n environment.locations.find(\n (location) => location.lang.code == currentLang\n )?.lang?.longCode || environment.locations[0].lang.longCode;\n\n const updateHeaders = {\n setHeaders: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n 'X-Language': langLongCode,\n },\n };\n\n if (isOldApi) {\n Object.assign(updateHeaders);\n }\n clone = req.clone(updateHeaders);\n }\n\n return next.handle(clone).pipe(\n tap(getCorrelation),\n catchError((error) => this.catchHttpError(error, req))\n );\n }\n\n private catchHttpError(error: HttpEvent, req: HttpRequest) {\n if (error instanceof HttpErrorResponse) {\n if (error.status === 401) {\n this.router.navigateByUrl(`/accounts/check`);\n return EMPTY;\n }\n\n saveCorrelationToSentry(error);\n\n // For http 0, 403 or 500 log to Sentry\n const unexpectedStatuses = [\n 0, // No response\n HttpStatusCode.Forbidden,\n HttpStatusCode.InternalServerError,\n ];\n\n if (unexpectedStatuses.includes(error.status)) {\n const url = error?.url?.replace(environment.apiUrl, '');\n\n if(!req.context.get(IGNORE_SENTRY)) {\n Sentry.captureException(`[API error] [Status: ${error.status}] ${url}`);\n }\n }\n }\n return throwError(error);\n }\n}\n\nconst saveCorrelationToSentry = (\n data: HttpErrorResponse | HttpResponse\n): void => {\n const payload = {\n correlationId: data.headers.get('CorrelationId'),\n };\n Sentry.setContext('Last API call', payload);\n};\n\nconst getCorrelation = (event: HttpEvent) => {\n if (event instanceof HttpResponse) {\n saveCorrelationToSentry(event);\n }\n};\n","import {\n HttpContextToken,\n HttpErrorResponse,\n HttpEvent,\n HttpHandler,\n HttpInterceptor,\n HttpRequest,\n HttpStatusCode,\n} from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { catchError, EMPTY, Observable, throwError } from 'rxjs';\n// eslint-disable-next-line @typescript-eslint/naming-convention\nimport * as Sentry from '@sentry/angular';\n\nexport const IGNORE_ERROR = new HttpContextToken(() => false);\n\n@Injectable()\nexport class InternalServerErrorInterceptor implements HttpInterceptor {\n constructor(private router: Router) {}\n\n intercept(\n request: HttpRequest,\n next: HttpHandler\n ): Observable> {\n return next.handle(request).pipe(\n catchError((error) => {\n if (error instanceof HttpErrorResponse) {\n if (error.status === HttpStatusCode.InternalServerError) {\n // This is to properly log RudderStack header errors. Realistically not a backend error,\n // since header shouldn't be over 7000 characters long\n const rsHeaderLength = request.headers\n .getAll('rs-anonymous-id')\n ?.join('').length;\n if (rsHeaderLength > 6500) {\n Sentry.captureException(\n `[RudderStack ERROR] Header 'rs-anonymous-id' is too long; ${rsHeaderLength} characters`\n );\n }\n // This is so API call can skip this interceptor.\n // Recommended when subscriber handles error\n if (\n !request.context.get(IGNORE_ERROR) &&\n !this.router.url.startsWith('/error/general')\n ) {\n this.router.navigate(['/error/general'], {\n replaceUrl: true,\n queryParams: { returnUrl: this.router.url },\n });\n return EMPTY;\n }\n }\n }\n return throwError(() => error);\n })\n );\n }\n}\n","import { Injectable } from '@angular/core';\nimport { ActivatedRoute, NavigationEnd, Router } from '@angular/router';\nimport { BehaviorSubject, fromEvent, Subject } from 'rxjs';\nimport { filter } from 'rxjs/operators';\nimport { Layout, NavigationExtras } from '../interfaces';\n\n@Injectable({ providedIn: 'root' })\nexport class LayoutService {\n layout$ = new BehaviorSubject(null);\n navigationExtras$ = new BehaviorSubject(null);\n headerHeightChange$ = new BehaviorSubject(0);\n headerCloseClicked$ = new Subject();\n public headerResized$ = new Subject();\n\n private headerHeight = 0;\n\n constructor(private router: Router, private activatedRoute: ActivatedRoute) {\n fromEvent(window, 'resize').subscribe(() => {\n this.updateHeaderHeight();\n });\n\n this.router.events\n .pipe(filter((event) => event instanceof NavigationEnd))\n .subscribe(() => {\n this.getLayout();\n const state = this.router.getCurrentNavigation()?.extras?.state;\n this.navigationExtras$.next(state as NavigationExtras);\n this.updateHeaderHeight();\n });\n\n this.headerResized$.subscribe(() => {\n this.updateHeaderHeight();\n });\n }\n\n public headerCloseClick() {\n this.headerCloseClicked$.next();\n }\n\n public getHeaderHeight() {\n return this.headerHeight;\n }\n\n private updateHeaderHeight() {\n setTimeout(() => {\n const headerHeight = document.getElementById('header')?.offsetHeight;\n if (headerHeight !== this.headerHeight) {\n this.headerHeight = headerHeight;\n this.headerHeightChange$.next(this.headerHeight);\n }\n });\n }\n\n private getLayout() {\n let layout = null;\n let route = this.activatedRoute;\n while (route) {\n if (route.snapshot?.data?.layout) {\n layout = route.snapshot?.data?.layout;\n }\n if (route.snapshot?.data?.footer) {\n layout = { ...layout, footer: route.snapshot?.data?.footer };\n }\n if (route.snapshot?.data?.layout === 'bottomOffset') {\n layout = {\n ...layout,\n footer: {\n ...layout?.footer,\n bottomOffset: 'product',\n },\n };\n }\n if (route.snapshot?.data?.layout === 'simpleAlternativeShipping') {\n layout = {\n ...layout,\n footer: {\n ...layout?.footer,\n bottomOffset: 'checkout',\n },\n };\n }\n route = route.firstChild;\n }\n this.layout$.next(layout);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { HttpClient, HttpParams } from '@angular/common/http';\nimport { Observable, of } from 'rxjs';\nimport { shareReplay } from 'rxjs/operators';\n\nimport { environment } from 'src/environments/environment';\n\nimport {\n AnalysesTypesLowercase,\n KitInProgress,\n Report,\n StatisticsLevel,\n} from 'src/app/analyses/interfaces/analyses.types';\nimport { CategoryReport } from 'src/app/core/interfaces';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ResultsService {\n analyses: { [id: string]: { results: { [id: string]: any } } } = {};\n report: any = {};\n test: string;\n\n constructor(private http: HttpClient) {}\n\n all(type?: string, status?: string): Observable {\n // temporary DNA domain check, until all domains are switched to new APIs\n if (\n type &&\n [\n AnalysesTypesLowercase.DNA as string,\n AnalysesTypesLowercase.Blood as string,\n ].includes(type.toLowerCase())\n ) {\n return this.http.get(`/api/${type.toLowerCase()}/reports`).pipe(\n shareReplay({\n bufferSize: 1,\n refCount: true,\n })\n );\n }\n\n // We need to capitalise tye parameter to fit old api. This is temporary until new api is introduced\n const capitalisedType = type\n ? type.charAt(0).toUpperCase() + type.slice(1)\n : '';\n const params = new HttpParams()\n .append('type', capitalisedType || '')\n .append('status', status);\n\n return this.http\n .get(`${environment.api}/reports`, { params })\n .pipe(\n shareReplay({\n bufferSize: 1,\n refCount: true,\n })\n );\n }\n\n get(id: string, type?: string): Observable {\n if (type) {\n return this.http\n .get(`/api/${type.toLocaleLowerCase()}/reports/${id}`)\n .pipe(\n shareReplay({\n bufferSize: 1,\n refCount: true,\n })\n );\n } else {\n // healthscore/questionnaire\n return this.http.get(`${environment.api}/reports/${id}`);\n }\n }\n\n // Removed from the face of the earth, if re-enabled define interface type\n getPublicQuestionnaire(): Observable {\n return this.http.get(\n `${environment.publicApi}/questionnaire/${environment.products.lifestyleQuestionnaire}`\n );\n }\n\n save(report: {\n id?: string;\n file?: string;\n name?: string;\n date: string;\n productId?: string;\n }): Observable {\n // Reports api will not be migrated to new api!\n if (report.id) {\n return this.http.put(\n `${environment.api}/reports/${report.id}`,\n report\n );\n }\n\n return this.http.post(`${environment.api}/reports`, report);\n }\n\n update(\n id: string,\n report: { id?: string; status?: string; resultId?: string; type?: string }\n ): Observable {\n return this.http.put(`${environment.api}/reports/${id}`, report);\n }\n\n // Save when report is viewed\n logViewed(productInventoryItemId: string, type: string): Observable {\n if (productInventoryItemId && type) {\n return this.http.post(\n `${environment.api}/resultinteractors/markresultasviewed`,\n {\n productName: 'HI Dashboard',\n productInventoryItemId,\n origin: `HI-${type}`,\n }\n );\n }\n return of();\n }\n\n statistics(type: string, id = ''): Observable {\n return this.http.get(\n `/api/${type}/statistics/levels${id ? '/' + id : ''}`\n );\n }\n\n fetchReportsByCategoryId(categoryId: string): Observable {\n return this.http.get(`/api/categories/${categoryId}`);\n }\n\n fetchKitsInProgressByCategoryId(\n categoryId: string\n ): Observable {\n return this.http.get(\n `${environment.api}/kits-in-progress`,\n { params: { categoryId } }\n );\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { ElementRef, Injectable } from '@angular/core';\nimport { BehaviorSubject, fromEvent, Observable } from 'rxjs';\nimport { Category } from '../interfaces';\n\ninterface Sidebar {\n opened: boolean;\n collapsed: boolean;\n}\n@Injectable({ providedIn: 'root' })\nexport class SideMenuService {\n public categories$ = new BehaviorSubject([]);\n isCollapsable$ = new BehaviorSubject(true);\n state$ = new BehaviorSubject({\n opened: true,\n collapsed: false,\n });\n sideMenuWidth: number;\n\n private readonly containerWidth = 720;\n private readonly collapsedSideMenuWidth = 72;\n private readonly sidePadding = 2 * 16;\n private readonly animationTime = 350;\n private readonly collapsableWidth =\n this.containerWidth + 2 * this.collapsedSideMenuWidth + this.sidePadding;\n private sideMenuElementRef: ElementRef;\n\n constructor(private http: HttpClient) {\n this.setDefault();\n fromEvent(window, 'resize').subscribe(() => {\n if (!this.sideMenuWidth && window.innerWidth > this.collapsableWidth) {\n this.state$.next({ opened: true, collapsed: false });\n this.updateSideMenuWidth();\n } else {\n this.setDefault();\n }\n });\n }\n\n setDefault() {\n const state = {\n opened: true,\n collapsed: false,\n };\n const width = window.innerWidth;\n\n if (width <= this.collapsableWidth) {\n state.opened = false;\n this.isCollapsable$.next(false);\n } else if (\n width > this.collapsableWidth &&\n width < this.containerWidth + 2 * this.sideMenuWidth + this.sidePadding\n ) {\n state.collapsed = true;\n this.isCollapsable$.next(true);\n }\n\n this.state$.next(state);\n }\n\n openToggle() {\n this.state$.next({\n ...this.state$.value,\n opened: !this.state$.value.opened,\n });\n }\n\n collapsedToggle() {\n this.state$.next({\n ...this.state$.value,\n collapsed: !this.state$.value.collapsed,\n });\n }\n\n setSideMenuElementRef(elementRef: ElementRef) {\n this.sideMenuElementRef = elementRef;\n this.updateSideMenuWidth();\n }\n\n fetchCategories(): Observable {\n return this.http.get(`/api/categories/`);\n }\n\n public clearCategories(): void {\n this.categories$.next([]);\n }\n\n private updateSideMenuWidth() {\n setTimeout(() => {\n if (!this.sideMenuWidth) {\n this.sideMenuWidth = this.sideMenuElementRef?.nativeElement?.clientWidth;\n }\n this.setDefault();\n }, this.animationTime);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { CanActivate, CanActivateChild, UrlTree } from '@angular/router';\nimport { Auth0Service } from '@geneplanet/ngx-auth0';\nimport { Observable, of } from 'rxjs';\nimport { switchMap } from 'rxjs/operators';\n\nimport { CustomerCheckService } from 'src/app/shared/services/customer-check.service';\nimport { IntentStrategyService } from 'src/app/shared/services/intent/intent-strategy.service';\n\n@Injectable({ providedIn: 'root' })\nexport class CustomerExistsGuard implements CanActivate, CanActivateChild {\n constructor(\n private customerCheck: CustomerCheckService,\n private intentStrategyService: IntentStrategyService,\n private auth0Service: Auth0Service\n ) {}\n\n getCanActive(): Observable {\n return this.customerCheck.customerExists$.pipe(\n switchMap((exists: boolean) => {\n if (exists) {\n return of(true);\n }\n\n const isUserLoggedIn = !!this.auth0Service.tokens.current$.value;\n\n if (isUserLoggedIn) {\n return this.intentStrategyService.context.onCustomerNotExists();\n } else {\n return this.intentStrategyService.context.onUserNotExists();\n }\n })\n );\n }\n\n canActivateChild(): Observable {\n return this.getCanActive();\n }\n\n canActivate(): Observable {\n return this.getCanActive();\n }\n}\n","export const HealthscoreTabs = {\n INSIGHTS: 'insights',\n DISCOVER: 'discover',\n IMPROVE: 'improve',\n ABOUT: 'about',\n};\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { tap } from 'rxjs/operators';\nimport { HabitsConfiguration } from 'src/app/analyses/interfaces/analyses.types';\nimport { AnalysesService } from 'src/app/analyses/services/analyses.service';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class QuestionnaireService {\n constructor(\n private http: HttpClient,\n private readonly analysesService: AnalysesService\n ) {}\n\n public getHabitsConfigurations(): Observable {\n return this.http.get(\n '/api/habits/configurations/lifestyle'\n );\n }\n\n saveQuestionnaire(): Observable<{ id: string } | null> {\n const data = this.analysesService.local.getQuestionnaire();\n\n if (!data?.questions.length) {\n return of(null);\n }\n\n return this.analysesService\n .saveQuestionnaire(data)\n .pipe(tap(() => this.analysesService.local.clearQuestionnaire()));\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport { TranslateService } from '@ngx-translate/core';\nimport { LokaliseService } from './lokalise.service';\nimport { LOKALISE_ENV_ENABLED, LOKALISE_USER_ENABLED } from './provider';\n\n@Injectable()\nexport class LokaliseTranslateService extends TranslateService {\n private enabledEnvToken = inject(LOKALISE_ENV_ENABLED);\n private enabledUserToken = inject(LOKALISE_USER_ENABLED);\n private lokaliseService = inject(LokaliseService);\n\n public instant(\n key: string | Array,\n interpolateParams?: object\n ): string | any {\n const translation = super.instant(key, interpolateParams);\n\n if (!this.enabledEnvToken || !this.enabledUserToken) {\n // Return translation, Lokalise script is not enabled\n return translation;\n }\n\n if (typeof key === 'string') {\n this.lokaliseService.translationAdded.next();\n return `{.${key.replaceAll('.', '::')}.}`;\n }\n\n return translation;\n }\n}\n","import { TranslateService } from '@ngx-translate/core';\nimport { LokaliseTranslateService } from './lokalise-translate.service';\nimport { LokaliseTranslatePipe } from './lokalise-translate.pipe';\nimport { NgModule } from '@angular/core';\n\nexport * from './provider';\nexport * from './lokalise-translate.pipe';\n\nexport const lokaliseOverrideTranslateService = {\n provide: TranslateService,\n useClass: LokaliseTranslateService,\n};\n\n@NgModule({\n providers: [lokaliseOverrideTranslateService],\n imports: [LokaliseTranslatePipe],\n exports: [LokaliseTranslatePipe]\n})\nexport class LokaliseOverrideModule {}\n","import { Pipe, PipeTransform, inject } from '@angular/core';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { LOKALISE_ENV_ENABLED, LOKALISE_USER_ENABLED } from './provider';\nimport { LokaliseService } from './lokalise.service';\n\n@Pipe({\n name: 'translate',\n standalone: true,\n pure: false,\n})\nexport class LokaliseTranslatePipe\n extends TranslatePipe\n implements PipeTransform\n{\n private enabledEnvToken = inject(LOKALISE_ENV_ENABLED);\n private enabledUserToken = inject(LOKALISE_USER_ENABLED);\n private lokaliseService = inject(LokaliseService);\n\n transform(value: any, ...args: any[]): any {\n const translation = super.transform(value, ...args);\n\n if (!this.enabledEnvToken || !this.enabledUserToken) {\n // Return translation, Lokalise script is not enabled\n return translation;\n }\n\n if (typeof translation === 'string') {\n this.lokaliseService.translationAdded.next();\n return '{.' + value.replaceAll('.', '::') + '.}';\n }\n\n if (Array.isArray(translation)) {\n return Array.from(Array(translation.length)).map(\n (_, index) => `{.${value.replaceAll('.', '::')}::${index}.}`\n );\n }\n\n return translation;\n }\n}\n","import { DOCUMENT, isPlatformServer } from '@angular/common';\nimport {\n Injectable,\n PLATFORM_ID,\n RendererFactory2,\n inject,\n} from '@angular/core';\nimport { Subject, debounceTime } from 'rxjs';\nimport {\n LOKALISE_ENV_ENABLED,\n LOKALISE_PROJECT_ID,\n LOKALISE_USER_ENABLED,\n} from './provider';\nimport { TranslateService } from '@ngx-translate/core';\n\nconst lokaliseBodyClass = 'lokalise-coloring';\nconst LiveJsPanelElementId = 'lokalise-live-js-panel';\nconst openClass = 'keepopen';\nconst openDefaultText = 'select translation to edit';\n\n@Injectable()\nexport class LokaliseService {\n public translationAdded = new Subject();\n\n private _document = inject(DOCUMENT);\n private platformId = inject(PLATFORM_ID);\n private translateService = inject(TranslateService);\n private renderer = inject(RendererFactory2).createRenderer(null, null);\n\n // Injection tokens\n private enabledEnvToken = inject(LOKALISE_ENV_ENABLED);\n private enabledUserToken = inject(LOKALISE_USER_ENABLED);\n private projectIdToken = inject(LOKALISE_PROJECT_ID);\n\n public init(): void {\n if (isPlatformServer(this.platformId)) {\n return;\n }\n\n if (!this.enabledEnvToken) {\n return;\n }\n\n if (!this.enabledUserToken) {\n this.listenToEnableShortcut();\n return;\n }\n\n this.injectScript();\n this.injectCSS();\n this.listenToLanguageChange();\n this.listenToTranslation();\n this.listenToCDKOverlay();\n this.listenToLokaliseInitialized();\n }\n\n /**\n * Enable LiveJS\n * By default it's disabled, pressing `ctrl + e` will enable it.\n */\n private listenToEnableShortcut(): void {\n this.renderer.listen('document', 'keydown.control.e', (event: Event) => {\n event.preventDefault();\n localStorage.setItem('LOKALISE_ENABLED', '{}');\n location.reload();\n return false;\n });\n }\n\n /**\n * Whenever we translate something `translationAdded` will emit.\n * Emitted from LokaliseTranslatePipe and LokaliseTranslateService\n */\n private listenToTranslation(): void {\n this.translationAdded.pipe(debounceTime(50)).subscribe(() => {\n this.emitUpdateElements();\n setTimeout(() => this.emitUpdateElements(), 2000);\n });\n }\n\n /**\n * Listening to CDK overlay changes\n * Due to timing issues CDK listener could not be used\n */\n private listenToCDKOverlay(): void {\n const targetNode = document.querySelector('.cdk-overlay-container');\n\n const config = { attributes: true, childList: true, subtree: true };\n\n const observer = new MutationObserver(() => this.emitUpdateElements());\n\n observer.observe(targetNode, config);\n }\n\n /**\n * When we change language we need to notify LiveJS about it through custom event\n */\n private listenToLanguageChange(): void {\n this.translateService.onLangChange.subscribe((event) => {\n document.dispatchEvent(\n new CustomEvent('lokalise-update-locale', { detail: event.lang })\n );\n });\n }\n\n /**\n * Listen to when LiveJS is initialized\n */\n private listenToLokaliseInitialized(): void {\n const injectToLiveJSButtonsCallback = () => {\n this.injectButtons();\n };\n\n document.addEventListener(\n 'lokalise-initialized',\n injectToLiveJSButtonsCallback,\n { once: true }\n );\n }\n\n /**\n * Inject script to load LiveJS. Once loaded it will emit 'lokalise-initialized'\n */\n private injectScript(): void {\n const script = document.createElement('script');\n script.type = `application/javascript`;\n script.text = `\n window.LOKALISE_CONFIG = {\n projectId: \"${this.projectIdToken}\",\n locale: \"${this.translateService.currentLang}\",\n plainKey: true,\n };\n (function () {\n var a = document.createElement(\"script\");a.type = \"text/javascript\";a.async = !0;\n a.src = [\"https://app.lokalise.com/live-js/script.min.js?\", (new Date).getTime()].join(\"\");\n document.body.appendChild(a)\n })();\n `;\n this._document.body.appendChild(script);\n }\n\n /**\n * Inject CSS to body to fix styling\n * This will add coloring for translatable elements\n */\n private injectCSS(): void {\n const style = document.createElement('style');\n style.textContent = `\n .lokalise-coloring [data-lokalise]:not(button) { background-color: #ffc4006b; }\n .lokalise-coloring button[data-lokalise] { outline: 3px solid #ffc4006b !important;}\n .lokalise-coloring .lokalise-live-js-edit-icon { display: inline-block !important; top: unset !important; }\n #content, app-side-menu {padding-bottom: 210px !important;}\n #${LiveJsPanelElementId}.${openClass} {height: 210px !important;}\n #${LiveJsPanelElementId}.${openClass}::after {\n content: \"${openDefaultText}\";\n font-size: 20px;\n justify-content: center;\n display: flex;\n padding-top: 50px;\n font-style: italic;\n }\n `;\n this._document.body.appendChild(style);\n document.body.classList.add(lokaliseBodyClass);\n }\n\n /**\n * Injecting buttons into LiveJS toolbar.\n * This will add:\n * - Toggle click - if click through propagation is stopped on parent (REMOVED)\n * - Toggle color - will show/hide background color of translatable text\n * - Remove LiveJS - will disable this script and reload website\n * - Toggle extended - forces the LiveJS panel to be extended even if no translation is selected\n */\n private injectButtons(): void {\n const container = document.querySelector(\n '#lokalise-live-js-panel .lokalise-live-js-container'\n );\n\n const createButton = (text: string, id: string, callback: () => void) => {\n const button = document.createElement('div');\n button.innerHTML = `\n
\n \n
`;\n\n container.appendChild(button);\n\n document\n .getElementById(`lokalise-${id}`)\n .addEventListener('click', () => callback());\n };\n\n createButton(\n 'Close',\n 'remove-script',\n this.removeLiveJS.bind(this)\n );\n createButton(\n 'Toggle highlight',\n 'toggle-coloring',\n this.toggleColors.bind(this)\n );\n createButton(\n 'Toggle extended',\n 'toggle-extend',\n this.toggleExtended.bind(this)\n );\n }\n\n private toggleColors(): void {\n if (document.body.classList.contains(lokaliseBodyClass)) {\n document.body.classList.remove(lokaliseBodyClass);\n } else {\n document.body.classList.add(lokaliseBodyClass);\n }\n }\n\n private toggleExtended(): void {\n if (document.getElementById(LiveJsPanelElementId).classList.contains(openClass)) {\n document.getElementById(LiveJsPanelElementId).classList.remove(openClass);\n } else {\n document.getElementById(LiveJsPanelElementId).classList.add(openClass);\n }\n }\n\n private emitUpdateElements(): void {\n document.dispatchEvent(new Event('lokalise-update-elements'));\n }\n\n private removeLiveJS(): void {\n localStorage.removeItem('LOKALISE_ENABLED');\n location.reload();\n }\n}\n","import {\n APP_INITIALIZER,\n EnvironmentProviders,\n InjectionToken,\n Provider,\n makeEnvironmentProviders,\n} from '@angular/core';\nimport { LokaliseService } from './lokalise.service';\n// import { TranslateService } from '@ngx-translate/core';\n// import { LokaliseTranslateService } from './lokalise-translate.service';\n\nexport enum LokaliseFeatureKind {\n ProjectId,\n EnvironmentEnabled,\n}\n\nexport interface LokaliseFeature {\n ɵkind: KindT;\n ɵproviders: Provider[];\n}\n\nexport const LOKALISE_ENV_ENABLED = new InjectionToken(\n 'LOKALISE_ENV_ENABLED'\n);\nexport const LOKALISE_USER_ENABLED = new InjectionToken(\n 'LOKALISE_USER_ENABLED'\n);\nexport const LOKALISE_PROJECT_ID = new InjectionToken(\n 'LOKALISE_PROJECT_ID'\n);\n\nfunction makeLokaliseFeature(\n kind: KindT,\n providers: Provider[]\n): LokaliseFeature {\n return {\n ɵkind: kind,\n ɵproviders: providers,\n };\n}\n\nexport const provideLokalise = (\n ...features: LokaliseFeature[]\n): EnvironmentProviders => {\n const providers: (Provider | EnvironmentProviders)[] = [\n LokaliseService,\n {\n provide: APP_INITIALIZER,\n useFactory: (service: LokaliseService) => () => service.init(),\n deps: [LokaliseService],\n multi: true,\n },\n {\n provide: LOKALISE_USER_ENABLED,\n useValue: !!localStorage.getItem('LOKALISE_ENABLED'),\n },\n ];\n\n for (const feature of features) {\n providers.push(...feature.ɵproviders);\n }\n\n return makeEnvironmentProviders(providers);\n};\n\n/**\n * Set injection token with project ID\n * @param projectId\n * @returns LokaliseFeature\n *\n * @see {@link provideLokalise}\n */\nexport const withProjectId = (\n projectId: string\n): LokaliseFeature => {\n return makeLokaliseFeature(LokaliseFeatureKind.ProjectId, [\n {\n provide: LOKALISE_PROJECT_ID,\n useValue: projectId,\n },\n ]);\n};\n\n/**\n * Set InjectionToken if this environment has Lokalise script enabled\n * @param enabled\n * @returns LokaliseFeature\n *\n * @see {@link provideLokalise}\n */\nexport const withEnvironmentEnabled = (\n enabled: boolean\n): LokaliseFeature => {\n return makeLokaliseFeature(LokaliseFeatureKind.EnvironmentEnabled, [\n {\n provide: LOKALISE_ENV_ENABLED,\n useValue: enabled,\n },\n ]);\n};\n","import { Injectable } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { BehaviorSubject, Observable } from 'rxjs';\nimport { filter, shareReplay, switchMap, tap } from 'rxjs/operators';\n\nimport { Auth0Service } from '@geneplanet/ngx-auth0';\nimport { environment } from 'src/environments/environment';\n\nimport { CustomerCheckService } from '../../shared/services/customer-check.service';\nimport { AncestryService } from '../../ancestry/services/ancestry.service';\nimport {\n UntypedFormBuilder,\n UntypedFormGroup,\n Validators,\n} from '@angular/forms';\nimport {\n Profile,\n FullProfile,\n Country,\n Kit,\n} from '../interfaces/me.interfaces';\nimport { IntentService } from 'src/app/shared/services/intent/intent.service';\nimport { IntentStrategyService } from 'src/app/shared/services/intent/intent-strategy.service';\nimport { SideMenuService } from 'src/app/core/services/side-menu.service';\nimport { Router } from '@angular/router';\nimport { AnalyticsService } from '@geneplanet/ngx-utils/src/lib/analytics';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MeService {\n public isNiptUser = new BehaviorSubject(false);\n public profile$?: Observable;\n form: UntypedFormGroup;\n\n constructor(\n private http: HttpClient,\n private readonly auth0: Auth0Service,\n private readonly customerCheckService: CustomerCheckService,\n private readonly ancestryService: AncestryService,\n private readonly builder: UntypedFormBuilder,\n private readonly intentService: IntentService,\n private readonly intentStrategyService: IntentStrategyService,\n private sideMenuService: SideMenuService,\n private analyticsService: AnalyticsService,\n private readonly router: Router\n ) {}\n\n buildForm() {\n this.form = this.builder.group({\n address: this.builder.group({\n street: ['', Validators.required],\n post: ['', Validators.required],\n city: ['', Validators.required],\n country: ['', Validators.required],\n }),\n unitSystem: ['', Validators.compose([])],\n });\n return this.form;\n }\n\n updateForm(me) {\n this.form.setValue({\n address: {\n street: me.address.street,\n post: me.address.post,\n city: me.address.city,\n country: me.address.country,\n },\n unitSystem: me?.unitSystem ? me.unitSystem : 'Metric',\n });\n }\n\n logout(): void {\n this.sideMenuService.clearCategories();\n this.clearProfileCache();\n this.analyticsService.reset();\n this.auth0.logout();\n this.intentService.clear();\n this.intentStrategyService.resetStrategy();\n this.intentService.inIntent = false;\n }\n\n clearProfileCache() {\n this.ancestryService.cleanup();\n this.profile$ = null;\n }\n\n getFullProfile(\n forceUpdate = false\n ): Observable | null | undefined {\n if (forceUpdate) {\n // Reset to make new API call. Required when your profile changes\n this.profile$ = null;\n }\n\n if (!this.profile$) {\n return this.customerCheckService.customerExists$.pipe(\n filter((customerExists: boolean) => !!customerExists),\n switchMap(() => this.fetchProfile())\n );\n }\n return this.profile$;\n }\n\n getSubscriptionUrl(id: string) {\n return this.http.post(\n `${environment.payment.stripeUrl}/customer_portal`,\n {\n subscriptionCustomerId: id,\n returnUrl: `${environment.dashboardUrl}me`,\n }\n );\n }\n\n saveProfile(profile: Profile): Observable {\n return this.http.put(`${environment.api}/me`, profile);\n }\n\n countries(): Observable {\n return this.http.get(`${environment.api}/countries`);\n }\n\n getKits(): Observable {\n return this.http.get(`${environment.api}/customers/kits`);\n }\n\n saveConsent(consent: boolean): Observable {\n return this.http.put(`/api/consents/SalivaConsent`, {\n value: consent,\n });\n }\n\n deleteAccount(): Observable {\n return this.http.delete(`${environment.api}/me`);\n }\n\n private fetchProfile(): Observable {\n this.profile$ = this.http.get(`${environment.api}/me`).pipe(\n shareReplay({\n bufferSize: 1,\n refCount: true,\n }),\n tap((profile) => {\n this.isNiptUser.next(!!profile.niptUser);\n\n if (profile.markedForDeletion) {\n this.logout();\n this.router.navigate(['/accounts/check']);\n }\n })\n );\n return this.profile$;\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { map, shareReplay } from 'rxjs/operators';\nimport { NiptResult } from '../interfaces/nipt-result.interface';\nimport { RefResponse } from '../interfaces/ref-response.interface';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class NiptApiService {\n errorDisplayed = false;\n constructor(private http: HttpClient) {}\n\n public getRefData(ref: string): Observable {\n return this.http\n .get(`/api/nipt-online/references/${ref}`)\n .pipe(\n shareReplay({\n bufferSize: 1,\n refCount: true,\n })\n );\n }\n\n public getResults(): Observable {\n return this.http.get('/api/nipt-online/results');\n }\n\n public getResult(testId: string): Observable {\n return this.http.get(`/api/nipt-online/results/${testId}`);\n }\n\n public isClaimed(kitId: string): Observable {\n return this.http\n .get(`/api/nipt-online/link-check/${kitId}`)\n .pipe(map((response: any) => !!response.linked));\n }\n\n /**\n * Claim kit\n * Should return 200 if successful or 400 if kit is already claimed / email doesn't match.\n *\n * To \"unlink\" (for testing purpose) use API: POST https://api-stg.geneplanet.com/api/nipts/NiptTest/{testId}/tell/UnlinkUserAccountFromNiptTest\n *\n * @param testId Test ID\n * @param barcode Known as kitId as well\n */\n public claimKit(testId: string, barcode: string): Observable {\n return this.http.put(`/api/nipt-online/${testId}/claim`, { barcode });\n }\n}\n","export enum LaboratoryName {\n BIO_LAB = 'biolab',\n ADRIA_LAB = 'adrialab',\n}\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n OnInit,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';\nimport { AnalyticsModule } from '@geneplanet/ngx-utils/src/lib/analytics';\nimport { QuestionnaireHostComponent } from '../questionnaire-host/questionnaire-host.component';\nimport { GpuFormFieldAppearance } from '@geneplanet/ngx-ui/src/lib/form-field';\nimport { AnalysesService } from 'src/app/analyses/services/analyses.service';\nimport {\n AnalysesTypesLowercase,\n HabitsConfiguration,\n} from 'src/app/analyses/interfaces/analyses.types';\nimport { retry } from 'rxjs/operators';\nimport { Router } from '@angular/router';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\n\n@UntilDestroy()\n@Component({\n selector: 'app-add-modal',\n standalone: true,\n imports: [CommonModule, AnalyticsModule, QuestionnaireHostComponent],\n templateUrl: './add-modal.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AddModalComponent implements OnInit {\n public id: string;\n\n protected questionnaires: HabitsConfiguration[];\n protected GpuFormFieldAppearance = GpuFormFieldAppearance;\n\n constructor(\n public modal: NgbActiveModal,\n private router: Router,\n private cdRef: ChangeDetectorRef,\n private analysesService: AnalysesService\n ) {}\n\n ngOnInit() {\n this.analysesService\n .habitsConfiguration(this.id)\n .pipe(untilDestroyed(this))\n .subscribe((response) => {\n this.questionnaires = [response];\n this.cdRef.markForCheck();\n });\n }\n\n protected onCompleted(data: { id: string }): void {\n this.analysesService\n .getCalculationId(this.id, data.id, AnalysesTypesLowercase.Habits)\n .pipe(retry(5), untilDestroyed(this)) // It might happen, that BE doesn't have result available on first request, but if we retry it will surely be there\n .subscribe((result) => {\n this.router.navigate([\n '/habits/analyses',\n this.id,\n result.result.calculationId,\n ]);\n });\n }\n}\n","
\n \n \n \n
\n\n
\n \n \n
\n\n","import { Directive, ViewContainerRef } from '@angular/core';\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: '[questionnaireHost]',\n standalone: true,\n})\nexport class QuestionnaireHostDirective {\n constructor(public viewContainerRef: ViewContainerRef) {}\n}\n","import { inject } from \"@angular/core\";\nimport { ControlContainer } from \"@angular/forms\";\n\nexport const controlContainerProvider = {\n provide: ControlContainer,\n useFactory: () => inject(ControlContainer, { skipSelf: true }),\n};\n","\n \n {{ answer.name }}\n \n\n","import {\n ChangeDetectionStrategy,\n Component,\n OnDestroy,\n inject,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { AnswerBase } from '../../interfaces/answer-base.interface';\nimport { HabitsQuestion } from 'src/app/analyses/interfaces/analyses.types';\nimport {\n ControlContainer,\n FormControl,\n FormGroup,\n ReactiveFormsModule,\n Validators,\n} from '@angular/forms';\nimport { GpuRadioGroupModule } from '@geneplanet/ngx-ui/src/lib/radio-group';\nimport { GpuFormFieldAppearance } from '@geneplanet/ngx-ui/src/lib/form-field';\nimport { controlContainerProvider } from '../../constants/control-container-provider';\nimport { AnswerDict } from '../../interfaces/answer-dict.interface';\nimport { AnswerDto } from '../../interfaces/answer-dto.interface';\nimport { AnalyticsService } from '@geneplanet/ngx-utils/src/lib/analytics';\n\n@Component({\n selector: 'app-simple-options',\n standalone: true,\n imports: [CommonModule, ReactiveFormsModule, GpuRadioGroupModule],\n templateUrl: './simple-options.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n viewProviders: [controlContainerProvider],\n})\nexport class SimpleOptionsComponent implements AnswerBase, OnDestroy {\n public questionnaireId: string;\n public question: HabitsQuestion;\n public formFieldAppearance: GpuFormFieldAppearance;\n public answer: AnswerDto;\n\n private parentContainer = inject(ControlContainer);\n private analyticsService = inject(AnalyticsService);\n\n get form() {\n return this.parentContainer.control as FormGroup;\n }\n\n public init(): void {\n this.form.addControl(\n 'value',\n new FormControl(this.answer?.id ?? '', Validators.required)\n );\n }\n\n public onSubmit(): AnswerDict {\n return {\n [this.question.id]: [{ id: this.form.controls.value.value }],\n };\n }\n\n ngOnDestroy(): void {\n this.form.removeControl('value');\n }\n\n protected track(): void {\n this.analyticsService.trackFormValue(\n 'analyses-add',\n 'value',\n {\n id: this.form.controls.value.value,\n },\n this.questionnaireId,\n this.question.id\n );\n }\n}\n","\n {{ question.answers[0].name }}\n \n \n {{ 'ANALYSES.VALUE_REQUIRED' | translate }}\n \n \n {{ 'ANALYSES.SINGLE.MAX_REFERENCE_VALUE' | translate }}\n \n \n {{ 'ANALYSES.VALUE_INVALID' | translate }}\n \n\n","import {\n ChangeDetectionStrategy,\n Component,\n OnDestroy,\n inject,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport {\n ControlContainer,\n FormGroup,\n FormControl,\n Validators,\n ReactiveFormsModule,\n} from '@angular/forms';\nimport {\n GpuFormFieldAppearance,\n GpuFormFieldModule,\n} from '@geneplanet/ngx-ui/src/lib/form-field';\nimport { HabitsQuestion } from 'src/app/analyses/interfaces/analyses.types';\nimport { AnswerDict } from '../../interfaces/answer-dict.interface';\nimport { AnswerBase } from '../../interfaces/answer-base.interface';\nimport { ScrollOnFocusDirective } from 'src/app/shared/directives/scroll-on-focus.directive';\nimport { controlContainerProvider } from '../../constants/control-container-provider';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { AnswerDto } from '../../interfaces/answer-dto.interface';\nimport { AnalyticsService } from '@geneplanet/ngx-utils/src/lib/analytics';\n\n@Component({\n selector: 'app-number-input',\n standalone: true,\n imports: [\n CommonModule,\n GpuFormFieldModule,\n ScrollOnFocusDirective,\n ReactiveFormsModule,\n TranslateModule,\n ],\n templateUrl: './number-input.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n viewProviders: [controlContainerProvider],\n})\nexport class NumberInputComponent implements AnswerBase, OnDestroy {\n public questionnaireId: string;\n public question: HabitsQuestion;\n public formFieldAppearance: GpuFormFieldAppearance;\n public answer: AnswerDto;\n\n private parentContainer = inject(ControlContainer);\n private analyticsService = inject(AnalyticsService);\n\n get form() {\n return this.parentContainer.control as FormGroup;\n }\n\n public init(): void {\n const { min, max, decimalPlaces } = this.question.answers[0];\n const pattern = new RegExp(\n `^\\\\d+${decimalPlaces > 0 ? `\\\\.?\\\\d{0,${decimalPlaces}}` : ''}$`\n );\n\n this.form.addControl(\n 'value',\n new FormControl(this.answer?.value ?? '', [\n Validators.required,\n Validators.min(min),\n Validators.max(max),\n Validators.pattern(pattern),\n ])\n );\n }\n\n public onSubmit(): AnswerDict {\n return {\n [this.question.id]: [\n {\n id: this.question.answers[0].id,\n value: this.form.controls.value.value,\n },\n ],\n };\n }\n\n ngOnDestroy(): void {\n this.form.removeControl('value');\n }\n\n protected track(): void {\n this.analyticsService.trackFormValue(\n 'analyses-add',\n 'value',\n {\n id: this.question.answers[0].id,\n value: this.form.controls.value.value,\n },\n this.questionnaireId,\n this.question.id\n );\n }\n}\n","\n \n {{ split(answer?.name, 0) }}\n \n \n \n \n {{ split(answer?.name, 1) }}\n \n \n\n","import {\n ChangeDetectionStrategy,\n Component,\n OnDestroy,\n inject,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport {\n GpuFormFieldAppearance,\n GpuFormFieldModule,\n} from '@geneplanet/ngx-ui/src/lib/form-field';\nimport {\n ControlContainer,\n FormControl,\n FormGroup,\n ReactiveFormsModule,\n Validators,\n} from '@angular/forms';\nimport { HabitsQuestion } from 'src/app/analyses/interfaces/analyses.types';\nimport { controlContainerProvider } from '../../constants/control-container-provider';\nimport { GpuRadioGroupModule } from '@geneplanet/ngx-ui/src/lib/radio-group';\nimport { AnswerDict } from '../../interfaces/answer-dict.interface';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport { AnswerDto } from '../../interfaces/answer-dto.interface';\nimport { AnalyticsService } from '@geneplanet/ngx-utils/src/lib/analytics';\n\n@UntilDestroy()\n@Component({\n selector: 'app-input-options',\n standalone: true,\n imports: [\n CommonModule,\n ReactiveFormsModule,\n GpuRadioGroupModule,\n GpuFormFieldModule,\n ],\n templateUrl: './input-options.component.html',\n styleUrls: ['./input-options.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n viewProviders: [controlContainerProvider],\n})\nexport class InputOptionsComponent implements OnDestroy {\n public questionnaireId: string;\n public question: HabitsQuestion;\n public formFieldAppearance: GpuFormFieldAppearance;\n public answer: AnswerDto;\n\n private parentContainer = inject(ControlContainer);\n private analyticsService = inject(AnalyticsService);\n\n get form() {\n return this.parentContainer.control as FormGroup;\n }\n\n public init(): void {\n this.form.addControl(\n 'select',\n new FormControl(this.answer?.id ?? '', Validators.required)\n );\n this.form.addControl('input', new FormControl(this.answer?.value ?? ''));\n\n if (this.answer?.id) {\n this.handleValidators(this.answer?.id);\n }\n\n this.form\n .get('select')\n .valueChanges.pipe(untilDestroyed(this))\n .subscribe((value) => {\n this.handleValidators(value);\n });\n }\n\n public onSubmit(): AnswerDict {\n const answer = { id: this.form.controls.select.value };\n if (this.selectedInput(this.form.controls.select.value)) {\n answer['value'] = this.form.controls.input.value;\n }\n\n return {\n [this.question.id]: [answer],\n };\n }\n\n ngOnDestroy(): void {\n this.form.removeControl('select');\n this.form.removeControl('input');\n }\n\n protected split(name: string, index: number): string {\n return name.split('x')[index];\n }\n\n protected track(isInput = false): void {\n const data = {\n id: this.form.controls.select.value,\n };\n if (isInput) {\n data['value'] = this.form.controls.input.value;\n }\n\n this.analyticsService.trackFormValue(\n 'analyses-add',\n 'value',\n data,\n this.questionnaireId,\n this.question.id\n );\n }\n\n private handleValidators(value: string) {\n const input = this.form.get('input');\n\n if (value && this.selectedInput(value)) {\n const inputAnswer = this.question.answers.find(\n (answer) => answer.type === 'Input'\n );\n\n const { min, max, decimalPlaces } = inputAnswer;\n const pattern = new RegExp(\n `^\\\\d+${decimalPlaces > 0 ? `\\\\.?\\\\d{0,${decimalPlaces}}` : ''}$`\n );\n\n input.addValidators([\n Validators.required,\n Validators.min(min),\n Validators.max(max),\n Validators.pattern(pattern),\n ]);\n } else {\n input.clearValidators();\n }\n input.updateValueAndValidity();\n }\n\n private selectedInput(value: string): boolean {\n return this.question.answers.find((a) => a.id === value).type === 'Input';\n }\n}\n","\n\n\n {{ 'MIN_VALUE' | translate }}\n\n","import {\n ChangeDetectionStrategy,\n Component,\n OnDestroy,\n inject,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport {\n ControlContainer,\n FormGroup,\n FormControl,\n Validators,\n ReactiveFormsModule,\n} from '@angular/forms';\nimport { GpuFormFieldAppearance } from '@geneplanet/ngx-ui/src/lib/form-field';\nimport { HabitsQuestion } from 'src/app/analyses/interfaces/analyses.types';\nimport { AnswerDict } from '../../interfaces/answer-dict.interface';\nimport { controlContainerProvider } from '../../constants/control-container-provider';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { AnswerBase } from '../../interfaces/answer-base.interface';\nimport { SliderComponent } from 'src/app/shared/components/slider/slider.component';\nimport { AnswerDto } from '../../interfaces/answer-dto.interface';\nimport { AnalyticsService } from '@geneplanet/ngx-utils/src/lib/analytics';\n\n@Component({\n selector: 'app-number-slider',\n standalone: true,\n imports: [\n CommonModule,\n ReactiveFormsModule,\n TranslateModule,\n SliderComponent,\n ],\n templateUrl: './number-slider.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n viewProviders: [controlContainerProvider],\n})\nexport class NumberSliderComponent implements AnswerBase, OnDestroy {\n public questionnaireId: string;\n public question: HabitsQuestion;\n public formFieldAppearance: GpuFormFieldAppearance;\n public answer: AnswerDto;\n\n private parentContainer = inject(ControlContainer);\n private analyticsService = inject(AnalyticsService);\n\n get form() {\n return this.parentContainer.control as FormGroup;\n }\n\n public init(): void {\n this.form.addControl(\n 'value',\n new FormControl(this.answer?.value ?? 0, [\n Validators.required,\n Validators.min(1),\n ])\n );\n }\n\n public onSubmit(): AnswerDict {\n return {\n [this.question.id]: [\n {\n id: this.question.answers[0].id,\n value: this.form.controls.value.value,\n },\n ],\n };\n }\n\n ngOnDestroy(): void {\n this.form.removeControl('value');\n }\n\n protected track(): void {\n this.analyticsService.trackFormValue(\n 'analyses-add',\n 'value',\n {\n id: this.question.answers[0].id,\n value: String(this.form.controls.value.value),\n },\n this.questionnaireId,\n this.question.id\n );\n }\n}\n","
\n
\n \n {{ question.answers[0].name }}\n \n \n {{ option.label }}\n \n \n \n
\n\n \n :\n \n\n
\n \n \n {{ 'RESULTS.HABITS.QUESTIONNAIRE.MINUTES' | translate }}\n \n \n \n {{ option.label }}\n \n \n \n
\n
\n\n\n {{ 'ANALYSES.VALUE_REQUIRED' | translate }}\n\n","import {\n ChangeDetectionStrategy,\n Component,\n OnDestroy,\n inject,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport {\n ControlContainer,\n FormGroup,\n FormControl,\n Validators,\n ReactiveFormsModule,\n} from '@angular/forms';\nimport { GpuFormFieldAppearance, GpuFormFieldModule } from '@geneplanet/ngx-ui/src/lib/form-field';\nimport { HabitsQuestion } from 'src/app/analyses/interfaces/analyses.types';\nimport { AnswerBase } from '../../interfaces/answer-base.interface';\nimport { AnswerDict } from '../../interfaces/answer-dict.interface';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { controlContainerProvider } from '../../constants/control-container-provider';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport { removeFormControlError } from 'src/app/shared/util/util';\nimport { AnswerDto } from '../../interfaces/answer-dto.interface';\nimport { AnalyticsService } from '@geneplanet/ngx-utils/src/lib/analytics';\n\n@UntilDestroy()\n@Component({\n selector: 'app-time-dropdown',\n standalone: true,\n imports: [\n CommonModule,\n GpuFormFieldModule,\n ReactiveFormsModule,\n TranslateModule,\n ],\n templateUrl: './time-dropdown.component.html',\n styleUrls: ['./time-dropdown.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n viewProviders: [controlContainerProvider],\n})\nexport class TimeDropdownComponent implements AnswerBase, OnDestroy {\n public question: HabitsQuestion;\n public formFieldAppearance: GpuFormFieldAppearance;\n public answer: AnswerDto;\n\n protected sleepingHours = Array.from({ length: 25 }, (_, index) => ({\n label: String(index).padStart(2, '0'),\n value: index,\n }));\n\n protected sleepingMinutes = [\n { label: '00', value: 0 },\n { label: '30', value: 0.5 },\n ];\n\n private parentContainer = inject(ControlContainer);\n private analyticsService = inject(AnalyticsService);\n\n get form() {\n return this.parentContainer.control as FormGroup;\n }\n\n public init(): void {\n this.form.addControl('hours', new FormControl('', Validators.required));\n this.form.addControl('minutes', new FormControl('', Validators.required));\n\n this.form.valueChanges.pipe(untilDestroyed(this)).subscribe((value) => {\n const { hours, minutes } = value;\n if (hours === 24 && minutes === 0.5) {\n this.form.get('hours').setErrors({ invalidTime: true });\n } else {\n removeFormControlError(this.form.get('hours'), 'invalidTime');\n }\n });\n }\n\n public onSubmit(): AnswerDict {\n const { hours, minutes } = this.form.getRawValue();\n return {\n [this.question.id]: [\n { id: this.question.answers[0].id, value: hours + minutes },\n ],\n };\n }\n\n ngOnDestroy(): void {\n this.form.removeControl('hours');\n this.form.removeControl('minutes');\n }\n\n protected track(name: string, value: number): void {\n this.analyticsService.trackFormValue(\n 'analyses-add',\n name,\n {\n id: this.question.answers[0].id,\n value: value === 0.5 ? '30' : String(value),\n },\n '1bb8d5e8-e149-43c3-a659-83f75c82ba62',\n this.question.id\n );\n }\n}\n","\n {{ button.text | translate }}\n\n","import {\n ChangeDetectionStrategy,\n Component,\n Input,\n inject,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { HabitsQuestion } from 'src/app/analyses/interfaces/analyses.types';\nimport { NgbModal } from '@ng-bootstrap/ng-bootstrap';\nimport { AnalysesIdResultsMetricsServingsComponent } from 'src/app/analyses/modals/servings/servings.component';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { AnalyticsModule } from '@geneplanet/ngx-utils/src/lib/analytics';\n\nenum QuestionButton {\n VEGETABLES = '8d6d4edb-3c2c-4cba-95dc-c83bc043a6c1',\n MEAT = '92f1f5f7-0d20-4ab1-b757-045027f2dd3b'\n}\n\n@Component({\n selector: 'app-examples-modal-buttons',\n standalone: true,\n imports: [CommonModule, TranslateModule, AnalyticsModule],\n templateUrl: './examples-modal-buttons.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ExamplesModalButtonsComponent {\n @Input({ required: true }) question: HabitsQuestion;\n\n protected get button() {\n return [\n {\n questionId: QuestionButton.VEGETABLES,\n dataTrack: 'analyses-view-one-serving',\n text: 'ANALYSES.SINGLE.VIEW_ONE_SERVING',\n type: 'vegetables',\n },\n {\n questionId: QuestionButton.MEAT,\n dataTrack: 'analyses-view-example',\n text: 'ANALYSES.SINGLE.VIEW_EXAMPLE',\n type: 'meat',\n },\n ].find((b) => b.questionId === this.question.id);\n }\n\n private modals = inject(NgbModal);\n\n protected openModal(type: string): void {\n const ref = this.modals.open(AnalysesIdResultsMetricsServingsComponent, {\n backdrop: 'static',\n keyboard: false,\n windowClass: 'basic-modal',\n backdropClass: 'basic-modal-backdrop',\n });\n ref.componentInstance.type = type;\n }\n}\n","\n {{ question.name }}\n

\n\n

\n {{ question.hint }}\n

\n\n\n\n
\n \n
\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ComponentRef,\n ViewChild,\n} from '@angular/core';\nimport { QuestionnaireBase } from '../../interfaces/questionnaire-base.interface';\nimport {\n HabitsConfiguration,\n HabitsQuestion,\n} from 'src/app/analyses/interfaces/analyses.types';\nimport { CommonModule } from '@angular/common';\nimport { GpuFormFieldAppearance } from '@geneplanet/ngx-ui/src/lib/form-field';\nimport { SimpleOptionsComponent } from '../../answers/simple-options/simple-options.component';\nimport { QuestionnaireHostDirective } from '../../directives/questionnaire-host.directive';\nimport { AnswerBase } from '../../interfaces/answer-base.interface';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { NumberInputComponent } from '../../answers/number-input/number-input.component';\nimport { InputOptionsComponent } from '../../answers/input-options/input-options.component';\nimport { NumberSliderComponent } from '../../answers/number-slider/number-slider.component';\nimport { TimeDropdownComponent } from '../../answers/time-dropdown/time-dropdown.component';\nimport { AnswerDict } from '../../interfaces/answer-dict.interface';\nimport { ExamplesModalButtonsComponent } from '../examples-modal-buttons/examples-modal-buttons.component';\n\n/**\n * Simple questionnaire is designed to display one question only.\n */\n@Component({\n selector: 'app-simple-questionnaire',\n templateUrl: './simple-questionnaire.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n CommonModule,\n QuestionnaireHostDirective,\n TranslateModule,\n ExamplesModalButtonsComponent,\n ],\n standalone: true,\n})\nexport class SimpleQuestionnaireComponent implements QuestionnaireBase {\n @ViewChild(QuestionnaireHostDirective, { static: true })\n questionnaireHost!: QuestionnaireHostDirective;\n\n public questionnaire: HabitsConfiguration;\n public formFieldAppearance: GpuFormFieldAppearance;\n public answers: AnswerDict;\n public smallTitle: boolean;\n\n private componentRef: ComponentRef;\n\n protected get question(): HabitsQuestion {\n // Simple questionnaire only accepts one question\n return this.questionnaire.questions[0];\n }\n\n constructor(private cdRef: ChangeDetectorRef) {}\n\n public init() {\n this.loadComponent();\n }\n\n public onSubmit() {\n return this.componentRef.instance.onSubmit();\n }\n\n private loadComponent() {\n const component = this.selectComponent();\n\n const viewContainerRef = this.questionnaireHost.viewContainerRef;\n viewContainerRef.clear();\n\n this.componentRef = viewContainerRef.createComponent(component);\n this.componentRef.instance.question = this.question;\n this.componentRef.instance.formFieldAppearance = this.formFieldAppearance;\n this.componentRef.instance.answer = this.answers[this.question.id]?.[0];\n this.componentRef.instance.questionnaireId = this.questionnaire.id;\n\n // Init is optional\n if (this.componentRef.instance.init) {\n this.componentRef.instance.init();\n }\n\n this.cdRef.markForCheck();\n }\n\n private selectComponent() {\n enum Question {\n FRUITS = '5dcbc671-ee1f-4ac7-b0d2-6d5769d6395a',\n NUTS = 'e6d06d90-955c-403e-ac95-e3a16d13e3ca',\n GRAIN = 'f8bf8c39-21eb-4d83-9eab-39eb694bb478',\n MEAT = '559cbd1f-ad6d-452f-8094-7fe4b28ffc5b',\n SITTING = '217ce35c-164f-4e69-a612-70278eee419b',\n SMOKING = 'e652d53f-4a19-4ab2-a6da-3028862816ba',\n ALCOHOL = '667bf34d-0494-4fac-b06d-c7dbfdf3e3ae',\n BINGE_DRINKING = '7e90f5d1-18d0-41a0-986d-9c3e60ba727a',\n STRESS = '335aace7-c714-4049-b083-fe6b93fa3fe1',\n SLEEP = '1bb8d5e8-e149-43c3-a659-83f75c82ba62',\n }\n return (\n {\n [Question.FRUITS]: SimpleOptionsComponent,\n [Question.NUTS]: SimpleOptionsComponent,\n [Question.GRAIN]: SimpleOptionsComponent,\n [Question.MEAT]: SimpleOptionsComponent,\n [Question.SITTING]: NumberInputComponent,\n [Question.SMOKING]: InputOptionsComponent,\n [Question.ALCOHOL]: NumberInputComponent,\n [Question.BINGE_DRINKING]: SimpleOptionsComponent,\n [Question.STRESS]: NumberSliderComponent,\n [Question.SLEEP]: TimeDropdownComponent,\n }[this.questionnaire.id] ?? null\n );\n }\n}\n","\n \n {{ question.name }}\n

\n\n 1\">\n \n
\n \n \n \n\n\n\n
\n \n\n \n {{ 'MIN_VALUE' | translate }}\n \n
\n
\n\n\n \n \n {{ answer.name }}\n \n \n\n","import {\n ChangeDetectionStrategy,\n Component,\n OnDestroy,\n inject,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { QuestionnaireBase } from '../../interfaces/questionnaire-base.interface';\nimport { GpuFormFieldAppearance } from '@geneplanet/ngx-ui/src/lib/form-field';\nimport {\n HabitsConfiguration,\n HabitsQuestion,\n} from 'src/app/analyses/interfaces/analyses.types';\nimport {\n ControlContainer,\n FormControl,\n Validators,\n ReactiveFormsModule,\n FormRecord,\n} from '@angular/forms';\nimport { controlContainerProvider } from '../../constants/control-container-provider';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport { SliderComponent } from 'src/app/shared/components/slider/slider.component';\nimport { startWith } from 'rxjs/operators';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { AnswerDict } from '../../interfaces/answer-dict.interface';\nimport { AnalyticsService } from '@geneplanet/ngx-utils/src/lib/analytics';\nimport { AnswerDto } from '../../interfaces/answer-dto.interface';\nimport { GpuRadioGroupModule } from '@geneplanet/ngx-ui/src/lib/radio-group';\n\n@UntilDestroy()\n@Component({\n selector: 'app-physical-questionnaire',\n standalone: true,\n imports: [\n CommonModule,\n GpuRadioGroupModule,\n ReactiveFormsModule,\n SliderComponent,\n TranslateModule,\n ],\n templateUrl: './physical-questionnaire.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n viewProviders: [controlContainerProvider],\n})\nexport class PhysicalQuestionnaireComponent\n implements QuestionnaireBase, OnDestroy\n{\n public questionnaire: HabitsConfiguration;\n public formFieldAppearance: GpuFormFieldAppearance;\n public answers: AnswerDict;\n public smallTitle: boolean;\n\n private parentContainer = inject(ControlContainer);\n private analyticsService = inject(AnalyticsService);\n\n get form() {\n return this.parentContainer.control as FormRecord;\n }\n\n ngOnDestroy() {\n this.questionnaire.questions.forEach((question) => {\n this.form.removeControl(question.id);\n });\n }\n\n public init(): void {\n this.questionnaire.questions.forEach((question) => {\n const value = this.getInitialValue(question);\n\n this.form.addControl(\n question.id,\n new FormControl(value, [Validators.required, Validators.min(0)])\n );\n });\n\n const questions = this.questionnaire.questions;\n this.toggleRelated(questions[0].id, questions[1].id);\n this.toggleRelated(questions[2].id, questions[3].id);\n }\n\n public onSubmit(): AnswerDict {\n return Object.entries(this.form.getRawValue()).reduce(\n (prev, [key, value]) => {\n if (key === 'date') {\n return prev;\n }\n\n let answer = {};\n if (isNaN(value)) {\n // For Options selected value is answer ID\n answer = { id: value };\n } else {\n // For Slider selected value is value\n const question = this.questionnaire.questions.find(\n (q) => q.id === key\n );\n answer = { id: question.answers[0].id, value };\n }\n\n return {\n ...prev,\n [key]: [answer],\n };\n },\n {}\n );\n }\n\n protected track(questionId: string, answerId?: string): void {\n let data = {\n id: this.form.get(questionId).value,\n } as AnswerDto;\n if (answerId) {\n data = {\n id: answerId,\n value: String(this.form.get(questionId).value),\n };\n }\n\n this.analyticsService.trackFormValue(\n 'analyses-add',\n 'value',\n data,\n this.questionnaire.id,\n questionId\n );\n }\n\n private toggleRelated(sliderId: string, optionsId: string) {\n this.form\n .get(sliderId)\n .valueChanges.pipe(\n startWith(this.form.get(sliderId).value),\n untilDestroyed(this)\n )\n .subscribe((value) => {\n const control = this.form.get(optionsId);\n if (value <= 0 && !control.disabled) {\n control.disable();\n } else if (value > 0 && control.disabled) {\n control.enable();\n }\n });\n }\n\n private getInitialValue(question: HabitsQuestion): string | number {\n if (Object.keys(this.answers).length) {\n const answer = this.answers[question.id][0];\n\n if (Object.hasOwn(answer, 'value')) {\n return answer.value;\n }\n\n return answer.id;\n }\n return question.answers.length > 1 ? question.answers[0].id : -1;\n }\n}\n","\n \n {{ 'ANALYSES.ADD.DATE' | translate }}\n \n \n \n \n {{ 'ANALYSES.ADD.REQUIRED' | translate }}\n \n\n","import {\n ChangeDetectionStrategy,\n Component,\n Input,\n OnDestroy,\n OnInit,\n inject,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport {\n ControlContainer,\n FormControl,\n FormGroup,\n ReactiveFormsModule,\n Validators,\n} from '@angular/forms';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { controlContainerProvider } from '../../constants/control-container-provider';\nimport {\n GpuFormFieldAppearance,\n GpuFormFieldModule,\n} from '@geneplanet/ngx-ui/src/lib/form-field';\nimport {\n ngbDateFromDate,\n ngbDateToISO,\n subtractCurrentDateYear,\n} from 'src/app/shared/util/date-util';\nimport { NgbDatepickerModule } from '@ng-bootstrap/ng-bootstrap';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport { AnalyticsService } from '@geneplanet/ngx-utils/src/lib/analytics';\nimport { filter } from 'rxjs/operators';\n\n@UntilDestroy()\n@Component({\n selector: 'app-questionnaire-date',\n standalone: true,\n imports: [\n CommonModule,\n ReactiveFormsModule,\n TranslateModule,\n GpuFormFieldModule,\n NgbDatepickerModule,\n ],\n templateUrl: './questionnaire-date.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n viewProviders: [controlContainerProvider],\n})\nexport class QuestionnaireDateComponent implements OnInit, OnDestroy {\n @Input({ required: true }) formFieldAppearance: GpuFormFieldAppearance;\n @Input({ required: true }) questionnaireId: string;\n\n protected now = ngbDateFromDate(new Date());\n protected minDate = ngbDateFromDate(subtractCurrentDateYear(10));\n\n private parentContainer = inject(ControlContainer);\n private analyticsService = inject(AnalyticsService);\n\n get form() {\n return this.parentContainer.control as FormGroup;\n }\n\n ngOnInit(): void {\n this.form.addControl(\n 'date',\n new FormControl(this.now, Validators.required)\n );\n this.trackDate();\n }\n\n ngOnDestroy(): void {\n this.form.removeControl('date');\n }\n\n private trackDate() {\n const control = this.form.controls.date;\n control.valueChanges\n .pipe(filter(Boolean), untilDestroyed(this))\n .subscribe(() => {\n this.analyticsService.trackFormValue(\n 'analyses-add',\n 'date',\n {\n value: ngbDateToISO(this.form.controls.date.value),\n },\n this.questionnaireId\n );\n });\n }\n}\n","\n \n {{ questionnaireIndex() + 1 }} / {{ questionnaires?.length }}\n

\n\n \n\n \n\n \n\n\n\n
\n\n \n
\n 0\"\n type=\"button\"\n class=\"text-primary bg-transparent gp-12 border-0 gmr-24 gmr-sm-12\"\n gptDataTrack=\"questionnaire-previous\"\n (click)=\"previous()\"\n >\n \n \n\n \n {{\n (isSingleResult ? 'ANALYSES.ADD_RESULT' : 'ANALYSES.NEXT') | translate\n }}\n \n
\n \n
\n\n\n
\n {{ 'ERROR' | translate }}\n {{ 'FAILURE.GENERAL_ERROR.CONTENT' | translate }}\n
\n
\n\n\n \n \n \n\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ComponentRef,\n EventEmitter,\n Input,\n OnChanges,\n Output,\n ViewChild,\n signal,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { QuestionnaireBase } from '../../interfaces/questionnaire-base.interface';\nimport { QuestionnaireHostDirective } from '../../directives/questionnaire-host.directive';\nimport { SimpleQuestionnaireComponent } from '../simple-questionnaire/simple-questionnaire.component';\nimport {\n HabitsConfiguration,\n QuestionnaireCreate,\n} from 'src/app/analyses/interfaces/analyses.types';\nimport {\n GpuFormFieldAppearance,\n GpuFormFieldModule,\n} from '@geneplanet/ngx-ui/src/lib/form-field';\nimport {\n FormBuilder,\n FormGroupDirective,\n ReactiveFormsModule,\n} from '@angular/forms';\nimport { PhysicalQuestionnaireComponent } from '../physical-questionnaire/physical-questionnaire.component';\nimport { AnswerDict } from '../../interfaces/answer-dict.interface';\nimport { FormPageFooterComponent } from 'src/app/shared/components/form-page-footer/form-page-footer.component';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { QuestionnaireDateComponent } from '../questionnaire-date/questionnaire-date.component';\nimport { GpuLoadingModule } from '@geneplanet/ngx-ui/src/lib/loading';\nimport { AnalysesService } from 'src/app/analyses/services/analyses.service';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport { AnalyticsModule } from '@geneplanet/ngx-utils/src/lib/analytics';\n// eslint-disable-next-line @typescript-eslint/naming-convention\nimport * as Sentry from '@sentry/angular';\nimport { ngbDateToNativeUTCDateTime } from 'src/app/shared/util/date-util';\nimport { NgbDateStruct } from '@ng-bootstrap/ng-bootstrap';\n\nenum ComponentState {\n LOADING = 'loading',\n ERROR = 'error',\n FORM = 'form',\n}\n\n@UntilDestroy()\n@Component({\n selector: 'app-questionnaire-host',\n standalone: true,\n imports: [\n CommonModule,\n QuestionnaireHostDirective,\n ReactiveFormsModule,\n FormPageFooterComponent,\n TranslateModule,\n GpuFormFieldModule,\n QuestionnaireDateComponent,\n GpuLoadingModule,\n AnalyticsModule,\n ],\n templateUrl: './questionnaire-host.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class QuestionnaireHostComponent implements OnChanges {\n @ViewChild(QuestionnaireHostDirective, { static: true })\n questionnaireHost!: QuestionnaireHostDirective;\n\n @Input({ required: true }) questionnaires: HabitsConfiguration[];\n @Input() formFieldAppearance = GpuFormFieldAppearance.Card;\n @Input() smallTitle = false;\n @Output() completed = new EventEmitter<{ id: string }>();\n\n protected state = ComponentState.LOADING;\n protected GpuFormFieldAppearance = GpuFormFieldAppearance;\n\n protected questionnaireIndex = signal(0);\n protected form = this.fb.nonNullable.record({});\n\n protected get isSingleResult(): boolean {\n return this.questionnaires?.length === 1;\n }\n\n private answers = signal({});\n\n private componentRef: ComponentRef;\n\n constructor(\n private fb: FormBuilder,\n private cdRef: ChangeDetectorRef,\n private analysesService: AnalysesService\n ) {}\n\n ngOnChanges() {\n if (this.questionnaires && !this.componentRef) {\n this.init();\n }\n }\n\n protected previous() {\n if (this.questionnaireIndex() > 0) {\n this.questionnaireIndex.update((current) => current - 1);\n this.loadComponent();\n }\n }\n\n protected submit(ngForm: FormGroupDirective) {\n if (this.form.invalid) {\n return;\n }\n\n const value = this.componentRef.instance.onSubmit();\n this.answers.update((current) => ({\n ...current,\n ...value,\n }));\n\n const date = this.form.controls.date?.value || undefined;\n\n // Destroying inner component, to prevent any events emitting when resetForm() is called.\n this.questionnaireHost.viewContainerRef.clear();\n\n // This is required to reset `submitted` on NgForm - otherwise errors can show\n // on untouched forms\n ngForm.resetForm();\n\n if (this.questionnaireIndex() + 1 < this.questionnaires.length) {\n this.questionnaireIndex.update((current) => current + 1);\n this.loadComponent();\n } else {\n this.submitAnswers(date as NgbDateStruct);\n }\n }\n\n private init() {\n if (!this.questionnaires?.length) {\n return;\n }\n\n this.loadComponent();\n }\n\n private loadComponent() {\n const componentSelector =\n this.questionnaires?.[this.questionnaireIndex()]?.id;\n if (!componentSelector) {\n return;\n }\n\n const component = this.selectComponent(componentSelector);\n this.state = ComponentState.FORM;\n\n const viewContainerRef = this.questionnaireHost.viewContainerRef;\n viewContainerRef.clear();\n\n this.componentRef =\n viewContainerRef.createComponent(component);\n this.componentRef.instance.questionnaire =\n this.questionnaires[this.questionnaireIndex()];\n this.componentRef.instance.formFieldAppearance = this.formFieldAppearance;\n this.componentRef.instance.answers = this.questionnaireAnswers();\n this.componentRef.instance.smallTitle = this.smallTitle;\n\n // Init is optional\n if (this.componentRef.instance.init) {\n this.componentRef.instance.init();\n }\n\n this.cdRef.markForCheck();\n }\n\n private selectComponent(analysisId: string) {\n return (\n {\n ['85c0adce-e9ad-4e90-b327-7cb55410f975']:\n PhysicalQuestionnaireComponent,\n }[analysisId] ?? SimpleQuestionnaireComponent\n );\n }\n\n private questionnaireAnswers(): AnswerDict {\n const questionnaire = this.questionnaires[this.questionnaireIndex()];\n const ids = questionnaire.questions.map((q) => q.id);\n return Object.fromEntries(\n Object.entries(this.answers()).filter(([id]) => ids.includes(id))\n );\n }\n\n private submitAnswers(date: null | NgbDateStruct): void {\n const answerList = Object.entries(this.answers()).map(([key, value]) => {\n return {\n id: key,\n answers: value,\n };\n });\n\n const payload: QuestionnaireCreate = {\n questions: answerList,\n };\n\n if (this.isSingleResult) {\n payload.generated = ngbDateToNativeUTCDateTime(date).toISOString();\n }\n\n this.state = ComponentState.LOADING;\n this.questionnaireHost.viewContainerRef.clear();\n this.cdRef.markForCheck();\n\n this.analysesService\n .saveQuestionnaire(payload)\n .pipe(untilDestroyed(this))\n .subscribe({\n next: (response) => {\n this.completed.emit(response);\n },\n error: (error) => {\n this.state = ComponentState.ERROR;\n this.cdRef.markForCheck();\n\n Sentry.withScope((scope) => {\n scope.setExtra('payload', payload);\n scope.setExtra('error', error);\n Sentry.captureException('[QUESTIONNAIRE SUBMIT] Submit error');\n });\n },\n });\n }\n}\n","import { Component } from '@angular/core';\nimport { NgbModal } from '@ng-bootstrap/ng-bootstrap';\n\n@Component({\n selector: 'app-add-data-list',\n templateUrl: './add-data-list.component.html',\n})\nexport class AddDataListComponent {\n constructor(private modals: NgbModal) {}\n\n navItemClick() {\n this.modals.dismissAll();\n }\n}\n","\n\n\n\n\n\n\n\n","
\n
\n
\n
\n
\n

\n {{ group.name | uppercase }}\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\n","import { Component, EventEmitter, Input, Output } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { tap } from 'rxjs/operators';\nimport {\n AnalysesTypesLowercase,\n BloodPanel,\n} from 'src/app/analyses/interfaces/analyses.types';\n\n@Component({\n selector: 'app-analyses-groups',\n templateUrl: './analyses-groups.component.html',\n styleUrls: ['./analyses-groups.component.scss'],\n})\nexport class AnalysesGroupsComponent {\n @Input() set groups$(bloodGroups$: Observable) {\n this.bloodGroups$ = bloodGroups$.pipe(\n tap((groups) => {\n this.isLoading = false;\n this.groupsLoaded.emit(groups);\n })\n );\n }\n @Input() panels;\n\n @Output() groupsLoaded = new EventEmitter();\n\n public bloodGroups$: Observable;\n public isLoading = true;\n public readonly AnalysesTypesLowercase = AnalysesTypesLowercase;\n}\n","\n
\n \n \n \n \n
\n\n
1\" class=\"d-flex justify-content-center mt-5\">\n \n \n \n {{ page }}\n \n \n \n
\n\n \n

\n {{ 'ANALYSES.NORECS' | translate }}\n

\n
\n
\n\n\n \n \n \n\n","import { Component, Input, OnChanges, OnInit } from '@angular/core';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport { BehaviorSubject, combineLatest, Observable, of } from 'rxjs';\nimport { tap } from 'rxjs/operators';\nimport {\n AnalysesTypes,\n AnalysisResponse,\n} from 'src/app/analyses/interfaces/analyses.types';\n\n@UntilDestroy()\n@Component({\n selector: 'app-analyses-list',\n templateUrl: './analyses-list.component.html',\n styleUrls: ['./analyses-list.component.scss'],\n})\nexport class AnalysesListComponent implements OnChanges, OnInit {\n @Input() analyses$: Observable;\n @Input() data: AnalysisResponse[];\n @Input() type: AnalysesTypes;\n @Input() showNoResult = true;\n @Input() size = 10;\n @Input() reportCard = false;\n @Input() reCheckLabel = false;\n\n // pagination variables\n public analysesPaginated: AnalysisResponse[];\n public pageChanged$ = new BehaviorSubject(null);\n public page = 1;\n public pageCount: number;\n public collectionSize: number;\n\n ngOnInit(): void {\n combineLatest([\n this.pageChanged$,\n this.analyses$?.pipe(\n tap((analyses) => this.setPaginationVariables(analyses.length))\n ),\n ])\n .pipe(untilDestroyed(this))\n .subscribe(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ([_, analyses]) =>\n (this.analysesPaginated = analyses.slice(\n (this.page - 1) * this.size,\n Math.min((this.page - 1) * this.size + this.size, analyses.length)\n ))\n );\n }\n\n ngOnChanges(): void {\n this.page = 1;\n if (this.data) {\n this.analyses$ = of(this.data);\n }\n }\n\n private setPaginationVariables(analysesCount: number): void {\n this.pageCount = Math.ceil(analysesCount / this.size);\n this.collectionSize = analysesCount;\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
\n\n \n \n\n","import { BreakpointObserver, BreakpointState } from '@angular/cdk/layout';\nimport {\n Component,\n HostListener,\n ChangeDetectorRef,\n HostBinding,\n Input,\n ContentChildren,\n QueryList,\n ViewChild,\n ElementRef,\n AfterViewInit,\n ChangeDetectionStrategy,\n OnInit,\n InjectionToken,\n OnDestroy,\n SkipSelf,\n Output,\n EventEmitter,\n} from '@angular/core';\nimport {\n GPU_MEDIA_QUERIES,\n GpuMediaQueryBreakpoints,\n} from '@geneplanet/ngx-ui/src/lib/layout';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport { merge } from 'rxjs';\nimport { map } from 'rxjs/operators';\nimport { LayoutService } from 'src/app/core/services/layout.service';\nimport { AnalysisHeaderTabComponent } from './components/tab/tab.component';\nimport { CommonModule } from '@angular/common';\n\nexport const ANALYSIS_HEADER = new InjectionToken(\n 'AnalysisHeader'\n);\n\n@UntilDestroy()\n@Component({\n selector: 'app-analysis-header',\n templateUrl: './analysis-header.component.html',\n styleUrls: ['./analysis-header.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{ provide: ANALYSIS_HEADER, useValue: AnalysisHeaderComponent }],\n imports: [CommonModule],\n standalone: true,\n})\nexport class AnalysisHeaderComponent\n implements OnInit, AfterViewInit, OnDestroy\n{\n @HostBinding('class') class = 'analysis-header';\n @HostBinding('style.top.px') top = this.layoutService.getHeaderHeight();\n @HostBinding('style.height.px') height: number;\n\n @Input() isFluidContainer = false;\n @Input() containerClass: string;\n @Input() hideBack = false;\n @Output() heightChanged = new EventEmitter();\n\n @ContentChildren(AnalysisHeaderTabComponent, { descendants: true })\n tabList: QueryList;\n @ViewChild('headerContainer') headerContainer: ElementRef;\n @ViewChild('titleContent') titleContent: ElementRef;\n @ViewChild('scrollRef', { static: true }) scrollRef: ElementRef;\n\n scrolled = false;\n isXlUp = false;\n observer: ResizeObserver;\n\n private activeTab: number;\n\n constructor(\n @SkipSelf() private parentCdr: ChangeDetectorRef, //this is needed because height change is too slow with normal cdr\n private cdr: ChangeDetectorRef,\n private layoutService: LayoutService,\n private breakpointObserver: BreakpointObserver\n ) {}\n\n @HostListener('window:scroll')\n windowScroll() {\n this.onScroll();\n }\n\n ngOnInit() {\n this.layoutService.headerHeightChange$\n .pipe(untilDestroyed(this))\n .subscribe((height: number) => (this.top = height));\n\n this.breakpointObserver\n .observe(GPU_MEDIA_QUERIES[GpuMediaQueryBreakpoints.XL_UP])\n .pipe(untilDestroyed(this))\n .subscribe((value: BreakpointState) => {\n this.isXlUp = value.matches;\n this.cdr.markForCheck();\n });\n }\n\n ngAfterViewInit() {\n this.heightObserver();\n this.activeTab = this.tabList.toArray().findIndex((t) => t.active);\n this.scrollTabs(this.activeTab);\n this.setTabSelectedListener();\n }\n\n ngOnDestroy(): void {\n if (this.observer) {\n this.observer.unobserve(this.headerContainer?.nativeElement);\n }\n }\n\n hasTabs() {\n return this.tabList?.length > 0;\n }\n\n updateHeight() {\n this.height = this.headerContainer?.nativeElement.offsetHeight;\n this.parentCdr.detectChanges();\n this.heightChanged.emit();\n }\n\n private heightObserver(): void {\n this.observer = new ResizeObserver((entries: ResizeObserverEntry[]) => {\n if (entries[0].contentRect.height !== this.height) {\n this.updateHeight();\n }\n });\n\n this.observer.observe(this.headerContainer?.nativeElement);\n }\n\n private setTabSelectedListener(): void {\n merge(...this.tabList.map((t, i) => t.selected.pipe(map(() => i))))\n .pipe(untilDestroyed(this))\n .subscribe((index: number) => {\n this.scrollTabs(index);\n this.activeTab = index;\n });\n }\n\n private scrollTabs(index: number): void {\n if (index === this.activeTab) {\n return;\n }\n\n const tabWidths = [\n ...this.scrollRef.nativeElement.children[0].children,\n ].map((x) => x.offsetWidth);\n\n const offset = tabWidths.reduce((a, b, i) => {\n return i < index - 1 ? a + b : a;\n }, 0);\n\n this.scrollRef.nativeElement.scrollTo({\n left: offset,\n behavior: 'smooth',\n });\n }\n\n private onScroll() {\n const mainContentHeight = document.getElementById('content').offsetHeight;\n const titleHeight = this.titleContent?.nativeElement?.offsetHeight;\n const canBeScrolled =\n this.scrolled ||\n mainContentHeight + this.layoutService.getHeaderHeight() >\n window.innerHeight + titleHeight;\n\n const previousValue = this.scrolled;\n this.scrolled = canBeScrolled && !!window.scrollY;\n\n if (previousValue != this.scrolled) {\n setTimeout(() => this.updateHeight());\n }\n }\n}\n","import { ChangeDetectionStrategy, Component, HostBinding } from '@angular/core';\n\n@Component({\n selector: 'app-analysis-header-button',\n templateUrl: './button.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true\n})\nexport class AnalysisHeaderButtonComponent {\n @HostBinding('class.gml-8') margin = true;\n}\n","\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n selector: 'app-analysis-header-subtitle',\n templateUrl: './subtitle.component.html',\n styleUrls: ['./subtitle.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AnalysisHeaderSubtitleComponent {}\n","\n","import {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n HostBinding,\n Input,\n OnInit,\n Output,\n} from '@angular/core';\nimport { ColorUtil } from 'src/app/shared/util/color-util';\n\n@Component({\n selector: 'app-analysis-header-tab',\n templateUrl: './tab.component.html',\n styleUrls: ['./tab.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AnalysisHeaderTabComponent implements OnInit {\n @Input() active: boolean;\n @Input() color: string;\n @Output() selected = new EventEmitter();\n\n @HostBinding('class.gmr-4') margin = true;\n\n get boxShadow() {\n return `0px 4px 10px ${this.shadow}`;\n }\n\n private shadow = 'rgba(78, 95, 124, 0.16)';\n\n ngOnInit() {\n if (this.color) {\n this.shadow = ColorUtil.hexToRGBA(this.color, 0.2);\n }\n }\n\n tabClicked() {\n this.selected.emit();\n }\n}\n","\n \n \n \n\n\n\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n selector: 'app-analysis-header-title',\n templateUrl: './title.component.html',\n styleUrls: ['./title.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n})\nexport class AnalysisHeaderTitleComponent {}\n","\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n selector: 'app-analysis-header-top-content',\n templateUrl: './top-content.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AnalysisHeaderTopContentComponent {}\n","\n","\n
\n
\n \n
\n \n \n \n {{ 'ANALYSES.NEW.LABEL' | translate }}\n \n
\n\n \n \n {{ analysis?.result?.generated | timeAgo }}\n \n \n {{ 'RESULTS.BLOOD.RE_CHECK.LABEL' | translate }}\n \n \n \n \n {{\n (type === AnalysesTypesLowercase.DNA\n ? 'ANALYSES.UNLOCK'\n : 'ANALYSES.MISSING_RESULT'\n ) | translate\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 {{ report?.generated | localDate }}\n

\n
\n
\n \n \n\n\n\n
\n
\n \n {{\n 'ORAL_MICROBIOME.ASSOCIATED.' +\n (microbiome.semanticType === SemanticTypes.UNFAVOURABLE\n ? 'RELEVANT_MICROBES'\n : 'NO_RELEVANT_MICROBES') | translate\n }}\n \n
\n\n
\n \n \n
\n\n\n\n \n
\n
\n
\n \n {{ analysis?.result }}\n \n\n \n {{ 'ANALYSES.NEW.LABEL' | translate }}\n \n
\n \n
\n \n
\n \n
\n","import {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n Input,\n OnInit,\n Output,\n} from '@angular/core';\nimport {\n BloodResult,\n AnalysesTypesLowercase,\n MeasurementResult,\n AnalysesTypes,\n} from 'src/app/analyses/interfaces/analyses.types';\nimport { Router } from '@angular/router';\nimport { AnalysisLink, MicrobiomeLink, ReportLink } from '../../shared.types';\nimport { resolveTypePath } from 'src/app/analyses/util/link-util';\nimport { AnalysisId } from 'src/app/analyses/interfaces/analysis-id.enum';\nimport { DecimalPlacesPipe } from '../../pipes';\nimport { SemanticType } from '../../constants/semantic-type';\n\n@Component({\n selector: 'app-analysis-link',\n templateUrl: './analysis-link.component.html',\n styleUrls: ['./analysis-link.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AnalysisLinkComponent implements OnInit {\n @Input() analysis: AnalysisLink; // Previously AnalysisLink\n @Input() microbiome: MicrobiomeLink;\n @Input() report: ReportLink;\n @Input() customClickEvent = false;\n @Input() hideCircles = false;\n @Input() type: AnalysesTypesLowercase;\n @Input() showNoResult = true;\n @Input() withLink = true;\n @Input() reCheckLabel = false;\n @Output() clicked = new EventEmitter();\n\n public hasResult = false;\n\n AnalysesTypes = AnalysesTypes;\n AnalysisId = AnalysisId;\n AnalysesTypesLowercase = AnalysesTypesLowercase;\n SemanticTypes = SemanticType;\n resultLabel = '';\n\n constructor(\n private readonly router: Router,\n private decimalPlacesPipe: DecimalPlacesPipe\n ) {}\n\n ngOnInit(): void {\n // Backend will sometimes return 'No result' when there isn't one,\n // and sometimes nothing at all.\n if (this.analysis) {\n this.hasResult =\n this.analysis?.result && this.analysis.result !== 'No result';\n this.resolveResultLabel(this.analysis);\n }\n }\n\n onClick() {\n if (this.customClickEvent) {\n this.clicked.emit();\n return;\n }\n\n if (this.report) {\n const type = resolveTypePath(this.report.type);\n if (type === AnalysesTypesLowercase.PRS) {\n return this.router.navigate([`/prs/results/${this.report.id}`]);\n } else if (type === AnalysesTypesLowercase.NIPT) {\n return this.router.navigate(['/nipt/results', this.report.id]);\n } else if (type === AnalysesTypesLowercase.Blood) {\n return this.router.navigate([`/blood/results/${this.report.id}`]);\n } else {\n if (this.report.type === AnalysesTypes.DNALifestyle) {\n return this.router.navigate(['/dna-snp/results', this.report.id]);\n }\n return this.router.navigate(['/dna/results', this.report.id]);\n }\n }\n\n if (this.hasResult) {\n const resolvedType = resolveTypePath(this.type);\n if (resolvedType === AnalysesTypesLowercase.PRS) {\n this.router.navigate([`/prs/analyses/`, this.analysis?.id]);\n } else if (resolvedType === AnalysesTypesLowercase.Habits) {\n // TODO: Verify this\n // Two different API calls will return id in two ways:\n // - On /habits we will get analysisId\n // - On /results/factor/1234 you will get id\n const id = this.analysis.id || this.analysis.analysisId;\n this.router.navigate([\n '/',\n resolvedType,\n 'analyses',\n id,\n this.analysis.calculationId,\n ]);\n } else if (resolvedType === AnalysesTypesLowercase.Ancestry) {\n this.router.navigate([\n this.router.url + '/' + this.analysis?.analysisId,\n ]);\n } else if (resolvedType === AnalysesTypesLowercase.PhysicalTraits) {\n this.router.navigate([\n 'ancestry/physical-traits/analyses/' + this.analysis?.analysisId,\n ]);\n } else {\n const resultId =\n this.analysis.resultId || // panel\n this.analysis.calculationId || // related analyses\n (this.analysis.result as BloodResult).id; // result view\n const analysisId =\n this.analysis.analysisId || // everywhere except blood panel\n this.analysis?.id; // blood panel\n const url = [\n '/',\n this.analysis.type === AnalysesTypes.DNA ? 'dna-snp' : resolvedType,\n 'analyses',\n analysisId,\n ];\n\n if (this.type !== AnalysesTypesLowercase.DNA) {\n url.push(resultId);\n }\n\n this.router.navigate(url);\n }\n } else if (this.analysis?.type === AnalysesTypesLowercase.DNA) {\n // TODO unlock\n } else {\n if (this.analysis.analysisId === AnalysisId.stepsId) {\n return this.router.navigate(['/habits/missing-steps']);\n }\n\n this.router.navigate([\n '/',\n this.type,\n 'analyses',\n this.analysis?.analysisId || this.analysis.id,\n 'result',\n 'add',\n ]);\n }\n }\n\n resolveResultLabel(analysis: AnalysisLink) {\n const { result, analysisId } = analysis;\n if (!result) {\n return;\n }\n\n if (typeof result === 'string') {\n // if habits\n this.resultLabel = result;\n } else if (Array.isArray(analysis?.result)) {\n // no decimal places for imperial unit system body weight & height\n if (\n (analysisId === AnalysisId.BodyHeight &&\n (result as MeasurementResult[]).length > 1) ||\n (analysisId === AnalysisId.BodyWeight && result[0].unitName === 'lbs')\n ) {\n (result as MeasurementResult[]).forEach((res) => {\n this.resultLabel += `${res.result} ${res.unitName} `;\n });\n }\n // if measurement (blood pressure and height in metric system returns two items in array)\n else if ((result as MeasurementResult[]).length > 1) {\n if (analysisId == AnalysisId.BloodPressure) {\n this.resultLabel = `\n ${result[0].result}/${result[1].result} ${result[0].unitName}`;\n }\n } else if (analysisId == AnalysisId.HeartRate) {\n this.resultLabel = `${result[0].result} ${result[0].unitName || ''}`;\n } else {\n this.resultLabel = `${this.decimalPlacesPipe.transform(\n result[0].result\n )} ${result[0].unitName || ''}`;\n }\n } else if (typeof result === 'object') {\n // if blood\n const bloodResult = result as BloodResult;\n this.resultLabel = `${this.decimalPlacesPipe.transform(\n bloodResult.value\n )} ${\n bloodResult.unit.isVisibleResult && bloodResult.unit.name\n ? bloodResult.unit.name\n : ''\n }`;\n }\n\n this.resultLabel = this.resultLabel\n ? this.resultLabel.replace('Proportion of 1.0', '') // R&D asked to hide this \"unit\", because it is not a real unit.\n : '';\n }\n\n displayReCheck(date: string) {\n const differenceInTime = new Date().getTime() - new Date(date).getTime();\n const differenceInDays = Math.floor(differenceInTime / (1000 * 3600 * 24));\n\n return differenceInDays > 330;\n }\n}\n","\n","import { ChangeDetectionStrategy, Component, Input } from '@angular/core';\nimport { KeyboardService } from '@geneplanet/ngx-shop/src/lib/shared';\nimport { BehaviorSubject } from 'rxjs';\n\n@Component({\n selector: 'app-bottom-offset',\n templateUrl: './bottom-offset.component.html',\n styleUrls: ['./bottom-offset.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BottomOffsetComponent {\n @Input() type: string;\n\n public keyboardActive$: BehaviorSubject;\n\n constructor(private readonly keyboardService: KeyboardService) {\n this.keyboardActive$ = this.keyboardService.keyboardActive$;\n }\n}\n","\n
\n \n \n {{ title | translate }}\n \n @if (isNew) {\n \n {{ 'RESULTS.MENU.TAG.NEW' | translate }}\n \n }\n @if (isNewAnalyses) {\n \n {{ 'ANALYSES.NEW.LABEL' | translate }}\n \n }\n
\n\n","import { Component, EventEmitter, Input, Output } from '@angular/core';\n\n@Component({\n selector: 'app-card-nav-item',\n templateUrl: './card-nav-item.component.html',\n styleUrls: ['./card-nav-item.component.scss'],\n})\nexport class CardNavItemComponent {\n @Input() url: string;\n @Input() fragment = '';\n @Input() title: string;\n @Input() icon: string;\n @Input() isNew = false;\n @Input() isNewAnalyses = false;\n\n @Output() clicked = new EventEmitter();\n}\n","import { ChangeDetectionStrategy, Component, HostBinding } from '@angular/core';\n\n@Component({\n selector: 'app-chapter-card',\n templateUrl: './chapter-card.component.html',\n styleUrls: ['./chapter-card.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ChapterCardComponent {\n @HostBinding('class.card-shadow-1')\n @HostBinding('class.hover-shadow')\n @HostBinding('class.active-shadow')\n readonly cardShadowClasses = true;\n}\n","\n\n \n \n\n","import { ChangeDetectionStrategy, Component, Input } from '@angular/core';\n\n@Component({\n selector: 'app-chapter-card-img',\n templateUrl: './image.component.html',\n styleUrls: ['./image.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ChapterCardImageComponent {\n @Input() alt: string;\n @Input() src: string;\n}\n","\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n selector: 'app-chapter-card-title',\n templateUrl: './title.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ChapterCardTitleComponent {}\n","
\n \n
\n","
\n
\n {{ title | translate }}\n
\n\n \n \n

\n {{ 'RESULTS.CLAIMED_KIT_PROGRESS.CLAIMED' | translate }}\n

\n

\n {{ kitClaimed | localDate }}\n

\n
\n\n \n

\n {{ 'RESULTS.CLAIMED_KIT_PROGRESS.RECEIVED' | translate }}\n

\n

\n {{ kitReceived | localDate }}\n

\n
\n\n \n

\n {{ 'RESULTS.CLAIMED_KIT_PROGRESS.SENT' | translate }}\n

\n

\n {{ kitSent | localDate }}\n

\n
\n\n \n

\n {{ 'RESULTS.CLAIMED_KIT_PROGRESS.READY' | translate }}\n

\n

\n {{ kitCompleted | localDate }}\n

\n
\n
\n\n
\n

\n {{ 'RESULTS.CLAIMED_KIT_PROGRESS.KIT_CODE' | translate }}\n

\n

{{ kitInProgress?.kitId }}

\n
\n
\n","import {\n ChangeDetectionStrategy,\n Component,\n Input,\n OnInit,\n} from '@angular/core';\nimport {\n KitInProgress,\n KitInProgressInteraction,\n KitInProgressInteractionType,\n} from 'src/app/analyses/interfaces/analyses.types';\n\n@Component({\n selector: 'app-claimed-kit-progress',\n templateUrl: './claimed-kit-progress.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ClaimedKitProgressComponent implements OnInit {\n @Input() kitInProgress: KitInProgress;\n\n kitClaimed: number;\n kitReceived: number;\n kitSent: Date;\n kitCompleted: Date;\n isKitSent = false;\n\n private kitUnclaimed: number;\n\n ngOnInit() {\n this.kitInProgress.interactions?.map(\n (interaction: KitInProgressInteraction) => {\n const interactedOnDate = Date.parse(interaction.interactedOn);\n switch (interaction.interaction) {\n case KitInProgressInteractionType.CLAIMED:\n // Test has been activated\n if (!this.kitClaimed || this.kitClaimed < interactedOnDate) {\n this.kitClaimed = interactedOnDate;\n }\n break;\n case KitInProgressInteractionType.UNCLAIMED:\n if (!this.kitUnclaimed || this.kitUnclaimed < interactedOnDate) {\n this.kitUnclaimed = interactedOnDate;\n }\n break;\n case KitInProgressInteractionType.RETURNED:\n // Sample has been received from the customer\n this.kitReceived = interactedOnDate;\n break;\n case KitInProgressInteractionType.SENT_TO_LABORATORY:\n this.kitSent = new Date(interactedOnDate);\n this.isKitSent = true;\n break;\n }\n }\n );\n\n if (this.kitUnclaimed > this.kitClaimed) {\n this.kitClaimed = null;\n }\n\n // This is a fallback for missing 'SentToLaboratory'\n if (this.kitReceived && !this.isKitSent) {\n const sentMilliseconds = this.kitReceived + 1000 * 60 * 60 * 24;\n this.kitSent = new Date(sentMilliseconds);\n this.isKitSent = Date.now() > sentMilliseconds;\n }\n }\n\n get title(): string {\n if (this.isKitSent) {\n return 'RESULTS.CLAIMED_KIT_PROGRESS.ANALYZING';\n } else if (this.kitReceived) {\n return 'RESULTS.CLAIMED_KIT_PROGRESS.PREPARING';\n }\n return 'RESULTS.CLAIMED_KIT_PROGRESS.WAITING';\n }\n}\n","export const CalendlyUrls = {\n en: {\n nutrition:\n 'https://calendly.com/geneplanet/en-consultation-diet-and-nutrition',\n consultations:\n 'https://calendly.com/geneplanet/en-consultations-general-wellbeing',\n sports:\n 'https://calendly.com/geneplanet/en-consultations-sport-and-recreation',\n },\n sl: {\n nutrition:\n 'https://calendly.com/geneplanet/sl-consultation-diet-and-nutrition',\n consultations:\n 'https://calendly.com/geneplanet/sl-consultations-general-wellbeing',\n sports:\n 'https://calendly.com/geneplanet/sl-consultations-sport-and-recreation',\n },\n pl: {\n nutrition:\n 'https://calendly.com/geneplanet/pl-consultation-diet-and-nutrition',\n consultations:\n 'https://calendly.com/geneplanet/pl-consultations-general-wellbeing',\n sports:\n 'https://calendly.com/geneplanet/pl-consultations-sport-and-recreation',\n },\n sk: {\n nutrition:\n 'https://calendly.com/geneplanet/svk-consultation-diet-and-nutrition',\n consultations:\n 'https://calendly.com/geneplanet/svk-consultations-general-wellbeing',\n sports:\n 'https://calendly.com/geneplanet/svk-consultations-sport-and-recreation',\n },\n};\n","\n \n

\n {{ 'CONSULTATION.FREE_30_MINUTE' | translate | uppercase }}\n

\n
\n \n

\n {{ 'CONSULTATION.TALK_WITH_OUR' | translate }}\n

\n
\n\n \n
\n \n {{ 'RESULTS.ID.CONSULT.BTN' | translate }}\n \n \n \n {{ 'RESULTS.ID.CONSULT.VIDEO' | translate }}\n \n
\n
\n\n","import { Component, Input } from '@angular/core';\nimport { NgbModal } from '@ng-bootstrap/ng-bootstrap';\nimport { TranslateService } from '@ngx-translate/core';\n\nimport { environment } from 'src/environments/environment';\nimport { VideoModalComponent } from '../modals/video-modal.component';\nimport { CalendlyUrls } from './consulting.constants';\n\n@Component({\n selector: 'app-consulting',\n templateUrl: './consulting.component.html',\n styleUrls: ['./consulting.component.scss'],\n})\nexport class ConsultingComponent {\n @Input() productId: string;\n @Input() video = false;\n\n constructor(\n private translateService: TranslateService,\n protected readonly modals: NgbModal\n ) {}\n\n openVideoModal() {\n const ref = this.modals.open(VideoModalComponent, {\n backdrop: true,\n keyboard: false,\n windowClass: 'basic-video-modal',\n\n backdropClass: 'basic-modal-backdrop',\n });\n\n ref.componentInstance.videoId = 'aYsa2f1fy5s';\n ref.componentInstance.forceCC = true;\n }\n\n getUrl(): string {\n const lang = this.translateService.currentLang;\n\n switch (this.productId) {\n case environment.products.dietAndBodyWeight:\n case environment.products.dietAndNutrition:\n case environment.products.vitaminsAndMinerals:\n case environment.products.metabolismAndLifeStyle:\n case environment.products.dietAndBodyWeightOLD:\n case environment.products.vitaminsAndMineralsOLD:\n case environment.products.metabolismAndLifeStyleOLD:\n return CalendlyUrls[lang]?.nutrition;\n case 'DNA':\n case environment.products.heartHealthDna:\n case environment.products.skinHealthAndAgeing:\n case environment.products.mindAndWellbeing:\n case environment.products.bodyAndMind:\n case environment.products.immuneSystem:\n case environment.products.heartHealthDnaOLD:\n case environment.products.skinHealthAndAgeingOLD:\n return CalendlyUrls[lang]?.consultations;\n case environment.products.sportsPerformance:\n case environment.products.sportAndRecreation:\n case environment.products.sportsPerformanceOLD:\n return CalendlyUrls[lang]?.sports;\n default:\n return '';\n }\n }\n\n book() {\n const url = this.getUrl();\n if (url) {\n window.open(url, '_blank');\n }\n }\n}\n","import { BreakpointObserver } from '@angular/cdk/layout';\nimport {\n Component,\n Input,\n ChangeDetectionStrategy,\n AfterViewInit,\n ChangeDetectorRef,\n HostListener,\n ViewChild,\n ElementRef,\n HostBinding,\n} from '@angular/core';\nimport {\n GPU_MEDIA_QUERIES,\n GpuMediaQueryBreakpoints,\n} from '@geneplanet/ngx-ui/src/lib/layout';\n\n@Component({\n selector: 'app-container-popover',\n templateUrl: './container-popover.component.html',\n styleUrls: ['./container-popover.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ContainerPopoverComponent implements AfterViewInit {\n @Input() parentRef: ElementRef;\n @Input() arrowClass: string;\n @Input() popoverClass: string;\n\n @ViewChild('container') containerRef: ElementRef;\n @ViewChild('popover') popoverRef: ElementRef;\n\n @HostBinding('style.visibility') visibility = 'hidden';\n\n arrowLeftPosition = 0;\n popoverLeftPosition = 0;\n\n constructor(\n private cdr: ChangeDetectorRef,\n private breakpointObserver: BreakpointObserver\n ) {}\n\n @HostListener('window:resize')\n onResize() {\n this.updateDOM();\n }\n\n ngAfterViewInit() {\n setTimeout(() => this.updateDOM());\n }\n\n private updateDOM() {\n if (!this.parentRef || !this.containerRef || !this.popoverRef) {\n return;\n }\n\n const popoverMargin = this.breakpointObserver.isMatched(\n GPU_MEDIA_QUERIES[GpuMediaQueryBreakpoints.MD_UP]\n )\n ? 0\n : 16;\n this.popoverLeftPosition = popoverMargin;\n\n const parentRect = this.parentRef.nativeElement.getBoundingClientRect();\n const containerRect = this.containerRef.nativeElement.getBoundingClientRect();\n const popoverRect = this.popoverRef.nativeElement.getBoundingClientRect();\n\n this.arrowLeftPosition = parentRect.left + parentRect.width / 2;\n this.popoverLeftPosition = Math.max(\n this.arrowLeftPosition - popoverRect.width / 2,\n containerRect.left + popoverMargin\n );\n this.popoverLeftPosition = Math.min(\n this.popoverLeftPosition,\n containerRect.left +\n containerRect.width -\n popoverRect.width -\n popoverMargin\n );\n this.visibility = 'visible';\n\n this.cdr.markForCheck();\n }\n}\n","\n\n
\n \n \n
\n\n","import { Component, OnInit, Input, OnChanges } from '@angular/core';\n\n@Component({\n selector: 'app-counter',\n template: `{{ count | localNumber }}`,\n})\nexport class CounterComponent implements OnInit, OnChanges {\n @Input() target: number;\n @Input() speed = 1; // this.speed < 1 makes counter faster\n count = 0;\n updateCount = () => {\n const inc = 10;\n const percent = this.count / this.target;\n\n if (this.count < this.target) {\n if (this.count + inc > this.target) {\n this.count = this.target;\n } else {\n this.count += inc;\n setTimeout(this.updateCount, 10 * percent * this.speed);\n }\n } else if (this.count > this.target) {\n if (this.count - inc < this.target) {\n this.count = this.target;\n } else {\n this.count -= inc;\n setTimeout(this.updateCount, 10 * percent * this.speed);\n }\n }\n };\n ngOnInit() {\n this.updateCount();\n }\n\n ngOnChanges() {\n this.updateCount();\n }\n}\n","
\n i\"\n >\n
\n","import { Component, Input, OnInit } from '@angular/core';\n\n@Component({\n selector: 'app-evidence-level',\n styleUrls: ['./evidence-level.component.scss'],\n templateUrl: './evidence-level.component.html',\n})\nexport class EvidenceLevelComponent implements OnInit {\n @Input() level: number;\n @Input() maxLevel = 5;\n\n levels: number[];\n\n ngOnInit() {\n this.levels = Array.from(Array(this.maxLevel));\n }\n}\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n selector: 'app-form-page-footer',\n template: ``,\n styleUrls: ['./form-page-footer.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n})\nexport class FormPageFooterComponent {}\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n selector: 'app-image-card-button',\n templateUrl: './button.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ImageCardButtonComponent {}\n","\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n selector: 'app-image-card-description',\n templateUrl: './description.component.html',\n styleUrls: ['./description.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ImageCardDescriptionComponent {}\n","\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n selector: 'app-image-card-tag',\n templateUrl: './tag.component.html',\n styleUrls: ['./tag.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ImageCardTagComponent {}\n","\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n selector: 'app-image-card-title',\n templateUrl: './title.component.html',\n styleUrls: ['./title.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n})\nexport class ImageCardTitleComponent {}\n","\n","import { Component, ContentChild, Input } from '@angular/core';\nimport { ImageCardButtonComponent } from './components/button/button.component';\nimport { ImageCardDescriptionComponent } from './components/description/description.component';\nimport { GpuLayoutModule } from '@geneplanet/ngx-ui/src/lib/layout';\n\n@Component({\n selector: 'app-image-card',\n templateUrl: './image-card.component.html',\n styleUrls: ['./image-card.component.scss'],\n imports: [GpuLayoutModule],\n standalone: true,\n})\nexport class ImageCardComponent {\n @Input() imgS: string;\n @Input() imgL: string;\n @ContentChild(ImageCardDescriptionComponent)\n description: ImageCardDescriptionComponent;\n @ContentChild(ImageCardButtonComponent)\n button: ImageCardButtonComponent;\n\n linearGradient =\n 'linear-gradient(180deg, rgba(58, 67, 113, 0) 0.03%, rgba(58, 67, 113, 0.75) 100%)';\n}\n","\n \n\n
\n \n
\n\n
\n \n
\n\n \n\n \n\n","import {\n Component,\n ChangeDetectionStrategy,\n Input,\n ViewChild,\n ElementRef,\n HostListener,\n ChangeDetectorRef,\n} from '@angular/core';\nimport { AnalysisHeaderComponent } from '../analysis-header/analysis-header.component';\nimport { GptRouterBackModule } from '@geneplanet/ngx-utils';\nimport { AnalysisHeaderTitleComponent } from '../analysis-header/components/title/title.component';\nimport { GpuLayoutModule } from '@geneplanet/ngx-ui';\n\n@Component({\n selector: 'app-image-header',\n templateUrl: './image-header.component.html',\n styleUrls: ['./image-header.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n AnalysisHeaderComponent,\n AnalysisHeaderTitleComponent,\n GptRouterBackModule,\n GpuLayoutModule,\n ],\n standalone: true,\n})\nexport class ImageHeaderComponent {\n @Input() imgS: string;\n @Input() imgL: string;\n @Input() title: string;\n @Input() routerBackUrl: string;\n\n @ViewChild('imageHeaderContainer') imageHeaderContainer: ElementRef;\n @ViewChild('contentContainer') contentContainer: ElementRef;\n @ViewChild('backContainer') backContainer: ElementRef;\n @ViewChild('analysisHeaderContainer') analysisHeaderContainer: ElementRef;\n\n linearGradient =\n 'linear-gradient(180deg, rgba(58, 67, 113, 0) 0.03%, rgba(58, 67, 113, 0.75) 100%)';\n analysisHeaderTop = -1;\n\n constructor(private cdr: ChangeDetectorRef) {}\n\n @HostListener('window:scroll')\n windowScroll() {\n this.onScroll();\n }\n\n public updateHeight() {\n this.analysisHeaderTop =\n this.analysisHeaderContainer.nativeElement?.offsetHeight * -1;\n this.cdr.markForCheck();\n }\n\n private onScroll() {\n setTimeout(() => {\n const imageHeaderHeight =\n this.imageHeaderContainer?.nativeElement?.offsetHeight;\n const contentHeight = this.contentContainer?.nativeElement?.offsetHeight;\n const backHeight = this.backContainer?.nativeElement?.offsetHeight;\n const analysisHeaderHeight =\n this.analysisHeaderContainer?.nativeElement?.offsetHeight;\n\n const previousValue = this.analysisHeaderTop;\n this.analysisHeaderTop =\n window.scrollY + backHeight >= imageHeaderHeight - contentHeight\n ? 0\n : analysisHeaderHeight * -1;\n\n if (previousValue != this.analysisHeaderTop) {\n this.cdr.markForCheck();\n }\n });\n }\n}\n","\n
\n \n
\n\n\n
\n \n
\n\n\n \n \n\n \n

\n {{ title }}\n

\n
\n
\n\n","import { Component, Input } from '@angular/core';\nimport { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';\n\n@Component({\n selector: 'app-jotform-close-modal',\n templateUrl: './close-modal.component.html',\n})\nexport class JotFormCloseModalComponent {\n @Input() analyticsId: string;\n\n constructor(public readonly modal: NgbActiveModal) {}\n}\n","
\n \n\n
\n {{ 'JOTFORM.CLOSE_MODAL.TITLE' | translate }}\n
\n\n

\n {{ 'JOTFORM.CLOSE_MODAL.CONTENT' | translate }}\n

\n\n
\n \n {{ 'JOTFORM.CLOSE_MODAL.CLOSE' | translate }}\n \n \n {{ 'JOTFORM.CLOSE_MODAL.CANCEL' | translate }}\n \n
\n
\n","export enum JotFormControlTypes {\n HEAD = 'control_head',\n TEXT = 'control_text',\n CHECKBOX = 'control_checkbox',\n RADIO = 'control_radio',\n YESNO = 'control_yesno',\n WIDGET = 'control_widget',\n TEXTBOX = 'control_textbox',\n}\n\nexport enum JotFormWidgetTypes {\n FIELD = 'field',\n}\n\ninterface JotFormResponse {\n responseCode: number;\n message: string;\n}\n\ninterface JotFormCondition {\n action: string;\n id: string;\n index: string;\n link: string;\n priority: string;\n terms: string;\n type: string;\n}\n\nexport interface JotFormQuestionResponse extends JotFormResponse {\n content: object;\n}\n\nexport interface JotFormPropertyResponse extends JotFormResponse {\n content: {\n conditions: JotFormCondition[];\n thankYouPage: {\n title: string;\n subTitle: string;\n type: string;\n imageSrc: string;\n redirectLink: string;\n };\n welcomePage: {\n title: string;\n subTitle: string;\n buttonText: string;\n logo: string;\n isActive: string;\n };\n };\n}\n\nexport interface JotFormSubmissionResponse extends JotFormResponse {\n content: {\n submissionID: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n URL: string;\n };\n}\n\nexport interface JotFormQuestion {\n qid: string;\n type: string;\n order: string;\n name: string;\n text?: string;\n hidden?: string;\n options?: string;\n description?: string;\n subHeader?: string;\n termsText?: string;\n termsLink?: string;\n widgetType?: string;\n fieldParameters?: string;\n}\n\nexport interface JotFormConditions {\n action: string;\n terms: string;\n}\n","import { UntypedFormGroup, ValidationErrors } from '@angular/forms';\n\nexport function atLeastOneChecked(group: UntypedFormGroup): ValidationErrors | null {\n const atLeastOneChecked =\n group &&\n group?.controls &&\n Object.keys(group.controls).some((k) => group.controls[k].value);\n\n return atLeastOneChecked ? null : { atLeastOne: true };\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { shareReplay } from 'rxjs/operators';\nimport {\n JotFormQuestionResponse,\n JotFormPropertyResponse,\n JotFormSubmissionResponse,\n} from 'src/app/shared/components/jotform-modal/jotfrom-types';\nimport { Observable } from 'rxjs';\n\n@Injectable({ providedIn: 'root' })\nexport class JotformApiService {\n constructor(private http: HttpClient) {}\n\n questions(formId: string): Observable {\n return this.http\n .get(`/api/jotform/form/${formId}/questions`)\n .pipe(shareReplay());\n }\n\n formProperties(formId: string): Observable {\n return this.http\n .get(`/api/jotform/form/${formId}/properties`)\n .pipe(shareReplay());\n }\n\n saveSubmissions(\n formId: string,\n data: any\n ): Observable {\n return this.http.post(\n `/api/jotform/form/${formId}/submissions`,\n data\n );\n }\n}\n","
\n \n \n \n
\n\n
\n \n \n \n \n \n \n \n \n

\n {{ questionIndex }}/{{ filteredQuestionsLength }}\n

\n\n \n \n\n \n {{ selectedQuestion.subHeader }}\n

\n\n \n {{ selectedQuestion.description }}\n

\n\n
\n \n \n \n \n \n \n\n \n \n \n \n \n {{ option }}\n \n \n \n \n \n\n \n \n \n {{ option }}\n \n \n\n \n \n \n \n \n {{ option }}\n \n \n
\n \n \n \n \n \n\n \n
\n \n \n \n\n \n {{ (isSaveStep ? 'JOTFORM.COMPLETE' : 'NEXT') | translate }}\n \n
\n
\n \n \n \n \n\n\n\n

\n
\n\n\n

\n
\n\n\n
\n

{{ data.title }}

\n

{{ data.subTitle }}

\n \n \n {{ data.buttonText }}\n \n \n
\n
\n\n\n
\n

{{ data.title }}

\n

{{ data.subTitle }}

\n \n \n {{ 'CLOSE' | translate }}\n \n \n
\n
\n\n\n
\n \n\n
\n {{ data.text }}\n
\n\n \n {{ data.subHeader }}\n

\n\n \n {{ data.description }}\n

\n \n \n {{ 'BACK' | translate }}\n \n\n \n {{ 'JOTFORM.COMPLETE' | translate }}\n \n \n
\n
\n","import {\n Component,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n OnInit,\n Input,\n Output,\n EventEmitter,\n} from '@angular/core';\nimport { UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';\nimport { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap';\nimport { distinctUntilChanged, first, map } from 'rxjs/operators';\nimport { JotformApiService } from '../../services/jotfrom-api.service';\nimport {\n JotFormConditions,\n JotFormQuestion,\n JotFormControlTypes,\n JotFormWidgetTypes,\n} from './jotfrom-types';\nimport { atLeastOneChecked } from '../../util/checkbox-required';\nimport { JotFormCloseModalComponent } from './close-modal/close-modal.component';\nimport { AnalyticsService } from '@geneplanet/ngx-utils';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\n\n@UntilDestroy()\n@Component({\n selector: 'app-jotform-modal',\n templateUrl: './jotform-modal.component.html',\n styleUrls: ['./jotform-modal.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class JotFormModalComponent implements OnInit {\n @Input() formId: string;\n @Input() additionalParameters: any;\n @Input() analyticsId: string;\n\n @Output() completed: EventEmitter = new EventEmitter();\n\n pageId = {\n start: 'welcome',\n complete: 'thankyou',\n saveStep: null,\n };\n\n selectedQuestion: JotFormQuestion;\n form: UntypedFormGroup;\n controlTypes = JotFormControlTypes;\n widgetTypes = JotFormWidgetTypes;\n filteredQuestionsLength: number;\n questionIndex = 1;\n thankPageActive = false;\n questions: JotFormQuestion[];\n\n private hiddenFields = {};\n private checkboxQuestions = [];\n private breadCrumbs = [];\n private conditions: object = {};\n private data = { formProperties: null, formQuestions: null };\n\n constructor(\n private cdr: ChangeDetectorRef,\n private jotformService: JotformApiService,\n public readonly modal: NgbActiveModal,\n private readonly modals: NgbModal,\n private analyticsService: AnalyticsService\n ) {}\n\n ngOnInit() {\n this.jotformService\n .questions(this.formId)\n .pipe(\n first(),\n map((questions: { content: object }) => {\n return Object.values(questions.content).sort(\n (a, b) => Number(a.order) - Number(b.order)\n );\n })\n )\n .subscribe((questions) => {\n this.data.formQuestions = questions;\n this.setQuestions();\n });\n\n this.jotformService\n .formProperties(this.formId)\n .pipe(first())\n .subscribe((properties) => {\n this.data.formProperties = properties.content;\n this.setFormConditions(properties.content.conditions);\n this.setQuestions();\n });\n }\n\n start() {\n this.questionIndex = 1;\n this.selectQuestion(this.questions[1]);\n }\n\n next(step = 1) {\n if (this.control.status !== 'VALID' && step > 0) {\n return;\n }\n\n const breadcrumb = step > 0;\n let next;\n\n if (step > 0) {\n if (this.isSaveStep) {\n this.saveAnswer();\n }\n\n next = this.questions[\n this.questions.indexOf(this.selectedQuestion) + step\n ];\n const rules = this.checkFormConditions(\n this.selectedQuestion.qid,\n this.control.value\n );\n\n next = rules ? this.findQuestion(rules) : next;\n } else {\n this.breadCrumbs.pop();\n next = this.findQuestion(this.breadCrumbs[this.breadCrumbs.length - 1]);\n }\n\n if (next) {\n this.questionIndex += step;\n this.selectedQuestion = null;\n this.cdr.detectChanges();\n this.selectQuestion(next, breadcrumb);\n this.cdr.markForCheck();\n }\n }\n\n get selectedQuestionOrder(): number {\n return Number(this.selectedQuestion?.order);\n }\n\n get control() {\n return this.form?.controls[this.selectedQuestion.qid];\n }\n\n public get isSaveStep() {\n return this.selectedQuestion.qid === this.pageId.saveStep;\n }\n\n getOption(option: string) {\n return (this.control as UntypedFormGroup).controls[option];\n }\n\n getAnswers(answers: string) {\n return answers.split('|');\n }\n\n close() {\n if (\n this.selectedQuestion.qid === this.pageId.start ||\n this.selectedQuestion.qid === this.pageId.complete\n ) {\n this.modal.dismiss();\n } else {\n const ref = this.modals.open(JotFormCloseModalComponent, {\n backdrop: 'static',\n keyboard: false,\n windowClass: 'small-modal',\n });\n\n ref.componentInstance.analyticsId = this.analyticsId;\n\n ref.result.then((result: any) => {\n if (result) {\n this.modal.dismiss();\n }\n });\n }\n }\n\n getFieldOptions() {\n const fieldOptions = JSON.parse(this.selectedQuestion.fieldParameters)?.[0];\n\n if (!fieldOptions) {\n return [];\n }\n return fieldOptions.options?.split(',') ?? [];\n }\n\n public saveAnswer() {\n const data = this.form.getRawValue();\n\n // Set checkbox values to array from a object with boolean properties\n this.checkboxQuestions.forEach((question) => {\n data[question] = Object.keys(data[question]).filter((key) => {\n return data[question][key];\n });\n });\n\n this.jotformService\n .saveSubmissions(this.formId, { ...data, ...this.hiddenFields })\n .subscribe((res) => this.completed.emit(res.content.submissionID));\n\n if (!this.thankPageActive) {\n this.modal.dismiss();\n }\n }\n\n private setQuestions() {\n if (this.data.formProperties && this.data.formQuestions) {\n this.questions = this.filterHiddenQuestions(this.data.formQuestions);\n\n this.form = this.toFormGroup(this.questions);\n\n const welcomePage = this.data.formProperties.welcomePage[0];\n const thankYouPage = this.data.formProperties.thankYouPage[0];\n\n if (Number(welcomePage.isActive)) {\n this.questions.unshift({\n ...welcomePage,\n qid: this.pageId.start,\n });\n this.questionIndex = 0;\n }\n\n const saveStep = this.questions[this.questions.length - 1];\n this.pageId.saveStep = saveStep.qid;\n\n if (Number(thankYouPage.isActive)) {\n this.questions.push({\n ...thankYouPage,\n qid: this.pageId.complete,\n });\n this.thankPageActive = true;\n } else if (saveStep.type === this.controlTypes.HEAD) {\n this.filteredQuestionsLength--;\n }\n\n this.selectQuestion(this.questions[0]);\n\n this.cdr.markForCheck();\n }\n }\n\n private filterHiddenQuestions(\n questions: JotFormQuestion[]\n ): JotFormQuestion[] {\n const filtered = [];\n\n questions.forEach((question) => {\n if (question.hidden === 'Yes') {\n if (this.additionalParameters[question.name]) {\n this.hiddenFields[question.qid] = this.additionalParameters[\n question.name\n ];\n }\n } else {\n filtered.push(question);\n }\n });\n\n this.filteredQuestionsLength = filtered.length;\n\n return filtered;\n }\n\n private selectQuestion(question: JotFormQuestion, breadcrumb = true) {\n this.selectedQuestion = question;\n\n if (breadcrumb) {\n this.breadCrumbs.push(question.qid);\n }\n }\n\n private setFormConditions(conditions: JotFormConditions[]) {\n if (!conditions) {\n return;\n }\n\n for (const condition of conditions) {\n const term = JSON.parse(condition.terms)[0];\n const action = JSON.parse(condition.action)[0];\n\n this.conditions[term.field] = {\n value: term.value,\n skipTo: action.skipTo,\n };\n }\n }\n\n private toFormGroup(questions: JotFormQuestion[]) {\n const group: any = {};\n\n for (const question of questions) {\n let validators = [Validators.required];\n\n if (\n [\n JotFormControlTypes.HEAD as string,\n JotFormControlTypes.TEXT as string,\n ].includes(question.type)\n ) {\n validators = [];\n }\n\n if (question.type === JotFormControlTypes.CHECKBOX) {\n this.checkboxQuestions.push(question.qid);\n const optionsArray = this.getAnswers(question.options);\n\n const formGroup = new UntypedFormGroup({}, atLeastOneChecked);\n optionsArray.forEach((option) => {\n const control = new UntypedFormControl(false);\n control.valueChanges\n .pipe(untilDestroyed(this))\n .subscribe((value) =>\n this.analyticsService.trackFormValue(\n this.analyticsId + '-questionnaire',\n \"value\",\n {\n id: option,\n value,\n },\n this.formId,\n question.name\n )\n );\n formGroup.addControl(option, control);\n });\n\n formGroup.updateValueAndValidity();\n\n group[question.qid] = formGroup;\n } else {\n group[question.qid] = new UntypedFormControl(\n null,\n Validators.compose(validators)\n );\n group[question.qid].valueChanges\n .pipe(distinctUntilChanged(), untilDestroyed(this))\n .subscribe((value) =>\n this.analyticsService.trackFormValue(\n this.analyticsId + '-questionnaire',\n \"value\",\n {\n value: value || '',\n isValid: group[question.qid].valid\n },\n this.formId,\n question.name\n )\n );\n }\n }\n return new UntypedFormGroup(group);\n }\n\n private findQuestion(qid: string) {\n return this.questions.find((item) => item.qid === qid);\n }\n\n private checkFormConditions(qid: string, value: string) {\n const rule = this.conditions[qid];\n\n if (rule?.value && rule.value === value) {\n return rule.skipTo;\n }\n\n return false;\n }\n}\n","import { Component, ChangeDetectionStrategy } from '@angular/core';\n\n@Component({\n selector: 'app-list-item-content',\n templateUrl: './content.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ListItemContentComponent {}\n","\n","import { Component, ChangeDetectionStrategy } from '@angular/core';\n\n@Component({\n selector: 'app-list-item-description',\n templateUrl: './description.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ListItemDescriptionComponent {}\n","\n","import { Component, ChangeDetectionStrategy } from '@angular/core';\n\n@Component({\n selector: 'app-list-item-icon',\n templateUrl: './icon.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ListItemIconComponent {}\n","\n","import {\n Component,\n ChangeDetectionStrategy,\n ContentChild,\n Input,\n} from '@angular/core';\nimport { ListItemDescriptionComponent } from './description/description.component';\nimport { ListItemIconComponent } from './icon/icon.component';\n\n@Component({\n selector: 'app-list-item',\n templateUrl: './item.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ListItemComponent {\n @Input() itemClass = '';\n\n @ContentChild(ListItemIconComponent) icon: ListItemIconComponent;\n @ContentChild(ListItemDescriptionComponent)\n description: ListItemDescriptionComponent;\n}\n","\n
\n \n
\n\n
\n \n

\n \n

\n
\n\n
\n \n
\n\n","import { Component, ChangeDetectionStrategy } from '@angular/core';\n\n@Component({\n selector: 'app-list-item-title',\n templateUrl: './title.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ListItemTitleComponent {}\n","\n","import { Component, ChangeDetectionStrategy, Input } from '@angular/core';\n\n@Component({\n selector: 'app-list',\n templateUrl: './list.component.html',\n styleUrls: ['./list.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ListComponent {\n @Input() card = true;\n @Input() listClass = '';\n}\n","\n \n\n","import { DOCUMENT } from '@angular/common';\nimport {\n Component,\n ChangeDetectionStrategy,\n Input,\n Inject,\n OnInit,\n} from '@angular/core';\nimport { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';\nimport { TranslateService } from '@ngx-translate/core';\nimport { environment } from 'src/environments/environment';\n\n@Component({\n selector: 'app-analysis-video-modal',\n templateUrl: './video-modal.component.html',\n styleUrls: ['./video-modal.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class VideoModalComponent implements OnInit {\n @Input() videoId: string;\n @Input() forceCC = false;\n\n cc = [];\n playerVars: YT.PlayerVars;\n\n constructor(\n public readonly modal: NgbActiveModal,\n private translate: TranslateService,\n @Inject(DOCUMENT) private document\n ) {\n environment.locations.forEach((location) => {\n if (location.lang.videoSubtitles) {\n this.cc.push(location.lang.code);\n }\n });\n }\n\n ngOnInit() {\n this.playerVars = {\n enablejsapi: 1,\n origin: this.document.location.origin,\n showinfo: 0,\n modestbranding: 1,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n cc_load_policy: this.setPolicy(),\n hl: this.setLanguage(),\n rel: 0,\n };\n }\n\n setPolicy() {\n return this.cc.includes(this.translate.currentLang) && this.forceCC ? 1 : 0;\n }\n\n setLanguage() {\n return this.forceCC ? this.translate.currentLang : null;\n }\n}\n","
\n \n \n \n\n
\n \n
\n
\n","
\n
\n {{ 'ANALYSES.NEW.TEXT' | translate }}\n
\n\n
\n \n
\n
\n","import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';\nimport { AnalysesTypesLowercase } from 'src/app/analyses/interfaces/analyses.types';\nimport { AnalysisLink } from '../../shared.types';\n\n@Component({\n selector: 'app-new-analyses-list',\n templateUrl: './new-analyses-list.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class NewAnalysesListComponent implements OnInit {\n @Input() type: AnalysesTypesLowercase;\n @Input() analyses: AnalysisLink[];\n @Input() hideCircles = false;\n\n public newAnalyses: AnalysisLink[];\n\n ngOnInit(): void {\n this.newAnalyses = this.analyses.filter((analysis) => analysis?.isNew);\n }\n}\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n selector: 'app-onboarding-footer',\n template: ``,\n styleUrls: ['./onboarding-footer.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class OnboardingFooterComponent {}\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n HostListener,\n Input,\n OnDestroy,\n Renderer2,\n} from '@angular/core';\nimport { LayoutService } from 'src/app/core/services/layout.service';\nimport { OnboardingType } from '../../enums/intent.enum';\n\n@Component({\n selector: 'app-onboarding-welcome',\n templateUrl: './onboarding-welcome.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n styleUrls: ['./onboarding-welcome.component.scss'],\n})\nexport class OnboardingWelcomeComponent implements AfterViewInit, OnDestroy {\n @Input()\n onboardingType: OnboardingType;\n\n private headerHeight = 56;\n\n constructor(\n private renderer: Renderer2,\n private layoutService: LayoutService\n ) {}\n\n @HostListener('window:resize', ['$event'])\n handleResize() {\n const newHeight = window.screen.width < 768 ? 0 : 56;\n\n if (newHeight !== this.headerHeight) {\n setTimeout(() => {\n this.layoutService.headerHeightChange$.next(this.headerHeight);\n });\n\n this.headerHeight = newHeight;\n }\n }\n\n ngAfterViewInit() {\n this.handleResize();\n // Add class to change location switcher color\n this.renderer.addClass(document.body, 'white-location-selector');\n }\n\n ngOnDestroy() {\n if (window.screen.width < 768) {\n const height = this.layoutService.getHeaderHeight();\n this.layoutService.headerHeightChange$.next(height);\n }\n\n this.renderer.removeClass(document.body, 'white-location-selector');\n }\n}\n","
\n \n
\n \n
\n
\n
\n","import {\n AfterContentInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n HostListener,\n Input,\n} from '@angular/core';\n\n@Component({\n selector: 'app-onboarding-wrapper',\n templateUrl: './onboarding-wrapper.component.html',\n styleUrls: ['./onboarding-wrapper.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class OnboardingWrapperComponent implements AfterContentInit {\n @Input() isNarrow = false;\n\n footerHeight = 0;\n\n constructor(private cd: ChangeDetectorRef) {}\n\n ngAfterContentInit() {\n this.updateFooterHeight();\n }\n\n @HostListener('window:resize')\n private updateFooterHeight() {\n const footer = document.getElementsByTagName('app-onboarding-footer')[0];\n\n if (footer && footer.clientHeight !== this.footerHeight) {\n this.footerHeight = footer.clientHeight;\n this.cd.markForCheck();\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","import { Component, Input, OnInit } from '@angular/core';\n\n@Component({\n selector: 'app-population-chart',\n templateUrl: './population-chart.component.html',\n styleUrls: ['./population-chart.component.scss'],\n})\nexport class PopulationChartComponent implements OnInit {\n @Input() male = false;\n @Input() color = '#FFCD03';\n @Input() percent = 0;\n\n percents = [];\n\n ngOnInit(): void {\n this.calculate();\n }\n\n calculate() {\n const full = Math.floor(this.percent / 10);\n const remain = this.percent % 10;\n this.percents = [];\n\n for (let i = 0; i < 10; i++) {\n if (i < full) {\n this.percents.push('100%');\n } else if (i === full) {\n this.percents.push(remain + '0%');\n } else {\n this.percents.push('0%');\n }\n }\n }\n}\n","\n

\n {{ 'ANALYSES.NORECOMMENDATIONS' | translate }}\n

\n
\n\n\n \n
\n \n \n {{\n (recommendation.increasesRisk\n ? 'PRS.RECOMMENDATIONS.PREVENTION.INCREASES'\n : 'PRS.RECOMMENDATIONS.PREVENTION.DECREASES'\n ) | translate\n }}\n
\n
\n

\n {{ 'PRS.RECOMMENDATIONS.PREVENTION.EVIDENCE_LEVEL' | translate }}\n

\n \n
\n

\n \n\n\n\n\n \n
\n
\n {{ 'ANALYSES.TOPICAL_INGREDIENTS' | translate }}\n
\n
\n

\n

\n
\n
\n\n\n\n\n \n
\n
\n {{ 'ANALYSES.SUPPLEMENTS' | translate }}\n
\n
\n

\n

\n
\n
\n\n","import { Component, Input, OnInit } from '@angular/core';\nimport { Recommendation } from '../../interfaces';\n\n@Component({\n selector: 'app-recommendations-list',\n styleUrls: ['./recommendations-list.component.scss'],\n templateUrl: './recommendations-list.component.html',\n})\nexport class RecommendationsListComponent implements OnInit {\n @Input() recommendations: Recommendation[];\n @Input() topicalIngredients: Recommendation[];\n @Input() supplements: Recommendation[];\n\n ngOnInit() {\n if (\n this.recommendations?.length > 0 &&\n !!this.recommendations[0].sequenceNumber\n ) {\n this.recommendations\n .filter((item) => item.title && item.image)\n .sort((a, b) => a.sequenceNumber - b.sequenceNumber);\n }\n }\n\n propertyExists(property: string, object: Recommendation) {\n return property in object;\n }\n}\n","// so it doesn't throw if no window or matchMedia\r\nvar w = typeof window !== 'undefined' ? window : { screen: {}, navigator: {} };\r\nvar matchMedia = (w.matchMedia || (function () { return ({ matches: false }); })).bind(w);\r\n// passive events test\r\n// adapted from https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md\r\nvar passiveOptionAccessed = false;\r\nvar options = {\r\n get passive() {\r\n return (passiveOptionAccessed = true);\r\n },\r\n};\r\n// have to set and remove a no-op listener instead of null\r\n// (which was used previously), because Edge v15 throws an error\r\n// when providing a null callback.\r\n// https://github.com/rafgraph/detect-passive-events/pull/3\r\n// eslint-disable-next-line @typescript-eslint/no-empty-function\r\nvar noop = function () { };\r\nw.addEventListener && w.addEventListener('p', noop, options);\r\nw.removeEventListener && w.removeEventListener('p', noop, false);\r\nvar supportsPassiveEvents = passiveOptionAccessed;\r\nvar supportsPointerEvents = 'PointerEvent' in w;\r\nvar onTouchStartInWindow = 'ontouchstart' in w;\r\nvar touchEventInWindow = 'TouchEvent' in w;\r\n// onTouchStartInWindow is the old-old-legacy way to determine a touch device\r\n// and many websites interpreted it to mean that the device is a touch only phone,\r\n// so today browsers on a desktop/laptop computer with a touch screen (primary input mouse)\r\n// have onTouchStartInWindow as false (to prevent from being confused with a\r\n// touchOnly phone) even though they support the TouchEvents API, so need to check\r\n// both onTouchStartInWindow and touchEventInWindow for TouchEvent support,\r\n// however, some browsers (chromium) support the TouchEvents API even when running on\r\n// a mouse only device (touchEventInWindow true, but onTouchStartInWindow false)\r\n// so the touchEventInWindow check needs to include an coarse pointer media query\r\nvar supportsTouchEvents = onTouchStartInWindow ||\r\n (touchEventInWindow && matchMedia('(any-pointer: coarse)').matches);\r\nvar hasTouch = (w.navigator.maxTouchPoints || 0) > 0 || supportsTouchEvents;\r\n// userAgent is used as a backup to correct for known device/browser bugs\r\n// and when the browser doesn't support interaction media queries (pointer and hover)\r\n// see https://caniuse.com/css-media-interaction\r\nvar userAgent = w.navigator.userAgent || '';\r\n// iPads now support a mouse that can hover, however the media query interaction\r\n// feature results always say iPads only have a coarse pointer that can't hover\r\n// even when a mouse is connected (anyFine and anyHover are always false),\r\n// this unfortunately indicates a touch only device but iPads should\r\n// be classified as a hybrid device, so determine if it is an iPad\r\n// to indicate it should be treated as a hybrid device with anyHover true\r\nvar isIPad = matchMedia('(pointer: coarse)').matches &&\r\n // both iPad and iPhone can \"request desktop site\", which sets the userAgent to Macintosh\r\n // so need to check both userAgents to determine if it is an iOS device\r\n // and screen size to separate iPad from iPhone\r\n /iPad|Macintosh/.test(userAgent) &&\r\n Math.min(w.screen.width || 0, w.screen.height || 0) >= 768;\r\nvar hasCoarsePrimaryPointer = (matchMedia('(pointer: coarse)').matches ||\r\n // if the pointer is not coarse and not fine then the browser doesn't support\r\n // interaction media queries (see https://caniuse.com/css-media-interaction)\r\n // so if it has onTouchStartInWindow assume it has a coarse primary pointer\r\n (!matchMedia('(pointer: fine)').matches && onTouchStartInWindow)) &&\r\n // bug in firefox (as of v81) on hybrid windows devices where the interaction media queries\r\n // always indicate a touch only device (only has a coarse pointer that can't hover)\r\n // so assume that the primary pointer is not coarse for firefox windows\r\n !/Windows.*Firefox/.test(userAgent);\r\nvar hasAnyHoverOrAnyFinePointer = matchMedia('(any-pointer: fine)').matches ||\r\n matchMedia('(any-hover: hover)').matches ||\r\n // iPads might have an input device that can hover, so assume it has anyHover\r\n isIPad ||\r\n // if no onTouchStartInWindow then the browser is indicating that it is not a touch only device\r\n // see above note for supportsTouchEvents\r\n !onTouchStartInWindow;\r\n// a hybrid device is one that both hasTouch and\r\n// any input can hover or has a fine pointer, or the primary pointer is not coarse\r\n// if it's not a hybrid, then if it hasTouch it's touchOnly, otherwise it's mouseOnly\r\nvar deviceType = hasTouch && (hasAnyHoverOrAnyFinePointer || !hasCoarsePrimaryPointer)\r\n ? 'hybrid'\r\n : hasTouch\r\n ? 'touchOnly'\r\n : 'mouseOnly';\r\nvar primaryInput = deviceType === 'mouseOnly'\r\n ? 'mouse'\r\n : deviceType === 'touchOnly'\r\n ? 'touch'\r\n : // if the device is a hybrid, then if the primary pointer is coarse\r\n // assume the primaryInput is touch, otherwise assume it's mouse\r\n hasCoarsePrimaryPointer\r\n ? 'touch'\r\n : 'mouse';\n\nexport { deviceType, primaryInput, supportsPassiveEvents, supportsPointerEvents, supportsTouchEvents };\n","import * as i0 from '@angular/core';\nimport { InjectionToken, Directive, HostBinding, Inject, Optional, Component, Input, forwardRef, EventEmitter, ChangeDetectionStrategy, Output, ViewChild, ContentChild, HostListener, NgModule } from '@angular/core';\nimport * as i1 from '@angular/common';\nimport { CommonModule } from '@angular/common';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { Subject } from 'rxjs';\nimport { throttleTime, tap, distinctUntilChanged, filter } from 'rxjs/operators';\nimport { supportsPassiveEvents } from 'detect-passive-events';\n\n/** Label type */\nvar LabelType;\n(function (LabelType) {\n /** Label above low pointer */\n LabelType[LabelType[\"Low\"] = 0] = \"Low\";\n /** Label above high pointer */\n LabelType[LabelType[\"High\"] = 1] = \"High\";\n /** Label for minimum slider value */\n LabelType[LabelType[\"Floor\"] = 2] = \"Floor\";\n /** Label for maximum slider value */\n LabelType[LabelType[\"Ceil\"] = 3] = \"Ceil\";\n /** Label below legend tick */\n LabelType[LabelType[\"TickValue\"] = 4] = \"TickValue\";\n})(LabelType || (LabelType = {}));\n/** Slider options */\nclass Options {\n /** Minimum value for a slider.\n Not applicable when using stepsArray. */\n floor = 0;\n /** Maximum value for a slider.\n Not applicable when using stepsArray. */\n ceil = null;\n /** Step between each value.\n Not applicable when using stepsArray. */\n step = 1;\n /** The minimum range authorized on the slider.\n Applies to range slider only.\n When using stepsArray, expressed as index into stepsArray. */\n minRange = null;\n /** The maximum range authorized on the slider.\n Applies to range slider only.\n When using stepsArray, expressed as index into stepsArray. */\n maxRange = null;\n /** Set to true to have a push behavior. When the min handle goes above the max,\n the max is moved as well (and vice-versa). The range between min and max is\n defined by the step option (defaults to 1) and can also be overriden by\n the minRange option. Applies to range slider only. */\n pushRange = false;\n /** The minimum value authorized on the slider.\n When using stepsArray, expressed as index into stepsArray. */\n minLimit = null;\n /** The maximum value authorized on the slider.\n When using stepsArray, expressed as index into stepsArray. */\n maxLimit = null;\n /** Custom translate function. Use this if you want to translate values displayed\n on the slider. */\n translate = null;\n /** Custom function for combining overlapping labels in range slider.\n It takes the min and max values (already translated with translate fuction)\n and should return how these two values should be combined.\n If not provided, the default function will join the two values with\n ' - ' as separator. */\n combineLabels = null;\n /** Use to display legend under ticks (thus, it needs to be used along with\n showTicks or showTicksValues). The function will be called with each tick\n value and returned content will be displayed under the tick as a legend.\n If the returned value is null, then no legend is displayed under\n the corresponding tick.You can also directly provide the legend values\n in the stepsArray option. */\n getLegend = null;\n /** Use to display a custom legend of a stepItem from stepsArray.\n It will be the same as getLegend but for stepsArray. */\n getStepLegend = null;\n /** If you want to display a slider with non linear/number steps.\n Just pass an array with each slider value and that's it; the floor, ceil and step settings\n of the slider will be computed automatically.\n By default, the value model and valueHigh model values will be the value of the selected item\n in the stepsArray.\n They can also be bound to the index of the selected item by setting the bindIndexForStepsArray\n option to true. */\n stepsArray = null;\n /** Set to true to bind the index of the selected item to value model and valueHigh model. */\n bindIndexForStepsArray = false;\n /** When set to true and using a range slider, the range can be dragged by the selection bar.\n Applies to range slider only. */\n draggableRange = false;\n /** Same as draggableRange but the slider range can't be changed.\n Applies to range slider only. */\n draggableRangeOnly = false;\n /** Set to true to always show the selection bar before the slider handle. */\n showSelectionBar = false;\n /** Set to true to always show the selection bar after the slider handle. */\n showSelectionBarEnd = false;\n /** Set a number to draw the selection bar between this value and the slider handle.\n When using stepsArray, expressed as index into stepsArray. */\n showSelectionBarFromValue = null;\n /** Only for range slider. Set to true to visualize in different colour the areas\n on the left/right (top/bottom for vertical range slider) of selection bar between the handles. */\n showOuterSelectionBars = false;\n /** Set to true to hide pointer labels */\n hidePointerLabels = false;\n /** Set to true to hide min / max labels */\n hideLimitLabels = false;\n /** Set to false to disable the auto-hiding behavior of the limit labels. */\n autoHideLimitLabels = true;\n /** Set to true to make the slider read-only. */\n readOnly = false;\n /** Set to true to disable the slider. */\n disabled = false;\n /** Set to true to display a tick for each step of the slider. */\n showTicks = false;\n /** Set to true to display a tick and the step value for each step of the slider.. */\n showTicksValues = false;\n /* The step between each tick to display. If not set, the step value is used.\n Not used when ticksArray is specified. */\n tickStep = null;\n /* The step between displaying each tick step value.\n If not set, then tickStep or step is used, depending on which one is set. */\n tickValueStep = null;\n /** Use to display ticks at specific positions.\n The array contains the index of the ticks that should be displayed.\n For example, [0, 1, 5] will display a tick for the first, second and sixth values. */\n ticksArray = null;\n /** Used to display a tooltip when a tick is hovered.\n Set to a function that returns the tooltip content for a given value. */\n ticksTooltip = null;\n /** Same as ticksTooltip but for ticks values. */\n ticksValuesTooltip = null;\n /** Set to true to display the slider vertically.\n The slider will take the full height of its parent.\n Changing this value at runtime is not currently supported. */\n vertical = false;\n /** Function that returns the current color of the selection bar.\n If your color won't change, don't use this option but set it through CSS.\n If the returned color depends on a model value (either value or valueHigh),\n you should use the argument passed to the function.\n Indeed, when the function is called, there is no certainty that the model\n has already been updated.*/\n getSelectionBarColor = null;\n /** Function that returns the color of a tick. showTicks must be enabled. */\n getTickColor = null;\n /** Function that returns the current color of a pointer.\n If your color won't change, don't use this option but set it through CSS.\n If the returned color depends on a model value (either value or valueHigh),\n you should use the argument passed to the function.\n Indeed, when the function is called, there is no certainty that the model has already been updated.\n To handle range slider pointers independently, you should evaluate pointerType within the given\n function where \"min\" stands for value model and \"max\" for valueHigh model values. */\n getPointerColor = null;\n /** Handles are focusable (on click or with tab) and can be modified using the following keyboard controls:\n Left/bottom arrows: -1\n Right/top arrows: +1\n Page-down: -10%\n Page-up: +10%\n Home: minimum value\n End: maximum value\n */\n keyboardSupport = true;\n /** If you display the slider in an element that uses transform: scale(0.5), set the scale value to 2\n so that the slider is rendered properly and the events are handled correctly. */\n scale = 1;\n /** If you display the slider in an element that uses transform: rotate(90deg), set the rotate value to 90\n so that the slider is rendered properly and the events are handled correctly. Value is in degrees. */\n rotate = 0;\n /** Set to true to force the value(s) to be rounded to the step, even when modified from the outside.\n When set to false, if the model values are modified from outside the slider, they are not rounded\n and can be between two steps. */\n enforceStep = true;\n /** Set to true to force the value(s) to be normalised to allowed range (floor to ceil), even when modified from the outside.\n When set to false, if the model values are modified from outside the slider, and they are outside allowed range,\n the slider may be rendered incorrectly. However, setting this to false may be useful if you want to perform custom normalisation. */\n enforceRange = true;\n /** Set to true to force the value(s) to be rounded to the nearest step value, even when modified from the outside.\n When set to false, if the model values are modified from outside the slider, and they are outside allowed range,\n the slider may be rendered incorrectly. However, setting this to false may be useful if you want to perform custom normalisation. */\n enforceStepsArray = true;\n /** Set to true to prevent to user from switching the min and max handles. Applies to range slider only. */\n noSwitching = false;\n /** Set to true to only bind events on slider handles. */\n onlyBindHandles = false;\n /** Set to true to show graphs right to left.\n If vertical is true it will be from top to bottom and left / right arrow functions reversed. */\n rightToLeft = false;\n /** Set to true to reverse keyboard navigation:\n Right/top arrows: -1\n Left/bottom arrows: +1\n Page-up: -10%\n Page-down: +10%\n End: minimum value\n Home: maximum value\n */\n reversedControls = false;\n /** Set to true to keep the slider labels inside the slider bounds. */\n boundPointerLabels = true;\n /** Set to true to use a logarithmic scale to display the slider. */\n logScale = false;\n /** Function that returns the position on the slider for a given value.\n The position must be a percentage between 0 and 1.\n The function should be monotonically increasing or decreasing; otherwise the slider may behave incorrectly. */\n customValueToPosition = null;\n /** Function that returns the value for a given position on the slider.\n The position is a percentage between 0 and 1.\n The function should be monotonically increasing or decreasing; otherwise the slider may behave incorrectly. */\n customPositionToValue = null;\n /** Precision limit for calculated values.\n Values used in calculations will be rounded to this number of significant digits\n to prevent accumulating small floating-point errors. */\n precisionLimit = 12;\n /** Use to display the selection bar as a gradient.\n The given object must contain from and to properties which are colors. */\n selectionBarGradient = null;\n /** Use to add a label directly to the slider for accessibility. Adds the aria-label attribute. */\n ariaLabel = \"ngx-slider\";\n /** Use instead of ariaLabel to reference the id of an element which will be used to label the slider.\n Adds the aria-labelledby attribute. */\n ariaLabelledBy = null;\n /** Use to add a label directly to the slider range for accessibility. Adds the aria-label attribute. */\n ariaLabelHigh = \"ngx-slider-max\";\n /** Use instead of ariaLabelHigh to reference the id of an element which will be used to label the slider range.\n Adds the aria-labelledby attribute. */\n ariaLabelledByHigh = null;\n /** Use to increase rendering performance. If the value is not provided, the slider calculates the with/height of the handle */\n handleDimension = null;\n /** Use to increase rendering performance. If the value is not provided, the slider calculates the with/height of the bar */\n barDimension = null;\n /** Enable/disable CSS animations */\n animate = true;\n /** Enable/disable CSS animations while moving the slider */\n animateOnMove = false;\n}\nconst AllowUnsafeHtmlInSlider = new InjectionToken(\"AllowUnsafeHtmlInSlider\");\n\n/** Pointer type */\nvar PointerType;\n(function (PointerType) {\n /** Low pointer */\n PointerType[PointerType[\"Min\"] = 0] = \"Min\";\n /** High pointer */\n PointerType[PointerType[\"Max\"] = 1] = \"Max\";\n})(PointerType || (PointerType = {}));\n\nclass ChangeContext {\n value;\n highValue;\n pointerType;\n}\n\n/**\n * Collection of functions to handle conversions/lookups of values\n */\nclass ValueHelper {\n static isNullOrUndefined(value) {\n return value === undefined || value === null;\n }\n static areArraysEqual(array1, array2) {\n if (array1.length !== array2.length) {\n return false;\n }\n for (let i = 0; i < array1.length; ++i) {\n if (array1[i] !== array2[i]) {\n return false;\n }\n }\n return true;\n }\n static linearValueToPosition(val, minVal, maxVal) {\n const range = maxVal - minVal;\n return (val - minVal) / range;\n }\n static logValueToPosition(val, minVal, maxVal) {\n val = Math.log(val);\n minVal = Math.log(minVal);\n maxVal = Math.log(maxVal);\n const range = maxVal - minVal;\n return (val - minVal) / range;\n }\n static linearPositionToValue(percent, minVal, maxVal) {\n return percent * (maxVal - minVal) + minVal;\n }\n static logPositionToValue(percent, minVal, maxVal) {\n minVal = Math.log(minVal);\n maxVal = Math.log(maxVal);\n const value = percent * (maxVal - minVal) + minVal;\n return Math.exp(value);\n }\n static findStepIndex(modelValue, stepsArray) {\n const differences = stepsArray.map((step) => Math.abs(modelValue - step.value));\n let minDifferenceIndex = 0;\n for (let index = 0; index < stepsArray.length; index++) {\n if (differences[index] !== differences[minDifferenceIndex] && differences[index] < differences[minDifferenceIndex]) {\n minDifferenceIndex = index;\n }\n }\n return minDifferenceIndex;\n }\n}\n\n/** Helper with compatibility functions to support different browsers */\nclass CompatibilityHelper {\n /** Workaround for TouchEvent constructor sadly not being available on all browsers (e.g. Firefox, Safari) */\n static isTouchEvent(event) {\n if (window.TouchEvent !== undefined) {\n return event instanceof TouchEvent;\n }\n return event.touches !== undefined;\n }\n /** Detect presence of ResizeObserver API */\n static isResizeObserverAvailable() {\n return window.ResizeObserver !== undefined;\n }\n}\n\n/** Helper with mathematical functions */\nclass MathHelper {\n /* Round numbers to a given number of significant digits */\n static roundToPrecisionLimit(value, precisionLimit) {\n return +(value.toPrecision(precisionLimit));\n }\n static isModuloWithinPrecisionLimit(value, modulo, precisionLimit) {\n const limit = Math.pow(10, -precisionLimit);\n return Math.abs(value % modulo) <= limit || Math.abs(Math.abs(value % modulo) - modulo) <= limit;\n }\n static clampToRange(value, floor, ceil) {\n return Math.min(Math.max(value, floor), ceil);\n }\n}\n\nclass EventListener {\n eventName = null;\n events = null;\n eventsSubscription = null;\n teardownCallback = null;\n}\n\n/**\n * Helper class to attach event listeners to DOM elements with debounce support using rxjs\n */\nclass EventListenerHelper {\n renderer;\n constructor(renderer) {\n this.renderer = renderer;\n }\n attachPassiveEventListener(nativeElement, eventName, callback, throttleInterval) {\n // Only use passive event listeners if the browser supports it\n if (supportsPassiveEvents !== true) {\n return this.attachEventListener(nativeElement, eventName, callback, throttleInterval);\n }\n // Angular doesn't support passive event handlers (yet), so we need to roll our own code using native functions\n const listener = new EventListener();\n listener.eventName = eventName;\n listener.events = new Subject();\n const observerCallback = (event) => {\n listener.events.next(event);\n };\n nativeElement.addEventListener(eventName, observerCallback, { passive: true, capture: false });\n listener.teardownCallback = () => {\n nativeElement.removeEventListener(eventName, observerCallback, { passive: true, capture: false });\n };\n listener.eventsSubscription = listener.events\n .pipe((!ValueHelper.isNullOrUndefined(throttleInterval))\n ? throttleTime(throttleInterval, undefined, { leading: true, trailing: true })\n : tap(() => { }) // no-op\n )\n .subscribe((event) => {\n callback(event);\n });\n return listener;\n }\n detachEventListener(eventListener) {\n if (!ValueHelper.isNullOrUndefined(eventListener.eventsSubscription)) {\n eventListener.eventsSubscription.unsubscribe();\n eventListener.eventsSubscription = null;\n }\n if (!ValueHelper.isNullOrUndefined(eventListener.events)) {\n eventListener.events.complete();\n eventListener.events = null;\n }\n if (!ValueHelper.isNullOrUndefined(eventListener.teardownCallback)) {\n eventListener.teardownCallback();\n eventListener.teardownCallback = null;\n }\n }\n attachEventListener(nativeElement, eventName, callback, throttleInterval) {\n const listener = new EventListener();\n listener.eventName = eventName;\n listener.events = new Subject();\n const observerCallback = (event) => {\n listener.events.next(event);\n };\n listener.teardownCallback = this.renderer.listen(nativeElement, eventName, observerCallback);\n listener.eventsSubscription = listener.events\n .pipe((!ValueHelper.isNullOrUndefined(throttleInterval))\n ? throttleTime(throttleInterval, undefined, { leading: true, trailing: true })\n : tap(() => { }) // no-op\n )\n .subscribe((event) => { callback(event); });\n return listener;\n }\n}\n\nclass SliderElementDirective {\n elemRef;\n renderer;\n changeDetectionRef;\n _position = 0;\n get position() {\n return this._position;\n }\n _dimension = 0;\n get dimension() {\n return this._dimension;\n }\n _alwaysHide = false;\n get alwaysHide() {\n return this._alwaysHide;\n }\n _vertical = false;\n get vertical() {\n return this._vertical;\n }\n _scale = 1;\n get scale() {\n return this._scale;\n }\n _rotate = 0;\n get rotate() {\n return this._rotate;\n }\n opacity = 1;\n visibility = 'visible';\n left = '';\n bottom = '';\n height = '';\n width = '';\n transform = '';\n eventListenerHelper;\n eventListeners = [];\n constructor(elemRef, renderer, changeDetectionRef) {\n this.elemRef = elemRef;\n this.renderer = renderer;\n this.changeDetectionRef = changeDetectionRef;\n this.eventListenerHelper = new EventListenerHelper(this.renderer);\n }\n setAlwaysHide(hide) {\n this._alwaysHide = hide;\n if (hide) {\n this.visibility = 'hidden';\n }\n else {\n this.visibility = 'visible';\n }\n }\n hide() {\n this.opacity = 0;\n }\n show() {\n if (this.alwaysHide) {\n return;\n }\n this.opacity = 1;\n }\n isVisible() {\n if (this.alwaysHide) {\n return false;\n }\n return this.opacity !== 0;\n }\n setVertical(vertical) {\n this._vertical = vertical;\n if (this._vertical) {\n this.left = '';\n this.width = '';\n }\n else {\n this.bottom = '';\n this.height = '';\n }\n }\n setScale(scale) {\n this._scale = scale;\n }\n setRotate(rotate) {\n this._rotate = rotate;\n this.transform = 'rotate(' + rotate + 'deg)';\n }\n getRotate() {\n return this._rotate;\n }\n // Set element left/top position depending on whether slider is horizontal or vertical\n setPosition(pos) {\n if (this._position !== pos && !this.isRefDestroyed()) {\n this.changeDetectionRef.markForCheck();\n }\n this._position = pos;\n if (this._vertical) {\n this.bottom = Math.round(pos) + 'px';\n }\n else {\n this.left = Math.round(pos) + 'px';\n }\n }\n // Calculate element's width/height depending on whether slider is horizontal or vertical\n calculateDimension() {\n const val = this.getBoundingClientRect();\n if (this.vertical) {\n this._dimension = (val.bottom - val.top) * this.scale;\n }\n else {\n this._dimension = (val.right - val.left) * this.scale;\n }\n }\n // Set element width/height depending on whether slider is horizontal or vertical\n setDimension(dim) {\n if (this._dimension !== dim && !this.isRefDestroyed()) {\n this.changeDetectionRef.markForCheck();\n }\n this._dimension = dim;\n if (this._vertical) {\n this.height = Math.round(dim) + 'px';\n }\n else {\n this.width = Math.round(dim) + 'px';\n }\n }\n getBoundingClientRect() {\n return this.elemRef.nativeElement.getBoundingClientRect();\n }\n on(eventName, callback, debounceInterval) {\n const listener = this.eventListenerHelper.attachEventListener(this.elemRef.nativeElement, eventName, callback, debounceInterval);\n this.eventListeners.push(listener);\n }\n onPassive(eventName, callback, debounceInterval) {\n const listener = this.eventListenerHelper.attachPassiveEventListener(this.elemRef.nativeElement, eventName, callback, debounceInterval);\n this.eventListeners.push(listener);\n }\n off(eventName) {\n let listenersToKeep;\n let listenersToRemove;\n if (!ValueHelper.isNullOrUndefined(eventName)) {\n listenersToKeep = this.eventListeners.filter((event) => event.eventName !== eventName);\n listenersToRemove = this.eventListeners.filter((event) => event.eventName === eventName);\n }\n else {\n listenersToKeep = [];\n listenersToRemove = this.eventListeners;\n }\n for (const listener of listenersToRemove) {\n this.eventListenerHelper.detachEventListener(listener);\n }\n this.eventListeners = listenersToKeep;\n }\n isRefDestroyed() {\n return ValueHelper.isNullOrUndefined(this.changeDetectionRef) || this.changeDetectionRef['destroyed'];\n }\n static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"17.0.3\", ngImport: i0, type: SliderElementDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });\n static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"17.0.3\", type: SliderElementDirective, selector: \"[ngxSliderElement]\", host: { properties: { \"style.opacity\": \"this.opacity\", \"style.visibility\": \"this.visibility\", \"style.left\": \"this.left\", \"style.bottom\": \"this.bottom\", \"style.height\": \"this.height\", \"style.width\": \"this.width\", \"style.transform\": \"this.transform\" } }, ngImport: i0 });\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"17.0.3\", ngImport: i0, type: SliderElementDirective, decorators: [{\n type: Directive,\n args: [{\n selector: '[ngxSliderElement]'\n }]\n }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }], propDecorators: { opacity: [{\n type: HostBinding,\n args: ['style.opacity']\n }], visibility: [{\n type: HostBinding,\n args: ['style.visibility']\n }], left: [{\n type: HostBinding,\n args: ['style.left']\n }], bottom: [{\n type: HostBinding,\n args: ['style.bottom']\n }], height: [{\n type: HostBinding,\n args: ['style.height']\n }], width: [{\n type: HostBinding,\n args: ['style.width']\n }], transform: [{\n type: HostBinding,\n args: ['style.transform']\n }] } });\n\nclass SliderHandleDirective extends SliderElementDirective {\n active = false;\n role = \"\";\n tabindex = \"\";\n ariaOrientation = \"\";\n ariaLabel = \"\";\n ariaLabelledBy = \"\";\n ariaValueNow = \"\";\n ariaValueText = \"\";\n ariaValueMin = \"\";\n ariaValueMax = \"\";\n focus() {\n this.elemRef.nativeElement.focus();\n }\n constructor(elemRef, renderer, changeDetectionRef) {\n super(elemRef, renderer, changeDetectionRef);\n }\n static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"17.0.3\", ngImport: i0, type: SliderHandleDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });\n static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"17.0.3\", type: SliderHandleDirective, selector: \"[ngxSliderHandle]\", host: { properties: { \"class.ngx-slider-active\": \"this.active\", \"attr.role\": \"this.role\", \"attr.tabindex\": \"this.tabindex\", \"attr.aria-orientation\": \"this.ariaOrientation\", \"attr.aria-label\": \"this.ariaLabel\", \"attr.aria-labelledby\": \"this.ariaLabelledBy\", \"attr.aria-valuenow\": \"this.ariaValueNow\", \"attr.aria-valuetext\": \"this.ariaValueText\", \"attr.aria-valuemin\": \"this.ariaValueMin\", \"attr.aria-valuemax\": \"this.ariaValueMax\" } }, usesInheritance: true, ngImport: i0 });\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"17.0.3\", ngImport: i0, type: SliderHandleDirective, decorators: [{\n type: Directive,\n args: [{\n selector: \"[ngxSliderHandle]\",\n }]\n }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }], propDecorators: { active: [{\n type: HostBinding,\n args: [\"class.ngx-slider-active\"]\n }], role: [{\n type: HostBinding,\n args: [\"attr.role\"]\n }], tabindex: [{\n type: HostBinding,\n args: [\"attr.tabindex\"]\n }], ariaOrientation: [{\n type: HostBinding,\n args: [\"attr.aria-orientation\"]\n }], ariaLabel: [{\n type: HostBinding,\n args: [\"attr.aria-label\"]\n }], ariaLabelledBy: [{\n type: HostBinding,\n args: [\"attr.aria-labelledby\"]\n }], ariaValueNow: [{\n type: HostBinding,\n args: [\"attr.aria-valuenow\"]\n }], ariaValueText: [{\n type: HostBinding,\n args: [\"attr.aria-valuetext\"]\n }], ariaValueMin: [{\n type: HostBinding,\n args: [\"attr.aria-valuemin\"]\n }], ariaValueMax: [{\n type: HostBinding,\n args: [\"attr.aria-valuemax\"]\n }] } });\n\nclass SliderLabelDirective extends SliderElementDirective {\n allowUnsafeHtmlInSlider;\n _value = null;\n get value() {\n return this._value;\n }\n constructor(elemRef, renderer, changeDetectionRef, allowUnsafeHtmlInSlider) {\n super(elemRef, renderer, changeDetectionRef);\n this.allowUnsafeHtmlInSlider = allowUnsafeHtmlInSlider;\n }\n setValue(value) {\n let recalculateDimension = false;\n if (!this.alwaysHide &&\n (ValueHelper.isNullOrUndefined(this.value) ||\n this.value.length !== value.length ||\n (this.value.length > 0 && this.dimension === 0))) {\n recalculateDimension = true;\n }\n this._value = value;\n if (this.allowUnsafeHtmlInSlider === false) {\n this.elemRef.nativeElement.innerText = value;\n }\n else {\n this.elemRef.nativeElement.innerHTML = value;\n }\n // Update dimension only when length of the label have changed\n if (recalculateDimension) {\n this.calculateDimension();\n }\n }\n static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"17.0.3\", ngImport: i0, type: SliderLabelDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: AllowUnsafeHtmlInSlider, optional: true }], target: i0.ɵɵFactoryTarget.Directive });\n static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"17.0.3\", type: SliderLabelDirective, selector: \"[ngxSliderLabel]\", usesInheritance: true, ngImport: i0 });\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"17.0.3\", ngImport: i0, type: SliderLabelDirective, decorators: [{\n type: Directive,\n args: [{\n selector: \"[ngxSliderLabel]\",\n }]\n }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{\n type: Inject,\n args: [AllowUnsafeHtmlInSlider]\n }, {\n type: Optional\n }] }] });\n\nclass TooltipWrapperComponent {\n template;\n tooltip;\n placement;\n content;\n static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"17.0.3\", ngImport: i0, type: TooltipWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });\n static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: \"14.0.0\", version: \"17.0.3\", type: TooltipWrapperComponent, selector: \"ngx-slider-tooltip-wrapper\", inputs: { template: \"template\", tooltip: \"tooltip\", placement: \"placement\", content: \"content\" }, ngImport: i0, template: \"\\n \\n\\n\\n\\n
\\n {{content}}\\n
\\n
\", styles: [\".ngx-slider-inner-tooltip{height:100%}\\n\"], dependencies: [{ kind: \"directive\", type: i1.NgIf, selector: \"[ngIf]\", inputs: [\"ngIf\", \"ngIfThen\", \"ngIfElse\"] }, { kind: \"directive\", type: i1.NgTemplateOutlet, selector: \"[ngTemplateOutlet]\", inputs: [\"ngTemplateOutletContext\", \"ngTemplateOutlet\", \"ngTemplateOutletInjector\"] }] });\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"17.0.3\", ngImport: i0, type: TooltipWrapperComponent, decorators: [{\n type: Component,\n args: [{ selector: 'ngx-slider-tooltip-wrapper', template: \"\\n \\n\\n\\n\\n
\\n {{content}}\\n
\\n
\", styles: [\".ngx-slider-inner-tooltip{height:100%}\\n\"] }]\n }], propDecorators: { template: [{\n type: Input\n }], tooltip: [{\n type: Input\n }], placement: [{\n type: Input\n }], content: [{\n type: Input\n }] } });\n\nclass Tick {\n selected = false;\n style = {};\n tooltip = null;\n tooltipPlacement = null;\n value = null;\n valueTooltip = null;\n valueTooltipPlacement = null;\n legend = null;\n}\nclass Dragging {\n active = false;\n value = 0;\n difference = 0;\n position = 0;\n lowLimit = 0;\n highLimit = 0;\n}\nclass ModelValues {\n value;\n highValue;\n static compare(x, y) {\n if (ValueHelper.isNullOrUndefined(x) && ValueHelper.isNullOrUndefined(y)) {\n return false;\n }\n if (ValueHelper.isNullOrUndefined(x) !== ValueHelper.isNullOrUndefined(y)) {\n return false;\n }\n return x.value === y.value && x.highValue === y.highValue;\n }\n}\nclass ModelChange extends ModelValues {\n // Flag used to by-pass distinctUntilChanged() filter on input values\n // (sometimes there is a need to pass values through even though the model values have not changed)\n forceChange;\n static compare(x, y) {\n if (ValueHelper.isNullOrUndefined(x) && ValueHelper.isNullOrUndefined(y)) {\n return false;\n }\n if (ValueHelper.isNullOrUndefined(x) !== ValueHelper.isNullOrUndefined(y)) {\n return false;\n }\n return (x.value === y.value &&\n x.highValue === y.highValue &&\n x.forceChange === y.forceChange);\n }\n}\nclass InputModelChange extends ModelChange {\n internalChange;\n}\nclass OutputModelChange extends ModelChange {\n userEventInitiated;\n}\nconst NGX_SLIDER_CONTROL_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n /* tslint:disable-next-line: no-use-before-declare */\n useExisting: forwardRef(() => SliderComponent),\n multi: true,\n};\nclass SliderComponent {\n renderer;\n elementRef;\n changeDetectionRef;\n zone;\n allowUnsafeHtmlInSlider;\n // Model for low value of slider. For simple slider, this is the only input. For range slider, this is the low value.\n value = null;\n // Output for low value slider to support two-way bindings\n valueChange = new EventEmitter();\n // Model for high value of slider. Not used in simple slider. For range slider, this is the high value.\n highValue = null;\n // Output for high value slider to support two-way bindings\n highValueChange = new EventEmitter();\n // An object with all the other options of the slider.\n // Each option can be updated at runtime and the slider will automatically be re-rendered.\n options = new Options();\n // Event emitted when user starts interaction with the slider\n userChangeStart = new EventEmitter();\n // Event emitted on each change coming from user interaction\n userChange = new EventEmitter();\n // Event emitted when user finishes interaction with the slider\n userChangeEnd = new EventEmitter();\n manualRefreshSubscription;\n // Input event that triggers slider refresh (re-positioning of slider elements)\n set manualRefresh(manualRefresh) {\n this.unsubscribeManualRefresh();\n this.manualRefreshSubscription = manualRefresh.subscribe(() => {\n setTimeout(() => this.calculateViewDimensionsAndDetectChanges());\n });\n }\n triggerFocusSubscription;\n // Input event that triggers setting focus on given slider handle\n set triggerFocus(triggerFocus) {\n this.unsubscribeTriggerFocus();\n this.triggerFocusSubscription = triggerFocus.subscribe((pointerType) => {\n this.focusPointer(pointerType);\n });\n }\n // Slider type, true means range slider\n get range() {\n return (!ValueHelper.isNullOrUndefined(this.value) &&\n !ValueHelper.isNullOrUndefined(this.highValue));\n }\n // Set to true if init method already executed\n initHasRun = false;\n // Changes in model inputs are passed through this subject\n // These are all changes coming in from outside the component through input bindings or reactive form inputs\n inputModelChangeSubject = new Subject();\n inputModelChangeSubscription = null;\n // Changes to model outputs are passed through this subject\n // These are all changes that need to be communicated to output emitters and registered callbacks\n outputModelChangeSubject = new Subject();\n outputModelChangeSubscription = null;\n // Low value synced to model low value\n viewLowValue = null;\n // High value synced to model high value\n viewHighValue = null;\n // Options synced to model options, based on defaults\n viewOptions = new Options();\n // Half of the width or height of the slider handles\n handleHalfDimension = 0;\n // Maximum position the slider handle can have\n maxHandlePosition = 0;\n // Which handle is currently tracked for move events\n currentTrackingPointer = null;\n // Internal variable to keep track of the focus element\n currentFocusPointer = null;\n // Used to call onStart on the first keydown event\n firstKeyDown = false;\n // Current touch id of touch event being handled\n touchId = null;\n // Values recorded when first dragging the bar\n dragging = new Dragging();\n /* Slider DOM elements */\n // Left selection bar outside two handles\n leftOuterSelectionBarElement;\n // Right selection bar outside two handles\n rightOuterSelectionBarElement;\n // The whole slider bar\n fullBarElement;\n // Highlight between two handles\n selectionBarElement;\n // Left slider handle\n minHandleElement;\n // Right slider handle\n maxHandleElement;\n // Floor label\n floorLabelElement;\n // Ceiling label\n ceilLabelElement;\n // Label above the low value\n minHandleLabelElement;\n // Label above the high value\n maxHandleLabelElement;\n // Combined label\n combinedLabelElement;\n // The ticks\n ticksElement;\n // Optional custom template for displaying tooltips\n tooltipTemplate;\n // Host element class bindings\n sliderElementVerticalClass = false;\n sliderElementAnimateClass = false;\n sliderElementWithLegendClass = false;\n sliderElementDisabledAttr = null;\n sliderElementAriaLabel = \"ngx-slider\";\n // CSS styles and class flags\n barStyle = {};\n minPointerStyle = {};\n maxPointerStyle = {};\n fullBarTransparentClass = false;\n selectionBarDraggableClass = false;\n ticksUnderValuesClass = false;\n // Whether to show/hide ticks\n get showTicks() {\n return this.viewOptions.showTicks;\n }\n /* If tickStep is set or ticksArray is specified.\n In this case, ticks values should be displayed below the slider. */\n intermediateTicks = false;\n // Ticks array as displayed in view\n ticks = [];\n // Event listeners\n eventListenerHelper = null;\n onMoveEventListener = null;\n onEndEventListener = null;\n // Whether currently moving the slider (between onStart() and onEnd())\n moving = false;\n // Observer for slider element resize events\n resizeObserver = null;\n // Callbacks for reactive forms support\n onTouchedCallback = null;\n onChangeCallback = null;\n constructor(renderer, elementRef, changeDetectionRef, zone, allowUnsafeHtmlInSlider) {\n this.renderer = renderer;\n this.elementRef = elementRef;\n this.changeDetectionRef = changeDetectionRef;\n this.zone = zone;\n this.allowUnsafeHtmlInSlider = allowUnsafeHtmlInSlider;\n this.eventListenerHelper = new EventListenerHelper(this.renderer);\n }\n // OnInit interface\n ngOnInit() {\n this.viewOptions = new Options();\n Object.assign(this.viewOptions, this.options);\n // We need to run these two things first, before the rest of the init in ngAfterViewInit(),\n // because these two settings are set through @HostBinding and Angular change detection\n // mechanism doesn't like them changing in ngAfterViewInit()\n this.updateDisabledState();\n this.updateVerticalState();\n this.updateAriaLabel();\n }\n // AfterViewInit interface\n ngAfterViewInit() {\n this.applyOptions();\n this.subscribeInputModelChangeSubject();\n this.subscribeOutputModelChangeSubject();\n // Once we apply options, we need to normalise model values for the first time\n this.renormaliseModelValues();\n this.viewLowValue = this.modelValueToViewValue(this.value);\n if (this.range) {\n this.viewHighValue = this.modelValueToViewValue(this.highValue);\n }\n else {\n this.viewHighValue = null;\n }\n this.updateVerticalState(); // need to run this again to cover changes to slider elements\n this.manageElementsStyle();\n this.updateDisabledState();\n this.calculateViewDimensions();\n this.addAccessibility();\n this.updateCeilLabel();\n this.updateFloorLabel();\n this.initHandles();\n this.manageEventsBindings();\n this.updateAriaLabel();\n this.subscribeResizeObserver();\n this.initHasRun = true;\n // Run change detection manually to resolve some issues when init procedure changes values used in the view\n if (!this.isRefDestroyed()) {\n this.changeDetectionRef.detectChanges();\n }\n }\n // OnChanges interface\n ngOnChanges(changes) {\n // Always apply options first\n if (!ValueHelper.isNullOrUndefined(changes.options) &&\n JSON.stringify(changes.options.previousValue) !==\n JSON.stringify(changes.options.currentValue)) {\n this.onChangeOptions();\n }\n // Then value changes\n if (!ValueHelper.isNullOrUndefined(changes.value) ||\n !ValueHelper.isNullOrUndefined(changes.highValue)) {\n this.inputModelChangeSubject.next({\n value: this.value,\n highValue: this.highValue,\n forceChange: false,\n internalChange: false,\n });\n }\n }\n // OnDestroy interface\n ngOnDestroy() {\n this.unbindEvents();\n this.unsubscribeResizeObserver();\n this.unsubscribeInputModelChangeSubject();\n this.unsubscribeOutputModelChangeSubject();\n this.unsubscribeManualRefresh();\n this.unsubscribeTriggerFocus();\n }\n // ControlValueAccessor interface\n writeValue(obj) {\n if (obj instanceof Array) {\n this.value = obj[0];\n this.highValue = obj[1];\n }\n else {\n this.value = obj;\n }\n // ngOnChanges() is not called in this instance, so we need to communicate the change manually\n this.inputModelChangeSubject.next({\n value: this.value,\n highValue: this.highValue,\n forceChange: false,\n internalChange: false,\n });\n }\n // ControlValueAccessor interface\n registerOnChange(onChangeCallback) {\n this.onChangeCallback = onChangeCallback;\n }\n // ControlValueAccessor interface\n registerOnTouched(onTouchedCallback) {\n this.onTouchedCallback = onTouchedCallback;\n }\n // ControlValueAccessor interface\n setDisabledState(isDisabled) {\n this.viewOptions.disabled = isDisabled;\n this.updateDisabledState();\n }\n setAriaLabel(ariaLabel) {\n this.viewOptions.ariaLabel = ariaLabel;\n this.updateAriaLabel();\n }\n onResize(event) {\n this.calculateViewDimensionsAndDetectChanges();\n }\n subscribeInputModelChangeSubject() {\n this.inputModelChangeSubscription = this.inputModelChangeSubject\n .pipe(distinctUntilChanged(ModelChange.compare), \n // Hack to reset the status of the distinctUntilChanged() - if a \"fake\" event comes through with forceChange=true,\n // we forcefully by-pass distinctUntilChanged(), but otherwise drop the event\n filter((modelChange) => !modelChange.forceChange && !modelChange.internalChange))\n .subscribe((modelChange) => this.applyInputModelChange(modelChange));\n }\n subscribeOutputModelChangeSubject() {\n this.outputModelChangeSubscription = this.outputModelChangeSubject\n .pipe(distinctUntilChanged(ModelChange.compare))\n .subscribe((modelChange) => this.publishOutputModelChange(modelChange));\n }\n subscribeResizeObserver() {\n if (CompatibilityHelper.isResizeObserverAvailable()) {\n this.resizeObserver = new ResizeObserver(() => this.calculateViewDimensionsAndDetectChanges());\n this.resizeObserver.observe(this.elementRef.nativeElement);\n }\n }\n unsubscribeResizeObserver() {\n if (CompatibilityHelper.isResizeObserverAvailable() &&\n this.resizeObserver !== null) {\n this.resizeObserver.disconnect();\n this.resizeObserver = null;\n }\n }\n unsubscribeOnMove() {\n if (!ValueHelper.isNullOrUndefined(this.onMoveEventListener)) {\n this.eventListenerHelper.detachEventListener(this.onMoveEventListener);\n this.onMoveEventListener = null;\n }\n }\n unsubscribeOnEnd() {\n if (!ValueHelper.isNullOrUndefined(this.onEndEventListener)) {\n this.eventListenerHelper.detachEventListener(this.onEndEventListener);\n this.onEndEventListener = null;\n }\n }\n unsubscribeInputModelChangeSubject() {\n if (!ValueHelper.isNullOrUndefined(this.inputModelChangeSubscription)) {\n this.inputModelChangeSubscription.unsubscribe();\n this.inputModelChangeSubscription = null;\n }\n }\n unsubscribeOutputModelChangeSubject() {\n if (!ValueHelper.isNullOrUndefined(this.outputModelChangeSubscription)) {\n this.outputModelChangeSubscription.unsubscribe();\n this.outputModelChangeSubscription = null;\n }\n }\n unsubscribeManualRefresh() {\n if (!ValueHelper.isNullOrUndefined(this.manualRefreshSubscription)) {\n this.manualRefreshSubscription.unsubscribe();\n this.manualRefreshSubscription = null;\n }\n }\n unsubscribeTriggerFocus() {\n if (!ValueHelper.isNullOrUndefined(this.triggerFocusSubscription)) {\n this.triggerFocusSubscription.unsubscribe();\n this.triggerFocusSubscription = null;\n }\n }\n getPointerElement(pointerType) {\n if (pointerType === PointerType.Min) {\n return this.minHandleElement;\n }\n else if (pointerType === PointerType.Max) {\n return this.maxHandleElement;\n }\n return null;\n }\n getCurrentTrackingValue() {\n if (this.currentTrackingPointer === PointerType.Min) {\n return this.viewLowValue;\n }\n else if (this.currentTrackingPointer === PointerType.Max) {\n return this.viewHighValue;\n }\n return null;\n }\n modelValueToViewValue(modelValue) {\n if (ValueHelper.isNullOrUndefined(modelValue)) {\n return NaN;\n }\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.stepsArray) &&\n !this.viewOptions.bindIndexForStepsArray) {\n return ValueHelper.findStepIndex(+modelValue, this.viewOptions.stepsArray);\n }\n return +modelValue;\n }\n viewValueToModelValue(viewValue) {\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.stepsArray) &&\n !this.viewOptions.bindIndexForStepsArray) {\n return this.getStepValue(viewValue);\n }\n return viewValue;\n }\n getStepValue(sliderValue) {\n const step = this.viewOptions.stepsArray[sliderValue];\n return !ValueHelper.isNullOrUndefined(step) ? step.value : NaN;\n }\n applyViewChange() {\n this.value = this.viewValueToModelValue(this.viewLowValue);\n if (this.range) {\n this.highValue = this.viewValueToModelValue(this.viewHighValue);\n }\n this.outputModelChangeSubject.next({\n value: this.value,\n highValue: this.highValue,\n userEventInitiated: true,\n forceChange: false,\n });\n // At this point all changes are applied and outputs are emitted, so we should be done.\n // However, input changes are communicated in different stream and we need to be ready to\n // act on the next input change even if it is exactly the same as last input change.\n // Therefore, we send a special event to reset the stream.\n this.inputModelChangeSubject.next({\n value: this.value,\n highValue: this.highValue,\n forceChange: false,\n internalChange: true,\n });\n }\n // Apply model change to the slider view\n applyInputModelChange(modelChange) {\n const normalisedModelChange = this.normaliseModelValues(modelChange);\n // If normalised model change is different, apply the change to the model values\n const normalisationChange = !ModelValues.compare(modelChange, normalisedModelChange);\n if (normalisationChange) {\n this.value = normalisedModelChange.value;\n this.highValue = normalisedModelChange.highValue;\n }\n this.viewLowValue = this.modelValueToViewValue(normalisedModelChange.value);\n if (this.range) {\n this.viewHighValue = this.modelValueToViewValue(normalisedModelChange.highValue);\n }\n else {\n this.viewHighValue = null;\n }\n this.updateLowHandle(this.valueToPosition(this.viewLowValue));\n if (this.range) {\n this.updateHighHandle(this.valueToPosition(this.viewHighValue));\n }\n this.updateSelectionBar();\n this.updateTicksScale();\n this.updateAriaAttributes();\n if (this.range) {\n this.updateCombinedLabel();\n }\n // At the end, we need to communicate the model change to the outputs as well\n // Normalisation changes are also always forced out to ensure that subscribers always end up in correct state\n this.outputModelChangeSubject.next({\n value: normalisedModelChange.value,\n highValue: normalisedModelChange.highValue,\n forceChange: normalisationChange,\n userEventInitiated: false,\n });\n }\n // Publish model change to output event emitters and registered callbacks\n publishOutputModelChange(modelChange) {\n const emitOutputs = () => {\n this.valueChange.emit(modelChange.value);\n if (this.range) {\n this.highValueChange.emit(modelChange.highValue);\n }\n if (!ValueHelper.isNullOrUndefined(this.onChangeCallback)) {\n if (this.range) {\n this.onChangeCallback([modelChange.value, modelChange.highValue]);\n }\n else {\n this.onChangeCallback(modelChange.value);\n }\n }\n if (!ValueHelper.isNullOrUndefined(this.onTouchedCallback)) {\n if (this.range) {\n this.onTouchedCallback([modelChange.value, modelChange.highValue]);\n }\n else {\n this.onTouchedCallback(modelChange.value);\n }\n }\n };\n if (modelChange.userEventInitiated) {\n // If this change was initiated by a user event, we can emit outputs in the same tick\n emitOutputs();\n this.userChange.emit(this.getChangeContext());\n }\n else {\n // But, if the change was initated by something else like a change in input bindings,\n // we need to wait until next tick to emit the outputs to keep Angular change detection happy\n setTimeout(() => {\n emitOutputs();\n });\n }\n }\n normaliseModelValues(input) {\n const normalisedInput = new ModelValues();\n normalisedInput.value = input.value;\n normalisedInput.highValue = input.highValue;\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.stepsArray)) {\n // When using steps array, only round to nearest step in the array\n // No other enforcement can be done, as the step array may be out of order, and that is perfectly fine\n if (this.viewOptions.enforceStepsArray) {\n const valueIndex = ValueHelper.findStepIndex(normalisedInput.value, this.viewOptions.stepsArray);\n normalisedInput.value = this.viewOptions.stepsArray[valueIndex].value;\n if (this.range) {\n const highValueIndex = ValueHelper.findStepIndex(normalisedInput.highValue, this.viewOptions.stepsArray);\n normalisedInput.highValue =\n this.viewOptions.stepsArray[highValueIndex].value;\n }\n }\n return normalisedInput;\n }\n if (this.viewOptions.enforceStep) {\n normalisedInput.value = this.roundStep(normalisedInput.value);\n if (this.range) {\n normalisedInput.highValue = this.roundStep(normalisedInput.highValue);\n }\n }\n if (this.viewOptions.enforceRange) {\n normalisedInput.value = MathHelper.clampToRange(normalisedInput.value, this.viewOptions.floor, this.viewOptions.ceil);\n if (this.range) {\n normalisedInput.highValue = MathHelper.clampToRange(normalisedInput.highValue, this.viewOptions.floor, this.viewOptions.ceil);\n }\n // Make sure that range slider invariant (value <= highValue) is always satisfied\n if (this.range && input.value > input.highValue) {\n // We know that both values are now clamped correctly, they may just be in the wrong order\n // So the easy solution is to swap them... except swapping is sometimes disabled in options, so we make the two values the same\n if (this.viewOptions.noSwitching) {\n normalisedInput.value = normalisedInput.highValue;\n }\n else {\n const tempValue = input.value;\n normalisedInput.value = input.highValue;\n normalisedInput.highValue = tempValue;\n }\n }\n }\n return normalisedInput;\n }\n renormaliseModelValues() {\n const previousModelValues = {\n value: this.value,\n highValue: this.highValue,\n };\n const normalisedModelValues = this.normaliseModelValues(previousModelValues);\n if (!ModelValues.compare(normalisedModelValues, previousModelValues)) {\n this.value = normalisedModelValues.value;\n this.highValue = normalisedModelValues.highValue;\n this.outputModelChangeSubject.next({\n value: this.value,\n highValue: this.highValue,\n forceChange: true,\n userEventInitiated: false,\n });\n }\n }\n onChangeOptions() {\n if (!this.initHasRun) {\n return;\n }\n const previousOptionsInfluencingEventBindings = this.getOptionsInfluencingEventBindings(this.viewOptions);\n this.applyOptions();\n const newOptionsInfluencingEventBindings = this.getOptionsInfluencingEventBindings(this.viewOptions);\n // Avoid re-binding events in case nothing changes that can influence it\n // It makes it possible to change options while dragging the slider\n const rebindEvents = !ValueHelper.areArraysEqual(previousOptionsInfluencingEventBindings, newOptionsInfluencingEventBindings);\n // With new options, we need to re-normalise model values if necessary\n this.renormaliseModelValues();\n this.viewLowValue = this.modelValueToViewValue(this.value);\n if (this.range) {\n this.viewHighValue = this.modelValueToViewValue(this.highValue);\n }\n else {\n this.viewHighValue = null;\n }\n this.resetSlider(rebindEvents);\n }\n // Read the user options and apply them to the slider model\n applyOptions() {\n this.viewOptions = new Options();\n Object.assign(this.viewOptions, this.options);\n this.viewOptions.draggableRange =\n this.range && this.viewOptions.draggableRange;\n this.viewOptions.draggableRangeOnly =\n this.range && this.viewOptions.draggableRangeOnly;\n if (this.viewOptions.draggableRangeOnly) {\n this.viewOptions.draggableRange = true;\n }\n this.viewOptions.showTicks =\n this.viewOptions.showTicks ||\n this.viewOptions.showTicksValues ||\n !ValueHelper.isNullOrUndefined(this.viewOptions.ticksArray);\n if (this.viewOptions.showTicks &&\n (!ValueHelper.isNullOrUndefined(this.viewOptions.tickStep) ||\n !ValueHelper.isNullOrUndefined(this.viewOptions.ticksArray))) {\n this.intermediateTicks = true;\n }\n this.viewOptions.showSelectionBar =\n this.viewOptions.showSelectionBar ||\n this.viewOptions.showSelectionBarEnd ||\n !ValueHelper.isNullOrUndefined(this.viewOptions.showSelectionBarFromValue);\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.stepsArray)) {\n this.applyStepsArrayOptions();\n }\n else {\n this.applyFloorCeilOptions();\n }\n if (ValueHelper.isNullOrUndefined(this.viewOptions.combineLabels)) {\n this.viewOptions.combineLabels = (minValue, maxValue) => {\n return minValue + \" - \" + maxValue;\n };\n }\n if (this.viewOptions.logScale && this.viewOptions.floor === 0) {\n throw Error(\"Can't use floor=0 with logarithmic scale\");\n }\n }\n applyStepsArrayOptions() {\n this.viewOptions.floor = 0;\n this.viewOptions.ceil = this.viewOptions.stepsArray.length - 1;\n this.viewOptions.step = 1;\n if (ValueHelper.isNullOrUndefined(this.viewOptions.translate)) {\n this.viewOptions.translate = (modelValue) => {\n if (this.viewOptions.bindIndexForStepsArray) {\n return String(this.getStepValue(modelValue));\n }\n return String(modelValue);\n };\n }\n }\n applyFloorCeilOptions() {\n if (ValueHelper.isNullOrUndefined(this.viewOptions.step)) {\n this.viewOptions.step = 1;\n }\n else {\n this.viewOptions.step = +this.viewOptions.step;\n if (this.viewOptions.step <= 0) {\n this.viewOptions.step = 1;\n }\n }\n if (ValueHelper.isNullOrUndefined(this.viewOptions.ceil) ||\n ValueHelper.isNullOrUndefined(this.viewOptions.floor)) {\n throw Error(\"floor and ceil options must be supplied\");\n }\n this.viewOptions.ceil = +this.viewOptions.ceil;\n this.viewOptions.floor = +this.viewOptions.floor;\n if (ValueHelper.isNullOrUndefined(this.viewOptions.translate)) {\n this.viewOptions.translate = (value) => String(value);\n }\n }\n // Resets slider\n resetSlider(rebindEvents = true) {\n this.manageElementsStyle();\n this.addAccessibility();\n this.updateCeilLabel();\n this.updateFloorLabel();\n if (rebindEvents) {\n this.unbindEvents();\n this.manageEventsBindings();\n }\n this.updateDisabledState();\n this.updateAriaLabel();\n this.calculateViewDimensions();\n // this.refocusPointerIfNeeded();\n }\n // Sets focus on the specified pointer\n focusPointer(pointerType) {\n // If not supplied, use min pointer as default\n if (pointerType !== PointerType.Min && pointerType !== PointerType.Max) {\n pointerType = PointerType.Min;\n }\n if (pointerType === PointerType.Min) {\n this.minHandleElement.focus();\n }\n else if (this.range && pointerType === PointerType.Max) {\n this.maxHandleElement.focus();\n }\n }\n refocusPointerIfNeeded() {\n if (!ValueHelper.isNullOrUndefined(this.currentFocusPointer)) {\n this.onPointerFocus(this.currentFocusPointer);\n const element = this.getPointerElement(this.currentFocusPointer);\n element.focus();\n }\n }\n // Update each elements style based on options\n manageElementsStyle() {\n this.updateScale();\n this.floorLabelElement.setAlwaysHide(this.viewOptions.showTicksValues || this.viewOptions.hideLimitLabels);\n this.ceilLabelElement.setAlwaysHide(this.viewOptions.showTicksValues || this.viewOptions.hideLimitLabels);\n const hideLabelsForTicks = this.viewOptions.showTicksValues && !this.intermediateTicks;\n this.minHandleLabelElement.setAlwaysHide(hideLabelsForTicks || this.viewOptions.hidePointerLabels);\n this.maxHandleLabelElement.setAlwaysHide(hideLabelsForTicks || !this.range || this.viewOptions.hidePointerLabels);\n this.combinedLabelElement.setAlwaysHide(hideLabelsForTicks || !this.range || this.viewOptions.hidePointerLabels);\n this.selectionBarElement.setAlwaysHide(!this.range && !this.viewOptions.showSelectionBar);\n this.leftOuterSelectionBarElement.setAlwaysHide(!this.range || !this.viewOptions.showOuterSelectionBars);\n this.rightOuterSelectionBarElement.setAlwaysHide(!this.range || !this.viewOptions.showOuterSelectionBars);\n this.fullBarTransparentClass =\n this.range && this.viewOptions.showOuterSelectionBars;\n this.selectionBarDraggableClass =\n this.viewOptions.draggableRange && !this.viewOptions.onlyBindHandles;\n this.ticksUnderValuesClass =\n this.intermediateTicks && this.options.showTicksValues;\n if (this.sliderElementVerticalClass !== this.viewOptions.vertical) {\n this.updateVerticalState();\n // The above change in host component class will not be applied until the end of this cycle\n // However, functions calculating the slider position expect the slider to be already styled as vertical\n // So as a workaround, we need to reset the slider once again to compute the correct values\n setTimeout(() => {\n this.resetSlider();\n });\n }\n // Changing animate class may interfere with slider reset/initialisation, so we should set it separately,\n // after all is properly set up\n if (this.sliderElementAnimateClass !== this.viewOptions.animate) {\n setTimeout(() => {\n this.sliderElementAnimateClass = this.viewOptions.animate;\n });\n }\n this.updateRotate();\n }\n // Manage the events bindings based on readOnly and disabled options\n manageEventsBindings() {\n if (this.viewOptions.disabled || this.viewOptions.readOnly) {\n this.unbindEvents();\n }\n else {\n this.bindEvents();\n }\n }\n // Set the disabled state based on disabled option\n updateDisabledState() {\n this.sliderElementDisabledAttr = this.viewOptions.disabled\n ? \"disabled\"\n : null;\n }\n // Set the aria-label state based on ariaLabel option\n updateAriaLabel() {\n this.sliderElementAriaLabel = this.viewOptions.ariaLabel || \"nxg-slider\";\n }\n // Set vertical state based on vertical option\n updateVerticalState() {\n this.sliderElementVerticalClass = this.viewOptions.vertical;\n for (const element of this.getAllSliderElements()) {\n // This is also called before ngAfterInit, so need to check that view child bindings work\n if (!ValueHelper.isNullOrUndefined(element)) {\n element.setVertical(this.viewOptions.vertical);\n }\n }\n }\n updateScale() {\n for (const element of this.getAllSliderElements()) {\n element.setScale(this.viewOptions.scale);\n }\n }\n updateRotate() {\n for (const element of this.getAllSliderElements()) {\n element.setRotate(this.viewOptions.rotate);\n }\n }\n getAllSliderElements() {\n return [\n this.leftOuterSelectionBarElement,\n this.rightOuterSelectionBarElement,\n this.fullBarElement,\n this.selectionBarElement,\n this.minHandleElement,\n this.maxHandleElement,\n this.floorLabelElement,\n this.ceilLabelElement,\n this.minHandleLabelElement,\n this.maxHandleLabelElement,\n this.combinedLabelElement,\n this.ticksElement,\n ];\n }\n // Initialize slider handles positions and labels\n // Run only once during initialization and every time view port changes size\n initHandles() {\n this.updateLowHandle(this.valueToPosition(this.viewLowValue));\n /*\n the order here is important since the selection bar should be\n updated after the high handle but before the combined label\n */\n if (this.range) {\n this.updateHighHandle(this.valueToPosition(this.viewHighValue));\n }\n this.updateSelectionBar();\n if (this.range) {\n this.updateCombinedLabel();\n }\n this.updateTicksScale();\n }\n // Adds accessibility attributes, run only once during initialization\n addAccessibility() {\n this.updateAriaAttributes();\n this.minHandleElement.role = \"slider\";\n if (this.viewOptions.keyboardSupport &&\n !(this.viewOptions.readOnly || this.viewOptions.disabled)) {\n this.minHandleElement.tabindex = \"0\";\n }\n else {\n this.minHandleElement.tabindex = \"\";\n }\n this.minHandleElement.ariaOrientation =\n this.viewOptions.vertical || this.viewOptions.rotate !== 0\n ? \"vertical\"\n : \"horizontal\";\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.ariaLabel)) {\n this.minHandleElement.ariaLabel = this.viewOptions.ariaLabel;\n }\n else if (!ValueHelper.isNullOrUndefined(this.viewOptions.ariaLabelledBy)) {\n this.minHandleElement.ariaLabelledBy = this.viewOptions.ariaLabelledBy;\n }\n if (this.range) {\n this.maxHandleElement.role = \"slider\";\n if (this.viewOptions.keyboardSupport &&\n !(this.viewOptions.readOnly || this.viewOptions.disabled)) {\n this.maxHandleElement.tabindex = \"0\";\n }\n else {\n this.maxHandleElement.tabindex = \"\";\n }\n this.maxHandleElement.ariaOrientation =\n this.viewOptions.vertical || this.viewOptions.rotate !== 0\n ? \"vertical\"\n : \"horizontal\";\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.ariaLabelHigh)) {\n this.maxHandleElement.ariaLabel = this.viewOptions.ariaLabelHigh;\n }\n else if (!ValueHelper.isNullOrUndefined(this.viewOptions.ariaLabelledByHigh)) {\n this.maxHandleElement.ariaLabelledBy =\n this.viewOptions.ariaLabelledByHigh;\n }\n }\n }\n // Updates aria attributes according to current values\n updateAriaAttributes() {\n this.minHandleElement.ariaValueNow = (+this.value).toString();\n this.minHandleElement.ariaValueText = this.viewOptions.translate(+this.value, LabelType.Low);\n this.minHandleElement.ariaValueMin = this.viewOptions.floor.toString();\n this.minHandleElement.ariaValueMax = this.viewOptions.ceil.toString();\n if (this.range) {\n this.maxHandleElement.ariaValueNow = (+this.highValue).toString();\n this.maxHandleElement.ariaValueText = this.viewOptions.translate(+this.highValue, LabelType.High);\n this.maxHandleElement.ariaValueMin = this.viewOptions.floor.toString();\n this.maxHandleElement.ariaValueMax = this.viewOptions.ceil.toString();\n }\n }\n // Calculate dimensions that are dependent on view port size\n // Run once during initialization and every time view port changes size.\n calculateViewDimensions() {\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.handleDimension)) {\n this.minHandleElement.setDimension(this.viewOptions.handleDimension);\n }\n else {\n this.minHandleElement.calculateDimension();\n }\n const handleWidth = this.minHandleElement.dimension;\n this.handleHalfDimension = handleWidth / 2;\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.barDimension)) {\n this.fullBarElement.setDimension(this.viewOptions.barDimension);\n }\n else {\n this.fullBarElement.calculateDimension();\n }\n this.maxHandlePosition = this.fullBarElement.dimension - handleWidth;\n if (this.initHasRun) {\n this.updateFloorLabel();\n this.updateCeilLabel();\n this.initHandles();\n }\n }\n calculateViewDimensionsAndDetectChanges() {\n this.calculateViewDimensions();\n if (!this.isRefDestroyed()) {\n this.changeDetectionRef.detectChanges();\n }\n }\n /**\n * If the slider reference is already destroyed\n * @returns boolean - true if ref is destroyed\n */\n isRefDestroyed() {\n return this.changeDetectionRef[\"destroyed\"];\n }\n // Update the ticks position\n updateTicksScale() {\n if (!this.viewOptions.showTicks && this.sliderElementWithLegendClass) {\n setTimeout(() => {\n this.sliderElementWithLegendClass = false;\n });\n return;\n }\n const ticksArray = !ValueHelper.isNullOrUndefined(this.viewOptions.ticksArray)\n ? this.viewOptions.ticksArray\n : this.getTicksArray();\n const translate = this.viewOptions.vertical\n ? \"translateY\"\n : \"translateX\";\n if (this.viewOptions.rightToLeft) {\n ticksArray.reverse();\n }\n const tickValueStep = !ValueHelper.isNullOrUndefined(this.viewOptions.tickValueStep)\n ? this.viewOptions.tickValueStep\n : !ValueHelper.isNullOrUndefined(this.viewOptions.tickStep)\n ? this.viewOptions.tickStep\n : this.viewOptions.step;\n let hasAtLeastOneLegend = false;\n const newTicks = ticksArray.map((value) => {\n let position = this.valueToPosition(value);\n if (this.viewOptions.vertical) {\n position = this.maxHandlePosition - position;\n }\n const translation = translate + \"(\" + Math.round(position) + \"px)\";\n const tick = new Tick();\n tick.selected = this.isTickSelected(value);\n tick.style = {\n \"-webkit-transform\": translation,\n \"-moz-transform\": translation,\n \"-o-transform\": translation,\n \"-ms-transform\": translation,\n transform: translation,\n };\n if (tick.selected &&\n !ValueHelper.isNullOrUndefined(this.viewOptions.getSelectionBarColor)) {\n tick.style[\"background-color\"] = this.getSelectionBarColor();\n }\n if (!tick.selected &&\n !ValueHelper.isNullOrUndefined(this.viewOptions.getTickColor)) {\n tick.style[\"background-color\"] = this.getTickColor(value);\n }\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.ticksTooltip)) {\n tick.tooltip = this.viewOptions.ticksTooltip(value);\n tick.tooltipPlacement = this.viewOptions.vertical ? \"right\" : \"top\";\n }\n if (this.viewOptions.showTicksValues &&\n !ValueHelper.isNullOrUndefined(tickValueStep) &&\n MathHelper.isModuloWithinPrecisionLimit(value, tickValueStep, this.viewOptions.precisionLimit)) {\n tick.value = this.getDisplayValue(value, LabelType.TickValue);\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.ticksValuesTooltip)) {\n tick.valueTooltip = this.viewOptions.ticksValuesTooltip(value);\n tick.valueTooltipPlacement = this.viewOptions.vertical\n ? \"right\"\n : \"top\";\n }\n }\n let legend = null;\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.stepsArray)) {\n const step = this.viewOptions.stepsArray[value];\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.getStepLegend)) {\n legend = this.viewOptions.getStepLegend(step);\n }\n else if (!ValueHelper.isNullOrUndefined(step)) {\n legend = step.legend;\n }\n }\n else if (!ValueHelper.isNullOrUndefined(this.viewOptions.getLegend)) {\n legend = this.viewOptions.getLegend(value);\n }\n if (!ValueHelper.isNullOrUndefined(legend)) {\n tick.legend = legend;\n hasAtLeastOneLegend = true;\n }\n return tick;\n });\n if (this.sliderElementWithLegendClass !== hasAtLeastOneLegend) {\n setTimeout(() => {\n this.sliderElementWithLegendClass = hasAtLeastOneLegend;\n });\n }\n // We should avoid re-creating the ticks array if possible\n // This both improves performance and makes CSS animations work correctly\n if (!ValueHelper.isNullOrUndefined(this.ticks) &&\n this.ticks.length === newTicks.length) {\n for (let i = 0; i < newTicks.length; ++i) {\n Object.assign(this.ticks[i], newTicks[i]);\n }\n }\n else {\n this.ticks = newTicks;\n if (!this.isRefDestroyed()) {\n this.changeDetectionRef.detectChanges();\n }\n }\n }\n getTicksArray() {\n const step = !ValueHelper.isNullOrUndefined(this.viewOptions.tickStep)\n ? this.viewOptions.tickStep\n : this.viewOptions.step;\n const ticksArray = [];\n const numberOfValues = 1 +\n Math.floor(MathHelper.roundToPrecisionLimit(Math.abs(this.viewOptions.ceil - this.viewOptions.floor) / step, this.viewOptions.precisionLimit));\n for (let index = 0; index < numberOfValues; ++index) {\n ticksArray.push(MathHelper.roundToPrecisionLimit(this.viewOptions.floor + step * index, this.viewOptions.precisionLimit));\n }\n return ticksArray;\n }\n isTickSelected(value) {\n if (!this.range) {\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.showSelectionBarFromValue)) {\n const center = this.viewOptions.showSelectionBarFromValue;\n if (this.viewLowValue > center &&\n value >= center &&\n value <= this.viewLowValue) {\n return true;\n }\n else if (this.viewLowValue < center &&\n value <= center &&\n value >= this.viewLowValue) {\n return true;\n }\n }\n else if (this.viewOptions.showSelectionBarEnd) {\n if (value >= this.viewLowValue) {\n return true;\n }\n }\n else if (this.viewOptions.showSelectionBar &&\n value <= this.viewLowValue) {\n return true;\n }\n }\n if (this.range &&\n value >= this.viewLowValue &&\n value <= this.viewHighValue) {\n return true;\n }\n return false;\n }\n // Update position of the floor label\n updateFloorLabel() {\n if (!this.floorLabelElement.alwaysHide) {\n this.floorLabelElement.setValue(this.getDisplayValue(this.viewOptions.floor, LabelType.Floor));\n this.floorLabelElement.calculateDimension();\n const position = this.viewOptions.rightToLeft\n ? this.fullBarElement.dimension - this.floorLabelElement.dimension\n : 0;\n this.floorLabelElement.setPosition(position);\n }\n }\n // Update position of the ceiling label\n updateCeilLabel() {\n if (!this.ceilLabelElement.alwaysHide) {\n this.ceilLabelElement.setValue(this.getDisplayValue(this.viewOptions.ceil, LabelType.Ceil));\n this.ceilLabelElement.calculateDimension();\n const position = this.viewOptions.rightToLeft\n ? 0\n : this.fullBarElement.dimension - this.ceilLabelElement.dimension;\n this.ceilLabelElement.setPosition(position);\n }\n }\n // Update slider handles and label positions\n updateHandles(which, newPos) {\n if (which === PointerType.Min) {\n this.updateLowHandle(newPos);\n }\n else if (which === PointerType.Max) {\n this.updateHighHandle(newPos);\n }\n this.updateSelectionBar();\n this.updateTicksScale();\n if (this.range) {\n this.updateCombinedLabel();\n }\n }\n // Helper function to work out the position for handle labels depending on RTL or not\n getHandleLabelPos(labelType, newPos) {\n const labelDimension = labelType === PointerType.Min\n ? this.minHandleLabelElement.dimension\n : this.maxHandleLabelElement.dimension;\n const nearHandlePos = newPos - labelDimension / 2 + this.handleHalfDimension;\n const endOfBarPos = this.fullBarElement.dimension - labelDimension;\n if (!this.viewOptions.boundPointerLabels) {\n return nearHandlePos;\n }\n if ((this.viewOptions.rightToLeft && labelType === PointerType.Min) ||\n (!this.viewOptions.rightToLeft && labelType === PointerType.Max)) {\n return Math.min(nearHandlePos, endOfBarPos);\n }\n else {\n return Math.min(Math.max(nearHandlePos, 0), endOfBarPos);\n }\n }\n // Update low slider handle position and label\n updateLowHandle(newPos) {\n this.minHandleElement.setPosition(newPos);\n this.minHandleLabelElement.setValue(this.getDisplayValue(this.viewLowValue, LabelType.Low));\n this.minHandleLabelElement.setPosition(this.getHandleLabelPos(PointerType.Min, newPos));\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.getPointerColor)) {\n this.minPointerStyle = {\n backgroundColor: this.getPointerColor(PointerType.Min),\n };\n }\n if (this.viewOptions.autoHideLimitLabels) {\n this.updateFloorAndCeilLabelsVisibility();\n }\n }\n // Update high slider handle position and label\n updateHighHandle(newPos) {\n this.maxHandleElement.setPosition(newPos);\n this.maxHandleLabelElement.setValue(this.getDisplayValue(this.viewHighValue, LabelType.High));\n this.maxHandleLabelElement.setPosition(this.getHandleLabelPos(PointerType.Max, newPos));\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.getPointerColor)) {\n this.maxPointerStyle = {\n backgroundColor: this.getPointerColor(PointerType.Max),\n };\n }\n if (this.viewOptions.autoHideLimitLabels) {\n this.updateFloorAndCeilLabelsVisibility();\n }\n }\n // Show/hide floor/ceiling label\n updateFloorAndCeilLabelsVisibility() {\n // Show based only on hideLimitLabels if pointer labels are hidden\n if (this.viewOptions.hidePointerLabels) {\n return;\n }\n let floorLabelHidden = false;\n let ceilLabelHidden = false;\n const isMinLabelAtFloor = this.isLabelBelowFloorLabel(this.minHandleLabelElement);\n const isMinLabelAtCeil = this.isLabelAboveCeilLabel(this.minHandleLabelElement);\n const isMaxLabelAtCeil = this.isLabelAboveCeilLabel(this.maxHandleLabelElement);\n const isCombinedLabelAtFloor = this.isLabelBelowFloorLabel(this.combinedLabelElement);\n const isCombinedLabelAtCeil = this.isLabelAboveCeilLabel(this.combinedLabelElement);\n if (isMinLabelAtFloor) {\n floorLabelHidden = true;\n this.floorLabelElement.hide();\n }\n else {\n floorLabelHidden = false;\n this.floorLabelElement.show();\n }\n if (isMinLabelAtCeil) {\n ceilLabelHidden = true;\n this.ceilLabelElement.hide();\n }\n else {\n ceilLabelHidden = false;\n this.ceilLabelElement.show();\n }\n if (this.range) {\n const hideCeil = this.combinedLabelElement.isVisible()\n ? isCombinedLabelAtCeil\n : isMaxLabelAtCeil;\n const hideFloor = this.combinedLabelElement.isVisible()\n ? isCombinedLabelAtFloor\n : isMinLabelAtFloor;\n if (hideCeil) {\n this.ceilLabelElement.hide();\n }\n else if (!ceilLabelHidden) {\n this.ceilLabelElement.show();\n }\n // Hide or show floor label\n if (hideFloor) {\n this.floorLabelElement.hide();\n }\n else if (!floorLabelHidden) {\n this.floorLabelElement.show();\n }\n }\n }\n isLabelBelowFloorLabel(label) {\n const pos = label.position;\n const dim = label.dimension;\n const floorPos = this.floorLabelElement.position;\n const floorDim = this.floorLabelElement.dimension;\n return this.viewOptions.rightToLeft\n ? pos + dim >= floorPos - 2\n : pos <= floorPos + floorDim + 2;\n }\n isLabelAboveCeilLabel(label) {\n const pos = label.position;\n const dim = label.dimension;\n const ceilPos = this.ceilLabelElement.position;\n const ceilDim = this.ceilLabelElement.dimension;\n return this.viewOptions.rightToLeft\n ? pos <= ceilPos + ceilDim + 2\n : pos + dim >= ceilPos - 2;\n }\n // Update slider selection bar, combined label and range label\n updateSelectionBar() {\n let position = 0;\n let dimension = 0;\n const isSelectionBarFromRight = this.viewOptions.rightToLeft\n ? !this.viewOptions.showSelectionBarEnd\n : this.viewOptions.showSelectionBarEnd;\n const positionForRange = this.viewOptions.rightToLeft\n ? this.maxHandleElement.position + this.handleHalfDimension\n : this.minHandleElement.position + this.handleHalfDimension;\n if (this.range) {\n dimension = Math.abs(this.maxHandleElement.position - this.minHandleElement.position);\n position = positionForRange;\n }\n else {\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.showSelectionBarFromValue)) {\n const center = this.viewOptions.showSelectionBarFromValue;\n const centerPosition = this.valueToPosition(center);\n const isModelGreaterThanCenter = this.viewOptions.rightToLeft\n ? this.viewLowValue <= center\n : this.viewLowValue > center;\n if (isModelGreaterThanCenter) {\n dimension = this.minHandleElement.position - centerPosition;\n position = centerPosition + this.handleHalfDimension;\n }\n else {\n dimension = centerPosition - this.minHandleElement.position;\n position = this.minHandleElement.position + this.handleHalfDimension;\n }\n }\n else if (isSelectionBarFromRight) {\n dimension = Math.ceil(Math.abs(this.maxHandlePosition - this.minHandleElement.position) +\n this.handleHalfDimension);\n position = Math.floor(this.minHandleElement.position + this.handleHalfDimension);\n }\n else {\n dimension = this.minHandleElement.position + this.handleHalfDimension;\n position = 0;\n }\n }\n this.selectionBarElement.setDimension(dimension);\n this.selectionBarElement.setPosition(position);\n if (this.range && this.viewOptions.showOuterSelectionBars) {\n if (this.viewOptions.rightToLeft) {\n this.rightOuterSelectionBarElement.setDimension(position);\n this.rightOuterSelectionBarElement.setPosition(0);\n this.fullBarElement.calculateDimension();\n this.leftOuterSelectionBarElement.setDimension(this.fullBarElement.dimension - (position + dimension));\n this.leftOuterSelectionBarElement.setPosition(position + dimension);\n }\n else {\n this.leftOuterSelectionBarElement.setDimension(position);\n this.leftOuterSelectionBarElement.setPosition(0);\n this.fullBarElement.calculateDimension();\n this.rightOuterSelectionBarElement.setDimension(this.fullBarElement.dimension - (position + dimension));\n this.rightOuterSelectionBarElement.setPosition(position + dimension);\n }\n }\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.getSelectionBarColor)) {\n const color = this.getSelectionBarColor();\n this.barStyle = {\n backgroundColor: color,\n };\n }\n else if (!ValueHelper.isNullOrUndefined(this.viewOptions.selectionBarGradient)) {\n const offset = !ValueHelper.isNullOrUndefined(this.viewOptions.showSelectionBarFromValue)\n ? this.valueToPosition(this.viewOptions.showSelectionBarFromValue)\n : 0;\n const reversed = (offset - position > 0 && !isSelectionBarFromRight) ||\n (offset - position <= 0 && isSelectionBarFromRight);\n const direction = this.viewOptions.vertical\n ? reversed\n ? \"bottom\"\n : \"top\"\n : reversed\n ? \"left\"\n : \"right\";\n this.barStyle = {\n backgroundImage: \"linear-gradient(to \" +\n direction +\n \", \" +\n this.viewOptions.selectionBarGradient.from +\n \" 0%,\" +\n this.viewOptions.selectionBarGradient.to +\n \" 100%)\",\n };\n if (this.viewOptions.vertical) {\n this.barStyle.backgroundPosition =\n \"center \" +\n (offset +\n dimension +\n position +\n (reversed ? -this.handleHalfDimension : 0)) +\n \"px\";\n this.barStyle.backgroundSize =\n \"100% \" +\n (this.fullBarElement.dimension - this.handleHalfDimension) +\n \"px\";\n }\n else {\n this.barStyle.backgroundPosition =\n offset -\n position +\n (reversed ? this.handleHalfDimension : 0) +\n \"px center\";\n this.barStyle.backgroundSize =\n this.fullBarElement.dimension - this.handleHalfDimension + \"px 100%\";\n }\n }\n }\n // Wrapper around the getSelectionBarColor of the user to pass to correct parameters\n getSelectionBarColor() {\n if (this.range) {\n return this.viewOptions.getSelectionBarColor(this.value, this.highValue);\n }\n return this.viewOptions.getSelectionBarColor(this.value);\n }\n // Wrapper around the getPointerColor of the user to pass to correct parameters\n getPointerColor(pointerType) {\n if (pointerType === PointerType.Max) {\n return this.viewOptions.getPointerColor(this.highValue, pointerType);\n }\n return this.viewOptions.getPointerColor(this.value, pointerType);\n }\n // Wrapper around the getTickColor of the user to pass to correct parameters\n getTickColor(value) {\n return this.viewOptions.getTickColor(value);\n }\n // Update combined label position and value\n updateCombinedLabel() {\n let isLabelOverlap = null;\n if (this.viewOptions.rightToLeft) {\n isLabelOverlap =\n this.minHandleLabelElement.position -\n this.minHandleLabelElement.dimension -\n 10 <=\n this.maxHandleLabelElement.position;\n }\n else {\n isLabelOverlap =\n this.minHandleLabelElement.position +\n this.minHandleLabelElement.dimension +\n 10 >=\n this.maxHandleLabelElement.position;\n }\n if (isLabelOverlap) {\n const lowDisplayValue = this.getDisplayValue(this.viewLowValue, LabelType.Low);\n const highDisplayValue = this.getDisplayValue(this.viewHighValue, LabelType.High);\n const combinedLabelValue = this.viewOptions.rightToLeft\n ? this.viewOptions.combineLabels(highDisplayValue, lowDisplayValue)\n : this.viewOptions.combineLabels(lowDisplayValue, highDisplayValue);\n this.combinedLabelElement.setValue(combinedLabelValue);\n const pos = this.viewOptions.boundPointerLabels\n ? Math.min(Math.max(this.selectionBarElement.position +\n this.selectionBarElement.dimension / 2 -\n this.combinedLabelElement.dimension / 2, 0), this.fullBarElement.dimension - this.combinedLabelElement.dimension)\n : this.selectionBarElement.position +\n this.selectionBarElement.dimension / 2 -\n this.combinedLabelElement.dimension / 2;\n this.combinedLabelElement.setPosition(pos);\n this.minHandleLabelElement.hide();\n this.maxHandleLabelElement.hide();\n this.combinedLabelElement.show();\n }\n else {\n this.updateHighHandle(this.valueToPosition(this.viewHighValue));\n this.updateLowHandle(this.valueToPosition(this.viewLowValue));\n this.maxHandleLabelElement.show();\n this.minHandleLabelElement.show();\n this.combinedLabelElement.hide();\n }\n if (this.viewOptions.autoHideLimitLabels) {\n this.updateFloorAndCeilLabelsVisibility();\n }\n }\n // Return the translated value if a translate function is provided else the original value\n getDisplayValue(value, which) {\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.stepsArray) &&\n !this.viewOptions.bindIndexForStepsArray) {\n value = this.getStepValue(value);\n }\n return this.viewOptions.translate(value, which);\n }\n // Round value to step and precision based on minValue\n roundStep(value, customStep) {\n const step = !ValueHelper.isNullOrUndefined(customStep)\n ? customStep\n : this.viewOptions.step;\n let steppedDifference = MathHelper.roundToPrecisionLimit((value - this.viewOptions.floor) / step, this.viewOptions.precisionLimit);\n steppedDifference = Math.round(steppedDifference) * step;\n return MathHelper.roundToPrecisionLimit(this.viewOptions.floor + steppedDifference, this.viewOptions.precisionLimit);\n }\n // Translate value to pixel position\n valueToPosition(val) {\n let fn = ValueHelper.linearValueToPosition;\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.customValueToPosition)) {\n fn = this.viewOptions.customValueToPosition;\n }\n else if (this.viewOptions.logScale) {\n fn = ValueHelper.logValueToPosition;\n }\n val = MathHelper.clampToRange(val, this.viewOptions.floor, this.viewOptions.ceil);\n let percent = fn(val, this.viewOptions.floor, this.viewOptions.ceil);\n if (ValueHelper.isNullOrUndefined(percent)) {\n percent = 0;\n }\n if (this.viewOptions.rightToLeft) {\n percent = 1 - percent;\n }\n return percent * this.maxHandlePosition;\n }\n // Translate position to model value\n positionToValue(position) {\n let percent = position / this.maxHandlePosition;\n if (this.viewOptions.rightToLeft) {\n percent = 1 - percent;\n }\n let fn = ValueHelper.linearPositionToValue;\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.customPositionToValue)) {\n fn = this.viewOptions.customPositionToValue;\n }\n else if (this.viewOptions.logScale) {\n fn = ValueHelper.logPositionToValue;\n }\n const value = fn(percent, this.viewOptions.floor, this.viewOptions.ceil);\n return !ValueHelper.isNullOrUndefined(value) ? value : 0;\n }\n // Get the X-coordinate or Y-coordinate of an event\n getEventXY(event, targetTouchId) {\n if (event instanceof MouseEvent) {\n return this.viewOptions.vertical || this.viewOptions.rotate !== 0\n ? event.clientY\n : event.clientX;\n }\n let touchIndex = 0;\n const touches = event.touches;\n if (!ValueHelper.isNullOrUndefined(targetTouchId)) {\n for (let i = 0; i < touches.length; i++) {\n if (touches[i].identifier === targetTouchId) {\n touchIndex = i;\n break;\n }\n }\n }\n // Return the target touch or if the target touch was not found in the event\n // returns the coordinates of the first touch\n return this.viewOptions.vertical || this.viewOptions.rotate !== 0\n ? touches[touchIndex].clientY\n : touches[touchIndex].clientX;\n }\n // Compute the event position depending on whether the slider is horizontal or vertical\n getEventPosition(event, targetTouchId) {\n const sliderElementBoundingRect = this.elementRef.nativeElement.getBoundingClientRect();\n const sliderPos = this.viewOptions.vertical || this.viewOptions.rotate !== 0\n ? sliderElementBoundingRect.bottom\n : sliderElementBoundingRect.left;\n let eventPos = 0;\n if (this.viewOptions.vertical || this.viewOptions.rotate !== 0) {\n eventPos = -this.getEventXY(event, targetTouchId) + sliderPos;\n }\n else {\n eventPos = this.getEventXY(event, targetTouchId) - sliderPos;\n }\n return eventPos * this.viewOptions.scale - this.handleHalfDimension;\n }\n // Get the handle closest to an event\n getNearestHandle(event) {\n if (!this.range) {\n return PointerType.Min;\n }\n const position = this.getEventPosition(event);\n const distanceMin = Math.abs(position - this.minHandleElement.position);\n const distanceMax = Math.abs(position - this.maxHandleElement.position);\n if (distanceMin < distanceMax) {\n return PointerType.Min;\n }\n else if (distanceMin > distanceMax) {\n return PointerType.Max;\n }\n else if (!this.viewOptions.rightToLeft) {\n // if event is at the same distance from min/max then if it's at left of minH, we return minH else maxH\n return position < this.minHandleElement.position\n ? PointerType.Min\n : PointerType.Max;\n }\n // reverse in rtl\n return position > this.minHandleElement.position\n ? PointerType.Min\n : PointerType.Max;\n }\n // Bind mouse and touch events to slider handles\n bindEvents() {\n const draggableRange = this.viewOptions.draggableRange;\n if (!this.viewOptions.onlyBindHandles) {\n this.selectionBarElement.on(\"mousedown\", (event) => this.onBarStart(null, draggableRange, event, true, true, true));\n }\n if (this.viewOptions.draggableRangeOnly) {\n this.minHandleElement.on(\"mousedown\", (event) => this.onBarStart(PointerType.Min, draggableRange, event, true, true));\n this.maxHandleElement.on(\"mousedown\", (event) => this.onBarStart(PointerType.Max, draggableRange, event, true, true));\n }\n else {\n this.minHandleElement.on(\"mousedown\", (event) => this.onStart(PointerType.Min, event, true, true));\n if (this.range) {\n this.maxHandleElement.on(\"mousedown\", (event) => this.onStart(PointerType.Max, event, true, true));\n }\n if (!this.viewOptions.onlyBindHandles) {\n this.fullBarElement.on(\"mousedown\", (event) => this.onStart(null, event, true, true, true));\n this.ticksElement.on(\"mousedown\", (event) => this.onStart(null, event, true, true, true, true));\n }\n }\n if (!this.viewOptions.onlyBindHandles) {\n this.selectionBarElement.onPassive(\"touchstart\", (event) => this.onBarStart(null, draggableRange, event, true, true, true));\n }\n if (this.viewOptions.draggableRangeOnly) {\n this.minHandleElement.onPassive(\"touchstart\", (event) => this.onBarStart(PointerType.Min, draggableRange, event, true, true));\n this.maxHandleElement.onPassive(\"touchstart\", (event) => this.onBarStart(PointerType.Max, draggableRange, event, true, true));\n }\n else {\n this.minHandleElement.onPassive(\"touchstart\", (event) => this.onStart(PointerType.Min, event, true, true));\n if (this.range) {\n this.maxHandleElement.onPassive(\"touchstart\", (event) => this.onStart(PointerType.Max, event, true, true));\n }\n if (!this.viewOptions.onlyBindHandles) {\n this.fullBarElement.onPassive(\"touchstart\", (event) => this.onStart(null, event, true, true, true));\n this.ticksElement.onPassive(\"touchstart\", (event) => this.onStart(null, event, false, false, true, true));\n }\n }\n if (this.viewOptions.keyboardSupport) {\n this.minHandleElement.on(\"focus\", () => this.onPointerFocus(PointerType.Min));\n if (this.range) {\n this.maxHandleElement.on(\"focus\", () => this.onPointerFocus(PointerType.Max));\n }\n }\n }\n getOptionsInfluencingEventBindings(options) {\n return [\n options.disabled,\n options.readOnly,\n options.draggableRange,\n options.draggableRangeOnly,\n options.onlyBindHandles,\n options.keyboardSupport,\n ];\n }\n // Unbind mouse and touch events to slider handles\n unbindEvents() {\n this.unsubscribeOnMove();\n this.unsubscribeOnEnd();\n for (const element of this.getAllSliderElements()) {\n if (!ValueHelper.isNullOrUndefined(element)) {\n element.off();\n }\n }\n }\n onBarStart(pointerType, draggableRange, event, bindMove, bindEnd, simulateImmediateMove, simulateImmediateEnd) {\n if (draggableRange) {\n this.onDragStart(pointerType, event, bindMove, bindEnd);\n }\n else {\n this.onStart(pointerType, event, bindMove, bindEnd, simulateImmediateMove, simulateImmediateEnd);\n }\n }\n // onStart event handler\n onStart(pointerType, event, bindMove, bindEnd, simulateImmediateMove, simulateImmediateEnd) {\n event.stopPropagation();\n // Only call preventDefault() when handling non-passive events (passive events don't need it)\n if (!CompatibilityHelper.isTouchEvent(event) && !supportsPassiveEvents) {\n event.preventDefault();\n }\n this.moving = false;\n // We have to do this in case the HTML where the sliders are on\n // have been animated into view.\n this.calculateViewDimensions();\n if (ValueHelper.isNullOrUndefined(pointerType)) {\n pointerType = this.getNearestHandle(event);\n }\n this.currentTrackingPointer = pointerType;\n const pointerElement = this.getPointerElement(pointerType);\n pointerElement.active = true;\n if (this.viewOptions.keyboardSupport) {\n pointerElement.focus();\n }\n if (bindMove) {\n this.unsubscribeOnMove();\n const onMoveCallback = (e) => (this.dragging.active ? this.onDragMove(e) : this.onMove(e));\n if (CompatibilityHelper.isTouchEvent(event)) {\n this.onMoveEventListener =\n this.eventListenerHelper.attachPassiveEventListener(document, \"touchmove\", onMoveCallback);\n }\n else {\n this.onMoveEventListener = this.eventListenerHelper.attachEventListener(document, \"mousemove\", onMoveCallback);\n }\n }\n if (bindEnd) {\n this.unsubscribeOnEnd();\n const onEndCallback = (e) => this.onEnd(e);\n if (CompatibilityHelper.isTouchEvent(event)) {\n this.onEndEventListener =\n this.eventListenerHelper.attachPassiveEventListener(document, \"touchend\", onEndCallback);\n }\n else {\n this.onEndEventListener = this.eventListenerHelper.attachEventListener(document, \"mouseup\", onEndCallback);\n }\n }\n this.userChangeStart.emit(this.getChangeContext());\n if (CompatibilityHelper.isTouchEvent(event) &&\n !ValueHelper.isNullOrUndefined(event.changedTouches)) {\n // Store the touch identifier\n if (ValueHelper.isNullOrUndefined(this.touchId)) {\n this.touchId = event.changedTouches[0].identifier;\n }\n }\n // Click events, either with mouse or touch gesture are weird. Sometimes they result in full\n // start, move, end sequence, and sometimes, they don't - they only invoke mousedown\n // As a workaround, we simulate the first move event and the end event if it's necessary\n if (simulateImmediateMove) {\n this.onMove(event, true);\n }\n if (simulateImmediateEnd) {\n this.onEnd(event);\n }\n }\n // onMove event handler\n onMove(event, fromTick) {\n let touchForThisSlider = null;\n if (CompatibilityHelper.isTouchEvent(event)) {\n const changedTouches = event.changedTouches;\n for (let i = 0; i < changedTouches.length; i++) {\n if (changedTouches[i].identifier === this.touchId) {\n touchForThisSlider = changedTouches[i];\n break;\n }\n }\n if (ValueHelper.isNullOrUndefined(touchForThisSlider)) {\n return;\n }\n }\n if (this.viewOptions.animate && !this.viewOptions.animateOnMove) {\n if (this.moving) {\n this.sliderElementAnimateClass = false;\n }\n }\n this.moving = true;\n const newPos = !ValueHelper.isNullOrUndefined(touchForThisSlider)\n ? this.getEventPosition(event, touchForThisSlider.identifier)\n : this.getEventPosition(event);\n let newValue;\n const ceilValue = this.viewOptions.rightToLeft\n ? this.viewOptions.floor\n : this.viewOptions.ceil;\n const floorValue = this.viewOptions.rightToLeft\n ? this.viewOptions.ceil\n : this.viewOptions.floor;\n if (newPos <= 0) {\n newValue = floorValue;\n }\n else if (newPos >= this.maxHandlePosition) {\n newValue = ceilValue;\n }\n else {\n newValue = this.positionToValue(newPos);\n if (fromTick &&\n !ValueHelper.isNullOrUndefined(this.viewOptions.tickStep)) {\n newValue = this.roundStep(newValue, this.viewOptions.tickStep);\n }\n else {\n newValue = this.roundStep(newValue);\n }\n }\n this.positionTrackingHandle(newValue);\n }\n onEnd(event) {\n if (CompatibilityHelper.isTouchEvent(event)) {\n const changedTouches = event.changedTouches;\n if (changedTouches[0].identifier !== this.touchId) {\n return;\n }\n }\n this.moving = false;\n if (this.viewOptions.animate) {\n this.sliderElementAnimateClass = true;\n }\n this.touchId = null;\n if (!this.viewOptions.keyboardSupport) {\n this.minHandleElement.active = false;\n this.maxHandleElement.active = false;\n this.currentTrackingPointer = null;\n }\n this.dragging.active = false;\n this.unsubscribeOnMove();\n this.unsubscribeOnEnd();\n this.userChangeEnd.emit(this.getChangeContext());\n }\n onPointerFocus(pointerType) {\n const pointerElement = this.getPointerElement(pointerType);\n pointerElement.on(\"blur\", () => this.onPointerBlur(pointerElement));\n pointerElement.on(\"keydown\", (event) => this.onKeyboardEvent(event));\n pointerElement.on(\"keyup\", () => this.onKeyUp());\n pointerElement.active = true;\n this.currentTrackingPointer = pointerType;\n this.currentFocusPointer = pointerType;\n this.firstKeyDown = true;\n }\n onKeyUp() {\n this.firstKeyDown = true;\n this.userChangeEnd.emit(this.getChangeContext());\n }\n onPointerBlur(pointer) {\n pointer.off(\"blur\");\n pointer.off(\"keydown\");\n pointer.off(\"keyup\");\n pointer.active = false;\n if (ValueHelper.isNullOrUndefined(this.touchId)) {\n this.currentTrackingPointer = null;\n this.currentFocusPointer = null;\n }\n }\n getKeyActions(currentValue) {\n const valueRange = this.viewOptions.ceil - this.viewOptions.floor;\n let increaseStep = currentValue + this.viewOptions.step;\n let decreaseStep = currentValue - this.viewOptions.step;\n let increasePage = currentValue + valueRange / 10;\n let decreasePage = currentValue - valueRange / 10;\n if (this.viewOptions.reversedControls) {\n increaseStep = currentValue - this.viewOptions.step;\n decreaseStep = currentValue + this.viewOptions.step;\n increasePage = currentValue - valueRange / 10;\n decreasePage = currentValue + valueRange / 10;\n }\n // Left to right default actions\n const actions = {\n UP: increaseStep,\n DOWN: decreaseStep,\n LEFT: decreaseStep,\n RIGHT: increaseStep,\n PAGEUP: increasePage,\n PAGEDOWN: decreasePage,\n HOME: this.viewOptions.reversedControls\n ? this.viewOptions.ceil\n : this.viewOptions.floor,\n END: this.viewOptions.reversedControls\n ? this.viewOptions.floor\n : this.viewOptions.ceil,\n };\n // right to left means swapping right and left arrows\n if (this.viewOptions.rightToLeft) {\n actions.LEFT = increaseStep;\n actions.RIGHT = decreaseStep;\n // right to left and vertical means we also swap up and down\n if (this.viewOptions.vertical || this.viewOptions.rotate !== 0) {\n actions.UP = decreaseStep;\n actions.DOWN = increaseStep;\n }\n }\n return actions;\n }\n onKeyboardEvent(event) {\n const currentValue = this.getCurrentTrackingValue();\n const keyCode = !ValueHelper.isNullOrUndefined(event.keyCode)\n ? event.keyCode\n : event.which;\n const keys = {\n 38: \"UP\",\n 40: \"DOWN\",\n 37: \"LEFT\",\n 39: \"RIGHT\",\n 33: \"PAGEUP\",\n 34: \"PAGEDOWN\",\n 36: \"HOME\",\n 35: \"END\",\n };\n const actions = this.getKeyActions(currentValue);\n const key = keys[keyCode];\n const action = actions[key];\n if (ValueHelper.isNullOrUndefined(action) ||\n ValueHelper.isNullOrUndefined(this.currentTrackingPointer)) {\n return;\n }\n event.preventDefault();\n if (this.firstKeyDown) {\n this.firstKeyDown = false;\n this.userChangeStart.emit(this.getChangeContext());\n }\n const actionValue = MathHelper.clampToRange(action, this.viewOptions.floor, this.viewOptions.ceil);\n const newValue = this.roundStep(actionValue);\n if (!this.viewOptions.draggableRangeOnly) {\n this.positionTrackingHandle(newValue);\n }\n else {\n const difference = this.viewHighValue - this.viewLowValue;\n let newMinValue;\n let newMaxValue;\n if (this.currentTrackingPointer === PointerType.Min) {\n newMinValue = newValue;\n newMaxValue = newValue + difference;\n if (newMaxValue > this.viewOptions.ceil) {\n newMaxValue = this.viewOptions.ceil;\n newMinValue = newMaxValue - difference;\n }\n }\n else if (this.currentTrackingPointer === PointerType.Max) {\n newMaxValue = newValue;\n newMinValue = newValue - difference;\n if (newMinValue < this.viewOptions.floor) {\n newMinValue = this.viewOptions.floor;\n newMaxValue = newMinValue + difference;\n }\n }\n this.positionTrackingBar(newMinValue, newMaxValue);\n }\n }\n // onDragStart event handler, handles dragging of the middle bar\n onDragStart(pointerType, event, bindMove, bindEnd) {\n const position = this.getEventPosition(event);\n this.dragging = new Dragging();\n this.dragging.active = true;\n this.dragging.value = this.positionToValue(position);\n this.dragging.difference = this.viewHighValue - this.viewLowValue;\n this.dragging.lowLimit = this.viewOptions.rightToLeft\n ? this.minHandleElement.position - position\n : position - this.minHandleElement.position;\n this.dragging.highLimit = this.viewOptions.rightToLeft\n ? position - this.maxHandleElement.position\n : this.maxHandleElement.position - position;\n this.onStart(pointerType, event, bindMove, bindEnd);\n }\n /** Get min value depending on whether the newPos is outOfBounds above or below the bar and rightToLeft */\n getMinValue(newPos, outOfBounds, isAbove) {\n const isRTL = this.viewOptions.rightToLeft;\n let value = null;\n if (outOfBounds) {\n if (isAbove) {\n value = isRTL\n ? this.viewOptions.floor\n : this.viewOptions.ceil - this.dragging.difference;\n }\n else {\n value = isRTL\n ? this.viewOptions.ceil - this.dragging.difference\n : this.viewOptions.floor;\n }\n }\n else {\n value = isRTL\n ? this.positionToValue(newPos + this.dragging.lowLimit)\n : this.positionToValue(newPos - this.dragging.lowLimit);\n }\n return this.roundStep(value);\n }\n /** Get max value depending on whether the newPos is outOfBounds above or below the bar and rightToLeft */\n getMaxValue(newPos, outOfBounds, isAbove) {\n const isRTL = this.viewOptions.rightToLeft;\n let value = null;\n if (outOfBounds) {\n if (isAbove) {\n value = isRTL\n ? this.viewOptions.floor + this.dragging.difference\n : this.viewOptions.ceil;\n }\n else {\n value = isRTL\n ? this.viewOptions.ceil\n : this.viewOptions.floor + this.dragging.difference;\n }\n }\n else {\n if (isRTL) {\n value =\n this.positionToValue(newPos + this.dragging.lowLimit) +\n this.dragging.difference;\n }\n else {\n value =\n this.positionToValue(newPos - this.dragging.lowLimit) +\n this.dragging.difference;\n }\n }\n return this.roundStep(value);\n }\n onDragMove(event) {\n const newPos = this.getEventPosition(event);\n if (this.viewOptions.animate && !this.viewOptions.animateOnMove) {\n if (this.moving) {\n this.sliderElementAnimateClass = false;\n }\n }\n this.moving = true;\n let ceilLimit, floorLimit, floorHandleElement, ceilHandleElement;\n if (this.viewOptions.rightToLeft) {\n ceilLimit = this.dragging.lowLimit;\n floorLimit = this.dragging.highLimit;\n floorHandleElement = this.maxHandleElement;\n ceilHandleElement = this.minHandleElement;\n }\n else {\n ceilLimit = this.dragging.highLimit;\n floorLimit = this.dragging.lowLimit;\n floorHandleElement = this.minHandleElement;\n ceilHandleElement = this.maxHandleElement;\n }\n const isUnderFloorLimit = newPos <= floorLimit;\n const isOverCeilLimit = newPos >= this.maxHandlePosition - ceilLimit;\n let newMinValue;\n let newMaxValue;\n if (isUnderFloorLimit) {\n if (floorHandleElement.position === 0) {\n return;\n }\n newMinValue = this.getMinValue(newPos, true, false);\n newMaxValue = this.getMaxValue(newPos, true, false);\n }\n else if (isOverCeilLimit) {\n if (ceilHandleElement.position === this.maxHandlePosition) {\n return;\n }\n newMaxValue = this.getMaxValue(newPos, true, true);\n newMinValue = this.getMinValue(newPos, true, true);\n }\n else {\n newMinValue = this.getMinValue(newPos, false, false);\n newMaxValue = this.getMaxValue(newPos, false, false);\n }\n this.positionTrackingBar(newMinValue, newMaxValue);\n }\n // Set the new value and position for the entire bar\n positionTrackingBar(newMinValue, newMaxValue) {\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.minLimit) &&\n newMinValue < this.viewOptions.minLimit) {\n newMinValue = this.viewOptions.minLimit;\n newMaxValue = MathHelper.roundToPrecisionLimit(newMinValue + this.dragging.difference, this.viewOptions.precisionLimit);\n }\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.maxLimit) &&\n newMaxValue > this.viewOptions.maxLimit) {\n newMaxValue = this.viewOptions.maxLimit;\n newMinValue = MathHelper.roundToPrecisionLimit(newMaxValue - this.dragging.difference, this.viewOptions.precisionLimit);\n }\n this.viewLowValue = newMinValue;\n this.viewHighValue = newMaxValue;\n this.applyViewChange();\n this.updateHandles(PointerType.Min, this.valueToPosition(newMinValue));\n this.updateHandles(PointerType.Max, this.valueToPosition(newMaxValue));\n }\n // Set the new value and position to the current tracking handle\n positionTrackingHandle(newValue) {\n newValue = this.applyMinMaxLimit(newValue);\n if (this.range) {\n if (this.viewOptions.pushRange) {\n newValue = this.applyPushRange(newValue);\n }\n else {\n if (this.viewOptions.noSwitching) {\n if (this.currentTrackingPointer === PointerType.Min &&\n newValue > this.viewHighValue) {\n newValue = this.applyMinMaxRange(this.viewHighValue);\n }\n else if (this.currentTrackingPointer === PointerType.Max &&\n newValue < this.viewLowValue) {\n newValue = this.applyMinMaxRange(this.viewLowValue);\n }\n }\n newValue = this.applyMinMaxRange(newValue);\n /* This is to check if we need to switch the min and max handles */\n if (this.currentTrackingPointer === PointerType.Min &&\n newValue > this.viewHighValue) {\n this.viewLowValue = this.viewHighValue;\n this.applyViewChange();\n this.updateHandles(PointerType.Min, this.maxHandleElement.position);\n this.updateAriaAttributes();\n this.currentTrackingPointer = PointerType.Max;\n this.minHandleElement.active = false;\n this.maxHandleElement.active = true;\n if (this.viewOptions.keyboardSupport) {\n this.maxHandleElement.focus();\n }\n }\n else if (this.currentTrackingPointer === PointerType.Max &&\n newValue < this.viewLowValue) {\n this.viewHighValue = this.viewLowValue;\n this.applyViewChange();\n this.updateHandles(PointerType.Max, this.minHandleElement.position);\n this.updateAriaAttributes();\n this.currentTrackingPointer = PointerType.Min;\n this.maxHandleElement.active = false;\n this.minHandleElement.active = true;\n if (this.viewOptions.keyboardSupport) {\n this.minHandleElement.focus();\n }\n }\n }\n }\n if (this.getCurrentTrackingValue() !== newValue) {\n if (this.currentTrackingPointer === PointerType.Min) {\n this.viewLowValue = newValue;\n this.applyViewChange();\n }\n else if (this.currentTrackingPointer === PointerType.Max) {\n this.viewHighValue = newValue;\n this.applyViewChange();\n }\n this.updateHandles(this.currentTrackingPointer, this.valueToPosition(newValue));\n this.updateAriaAttributes();\n }\n }\n applyMinMaxLimit(newValue) {\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.minLimit) &&\n newValue < this.viewOptions.minLimit) {\n return this.viewOptions.minLimit;\n }\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.maxLimit) &&\n newValue > this.viewOptions.maxLimit) {\n return this.viewOptions.maxLimit;\n }\n return newValue;\n }\n applyMinMaxRange(newValue) {\n const oppositeValue = this.currentTrackingPointer === PointerType.Min\n ? this.viewHighValue\n : this.viewLowValue;\n const difference = Math.abs(newValue - oppositeValue);\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.minRange)) {\n if (difference < this.viewOptions.minRange) {\n if (this.currentTrackingPointer === PointerType.Min) {\n return MathHelper.roundToPrecisionLimit(this.viewHighValue - this.viewOptions.minRange, this.viewOptions.precisionLimit);\n }\n else if (this.currentTrackingPointer === PointerType.Max) {\n return MathHelper.roundToPrecisionLimit(this.viewLowValue + this.viewOptions.minRange, this.viewOptions.precisionLimit);\n }\n }\n }\n if (!ValueHelper.isNullOrUndefined(this.viewOptions.maxRange)) {\n if (difference > this.viewOptions.maxRange) {\n if (this.currentTrackingPointer === PointerType.Min) {\n return MathHelper.roundToPrecisionLimit(this.viewHighValue - this.viewOptions.maxRange, this.viewOptions.precisionLimit);\n }\n else if (this.currentTrackingPointer === PointerType.Max) {\n return MathHelper.roundToPrecisionLimit(this.viewLowValue + this.viewOptions.maxRange, this.viewOptions.precisionLimit);\n }\n }\n }\n return newValue;\n }\n applyPushRange(newValue) {\n const difference = this.currentTrackingPointer === PointerType.Min\n ? this.viewHighValue - newValue\n : newValue - this.viewLowValue;\n const minRange = !ValueHelper.isNullOrUndefined(this.viewOptions.minRange)\n ? this.viewOptions.minRange\n : this.viewOptions.step;\n const maxRange = this.viewOptions.maxRange;\n // if smaller than minRange\n if (difference < minRange) {\n if (this.currentTrackingPointer === PointerType.Min) {\n this.viewHighValue = MathHelper.roundToPrecisionLimit(Math.min(newValue + minRange, this.viewOptions.ceil), this.viewOptions.precisionLimit);\n newValue = MathHelper.roundToPrecisionLimit(this.viewHighValue - minRange, this.viewOptions.precisionLimit);\n this.applyViewChange();\n this.updateHandles(PointerType.Max, this.valueToPosition(this.viewHighValue));\n }\n else if (this.currentTrackingPointer === PointerType.Max) {\n this.viewLowValue = MathHelper.roundToPrecisionLimit(Math.max(newValue - minRange, this.viewOptions.floor), this.viewOptions.precisionLimit);\n newValue = MathHelper.roundToPrecisionLimit(this.viewLowValue + minRange, this.viewOptions.precisionLimit);\n this.applyViewChange();\n this.updateHandles(PointerType.Min, this.valueToPosition(this.viewLowValue));\n }\n this.updateAriaAttributes();\n }\n else if (!ValueHelper.isNullOrUndefined(maxRange) &&\n difference > maxRange) {\n // if greater than maxRange\n if (this.currentTrackingPointer === PointerType.Min) {\n this.viewHighValue = MathHelper.roundToPrecisionLimit(newValue + maxRange, this.viewOptions.precisionLimit);\n this.applyViewChange();\n this.updateHandles(PointerType.Max, this.valueToPosition(this.viewHighValue));\n }\n else if (this.currentTrackingPointer === PointerType.Max) {\n this.viewLowValue = MathHelper.roundToPrecisionLimit(newValue - maxRange, this.viewOptions.precisionLimit);\n this.applyViewChange();\n this.updateHandles(PointerType.Min, this.valueToPosition(this.viewLowValue));\n }\n this.updateAriaAttributes();\n }\n return newValue;\n }\n getChangeContext() {\n const changeContext = new ChangeContext();\n changeContext.pointerType = this.currentTrackingPointer;\n changeContext.value = +this.value;\n if (this.range) {\n changeContext.highValue = +this.highValue;\n }\n return changeContext;\n }\n static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"17.0.3\", ngImport: i0, type: SliderComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: AllowUnsafeHtmlInSlider, optional: true }], target: i0.ɵɵFactoryTarget.Component });\n static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: \"14.0.0\", version: \"17.0.3\", type: SliderComponent, selector: \"ngx-slider\", inputs: { value: \"value\", highValue: \"highValue\", options: \"options\", manualRefresh: \"manualRefresh\", triggerFocus: \"triggerFocus\" }, outputs: { valueChange: \"valueChange\", highValueChange: \"highValueChange\", userChangeStart: \"userChangeStart\", userChange: \"userChange\", userChangeEnd: \"userChangeEnd\" }, host: { listeners: { \"window:resize\": \"onResize($event)\" }, properties: { \"class.vertical\": \"this.sliderElementVerticalClass\", \"class.animate\": \"this.sliderElementAnimateClass\", \"class.with-legend\": \"this.sliderElementWithLegendClass\", \"attr.disabled\": \"this.sliderElementDisabledAttr\", \"attr.aria-label\": \"this.sliderElementAriaLabel\" }, classAttribute: \"ngx-slider\" }, providers: [NGX_SLIDER_CONTROL_VALUE_ACCESSOR], queries: [{ propertyName: \"tooltipTemplate\", first: true, predicate: [\"tooltipTemplate\"], descendants: true }], viewQueries: [{ propertyName: \"leftOuterSelectionBarElement\", first: true, predicate: [\"leftOuterSelectionBar\"], descendants: true, read: SliderElementDirective }, { propertyName: \"rightOuterSelectionBarElement\", first: true, predicate: [\"rightOuterSelectionBar\"], descendants: true, read: SliderElementDirective }, { propertyName: \"fullBarElement\", first: true, predicate: [\"fullBar\"], descendants: true, read: SliderElementDirective }, { propertyName: \"selectionBarElement\", first: true, predicate: [\"selectionBar\"], descendants: true, read: SliderElementDirective }, { propertyName: \"minHandleElement\", first: true, predicate: [\"minHandle\"], descendants: true, read: SliderHandleDirective }, { propertyName: \"maxHandleElement\", first: true, predicate: [\"maxHandle\"], descendants: true, read: SliderHandleDirective }, { propertyName: \"floorLabelElement\", first: true, predicate: [\"floorLabel\"], descendants: true, read: SliderLabelDirective }, { propertyName: \"ceilLabelElement\", first: true, predicate: [\"ceilLabel\"], descendants: true, read: SliderLabelDirective }, { propertyName: \"minHandleLabelElement\", first: true, predicate: [\"minHandleLabel\"], descendants: true, read: SliderLabelDirective }, { propertyName: \"maxHandleLabelElement\", first: true, predicate: [\"maxHandleLabel\"], descendants: true, read: SliderLabelDirective }, { propertyName: \"combinedLabelElement\", first: true, predicate: [\"combinedLabel\"], descendants: true, read: SliderLabelDirective }, { propertyName: \"ticksElement\", first: true, predicate: [\"ticksElement\"], descendants: true, read: SliderElementDirective }], usesOnChanges: true, ngImport: i0, template: \"\\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\\n\\n \\n \\n \\n \\n \\n \\n\", styles: [\"::ng-deep .ngx-slider{display:inline-block;position:relative;height:4px;width:100%;margin:35px 0 15px;vertical-align:middle;-webkit-user-select:none;user-select:none;touch-action:pan-y}::ng-deep .ngx-slider.with-legend{margin-bottom:40px}::ng-deep .ngx-slider[disabled]{cursor:not-allowed}::ng-deep .ngx-slider[disabled] .ngx-slider-pointer{cursor:not-allowed;background-color:#d8e0f3}::ng-deep .ngx-slider[disabled] .ngx-slider-draggable{cursor:not-allowed}::ng-deep .ngx-slider[disabled] .ngx-slider-selection{background:#8b91a2}::ng-deep .ngx-slider[disabled] .ngx-slider-tick{cursor:not-allowed}::ng-deep .ngx-slider[disabled] .ngx-slider-tick.ngx-slider-selected{background:#8b91a2}::ng-deep .ngx-slider .ngx-slider-span{white-space:nowrap;position:absolute;display:inline-block}::ng-deep .ngx-slider .ngx-slider-base{width:100%;height:100%;padding:0}::ng-deep .ngx-slider .ngx-slider-bar-wrapper{left:0;box-sizing:border-box;margin-top:-16px;padding-top:16px;width:100%;height:32px;z-index:1}::ng-deep .ngx-slider .ngx-slider-draggable{cursor:move}::ng-deep .ngx-slider .ngx-slider-bar{left:0;width:100%;height:4px;z-index:1;background:#d8e0f3;border-radius:2px}::ng-deep .ngx-slider .ngx-slider-bar-wrapper.ngx-slider-transparent .ngx-slider-bar{background:transparent}::ng-deep .ngx-slider .ngx-slider-bar-wrapper.ngx-slider-left-out-selection .ngx-slider-bar{background:#df002d}::ng-deep .ngx-slider .ngx-slider-bar-wrapper.ngx-slider-right-out-selection .ngx-slider-bar{background:#03a688}::ng-deep .ngx-slider .ngx-slider-selection{z-index:2;background:#0db9f0;border-radius:2px}::ng-deep .ngx-slider .ngx-slider-pointer{cursor:pointer;width:32px;height:32px;top:-14px;background-color:#0db9f0;z-index:3;border-radius:16px}::ng-deep .ngx-slider .ngx-slider-pointer:after{content:\\\"\\\";width:8px;height:8px;position:absolute;top:12px;left:12px;border-radius:4px;background:#fff}::ng-deep .ngx-slider .ngx-slider-pointer:hover:after{background-color:#fff}::ng-deep .ngx-slider .ngx-slider-pointer.ngx-slider-active{z-index:4}::ng-deep .ngx-slider .ngx-slider-pointer.ngx-slider-active:after{background-color:#451aff}::ng-deep .ngx-slider .ngx-slider-bubble{cursor:default;bottom:16px;padding:1px 3px;color:#55637d;font-size:16px}::ng-deep .ngx-slider .ngx-slider-bubble.ngx-slider-limit{color:#55637d}::ng-deep .ngx-slider .ngx-slider-ticks{box-sizing:border-box;width:100%;height:0;position:absolute;left:0;top:-3px;margin:0;z-index:1;list-style:none}::ng-deep .ngx-slider .ngx-slider-ticks-values-under .ngx-slider-tick-value{top:auto;bottom:-36px}::ng-deep .ngx-slider .ngx-slider-tick{text-align:center;cursor:pointer;width:10px;height:10px;background:#d8e0f3;border-radius:50%;position:absolute;top:0;left:0;margin-left:11px}::ng-deep .ngx-slider .ngx-slider-tick.ngx-slider-selected{background:#0db9f0}::ng-deep .ngx-slider .ngx-slider-tick-value{position:absolute;top:-34px;transform:translate(-50%)}::ng-deep .ngx-slider .ngx-slider-tick-legend{position:absolute;top:24px;transform:translate(-50%);max-width:50px;white-space:normal}::ng-deep .ngx-slider.vertical{position:relative;width:4px;height:100%;margin:0 20px;padding:0;vertical-align:baseline;touch-action:pan-x}::ng-deep .ngx-slider.vertical .ngx-slider-base{width:100%;height:100%;padding:0}::ng-deep .ngx-slider.vertical .ngx-slider-bar-wrapper{top:auto;left:0;margin:0 0 0 -16px;padding:0 0 0 16px;height:100%;width:32px}::ng-deep .ngx-slider.vertical .ngx-slider-bar{bottom:0;left:auto;width:4px;height:100%}::ng-deep .ngx-slider.vertical .ngx-slider-pointer{left:-14px!important;top:auto;bottom:0}::ng-deep .ngx-slider.vertical .ngx-slider-bubble{left:16px!important;bottom:0}::ng-deep .ngx-slider.vertical .ngx-slider-ticks{height:100%;width:0;left:-3px;top:0;z-index:1}::ng-deep .ngx-slider.vertical .ngx-slider-tick{vertical-align:middle;margin-left:auto;margin-top:11px}::ng-deep .ngx-slider.vertical .ngx-slider-tick-value{left:24px;top:auto;transform:translateY(-28%)}::ng-deep .ngx-slider.vertical .ngx-slider-tick-legend{top:auto;right:24px;transform:translateY(-28%);max-width:none;white-space:nowrap}::ng-deep .ngx-slider.vertical .ngx-slider-ticks-values-under .ngx-slider-tick-value{bottom:auto;left:auto;right:24px}::ng-deep .ngx-slider *{transition:none}::ng-deep .ngx-slider.animate .ngx-slider-bar-wrapper{transition:all linear .3s}::ng-deep .ngx-slider.animate .ngx-slider-selection{transition:background-color linear .3s}::ng-deep .ngx-slider.animate .ngx-slider-pointer{transition:all linear .3s}::ng-deep .ngx-slider.animate .ngx-slider-pointer:after{transition:all linear .3s}::ng-deep .ngx-slider.animate .ngx-slider-bubble{transition:all linear .3s}::ng-deep .ngx-slider.animate .ngx-slider-bubble.ngx-slider-limit{transition:opacity linear .3s}::ng-deep .ngx-slider.animate .ngx-slider-bubble.ngx-slider-combined{transition:opacity linear .3s}::ng-deep .ngx-slider.animate .ngx-slider-tick{transition:background-color linear .3s}\\n\"], dependencies: [{ kind: \"directive\", type: i1.NgClass, selector: \"[ngClass]\", inputs: [\"class\", \"ngClass\"] }, { kind: \"directive\", type: i1.NgForOf, selector: \"[ngFor][ngForOf]\", inputs: [\"ngForOf\", \"ngForTrackBy\", \"ngForTemplate\"] }, { kind: \"directive\", type: i1.NgIf, selector: \"[ngIf]\", inputs: [\"ngIf\", \"ngIfThen\", \"ngIfElse\"] }, { kind: \"directive\", type: i1.NgStyle, selector: \"[ngStyle]\", inputs: [\"ngStyle\"] }, { kind: \"directive\", type: SliderElementDirective, selector: \"[ngxSliderElement]\" }, { kind: \"directive\", type: SliderHandleDirective, selector: \"[ngxSliderHandle]\" }, { kind: \"directive\", type: SliderLabelDirective, selector: \"[ngxSliderLabel]\" }, { kind: \"component\", type: TooltipWrapperComponent, selector: \"ngx-slider-tooltip-wrapper\", inputs: [\"template\", \"tooltip\", \"placement\", \"content\"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"17.0.3\", ngImport: i0, type: SliderComponent, decorators: [{\n type: Component,\n args: [{ selector: \"ngx-slider\", host: { class: \"ngx-slider\" }, providers: [NGX_SLIDER_CONTROL_VALUE_ACCESSOR], changeDetection: ChangeDetectionStrategy.OnPush, template: \"\\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\\n\\n \\n \\n \\n \\n \\n \\n\", styles: [\"::ng-deep .ngx-slider{display:inline-block;position:relative;height:4px;width:100%;margin:35px 0 15px;vertical-align:middle;-webkit-user-select:none;user-select:none;touch-action:pan-y}::ng-deep .ngx-slider.with-legend{margin-bottom:40px}::ng-deep .ngx-slider[disabled]{cursor:not-allowed}::ng-deep .ngx-slider[disabled] .ngx-slider-pointer{cursor:not-allowed;background-color:#d8e0f3}::ng-deep .ngx-slider[disabled] .ngx-slider-draggable{cursor:not-allowed}::ng-deep .ngx-slider[disabled] .ngx-slider-selection{background:#8b91a2}::ng-deep .ngx-slider[disabled] .ngx-slider-tick{cursor:not-allowed}::ng-deep .ngx-slider[disabled] .ngx-slider-tick.ngx-slider-selected{background:#8b91a2}::ng-deep .ngx-slider .ngx-slider-span{white-space:nowrap;position:absolute;display:inline-block}::ng-deep .ngx-slider .ngx-slider-base{width:100%;height:100%;padding:0}::ng-deep .ngx-slider .ngx-slider-bar-wrapper{left:0;box-sizing:border-box;margin-top:-16px;padding-top:16px;width:100%;height:32px;z-index:1}::ng-deep .ngx-slider .ngx-slider-draggable{cursor:move}::ng-deep .ngx-slider .ngx-slider-bar{left:0;width:100%;height:4px;z-index:1;background:#d8e0f3;border-radius:2px}::ng-deep .ngx-slider .ngx-slider-bar-wrapper.ngx-slider-transparent .ngx-slider-bar{background:transparent}::ng-deep .ngx-slider .ngx-slider-bar-wrapper.ngx-slider-left-out-selection .ngx-slider-bar{background:#df002d}::ng-deep .ngx-slider .ngx-slider-bar-wrapper.ngx-slider-right-out-selection .ngx-slider-bar{background:#03a688}::ng-deep .ngx-slider .ngx-slider-selection{z-index:2;background:#0db9f0;border-radius:2px}::ng-deep .ngx-slider .ngx-slider-pointer{cursor:pointer;width:32px;height:32px;top:-14px;background-color:#0db9f0;z-index:3;border-radius:16px}::ng-deep .ngx-slider .ngx-slider-pointer:after{content:\\\"\\\";width:8px;height:8px;position:absolute;top:12px;left:12px;border-radius:4px;background:#fff}::ng-deep .ngx-slider .ngx-slider-pointer:hover:after{background-color:#fff}::ng-deep .ngx-slider .ngx-slider-pointer.ngx-slider-active{z-index:4}::ng-deep .ngx-slider .ngx-slider-pointer.ngx-slider-active:after{background-color:#451aff}::ng-deep .ngx-slider .ngx-slider-bubble{cursor:default;bottom:16px;padding:1px 3px;color:#55637d;font-size:16px}::ng-deep .ngx-slider .ngx-slider-bubble.ngx-slider-limit{color:#55637d}::ng-deep .ngx-slider .ngx-slider-ticks{box-sizing:border-box;width:100%;height:0;position:absolute;left:0;top:-3px;margin:0;z-index:1;list-style:none}::ng-deep .ngx-slider .ngx-slider-ticks-values-under .ngx-slider-tick-value{top:auto;bottom:-36px}::ng-deep .ngx-slider .ngx-slider-tick{text-align:center;cursor:pointer;width:10px;height:10px;background:#d8e0f3;border-radius:50%;position:absolute;top:0;left:0;margin-left:11px}::ng-deep .ngx-slider .ngx-slider-tick.ngx-slider-selected{background:#0db9f0}::ng-deep .ngx-slider .ngx-slider-tick-value{position:absolute;top:-34px;transform:translate(-50%)}::ng-deep .ngx-slider .ngx-slider-tick-legend{position:absolute;top:24px;transform:translate(-50%);max-width:50px;white-space:normal}::ng-deep .ngx-slider.vertical{position:relative;width:4px;height:100%;margin:0 20px;padding:0;vertical-align:baseline;touch-action:pan-x}::ng-deep .ngx-slider.vertical .ngx-slider-base{width:100%;height:100%;padding:0}::ng-deep .ngx-slider.vertical .ngx-slider-bar-wrapper{top:auto;left:0;margin:0 0 0 -16px;padding:0 0 0 16px;height:100%;width:32px}::ng-deep .ngx-slider.vertical .ngx-slider-bar{bottom:0;left:auto;width:4px;height:100%}::ng-deep .ngx-slider.vertical .ngx-slider-pointer{left:-14px!important;top:auto;bottom:0}::ng-deep .ngx-slider.vertical .ngx-slider-bubble{left:16px!important;bottom:0}::ng-deep .ngx-slider.vertical .ngx-slider-ticks{height:100%;width:0;left:-3px;top:0;z-index:1}::ng-deep .ngx-slider.vertical .ngx-slider-tick{vertical-align:middle;margin-left:auto;margin-top:11px}::ng-deep .ngx-slider.vertical .ngx-slider-tick-value{left:24px;top:auto;transform:translateY(-28%)}::ng-deep .ngx-slider.vertical .ngx-slider-tick-legend{top:auto;right:24px;transform:translateY(-28%);max-width:none;white-space:nowrap}::ng-deep .ngx-slider.vertical .ngx-slider-ticks-values-under .ngx-slider-tick-value{bottom:auto;left:auto;right:24px}::ng-deep .ngx-slider *{transition:none}::ng-deep .ngx-slider.animate .ngx-slider-bar-wrapper{transition:all linear .3s}::ng-deep .ngx-slider.animate .ngx-slider-selection{transition:background-color linear .3s}::ng-deep .ngx-slider.animate .ngx-slider-pointer{transition:all linear .3s}::ng-deep .ngx-slider.animate .ngx-slider-pointer:after{transition:all linear .3s}::ng-deep .ngx-slider.animate .ngx-slider-bubble{transition:all linear .3s}::ng-deep .ngx-slider.animate .ngx-slider-bubble.ngx-slider-limit{transition:opacity linear .3s}::ng-deep .ngx-slider.animate .ngx-slider-bubble.ngx-slider-combined{transition:opacity linear .3s}::ng-deep .ngx-slider.animate .ngx-slider-tick{transition:background-color linear .3s}\\n\"] }]\n }], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{\n type: Inject,\n args: [AllowUnsafeHtmlInSlider]\n }, {\n type: Optional\n }] }], propDecorators: { value: [{\n type: Input\n }], valueChange: [{\n type: Output\n }], highValue: [{\n type: Input\n }], highValueChange: [{\n type: Output\n }], options: [{\n type: Input\n }], userChangeStart: [{\n type: Output\n }], userChange: [{\n type: Output\n }], userChangeEnd: [{\n type: Output\n }], manualRefresh: [{\n type: Input\n }], triggerFocus: [{\n type: Input\n }], leftOuterSelectionBarElement: [{\n type: ViewChild,\n args: [\"leftOuterSelectionBar\", {\n read: SliderElementDirective,\n static: false,\n }]\n }], rightOuterSelectionBarElement: [{\n type: ViewChild,\n args: [\"rightOuterSelectionBar\", {\n read: SliderElementDirective,\n static: false,\n }]\n }], fullBarElement: [{\n type: ViewChild,\n args: [\"fullBar\", { read: SliderElementDirective, static: false }]\n }], selectionBarElement: [{\n type: ViewChild,\n args: [\"selectionBar\", { read: SliderElementDirective, static: false }]\n }], minHandleElement: [{\n type: ViewChild,\n args: [\"minHandle\", { read: SliderHandleDirective, static: false }]\n }], maxHandleElement: [{\n type: ViewChild,\n args: [\"maxHandle\", { read: SliderHandleDirective, static: false }]\n }], floorLabelElement: [{\n type: ViewChild,\n args: [\"floorLabel\", { read: SliderLabelDirective, static: false }]\n }], ceilLabelElement: [{\n type: ViewChild,\n args: [\"ceilLabel\", { read: SliderLabelDirective, static: false }]\n }], minHandleLabelElement: [{\n type: ViewChild,\n args: [\"minHandleLabel\", { read: SliderLabelDirective, static: false }]\n }], maxHandleLabelElement: [{\n type: ViewChild,\n args: [\"maxHandleLabel\", { read: SliderLabelDirective, static: false }]\n }], combinedLabelElement: [{\n type: ViewChild,\n args: [\"combinedLabel\", { read: SliderLabelDirective, static: false }]\n }], ticksElement: [{\n type: ViewChild,\n args: [\"ticksElement\", { read: SliderElementDirective, static: false }]\n }], tooltipTemplate: [{\n type: ContentChild,\n args: [\"tooltipTemplate\", { static: false }]\n }], sliderElementVerticalClass: [{\n type: HostBinding,\n args: [\"class.vertical\"]\n }], sliderElementAnimateClass: [{\n type: HostBinding,\n args: [\"class.animate\"]\n }], sliderElementWithLegendClass: [{\n type: HostBinding,\n args: [\"class.with-legend\"]\n }], sliderElementDisabledAttr: [{\n type: HostBinding,\n args: [\"attr.disabled\"]\n }], sliderElementAriaLabel: [{\n type: HostBinding,\n args: [\"attr.aria-label\"]\n }], onResize: [{\n type: HostListener,\n args: [\"window:resize\", [\"$event\"]]\n }] } });\n\n/**\n * NgxSlider module\n *\n * The module exports the slider component\n */\nclass NgxSliderModule {\n static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"17.0.3\", ngImport: i0, type: NgxSliderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });\n static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"14.0.0\", version: \"17.0.3\", ngImport: i0, type: NgxSliderModule, declarations: [SliderComponent,\n SliderElementDirective,\n SliderHandleDirective,\n SliderLabelDirective,\n TooltipWrapperComponent], imports: [CommonModule], exports: [SliderComponent] });\n static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"17.0.3\", ngImport: i0, type: NgxSliderModule, imports: [CommonModule] });\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"17.0.3\", ngImport: i0, type: NgxSliderModule, decorators: [{\n type: NgModule,\n args: [{\n imports: [\n CommonModule\n ],\n declarations: [\n SliderComponent,\n SliderElementDirective,\n SliderHandleDirective,\n SliderLabelDirective,\n TooltipWrapperComponent\n ],\n exports: [\n SliderComponent\n ]\n }]\n }] });\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { AllowUnsafeHtmlInSlider, ChangeContext, LabelType, NgxSliderModule, Options, PointerType, SliderComponent };\n","\n
\n
\n

\n {{ sliderData.title | translate }}\n

\n
\n \n
\n \n {{ sliderData.lowValue | translate }}\n

\n \n {{ sliderData.highValue | translate }}\n

\n
\n
\n\n","/* eslint-disable @typescript-eslint/no-empty-function */\nimport {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n Input,\n OnInit,\n Output,\n ViewEncapsulation,\n} from '@angular/core';\nimport { NgxSliderModule, Options } from 'ngx-slider-v2';\nimport { ReactiveFormsModule, UntypedFormControl } from '@angular/forms';\nimport { SliderTranslationData } from '../../interfaces/slider-translation-data.interface';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { CommonModule } from '@angular/common';\n\n@Component({\n selector: 'app-slider',\n templateUrl: './slider.component.html',\n styleUrls: ['./slider.component.scss'],\n imports: [\n CommonModule,\n TranslateModule,\n NgxSliderModule,\n ReactiveFormsModule,\n ],\n encapsulation: ViewEncapsulation.None,\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SliderComponent implements OnInit {\n @Input() value: string;\n @Input({ required: true }) min: number;\n @Input({ required: true }) max: number;\n @Input({ required: true }) control: UntypedFormControl;\n @Input() colorfulSlideBar: boolean;\n @Input() sliderData: SliderTranslationData;\n\n @Output() valueChanged = new EventEmitter();\n\n protected options: Options;\n\n ngOnInit(): void {\n const steps = [this.min - 1];\n\n for (let i = this.min; i <= this.max + 1; i++) {\n steps.push(i);\n }\n\n const stepsArray = steps.map((v) => ({ value: v, legend: undefined }));\n\n this.options = {\n showSelectionBarEnd: true,\n showTicks: true,\n showTicksValues: true,\n stepsArray,\n maxLimit: steps.length - 2,\n };\n }\n\n protected userChangeEnd() {\n this.valueChanged.emit();\n }\n}\n","
    0\" class=\"bulleted-list\">\n
  • \n
    \n

    \n \n \n {{ 'LINK' | translate }}\n {{ source.link.includes('|') ? +link.key + 1 : null }}\n \n \n \n
    \n
  • \n
\n","import { Component, Input, ChangeDetectionStrategy } from '@angular/core';\nimport { Source } from '../../interfaces';\n\n@Component({\n selector: 'app-sources-list',\n templateUrl: './sources-list.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SourcesListComponent {\n @Input() sources: Source[];\n\n links(link: string): string[] {\n return link.replace(/\\s/g, '').split('|');\n }\n}\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ContentChildren,\n QueryList,\n} from '@angular/core';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport { merge, Observable } from 'rxjs';\nimport { StepProgressStepComponent } from './step/step.component';\n\n@UntilDestroy()\n@Component({\n selector: 'app-step-progress',\n templateUrl: './step-progress.component.html',\n styleUrls: ['./step-progress.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class StepProgressComponent implements AfterViewInit {\n @ContentChildren(StepProgressStepComponent, { descendants: true })\n steps: QueryList;\n\n constructor(private cdRef: ChangeDetectorRef) {}\n\n ngAfterViewInit() {\n this.updateStepsCompletedStates();\n\n const stepsActiveChanges = merge(\n ...this.steps.map((step: StepProgressStepComponent) => step.activeChanged)\n ) as Observable;\n stepsActiveChanges\n .pipe(untilDestroyed(this))\n .subscribe(() => this.updateStepsCompletedStates());\n }\n\n private updateStepsCompletedStates() {\n const stepsArr = this.steps.toArray();\n const lastActiveIndex = stepsArr\n .map((step: StepProgressStepComponent) => !!step.active)\n .lastIndexOf(true);\n\n setTimeout(() => {\n stepsArr.map((step: StepProgressStepComponent, index: number) => {\n step.completed = index <= lastActiveIndex;\n step.nextCompleted = index < lastActiveIndex;\n });\n this.cdRef.markForCheck();\n });\n }\n}\n","\n \n\n","import {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n HostBinding,\n Input,\n Output,\n} from '@angular/core';\n\n@Component({\n selector: 'app-step-progress-step',\n templateUrl: './step.component.html',\n styleUrls: ['./step.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class StepProgressStepComponent {\n @Input()\n get active(): boolean {\n return this.isActive;\n }\n set active(value: boolean) {\n this.isActive = value;\n this.activeChanged.emit();\n }\n\n @Output() activeChanged = new EventEmitter();\n\n @HostBinding('class.step-completed') completed = false;\n @HostBinding('class.next-step-completed') nextCompleted = false;\n\n private isActive = false;\n}\n","
\n
\n \n
\n\n
\n
\n
\n
\n","import { Component } from '@angular/core';\n\n@Component({\n selector: 'app-unsupported-browser-banner',\n templateUrl: 'unsupported-browser-banner.component.html',\n})\nexport class UnsupportedBrowserComponent {}\n","
\n

{{ 'UNSUPPORTED_BROWSER.MESSAGE' | translate }}

\n

\n {{\n 'LINK' | translate\n }}\n

\n
\n","\n
\n

\n {{ title }}\n

\n

\n {{ text }}\n

\n
\n \n {{ 'WALKTROUGH.SKIP' | translate }}\n

\n 1\"\n class=\"p4-regular gmb-0 gmr-8 ms-auto text-white\"\n >\n {{ 'WALKTROUGH.STEP' | translate }} {{ step }}/{{ totalSteps }}\n

\n \n {{\n (step === totalSteps ? 'WALKTROUGH.GOT_IT' : 'WALKTROUGH.NEXT')\n | translate\n }}\n \n
\n
\n\n","import {\n Component,\n Input,\n OnInit,\n OnDestroy,\n ElementRef,\n HostBinding,\n} from '@angular/core';\nimport { Subject } from 'rxjs';\nimport { filter, takeUntil } from 'rxjs/operators';\nimport { WalkTroughPopoverService } from '../../services/walk-trough-popover.service';\nimport { AnalyticsService } from '@geneplanet/ngx-utils';\n@Component({\n selector: 'app-walk-trough',\n templateUrl: './walk-trough-popover.component.html',\n styleUrls: ['./walk-trough-popover.component.scss'],\n})\nexport class WalkTroughComponent implements OnInit, OnDestroy {\n @Input() walkTroughId: string;\n @Input() title: string = null;\n @Input() text: string = null;\n\n @HostBinding('class.d-flex') display = true;\n\n step: number;\n totalSteps: number;\n showPopover = false;\n\n private destroy$ = new Subject();\n\n constructor(\n public elRef: ElementRef,\n private popoverService: WalkTroughPopoverService,\n private analyticsService: AnalyticsService\n ) {}\n\n ngOnInit() {\n this.popoverService\n .listen()\n .pipe(\n filter(\n () => this.popoverService.getWalkTroughId() === this.walkTroughId\n ),\n takeUntil(this.destroy$)\n )\n .subscribe(() => {\n this.step = this.popoverService.getStep();\n this.totalSteps = this.popoverService.getTotalSteps();\n this.showPopover = true;\n });\n }\n\n ngOnDestroy() {\n this.destroy$.next();\n this.showPopover = false;\n }\n\n skip() {\n this.popoverService.complete();\n this.showPopover = false;\n this.analyticsService.trackClicksManually('walkthrough-skip');\n }\n\n next() {\n this.popoverService.next();\n this.showPopover = false;\n this.analyticsService.trackClicksManually(\n this.step === this.totalSteps ? 'walkthrough-got-it' : 'walkthrough-next'\n );\n }\n}\n","export default {\n INVALID_VALUE: 'EC_V_001',\n VALUE_OUT_OF_RANGE: 'EC_V_002',\n TG_HDL_ERROR: 'EC_U_001',\n};\n","export const SemanticType = {\n MOST_FAVOURABLE: 'MostFavourable',\n FAVOURABLE: 'Favourable',\n NEUTRAL: 'Neutral',\n AVERAGE: 'Average',\n LESS_FAVOURABLE: 'LessFavourable',\n UNFAVOURABLE: 'Unfavourable',\n UNKNOWN: 'Unknown',\n};\n\nexport const SemanticTypeValue = {\n [SemanticType.UNKNOWN]: 6,\n [SemanticType.NEUTRAL]: 5,\n [SemanticType.MOST_FAVOURABLE]: 4,\n [SemanticType.FAVOURABLE]: 3,\n [SemanticType.AVERAGE]: 2,\n [SemanticType.LESS_FAVOURABLE]: 1,\n [SemanticType.UNFAVOURABLE]: 0,\n};\n","import {\n Directive,\n ElementRef,\n HostListener,\n Input,\n NgZone,\n} from '@angular/core';\nimport { PlatformService } from '../services/platform.service';\n\n@Directive({\n selector: '[appMobileScrollOnFocus]',\n standalone: true\n})\nexport class ScrollOnFocusDirective {\n @Input() appMobileScrollOnFocus = true;\n constructor(\n private el: ElementRef,\n private platform: PlatformService,\n private _ngZone: NgZone\n ) {}\n\n @HostListener('focus') onFocus(): void {\n if (\n this.appMobileScrollOnFocus === false ||\n (!this.platform.ANDROID && !this.platform.IOS)\n ) {\n return;\n }\n this.scrollIntoView();\n }\n\n private scrollIntoView(): void {\n this._ngZone.runOutsideAngular(() => {\n setTimeout(() => {\n const header = document\n .getElementById('header')\n .getBoundingClientRect();\n const offset = this.el.nativeElement.offsetTop;\n\n window.scrollTo({\n top: offset - header.height - 30,\n behavior: 'smooth',\n });\n }, 100);\n });\n }\n}\n","// Rename to IntentMilestons\nexport enum OnboardingIntentStep {\n Welcome = 'Welcome',\n Register = 'Register',\n Newsletter = 'Newsletter',\n Caution = 'Caution',\n Check = 'Check',\n DownloadAfterCheck = 'DownloadAfterCheck',\n Login = 'Login',\n Onboarding = 'Onboarding',\n DownloadAfterOnBoarding = 'DownloadAfterOnBoarding',\n PushNotifications = 'PushNotifications',\n Claim = 'Claim',\n Consent = 'Consent',\n Sample = 'Sample',\n Complete = 'Complete',\n End = 'End',\n}\n\nexport enum OnboardingType {\n DNA = 'dna',\n BLOOD = 'blood',\n LAB = 'lab',\n NIPT = 'nipt',\n}\n","export enum IntroId {\n BLOOD = 'blood',\n HEALTHSCORE = 'healthscore',\n MY_LIFESTYLE = 'my-lifestyle',\n MY_HEALTH = 'my-health',\n MY_ANCESTRY = 'my-ancestry',\n PRS = 'prs',\n ORAL_MICROBIOME = 'oral-microbiome',\n ACTIVITY = 'activity',\n NUTRITION = 'nutrition',\n}\n","export enum IntroModalType {\n SWIPER = 'swiper',\n IMAGE_SWIPER = 'image-swiper',\n}\n","import { Injectable } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n CanActivate,\n CanActivateChild,\n Router,\n} from '@angular/router';\nimport { environment } from 'src/environments/environment';\n\n@Injectable({ providedIn: 'root' })\n/**\n * @deprecated Instead use `canViewFeature` functional guard, which supports localization\n */\nexport class FeatureFlagGuard implements CanActivateChild, CanActivate {\n constructor(private readonly router: Router) {}\n\n static isFeatureActive(feature: string) {\n if (environment.features[feature] !== undefined) {\n return environment.features[feature];\n }\n return true;\n }\n\n canActivate(route: ActivatedRouteSnapshot) {\n if (!FeatureFlagGuard.isFeatureActive(route.data.feature)) {\n return this.router.parseUrl('/');\n }\n return true;\n }\n\n canActivateChild(route: ActivatedRouteSnapshot) {\n return this.canActivate(route);\n }\n}\n","\n
\n \n \n \n
\n\n\n
\n \n
\n
\n
\n \n \n \n \n
\n
\n
\n

\n {{ title | translate }}\n

\n

\n {{ description | translate }}\n

\n \n {{ button | translate }}\n \n
\n
\n
\n
\n\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n HostBinding,\n Input,\n OnInit,\n} from '@angular/core';\nimport { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport { BreakpointObserver, BreakpointState } from '@angular/cdk/layout';\nimport { GpuMediaQueryBreakpoints, GPU_MEDIA_QUERIES } from '@geneplanet/ngx-ui/src/lib/layout';\n\n@UntilDestroy()\n@Component({\n selector: 'app-full-image-modal',\n templateUrl: './full-image-modal.component.html',\n styleUrls: ['./full-image-modal.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class FullImageModalComponent implements OnInit {\n @HostBinding('class') classAttribute = 'overflow-hidden';\n\n @Input() title: string;\n @Input() description: string;\n @Input() button: string;\n @Input() bgImg = '';\n @Input() bgImageType = 'jpg';\n @Input() dataTrackClose: string;\n @Input() dataTrackClick: string;\n\n @Input() closeClick = new EventEmitter();\n @Input() buttonClick = new EventEmitter();\n\n public viewHasInitialized = false;\n public isMobile = false;\n\n constructor(\n public modal: NgbActiveModal,\n private cdr: ChangeDetectorRef,\n private breakpointObserver: BreakpointObserver\n ) {\n this.breakpointObserver\n .observe(GPU_MEDIA_QUERIES[GpuMediaQueryBreakpoints.SM_DOWN])\n .pipe(untilDestroyed(this))\n .subscribe((value: BreakpointState) => {\n this.isMobile = value.matches;\n this.cdr.markForCheck();\n });\n }\n\n ngOnInit() {\n /* Fixes black screen on init. Can be removed with ng-bootstrap ^9.0 */\n setTimeout(() => {\n this.viewHasInitialized = true;\n this.cdr.markForCheck();\n }, 0);\n }\n\n close() {\n this.modal.dismiss();\n this.closeClick.emit();\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 {{ step.text | translate }}\n

\n
\n
\n \n \n \n \n \n \n
\n\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n HostBinding,\n Input,\n ViewChild,\n} from '@angular/core';\nimport { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport { ImageSwiperModalStep } from '../../interfaces';\nimport { BreakpointObserver, BreakpointState } from '@angular/cdk/layout';\nimport {\n GPU_MEDIA_QUERIES,\n GpuMediaQueryBreakpoints,\n} from '@geneplanet/ngx-ui/src/lib/layout';\n\n@UntilDestroy()\n@Component({\n selector: 'app-image-swiper-modal',\n templateUrl: './image-swiper-modal.component.html',\n styleUrls: ['./image-swiper-modal.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ImageSwiperModalComponent {\n @HostBinding('class') classAttribute = 'overflow-visible';\n @ViewChild('container') container: ElementRef;\n\n @Input() steps: ImageSwiperModalStep[] = [];\n\n protected isMobile = false;\n protected activePage = 0;\n\n constructor(\n protected modal: NgbActiveModal,\n private cdr: ChangeDetectorRef,\n private breakpointObserver: BreakpointObserver\n ) {\n this.breakpointObserver\n .observe(GPU_MEDIA_QUERIES[GpuMediaQueryBreakpoints.SM_DOWN])\n .pipe(untilDestroyed(this))\n .subscribe((value: BreakpointState) => {\n this.isMobile = value.matches;\n this.cdr.markForCheck();\n });\n }\n\n get numberOfSlides() {\n return Object.keys(this.steps).length;\n }\n\n protected onPageChanged(activePage: number) {\n this.activePage = activePage;\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 {{ step.title | translate }}\n

\n

\n
\n
\n
\n \n \n \n \n \n \n \n\n\n\n\n\n \n {{ confirmButtonText | translate }}\n \n\n","import { BreakpointObserver, BreakpointState } from '@angular/cdk/layout';\nimport {\n ChangeDetectorRef,\n Component,\n ElementRef,\n ViewChild,\n HostBinding,\n ChangeDetectionStrategy,\n Input,\n Injector,\n} from '@angular/core';\nimport {\n GPU_MEDIA_QUERIES,\n GpuMediaQueryBreakpoints,\n} from '@geneplanet/ngx-ui/src/lib/layout';\nimport { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport { TranslateService } from '@ngx-translate/core';\nimport { IntroId } from '../../enums/intro-id.enum';\nimport { IntroModalType } from '../../enums/intro-modal-type.enum';\nimport { SwiperModalStep } from '../../interfaces';\nimport { IntroModalService } from '../../services/intro-modal.service';\n\n@UntilDestroy()\n@Component({\n selector: 'app-swiper-modal',\n templateUrl: './swiper-modal.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SwiperModalComponent {\n @HostBinding('class') classAttribute = 'overflow-hidden';\n @ViewChild('container') container: ElementRef;\n @ViewChild('scrollContainer') set height(container: ElementRef) {\n this.minSlideHeight = container?.nativeElement.offsetHeight;\n }\n\n @Input() introId: IntroId;\n @Input() steps: SwiperModalStep[] = [];\n @Input() confirmButtonText: string;\n @Input() confirmed: boolean;\n @Input() containerClass = 'gpx-0 gpy-sm-72';\n\n protected isMobile = false;\n protected minSlideHeight = 0;\n protected activePage = 0;\n\n constructor(\n protected modal: NgbActiveModal,\n private injector: Injector,\n private translate: TranslateService,\n private cdr: ChangeDetectorRef,\n private breakpointObserver: BreakpointObserver\n ) {\n this.breakpointObserver\n .observe(GPU_MEDIA_QUERIES[GpuMediaQueryBreakpoints.SM_DOWN])\n .pipe(untilDestroyed(this))\n .subscribe((value: BreakpointState) => {\n this.isMobile = value.matches;\n this.cdr.markForCheck();\n });\n }\n\n get numberOfSlides() {\n return Object.keys(this.steps).length;\n }\n\n protected onPageChanged(activePage: number) {\n this.activePage = activePage;\n }\n\n protected close() {\n if (!this.confirmed) {\n this.injector\n .get(IntroModalService)\n .setIntroModalCompleted(this.introId, IntroModalType.SWIPER);\n }\n this.modal.dismiss();\n }\n\n protected getImgSm(step) {\n const lang = this.translate.currentLang;\n return step[`img-s-${lang}`] ? step[`img-s-${lang}`] : step[`img-s`];\n }\n\n protected getImgLg(step) {\n const lang = this.translate.currentLang;\n return step[`img-l-${lang}`] ? step[`img-l-${lang}`] : step[`img-l`];\n }\n}\n","
\n \n \n \n
\n
\n \n
\n \n

\n {{ 'WEARABLES.BROWSER.CONNECT_APP.TITLE' | translate }}\n

\n

\n {{ 'WEARABLES.BROWSER.CONNECT_APP.TEXT' | translate }}\n

\n\n \n
\n \n {{ 'WEARABLES.BROWSER.CONNECT_APP.BUTTON' | translate }}\n \n
\n
\n
\n
\n
\n\n\n \n \n
\n
\n \"qr\n
\n

\n {{ 'WEARABLES.BROWSER.CONNECT_APP.SCAN' | translate }}\n

\n

\n {{ 'WEARABLES.BROWSER.CONNECT_APP.POINT' | translate }}\n

\n
\n \n \n
\n
\n\n \n
\n

\n {{ 'WEARABLES.BROWSER.CONNECT_APP.DOWNLOAD' | translate }}\n

\n
\n \n
\n
\n \n \n
\n
\n \n
\n\n\n \n \n \n\n\n\n \n \n \n\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\nimport { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';\nimport { PlatformService } from 'src/app/shared/services/platform.service';\n\n@Component({\n selector: 'app-wearables-modal',\n templateUrl: './wearables-modal.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class WearablesModalComponent {\n public showQr = false;\n\n constructor(\n public modal: NgbActiveModal,\n private platformService: PlatformService\n ) {}\n\n isPlatformIOS() {\n return this.platformService.IOS;\n }\n\n isPlatformAndroid() {\n return this.platformService.ANDROID;\n }\n\n toggleQrView() {\n this.showQr = true;\n }\n\n get platformImg() {\n if (this.isPlatformAndroid()) {\n return 'connect-google-fit.svg';\n } else if (this.isPlatformIOS()) {\n return 'connect-health.svg';\n } else {\n return 'connect-app.svg';\n }\n }\n}\n","import { JwtHelperService } from '@auth0/angular-jwt';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\nimport { Auth0Account } from 'src/app/accounts/interfaces/accounts.types';\n\n/**\n * RxJS operator that converts JWT token to Auth0Account\n *\n * Example:\n * ```\n * this.auth0.token$\n * .pipe(extractAccount())\n * .subscribe((account: Auth0Account) => {\n * ```\n */\nexport function extractAccount() {\n return (source: Observable): Observable =>\n source.pipe(\n map((token: string) => {\n return decodeToken(token);\n })\n );\n}\n\nexport function decodeToken(token: string): Auth0Account {\n return new JwtHelperService().decodeToken(JSON.parse(token || '{}').idToken);\n}\n","\n \n \n\n \n

\n {{ type === AnalysesTypesLowercase.Blood ? report.name : report.title }}\n

\n
\n \n

\n {{ report.generated | localDate }}\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 {{ 'ERROR' | translate }}\n {{ 'FAILURE.GENERAL_ERROR.CONTENT' | translate }}\n
\n
\n \n \n \n
\n","/* eslint-disable @typescript-eslint/no-empty-function */\nimport { catchError, map, tap } from 'rxjs/operators';\nimport { Component, OnInit } from '@angular/core';\nimport { ActivatedRoute, ParamMap } from '@angular/router';\nimport { Observable, of } from 'rxjs';\nimport { AnalysesService } from 'src/app/analyses/services/analyses.service';\nimport {\n AnalysesTypesLowercase,\n AnalysesTypes,\n DnaReportAnalysis,\n} from 'src/app/analyses/interfaces/analyses.types';\n\nimport { Report } from 'src/app/core/interfaces/results.types';\nimport { ResultsService } from 'src/app/core/services/results.service';\nimport { SemanticTypeValue } from 'src/app/shared/constants/semantic-type';\n\n@Component({\n selector: 'app-results-view',\n templateUrl: './results-view.component.html',\n})\nexport class ResultsViewComponent implements OnInit {\n public readonly AnalysesTypesLowercase = AnalysesTypesLowercase;\n public readonly AnalysesTypes = AnalysesTypes;\n report$: Observable;\n analyses$: Observable;\n type: string;\n id: string;\n error = null;\n\n constructor(\n private readonly route: ActivatedRoute,\n private readonly resultsService: ResultsService,\n private readonly analysesService: AnalysesService\n ) {}\n\n ngOnInit(): void {\n this.route.paramMap.subscribe((params: ParamMap) => {\n this.type = this.route.snapshot.data?.type;\n this.id = params.get('id');\n\n this.report$ = this.resultsService.get(this.id, this.type).pipe(\n map((report) => {\n if (this.type === AnalysesTypesLowercase.Blood) {\n const reportSorted = {\n ...report,\n analyses: this.sortAnalyses(report),\n };\n return reportSorted;\n }\n return report;\n }),\n catchError((error) => {\n this.error = error;\n return of(null);\n }),\n tap((report) => {\n // Log user has viewed this report\n this.resultsService.logViewed(report?.id, this.type).subscribe(\n () => {},\n () => {} // Catch error, can fail for older results\n );\n })\n );\n if (this.type == AnalysesTypesLowercase.DNA) {\n this.analyses$ = this.analysesService\n .getDnaReportAnalyses(this.id)\n .pipe(\n map((analyses: DnaReportAnalysis[]) =>\n this.analysesService.sortDnaBySemanticType(analyses)\n ),\n map((analyses) =>\n this.analysesService.hideAnalysesWithoutResults(analyses)\n )\n );\n }\n });\n }\n\n sortAnalyses(report) {\n // Sort analyses by semanticValue -> shortName\n const sortByName = (a, b) =>\n a.name.toLowerCase().localeCompare(b.name.toLowerCase());\n\n const sorted = report.analyses.sort((a, b) => {\n const typeA = SemanticTypeValue[a.semanticType];\n const typeB = SemanticTypeValue[b.semanticType];\n return typeA === typeB ? sortByName(a, b) : typeA - typeB;\n });\n\n return sorted;\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\n@Pipe({\n name: 'age',\n})\nexport class AgePipe implements PipeTransform {\n transform(value: string): number {\n const today = new Date();\n const birthdate = new Date(value);\n\n let age = today.getFullYear() - birthdate.getFullYear();\n const m = today.getMonth() - birthdate.getMonth();\n\n if (m < 0 || (m === 0 && today.getDate() < birthdate.getDate())) {\n age--;\n }\n return age;\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { environment } from 'src/environments/environment';\n\n@Pipe({ name: 'chapterImage' })\nexport class ChapterImagePipe implements PipeTransform {\n transform(reportId: string): string {\n const PATH = '/assets/images/';\n\n switch (reportId) {\n case environment.products.dietAndNutrition:\n return PATH + 'my-lifestyle/chapter/diet-and-nutrition.png';\n case environment.products.bodyAndMind:\n return PATH + 'my-lifestyle/chapter/body-and-mind.png';\n case environment.products.sportAndRecreation:\n return PATH + 'my-lifestyle/chapter/sport-and-recreation.png';\n case environment.products.prsCancer:\n return PATH + 'my-health/chapter/cancer-risk.png';\n case environment.products.immuneSystem:\n return PATH + 'my-health/chapter/immune-system.png';\n }\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\nenum Colors {\n MostFavourable = '#33C7C9',\n Favourable = '#45E4E2',\n Neutral = '#889AF8',\n Average = '#FFD735',\n LessFavourable = '#FFB233',\n Unfavourable = '#FF6199',\n MostUnfavourable = '#D1517F',\n Unknown = '#9599AA',\n UnknownLight = '#E5E5EA',\n Risk = '#FF9BBE',\n}\n\nenum MicrobiomeColors {\n Neutral = '#7CB5EC',\n Bad = '#F15C80',\n Good = '#90ED7D',\n}\n\n@Pipe({ name: 'colorize' })\nexport class ColorizePipe implements PipeTransform {\n transform(input: string, microbiomeColors = false): string {\n // If there is no input to compare return it.\n // In analysis-link we rely on not returning color for undefined/null.\n if (!input) {\n return input;\n }\n return microbiomeColors ? MicrobiomeColors[input] : Colors[input];\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { TranslateService } from '@ngx-translate/core';\nimport { DecimalPipe } from '@angular/common';\n\n@Pipe({\n name: 'decimal',\n})\nexport class DecimalPlacesPipe implements PipeTransform {\n constructor(private translate: TranslateService) {}\n\n transform(value: any, transform = true) {\n if (!transform || isNaN(value)) {\n return value;\n }\n\n value = +value;\n let digitsInfo = '1.3-3';\n\n if (value >= 100) {\n digitsInfo = '1.0-0';\n } else if (value >= 10 && value < 100) {\n digitsInfo = '1.1-1';\n } else if (value >= 1 && value < 10) {\n digitsInfo = '1.2-2';\n }\n\n const decimalPipe = new DecimalPipe(this.translate.currentLang);\n return decimalPipe.transform(value, digitsInfo);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { LanguageService } from '../services/language.service';\nimport { isFeatureActive } from '../util/feature-active';\n\n@Pipe({\n name: 'isFeatureActive',\n standalone: true,\n pure: false,\n})\nexport class FeatureActivePipe implements PipeTransform {\n constructor(private languageService: LanguageService) {}\n\n transform(featureName: string): boolean {\n const location = this.languageService.locationCode;\n\n return isFeatureActive(location, featureName);\n }\n}\n","import { ToTypeIdPipe } from './toTypeId.pipe';\nimport { LocalDatePipe } from './local-date.pipe';\nimport { AgePipe } from './age.pipe';\nimport { YoutubeCaptionsPipe } from './youtube-captions.pipe';\nimport { TimeAgoPipe } from './time-ago.pipe';\nimport { RefMinMaxPipe } from './ref-min-max.pipe';\nimport { ChapterImagePipe } from './chapter-image.pipe';\nimport { SafeHtmlPipe } from './safe-html.pipe';\nimport { DecimalPlacesPipe } from './decimal-places.pipe';\nimport { TransformUnitsPipe } from './transform-units.pipe';\nimport { ColorizePipe } from './colorize.pipe';\n\nexport const pipes = [\n ToTypeIdPipe,\n LocalDatePipe,\n AgePipe,\n YoutubeCaptionsPipe,\n TimeAgoPipe,\n RefMinMaxPipe,\n ChapterImagePipe,\n SafeHtmlPipe,\n DecimalPlacesPipe,\n TransformUnitsPipe,\n ColorizePipe,\n];\n\nexport {\n ToTypeIdPipe,\n LocalDatePipe,\n AgePipe,\n YoutubeCaptionsPipe,\n TimeAgoPipe,\n RefMinMaxPipe,\n ChapterImagePipe,\n SafeHtmlPipe,\n DecimalPlacesPipe,\n TransformUnitsPipe,\n ColorizePipe,\n};\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { TranslateService } from '@ngx-translate/core';\nimport { formatDate } from '@angular/common';\n\n@Pipe({\n name: 'localDate',\n pure: false\n})\nexport class LocalDatePipe implements PipeTransform {\n constructor(private translate: TranslateService) {}\n\n transform(value: any, format?: string) {\n if (!value) {\n return '';\n }\n\n if (!format) {\n format = 'mediumDate';\n }\n\n return formatDate(value, format, this.translate.currentLang);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { GptLocalNumberPipe } from '@geneplanet/ngx-utils/src/lib/localization';\nimport { TranslateService } from '@ngx-translate/core';\n\n@Pipe({\n name: 'refMinMax',\n})\nexport class RefMinMaxPipe implements PipeTransform {\n constructor(private translate: TranslateService) {}\n\n transform(metric: { from: any; to: any }): string {\n const hasFrom = this.isNumber(metric.from);\n const hasTo = this.isNumber(metric.to);\n\n const toDecimal = (val: string) => {\n return new GptLocalNumberPipe(this.translate).transform(\n Number(val),\n '1.1-2'\n );\n };\n\n if (!hasFrom && !hasTo) {\n return '';\n } else if (hasFrom && hasTo) {\n return `${toDecimal(metric.from)}–${toDecimal(metric.to)}`;\n } else if (hasFrom) {\n return `≥ ${toDecimal(metric.from)}`;\n } else if (hasTo) {\n return `< ${toDecimal(metric.to)}`;\n }\n }\n\n private isNumber(value: any): boolean {\n return !isNaN(value) && value !== '' && value !== null;\n }\n}\n","import { DomSanitizer } from '@angular/platform-browser';\nimport { PipeTransform, Pipe } from '@angular/core';\n\n@Pipe({ name: 'safeHtml' })\nexport class SafeHtmlPipe implements PipeTransform {\n constructor(private sanitized: DomSanitizer) {}\n transform(value) {\n return this.sanitized.bypassSecurityTrustHtml(value);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { TranslateService } from '@ngx-translate/core';\nimport { LocalDatePipe } from './local-date.pipe';\n\n@Pipe({\n name: 'timeAgo',\n})\nexport class TimeAgoPipe implements PipeTransform {\n constructor(\n private translate: TranslateService,\n private localDate: LocalDatePipe\n ) {}\n\n transform(date: string | Date): string {\n const differenceInTime = new Date().getTime() - new Date(date).getTime();\n const differenceInDays = Math.floor(differenceInTime / (1000 * 3600 * 24));\n const rules = [\n {\n match: differenceInDays >= 0 && differenceInDays <= 90,\n label: this.localDate.transform(date),\n },\n {\n match: differenceInDays >= 91 && differenceInDays <= 329,\n label: this.translate.instant('TIMEAGO.MONTHS', {\n value: Math.floor(differenceInDays / 28),\n }),\n },\n {\n match: differenceInDays >= 330 && differenceInDays <= 400,\n label: this.translate.instant('TIMEAGO.YEAR'),\n },\n {\n match: differenceInDays > 400,\n label: this.translate.instant('TIMEAGO.YEARS'),\n },\n ];\n\n return rules.find((rule) => rule.match).label;\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { Observable, of } from 'rxjs';\nimport { map, switchMap } from 'rxjs/operators';\n\nimport { Type } from 'src/app/analyses/interfaces/analyses.types';\nimport { AnalysesService } from 'src/app/analyses/services/analyses.service';\n\n@Pipe({\n name: 'toTypeId',\n})\nexport class ToTypeIdPipe implements PipeTransform {\n constructor(private readonly service: AnalysesService) {}\n\n transform(type: Observable | string): Observable {\n const type$ = typeof type === 'string' ? of(type) : type;\n return type$.pipe(\n switchMap((t) => {\n return this.service.getTypes().pipe(\n map((data: Type[]) => {\n const find = data.find((types) => types.type === t);\n return find ? find.id : undefined;\n })\n );\n })\n );\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { SafeHtml } from '@angular/platform-browser';\n\n@Pipe({ name: 'transformUnits' })\nexport class TransformUnitsPipe implements PipeTransform {\n /**\n * Replace units that contain ^N and replace with `N`.\n * Returns SaveHtml, so use with `innerHtml` or `outerHtml`\n *\n * Example: ``\n * @param value String with unit\n */\n transform(value: string): SafeHtml {\n // Prevent null and undefined crash\n if (!value || typeof value !== 'string') {\n return value;\n }\n\n if (value.indexOf('^') > -1) {\n return this.replaceToPower(value);\n }\n\n return value;\n }\n\n private replaceToPower(value: string): SafeHtml {\n // Replace *10^9/L with *109/L\n return value.replace(/(\\^[0-9]+)/g, (pow) => {\n return `${pow.replace('^', '')}`;\n });\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';\nimport { TranslateService } from '@ngx-translate/core';\nimport { environment } from 'src/environments/environment';\n\n@Pipe({\n name: 'youtubeCaptions',\n})\nexport class YoutubeCaptionsPipe implements PipeTransform {\n constructor(\n private sanitizer: DomSanitizer,\n private translate: TranslateService\n ) {}\n\n /**\n * Add query parameters to embed url, to turn on captions for slovenian language.\n * @param url YouTube embed url\n */\n transform(url: string): SafeResourceUrl {\n const currentLanguageObj = environment.locations.find(\n (obj) => obj.lang.code === this.translate.currentLang\n );\n if (currentLanguageObj.lang.videoSubtitles) {\n const prefix = url.indexOf('?') > -1 ? '&' : '?';\n return this.sanitizer.bypassSecurityTrustResourceUrl(\n `${url}${prefix}cc_load_policy=1&hl=${currentLanguageObj.lang.code}`\n );\n }\n return this.sanitizer.bypassSecurityTrustResourceUrl(url);\n }\n}\n","import { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { mergeMap } from 'rxjs/operators';\n\nimport { JwtHelperService } from '@auth0/angular-jwt';\n\nimport { Auth0Service } from '@geneplanet/ngx-auth0';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class CustomerCheckService {\n customerExists$: Observable = this.auth0.token$.pipe(\n mergeMap((token: string) => {\n return new Observable((observer) => {\n const account = new JwtHelperService().decodeToken(\n JSON.parse(token || '{}').accessToken\n );\n\n const isCustomer =\n account && !!account['http://schemas.nomnio.com/2017/5/customer'];\n return observer.next(isCustomer);\n });\n })\n );\n\n constructor(private readonly auth0: Auth0Service) {}\n}\n","import { Injector } from '@angular/core';\nimport { ActivatedRoute, Router, UrlTree } from '@angular/router';\nimport { Observable, of } from 'rxjs';\nimport { first, tap } from 'rxjs/operators';\nimport { CreateAccount } from 'src/app/accounts/interfaces/accounts.types';\nimport { AccountsService } from 'src/app/accounts/services/accounts.service';\nimport { QuestionnaireService } from 'src/app/healthscore/services/questionnaire.service';\nimport { OnboardingIntentStep } from 'src/app/shared/enums/intent.enum';\nimport { IntentStrategy, IntentStrategyConfig } from './intent.strategy';\n// eslint-disable-next-line @typescript-eslint/naming-convention\nimport * as Sentry from '@sentry/angular';\n\nexport class GeneralIntentStrategy implements IntentStrategy {\n router: Router;\n route: ActivatedRoute;\n questionnaireService: QuestionnaireService;\n accountService: AccountsService;\n\n constructor(private injector: Injector) {\n this.router = this.injector.get(Router);\n this.route = this.injector.get(ActivatedRoute);\n this.questionnaireService = this.injector.get(QuestionnaireService);\n this.accountService = this.injector.get(AccountsService);\n }\n\n public getConfig(): IntentStrategyConfig {\n return {\n [OnboardingIntentStep.Caution]: {\n paragraph1: 'ACCOUNTS.CAUTION.GENERAL.PARAGRAPH_1',\n paragraph2: 'ACCOUNTS.CAUTION.GENERAL.PARAGRAPH_2',\n },\n [OnboardingIntentStep.Complete]: {\n title: 'ONBOARDING.COMPLETE.COMPLETE',\n description: 'ONBOARDING.COMPLETE.YOUR_REGISTRATION_IS',\n },\n };\n }\n\n public onRegisterCreateAccount({\n skipEmailVerification,\n ...rest\n }: CreateAccount): Observable {\n return this.accountService.create(rest).pipe(\n tap(() => {\n const queryParams = skipEmailVerification ? { skip: true } : {};\n\n this.router.navigate(['/accounts/newsletters'], {\n // masking query parameter which is used for skipping verified guard -> Questioner onboarding\n queryParams,\n replaceUrl: true,\n });\n })\n );\n }\n\n public onRegisterLogin(): void {\n this.router.navigate(['/accounts/check']);\n }\n\n public onNewsletterNextStep(): void {\n this.router.navigate(['/accounts/caution'], {\n queryParamsHandling: 'preserve',\n });\n }\n\n public onCautionNextStep(): void {\n this.route.queryParams.pipe(first()).subscribe((params) => {\n const skipEmailVerification = params?.skip && JSON.parse(params.skip);\n\n if (skipEmailVerification) {\n this.router.navigate(['/onboarding/details'], {\n queryParams: { skip: true },\n });\n } else {\n this.router.navigate(['/accounts/verify']);\n }\n });\n }\n\n public onNotValidatedEmail(): Observable {\n return of(this.router.parseUrl('/accounts/verify'));\n }\n\n public onVerifyGoToLogin(): void {\n this.router.navigate(['/accounts/check']);\n }\n\n public onEmailActivation(): Observable {\n return of(\n this.router.parseUrl(\n '/accounts/check?returnUrl=%onboarding%2Fdownload%2F'\n )\n );\n }\n\n public onSkipEmailActivation(): Observable {\n return of(this.router.parseUrl('/onboarding/details'));\n }\n\n public onDownloadAfterCheckSkipClick(): void {\n this.router.navigate(['/onboarding/details']);\n }\n\n public onAlreadyActivitedEmailGoToLogin(): void {\n this.router.navigate(['/accounts/check']);\n }\n\n public onLoginRegister(): void {\n this.router.navigate(['/accounts/create']);\n }\n\n public onLoginSuccessfully(returnUrl: string): void {\n if (returnUrl) {\n this.router.navigateByUrl(returnUrl, {\n replaceUrl: true,\n });\n } else {\n this.router.navigate(['/dashboard'], { replaceUrl: true });\n }\n }\n\n public onCreateCustomerSuccessfully(): void {\n this.questionnaireService.saveQuestionnaire().subscribe((saved) => {\n if (saved) {\n this.accountService.resend().pipe(first()).subscribe();\n }\n });\n this.router.navigate(['/onboarding/complete']);\n }\n\n public onCompleteCloseClick(): void {\n this.router.navigate(['/onboarding/track']);\n }\n\n public onTrackSkipClick(): void {\n this.router.navigate(['/dashboard']);\n }\n\n public onCustomerNotExists(): Observable {\n return of(this.router.parseUrl('/onboarding/details'));\n }\n\n public onCustomerExists(): Observable {\n return of(this.router.parseUrl('/dashboard'));\n }\n\n public onUserNotExists(): Observable {\n return of(this.router.parseUrl('/accounts/check'));\n }\n\n public onCustomerWelcomeExists(): Observable {\n return of(this.router.parseUrl('/dashboard'));\n }\n\n public onFallback(): void {\n Sentry.captureException(`[INTENT error] Using fallback for missing intent`);\n this.router.navigate(['/dashboard']); \n }\n}\n","import { UrlTree } from '@angular/router';\nimport { EMPTY, Observable } from 'rxjs';\nimport { CreateAccount } from 'src/app/accounts/interfaces/accounts.types';\nimport { RefResponse } from 'src/app/nipt/interfaces/ref-response.interface';\nimport { LaboratoryName } from 'src/app/onboarding/lab/enums/lab.enum';\nimport {\n OnboardingIntentStep,\n OnboardingType,\n} from 'src/app/shared/enums/intent.enum';\nimport { OnboardingPaths } from 'src/app/shared/interfaces/intent.interface';\n\nexport interface IntentStrategyConfig {\n type?: OnboardingType;\n steps?: OnboardingPaths;\n [OnboardingIntentStep.Welcome]?: {\n title: string;\n description: string;\n };\n [OnboardingIntentStep.Caution]: {\n paragraph1: string;\n paragraph2: string;\n };\n [OnboardingIntentStep.Complete]?: {\n title: string;\n description: string;\n };\n}\n\n/*\n Namming - on|NameOfScreen|ActionName OR on|ActionName\n Example - onWelcomeLogin OR onCustomerExists\n*/\nexport abstract class IntentStrategy {\n abstract getConfig(): IntentStrategyConfig;\n abstract onAppInit?(milestone: OnboardingIntentStep): void;\n abstract onWelcomeInit?(forceInit?: boolean): Observable;\n abstract onWelcomeLogin?(): void;\n abstract onWelcomeCreateAccount?(): void;\n abstract onRegisterCreateAccount(account: CreateAccount): Observable;\n abstract onRegisterLogin(): void;\n abstract onNewsletterNextStep(): void;\n abstract onCautionNextStep(): void;\n abstract onNotValidatedEmail?(): Observable;\n abstract onVerifyGoToLogin(): void;\n abstract onDownloadAfterCheckSkipClick(): void;\n abstract onAlreadyActivitedEmailGoToLogin(): void;\n abstract onLoginSuccessfully(returnUrl?: string): void;\n abstract onLoginRegister(): void;\n abstract onCreateCustomerSuccessfully(): void;\n abstract onTrackSkipClick?(): void;\n abstract onCompleteCloseClick?(): void;\n abstract onLabClaimNextClick?(lab: LaboratoryName): void;\n abstract onLabClaimCancelIntent?(): Observable;\n abstract onKitClaimClaimClick?(\n isEU: string,\n collector: string\n ): Observable;\n abstract onKitConsentAgree?(): void;\n abstract onKitConsentDisagree?(): void;\n abstract onKitSampleSampleTaken?(): void;\n abstract onNiptClaimInit?(): Observable;\n abstract onNiptClaimActiveClick?(barcode: string): Observable;\n abstract onEmailActivation(): Observable;\n abstract onSkipEmailActivation(): Observable;\n abstract onUserNotExists(): Observable;\n abstract onCustomerNotExists(): Observable;\n abstract onCustomerExists(): Observable;\n abstract onCustomerWelcomeExists?(): Observable;\n abstract onFallback?(): void;\n}\n\nexport class IntentStrategyContext {\n public strategy: IntentStrategy;\n\n constructor(strategy: IntentStrategy) {\n this.strategy = strategy;\n }\n\n public getConfig(): IntentStrategyConfig {\n if (this.strategy.getConfig) {\n return this.strategy.getConfig();\n }\n }\n\n public onAppInit(milestone: OnboardingIntentStep): void {\n if (this.strategy.onAppInit) {\n this.strategy.onAppInit(milestone);\n }\n }\n\n public onWelcomeInit(forceInit?: boolean): Observable {\n if (this.strategy.onWelcomeInit) {\n return this.strategy.onWelcomeInit(forceInit);\n }\n return EMPTY;\n }\n\n public onWelcomeLogin(): void {\n if (this.strategy.onWelcomeLogin) {\n this.strategy.onWelcomeLogin();\n }\n }\n\n public onWelcomeCreateAccount(): void {\n if (this.strategy.onWelcomeCreateAccount) {\n this.strategy.onWelcomeCreateAccount();\n }\n }\n\n public onRegisterCreateAccount(props): Observable {\n return this.strategy.onRegisterCreateAccount(props);\n }\n\n public onRegisterLogin(): void {\n this.strategy.onRegisterLogin();\n }\n\n public onNewsletterNextStep(): void {\n this.strategy.onNewsletterNextStep();\n }\n\n public onCautionNextStep(): void {\n this.strategy.onCautionNextStep();\n }\n\n public onNotValidatedEmail(): Observable {\n return this.strategy.onNotValidatedEmail();\n }\n\n public onVerifyGoToLogin(): void {\n this.strategy.onVerifyGoToLogin();\n }\n\n public onEmailActivation(): Observable {\n return this.strategy.onEmailActivation();\n }\n\n public onSkipEmailActivation(): Observable {\n return this.strategy.onSkipEmailActivation();\n }\n\n public onAlreadyActivitedEmailGoToLogin(): void {\n this.strategy.onAlreadyActivitedEmailGoToLogin();\n }\n\n public onDownloadAfterCheckSkipClick(): void {\n this.strategy.onDownloadAfterCheckSkipClick();\n }\n\n public onLoginSuccessfully(returnUrl: string): void {\n this.strategy.onLoginSuccessfully(returnUrl);\n }\n\n public onLoginRegister(): void {\n this.strategy.onLoginRegister();\n }\n\n public onCreateCustomerSuccessfully(): void {\n this.strategy.onCreateCustomerSuccessfully();\n }\n\n public onTrackSkipClick(): void {\n if (this.strategy.onTrackSkipClick) {\n this.strategy.onTrackSkipClick();\n }\n }\n\n public onLabClaimNextClick(lab: LaboratoryName) {\n this.strategy.onLabClaimNextClick(lab);\n }\n\n public onNiptClaimInit(): Observable {\n if (this.strategy.onNiptClaimInit) {\n return this.strategy.onNiptClaimInit();\n }\n return EMPTY;\n }\n\n public onNiptClaimActiveClick(barcode: string): Observable {\n if (this.strategy.onNiptClaimActiveClick) {\n return this.strategy.onNiptClaimActiveClick(barcode);\n }\n return EMPTY;\n }\n\n public onLabClaimCancelIntent(): Observable {\n if (this.strategy.onLabClaimCancelIntent) {\n return this.strategy.onLabClaimCancelIntent();\n }\n return EMPTY;\n }\n\n public onKitClaimClaimClick(\n isEU: string,\n collector: string\n ): Observable {\n if (this.strategy.onKitClaimClaimClick) {\n return this.strategy.onKitClaimClaimClick(isEU, collector);\n }\n return EMPTY;\n }\n\n public onKitConsentAgree(): void {\n if (this.strategy.onKitConsentAgree) {\n this.strategy.onKitConsentAgree();\n }\n }\n\n public onKitConsentDisagree(): void {\n if (this.strategy.onKitConsentDisagree) {\n this.strategy.onKitConsentDisagree();\n }\n }\n\n public onKitSampleSampleTaken(): void {\n if (this.strategy.onKitSampleSampleTaken) {\n this.strategy.onKitSampleSampleTaken();\n } else {\n this.strategy.onFallback();\n }\n }\n\n public onCompleteCloseClick() {\n if (this.strategy.onCompleteCloseClick) {\n this.strategy.onCompleteCloseClick();\n } else {\n this.strategy.onFallback();\n }\n }\n\n public onCustomerNotExists(): Observable {\n return this.strategy.onCustomerNotExists();\n }\n\n public onCustomerExists(): Observable {\n return this.strategy.onCustomerExists();\n }\n\n public onCustomerWelcomeExists(): Observable {\n return this.strategy.onCustomerWelcomeExists();\n }\n\n public onUserNotExists(): Observable {\n return this.strategy.onUserNotExists();\n }\n}\n","import { Injectable, Injector } from '@angular/core';\nimport { LaboratoryName } from 'src/app/onboarding/lab/enums/lab.enum';\nimport { environment } from 'src/environments/environment';\nimport { OnboardingType } from '../../enums/intent.enum';\nimport { GeneralIntentStrategy } from './strategies/general-intent.strategy';\nimport {\n IntentStrategy,\n IntentStrategyContext,\n} from './strategies/intent.strategy';\nimport { KitIntentStrategy } from './strategies/kit-intent.strategy';\nimport { LabIntentStrategy } from './strategies/lab-intent.strategy';\nimport { NiptIntentStrategy } from './strategies/nipt-intent.strategy';\n\n@Injectable({ providedIn: 'root' })\nexport class IntentStrategyService {\n public context: IntentStrategyContext;\n\n constructor(private injector: Injector) {\n this.setStrategy(new GeneralIntentStrategy(this.injector));\n }\n\n public setStrategy(strategy: IntentStrategy) {\n this.context = new IntentStrategyContext(strategy);\n }\n\n public setStrategyByIntentId(intentId: string) {\n switch (intentId) {\n case environment.intents.adrialab: {\n this.setStrategy(\n new LabIntentStrategy(this.injector, LaboratoryName.ADRIA_LAB)\n );\n break;\n }\n case environment.intents.biolab: {\n this.setStrategy(\n new LabIntentStrategy(this.injector, LaboratoryName.BIO_LAB)\n );\n break;\n }\n case environment.intents.blood: {\n this.setStrategy(\n new KitIntentStrategy(this.injector, OnboardingType.BLOOD)\n );\n break;\n }\n case environment.intents.dna: {\n this.setStrategy(\n new KitIntentStrategy(this.injector, OnboardingType.DNA)\n );\n break;\n }\n case environment.intents.nipt: {\n this.setStrategy(new NiptIntentStrategy(this.injector));\n break;\n }\n }\n }\n\n public resetStrategy() {\n this.setStrategy(new GeneralIntentStrategy(this.injector));\n }\n}\n","/* eslint-disable @typescript-eslint/naming-convention */\nimport { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { tap } from 'rxjs/operators';\nimport { OnboardingIntentStep } from '../../enums/intent.enum';\nimport {\n Intent,\n IntentProperties,\n IntentValue,\n UserIntentState,\n} from '../../interfaces/intent.interface';\nimport * as Sentry from '@sentry/angular';\nimport { Observable } from 'rxjs';\n\n@Injectable({ providedIn: 'root' })\nexport class IntentApiService {\n constructor(private http: HttpClient) {}\n\n fetchIntents() {\n return this.http.get(`/api/intent/catalogue/intents`);\n }\n\n getCurrentStateByUserIntentId(userIntentId?: string) {\n return this.http\n .get(\n `/api/intent/user/intent/${userIntentId || ''}`\n )\n .pipe(\n tap((state) => Sentry.setContext('INTENT', { 'Intent state': state }))\n );\n }\n\n updateUserIntent(\n userIntentId: string,\n JumpToState?: OnboardingIntentStep,\n Properties?: IntentProperties\n ) {\n return this.http\n .put(`/api/intent/user/intent/${userIntentId}`, {\n JumpToState,\n Properties,\n })\n .pipe(\n tap((state) => Sentry.setContext('INTENT', { 'Intent state': state }))\n );\n }\n\n createUserIntent(IntentId: string) {\n return this.http.post<{ id: string }>(`/api/intent/user/intent`, {\n IntentId,\n });\n }\n\n deleteUserIntent(userIntentId: string): Observable {\n return this.http.delete(`/api/intent/user/intent/${userIntentId}`);\n }\n}\n","import {\n BehaviorSubject,\n combineLatest,\n EMPTY,\n iif,\n Observable,\n of,\n Subject,\n} from 'rxjs';\nimport { LocalStorageKey } from 'src/app/core/constants/local-storage-keys';\nimport {\n IntentProperties,\n IntentValue,\n UserIntentState,\n} from '../../interfaces/intent.interface';\n// eslint-disable-next-line @typescript-eslint/naming-convention\nimport * as Sentry from '@sentry/angular';\nimport { Injectable, Injector } from '@angular/core';\nimport {\n debounceTime,\n distinctUntilChanged,\n filter,\n first,\n map,\n mergeMap,\n switchMap,\n takeWhile,\n tap,\n} from 'rxjs/operators';\nimport { OnboardingIntentStep } from '../../enums/intent.enum';\nimport { IntentApiService } from './intent-api.service';\nimport { Auth0Service } from '@geneplanet/ngx-auth0';\nimport { environment } from 'src/environments/environment';\nimport { NavigationStart, Router, Event } from '@angular/router';\nimport { IntentStrategyService } from './intent-strategy.service';\nimport { extractAccount } from '../../operators/extract-account';\nimport { Auth0Account } from 'src/app/accounts/interfaces/accounts.types';\n\n@Injectable({ providedIn: 'root' })\nexport class IntentService {\n public state$ = new BehaviorSubject(undefined);\n public inIntent = false;\n\n private debounceIllegalSateCall = new Subject();\n\n constructor(\n private intentApiService: IntentApiService,\n private intentStrategyService: IntentStrategyService,\n private auth0Service: Auth0Service,\n private injector: Injector,\n private router: Router\n ) {\n this.cancelLegacyIntents();\n\n // This is to make sure API is debounced even if it's called many times\n this.debounceIllegalSateCall.pipe(debounceTime(10)).subscribe(() => {\n this.fetchUserIntent().subscribe();\n });\n }\n\n public startIntent(intentId: string) {\n return this.intentApiService.createUserIntent(intentId).pipe(\n tap(({ id }) => {\n this.setUserIntentIdToLocalStorage(id);\n this.setState({ userIntentId: id });\n })\n );\n }\n\n public fetchUserIntent(): Observable {\n const userIntentId = this.getIntentIdFromLocalStorage();\n\n if (userIntentId) {\n return this.intentApiService\n .getCurrentStateByUserIntentId(userIntentId)\n .pipe(\n tap((state: UserIntentState) => {\n this.setState(state);\n })\n );\n } else if (this.auth0Service.tokens?.current$?.value) {\n return this.intentApiService.getCurrentStateByUserIntentId().pipe(\n switchMap((value: IntentValue) => {\n const newUserIntentId = value?.value;\n\n if (newUserIntentId) {\n this.setUserIntentIdToLocalStorage(newUserIntentId);\n return this.intentApiService\n .getCurrentStateByUserIntentId(newUserIntentId)\n .pipe(\n tap((state: UserIntentState) => {\n this.setState(state);\n })\n );\n } else {\n return of({});\n }\n })\n );\n } else {\n return of({});\n }\n }\n\n public nextStep(\n jumpToState?: OnboardingIntentStep,\n newProperties?: IntentProperties\n ): Observable {\n const userIntentId = this.getIntentIdFromLocalStorage();\n\n if (!userIntentId) {\n return EMPTY;\n }\n\n const milestoneState = this.state$.value?.milestoneState;\n const properties = this.state$.value?.properties;\n\n const nextStep$ = this.intentApiService\n .updateUserIntent(userIntentId, jumpToState, {\n ...properties,\n ...newProperties,\n })\n .pipe(\n tap((state: UserIntentState) => {\n this.setState(state);\n })\n );\n\n return this.fetchUserIntent().pipe(\n first(),\n switchMap((state: UserIntentState) => this.verifyIntentActive(state)),\n mergeMap((newState: UserIntentState) =>\n iif(\n () =>\n newState.milestoneState === OnboardingIntentStep.Welcome ||\n newState.milestoneState === milestoneState,\n nextStep$,\n // SYNC MILESTONE/STEP IF BE IS AHEAD OF FE\n this.intentApiService\n .updateUserIntent(userIntentId, newState.milestoneState)\n .pipe(\n tap((state: UserIntentState) => {\n this.setState(state);\n })\n )\n )\n )\n );\n }\n\n public cancelIntent(): Observable {\n const userIntentId = this.getIntentIdFromLocalStorage();\n\n if (!userIntentId) {\n // This will prevent error when intent is canceled in a different tab\n this.clear();\n return EMPTY;\n }\n\n return this.intentApiService\n .getCurrentStateByUserIntentId(userIntentId)\n .pipe(\n switchMap((state: UserIntentState) => {\n // You cannot delete intent that has been canceled or finished.\n const { isCanceled, isFinished } = state;\n if (isCanceled || isFinished) {\n this.clear();\n return of(null);\n }\n return this.intentApiService.deleteUserIntent(userIntentId);\n }),\n tap(() => {\n this.clear();\n })\n );\n }\n\n public isUserStillInIntent(state: UserIntentState): boolean {\n return this.isUserInIntent(state) && !!this.getIntentIdFromLocalStorage();\n }\n\n public isUserInIntent(state: UserIntentState): boolean {\n if (state?.milestoneState && !state.isCanceled && !state.isFinished) {\n return true;\n } else {\n this.clear();\n return false;\n }\n }\n\n public clear(): void {\n this.state$.next(undefined);\n this.removeIntentIdFromLocalStorage();\n }\n\n public verifyIntentActive(\n state: UserIntentState\n ): Observable {\n if (!state.isCanceled && !state.isFinished) {\n // Intent is still active\n return of(state);\n }\n\n this.clear();\n\n return this.auth0Service.token$.pipe(\n first(),\n extractAccount(),\n switchMap((account: Auth0Account) => {\n if (!account['http://schemas.nomnio.com/2017/5/customer']) {\n return this.auth0Service.refresh();\n }\n return of(null);\n }),\n tap(() => this.router.navigate(['/dashboard'])),\n map(() => state)\n );\n }\n\n private getIntentIdFromLocalStorage(): string | null {\n return localStorage.getItem(LocalStorageKey.USER_INTENT);\n }\n\n private setUserIntentIdToLocalStorage(userIntentId: string): void {\n localStorage.setItem(LocalStorageKey.USER_INTENT, userIntentId);\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Sentry.setContext('INTENT', { 'User intent id': userIntentId });\n }\n\n private removeIntentIdFromLocalStorage(): void {\n localStorage.removeItem(LocalStorageKey.USER_INTENT);\n Sentry.setContext('INTENT', {});\n }\n\n private setState(state: UserIntentState): void {\n if (state?.milestoneState) {\n this.state$.next({ ...this.state$.value, ...state });\n if (!this.inIntent) {\n this.stayInIntent();\n this.preventIllegalState();\n this.inIntent = true;\n }\n } else {\n this.state$.next(undefined);\n }\n }\n\n private cancelLegacyIntents(): void {\n this.state$.subscribe((state) => {\n if (\n state?.intentId === environment.intents.claimKit ||\n state?.intentId === environment.intents.claimKitInApp\n ) {\n this.cancelIntent().subscribe(() => {\n this.injector.get(Router).navigate(['/']);\n });\n }\n });\n }\n\n private stayInIntent(): void {\n // Any route that isn't milestone of intent steps\n const EXCLUDED_ROUTES = [\n '/onboarding/download',\n '/onboarding/preferences',\n '/onboarding/sex',\n '/onboarding/measurements',\n '/onboarding/ethnicities',\n '/onboarding/language',\n '/onboarding/already-activated',\n '/accounts/reset',\n '/accounts/logout',\n '/accounts/clear',\n '/nipt/nipt-expired',\n ];\n let tempCurrentRoute: string;\n\n this.router.events\n .pipe(\n takeWhile(() => this.isUserStillInIntent(this.state$.value)),\n filter((event) => event instanceof NavigationStart)\n )\n .subscribe((event: NavigationStart) => {\n // Prevent user to go outside of the intent flow\n if (\n event.url !== tempCurrentRoute &&\n !EXCLUDED_ROUTES.find((url) => event.url.includes(url))\n ) {\n tempCurrentRoute = event.url;\n this.intentStrategyService.context.onAppInit(\n this.state$.value.milestoneState\n );\n }\n });\n }\n\n private preventIllegalState() {\n const navigationStart$: Observable = this.router.events.pipe(\n filter((event) => event instanceof NavigationStart),\n distinctUntilChanged()\n );\n\n const extractAccount$ = this.auth0Service.token$.pipe(\n first(),\n extractAccount()\n );\n\n combineLatest([extractAccount$, navigationStart$])\n .pipe(\n takeWhile(() => this.isUserInIntent(this.state$.value)),\n tap(([account]) => {\n // Prevent impossible intent url combination\n if (\n this.state$.value.milestoneState === OnboardingIntentStep.Login &&\n account?.email_verified\n ) {\n // We will update intent from the server\n // It's using debounce to avoid too many parallel API calls\n this.debounceIllegalSateCall.next();\n }\n })\n )\n .subscribe();\n }\n}\n","import { RegisterTypes } from 'src/app/accounts/enums/register-types.enums';\nimport { OnboardingIntentStep } from 'src/app/shared/enums/intent.enum';\nimport { OnboardingPaths } from 'src/app/shared/interfaces/intent.interface';\n\nconst ADRIALAB_STEPS: OnboardingPaths = {\n [OnboardingIntentStep.Welcome]: { path: '/onboarding/adrialab/welcome' },\n [OnboardingIntentStep.Register]: {\n path: '/accounts/create',\n queryParams: {\n type: RegisterTypes.LAB_ADRIALAB,\n },\n },\n [OnboardingIntentStep.Newsletter]: { path: '/accounts/newsletters' },\n [OnboardingIntentStep.Caution]: { path: '/accounts/caution' },\n [OnboardingIntentStep.Check]: { path: '/accounts/verify' },\n [OnboardingIntentStep.Login]: { path: '/accounts/check' },\n [OnboardingIntentStep.Onboarding]: { path: '/onboarding/details' },\n [OnboardingIntentStep.PushNotifications]: {\n path: '/onboarding/push-notifications',\n },\n [OnboardingIntentStep.Claim]: { path: '/onboarding/adrialab/details' },\n [OnboardingIntentStep.Complete]: { path: '/onboarding/adrialab/complete' },\n [OnboardingIntentStep.DownloadAfterCheck]: { path: '/onboarding/download' },\n [OnboardingIntentStep.End]: { path: '/dashboard' },\n};\n\nexport default ADRIALAB_STEPS;\n","import { RegisterTypes } from 'src/app/accounts/enums/register-types.enums';\nimport { OnboardingIntentStep } from 'src/app/shared/enums/intent.enum';\nimport { OnboardingPaths } from 'src/app/shared/interfaces/intent.interface';\n\nconst BIOLAB_STEPS: OnboardingPaths = {\n [OnboardingIntentStep.Welcome]: { path: '/onboarding/biolab/welcome' },\n [OnboardingIntentStep.Register]: {\n path: '/accounts/create',\n queryParams: {\n type: RegisterTypes.LAB_BIOLAB,\n },\n },\n [OnboardingIntentStep.Newsletter]: { path: '/accounts/newsletters' },\n [OnboardingIntentStep.Caution]: { path: '/accounts/caution' },\n [OnboardingIntentStep.Check]: { path: '/accounts/verify' },\n [OnboardingIntentStep.Login]: { path: '/accounts/check' },\n [OnboardingIntentStep.Onboarding]: { path: '/onboarding/details' },\n [OnboardingIntentStep.PushNotifications]: {\n path: '/onboarding/push-notifications',\n },\n [OnboardingIntentStep.Claim]: { path: '/onboarding/biolab/details' },\n [OnboardingIntentStep.Complete]: { path: '/onboarding/biolab/complete' },\n [OnboardingIntentStep.DownloadAfterCheck]: { path: '/onboarding/download' },\n [OnboardingIntentStep.End]: { path: '/dashboard' },\n};\n\nexport default BIOLAB_STEPS;\n","import { OnboardingIntentStep } from 'src/app/shared/enums/intent.enum';\nimport { OnboardingPaths } from 'src/app/shared/interfaces/intent.interface';\n\nconst BLOOD_STEPS: OnboardingPaths = {\n [OnboardingIntentStep.Welcome]: { path: '/onboarding/blood/welcome' },\n [OnboardingIntentStep.Register]: { path: '/accounts/create' },\n [OnboardingIntentStep.Newsletter]: { path: '/accounts/newsletters' },\n [OnboardingIntentStep.Caution]: { path: '/accounts/caution' },\n [OnboardingIntentStep.Check]: { path: '/accounts/verify' },\n [OnboardingIntentStep.Login]: { path: '/accounts/check' },\n [OnboardingIntentStep.DownloadAfterCheck]: { path: '/onboarding/download' },\n [OnboardingIntentStep.Onboarding]: { path: '/onboarding/details' },\n [OnboardingIntentStep.DownloadAfterOnBoarding]: { path: '/onboarding/track' },\n [OnboardingIntentStep.PushNotifications]: {\n path: '/onboarding/push-notifications',\n },\n [OnboardingIntentStep.Claim]: { path: '/onboarding/blood/claim' },\n [OnboardingIntentStep.Sample]: { path: '/onboarding/blood/sample' },\n [OnboardingIntentStep.Complete]: { path: '/onboarding/blood/complete' },\n [OnboardingIntentStep.End]: { path: '/dashboard' },\n};\n\nexport default BLOOD_STEPS;\n","import { OnboardingIntentStep } from 'src/app/shared/enums/intent.enum';\nimport { OnboardingPaths } from 'src/app/shared/interfaces/intent.interface';\n\nconst DNA_STEPS: OnboardingPaths = {\n [OnboardingIntentStep.Welcome]: { path: '/onboarding/dna/welcome' },\n [OnboardingIntentStep.Register]: { path: '/accounts/create' },\n [OnboardingIntentStep.Newsletter]: { path: '/accounts/newsletters' },\n [OnboardingIntentStep.Caution]: { path: '/accounts/caution' },\n [OnboardingIntentStep.Check]: { path: '/accounts/verify' },\n [OnboardingIntentStep.Login]: { path: '/accounts/check' },\n [OnboardingIntentStep.DownloadAfterCheck]: { path: '/onboarding/download' },\n [OnboardingIntentStep.Onboarding]: { path: '/onboarding/details' },\n [OnboardingIntentStep.DownloadAfterOnBoarding]: { path: '/onboarding/track' },\n [OnboardingIntentStep.PushNotifications]: {\n path: '/onboarding/push-notifications',\n },\n [OnboardingIntentStep.Claim]: { path: '/onboarding/dna/claim' },\n [OnboardingIntentStep.Consent]: { path: '/onboarding/dna/consent' },\n [OnboardingIntentStep.Sample]: { path: '/onboarding/dna/sample' },\n [OnboardingIntentStep.Complete]: { path: '/onboarding/dna/complete' },\n [OnboardingIntentStep.End]: { path: '/dashboard' },\n};\n\nexport default DNA_STEPS;\n","import { RegisterTypes } from 'src/app/accounts/enums/register-types.enums';\nimport { OnboardingIntentStep } from 'src/app/shared/enums/intent.enum';\nimport { OnboardingPaths } from 'src/app/shared/interfaces/intent.interface';\n\nconst NIPT_STEPS: OnboardingPaths = {\n [OnboardingIntentStep.Welcome]: { path: '/onboarding/nipt/welcome' },\n [OnboardingIntentStep.Register]: {\n path: '/accounts/create',\n queryParams: { type: RegisterTypes.NIPT },\n },\n [OnboardingIntentStep.Newsletter]: { path: '/accounts/newsletters' },\n [OnboardingIntentStep.Caution]: { path: '/accounts/caution' },\n [OnboardingIntentStep.Login]: { path: '/accounts/check' },\n [OnboardingIntentStep.Onboarding]: { path: '/onboarding/details' },\n [OnboardingIntentStep.PushNotifications]: {\n path: '/onboarding/push-notifications',\n },\n [OnboardingIntentStep.Claim]: { path: '/onboarding/nipt/claim' },\n [OnboardingIntentStep.End]: { path: '/nipt/results' },\n};\n\nexport default NIPT_STEPS;\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function isEmpty() {\n return operate((source, subscriber) => {\n source.subscribe(createOperatorSubscriber(subscriber, () => {\n subscriber.next(false);\n subscriber.complete();\n }, () => {\n subscriber.next(true);\n subscriber.complete();\n }));\n });\n}\n","/* eslint-disable no-unused-vars */\nimport { Injector } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { Observable, of } from 'rxjs';\nimport { isEmpty, map, mapTo, tap } from 'rxjs/operators';\nimport { CreateAccount } from 'src/app/accounts/interfaces/accounts.types';\nimport { AccountsService } from 'src/app/accounts/services/accounts.service';\nimport { MeService } from 'src/app/me/services/me.service';\nimport {\n OnboardingIntentStep,\n OnboardingType,\n} from 'src/app/shared/enums/intent.enum';\nimport {\n IntentProperties,\n UserIntentState,\n} from 'src/app/shared/interfaces/intent.interface';\nimport { environment } from 'src/environments/environment';\nimport { IntentService } from '../intent.service';\nimport { BLOOD_STEPS, DNA_STEPS } from '../steps';\nimport { IntentStrategy, IntentStrategyConfig } from './intent.strategy';\n// eslint-disable-next-line @typescript-eslint/naming-convention\nimport * as Sentry from '@sentry/angular';\n\nexport class KitIntentStrategy implements IntentStrategy {\n private intentService: IntentService;\n private meService: MeService;\n private router: Router;\n private accountService: AccountsService;\n\n constructor(\n private injector: Injector,\n private onboardingType: OnboardingType\n ) {\n this.intentService = this.injector.get(IntentService);\n this.meService = this.injector.get(MeService);\n this.router = this.injector.get(Router);\n this.accountService = this.injector.get(AccountsService);\n }\n\n public getConfig(): IntentStrategyConfig {\n const PREFIX = 'ONBOARDING.KIT.';\n const type = this.onboardingType;\n\n return {\n steps: type === OnboardingType.DNA ? DNA_STEPS : BLOOD_STEPS,\n type,\n [OnboardingIntentStep.Welcome]: {\n title: PREFIX + 'WELCOME.WELCOME',\n description: PREFIX + 'WELCOME.YOU_ARE_ABOUT_TO_BEGIN',\n },\n [OnboardingIntentStep.Caution]: {\n paragraph1: 'ACCOUNTS.CAUTION.GENERAL.PARAGRAPH_1',\n paragraph2: 'ACCOUNTS.CAUTION.GENERAL.PARAGRAPH_2',\n },\n [OnboardingIntentStep.Complete]: {\n title: PREFIX + 'COMPLETED.COMPLETE',\n description:\n type === OnboardingType.BLOOD\n ? PREFIX + 'COMPLETED.ONCE_THE_ANALYSIS'\n : PREFIX + 'COMPLETED.WE_WILL_SEND_YOU',\n },\n };\n }\n\n public onAppInit(milestone: OnboardingIntentStep): void {\n this.redirectToMilestone(milestone);\n }\n\n public onWelcomeInit(forceInit: boolean): Observable {\n const { blood, dna } = environment.intents;\n const intentId = this.onboardingType === OnboardingType.DNA ? dna : blood;\n\n if (\n !this.intentService.isUserInIntent(this.intentService.state$.value) ||\n forceInit\n ) {\n return this.intentService.startIntent(intentId);\n } else {\n return of({});\n }\n }\n\n public onWelcomeLogin(): void {\n this.onNextStep(OnboardingIntentStep.Login).subscribe();\n }\n\n public onWelcomeCreateAccount(): void {\n this.onNextStep(OnboardingIntentStep.Register).subscribe();\n }\n\n public onRegisterCreateAccount({\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n skipEmailVerification,\n ...rest\n }: CreateAccount): Observable {\n return this.accountService.create(rest).pipe(\n tap(() => {\n this.onNextStep(OnboardingIntentStep.Newsletter).subscribe();\n })\n );\n }\n\n public onRegisterLogin(): void {\n this.onNextStep(OnboardingIntentStep.Login).subscribe();\n }\n\n public onNewsletterNextStep(): void {\n this.onNextStep(OnboardingIntentStep.Caution).subscribe();\n }\n\n public onCautionNextStep(): void {\n this.onNextStep(OnboardingIntentStep.Check).subscribe();\n }\n\n public onNotValidatedEmail(): Observable {\n return this.onNextStep(OnboardingIntentStep.Check).pipe(mapTo(false));\n }\n\n public onVerifyGoToLogin(): void {\n this.onNextStep(OnboardingIntentStep.Login).subscribe();\n }\n\n public onEmailActivation(): Observable {\n if (\n this.intentService.state$?.value?.milestoneState !==\n OnboardingIntentStep.Login\n ) {\n return this.onNextStep(OnboardingIntentStep.Login).pipe(mapTo(false));\n } else {\n return of(true);\n }\n }\n\n public onSkipEmailActivation(): Observable {\n return this.onNextStep(OnboardingIntentStep.Onboarding).pipe(mapTo(false));\n }\n\n public onDownloadAfterCheckSkipClick(): void {\n this.onNextStep(OnboardingIntentStep.Onboarding).subscribe();\n }\n\n public onAlreadyActivitedEmailGoToLogin(): void {\n this.onNextStep(OnboardingIntentStep.Login).subscribe();\n }\n\n public onLoginRegister(): void {\n this.onNextStep(OnboardingIntentStep.Register).subscribe();\n }\n\n public onLoginSuccessfully(): void {\n const currentStep = this.intentService.state$.value.milestoneState;\n\n const stepsToSkip = [\n OnboardingIntentStep.Newsletter,\n OnboardingIntentStep.Caution,\n OnboardingIntentStep.Check,\n OnboardingIntentStep.Login,\n OnboardingIntentStep.Register,\n ];\n\n if (stepsToSkip.includes(currentStep)) {\n this.onNextStep(OnboardingIntentStep.DownloadAfterCheck).subscribe();\n } else {\n this.redirectToMilestone(currentStep);\n }\n }\n\n public onCreateCustomerSuccessfully(): void {\n this.onNextStep(OnboardingIntentStep.DownloadAfterOnBoarding).subscribe();\n }\n\n public onTrackSkipClick(): void {\n this.onNextStep(OnboardingIntentStep.Claim).subscribe();\n }\n\n public onKitClaimClaimClick(\n isEU: string,\n collector: string\n ): Observable {\n return this.onNextStep(OnboardingIntentStep.Sample, { isEU, collector });\n }\n\n public onKitConsentAgree() {\n this.meService.saveConsent(true).subscribe();\n this.onNextStep(OnboardingIntentStep.Sample).subscribe();\n }\n\n public onKitConsentDisagree() {\n this.onNextStep(OnboardingIntentStep.Sample).subscribe();\n }\n\n public onKitSampleSampleTaken() {\n this.onNextStep(OnboardingIntentStep.Complete)\n .pipe(isEmpty())\n .subscribe((empty: boolean) => {\n if (empty) {\n Sentry.captureException(\n `[INTENT error] Using fallback for missing intent on onKitSampleSampleTaken`\n );\n this.router.navigate(['/dashboard']);\n }\n });\n }\n\n public onCompleteCloseClick(): void {\n this.onNextStep(OnboardingIntentStep.End)\n .pipe(this.handleFallback('onCompleteCloseClick'))\n .subscribe();\n }\n\n public onCustomerNotExists(): Observable {\n return this.onNextStep(OnboardingIntentStep.Onboarding).pipe(mapTo(false));\n }\n\n public onCustomerExists(): Observable {\n return this.onNextStep(OnboardingIntentStep.Claim).pipe(mapTo(false));\n }\n\n public onCustomerWelcomeExists(): Observable {\n return this.onNextStep(OnboardingIntentStep.Welcome).pipe(map(() => false));\n }\n\n public onUserNotExists(): Observable {\n return this.onNextStep(OnboardingIntentStep.Login).pipe(mapTo(false));\n }\n\n private onNextStep(\n milestone?: OnboardingIntentStep,\n properties?: IntentProperties\n ): Observable {\n return this.intentService\n .nextStep(milestone, properties)\n .pipe(\n tap(({ milestoneState }) => this.redirectToMilestone(milestoneState))\n );\n }\n\n private redirectToMilestone(milestone: OnboardingIntentStep) {\n const { steps } = this.getConfig();\n const { path, state, queryParams } = steps[milestone];\n\n if (this.router.url === path) {\n return;\n }\n\n this.router.navigate([path], {\n state,\n queryParams,\n queryParamsHandling: 'preserve',\n });\n }\n\n private handleFallback(\n name: string\n ): (source$: Observable) => Observable {\n return (source$) =>\n source$.pipe(\n isEmpty(),\n tap((empty: boolean) => {\n if (empty) {\n Sentry.captureException(\n `[INTENT error] Using fallback for missing intent on ${name}`\n );\n this.router.navigate(['/dashboard']);\n }\n })\n );\n }\n}\n","/* eslint-disable no-unused-vars */\nimport { Injector } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { Observable, of } from 'rxjs';\nimport { map, mapTo, tap } from 'rxjs/operators';\nimport { CreateAccount } from 'src/app/accounts/interfaces/accounts.types';\nimport { AccountsService } from 'src/app/accounts/services/accounts.service';\nimport { LaboratoryName } from 'src/app/onboarding/lab/enums/lab.enum';\nimport {\n OnboardingIntentStep,\n OnboardingType,\n} from 'src/app/shared/enums/intent.enum';\nimport {\n OnboardingPaths,\n UserIntentState,\n} from 'src/app/shared/interfaces/intent.interface';\nimport { environment } from 'src/environments/environment';\nimport { IntentService } from '../intent.service';\nimport { ADRIALAB_STEPS, BIOLAB_STEPS } from '../steps';\nimport { IntentStrategy, IntentStrategyConfig } from './intent.strategy';\n\nexport class LabIntentStrategy implements IntentStrategy {\n private intentService: IntentService;\n private router: Router;\n private accountService: AccountsService;\n\n constructor(private injector: Injector, private labName: LaboratoryName) {\n this.intentService = this.injector.get(IntentService);\n this.router = this.injector.get(Router);\n this.accountService = this.injector.get(AccountsService);\n }\n\n public getConfig(): IntentStrategyConfig {\n const PREFIX = 'ONBOARDING.LAB.';\n\n return {\n steps: this.getLabIntentSteps(),\n type: OnboardingType.LAB,\n [OnboardingIntentStep.Welcome]: {\n title: PREFIX + 'WELCOME.WELCOME',\n description: PREFIX + 'WELCOME.TO_VIEW_YOUR_LABORATORY_RESULTS',\n },\n [OnboardingIntentStep.Caution]: {\n paragraph1: 'ACCOUNTS.CAUTION.LABORATORY.PARAGRAPH_1',\n paragraph2: 'ACCOUNTS.CAUTION.LABORATORY.PARAGRAPH_2',\n },\n [OnboardingIntentStep.Complete]: {\n title: PREFIX + 'COMPLETE.YOUR_LABORATORY_RESULTS',\n description: PREFIX + 'COMPLETE.WHEN_YOUR_RESULTS',\n },\n };\n }\n\n public onWelcomeInit(forceInit: boolean): Observable {\n const { adrialab, biolab } = environment.intents;\n const labName =\n this.labName === LaboratoryName.ADRIA_LAB ? adrialab : biolab;\n\n if (\n !this.intentService.isUserInIntent(this.intentService.state$.value) ||\n forceInit\n ) {\n return this.intentService.startIntent(labName);\n } else {\n return of({});\n }\n }\n\n public onAppInit(milestone: OnboardingIntentStep): void {\n this.redirectToMilestone(milestone);\n }\n\n public onWelcomeLogin(): void {\n this.onNextStep(OnboardingIntentStep.Login).subscribe();\n }\n\n public onWelcomeCreateAccount(): void {\n this.onNextStep(OnboardingIntentStep.Register).subscribe();\n }\n\n public onRegisterCreateAccount({\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n skipEmailVerification,\n ...rest\n }: CreateAccount): Observable {\n return this.accountService.create(rest).pipe(\n tap(() => {\n this.onNextStep(OnboardingIntentStep.Newsletter).subscribe();\n })\n );\n }\n\n public onRegisterLogin(): void {\n this.onNextStep(OnboardingIntentStep.Login).subscribe();\n }\n\n public onNewsletterNextStep(): void {\n this.onNextStep(OnboardingIntentStep.Caution).subscribe();\n }\n\n public onCautionNextStep(): void {\n this.onNextStep(OnboardingIntentStep.Check).subscribe();\n }\n\n public onNotValidatedEmail(): Observable {\n return this.onNextStep(OnboardingIntentStep.Check).pipe(mapTo(false));\n }\n\n public onVerifyGoToLogin(): void {\n this.onNextStep(OnboardingIntentStep.Login).subscribe();\n }\n\n public onEmailActivation(): Observable {\n if (\n this.intentService.state$?.value?.milestoneState !==\n OnboardingIntentStep.Check\n ) {\n return this.onNextStep(OnboardingIntentStep.Check).pipe(mapTo(false));\n } else {\n return of(true);\n }\n }\n\n public onSkipEmailActivation(): Observable {\n return this.onNextStep(OnboardingIntentStep.Onboarding).pipe(mapTo(false));\n }\n\n public onDownloadAfterCheckSkipClick(): void {\n this.onNextStep(OnboardingIntentStep.End).subscribe();\n }\n\n public onAlreadyActivitedEmailGoToLogin(): void {\n this.onNextStep(OnboardingIntentStep.Login).subscribe();\n }\n\n public onLoginRegister(): void {\n this.onNextStep(OnboardingIntentStep.Register).subscribe();\n }\n\n public onLoginSuccessfully(): void {\n const currentStep = this.intentService.state$.value.milestoneState;\n\n const stepsToSkip = [\n OnboardingIntentStep.Newsletter,\n OnboardingIntentStep.Caution,\n OnboardingIntentStep.Check,\n OnboardingIntentStep.Login,\n OnboardingIntentStep.Register,\n ];\n\n if (stepsToSkip.includes(currentStep)) {\n this.onNextStep(OnboardingIntentStep.Onboarding).subscribe();\n } else {\n this.redirectToMilestone(currentStep);\n }\n }\n\n public onCreateCustomerSuccessfully(): void {\n this.onNextStep(OnboardingIntentStep.Claim).subscribe();\n }\n\n public onTrackSkipClick(): void {\n this.onNextStep(OnboardingIntentStep.Claim).subscribe();\n }\n\n public onLabClaimNextClick(): void {\n this.onNextStep(OnboardingIntentStep.Complete).subscribe();\n }\n\n public onLabClaimCancelIntent(): Observable {\n return this.intentService.cancelIntent();\n }\n\n public onCompleteCloseClick(): void {\n this.onNextStep(OnboardingIntentStep.DownloadAfterCheck).subscribe();\n }\n\n public onCustomerNotExists(): Observable {\n return this.onNextStep(OnboardingIntentStep.Onboarding).pipe(mapTo(false));\n }\n\n public onCustomerExists(): Observable {\n return this.onNextStep(OnboardingIntentStep.Claim).pipe(mapTo(false));\n }\n\n public onCustomerWelcomeExists(): Observable {\n return this.onNextStep(OnboardingIntentStep.Welcome).pipe(map(() => false));\n }\n\n public onUserNotExists(): Observable {\n return this.onNextStep(OnboardingIntentStep.Login).pipe(mapTo(false));\n }\n\n private onNextStep(\n milestone?: OnboardingIntentStep\n ): Observable {\n return this.intentService\n .nextStep(milestone)\n .pipe(\n tap(({ milestoneState }) => this.redirectToMilestone(milestoneState))\n );\n }\n\n private redirectToMilestone(milestone: OnboardingIntentStep) {\n const { steps } = this.getConfig();\n const { path, state, queryParams } = steps[milestone];\n\n this.router.navigate([path], { state, queryParams });\n }\n\n private getLabIntentSteps(): OnboardingPaths {\n switch (this.labName) {\n case LaboratoryName.ADRIA_LAB:\n return ADRIALAB_STEPS;\n case LaboratoryName.BIO_LAB:\n return BIOLAB_STEPS;\n }\n }\n}\n","import { Injector } from '@angular/core';\nimport { ActivatedRoute, Router, UrlTree } from '@angular/router';\nimport { combineLatest, Observable, of } from 'rxjs';\nimport {\n catchError,\n first,\n map,\n mapTo,\n pluck,\n switchMap,\n take,\n tap,\n} from 'rxjs/operators';\nimport { CreateAccount } from 'src/app/accounts/interfaces/accounts.types';\nimport { AccountsService } from 'src/app/accounts/services/accounts.service';\nimport { MeService } from 'src/app/me/services/me.service';\nimport { RefResponse } from 'src/app/nipt/interfaces/ref-response.interface';\nimport { NiptApiService } from 'src/app/nipt/services/nipt-api.service';\nimport {\n OnboardingIntentStep,\n OnboardingType,\n} from 'src/app/shared/enums/intent.enum';\nimport {\n IntentProperties,\n UserIntentState,\n} from 'src/app/shared/interfaces/intent.interface';\nimport { environment } from 'src/environments/environment';\nimport { IntentService } from '../intent.service';\nimport { NIPT_STEPS } from '../steps';\nimport { IntentStrategy, IntentStrategyConfig } from './intent.strategy';\nimport { HttpStatusCode } from '@angular/common/http';\n\nexport class NiptIntentStrategy implements IntentStrategy {\n private intentService: IntentService;\n private router: Router;\n private activatedRoute: ActivatedRoute;\n private niptApiService: NiptApiService;\n private accountsService: AccountsService;\n private meService: MeService;\n\n constructor(private injector: Injector, private ref?: string) {\n this.intentService = this.injector.get(IntentService);\n this.router = this.injector.get(Router);\n this.activatedRoute = this.injector.get(ActivatedRoute);\n this.niptApiService = this.injector.get(NiptApiService);\n this.accountsService = this.injector.get(AccountsService);\n this.meService = this.injector.get(MeService);\n }\n\n public getConfig(): IntentStrategyConfig {\n const PREFIX = 'ONBOARDING.NIPT.';\n\n return {\n steps: NIPT_STEPS,\n type: OnboardingType.NIPT,\n [OnboardingIntentStep.Welcome]: {\n title: PREFIX + 'WELCOME.WELCOME',\n description: PREFIX + 'WELCOME.YOU_ARE_ABOUT_TO_BEGIN',\n },\n [OnboardingIntentStep.Caution]: {\n paragraph1: 'ACCOUNTS.CAUTION.GENERAL.PARAGRAPH_1',\n paragraph2: 'ACCOUNTS.CAUTION.GENERAL.PARAGRAPH_2',\n },\n };\n }\n\n public onAppInit(milestone: OnboardingIntentStep): void {\n this.redirectToMilestone(milestone);\n }\n\n public onWelcomeInit(forceInit: boolean): Observable {\n if (\n !this.intentService.isUserInIntent(this.intentService.state$.value) ||\n forceInit\n ) {\n const ref = this.getNiptRef();\n if (!ref) {\n return of({}).pipe(\n tap(() => this.router.navigate(['/accounts/check']))\n );\n }\n\n return this.niptApiService.getRefData(ref).pipe(\n first(),\n switchMap((data: RefResponse) => {\n if (data?.claimed) {\n return of({}).pipe(\n tap(() => {\n this.router.navigate([`/nipt/results/${data.testId}`]);\n })\n );\n } else if (data?.email) {\n return this.intentService\n .startIntent(environment.intents.nipt)\n .pipe(\n switchMap(() =>\n this.onNextStep(OnboardingIntentStep.Welcome, { ref })\n )\n );\n } else {\n return of({}).pipe(\n tap(() => this.router.navigate(['/accounts/check']))\n );\n }\n }),\n catchError((error) =>\n // BE returns 400 Bad Request when ref doesn't exist\n of({}).pipe(\n tap(() => {\n if (error.status === HttpStatusCode.NotFound) {\n this.router.navigate(['/nipt/nipt-expired']);\n } else {\n this.router.navigate(['/accounts/check']);\n }\n })\n )\n )\n );\n }\n\n return of({});\n }\n\n public onWelcomeLogin(): void {\n this.onNextStep(OnboardingIntentStep.Login).subscribe();\n }\n\n public onWelcomeCreateAccount(): void {\n this.onNextStep(OnboardingIntentStep.Register).subscribe();\n }\n\n public onRegisterCreateAccount({\n email,\n password,\n }: CreateAccount): Observable {\n const ref = this.getNiptRef();\n if (ref) {\n return this.accountsService\n .createNipt(email, password, ref)\n .pipe(\n tap(() =>\n this.onNextStep(OnboardingIntentStep.Newsletter).subscribe()\n )\n );\n }\n }\n\n public onRegisterLogin(): void {\n this.onNextStep(OnboardingIntentStep.Login).subscribe();\n }\n\n public onNewsletterNextStep(): void {\n this.onNextStep(OnboardingIntentStep.Caution).subscribe();\n }\n\n public onCautionNextStep(): void {\n this.onNextStep(OnboardingIntentStep.Onboarding).subscribe();\n }\n\n public onNotValidatedEmail(): Observable {\n return of(this.router.parseUrl('/accounts/verify'));\n }\n\n public onVerifyGoToLogin(): void {\n this.onNextStep(OnboardingIntentStep.Login).subscribe();\n }\n\n public onEmailActivation(): Observable {\n if (\n this.intentService.state$?.value?.milestoneState ===\n OnboardingIntentStep.Login\n ) {\n of(true);\n }\n\n return this.onNextStep(OnboardingIntentStep.Login).pipe(mapTo(false));\n }\n\n public onSkipEmailActivation(): Observable {\n return this.onNextStep(OnboardingIntentStep.Onboarding).pipe(mapTo(false));\n }\n\n // Should be unused (#7935)\n public onDownloadAfterCheckSkipClick(): void {\n this.onNextStep(OnboardingIntentStep.Onboarding).subscribe();\n }\n\n public onAlreadyActivitedEmailGoToLogin(): void {\n this.onNextStep(OnboardingIntentStep.Login).subscribe();\n }\n\n public onLoginRegister(): void {\n this.onNextStep(OnboardingIntentStep.Register).subscribe();\n }\n\n public onLoginSuccessfully(): void {\n this.onNextStep(OnboardingIntentStep.Onboarding).subscribe();\n }\n\n public onCreateCustomerSuccessfully(): void {\n this.onNextStep(OnboardingIntentStep.Claim).subscribe();\n }\n\n // Should be unused (#7935)\n public onTrackSkipClick(): void {\n this.onNextStep(OnboardingIntentStep.Claim).subscribe();\n }\n\n public onNiptClaimInit(): Observable {\n const ref = this.getNiptRef();\n const profile$ = this.meService.getFullProfile().pipe(take(1));\n const refData$ = this.niptApiService.getRefData(ref);\n\n return combineLatest([profile$, refData$]).pipe(\n switchMap(([me, data]) => {\n if (me.email.toLowerCase() !== data.email.toLowerCase()) {\n this.intentService.cancelIntent().subscribe(() => {\n this.meService.logout();\n\n this.router.navigate([`/nipt/view`, ref]);\n });\n }\n\n return data?.claimed\n ? this.onNextStep(OnboardingIntentStep.End)\n : of({});\n }),\n catchError((error) => {\n if (error.status === HttpStatusCode.NotFound) {\n this.router.navigate(['/nipt/nipt-expired']);\n }\n return of(error);\n })\n );\n }\n\n public onNiptClaimActiveClick(barcode: string): Observable {\n const ref = this.getNiptRef();\n\n return this.niptApiService.getRefData(ref).pipe(\n switchMap((data) => {\n return this.niptApiService\n .claimKit(data.testId, barcode)\n .pipe(switchMap(() => this.onNextStep(OnboardingIntentStep.End)));\n })\n );\n }\n\n public onCustomerNotExists(): Observable {\n return this.onNextStep(OnboardingIntentStep.Onboarding).pipe(mapTo(false));\n }\n\n public onCustomerExists(): Observable {\n return this.onNextStep(OnboardingIntentStep.Claim).pipe(mapTo(false));\n }\n\n public onCustomerWelcomeExists(): Observable {\n return this.onNextStep(OnboardingIntentStep.Welcome).pipe(map(() => false));\n }\n\n public onUserNotExists(): Observable {\n return this.onNextStep(OnboardingIntentStep.Login).pipe(mapTo(false));\n }\n\n private onNextStep(\n milestone?: OnboardingIntentStep,\n properties?: IntentProperties\n ): Observable {\n return this.intentService\n .nextStep(milestone, properties)\n .pipe(\n tap(({ milestoneState }) => this.redirectToMilestone(milestoneState))\n );\n }\n\n private redirectToMilestone(milestone: OnboardingIntentStep) {\n const { steps } = this.getConfig();\n const { path, state, queryParams } = steps[milestone];\n\n if (milestone === OnboardingIntentStep.End) {\n this.getTestIdByRef(this.getNiptRef()).subscribe((testId) => {\n this.router.navigate([`${path}/${testId}`], {\n state,\n queryParams,\n queryParamsHandling: 'preserve',\n });\n });\n\n this.intentService.cancelIntent().subscribe();\n } else {\n this.router.navigate([path], {\n state,\n queryParams,\n queryParamsHandling: 'preserve',\n });\n }\n }\n\n private getNiptRef(): string {\n const ref =\n this.ref ||\n this.intentService.state$.value?.properties?.ref ||\n this.activatedRoute.snapshot.queryParams.ref;\n\n if (!ref) {\n if (this.intentService.isUserInIntent(this.intentService.state$.value)) {\n this.intentService.cancelIntent().subscribe(() => {\n location.reload();\n });\n }\n }\n\n return ref;\n }\n\n private getTestIdByRef(ref: string): Observable {\n return this.niptApiService.getRefData(ref).pipe(pluck('testId'));\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { IntroId } from '../enums/intro-id.enum';\nimport { IntroFinished } from '../interfaces';\n\n@Injectable({ providedIn: 'root' })\nexport class TagsApiService {\n constructor(private http: HttpClient) {}\n\n getIntroFinished(introId: IntroId): Observable {\n if (introId === IntroId.PRS) {\n return this.http.get('/api/prs/intro/status');\n } else if (introId == IntroId.ORAL_MICROBIOME) {\n return this.http.get('/api/microbiome/intro/status');\n }\n }\n\n postIntroFinished(introId: IntroId): Observable {\n if (introId === IntroId.PRS) {\n return this.http.post('/api/prs/intro/finish', {});\n } else if (introId == IntroId.ORAL_MICROBIOME) {\n return this.http.post('/api/microbiome/intro/finish', {});\n }\n }\n}\n","import { Injectable } from '@angular/core';\nimport { NgbModal } from '@ng-bootstrap/ng-bootstrap';\nimport { ImageSwiperModalComponent } from '../modals/image-swiper-modal/image-swiper-modal.component';\nimport { SwiperModalComponent } from '../modals/swiper-modal/swiper-modal.component';\nimport { LocalStorageKey } from '../../core/constants/local-storage-keys';\nimport { IntroModalType } from '../enums/intro-modal-type.enum';\nimport {\n SwiperModalStep,\n ImageSwiperModalStep,\n IntroFinished,\n} from '../interfaces';\nimport { Auth0Service } from '@geneplanet/ngx-auth0';\nimport { delay, first, pluck } from 'rxjs/operators';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport { extractAccount } from '../operators/extract-account';\nimport { TagsApiService } from './tags-api.service';\nimport { IntroId } from '../enums/intro-id.enum';\n\n@Injectable({\n providedIn: 'root',\n})\n@UntilDestroy()\nexport class IntroModalService {\n private customerId$ = this.auth0.tokens.current$.pipe(\n first(),\n untilDestroyed(this),\n extractAccount(),\n pluck('http://schemas.nomnio.com/2017/5/customer'),\n delay(0)\n );\n\n constructor(\n private modals: NgbModal,\n private auth0: Auth0Service,\n private tagsApiService: TagsApiService\n ) {}\n\n checkAndOpenIntroModal(\n introId: IntroId,\n type: IntroModalType,\n steps?: SwiperModalStep[] | ImageSwiperModalStep[],\n confirmButtonText?: string\n ) {\n if (type === IntroModalType.SWIPER) {\n this.checkSwiperModal(\n introId,\n steps as SwiperModalStep[],\n confirmButtonText\n );\n } else if (type === IntroModalType.IMAGE_SWIPER) {\n this.checkImageSwiperModal(introId, steps as ImageSwiperModalStep[]);\n }\n }\n\n openSwiperModal(\n introId: IntroId,\n steps: SwiperModalStep[],\n confirmButtonText: string,\n confirmed = true,\n containerClass = undefined\n ) {\n const ref = this.modals.open(SwiperModalComponent, {\n backdrop: confirmed ? true : 'static',\n windowClass: 'swiper-modal',\n scrollable: true,\n });\n ref.componentInstance.introId = introId;\n ref.componentInstance.steps = steps;\n ref.componentInstance.confirmButtonText = confirmButtonText;\n ref.componentInstance.confirmed = confirmed;\n if (containerClass) {\n ref.componentInstance.containerClass = containerClass;\n }\n }\n\n openImageSwiperModal(steps: ImageSwiperModalStep[]) {\n const ref = this.modals.open(ImageSwiperModalComponent, {\n windowClass: 'swiper-modal fullscreen-image',\n scrollable: true,\n });\n ref.componentInstance.steps = steps;\n }\n\n setIntroModalCompleted(\n introId: IntroId,\n type: IntroModalType,\n customerId?: string\n ) {\n if (type === IntroModalType.SWIPER) {\n this.setSwiperModalCompleted(introId);\n } else if (type === IntroModalType.IMAGE_SWIPER) {\n this.setImageSwiperModalCompleted(introId, customerId);\n }\n }\n\n private checkSwiperModal(\n introId: IntroId,\n steps: SwiperModalStep[],\n confirmButtonText?: string\n ) {\n this.tagsApiService\n .getIntroFinished(introId)\n ?.subscribe((introFinished: IntroFinished) => {\n if (introFinished?.value === 'false') {\n this.openSwiperModal(\n introId,\n steps as SwiperModalStep[],\n confirmButtonText,\n false\n );\n }\n });\n }\n\n private checkImageSwiperModal(\n introId: IntroId,\n steps: ImageSwiperModalStep[]\n ) {\n const introIds = this.getIntroCompletedLocalStorage();\n this.customerId$.subscribe((customerId) => {\n // If user has old localstorage array instead ob object, then delete it to make it compatible with new implementation\n if (Array.isArray(introIds)) {\n localStorage.removeItem(LocalStorageKey.INTRO_COMPLETED);\n }\n\n if (!introIds[customerId]?.includes(introId)) {\n this.openImageSwiperModal(steps);\n this.setImageSwiperModalCompleted(introId, customerId);\n }\n });\n }\n\n private setSwiperModalCompleted(introId: IntroId) {\n this.tagsApiService.postIntroFinished(introId).subscribe();\n }\n\n private setImageSwiperModalCompleted(introId: IntroId, customerId?: string) {\n if (customerId) {\n this.setIntroCompletedToLocalStorage(introId, customerId);\n } else {\n this.customerId$.subscribe((cid) => {\n this.setIntroCompletedToLocalStorage(introId, cid);\n });\n }\n }\n\n private getIntroCompletedLocalStorage(): any {\n const introIdsStr = localStorage.getItem(LocalStorageKey.INTRO_COMPLETED);\n let introIdsObj = {};\n if (introIdsStr) {\n introIdsObj = JSON.parse(introIdsStr);\n }\n return introIdsObj;\n }\n\n private setIntroCompletedToLocalStorage(\n introId: string,\n customerId?: string\n ) {\n const introIdsObj = this.getIntroCompletedLocalStorage();\n if (!Array.isArray(introIdsObj[customerId])) {\n introIdsObj[customerId] = [];\n }\n introIdsObj[customerId].push(introId);\n localStorage.setItem(\n LocalStorageKey.INTRO_COMPLETED,\n JSON.stringify(introIdsObj)\n );\n }\n}\n","import { Inject, Injectable } from '@angular/core';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport {\n LocalizeParser,\n LocalizeRouterService,\n LocalizeRouterSettings,\n} from '@gilsdav/ngx-translate-router';\n\n/**\n * Custom localize router service will have an additional method for changing the language without triggering navigation.\n * This is to get rid of the \"broken\" navigation since it contains language prefix that is not supported on this project.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class CustomLocalizeRouterService extends LocalizeRouterService {\n constructor(\n @Inject(LocalizeParser) parser: LocalizeParser,\n @Inject(LocalizeRouterSettings) settings: LocalizeRouterSettings,\n @Inject(Router) router: Router,\n @Inject(ActivatedRoute) route: ActivatedRoute\n ) {\n super(parser, settings, router, route);\n }\n\n changeLanguageWithoutNavigation(lang: string): void {\n this.parser\n .translateRoutes(lang)\n .subscribe(() => this['applyConfigToRouter'](this.parser.routes));\n }\n}\n","import { Injectable } from '@angular/core';\nimport { CommonService } from '@geneplanet/ngx-shop/src/lib/shared';\nimport {\n Location,\n LocationCode,\n} from '@geneplanet/ngx-utils/src/lib/localization';\nimport { CustomLocalizeRouterService } from 'src/app/core/services/custom-localize-router.service';\nimport { CookieService } from 'ngx-cookie-service';\nimport { BehaviorSubject, Observable } from 'rxjs';\nimport { COOKIE_DOMAIN, COOKIE_LANG } from 'src/app/app.constants';\nimport { setLocaleData } from 'src/app/app.utils';\nimport { environment } from 'src/environments/environment';\nimport { AnalyticsService } from '@geneplanet/ngx-utils';\nimport { AncestryService } from 'src/app/ancestry/services/ancestry.service';\nimport { HttpClient } from '@angular/common/http';\n\n@Injectable({ providedIn: 'root' })\nexport class LanguageService {\n currentLocation$ = new BehaviorSubject(null);\n\n get locationCode(): LocationCode {\n return this.currentLocation$.value.code;\n }\n\n constructor(\n private http: HttpClient,\n private commonService: CommonService,\n private localize: CustomLocalizeRouterService,\n private cookieService: CookieService,\n private ancestryService: AncestryService,\n private analyticsService: AnalyticsService\n ) {}\n\n onLocationChange(location: Location): void {\n if (environment.rudderStackEnabled) {\n this.analyticsService.locale =\n location.lang.code + '-' + location.code.toUpperCase();\n }\n const expirationDate = new Date(\n new Date().setFullYear(new Date().getFullYear() + 1)\n );\n\n this.cookieService.set(\n COOKIE_LANG,\n location.code,\n expirationDate,\n '/',\n `${COOKIE_DOMAIN}`\n );\n\n this.currentLocation$.next(location);\n setLocaleData(location.code);\n this.commonService.setCurrency(location.currency);\n this.commonService.setPartnerId(location.partner.id);\n\n this.localize.parser.defaultLang = location.code;\n this.localize.changeLanguageWithoutNavigation(location.code);\n\n this.ancestryService.cleanup();\n }\n\n getLocations() {\n return environment.locations;\n }\n\n public updateLocaleOnServer(location: Location): Observable {\n const data = {\n language: location.lang.longCode,\n languageCode: location.lang.code,\n locationCode: location.code,\n };\n return this.http.put('/api/customers/locale', data);\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\nimport { Injectable } from '@angular/core';\nimport {\n NgbModal,\n NgbModalOptions,\n NgbModalRef,\n} from '@ng-bootstrap/ng-bootstrap';\nimport { Router } from '@angular/router';\nimport { AnalysesService } from 'src/app/analyses/services/analyses.service';\nimport {\n AnalysesTypes,\n AnalysesTypesLowercase,\n} from 'src/app/analyses/interfaces/analyses.types';\nimport { retry } from 'rxjs';\nimport { MeasurementAddModalComponent } from 'src/app/body-measurements/components/measurement-add-modal/measurement-add-modal.component';\nimport { BloodAddMarkerModalComponent } from 'src/app/blood/components/blood-add-marker-modal/blood-add-marker-modal.component';\nimport { AddModalComponent } from 'src/app/questionnaire/components/add-modal/add-modal.component';\n// eslint-disable-next-line @typescript-eslint/naming-convention\nimport * as Sentry from '@sentry/angular';\n\nconst modalConfig: NgbModalOptions = {\n backdrop: 'static',\n keyboard: false,\n windowClass: 'basic-modal',\n backdropClass: 'basic-modal-backdrop',\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ModalService {\n constructor(\n private readonly modals: NgbModal,\n private readonly router: Router,\n private readonly analysesService: AnalysesService\n ) {}\n\n openFullScreen(component: any) {\n return this.modals.open(component, {\n keyboard: false,\n windowClass: 'fullscreen-modal',\n });\n }\n\n open(\n id: string,\n type: AnalysesTypesLowercase | AnalysesTypes,\n redirect: string\n ): Promise {\n if (type === AnalysesTypes.Questionnaire) {\n return this.router.navigate(['/healthscore/questionnaire'], {\n queryParams: { redirectUrl: redirect },\n });\n } else {\n return this.add(id, type as AnalysesTypesLowercase);\n }\n }\n\n add(analysisId: string, type: AnalysesTypesLowercase): Promise {\n let ref: NgbModalRef;\n\n if (type === AnalysesTypesLowercase.Blood) {\n ref = this.openModal(analysisId, BloodAddMarkerModalComponent);\n } else if (type === AnalysesTypesLowercase.Measurements) {\n ref = this.openModal(analysisId, MeasurementAddModalComponent);\n } else if (type === AnalysesTypesLowercase.Habits) {\n ref = this.openModal(analysisId, AddModalComponent);\n } else {\n Sentry.captureMessage(\n 'Trying to create unsupported modal, of type ' + type\n );\n }\n\n return ref.result\n .then((requestId) => {\n switch (type) {\n case AnalysesTypesLowercase.Blood: {\n const calculationId = requestId;\n this.router.navigate([\n '/',\n type,\n 'analyses',\n analysisId,\n calculationId,\n ]);\n break;\n }\n default: {\n this.analysesService\n .getCalculationId(analysisId, requestId, type)\n .pipe(retry(5))\n .subscribe(({ result: { calculationId } }) => {\n this.router.navigate([\n '/',\n type,\n 'analyses',\n analysisId,\n calculationId,\n ]);\n });\n }\n }\n })\n .catch(() => {});\n }\n\n private openModal(analysisId: string, modal): NgbModalRef {\n const ref = this.modals.open(modal, modalConfig);\n ref.componentInstance.analysisId = analysisId;\n ref.componentInstance.id = analysisId; // Habits has ID instead of analysisId\n ref.componentInstance.editMode = false;\n return ref;\n }\n}\n","// https://github.com/angular/components/blob/master/src/cdk/platform/platform.ts\n\nimport { Inject, Injectable, PLATFORM_ID } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\n\nlet hasV8BreakIterator: boolean;\n\ntry {\n hasV8BreakIterator =\n typeof Intl !== 'undefined' && (Intl as any).v8BreakIterator;\n} catch {\n hasV8BreakIterator = false;\n}\n\n// eslint-disable-next-line complexity\n@Injectable({ providedIn: 'root' })\nexport class PlatformService {\n isBrowser: boolean = this._platformId\n ? isPlatformBrowser(this._platformId)\n : typeof document === 'object' && !!document;\n EDGE: boolean = this.isBrowser && /(edge)/i.test(navigator.userAgent);\n TRIDENT: boolean =\n this.isBrowser && /(msie|trident)/i.test(navigator.userAgent);\n BLINK: boolean =\n this.isBrowser &&\n !!((window as any).chrome || hasV8BreakIterator) &&\n typeof CSS !== 'undefined' &&\n !this.EDGE &&\n !this.TRIDENT;\n WEBKIT: boolean =\n this.isBrowser &&\n /AppleWebKit/i.test(navigator.userAgent) &&\n !this.BLINK &&\n !this.EDGE &&\n !this.TRIDENT;\n IOS: boolean =\n this.isBrowser &&\n /iPad|iPhone|iPod/.test(navigator.userAgent) &&\n !('MSStream' in window);\n FIREFOX: boolean =\n this.isBrowser && /(firefox|minefield)/i.test(navigator.userAgent);\n ANDROID: boolean =\n this.isBrowser && /android/i.test(navigator.userAgent) && !this.TRIDENT;\n SAFARI: boolean =\n this.isBrowser && /safari/i.test(navigator.userAgent) && this.WEBKIT;\n\n // eslint-disable-next-line @typescript-eslint/ban-types\n constructor(@Inject(PLATFORM_ID) private _platformId: Object) {}\n}\n","import { Injectable } from '@angular/core';\nimport { BehaviorSubject } from 'rxjs';\nimport { LocalStorageKey } from '../../core/constants/local-storage-keys';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class WalkTroughPopoverService {\n private index$ = new BehaviorSubject(null);\n private walkTroughGroupId: string;\n private walkTroughIds = [];\n private completedWalkTroughs = [];\n\n listen() {\n return this.index$;\n }\n\n start(walkTroughGroupId: string, walkTroughIds: string[]) {\n this.completedWalkTroughs =\n localStorage.getItem(LocalStorageKey.WT_COMPLETED)?.split(',') ?? [];\n if (!this.completedWalkTroughs.includes(walkTroughGroupId)) {\n this.walkTroughGroupId = walkTroughGroupId;\n this.walkTroughIds = walkTroughIds ?? [];\n this.next(0);\n }\n }\n\n next(index?: number) {\n index = index ?? this.index$.value + 1;\n if (index < this.walkTroughIds.length) {\n this.index$.next(index);\n } else if (index === this.walkTroughIds.length) {\n this.complete();\n }\n }\n\n getWalkTroughId() {\n return this.walkTroughIds[this.index$.value];\n }\n\n getStep() {\n return this.index$.value + 1;\n }\n\n getTotalSteps() {\n return this.walkTroughIds.length;\n }\n\n complete() {\n this.completedWalkTroughs.push(this.walkTroughGroupId);\n localStorage.setItem(\n LocalStorageKey.WT_COMPLETED,\n this.completedWalkTroughs.toString()\n );\n this.clear();\n }\n\n clear() {\n this.walkTroughGroupId = null;\n this.walkTroughIds = [];\n this.index$.next(null);\n }\n}\n","import { RouterModule } from '@angular/router';\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { NgbModule } from '@ng-bootstrap/ng-bootstrap';\nimport { components, ImageCardComponent, ImageCardTitleComponent } from './components';\nimport { pipes } from './pipes';\nimport { modals } from './modals';\nimport { directives } from './directives';\nimport { pages } from './pages';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { InlineSVGModule } from 'ng-inline-svg-2';\nimport { YouTubePlayerModule } from '@angular/youtube-player';\nimport {\n GptLocalizationModule,\n GptLocalNumberPipe,\n GptLocalStringNumberPipe,\n} from '@geneplanet/ngx-utils/src/lib/localization';\nimport { GptRouterBackModule } from '@geneplanet/ngx-utils/src/lib/router-back';\nimport { AnalyticsModule } from '@geneplanet/ngx-utils';\nimport { GpuCheckboxModule } from '@geneplanet/ngx-ui/src/lib/checkbox';\nimport { GpuCollapseModule } from '@geneplanet/ngx-ui/src/lib/collapse';\nimport { GpuFormFieldModule } from '@geneplanet/ngx-ui/src/lib/form-field';\nimport { GpuLayoutModule } from '@geneplanet/ngx-ui/src/lib/layout';\nimport { GpuLoadingModule } from '@geneplanet/ngx-ui/src/lib/loading';\nimport { GpuRadioGroupModule } from '@geneplanet/ngx-ui/src/lib/radio-group';\nimport { GpuToastModule } from '@geneplanet/ngx-ui/src/lib/toast';\nimport { GpuCarouselModule } from '@geneplanet/ngx-ui/src/lib/carousel';\nimport { ScrollOnFocusDirective } from './directives/scroll-on-focus.directive';\nimport { FormPageFooterComponent } from './components/form-page-footer/form-page-footer.component';\nimport { AnalysisHeaderComponent } from './components/analysis-header/analysis-header.component';\nimport { AnalysisHeaderTitleComponent } from './components/analysis-header/components/title/title.component';\nimport { LokaliseTranslatePipe } from '../lokalise';\nimport { AnalysisHeaderButtonComponent } from './components/analysis-header/components/button/button.component';\nimport { ImageHeaderComponent } from './components/image-header/image-header.component';\n\nconst standaloneComponents = [\n FormPageFooterComponent,\n AnalysisHeaderComponent,\n AnalysisHeaderTitleComponent,\n AnalysisHeaderButtonComponent,\n ImageCardComponent,\n ImageCardTitleComponent,\n ImageHeaderComponent,\n];\n\n@NgModule({\n imports: [\n TranslateModule,\n RouterModule,\n CommonModule,\n ReactiveFormsModule,\n NgbModule,\n InlineSVGModule,\n YouTubePlayerModule,\n GpuCarouselModule,\n GpuCollapseModule,\n GpuFormFieldModule,\n GpuCheckboxModule,\n GpuRadioGroupModule,\n GpuLoadingModule,\n GpuLayoutModule,\n GpuToastModule,\n GptLocalizationModule,\n GptRouterBackModule,\n AnalyticsModule,\n ScrollOnFocusDirective,\n ...standaloneComponents,\n LokaliseTranslatePipe\n ],\n declarations: [...components, ...pipes, ...modals, ...directives, ...pages],\n exports: [\n ...components,\n ...standaloneComponents,\n ...pipes,\n ...modals,\n ...directives,\n ...pages,\n AnalyticsModule,\n ScrollOnFocusDirective,\n ],\n providers: [...pipes, GptLocalStringNumberPipe, GptLocalNumberPipe],\n})\nexport class SharedModule {}\n","import {\n AnalysesTypes,\n AnalysesTypesLowercase,\n} from 'src/app/analyses/interfaces/analyses.types';\nimport { SemanticType } from 'src/app/shared/constants/semantic-type';\n\nexport const Colors = {\n [SemanticType.MOST_FAVOURABLE]: {\n primary: '#33C7C9',\n secondary: '#D9F5F5',\n },\n [SemanticType.FAVOURABLE]: {\n primary: '#45E4E2',\n secondary: '#E2FBFB',\n },\n [SemanticType.NEUTRAL]: {\n primary: '#889AF8',\n secondary: '#EFEFF4',\n },\n [SemanticType.AVERAGE]: {\n primary: '#FFD735',\n secondary: '#FFF9DF',\n },\n [SemanticType.LESS_FAVOURABLE]: {\n primary: '#FFB233',\n secondary: '#FFF3DF',\n },\n [SemanticType.UNFAVOURABLE]: {\n primary: '#FF6199',\n secondary: '#FFE6EE',\n },\n [SemanticType.UNKNOWN]: {\n primary: '#9599AA',\n secondary: '#EFEFF4',\n },\n GRAY: {\n primary: '#60606C',\n secondary: '#EFEFF4',\n },\n};\n\nexport class ColorUtil {\n static readonly Gray = '#C7C7D2';\n static readonly TextMuted = '#9599AA';\n\n static hexToRGBA(hex: string, opacity: number): string {\n // eslint-disable-next-line max-len\n return (\n 'rgba(' +\n (hex = hex.replace('#', ''))\n .match(new RegExp('(.{' + hex.length / 3 + '})', 'g'))\n .map((l) => parseInt(hex.length % 2 ? l + l : l, 16))\n .concat(opacity || 0)\n .join(',') +\n ')'\n );\n }\n\n static getColorByAnalysisType(\n type: AnalysesTypes | AnalysesTypesLowercase\n ): string {\n switch (type) {\n case AnalysesTypes.Blood:\n case AnalysesTypesLowercase.Blood:\n case AnalysesTypes.BloodSimple:\n return 'red';\n case AnalysesTypes.Questionnaire:\n case AnalysesTypes.Habits:\n case AnalysesTypesLowercase.Habits:\n return 'green';\n default:\n return 'yellow';\n }\n }\n}\n","import { IDateObject } from 'src/app/analyses/interfaces/analyses.types';\nimport {\n NgbDateNativeUTCAdapter,\n NgbDateStruct,\n} from '@ng-bootstrap/ng-bootstrap';\n\nexport function subtractCurrentDateYear(years: number): Date {\n const date = new Date();\n date.setFullYear(date.getFullYear() - years);\n return date;\n}\n\nexport function objectToDate(obj: IDateObject): Date {\n const dateNow = new Date();\n return new Date(\n obj.year ? obj.year : dateNow.getFullYear(),\n obj.month ? obj.month - 1 : dateNow.getMonth(),\n obj.day ? obj.day : dateNow.getDate(),\n obj.hours ? obj.hours : dateNow.getHours(),\n obj.minutes ? obj.minutes : dateNow.getMinutes(),\n obj.seconds ? obj.seconds : dateNow.getSeconds(),\n obj.milliseconds ? obj.milliseconds : dateNow.getMilliseconds()\n );\n}\n\nexport const ngbDateFromISO = (iso: string): NgbDateStruct => {\n return ngbDateFromDate(new Date(iso));\n};\n\nexport const ngbDateFromDate = (date: Date): NgbDateStruct => {\n return new NgbDateNativeUTCAdapter().fromModel(date);\n};\n\nexport const ngbDateToISO = (value: NgbDateStruct): string => {\n return new NgbDateNativeUTCAdapter().toModel(value).toISOString();\n};\n\nexport const ngbDateToISOWithTime = (value: NgbDateStruct): string => {\n return new NgbDateNativeUTCAdapter().toModel(value).toISOString();\n};\n\n// Converts ngb date to native JS date and adds current time\nexport const ngbDateToNativeUTCDateTime = (date: NgbDateStruct): Date => {\n const now = new Date();\n const jsDate = new Date(\n Date.UTC(\n date.year,\n date.month - 1,\n date.day,\n now.getUTCHours(),\n now.getUTCMinutes(),\n now.getUTCSeconds(),\n now.getUTCMilliseconds()\n )\n );\n // avoid 30 -> 1930 conversion\n jsDate.setUTCFullYear(date.year);\n return jsDate;\n};\n","import { LocationCode } from '@geneplanet/ngx-utils/src/lib/localization';\nimport { environment } from 'src/environments/environment';\n\nexport const isFeatureActive = (\n locationCode: LocationCode,\n featureName: string\n): boolean => {\n const feature = environment.features[featureName];\n\n // By default feature is active\n if (feature === undefined) {\n return true;\n }\n\n // It's localized\n if (typeof feature === 'object') {\n return feature[locationCode] !== false;\n }\n\n return feature;\n};\n","/* eslint-disable no-prototype-builtins */\nexport function isMobileApp() {\n return window.hasOwnProperty('cordova');\n}\n","export function openExternalWebPage(url: string) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const safariViewController = (window as any).SafariViewController;\n if (typeof safariViewController !== 'undefined') {\n safariViewController.show({\n url,\n hidden: false,\n animated: true,\n tintColor: '#ffffff',\n barColor: '#00a9ab',\n controlTintColor: '#ffffff',\n });\n return;\n }\n window.open(url, '_blank');\n}\n","import { AbstractControl } from '@angular/forms';\nimport { Location } from '@geneplanet/ngx-utils/src/lib/localization';\nimport { CategoryReport } from 'src/app/core/interfaces';\n\nexport class Util {\n static isMale(gender: string): boolean {\n return gender.toUpperCase() === 'MALE';\n }\n\n static preloadImages(imageUrls: string[]) {\n const images = [];\n\n for (let i = 0; i < imageUrls.length; i++) {\n images[i] = new Image();\n images[i].src = imageUrls[i];\n }\n }\n\n static localizeEnvironmentPage(location: Location, page: string) {\n const search = 'geneplanet.com';\n const index = page.search(search);\n if (index > -1) {\n return [\n page.slice(0, index + search.length),\n '/' + location.code,\n page.slice(index + search.length),\n ].join('');\n }\n return page;\n }\n\n static sortReports(reports: CategoryReport[], sortedProductIds: string[]) {\n return reports.sort((a, b) =>\n sortedProductIds.indexOf(a.productId) >\n sortedProductIds.indexOf(b.productId)\n ? 1\n : -1\n );\n }\n}\n\n/**\n * This will remove error from FormControl by mutation and leaving errors of existing as they are.\n * @param control FormControl\n * @param errorName \n */\nexport const removeFormControlError = (\n control: AbstractControl,\n errorName: string\n) => {\n if (control?.errors && control?.errors[errorName]) {\n delete control.errors[errorName];\n if (Object.keys(control.errors).length === 0) {\n control.setErrors(null);\n }\n }\n};\n","// This file can be replaced during build by using the `fileReplacements` array.\n// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.\n// The list of file replacements can be found in `angular.json`.\n\n/* eslint-disable @typescript-eslint/naming-convention */\nimport {\n Currency,\n LanguageCode,\n LocationCode,\n} from '@geneplanet/ngx-utils/src/lib/localization';\n\nexport const environment = {\n production: false,\n environment: 'local',\n language: 'en',\n locations: [\n {\n code: LocationCode.EU,\n currency: Currency.EUR,\n partner: {\n id: 'b17b988b-c11e-4460-a355-c42a98acd334',\n landingId: '0d03994c-fc39-4521-9185-6cc642789e8e',\n },\n lang: {\n videoSubtitles: false,\n code: LanguageCode.EN,\n longCode: 'English',\n name: 'English',\n },\n },\n {\n code: LocationCode.CH,\n currency: Currency.CHF,\n partner: {\n id: '74a1578a-97b0-4d58-8eb6-e2e987f5e19a',\n },\n lang: {\n videoSubtitles: false,\n code: LanguageCode.EN,\n longCode: 'English',\n name: 'English',\n },\n },\n {\n code: LocationCode.UK,\n currency: Currency.GBP,\n partner: {\n id: '77b49670-9312-4863-a457-e18259c96b7f',\n },\n lang: {\n videoSubtitles: false,\n code: LanguageCode.EN,\n longCode: 'English',\n name: 'English',\n },\n },\n {\n code: LocationCode.US,\n currency: Currency.USD,\n partner: {\n id: '1f592808-3675-4165-b5a7-ba35161eca83',\n },\n lang: {\n videoSubtitles: false,\n code: LanguageCode.EN,\n longCode: 'English',\n name: 'English',\n },\n },\n {\n code: LocationCode.PL,\n currency: Currency.PLN,\n partner: {\n id: '26f4e53a-0e91-43d7-bf31-5b23d8295a80',\n },\n lang: {\n videoSubtitles: true,\n code: LanguageCode.PL,\n longCode: 'Polish',\n name: 'Polski',\n },\n paymentMethods: {\n blik: true,\n mediraty: true,\n },\n },\n {\n code: LocationCode.SK,\n currency: Currency.EUR,\n partner: {\n id: 'b17b988b-c11e-4460-a355-c42a98acd334',\n },\n lang: {\n videoSubtitles: true,\n code: LanguageCode.SK,\n longCode: 'Slovak',\n name: 'Slovenský',\n },\n },\n {\n code: LocationCode.SL,\n currency: Currency.EUR,\n partner: {\n id: 'b17b988b-c11e-4460-a355-c42a98acd334',\n },\n lang: {\n videoSubtitles: true,\n code: LanguageCode.SL,\n longCode: 'Slovenian',\n name: 'Slovenščina',\n },\n },\n {\n code: LocationCode.TH,\n currency: Currency.EUR,\n name: 'Thai',\n customFlag: 'th',\n partner: {\n id: '',\n },\n lang: {\n videoSubtitles: false,\n code: LanguageCode.TH,\n longCode: 'Thai',\n name: 'แบบไทย',\n },\n },\n ],\n project: 'application',\n unitSystems: ['Metric', 'Imperial'],\n applicationId: '8968825b-a46c-4624-9160-dd5be80e79c4',\n api: 'https://api-stg.geneplanet.com/api/health-intelligence',\n apiUrl: 'https://api-stg.geneplanet.com',\n jotformApiKey: 'c1928dc4d96f4dbf1741389e6af0649f',\n auth0: {\n audience: 'https://geneplanet-platform-stg',\n domain: 'geneplanet-stg.eu.auth0.com',\n clientID: 'qI8UWmidt4khz5As8MGMrrajd1UnKzDM',\n responseType: 'token token_id',\n },\n pages: {\n home: 'https://web-stg.geneplanet.com/',\n about: 'https://web-stg.geneplanet.com/who-we-are/',\n contact: 'https://web-stg.geneplanet.com/contact/',\n press: 'https://hub.geneplanet.com/{lang}/press',\n careers: 'https://web-stg.geneplanet.com/careers/',\n business: 'https://web-stg.geneplanet.com/business/about',\n science: 'https://web-stg.geneplanet.com/science/',\n blog: 'https://hub.geneplanet.com/{lang}',\n help: 'https://hub.geneplanet.com/{lang}/help/',\n terms: 'https://web-stg.geneplanet.com/terms-and-conditions/',\n privacy: 'https://web-stg.geneplanet.com/privacy-policy/',\n cookie: 'https://web-stg.geneplanet.com/cookie-policy/',\n twitter: 'https://twitter.com/GenePlanet',\n facebook: 'https://www.facebook.com/GenePlanet-109182519106437/',\n instagram: 'https://www.instagram.com/geneplanet/',\n linkedin: 'https://www.linkedin.com/company/geneplanet',\n youtube: 'https://www.youtube.com/channel/UCvkfGs6Fx6UkxTmXmgOHOFg',\n lifestyle: 'https://web-stg.geneplanet.com/tests/dna-lifestyle',\n clinical: 'https://web-stg.geneplanet.com/tests/dna-clinical',\n blood: 'https://web-stg.geneplanet.com/tests/blood',\n workplacewellness:\n 'https://web-stg.geneplanet.com/business/workplace-wellness',\n insurance: 'https://web-stg.geneplanet.com/business/insurance',\n laboratories: 'https://web-stg.geneplanet.com/business/laboratories',\n gymplanet: 'https://web-stg.geneplanet.com/business/gymplanet',\n },\n productApi: 'https://api-stg.geneplanet.com/api',\n publicApi: 'https://api-stg.geneplanet.com/open-products',\n dashboardUrl: 'https://hi-dev.geneplanet.com/',\n dashboardHealthScoreUrl:\n 'https://hi-dev.geneplanet.com/healthscore/questionnaire/welcome',\n websiteUrl: 'https://web-dev.geneplanet.com',\n GpPartnerId: 'b17b988b-c11e-4460-a355-c42a98acd334',\n GpSecurityCode: 'YTbDxWfyAd2fKgjLu2hxz8JWU7wDaHaBD/Z0yTMtQYtO6CdJlJZ7bA==',\n payment: {\n stripePK: 'pk_test_1cYPJEqUZNTLRf2bhxXBFHu3',\n PayPalClientId:\n 'AReLbJyI42odsADLuSy5ok8OM-2LEKoGTLtaQlDC0yf_zwsRdtGaOwpVntygySlQh6xTR2HWTlekZv72',\n createOrderSessionUrl:\n 'https://api-stg.geneplanet.com/payment-gateway/paypal',\n stripeUrl: 'https://api-stg.geneplanet.com/payment-gateway/stripe',\n mediratyUrl: 'https://api-stg.geneplanet.com/payment-gateway/mediraty',\n },\n products: {\n heartHealthBlood: '257db183-b25f-4fe9-a9c6-ce1f411bf16f',\n dietAndBodyWeightOLD: '3f89430e-8734-4a24-a7db-def65baebaef',\n heartHealthDnaOLD: '699817b5-a174-4087-ba78-f0248dc942eb',\n metabolismAndLifeStyleOLD: 'e0f7e3ab-4180-471d-8f25-f2d2499d3fa8',\n skinHealthAndAgeingOLD: '177af1c7-e2a4-477f-96e4-063ba193d0a2',\n sportsPerformanceOLD: '91ca77c9-080b-437c-a066-ca1478549940',\n vitaminsAndMineralsOLD: '0085103f-fda8-4334-b8f4-13b51554f7ab',\n premiumPackOLD: '2d7320cb-2723-4fc2-8cd2-773bfb2e038d',\n dietAndBodyWeight: '39fa3a61-5774-4a89-bfd8-30a215216f55',\n heartHealthDna: 'e019b6d3-76bc-484a-899f-d6896904aeb2',\n metabolismAndLifeStyle: '6df46849-967c-40d8-8f4f-4040460d5784',\n skinHealthAndAgeing: '10be2ae2-ef23-459f-a494-ed30a6fb7ec2',\n sportsPerformance: '40c3f266-1989-481e-b9e1-ebd111ced9ff',\n vitaminsAndMinerals: '3783116d-f522-4cbb-8168-4b74d22a1892',\n premiumPack: '749a82db-0f02-4335-8cbc-e2a16bdbc0ea',\n lifestyleQuestionnaire: 'aba840e3-77d9-4895-932e-c7e4b4410c12',\n mindAndWellbeing: '935afd2a-e8de-4a8d-9986-18e192523ee3',\n prsCancer: '90a39fad-1ae8-4dd0-80b7-5f3172825bf7',\n premiumPackSubscription: '78fb5c2c-c92b-45da-856e-5f14e49f2b95',\n myLifestyle: '839147b0-5051-4aa7-b8c0-462de147e8d6',\n myHealth: 'f9a2abd5-7130-4116-9ab2-1cf6bceaab6c',\n bodyAndMind: '29e5ba5f-1c33-410d-95af-3a841097c83f',\n sportAndRecreation: 'ba656910-7de8-49cc-965c-603183abcf86',\n dietAndNutrition: '7f279bde-d64f-4b4e-8390-ed29ac9839fe',\n immuneSystem: '3bfe2eee-ac64-4f82-b7ca-861538d82e65',\n physicalTraits: '5c94841b-7e7b-4acc-96c5-ae4d3ef0e95a',\n ancestry: '0ba5c89b-d7f1-4afd-89b4-28e56b3cbd73',\n myAncestry: 'fcb8906f-d742-4f3e-bccb-9c8535de6b5b',\n cardiovascularDisease: '9af73423-a558-4b05-9c7f-261558c962c2',\n },\n cancerProducts: {\n cancerScreenBasic: '620d5dfb-430e-4456-ad3b-b977dfd3daaa',\n cancerScreenStandard: '0c38f38c-6433-4dca-94b4-d3b6aafbf425',\n cancerScreenPlusFemale: 'f7a4ca2e-05b1-4f09-ba92-4d6754c0a39b',\n cancerScreenPlusMale: 'cda4f9ab-9503-4060-a9f1-fd987e05b2cb',\n },\n enabledProducts: {\n myLifestyle: true,\n myHealth: true,\n myOral: true,\n myAncestry: true,\n },\n outOfStockProducts: {\n heartHealthBlood: true,\n },\n categories: {\n family: '1a571e8e-83ae-4e45-a597-c0d23e3fe56c',\n nutrition: 'a15d32a2-9e1d-482d-a951-ea96274d4bd5',\n cancerScreen: 'a91e34ab-769e-4925-9008-3f77729871c7',\n skinAndBeauty: 'aa93a309-ed06-454a-b026-8c49e6df55b9',\n sportAndExercise: 'e67a9336-9857-40fd-9b99-d49408e09e20',\n heartHealth: 'f9f67900-5798-419f-baa3-fdbc12548be9',\n myAncestry: 'c1c19b40-1990-44e0-82f8-b1484e25f62f',\n myHealth: '95e8cce8-f00c-43c3-ab7b-8a39a06f7858',\n myLifestyle: '5275471e-727e-455c-b1b0-b9febf48fd0d',\n dnaTestResults: 'f34dc7cb-c941-4c06-bae4-fb2ae3add19f',\n myMicrobiome: 'e4e53777-42e7-4ea5-b776-6421e2ff7f19',\n },\n testTypes: {\n dnaClinical: '1748230e-7016-40d7-874c-be5de8935798',\n dnaLifestyle: '08ec94cd-574f-4721-930f-2ebd353d7b2a',\n blood: '508d657b-8679-4584-aa42-c4860806d118',\n questionnaire: '9bb7a48d-b03f-4d98-8153-6ce71ea1d4f9',\n measurement: 'ab04ef0a-2d8e-42d6-9738-b22d99c60c32',\n prs: 'e3665663-59c2-4b42-8e75-b735bc2da7f5',\n },\n hubspotForms: {\n portalId: '6124254',\n newsletter: 'b088669a-3dec-428a-ac67-c02f19ac0306',\n niptContactForm: '8f548558-ec7d-4473-b94f-9d667f41e225',\n },\n measurement: {\n bodyHeight: '35321d0b-9ecf-4d03-a07b-35e76352cfa7',\n bodyWeight: '2a6bdd92-5de0-410d-818d-d2221aab481f',\n },\n intents: {\n biolab: 'e8a49b68-148b-4876-bbd9-b36a0c8ed965',\n adrialab: 'cc3f2ed4-54d7-4cdb-af6b-246105ccdfc6',\n claimKit: '7f431adb-6df4-45db-a162-05d8d6bf6da4',\n claimKitInApp: '13c5db25-1b34-49f3-9289-e80e3e7685fd',\n dna: 'de535cef-9870-4332-ac97-1440459f9abb',\n blood: '8d7f9416-4706-42db-b3f5-597fd37508ae',\n nipt: '32e52887-daa8-4c84-93ca-83dfcc00b573',\n },\n ancestry: {\n ethnicity: 'e0c5397a-4e4a-4a9d-9c4a-b47de81a5e53',\n haplogroup: 'cff26ec9-d211-4f4b-a8f4-859a93e38287',\n chromosome: 'e6aab65f-4276-44de-9a19-2fca0ecf735f',\n neanderthal: 'ab31ddbf-958d-41b3-8e6d-b9e066559138',\n },\n mapbox: {\n accessToken:\n 'pk.eyJ1IjoiZ2VuZXBsYW5ldCIsImEiOiJja292Ynd4cW4wMG8xMzByczZwOHl5c2EwIn0.PjrdiOINAmYPM77vEFi6aw',\n mapStyle:\n 'mapbox://styles/geneplanet/ckp3t6z6707qv18ojqb942kc7?optimize=true',\n },\n features: {\n prs: true,\n prsDemo: true,\n wgs: true,\n nipt: true,\n foodid: true,\n resultsOverview: true,\n ancestry: true,\n oralMicrobiome: true,\n subscription: false,\n recipeGenerator: { [LocationCode.TH]: false },\n newPrs: { [LocationCode.TH]: false },\n shop: { [LocationCode.TH]: false },\n },\n sentry: {\n enabled: true,\n logUser: true,\n dns: 'https://6631a9964e7544a08b3ff9bb006aa52d@o468713.ingest.sentry.io/5515505',\n },\n rudderstackKey: '27SesS8osOMaO9o8F0ZYHrhImGW',\n rudderStackEnabled: false,\n gtmContainer: 'GTM-MNH4KPC',\n};\n\n/*\n * For easier debugging in development mode, you can import the following file\n * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.\n *\n * This import should be commented out in production mode because it will have a negative impact\n * on performance if an error is thrown.\n */\n// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.\n","import { arrayify, logger } from '@sentry/utils';\nimport { getClient } from './currentScopes.js';\nimport { DEBUG_BUILD } from './debug-build.js';\n\nconst installedIntegrations = [];\n\n/** Map of integrations assigned to a client */\n\n/**\n * Remove duplicates from the given array, preferring the last instance of any duplicate. Not guaranteed to\n * preseve the order of integrations in the array.\n *\n * @private\n */\nfunction filterDuplicates(integrations) {\n const integrationsByName = {};\n\n integrations.forEach(currentInstance => {\n const { name } = currentInstance;\n\n const existingInstance = integrationsByName[name];\n\n // We want integrations later in the array to overwrite earlier ones of the same type, except that we never want a\n // default instance to overwrite an existing user instance\n if (existingInstance && !existingInstance.isDefaultInstance && currentInstance.isDefaultInstance) {\n return;\n }\n\n integrationsByName[name] = currentInstance;\n });\n\n return Object.values(integrationsByName);\n}\n\n/** Gets integrations to install */\nfunction getIntegrationsToSetup(options) {\n const defaultIntegrations = options.defaultIntegrations || [];\n const userIntegrations = options.integrations;\n\n // We flag default instances, so that later we can tell them apart from any user-created instances of the same class\n defaultIntegrations.forEach(integration => {\n integration.isDefaultInstance = true;\n });\n\n let integrations;\n\n if (Array.isArray(userIntegrations)) {\n integrations = [...defaultIntegrations, ...userIntegrations];\n } else if (typeof userIntegrations === 'function') {\n integrations = arrayify(userIntegrations(defaultIntegrations));\n } else {\n integrations = defaultIntegrations;\n }\n\n const finalIntegrations = filterDuplicates(integrations);\n\n // The `Debug` integration prints copies of the `event` and `hint` which will be passed to `beforeSend` or\n // `beforeSendTransaction`. It therefore has to run after all other integrations, so that the changes of all event\n // processors will be reflected in the printed values. For lack of a more elegant way to guarantee that, we therefore\n // locate it and, assuming it exists, pop it out of its current spot and shove it onto the end of the array.\n const debugIndex = finalIntegrations.findIndex(integration => integration.name === 'Debug');\n if (debugIndex > -1) {\n const [debugInstance] = finalIntegrations.splice(debugIndex, 1) ;\n finalIntegrations.push(debugInstance);\n }\n\n return finalIntegrations;\n}\n\n/**\n * Given a list of integration instances this installs them all. When `withDefaults` is set to `true` then all default\n * integrations are added unless they were already provided before.\n * @param integrations array of integration instances\n * @param withDefault should enable default integrations\n */\nfunction setupIntegrations(client, integrations) {\n const integrationIndex = {};\n\n integrations.forEach(integration => {\n // guard against empty provided integrations\n if (integration) {\n setupIntegration(client, integration, integrationIndex);\n }\n });\n\n return integrationIndex;\n}\n\n/**\n * Execute the `afterAllSetup` hooks of the given integrations.\n */\nfunction afterSetupIntegrations(client, integrations) {\n for (const integration of integrations) {\n // guard against empty provided integrations\n if (integration && integration.afterAllSetup) {\n integration.afterAllSetup(client);\n }\n }\n}\n\n/** Setup a single integration. */\nfunction setupIntegration(client, integration, integrationIndex) {\n if (integrationIndex[integration.name]) {\n DEBUG_BUILD && logger.log(`Integration skipped because it was already installed: ${integration.name}`);\n return;\n }\n integrationIndex[integration.name] = integration;\n\n // `setupOnce` is only called the first time\n if (installedIntegrations.indexOf(integration.name) === -1 && typeof integration.setupOnce === 'function') {\n integration.setupOnce();\n installedIntegrations.push(integration.name);\n }\n\n // `setup` is run for each client\n if (integration.setup && typeof integration.setup === 'function') {\n integration.setup(client);\n }\n\n if (typeof integration.preprocessEvent === 'function') {\n const callback = integration.preprocessEvent.bind(integration) ;\n client.on('preprocessEvent', (event, hint) => callback(event, hint, client));\n }\n\n if (typeof integration.processEvent === 'function') {\n const callback = integration.processEvent.bind(integration) ;\n\n const processor = Object.assign((event, hint) => callback(event, hint, client), {\n id: integration.name,\n });\n\n client.addEventProcessor(processor);\n }\n\n DEBUG_BUILD && logger.log(`Integration installed: ${integration.name}`);\n}\n\n/** Add an integration to the current scope's client. */\nfunction addIntegration(integration) {\n const client = getClient();\n\n if (!client) {\n DEBUG_BUILD && logger.warn(`Cannot add integration \"${integration.name}\" because no SDK Client is available.`);\n return;\n }\n\n client.addIntegration(integration);\n}\n\n/**\n * Define an integration function that can be used to create an integration instance.\n * Note that this by design hides the implementation details of the integration, as they are considered internal.\n */\nfunction defineIntegration(fn) {\n return fn;\n}\n\nexport { addIntegration, afterSetupIntegrations, defineIntegration, getIntegrationsToSetup, installedIntegrations, setupIntegration, setupIntegrations };\n","import { logger, getEventDescription, stringMatchesSomePattern } from '@sentry/utils';\nimport { DEBUG_BUILD } from '../debug-build.js';\nimport { defineIntegration } from '../integration.js';\n\n// \"Script error.\" is hard coded into browsers for errors that it can't read.\n// this is the result of a script being pulled in from an external domain and CORS.\nconst DEFAULT_IGNORE_ERRORS = [\n /^Script error\\.?$/,\n /^Javascript error: Script error\\.? on line 0$/,\n /^ResizeObserver loop completed with undelivered notifications.$/, // The browser logs this when a ResizeObserver handler takes a bit longer. Usually this is not an actual issue though. It indicates slowness.\n /^Cannot redefine property: googletag$/, // This is thrown when google tag manager is used in combination with an ad blocker\n \"undefined is not an object (evaluating 'a.L')\", // Random error that happens but not actionable or noticeable to end-users.\n 'can\\'t redefine non-configurable property \"solana\"', // Probably a browser extension or custom browser (Brave) throwing this error\n \"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)\", // Error thrown by GTM, seemingly not affecting end-users\n \"Can't find variable: _AutofillCallbackHandler\", // Unactionable error in instagram webview https://developers.facebook.com/community/threads/320013549791141/\n];\n\n/** Options for the InboundFilters integration */\n\nconst INTEGRATION_NAME = 'InboundFilters';\nconst _inboundFiltersIntegration = ((options = {}) => {\n return {\n name: INTEGRATION_NAME,\n processEvent(event, _hint, client) {\n const clientOptions = client.getOptions();\n const mergedOptions = _mergeOptions(options, clientOptions);\n return _shouldDropEvent(event, mergedOptions) ? null : event;\n },\n };\n}) ;\n\nconst inboundFiltersIntegration = defineIntegration(_inboundFiltersIntegration);\n\nfunction _mergeOptions(\n internalOptions = {},\n clientOptions = {},\n) {\n return {\n allowUrls: [...(internalOptions.allowUrls || []), ...(clientOptions.allowUrls || [])],\n denyUrls: [...(internalOptions.denyUrls || []), ...(clientOptions.denyUrls || [])],\n ignoreErrors: [\n ...(internalOptions.ignoreErrors || []),\n ...(clientOptions.ignoreErrors || []),\n ...(internalOptions.disableErrorDefaults ? [] : DEFAULT_IGNORE_ERRORS),\n ],\n ignoreTransactions: [...(internalOptions.ignoreTransactions || []), ...(clientOptions.ignoreTransactions || [])],\n ignoreInternal: internalOptions.ignoreInternal !== undefined ? internalOptions.ignoreInternal : true,\n };\n}\n\nfunction _shouldDropEvent(event, options) {\n if (options.ignoreInternal && _isSentryError(event)) {\n DEBUG_BUILD &&\n logger.warn(`Event dropped due to being internal Sentry Error.\\nEvent: ${getEventDescription(event)}`);\n return true;\n }\n if (_isIgnoredError(event, options.ignoreErrors)) {\n DEBUG_BUILD &&\n logger.warn(\n `Event dropped due to being matched by \\`ignoreErrors\\` option.\\nEvent: ${getEventDescription(event)}`,\n );\n return true;\n }\n if (_isUselessError(event)) {\n DEBUG_BUILD &&\n logger.warn(\n `Event dropped due to not having an error message, error type or stacktrace.\\nEvent: ${getEventDescription(\n event,\n )}`,\n );\n return true;\n }\n if (_isIgnoredTransaction(event, options.ignoreTransactions)) {\n DEBUG_BUILD &&\n logger.warn(\n `Event dropped due to being matched by \\`ignoreTransactions\\` option.\\nEvent: ${getEventDescription(event)}`,\n );\n return true;\n }\n if (_isDeniedUrl(event, options.denyUrls)) {\n DEBUG_BUILD &&\n logger.warn(\n `Event dropped due to being matched by \\`denyUrls\\` option.\\nEvent: ${getEventDescription(\n event,\n )}.\\nUrl: ${_getEventFilterUrl(event)}`,\n );\n return true;\n }\n if (!_isAllowedUrl(event, options.allowUrls)) {\n DEBUG_BUILD &&\n logger.warn(\n `Event dropped due to not being matched by \\`allowUrls\\` option.\\nEvent: ${getEventDescription(\n event,\n )}.\\nUrl: ${_getEventFilterUrl(event)}`,\n );\n return true;\n }\n return false;\n}\n\nfunction _isIgnoredError(event, ignoreErrors) {\n // If event.type, this is not an error\n if (event.type || !ignoreErrors || !ignoreErrors.length) {\n return false;\n }\n\n return _getPossibleEventMessages(event).some(message => stringMatchesSomePattern(message, ignoreErrors));\n}\n\nfunction _isIgnoredTransaction(event, ignoreTransactions) {\n if (event.type !== 'transaction' || !ignoreTransactions || !ignoreTransactions.length) {\n return false;\n }\n\n const name = event.transaction;\n return name ? stringMatchesSomePattern(name, ignoreTransactions) : false;\n}\n\nfunction _isDeniedUrl(event, denyUrls) {\n // TODO: Use Glob instead?\n if (!denyUrls || !denyUrls.length) {\n return false;\n }\n const url = _getEventFilterUrl(event);\n return !url ? false : stringMatchesSomePattern(url, denyUrls);\n}\n\nfunction _isAllowedUrl(event, allowUrls) {\n // TODO: Use Glob instead?\n if (!allowUrls || !allowUrls.length) {\n return true;\n }\n const url = _getEventFilterUrl(event);\n return !url ? true : stringMatchesSomePattern(url, allowUrls);\n}\n\nfunction _getPossibleEventMessages(event) {\n const possibleMessages = [];\n\n if (event.message) {\n possibleMessages.push(event.message);\n }\n\n let lastException;\n try {\n // @ts-expect-error Try catching to save bundle size\n lastException = event.exception.values[event.exception.values.length - 1];\n } catch (e) {\n // try catching to save bundle size checking existence of variables\n }\n\n if (lastException) {\n if (lastException.value) {\n possibleMessages.push(lastException.value);\n if (lastException.type) {\n possibleMessages.push(`${lastException.type}: ${lastException.value}`);\n }\n }\n }\n\n return possibleMessages;\n}\n\nfunction _isSentryError(event) {\n try {\n // @ts-expect-error can't be a sentry error if undefined\n return event.exception.values[0].type === 'SentryError';\n } catch (e) {\n // ignore\n }\n return false;\n}\n\nfunction _getLastValidUrl(frames = []) {\n for (let i = frames.length - 1; i >= 0; i--) {\n const frame = frames[i];\n\n if (frame && frame.filename !== '' && frame.filename !== '[native code]') {\n return frame.filename || null;\n }\n }\n\n return null;\n}\n\nfunction _getEventFilterUrl(event) {\n try {\n let frames;\n try {\n // @ts-expect-error we only care about frames if the whole thing here is defined\n frames = event.exception.values[0].stacktrace.frames;\n } catch (e) {\n // ignore\n }\n return frames ? _getLastValidUrl(frames) : null;\n } catch (oO) {\n DEBUG_BUILD && logger.error(`Cannot extract url for event ${getEventDescription(event)}`);\n return null;\n }\n}\n\nfunction _isUselessError(event) {\n if (event.type) {\n // event is not an error\n return false;\n }\n\n // We only want to consider events for dropping that actually have recorded exception values.\n if (!event.exception || !event.exception.values || event.exception.values.length === 0) {\n return false;\n }\n\n return (\n // No top-level message\n !event.message &&\n // There are no exception values that have a stacktrace, a non-generic-Error type or value\n !event.exception.values.some(value => value.stacktrace || (value.type && value.type !== 'Error') || value.value)\n );\n}\n\nexport { inboundFiltersIntegration };\n","import { getOriginalFunction } from '@sentry/utils';\nimport { getClient } from '../currentScopes.js';\nimport { defineIntegration } from '../integration.js';\n\nlet originalFunctionToString;\n\nconst INTEGRATION_NAME = 'FunctionToString';\n\nconst SETUP_CLIENTS = new WeakMap();\n\nconst _functionToStringIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n originalFunctionToString = Function.prototype.toString;\n\n // intrinsics (like Function.prototype) might be immutable in some environments\n // e.g. Node with --frozen-intrinsics, XS (an embedded JavaScript engine) or SES (a JavaScript proposal)\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Function.prototype.toString = function ( ...args) {\n const originalFunction = getOriginalFunction(this);\n const context =\n SETUP_CLIENTS.has(getClient() ) && originalFunction !== undefined ? originalFunction : this;\n return originalFunctionToString.apply(context, args);\n };\n } catch (e) {\n // ignore errors here, just don't patch this\n }\n },\n setup(client) {\n SETUP_CLIENTS.set(client, true);\n },\n };\n}) ;\n\n/**\n * Patch toString calls to return proper name for wrapped functions.\n *\n * ```js\n * Sentry.init({\n * integrations: [\n * functionToStringIntegration(),\n * ],\n * });\n * ```\n */\nconst functionToStringIntegration = defineIntegration(_functionToStringIntegration);\n\nexport { functionToStringIntegration };\n","import { logger, getFramesFromEvent } from '@sentry/utils';\nimport { defineIntegration } from '../integration.js';\nimport { DEBUG_BUILD } from '../debug-build.js';\n\nconst INTEGRATION_NAME = 'Dedupe';\n\nconst _dedupeIntegration = (() => {\n let previousEvent;\n\n return {\n name: INTEGRATION_NAME,\n processEvent(currentEvent) {\n // We want to ignore any non-error type events, e.g. transactions or replays\n // These should never be deduped, and also not be compared against as _previousEvent.\n if (currentEvent.type) {\n return currentEvent;\n }\n\n // Juuust in case something goes wrong\n try {\n if (_shouldDropEvent(currentEvent, previousEvent)) {\n DEBUG_BUILD && logger.warn('Event dropped due to being a duplicate of previously captured event.');\n return null;\n }\n } catch (_oO) {} // eslint-disable-line no-empty\n\n return (previousEvent = currentEvent);\n },\n };\n}) ;\n\n/**\n * Deduplication filter.\n */\nconst dedupeIntegration = defineIntegration(_dedupeIntegration);\n\n/** only exported for tests. */\nfunction _shouldDropEvent(currentEvent, previousEvent) {\n if (!previousEvent) {\n return false;\n }\n\n if (_isSameMessageEvent(currentEvent, previousEvent)) {\n return true;\n }\n\n if (_isSameExceptionEvent(currentEvent, previousEvent)) {\n return true;\n }\n\n return false;\n}\n\nfunction _isSameMessageEvent(currentEvent, previousEvent) {\n const currentMessage = currentEvent.message;\n const previousMessage = previousEvent.message;\n\n // If neither event has a message property, they were both exceptions, so bail out\n if (!currentMessage && !previousMessage) {\n return false;\n }\n\n // If only one event has a stacktrace, but not the other one, they are not the same\n if ((currentMessage && !previousMessage) || (!currentMessage && previousMessage)) {\n return false;\n }\n\n if (currentMessage !== previousMessage) {\n return false;\n }\n\n if (!_isSameFingerprint(currentEvent, previousEvent)) {\n return false;\n }\n\n if (!_isSameStacktrace(currentEvent, previousEvent)) {\n return false;\n }\n\n return true;\n}\n\nfunction _isSameExceptionEvent(currentEvent, previousEvent) {\n const previousException = _getExceptionFromEvent(previousEvent);\n const currentException = _getExceptionFromEvent(currentEvent);\n\n if (!previousException || !currentException) {\n return false;\n }\n\n if (previousException.type !== currentException.type || previousException.value !== currentException.value) {\n return false;\n }\n\n if (!_isSameFingerprint(currentEvent, previousEvent)) {\n return false;\n }\n\n if (!_isSameStacktrace(currentEvent, previousEvent)) {\n return false;\n }\n\n return true;\n}\n\nfunction _isSameStacktrace(currentEvent, previousEvent) {\n let currentFrames = getFramesFromEvent(currentEvent);\n let previousFrames = getFramesFromEvent(previousEvent);\n\n // If neither event has a stacktrace, they are assumed to be the same\n if (!currentFrames && !previousFrames) {\n return true;\n }\n\n // If only one event has a stacktrace, but not the other one, they are not the same\n if ((currentFrames && !previousFrames) || (!currentFrames && previousFrames)) {\n return false;\n }\n\n currentFrames = currentFrames ;\n previousFrames = previousFrames ;\n\n // If number of frames differ, they are not the same\n if (previousFrames.length !== currentFrames.length) {\n return false;\n }\n\n // Otherwise, compare the two\n for (let i = 0; i < previousFrames.length; i++) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const frameA = previousFrames[i];\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const frameB = currentFrames[i];\n\n if (\n frameA.filename !== frameB.filename ||\n frameA.lineno !== frameB.lineno ||\n frameA.colno !== frameB.colno ||\n frameA.function !== frameB.function\n ) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction _isSameFingerprint(currentEvent, previousEvent) {\n let currentFingerprint = currentEvent.fingerprint;\n let previousFingerprint = previousEvent.fingerprint;\n\n // If neither event has a fingerprint, they are assumed to be the same\n if (!currentFingerprint && !previousFingerprint) {\n return true;\n }\n\n // If only one event has a fingerprint, but not the other one, they are not the same\n if ((currentFingerprint && !previousFingerprint) || (!currentFingerprint && previousFingerprint)) {\n return false;\n }\n\n currentFingerprint = currentFingerprint ;\n previousFingerprint = previousFingerprint ;\n\n // Otherwise, compare the two\n try {\n return !!(currentFingerprint.join('') === previousFingerprint.join(''));\n } catch (_oO) {\n return false;\n }\n}\n\nfunction _getExceptionFromEvent(event) {\n return event.exception && event.exception.values && event.exception.values[0];\n}\n\nexport { _shouldDropEvent, dedupeIntegration };\n","import { DEBUG_BUILD } from './debug-build.js';\nimport { consoleSandbox, logger } from './logger.js';\n\n/** Regular expression used to parse a Dsn. */\nconst DSN_REGEX = /^(?:(\\w+):)\\/\\/(?:(\\w+)(?::(\\w+)?)?@)([\\w.-]+)(?::(\\d+))?\\/(.+)/;\n\nfunction isValidProtocol(protocol) {\n return protocol === 'http' || protocol === 'https';\n}\n\n/**\n * Renders the string representation of this Dsn.\n *\n * By default, this will render the public representation without the password\n * component. To get the deprecated private representation, set `withPassword`\n * to true.\n *\n * @param withPassword When set to true, the password will be included.\n */\nfunction dsnToString(dsn, withPassword = false) {\n const { host, path, pass, port, projectId, protocol, publicKey } = dsn;\n return (\n `${protocol}://${publicKey}${withPassword && pass ? `:${pass}` : ''}` +\n `@${host}${port ? `:${port}` : ''}/${path ? `${path}/` : path}${projectId}`\n );\n}\n\n/**\n * Parses a Dsn from a given string.\n *\n * @param str A Dsn as string\n * @returns Dsn as DsnComponents or undefined if @param str is not a valid DSN string\n */\nfunction dsnFromString(str) {\n const match = DSN_REGEX.exec(str);\n\n if (!match) {\n // This should be logged to the console\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.error(`Invalid Sentry Dsn: ${str}`);\n });\n return undefined;\n }\n\n const [protocol, publicKey, pass = '', host = '', port = '', lastPath = ''] = match.slice(1);\n let path = '';\n let projectId = lastPath;\n\n const split = projectId.split('/');\n if (split.length > 1) {\n path = split.slice(0, -1).join('/');\n projectId = split.pop() ;\n }\n\n if (projectId) {\n const projectMatch = projectId.match(/^\\d+/);\n if (projectMatch) {\n projectId = projectMatch[0];\n }\n }\n\n return dsnFromComponents({ host, pass, path, projectId, port, protocol: protocol , publicKey });\n}\n\nfunction dsnFromComponents(components) {\n return {\n protocol: components.protocol,\n publicKey: components.publicKey || '',\n pass: components.pass || '',\n host: components.host,\n port: components.port || '',\n path: components.path || '',\n projectId: components.projectId,\n };\n}\n\nfunction validateDsn(dsn) {\n if (!DEBUG_BUILD) {\n return true;\n }\n\n const { port, projectId, protocol } = dsn;\n\n const requiredComponents = ['protocol', 'publicKey', 'host', 'projectId'];\n const hasMissingRequiredComponent = requiredComponents.find(component => {\n if (!dsn[component]) {\n logger.error(`Invalid Sentry Dsn: ${component} missing`);\n return true;\n }\n return false;\n });\n\n if (hasMissingRequiredComponent) {\n return false;\n }\n\n if (!projectId.match(/^\\d+$/)) {\n logger.error(`Invalid Sentry Dsn: Invalid projectId ${projectId}`);\n return false;\n }\n\n if (!isValidProtocol(protocol)) {\n logger.error(`Invalid Sentry Dsn: Invalid protocol ${protocol}`);\n return false;\n }\n\n if (port && isNaN(parseInt(port, 10))) {\n logger.error(`Invalid Sentry Dsn: Invalid port ${port}`);\n return false;\n }\n\n return true;\n}\n\n/**\n * Creates a valid Sentry Dsn object, identifying a Sentry instance and project.\n * @returns a valid DsnComponents object or `undefined` if @param from is an invalid DSN source\n */\nfunction makeDsn(from) {\n const components = typeof from === 'string' ? dsnFromString(from) : dsnFromComponents(from);\n if (!components || !validateDsn(components)) {\n return undefined;\n }\n return components;\n}\n\nexport { dsnFromString, dsnToString, makeDsn };\n","import { makeDsn, dsnToString, urlEncode } from '@sentry/utils';\n\nconst SENTRY_API_VERSION = '7';\n\n/** Returns the prefix to construct Sentry ingestion API endpoints. */\nfunction getBaseApiEndpoint(dsn) {\n const protocol = dsn.protocol ? `${dsn.protocol}:` : '';\n const port = dsn.port ? `:${dsn.port}` : '';\n return `${protocol}//${dsn.host}${port}${dsn.path ? `/${dsn.path}` : ''}/api/`;\n}\n\n/** Returns the ingest API endpoint for target. */\nfunction _getIngestEndpoint(dsn) {\n return `${getBaseApiEndpoint(dsn)}${dsn.projectId}/envelope/`;\n}\n\n/** Returns a URL-encoded string with auth config suitable for a query string. */\nfunction _encodedAuth(dsn, sdkInfo) {\n return urlEncode({\n // We send only the minimum set of required information. See\n // https://github.com/getsentry/sentry-javascript/issues/2572.\n sentry_key: dsn.publicKey,\n sentry_version: SENTRY_API_VERSION,\n ...(sdkInfo && { sentry_client: `${sdkInfo.name}/${sdkInfo.version}` }),\n });\n}\n\n/**\n * Returns the envelope endpoint URL with auth in the query string.\n *\n * Sending auth as part of the query string and not as custom HTTP headers avoids CORS preflight requests.\n */\nfunction getEnvelopeEndpointWithUrlEncodedAuth(dsn, tunnel, sdkInfo) {\n return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, sdkInfo)}`;\n}\n\n/** Returns the url to the report dialog endpoint. */\nfunction getReportDialogEndpoint(\n dsnLike,\n dialogOptions\n\n,\n) {\n const dsn = makeDsn(dsnLike);\n if (!dsn) {\n return '';\n }\n\n const endpoint = `${getBaseApiEndpoint(dsn)}embed/error-page/`;\n\n let encodedOptions = `dsn=${dsnToString(dsn)}`;\n for (const key in dialogOptions) {\n if (key === 'dsn') {\n continue;\n }\n\n if (key === 'onClose') {\n continue;\n }\n\n if (key === 'user') {\n const user = dialogOptions.user;\n if (!user) {\n continue;\n }\n if (user.name) {\n encodedOptions += `&name=${encodeURIComponent(user.name)}`;\n }\n if (user.email) {\n encodedOptions += `&email=${encodeURIComponent(user.email)}`;\n }\n } else {\n encodedOptions += `&${encodeURIComponent(key)}=${encodeURIComponent(dialogOptions[key] )}`;\n }\n }\n\n return `${endpoint}?${encodedOptions}`;\n}\n\nexport { getEnvelopeEndpointWithUrlEncodedAuth, getReportDialogEndpoint };\n","import { DEBUG_BUILD } from './debug-build.js';\nimport { logger } from './logger.js';\nimport { GLOBAL_OBJ } from './worldwide.js';\n\nconst WINDOW = GLOBAL_OBJ ;\n\n/**\n * Tells whether current environment supports ErrorEvent objects\n * {@link supportsErrorEvent}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsErrorEvent() {\n try {\n new ErrorEvent('');\n return true;\n } catch (e) {\n return false;\n }\n}\n\n/**\n * Tells whether current environment supports DOMError objects\n * {@link supportsDOMError}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsDOMError() {\n try {\n // Chrome: VM89:1 Uncaught TypeError: Failed to construct 'DOMError':\n // 1 argument required, but only 0 present.\n // @ts-expect-error It really needs 1 argument, not 0.\n new DOMError('');\n return true;\n } catch (e) {\n return false;\n }\n}\n\n/**\n * Tells whether current environment supports DOMException objects\n * {@link supportsDOMException}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsDOMException() {\n try {\n new DOMException('');\n return true;\n } catch (e) {\n return false;\n }\n}\n\n/**\n * Tells whether current environment supports Fetch API\n * {@link supportsFetch}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsFetch() {\n if (!('fetch' in WINDOW)) {\n return false;\n }\n\n try {\n new Headers();\n new Request('http://www.example.com');\n new Response();\n return true;\n } catch (e) {\n return false;\n }\n}\n\n/**\n * isNative checks if the given function is a native implementation\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction isNativeFunction(func) {\n return func && /^function\\s+\\w+\\(\\)\\s+\\{\\s+\\[native code\\]\\s+\\}$/.test(func.toString());\n}\n\n/**\n * Tells whether current environment supports Fetch API natively\n * {@link supportsNativeFetch}.\n *\n * @returns true if `window.fetch` is natively implemented, false otherwise\n */\nfunction supportsNativeFetch() {\n if (typeof EdgeRuntime === 'string') {\n return true;\n }\n\n if (!supportsFetch()) {\n return false;\n }\n\n // Fast path to avoid DOM I/O\n // eslint-disable-next-line @typescript-eslint/unbound-method\n if (isNativeFunction(WINDOW.fetch)) {\n return true;\n }\n\n // window.fetch is implemented, but is polyfilled or already wrapped (e.g: by a chrome extension)\n // so create a \"pure\" iframe to see if that has native fetch\n let result = false;\n const doc = WINDOW.document;\n // eslint-disable-next-line deprecation/deprecation\n if (doc && typeof (doc.createElement ) === 'function') {\n try {\n const sandbox = doc.createElement('iframe');\n sandbox.hidden = true;\n doc.head.appendChild(sandbox);\n if (sandbox.contentWindow && sandbox.contentWindow.fetch) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n result = isNativeFunction(sandbox.contentWindow.fetch);\n }\n doc.head.removeChild(sandbox);\n } catch (err) {\n DEBUG_BUILD &&\n logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', err);\n }\n }\n\n return result;\n}\n\n/**\n * Tells whether current environment supports ReportingObserver API\n * {@link supportsReportingObserver}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsReportingObserver() {\n return 'ReportingObserver' in WINDOW;\n}\n\n/**\n * Tells whether current environment supports Referrer Policy API\n * {@link supportsReferrerPolicy}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsReferrerPolicy() {\n // Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default'\n // (see https://caniuse.com/#feat=referrer-policy),\n // it doesn't. And it throws an exception instead of ignoring this parameter...\n // REF: https://github.com/getsentry/raven-js/issues/1233\n\n if (!supportsFetch()) {\n return false;\n }\n\n try {\n new Request('_', {\n referrerPolicy: 'origin' ,\n });\n return true;\n } catch (e) {\n return false;\n }\n}\n\nexport { isNativeFunction, supportsDOMError, supportsDOMException, supportsErrorEvent, supportsFetch, supportsNativeFetch, supportsReferrerPolicy, supportsReportingObserver };\n","/**\n * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nconst DEBUG_BUILD = (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__);\n\nexport { DEBUG_BUILD };\n","import { SDK_VERSION } from './version.js';\n\n/** Get's the global object for the current JavaScript runtime */\nconst GLOBAL_OBJ = globalThis ;\n\n/**\n * Returns a global singleton contained in the global `__SENTRY__[]` object.\n *\n * If the singleton doesn't already exist in `__SENTRY__`, it will be created using the given factory\n * function and added to the `__SENTRY__` object.\n *\n * @param name name of the global singleton on __SENTRY__\n * @param creator creator Factory function to create the singleton if it doesn't already exist on `__SENTRY__`\n * @param obj (Optional) The global object on which to look for `__SENTRY__`, if not `GLOBAL_OBJ`'s return value\n * @returns the singleton\n */\nfunction getGlobalSingleton(name, creator, obj) {\n const gbl = (obj || GLOBAL_OBJ) ;\n const __SENTRY__ = (gbl.__SENTRY__ = gbl.__SENTRY__ || {});\n const versionedCarrier = (__SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {});\n return versionedCarrier[name] || (versionedCarrier[name] = creator());\n}\n\nexport { GLOBAL_OBJ, getGlobalSingleton };\n","import { DEBUG_BUILD } from './debug-build.js';\nimport { GLOBAL_OBJ } from './worldwide.js';\n\n/** Prefix for logging strings */\nconst PREFIX = 'Sentry Logger ';\n\nconst CONSOLE_LEVELS = [\n 'debug',\n 'info',\n 'warn',\n 'error',\n 'log',\n 'assert',\n 'trace',\n] ;\n\n/** This may be mutated by the console instrumentation. */\nconst originalConsoleMethods\n\n = {};\n\n/** JSDoc */\n\n/**\n * Temporarily disable sentry console instrumentations.\n *\n * @param callback The function to run against the original `console` messages\n * @returns The results of the callback\n */\nfunction consoleSandbox(callback) {\n if (!('console' in GLOBAL_OBJ)) {\n return callback();\n }\n\n const console = GLOBAL_OBJ.console ;\n const wrappedFuncs = {};\n\n const wrappedLevels = Object.keys(originalConsoleMethods) ;\n\n // Restore all wrapped console methods\n wrappedLevels.forEach(level => {\n const originalConsoleMethod = originalConsoleMethods[level] ;\n wrappedFuncs[level] = console[level] ;\n console[level] = originalConsoleMethod;\n });\n\n try {\n return callback();\n } finally {\n // Revert restoration to wrapped state\n wrappedLevels.forEach(level => {\n console[level] = wrappedFuncs[level] ;\n });\n }\n}\n\nfunction makeLogger() {\n let enabled = false;\n const logger = {\n enable: () => {\n enabled = true;\n },\n disable: () => {\n enabled = false;\n },\n isEnabled: () => enabled,\n };\n\n if (DEBUG_BUILD) {\n CONSOLE_LEVELS.forEach(name => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n logger[name] = (...args) => {\n if (enabled) {\n consoleSandbox(() => {\n GLOBAL_OBJ.console[name](`${PREFIX}[${name}]:`, ...args);\n });\n }\n };\n });\n } else {\n CONSOLE_LEVELS.forEach(name => {\n logger[name] = () => undefined;\n });\n }\n\n return logger ;\n}\n\nconst logger = makeLogger();\n\nexport { CONSOLE_LEVELS, consoleSandbox, logger, originalConsoleMethods };\n","const STACKTRACE_FRAME_LIMIT = 50;\nconst UNKNOWN_FUNCTION = '?';\n// Used to sanitize webpack (error: *) wrapped stack errors\nconst WEBPACK_ERROR_REGEXP = /\\(error: (.*)\\)/;\nconst STRIP_FRAME_REGEXP = /captureMessage|captureException/;\n\n/**\n * Creates a stack parser with the supplied line parsers\n *\n * StackFrames are returned in the correct order for Sentry Exception\n * frames and with Sentry SDK internal frames removed from the top and bottom\n *\n */\nfunction createStackParser(...parsers) {\n const sortedParsers = parsers.sort((a, b) => a[0] - b[0]).map(p => p[1]);\n\n return (stack, skipFirstLines = 0, framesToPop = 0) => {\n const frames = [];\n const lines = stack.split('\\n');\n\n for (let i = skipFirstLines; i < lines.length; i++) {\n const line = lines[i] ;\n // Ignore lines over 1kb as they are unlikely to be stack frames.\n // Many of the regular expressions use backtracking which results in run time that increases exponentially with\n // input size. Huge strings can result in hangs/Denial of Service:\n // https://github.com/getsentry/sentry-javascript/issues/2286\n if (line.length > 1024) {\n continue;\n }\n\n // https://github.com/getsentry/sentry-javascript/issues/5459\n // Remove webpack (error: *) wrappers\n const cleanedLine = WEBPACK_ERROR_REGEXP.test(line) ? line.replace(WEBPACK_ERROR_REGEXP, '$1') : line;\n\n // https://github.com/getsentry/sentry-javascript/issues/7813\n // Skip Error: lines\n if (cleanedLine.match(/\\S*Error: /)) {\n continue;\n }\n\n for (const parser of sortedParsers) {\n const frame = parser(cleanedLine);\n\n if (frame) {\n frames.push(frame);\n break;\n }\n }\n\n if (frames.length >= STACKTRACE_FRAME_LIMIT + framesToPop) {\n break;\n }\n }\n\n return stripSentryFramesAndReverse(frames.slice(framesToPop));\n };\n}\n\n/**\n * Gets a stack parser implementation from Options.stackParser\n * @see Options\n *\n * If options contains an array of line parsers, it is converted into a parser\n */\nfunction stackParserFromStackParserOptions(stackParser) {\n if (Array.isArray(stackParser)) {\n return createStackParser(...stackParser);\n }\n return stackParser;\n}\n\n/**\n * Removes Sentry frames from the top and bottom of the stack if present and enforces a limit of max number of frames.\n * Assumes stack input is ordered from top to bottom and returns the reverse representation so call site of the\n * function that caused the crash is the last frame in the array.\n * @hidden\n */\nfunction stripSentryFramesAndReverse(stack) {\n if (!stack.length) {\n return [];\n }\n\n const localStack = Array.from(stack);\n\n // If stack starts with one of our API calls, remove it (starts, meaning it's the top of the stack - aka last call)\n if (/sentryWrapped/.test(getLastStackFrame(localStack).function || '')) {\n localStack.pop();\n }\n\n // Reversing in the middle of the procedure allows us to just pop the values off the stack\n localStack.reverse();\n\n // If stack ends with one of our internal API calls, remove it (ends, meaning it's the bottom of the stack - aka top-most call)\n if (STRIP_FRAME_REGEXP.test(getLastStackFrame(localStack).function || '')) {\n localStack.pop();\n\n // When using synthetic events, we will have a 2 levels deep stack, as `new Error('Sentry syntheticException')`\n // is produced within the hub itself, making it:\n //\n // Sentry.captureException()\n // getCurrentHub().captureException()\n //\n // instead of just the top `Sentry` call itself.\n // This forces us to possibly strip an additional frame in the exact same was as above.\n if (STRIP_FRAME_REGEXP.test(getLastStackFrame(localStack).function || '')) {\n localStack.pop();\n }\n }\n\n return localStack.slice(0, STACKTRACE_FRAME_LIMIT).map(frame => ({\n ...frame,\n filename: frame.filename || getLastStackFrame(localStack).filename,\n function: frame.function || UNKNOWN_FUNCTION,\n }));\n}\n\nfunction getLastStackFrame(arr) {\n return arr[arr.length - 1] || {};\n}\n\nconst defaultFunctionName = '';\n\n/**\n * Safely extract function name from itself\n */\nfunction getFunctionName(fn) {\n try {\n if (!fn || typeof fn !== 'function') {\n return defaultFunctionName;\n }\n return fn.name || defaultFunctionName;\n } catch (e) {\n // Just accessing custom props in some Selenium environments\n // can cause a \"Permission denied\" exception (see raven-js#495).\n return defaultFunctionName;\n }\n}\n\n/**\n * Get's stack frames from an event without needing to check for undefined properties.\n */\nfunction getFramesFromEvent(event) {\n const exception = event.exception;\n\n if (exception) {\n const frames = [];\n try {\n // @ts-expect-error Object could be undefined\n exception.values.forEach(value => {\n // @ts-expect-error Value could be undefined\n if (value.stacktrace.frames) {\n // @ts-expect-error Value could be undefined\n frames.push(...value.stacktrace.frames);\n }\n });\n return frames;\n } catch (_oO) {\n return undefined;\n }\n }\n return undefined;\n}\n\nexport { UNKNOWN_FUNCTION, createStackParser, getFramesFromEvent, getFunctionName, stackParserFromStackParserOptions, stripSentryFramesAndReverse };\n","import { DEBUG_BUILD } from '../debug-build.js';\nimport { logger } from '../logger.js';\nimport { getFunctionName } from '../stacktrace.js';\n\n// We keep the handlers globally\nconst handlers = {};\nconst instrumented = {};\n\n/** Add a handler function. */\nfunction addHandler(type, handler) {\n handlers[type] = handlers[type] || [];\n (handlers[type] ).push(handler);\n}\n\n/**\n * Reset all instrumentation handlers.\n * This can be used by tests to ensure we have a clean slate of instrumentation handlers.\n */\nfunction resetInstrumentationHandlers() {\n Object.keys(handlers).forEach(key => {\n handlers[key ] = undefined;\n });\n}\n\n/** Maybe run an instrumentation function, unless it was already called. */\nfunction maybeInstrument(type, instrumentFn) {\n if (!instrumented[type]) {\n instrumentFn();\n instrumented[type] = true;\n }\n}\n\n/** Trigger handlers for a given instrumentation type. */\nfunction triggerHandlers(type, data) {\n const typeHandlers = type && handlers[type];\n if (!typeHandlers) {\n return;\n }\n\n for (const handler of typeHandlers) {\n try {\n handler(data);\n } catch (e) {\n DEBUG_BUILD &&\n logger.error(\n `Error while triggering instrumentation handler.\\nType: ${type}\\nName: ${getFunctionName(handler)}\\nError:`,\n e,\n );\n }\n }\n}\n\nexport { addHandler, maybeInstrument, resetInstrumentationHandlers, triggerHandlers };\n","import { GLOBAL_OBJ } from '../worldwide.js';\n\n// Based on https://github.com/angular/angular.js/pull/13945/files\n// The MIT License\n\n\nconst WINDOW = GLOBAL_OBJ ;\n\n/**\n * Tells whether current environment supports History API\n * {@link supportsHistory}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsHistory() {\n // NOTE: in Chrome App environment, touching history.pushState, *even inside\n // a try/catch block*, will cause Chrome to output an error to console.error\n // borrowed from: https://github.com/angular/angular.js/pull/13945/files\n /* eslint-disable @typescript-eslint/no-unsafe-member-access */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const chromeVar = (WINDOW ).chrome;\n const isChromePackagedApp = chromeVar && chromeVar.app && chromeVar.app.runtime;\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n const hasHistoryApi = 'history' in WINDOW && !!WINDOW.history.pushState && !!WINDOW.history.replaceState;\n\n return !isChromePackagedApp && hasHistoryApi;\n}\n\nexport { supportsHistory };\n","import { htmlTreeAsString } from './browser.js';\nimport { DEBUG_BUILD } from './debug-build.js';\nimport { isError, isEvent, isInstanceOf, isElement, isPlainObject, isPrimitive } from './is.js';\nimport { logger } from './logger.js';\nimport { truncate } from './string.js';\n\n/**\n * Replace a method in an object with a wrapped version of itself.\n *\n * @param source An object that contains a method to be wrapped.\n * @param name The name of the method to be wrapped.\n * @param replacementFactory A higher-order function that takes the original version of the given method and returns a\n * wrapped version. Note: The function returned by `replacementFactory` needs to be a non-arrow function, in order to\n * preserve the correct value of `this`, and the original method must be called using `origMethod.call(this, )` or `origMethod.apply(this, [])` (rather than being called directly), again to preserve `this`.\n * @returns void\n */\nfunction fill(source, name, replacementFactory) {\n if (!(name in source)) {\n return;\n }\n\n const original = source[name] ;\n const wrapped = replacementFactory(original) ;\n\n // Make sure it's a function first, as we need to attach an empty prototype for `defineProperties` to work\n // otherwise it'll throw \"TypeError: Object.defineProperties called on non-object\"\n if (typeof wrapped === 'function') {\n markFunctionWrapped(wrapped, original);\n }\n\n source[name] = wrapped;\n}\n\n/**\n * Defines a non-enumerable property on the given object.\n *\n * @param obj The object on which to set the property\n * @param name The name of the property to be set\n * @param value The value to which to set the property\n */\nfunction addNonEnumerableProperty(obj, name, value) {\n try {\n Object.defineProperty(obj, name, {\n // enumerable: false, // the default, so we can save on bundle size by not explicitly setting it\n value: value,\n writable: true,\n configurable: true,\n });\n } catch (o_O) {\n DEBUG_BUILD && logger.log(`Failed to add non-enumerable property \"${name}\" to object`, obj);\n }\n}\n\n/**\n * Remembers the original function on the wrapped function and\n * patches up the prototype.\n *\n * @param wrapped the wrapper function\n * @param original the original function that gets wrapped\n */\nfunction markFunctionWrapped(wrapped, original) {\n try {\n const proto = original.prototype || {};\n wrapped.prototype = original.prototype = proto;\n addNonEnumerableProperty(wrapped, '__sentry_original__', original);\n } catch (o_O) {} // eslint-disable-line no-empty\n}\n\n/**\n * This extracts the original function if available. See\n * `markFunctionWrapped` for more information.\n *\n * @param func the function to unwrap\n * @returns the unwrapped version of the function if available.\n */\nfunction getOriginalFunction(func) {\n return func.__sentry_original__;\n}\n\n/**\n * Encodes given object into url-friendly format\n *\n * @param object An object that contains serializable values\n * @returns string Encoded\n */\nfunction urlEncode(object) {\n return Object.keys(object)\n .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(object[key])}`)\n .join('&');\n}\n\n/**\n * Transforms any `Error` or `Event` into a plain object with all of their enumerable properties, and some of their\n * non-enumerable properties attached.\n *\n * @param value Initial source that we have to transform in order for it to be usable by the serializer\n * @returns An Event or Error turned into an object - or the value argurment itself, when value is neither an Event nor\n * an Error.\n */\nfunction convertToPlainObject(\n value,\n)\n\n {\n if (isError(value)) {\n return {\n message: value.message,\n name: value.name,\n stack: value.stack,\n ...getOwnProperties(value),\n };\n } else if (isEvent(value)) {\n const newObj\n\n = {\n type: value.type,\n target: serializeEventTarget(value.target),\n currentTarget: serializeEventTarget(value.currentTarget),\n ...getOwnProperties(value),\n };\n\n if (typeof CustomEvent !== 'undefined' && isInstanceOf(value, CustomEvent)) {\n newObj.detail = value.detail;\n }\n\n return newObj;\n } else {\n return value;\n }\n}\n\n/** Creates a string representation of the target of an `Event` object */\nfunction serializeEventTarget(target) {\n try {\n return isElement(target) ? htmlTreeAsString(target) : Object.prototype.toString.call(target);\n } catch (_oO) {\n return '';\n }\n}\n\n/** Filters out all but an object's own properties */\nfunction getOwnProperties(obj) {\n if (typeof obj === 'object' && obj !== null) {\n const extractedProps = {};\n for (const property in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, property)) {\n extractedProps[property] = (obj )[property];\n }\n }\n return extractedProps;\n } else {\n return {};\n }\n}\n\n/**\n * Given any captured exception, extract its keys and create a sorted\n * and truncated list that will be used inside the event message.\n * eg. `Non-error exception captured with keys: foo, bar, baz`\n */\nfunction extractExceptionKeysForMessage(exception, maxLength = 40) {\n const keys = Object.keys(convertToPlainObject(exception));\n keys.sort();\n\n const firstKey = keys[0];\n\n if (!firstKey) {\n return '[object has no keys]';\n }\n\n if (firstKey.length >= maxLength) {\n return truncate(firstKey, maxLength);\n }\n\n for (let includedKeys = keys.length; includedKeys > 0; includedKeys--) {\n const serialized = keys.slice(0, includedKeys).join(', ');\n if (serialized.length > maxLength) {\n continue;\n }\n if (includedKeys === keys.length) {\n return serialized;\n }\n return truncate(serialized, maxLength);\n }\n\n return '';\n}\n\n/**\n * Given any object, return a new object having removed all fields whose value was `undefined`.\n * Works recursively on objects and arrays.\n *\n * Attention: This function keeps circular references in the returned object.\n */\nfunction dropUndefinedKeys(inputValue) {\n // This map keeps track of what already visited nodes map to.\n // Our Set - based memoBuilder doesn't work here because we want to the output object to have the same circular\n // references as the input object.\n const memoizationMap = new Map();\n\n // This function just proxies `_dropUndefinedKeys` to keep the `memoBuilder` out of this function's API\n return _dropUndefinedKeys(inputValue, memoizationMap);\n}\n\nfunction _dropUndefinedKeys(inputValue, memoizationMap) {\n if (isPojo(inputValue)) {\n // If this node has already been visited due to a circular reference, return the object it was mapped to in the new object\n const memoVal = memoizationMap.get(inputValue);\n if (memoVal !== undefined) {\n return memoVal ;\n }\n\n const returnValue = {};\n // Store the mapping of this value in case we visit it again, in case of circular data\n memoizationMap.set(inputValue, returnValue);\n\n for (const key of Object.keys(inputValue)) {\n if (typeof inputValue[key] !== 'undefined') {\n returnValue[key] = _dropUndefinedKeys(inputValue[key], memoizationMap);\n }\n }\n\n return returnValue ;\n }\n\n if (Array.isArray(inputValue)) {\n // If this node has already been visited due to a circular reference, return the array it was mapped to in the new object\n const memoVal = memoizationMap.get(inputValue);\n if (memoVal !== undefined) {\n return memoVal ;\n }\n\n const returnValue = [];\n // Store the mapping of this value in case we visit it again, in case of circular data\n memoizationMap.set(inputValue, returnValue);\n\n inputValue.forEach((item) => {\n returnValue.push(_dropUndefinedKeys(item, memoizationMap));\n });\n\n return returnValue ;\n }\n\n return inputValue;\n}\n\nfunction isPojo(input) {\n if (!isPlainObject(input)) {\n return false;\n }\n\n try {\n const name = (Object.getPrototypeOf(input) ).constructor.name;\n return !name || name === 'Object';\n } catch (e) {\n return true;\n }\n}\n\n/**\n * Ensure that something is an object.\n *\n * Turns `undefined` and `null` into `String`s and all other primitives into instances of their respective wrapper\n * classes (String, Boolean, Number, etc.). Acts as the identity function on non-primitives.\n *\n * @param wat The subject of the objectification\n * @returns A version of `wat` which can safely be used with `Object` class methods\n */\nfunction objectify(wat) {\n let objectified;\n switch (true) {\n case wat === undefined || wat === null:\n objectified = new String(wat);\n break;\n\n // Though symbols and bigints do have wrapper classes (`Symbol` and `BigInt`, respectively), for whatever reason\n // those classes don't have constructors which can be used with the `new` keyword. We therefore need to cast each as\n // an object in order to wrap it.\n case typeof wat === 'symbol' || typeof wat === 'bigint':\n objectified = Object(wat);\n break;\n\n // this will catch the remaining primitives: `String`, `Number`, and `Boolean`\n case isPrimitive(wat):\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n objectified = new (wat ).constructor(wat);\n break;\n\n // by process of elimination, at this point we know that `wat` must already be an object\n default:\n objectified = wat;\n break;\n }\n return objectified;\n}\n\nexport { addNonEnumerableProperty, convertToPlainObject, dropUndefinedKeys, extractExceptionKeysForMessage, fill, getOriginalFunction, markFunctionWrapped, objectify, urlEncode };\n","import { GLOBAL_OBJ } from '@sentry/utils';\n\nconst WINDOW = GLOBAL_OBJ\n\n;\n\nexport { WINDOW };\n","import { addHandler, maybeInstrument, supportsHistory, triggerHandlers, fill } from '@sentry/utils';\nimport { WINDOW } from '../types.js';\n\nlet lastHref;\n\n/**\n * Add an instrumentation handler for when a fetch request happens.\n * The handler function is called once when the request starts and once when it ends,\n * which can be identified by checking if it has an `endTimestamp`.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nfunction addHistoryInstrumentationHandler(handler) {\n const type = 'history';\n addHandler(type, handler);\n maybeInstrument(type, instrumentHistory);\n}\n\nfunction instrumentHistory() {\n if (!supportsHistory()) {\n return;\n }\n\n const oldOnPopState = WINDOW.onpopstate;\n WINDOW.onpopstate = function ( ...args) {\n const to = WINDOW.location.href;\n // keep track of the current URL state, as we always receive only the updated state\n const from = lastHref;\n lastHref = to;\n const handlerData = { from, to };\n triggerHandlers('history', handlerData);\n if (oldOnPopState) {\n // Apparently this can throw in Firefox when incorrectly implemented plugin is installed.\n // https://github.com/getsentry/sentry-javascript/issues/3344\n // https://github.com/bugsnag/bugsnag-js/issues/469\n try {\n return oldOnPopState.apply(this, args);\n } catch (_oO) {\n // no-empty\n }\n }\n };\n\n function historyReplacementFunction(originalHistoryFunction) {\n return function ( ...args) {\n const url = args.length > 2 ? args[2] : undefined;\n if (url) {\n // coerce to string (this is what pushState does)\n const from = lastHref;\n const to = String(url);\n // keep track of the current URL state, as we always receive only the updated state\n lastHref = to;\n const handlerData = { from, to };\n triggerHandlers('history', handlerData);\n }\n return originalHistoryFunction.apply(this, args);\n };\n }\n\n fill(WINDOW.history, 'pushState', historyReplacementFunction);\n fill(WINDOW.history, 'replaceState', historyReplacementFunction);\n}\n\nexport { addHistoryInstrumentationHandler };\n","import { dsnToString } from './dsn.js';\nimport { normalize } from './normalize.js';\nimport { dropUndefinedKeys } from './object.js';\nimport { GLOBAL_OBJ } from './worldwide.js';\n\n/**\n * Creates an envelope.\n * Make sure to always explicitly provide the generic to this function\n * so that the envelope types resolve correctly.\n */\nfunction createEnvelope(headers, items = []) {\n return [headers, items] ;\n}\n\n/**\n * Add an item to an envelope.\n * Make sure to always explicitly provide the generic to this function\n * so that the envelope types resolve correctly.\n */\nfunction addItemToEnvelope(envelope, newItem) {\n const [headers, items] = envelope;\n return [headers, [...items, newItem]] ;\n}\n\n/**\n * Convenience function to loop through the items and item types of an envelope.\n * (This function was mostly created because working with envelope types is painful at the moment)\n *\n * If the callback returns true, the rest of the items will be skipped.\n */\nfunction forEachEnvelopeItem(\n envelope,\n callback,\n) {\n const envelopeItems = envelope[1];\n\n for (const envelopeItem of envelopeItems) {\n const envelopeItemType = envelopeItem[0].type;\n const result = callback(envelopeItem, envelopeItemType);\n\n if (result) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Returns true if the envelope contains any of the given envelope item types\n */\nfunction envelopeContainsItemType(envelope, types) {\n return forEachEnvelopeItem(envelope, (_, type) => types.includes(type));\n}\n\n/**\n * Encode a string to UTF8 array.\n */\nfunction encodeUTF8(input) {\n return GLOBAL_OBJ.__SENTRY__ && GLOBAL_OBJ.__SENTRY__.encodePolyfill\n ? GLOBAL_OBJ.__SENTRY__.encodePolyfill(input)\n : new TextEncoder().encode(input);\n}\n\n/**\n * Decode a UTF8 array to string.\n */\nfunction decodeUTF8(input) {\n return GLOBAL_OBJ.__SENTRY__ && GLOBAL_OBJ.__SENTRY__.decodePolyfill\n ? GLOBAL_OBJ.__SENTRY__.decodePolyfill(input)\n : new TextDecoder().decode(input);\n}\n\n/**\n * Serializes an envelope.\n */\nfunction serializeEnvelope(envelope) {\n const [envHeaders, items] = envelope;\n\n // Initially we construct our envelope as a string and only convert to binary chunks if we encounter binary data\n let parts = JSON.stringify(envHeaders);\n\n function append(next) {\n if (typeof parts === 'string') {\n parts = typeof next === 'string' ? parts + next : [encodeUTF8(parts), next];\n } else {\n parts.push(typeof next === 'string' ? encodeUTF8(next) : next);\n }\n }\n\n for (const item of items) {\n const [itemHeaders, payload] = item;\n\n append(`\\n${JSON.stringify(itemHeaders)}\\n`);\n\n if (typeof payload === 'string' || payload instanceof Uint8Array) {\n append(payload);\n } else {\n let stringifiedPayload;\n try {\n stringifiedPayload = JSON.stringify(payload);\n } catch (e) {\n // In case, despite all our efforts to keep `payload` circular-dependency-free, `JSON.strinify()` still\n // fails, we try again after normalizing it again with infinite normalization depth. This of course has a\n // performance impact but in this case a performance hit is better than throwing.\n stringifiedPayload = JSON.stringify(normalize(payload));\n }\n append(stringifiedPayload);\n }\n }\n\n return typeof parts === 'string' ? parts : concatBuffers(parts);\n}\n\nfunction concatBuffers(buffers) {\n const totalLength = buffers.reduce((acc, buf) => acc + buf.length, 0);\n\n const merged = new Uint8Array(totalLength);\n let offset = 0;\n for (const buffer of buffers) {\n merged.set(buffer, offset);\n offset += buffer.length;\n }\n\n return merged;\n}\n\n/**\n * Parses an envelope\n */\nfunction parseEnvelope(env) {\n let buffer = typeof env === 'string' ? encodeUTF8(env) : env;\n\n function readBinary(length) {\n const bin = buffer.subarray(0, length);\n // Replace the buffer with the remaining data excluding trailing newline\n buffer = buffer.subarray(length + 1);\n return bin;\n }\n\n function readJson() {\n let i = buffer.indexOf(0xa);\n // If we couldn't find a newline, we must have found the end of the buffer\n if (i < 0) {\n i = buffer.length;\n }\n\n return JSON.parse(decodeUTF8(readBinary(i))) ;\n }\n\n const envelopeHeader = readJson();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const items = [];\n\n while (buffer.length) {\n const itemHeader = readJson();\n const binaryLength = typeof itemHeader.length === 'number' ? itemHeader.length : undefined;\n\n items.push([itemHeader, binaryLength ? readBinary(binaryLength) : readJson()]);\n }\n\n return [envelopeHeader, items];\n}\n\n/**\n * Creates envelope item for a single span\n */\nfunction createSpanEnvelopeItem(spanJson) {\n const spanHeaders = {\n type: 'span',\n };\n\n return [spanHeaders, spanJson];\n}\n\n/**\n * Creates attachment envelope items\n */\nfunction createAttachmentEnvelopeItem(attachment) {\n const buffer = typeof attachment.data === 'string' ? encodeUTF8(attachment.data) : attachment.data;\n\n return [\n dropUndefinedKeys({\n type: 'attachment',\n length: buffer.length,\n filename: attachment.filename,\n content_type: attachment.contentType,\n attachment_type: attachment.attachmentType,\n }),\n buffer,\n ];\n}\n\nconst ITEM_TYPE_TO_DATA_CATEGORY_MAP = {\n session: 'session',\n sessions: 'session',\n attachment: 'attachment',\n transaction: 'transaction',\n event: 'error',\n client_report: 'internal',\n user_report: 'default',\n profile: 'profile',\n profile_chunk: 'profile',\n replay_event: 'replay',\n replay_recording: 'replay',\n check_in: 'monitor',\n feedback: 'feedback',\n span: 'span',\n statsd: 'metric_bucket',\n};\n\n/**\n * Maps the type of an envelope item to a data category.\n */\nfunction envelopeItemTypeToDataCategory(type) {\n return ITEM_TYPE_TO_DATA_CATEGORY_MAP[type];\n}\n\n/** Extracts the minimal SDK info from the metadata or an events */\nfunction getSdkMetadataForEnvelopeHeader(metadataOrEvent) {\n if (!metadataOrEvent || !metadataOrEvent.sdk) {\n return;\n }\n const { name, version } = metadataOrEvent.sdk;\n return { name, version };\n}\n\n/**\n * Creates event envelope headers, based on event, sdk info and tunnel\n * Note: This function was extracted from the core package to make it available in Replay\n */\nfunction createEventEnvelopeHeaders(\n event,\n sdkInfo,\n tunnel,\n dsn,\n) {\n const dynamicSamplingContext = event.sdkProcessingMetadata && event.sdkProcessingMetadata.dynamicSamplingContext;\n return {\n event_id: event.event_id ,\n sent_at: new Date().toISOString(),\n ...(sdkInfo && { sdk: sdkInfo }),\n ...(!!tunnel && dsn && { dsn: dsnToString(dsn) }),\n ...(dynamicSamplingContext && {\n trace: dropUndefinedKeys({ ...dynamicSamplingContext }),\n }),\n };\n}\n\nexport { addItemToEnvelope, createAttachmentEnvelopeItem, createEnvelope, createEventEnvelopeHeaders, createSpanEnvelopeItem, envelopeContainsItemType, envelopeItemTypeToDataCategory, forEachEnvelopeItem, getSdkMetadataForEnvelopeHeader, parseEnvelope, serializeEnvelope };\n","/** An error emitted by Sentry SDKs and related utilities. */\nclass SentryError extends Error {\n /** Display name of this error instance. */\n\n constructor( message, logLevel = 'warn') {\n super(message);this.message = message;\n this.name = new.target.prototype.constructor.name;\n // This sets the prototype to be `Error`, not `SentryError`. It's unclear why we do this, but commenting this line\n // out causes various (seemingly totally unrelated) playwright tests consistently time out. FYI, this makes\n // instances of `SentryError` fail `obj instanceof SentryError` checks.\n Object.setPrototypeOf(this, new.target.prototype);\n this.logLevel = logLevel;\n }\n}\n\nexport { SentryError };\n","import { makeDsn, logger, uuid4, checkOrSetAlreadyCaught, isParameterizedString, isPrimitive, resolvedSyncPromise, addItemToEnvelope, createAttachmentEnvelopeItem, SyncPromise, dropUndefinedKeys, rejectedSyncPromise, SentryError, isThenable, isPlainObject } from '@sentry/utils';\nimport { getEnvelopeEndpointWithUrlEncodedAuth } from './api.js';\nimport { getIsolationScope } from './currentScopes.js';\nimport { DEBUG_BUILD } from './debug-build.js';\nimport { createEventEnvelope, createSessionEnvelope } from './envelope.js';\nimport { setupIntegration, afterSetupIntegrations, setupIntegrations } from './integration.js';\nimport { updateSession } from './session.js';\nimport { getDynamicSamplingContextFromClient } from './tracing/dynamicSamplingContext.js';\nimport { parseSampleRate } from './utils/parseSampleRate.js';\nimport { prepareEvent } from './utils/prepareEvent.js';\n\nconst ALREADY_SEEN_ERROR = \"Not capturing exception because it's already been captured.\";\n\n/**\n * Base implementation for all JavaScript SDK clients.\n *\n * Call the constructor with the corresponding options\n * specific to the client subclass. To access these options later, use\n * {@link Client.getOptions}.\n *\n * If a Dsn is specified in the options, it will be parsed and stored. Use\n * {@link Client.getDsn} to retrieve the Dsn at any moment. In case the Dsn is\n * invalid, the constructor will throw a {@link SentryException}. Note that\n * without a valid Dsn, the SDK will not send any events to Sentry.\n *\n * Before sending an event, it is passed through\n * {@link BaseClient._prepareEvent} to add SDK information and scope data\n * (breadcrumbs and context). To add more custom information, override this\n * method and extend the resulting prepared event.\n *\n * To issue automatically created events (e.g. via instrumentation), use\n * {@link Client.captureEvent}. It will prepare the event and pass it through\n * the callback lifecycle. To issue auto-breadcrumbs, use\n * {@link Client.addBreadcrumb}.\n *\n * @example\n * class NodeClient extends BaseClient {\n * public constructor(options: NodeOptions) {\n * super(options);\n * }\n *\n * // ...\n * }\n */\nclass BaseClient {\n /** Options passed to the SDK. */\n\n /** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */\n\n /** Array of set up integrations. */\n\n /** Number of calls being processed */\n\n /** Holds flushable */\n\n // eslint-disable-next-line @typescript-eslint/ban-types\n\n /**\n * Initializes this client instance.\n *\n * @param options Options for the client.\n */\n constructor(options) {\n this._options = options;\n this._integrations = {};\n this._numProcessing = 0;\n this._outcomes = {};\n this._hooks = {};\n this._eventProcessors = [];\n\n if (options.dsn) {\n this._dsn = makeDsn(options.dsn);\n } else {\n DEBUG_BUILD && logger.warn('No DSN provided, client will not send events.');\n }\n\n if (this._dsn) {\n const url = getEnvelopeEndpointWithUrlEncodedAuth(\n this._dsn,\n options.tunnel,\n options._metadata ? options._metadata.sdk : undefined,\n );\n this._transport = options.transport({\n tunnel: this._options.tunnel,\n recordDroppedEvent: this.recordDroppedEvent.bind(this),\n ...options.transportOptions,\n url,\n });\n }\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n captureException(exception, hint, scope) {\n const eventId = uuid4();\n\n // ensure we haven't captured this very object before\n if (checkOrSetAlreadyCaught(exception)) {\n DEBUG_BUILD && logger.log(ALREADY_SEEN_ERROR);\n return eventId;\n }\n\n const hintWithEventId = {\n event_id: eventId,\n ...hint,\n };\n\n this._process(\n this.eventFromException(exception, hintWithEventId).then(event =>\n this._captureEvent(event, hintWithEventId, scope),\n ),\n );\n\n return hintWithEventId.event_id;\n }\n\n /**\n * @inheritDoc\n */\n captureMessage(\n message,\n level,\n hint,\n currentScope,\n ) {\n const hintWithEventId = {\n event_id: uuid4(),\n ...hint,\n };\n\n const eventMessage = isParameterizedString(message) ? message : String(message);\n\n const promisedEvent = isPrimitive(message)\n ? this.eventFromMessage(eventMessage, level, hintWithEventId)\n : this.eventFromException(message, hintWithEventId);\n\n this._process(promisedEvent.then(event => this._captureEvent(event, hintWithEventId, currentScope)));\n\n return hintWithEventId.event_id;\n }\n\n /**\n * @inheritDoc\n */\n captureEvent(event, hint, currentScope) {\n const eventId = uuid4();\n\n // ensure we haven't captured this very object before\n if (hint && hint.originalException && checkOrSetAlreadyCaught(hint.originalException)) {\n DEBUG_BUILD && logger.log(ALREADY_SEEN_ERROR);\n return eventId;\n }\n\n const hintWithEventId = {\n event_id: eventId,\n ...hint,\n };\n\n const sdkProcessingMetadata = event.sdkProcessingMetadata || {};\n const capturedSpanScope = sdkProcessingMetadata.capturedSpanScope;\n\n this._process(this._captureEvent(event, hintWithEventId, capturedSpanScope || currentScope));\n\n return hintWithEventId.event_id;\n }\n\n /**\n * @inheritDoc\n */\n captureSession(session) {\n if (!(typeof session.release === 'string')) {\n DEBUG_BUILD && logger.warn('Discarded session because of missing or non-string release');\n } else {\n this.sendSession(session);\n // After sending, we set init false to indicate it's not the first occurrence\n updateSession(session, { init: false });\n }\n }\n\n /**\n * @inheritDoc\n */\n getDsn() {\n return this._dsn;\n }\n\n /**\n * @inheritDoc\n */\n getOptions() {\n return this._options;\n }\n\n /**\n * @see SdkMetadata in @sentry/types\n *\n * @return The metadata of the SDK\n */\n getSdkMetadata() {\n return this._options._metadata;\n }\n\n /**\n * @inheritDoc\n */\n getTransport() {\n return this._transport;\n }\n\n /**\n * @inheritDoc\n */\n flush(timeout) {\n const transport = this._transport;\n if (transport) {\n this.emit('flush');\n return this._isClientDoneProcessing(timeout).then(clientFinished => {\n return transport.flush(timeout).then(transportFlushed => clientFinished && transportFlushed);\n });\n } else {\n return resolvedSyncPromise(true);\n }\n }\n\n /**\n * @inheritDoc\n */\n close(timeout) {\n return this.flush(timeout).then(result => {\n this.getOptions().enabled = false;\n this.emit('close');\n return result;\n });\n }\n\n /** Get all installed event processors. */\n getEventProcessors() {\n return this._eventProcessors;\n }\n\n /** @inheritDoc */\n addEventProcessor(eventProcessor) {\n this._eventProcessors.push(eventProcessor);\n }\n\n /** @inheritdoc */\n init() {\n if (this._isEnabled()) {\n this._setupIntegrations();\n }\n }\n\n /**\n * Gets an installed integration by its name.\n *\n * @returns The installed integration or `undefined` if no integration with that `name` was installed.\n */\n getIntegrationByName(integrationName) {\n return this._integrations[integrationName] ;\n }\n\n /**\n * @inheritDoc\n */\n addIntegration(integration) {\n const isAlreadyInstalled = this._integrations[integration.name];\n\n // This hook takes care of only installing if not already installed\n setupIntegration(this, integration, this._integrations);\n // Here we need to check manually to make sure to not run this multiple times\n if (!isAlreadyInstalled) {\n afterSetupIntegrations(this, [integration]);\n }\n }\n\n /**\n * @inheritDoc\n */\n sendEvent(event, hint = {}) {\n this.emit('beforeSendEvent', event, hint);\n\n let env = createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel);\n\n for (const attachment of hint.attachments || []) {\n env = addItemToEnvelope(env, createAttachmentEnvelopeItem(attachment));\n }\n\n const promise = this.sendEnvelope(env);\n if (promise) {\n promise.then(sendResponse => this.emit('afterSendEvent', event, sendResponse), null);\n }\n }\n\n /**\n * @inheritDoc\n */\n sendSession(session) {\n const env = createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel);\n\n // sendEnvelope should not throw\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.sendEnvelope(env);\n }\n\n /**\n * @inheritDoc\n */\n recordDroppedEvent(reason, category, _event) {\n // Note: we use `event` in replay, where we overwrite this hook.\n\n if (this._options.sendClientReports) {\n // We want to track each category (error, transaction, session, replay_event) separately\n // but still keep the distinction between different type of outcomes.\n // We could use nested maps, but it's much easier to read and type this way.\n // A correct type for map-based implementation if we want to go that route\n // would be `Partial>>>`\n // With typescript 4.1 we could even use template literal types\n const key = `${reason}:${category}`;\n DEBUG_BUILD && logger.log(`Adding outcome: \"${key}\"`);\n\n this._outcomes[key] = (this._outcomes[key] || 0) + 1;\n }\n }\n\n // Keep on() & emit() signatures in sync with types' client.ts interface\n /* eslint-disable @typescript-eslint/unified-signatures */\n\n /** @inheritdoc */\n\n /** @inheritdoc */\n on(hook, callback) {\n // Note that the code below, with nullish coalescing assignment,\n // may reduce the code, so it may be switched to when Node 14 support\n // is dropped (the `??=` operator is supported since Node 15).\n // (this._hooks[hook] ??= []).push(callback);\n if (!this._hooks[hook]) {\n this._hooks[hook] = [];\n }\n\n // @ts-expect-error We assue the types are correct\n this._hooks[hook].push(callback);\n\n // This function returns a callback execution handler that, when invoked,\n // deregisters a callback. This is crucial for managing instances where callbacks\n // need to be unregistered to prevent self-referencing in callback closures,\n // ensuring proper garbage collection.\n return () => {\n const hooks = this._hooks[hook];\n\n if (hooks) {\n // @ts-expect-error We assue the types are correct\n const cbIndex = hooks.indexOf(callback);\n hooks.splice(cbIndex, 1);\n }\n };\n }\n\n /** @inheritdoc */\n\n /** @inheritdoc */\n emit(hook, ...rest) {\n const callbacks = this._hooks[hook];\n if (callbacks) {\n callbacks.forEach(callback => callback(...rest));\n }\n }\n\n /**\n * @inheritdoc\n */\n sendEnvelope(envelope) {\n this.emit('beforeEnvelope', envelope);\n\n if (this._isEnabled() && this._transport) {\n return this._transport.send(envelope).then(null, reason => {\n DEBUG_BUILD && logger.error('Error while sending event:', reason);\n return reason;\n });\n }\n\n DEBUG_BUILD && logger.error('Transport disabled');\n\n return resolvedSyncPromise({});\n }\n\n /* eslint-enable @typescript-eslint/unified-signatures */\n\n /** Setup integrations for this client. */\n _setupIntegrations() {\n const { integrations } = this._options;\n this._integrations = setupIntegrations(this, integrations);\n afterSetupIntegrations(this, integrations);\n }\n\n /** Updates existing session based on the provided event */\n _updateSessionFromEvent(session, event) {\n let crashed = false;\n let errored = false;\n const exceptions = event.exception && event.exception.values;\n\n if (exceptions) {\n errored = true;\n\n for (const ex of exceptions) {\n const mechanism = ex.mechanism;\n if (mechanism && mechanism.handled === false) {\n crashed = true;\n break;\n }\n }\n }\n\n // A session is updated and that session update is sent in only one of the two following scenarios:\n // 1. Session with non terminal status and 0 errors + an error occurred -> Will set error count to 1 and send update\n // 2. Session with non terminal status and 1 error + a crash occurred -> Will set status crashed and send update\n const sessionNonTerminal = session.status === 'ok';\n const shouldUpdateAndSend = (sessionNonTerminal && session.errors === 0) || (sessionNonTerminal && crashed);\n\n if (shouldUpdateAndSend) {\n updateSession(session, {\n ...(crashed && { status: 'crashed' }),\n errors: session.errors || Number(errored || crashed),\n });\n this.captureSession(session);\n }\n }\n\n /**\n * Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying\n * \"no\" (resolving to `false`) in order to give the client a chance to potentially finish first.\n *\n * @param timeout The time, in ms, after which to resolve to `false` if the client is still busy. Passing `0` (or not\n * passing anything) will make the promise wait as long as it takes for processing to finish before resolving to\n * `true`.\n * @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and\n * `false` otherwise\n */\n _isClientDoneProcessing(timeout) {\n return new SyncPromise(resolve => {\n let ticked = 0;\n const tick = 1;\n\n const interval = setInterval(() => {\n if (this._numProcessing == 0) {\n clearInterval(interval);\n resolve(true);\n } else {\n ticked += tick;\n if (timeout && ticked >= timeout) {\n clearInterval(interval);\n resolve(false);\n }\n }\n }, tick);\n });\n }\n\n /** Determines whether this SDK is enabled and a transport is present. */\n _isEnabled() {\n return this.getOptions().enabled !== false && this._transport !== undefined;\n }\n\n /**\n * Adds common information to events.\n *\n * The information includes release and environment from `options`,\n * breadcrumbs and context (extra, tags and user) from the scope.\n *\n * Information that is already present in the event is never overwritten. For\n * nested objects, such as the context, keys are merged.\n *\n * @param event The original event.\n * @param hint May contain additional information about the original exception.\n * @param currentScope A scope containing event metadata.\n * @returns A new event with more information.\n */\n _prepareEvent(\n event,\n hint,\n currentScope,\n isolationScope = getIsolationScope(),\n ) {\n const options = this.getOptions();\n const integrations = Object.keys(this._integrations);\n if (!hint.integrations && integrations.length > 0) {\n hint.integrations = integrations;\n }\n\n this.emit('preprocessEvent', event, hint);\n\n if (!event.type) {\n isolationScope.setLastEventId(event.event_id || hint.event_id);\n }\n\n return prepareEvent(options, event, hint, currentScope, this, isolationScope).then(evt => {\n if (evt === null) {\n return evt;\n }\n\n const propagationContext = {\n ...isolationScope.getPropagationContext(),\n ...(currentScope ? currentScope.getPropagationContext() : undefined),\n };\n\n const trace = evt.contexts && evt.contexts.trace;\n if (!trace && propagationContext) {\n const { traceId: trace_id, spanId, parentSpanId, dsc } = propagationContext;\n evt.contexts = {\n trace: dropUndefinedKeys({\n trace_id,\n span_id: spanId,\n parent_span_id: parentSpanId,\n }),\n ...evt.contexts,\n };\n\n const dynamicSamplingContext = dsc ? dsc : getDynamicSamplingContextFromClient(trace_id, this);\n\n evt.sdkProcessingMetadata = {\n dynamicSamplingContext,\n ...evt.sdkProcessingMetadata,\n };\n }\n return evt;\n });\n }\n\n /**\n * Processes the event and logs an error in case of rejection\n * @param event\n * @param hint\n * @param scope\n */\n _captureEvent(event, hint = {}, scope) {\n return this._processEvent(event, hint, scope).then(\n finalEvent => {\n return finalEvent.event_id;\n },\n reason => {\n if (DEBUG_BUILD) {\n // If something's gone wrong, log the error as a warning. If it's just us having used a `SentryError` for\n // control flow, log just the message (no stack) as a log-level log.\n const sentryError = reason ;\n if (sentryError.logLevel === 'log') {\n logger.log(sentryError.message);\n } else {\n logger.warn(sentryError);\n }\n }\n return undefined;\n },\n );\n }\n\n /**\n * Processes an event (either error or message) and sends it to Sentry.\n *\n * This also adds breadcrumbs and context information to the event. However,\n * platform specific meta data (such as the User's IP address) must be added\n * by the SDK implementor.\n *\n *\n * @param event The event to send to Sentry.\n * @param hint May contain additional information about the original exception.\n * @param currentScope A scope containing event metadata.\n * @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.\n */\n _processEvent(event, hint, currentScope) {\n const options = this.getOptions();\n const { sampleRate } = options;\n\n const isTransaction = isTransactionEvent(event);\n const isError = isErrorEvent(event);\n const eventType = event.type || 'error';\n const beforeSendLabel = `before send for type \\`${eventType}\\``;\n\n // 1.0 === 100% events are sent\n // 0.0 === 0% events are sent\n // Sampling for transaction happens somewhere else\n const parsedSampleRate = typeof sampleRate === 'undefined' ? undefined : parseSampleRate(sampleRate);\n if (isError && typeof parsedSampleRate === 'number' && Math.random() > parsedSampleRate) {\n this.recordDroppedEvent('sample_rate', 'error', event);\n return rejectedSyncPromise(\n new SentryError(\n `Discarding event because it's not included in the random sample (sampling rate = ${sampleRate})`,\n 'log',\n ),\n );\n }\n\n const dataCategory = eventType === 'replay_event' ? 'replay' : eventType;\n\n const sdkProcessingMetadata = event.sdkProcessingMetadata || {};\n const capturedSpanIsolationScope = sdkProcessingMetadata.capturedSpanIsolationScope;\n\n return this._prepareEvent(event, hint, currentScope, capturedSpanIsolationScope)\n .then(prepared => {\n if (prepared === null) {\n this.recordDroppedEvent('event_processor', dataCategory, event);\n throw new SentryError('An event processor returned `null`, will not send event.', 'log');\n }\n\n const isInternalException = hint.data && (hint.data ).__sentry__ === true;\n if (isInternalException) {\n return prepared;\n }\n\n const result = processBeforeSend(this, options, prepared, hint);\n return _validateBeforeSendResult(result, beforeSendLabel);\n })\n .then(processedEvent => {\n if (processedEvent === null) {\n this.recordDroppedEvent('before_send', dataCategory, event);\n if (isTransactionEvent(event)) {\n const spans = event.spans || [];\n // the transaction itself counts as one span, plus all the child spans that are added\n const spanCount = 1 + spans.length;\n this._outcomes['span'] = (this._outcomes['span'] || 0) + spanCount;\n }\n throw new SentryError(`${beforeSendLabel} returned \\`null\\`, will not send event.`, 'log');\n }\n\n const session = currentScope && currentScope.getSession();\n if (!isTransaction && session) {\n this._updateSessionFromEvent(session, processedEvent);\n }\n\n // None of the Sentry built event processor will update transaction name,\n // so if the transaction name has been changed by an event processor, we know\n // it has to come from custom event processor added by a user\n const transactionInfo = processedEvent.transaction_info;\n if (isTransaction && transactionInfo && processedEvent.transaction !== event.transaction) {\n const source = 'custom';\n processedEvent.transaction_info = {\n ...transactionInfo,\n source,\n };\n }\n\n this.sendEvent(processedEvent, hint);\n return processedEvent;\n })\n .then(null, reason => {\n if (reason instanceof SentryError) {\n throw reason;\n }\n\n this.captureException(reason, {\n data: {\n __sentry__: true,\n },\n originalException: reason,\n });\n throw new SentryError(\n `Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\\nReason: ${reason}`,\n );\n });\n }\n\n /**\n * Occupies the client with processing and event\n */\n _process(promise) {\n this._numProcessing++;\n void promise.then(\n value => {\n this._numProcessing--;\n return value;\n },\n reason => {\n this._numProcessing--;\n return reason;\n },\n );\n }\n\n /**\n * Clears outcomes on this client and returns them.\n */\n _clearOutcomes() {\n const outcomes = this._outcomes;\n this._outcomes = {};\n return Object.entries(outcomes).map(([key, quantity]) => {\n const [reason, category] = key.split(':') ;\n return {\n reason,\n category,\n quantity,\n };\n });\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n\n}\n\n/**\n * Verifies that return value of configured `beforeSend` or `beforeSendTransaction` is of expected type, and returns the value if so.\n */\nfunction _validateBeforeSendResult(\n beforeSendResult,\n beforeSendLabel,\n) {\n const invalidValueError = `${beforeSendLabel} must return \\`null\\` or a valid event.`;\n if (isThenable(beforeSendResult)) {\n return beforeSendResult.then(\n event => {\n if (!isPlainObject(event) && event !== null) {\n throw new SentryError(invalidValueError);\n }\n return event;\n },\n e => {\n throw new SentryError(`${beforeSendLabel} rejected with ${e}`);\n },\n );\n } else if (!isPlainObject(beforeSendResult) && beforeSendResult !== null) {\n throw new SentryError(invalidValueError);\n }\n return beforeSendResult;\n}\n\n/**\n * Process the matching `beforeSendXXX` callback.\n */\nfunction processBeforeSend(\n client,\n options,\n event,\n hint,\n) {\n const { beforeSend, beforeSendTransaction, beforeSendSpan } = options;\n\n if (isErrorEvent(event) && beforeSend) {\n return beforeSend(event, hint);\n }\n\n if (isTransactionEvent(event)) {\n if (event.spans && beforeSendSpan) {\n const processedSpans = [];\n for (const span of event.spans) {\n const processedSpan = beforeSendSpan(span);\n if (processedSpan) {\n processedSpans.push(processedSpan);\n } else {\n client.recordDroppedEvent('before_send', 'span');\n }\n }\n event.spans = processedSpans;\n }\n\n if (beforeSendTransaction) {\n return beforeSendTransaction(event, hint);\n }\n }\n\n return event;\n}\n\nfunction isErrorEvent(event) {\n return event.type === undefined;\n}\n\nfunction isTransactionEvent(event) {\n return event.type === 'transaction';\n}\n\nexport { BaseClient };\n","import { getSdkMetadataForEnvelopeHeader, dsnToString, createEnvelope, createEventEnvelopeHeaders, createSpanEnvelopeItem } from '@sentry/utils';\nimport { getDynamicSamplingContextFromSpan } from './tracing/dynamicSamplingContext.js';\nimport { spanToJSON } from './utils/spanUtils.js';\n\n/**\n * Apply SdkInfo (name, version, packages, integrations) to the corresponding event key.\n * Merge with existing data if any.\n **/\nfunction enhanceEventWithSdkInfo(event, sdkInfo) {\n if (!sdkInfo) {\n return event;\n }\n event.sdk = event.sdk || {};\n event.sdk.name = event.sdk.name || sdkInfo.name;\n event.sdk.version = event.sdk.version || sdkInfo.version;\n event.sdk.integrations = [...(event.sdk.integrations || []), ...(sdkInfo.integrations || [])];\n event.sdk.packages = [...(event.sdk.packages || []), ...(sdkInfo.packages || [])];\n return event;\n}\n\n/** Creates an envelope from a Session */\nfunction createSessionEnvelope(\n session,\n dsn,\n metadata,\n tunnel,\n) {\n const sdkInfo = getSdkMetadataForEnvelopeHeader(metadata);\n const envelopeHeaders = {\n sent_at: new Date().toISOString(),\n ...(sdkInfo && { sdk: sdkInfo }),\n ...(!!tunnel && dsn && { dsn: dsnToString(dsn) }),\n };\n\n const envelopeItem =\n 'aggregates' in session ? [{ type: 'sessions' }, session] : [{ type: 'session' }, session.toJSON()];\n\n return createEnvelope(envelopeHeaders, [envelopeItem]);\n}\n\n/**\n * Create an Envelope from an event.\n */\nfunction createEventEnvelope(\n event,\n dsn,\n metadata,\n tunnel,\n) {\n const sdkInfo = getSdkMetadataForEnvelopeHeader(metadata);\n\n /*\n Note: Due to TS, event.type may be `replay_event`, theoretically.\n In practice, we never call `createEventEnvelope` with `replay_event` type,\n and we'd have to adjut a looot of types to make this work properly.\n We want to avoid casting this around, as that could lead to bugs (e.g. when we add another type)\n So the safe choice is to really guard against the replay_event type here.\n */\n const eventType = event.type && event.type !== 'replay_event' ? event.type : 'event';\n\n enhanceEventWithSdkInfo(event, metadata && metadata.sdk);\n\n const envelopeHeaders = createEventEnvelopeHeaders(event, sdkInfo, tunnel, dsn);\n\n // Prevent this data (which, if it exists, was used in earlier steps in the processing pipeline) from being sent to\n // sentry. (Note: Our use of this property comes and goes with whatever we might be debugging, whatever hacks we may\n // have temporarily added, etc. Even if we don't happen to be using it at some point in the future, let's not get rid\n // of this `delete`, lest we miss putting it back in the next time the property is in use.)\n delete event.sdkProcessingMetadata;\n\n const eventItem = [{ type: eventType }, event];\n return createEnvelope(envelopeHeaders, [eventItem]);\n}\n\n/**\n * Create envelope from Span item.\n *\n * Takes an optional client and runs spans through `beforeSendSpan` if available.\n */\nfunction createSpanEnvelope(spans, client) {\n function dscHasRequiredProps(dsc) {\n return !!dsc.trace_id && !!dsc.public_key;\n }\n\n // For the moment we'll obtain the DSC from the first span in the array\n // This might need to be changed if we permit sending multiple spans from\n // different segments in one envelope\n const dsc = getDynamicSamplingContextFromSpan(spans[0]);\n\n const dsn = client && client.getDsn();\n const tunnel = client && client.getOptions().tunnel;\n\n const headers = {\n sent_at: new Date().toISOString(),\n ...(dscHasRequiredProps(dsc) && { trace: dsc }),\n ...(!!tunnel && dsn && { dsn: dsnToString(dsn) }),\n };\n\n const beforeSendSpan = client && client.getOptions().beforeSendSpan;\n const convertToSpanJSON = beforeSendSpan\n ? (span) => beforeSendSpan(spanToJSON(span) )\n : (span) => spanToJSON(span);\n\n const items = [];\n for (const span of spans) {\n const spanJson = convertToSpanJSON(span);\n if (spanJson) {\n items.push(createSpanEnvelopeItem(spanJson));\n }\n }\n\n return createEnvelope(headers, items);\n}\n\nexport { createEventEnvelope, createSessionEnvelope, createSpanEnvelope };\n","import { logger } from '@sentry/utils';\nimport { DEBUG_BUILD } from '../debug-build.js';\n\n/**\n * Parse a sample rate from a given value.\n * This will either return a boolean or number sample rate, if the sample rate is valid (between 0 and 1).\n * If a string is passed, we try to convert it to a number.\n *\n * Any invalid sample rate will return `undefined`.\n */\nfunction parseSampleRate(sampleRate) {\n if (typeof sampleRate === 'boolean') {\n return Number(sampleRate);\n }\n\n const rate = typeof sampleRate === 'string' ? parseFloat(sampleRate) : sampleRate;\n if (typeof rate !== 'number' || isNaN(rate) || rate < 0 || rate > 1) {\n DEBUG_BUILD &&\n logger.warn(\n `[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(\n sampleRate,\n )} of type ${JSON.stringify(typeof sampleRate)}.`,\n );\n return undefined;\n }\n\n return rate;\n}\n\nexport { parseSampleRate };\n","import { SDK_VERSION } from '@sentry/utils';\n\n/**\n * A builder for the SDK metadata in the options for the SDK initialization.\n *\n * Note: This function is identical to `buildMetadata` in Remix and NextJS and SvelteKit.\n * We don't extract it for bundle size reasons.\n * @see https://github.com/getsentry/sentry-javascript/pull/7404\n * @see https://github.com/getsentry/sentry-javascript/pull/4196\n *\n * If you make changes to this function consider updating the others as well.\n *\n * @param options SDK options object that gets mutated\n * @param names list of package names\n */\nfunction applySdkMetadata(options, name, names = [name], source = 'npm') {\n const metadata = options._metadata || {};\n\n if (!metadata.sdk) {\n metadata.sdk = {\n name: `sentry.javascript.${name}`,\n packages: names.map(name => ({\n name: `${source}:@sentry/${name}`,\n version: SDK_VERSION,\n })),\n version: SDK_VERSION,\n };\n }\n\n options._metadata = metadata;\n}\n\nexport { applySdkMetadata };\n","/**\n * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nconst DEBUG_BUILD = (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__);\n\nexport { DEBUG_BUILD };\n","import { getClient } from '@sentry/core';\nimport { addExceptionMechanism, resolvedSyncPromise, isErrorEvent, isDOMError, isDOMException, addExceptionTypeValue, isError, isPlainObject, isEvent, isParameterizedString, normalizeToSize, extractExceptionKeysForMessage } from '@sentry/utils';\n\n/**\n * This function creates an exception from a JavaScript Error\n */\nfunction exceptionFromError(stackParser, ex) {\n // Get the frames first since Opera can lose the stack if we touch anything else first\n const frames = parseStackFrames(stackParser, ex);\n\n const exception = {\n type: ex && ex.name,\n value: extractMessage(ex),\n };\n\n if (frames.length) {\n exception.stacktrace = { frames };\n }\n\n if (exception.type === undefined && exception.value === '') {\n exception.value = 'Unrecoverable error caught';\n }\n\n return exception;\n}\n\nfunction eventFromPlainObject(\n stackParser,\n exception,\n syntheticException,\n isUnhandledRejection,\n) {\n const client = getClient();\n const normalizeDepth = client && client.getOptions().normalizeDepth;\n\n // If we can, we extract an exception from the object properties\n const errorFromProp = getErrorPropertyFromObject(exception);\n\n const extra = {\n __serialized__: normalizeToSize(exception, normalizeDepth),\n };\n\n if (errorFromProp) {\n return {\n exception: {\n values: [exceptionFromError(stackParser, errorFromProp)],\n },\n extra,\n };\n }\n\n const event = {\n exception: {\n values: [\n {\n type: isEvent(exception) ? exception.constructor.name : isUnhandledRejection ? 'UnhandledRejection' : 'Error',\n value: getNonErrorObjectExceptionValue(exception, { isUnhandledRejection }),\n } ,\n ],\n },\n extra,\n } ;\n\n if (syntheticException) {\n const frames = parseStackFrames(stackParser, syntheticException);\n if (frames.length) {\n // event.exception.values[0] has been set above\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n event.exception.values[0].stacktrace = { frames };\n }\n }\n\n return event;\n}\n\nfunction eventFromError(stackParser, ex) {\n return {\n exception: {\n values: [exceptionFromError(stackParser, ex)],\n },\n };\n}\n\n/** Parses stack frames from an error */\nfunction parseStackFrames(\n stackParser,\n ex,\n) {\n // Access and store the stacktrace property before doing ANYTHING\n // else to it because Opera is not very good at providing it\n // reliably in other circumstances.\n const stacktrace = ex.stacktrace || ex.stack || '';\n\n const skipLines = getSkipFirstStackStringLines(ex);\n const framesToPop = getPopFirstTopFrames(ex);\n\n try {\n return stackParser(stacktrace, skipLines, framesToPop);\n } catch (e) {\n // no-empty\n }\n\n return [];\n}\n\n// Based on our own mapping pattern - https://github.com/getsentry/sentry/blob/9f08305e09866c8bd6d0c24f5b0aabdd7dd6c59c/src/sentry/lang/javascript/errormapping.py#L83-L108\nconst reactMinifiedRegexp = /Minified React error #\\d+;/i;\n\n/**\n * Certain known React errors contain links that would be falsely\n * parsed as frames. This function check for these errors and\n * returns number of the stack string lines to skip.\n */\nfunction getSkipFirstStackStringLines(ex) {\n if (ex && reactMinifiedRegexp.test(ex.message)) {\n return 1;\n }\n\n return 0;\n}\n\n/**\n * If error has `framesToPop` property, it means that the\n * creator tells us the first x frames will be useless\n * and should be discarded. Typically error from wrapper function\n * which don't point to the actual location in the developer's code.\n *\n * Example: https://github.com/zertosh/invariant/blob/master/invariant.js#L46\n */\nfunction getPopFirstTopFrames(ex) {\n if (typeof ex.framesToPop === 'number') {\n return ex.framesToPop;\n }\n\n return 0;\n}\n\n/**\n * There are cases where stacktrace.message is an Event object\n * https://github.com/getsentry/sentry-javascript/issues/1949\n * In this specific case we try to extract stacktrace.message.error.message\n */\nfunction extractMessage(ex) {\n const message = ex && ex.message;\n if (!message) {\n return 'No error message';\n }\n if (message.error && typeof message.error.message === 'string') {\n return message.error.message;\n }\n return message;\n}\n\n/**\n * Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.\n * @hidden\n */\nfunction eventFromException(\n stackParser,\n exception,\n hint,\n attachStacktrace,\n) {\n const syntheticException = (hint && hint.syntheticException) || undefined;\n const event = eventFromUnknownInput(stackParser, exception, syntheticException, attachStacktrace);\n addExceptionMechanism(event); // defaults to { type: 'generic', handled: true }\n event.level = 'error';\n if (hint && hint.event_id) {\n event.event_id = hint.event_id;\n }\n return resolvedSyncPromise(event);\n}\n\n/**\n * Builds and Event from a Message\n * @hidden\n */\nfunction eventFromMessage(\n stackParser,\n message,\n level = 'info',\n hint,\n attachStacktrace,\n) {\n const syntheticException = (hint && hint.syntheticException) || undefined;\n const event = eventFromString(stackParser, message, syntheticException, attachStacktrace);\n event.level = level;\n if (hint && hint.event_id) {\n event.event_id = hint.event_id;\n }\n return resolvedSyncPromise(event);\n}\n\n/**\n * @hidden\n */\nfunction eventFromUnknownInput(\n stackParser,\n exception,\n syntheticException,\n attachStacktrace,\n isUnhandledRejection,\n) {\n let event;\n\n if (isErrorEvent(exception ) && (exception ).error) {\n // If it is an ErrorEvent with `error` property, extract it to get actual Error\n const errorEvent = exception ;\n return eventFromError(stackParser, errorEvent.error );\n }\n\n // If it is a `DOMError` (which is a legacy API, but still supported in some browsers) then we just extract the name\n // and message, as it doesn't provide anything else. According to the spec, all `DOMExceptions` should also be\n // `Error`s, but that's not the case in IE11, so in that case we treat it the same as we do a `DOMError`.\n //\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMError\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMException\n // https://webidl.spec.whatwg.org/#es-DOMException-specialness\n if (isDOMError(exception) || isDOMException(exception )) {\n const domException = exception ;\n\n if ('stack' in (exception )) {\n event = eventFromError(stackParser, exception );\n } else {\n const name = domException.name || (isDOMError(domException) ? 'DOMError' : 'DOMException');\n const message = domException.message ? `${name}: ${domException.message}` : name;\n event = eventFromString(stackParser, message, syntheticException, attachStacktrace);\n addExceptionTypeValue(event, message);\n }\n if ('code' in domException) {\n // eslint-disable-next-line deprecation/deprecation\n event.tags = { ...event.tags, 'DOMException.code': `${domException.code}` };\n }\n\n return event;\n }\n if (isError(exception)) {\n // we have a real Error object, do nothing\n return eventFromError(stackParser, exception);\n }\n if (isPlainObject(exception) || isEvent(exception)) {\n // If it's a plain object or an instance of `Event` (the built-in JS kind, not this SDK's `Event` type), serialize\n // it manually. This will allow us to group events based on top-level keys which is much better than creating a new\n // group on any key/value change.\n const objectException = exception ;\n event = eventFromPlainObject(stackParser, objectException, syntheticException, isUnhandledRejection);\n addExceptionMechanism(event, {\n synthetic: true,\n });\n return event;\n }\n\n // If none of previous checks were valid, then it means that it's not:\n // - an instance of DOMError\n // - an instance of DOMException\n // - an instance of Event\n // - an instance of Error\n // - a valid ErrorEvent (one with an error property)\n // - a plain Object\n //\n // So bail out and capture it as a simple message:\n event = eventFromString(stackParser, exception , syntheticException, attachStacktrace);\n addExceptionTypeValue(event, `${exception}`, undefined);\n addExceptionMechanism(event, {\n synthetic: true,\n });\n\n return event;\n}\n\nfunction eventFromString(\n stackParser,\n message,\n syntheticException,\n attachStacktrace,\n) {\n const event = {};\n\n if (attachStacktrace && syntheticException) {\n const frames = parseStackFrames(stackParser, syntheticException);\n if (frames.length) {\n event.exception = {\n values: [{ value: message, stacktrace: { frames } }],\n };\n }\n }\n\n if (isParameterizedString(message)) {\n const { __sentry_template_string__, __sentry_template_values__ } = message;\n\n event.logentry = {\n message: __sentry_template_string__,\n params: __sentry_template_values__,\n };\n return event;\n }\n\n event.message = message;\n return event;\n}\n\nfunction getNonErrorObjectExceptionValue(\n exception,\n { isUnhandledRejection },\n) {\n const keys = extractExceptionKeysForMessage(exception);\n const captureType = isUnhandledRejection ? 'promise rejection' : 'exception';\n\n // Some ErrorEvent instances do not have an `error` property, which is why they are not handled before\n // We still want to try to get a decent message for these cases\n if (isErrorEvent(exception)) {\n return `Event \\`ErrorEvent\\` captured as ${captureType} with message \\`${exception.message}\\``;\n }\n\n if (isEvent(exception)) {\n const className = getObjectClassName(exception);\n return `Event \\`${className}\\` (type=${exception.type}) captured as ${captureType}`;\n }\n\n return `Object captured as ${captureType} with keys: ${keys}`;\n}\n\nfunction getObjectClassName(obj) {\n try {\n const prototype = Object.getPrototypeOf(obj);\n return prototype ? prototype.constructor.name : undefined;\n } catch (e) {\n // ignore errors here\n }\n}\n\n/** If a plain object has a property that is an `Error`, return this error. */\nfunction getErrorPropertyFromObject(obj) {\n for (const prop in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, prop)) {\n const value = obj[prop];\n if (value instanceof Error) {\n return value;\n }\n }\n }\n\n return undefined;\n}\n\nexport { eventFromException, eventFromMessage, eventFromUnknownInput, exceptionFromError };\n","import { withScope, captureException } from '@sentry/core';\nimport { GLOBAL_OBJ, getOriginalFunction, markFunctionWrapped, addNonEnumerableProperty, addExceptionTypeValue, addExceptionMechanism } from '@sentry/utils';\n\nconst WINDOW = GLOBAL_OBJ ;\n\nlet ignoreOnError = 0;\n\n/**\n * @hidden\n */\nfunction shouldIgnoreOnError() {\n return ignoreOnError > 0;\n}\n\n/**\n * @hidden\n */\nfunction ignoreNextOnError() {\n // onerror should trigger before setTimeout\n ignoreOnError++;\n setTimeout(() => {\n ignoreOnError--;\n });\n}\n\n/**\n * Instruments the given function and sends an event to Sentry every time the\n * function throws an exception.\n *\n * @param fn A function to wrap. It is generally safe to pass an unbound function, because the returned wrapper always\n * has a correct `this` context.\n * @returns The wrapped function.\n * @hidden\n */\nfunction wrap(\n fn,\n options\n\n = {},\n before,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n) {\n // for future readers what this does is wrap a function and then create\n // a bi-directional wrapping between them.\n //\n // example: wrapped = wrap(original);\n // original.__sentry_wrapped__ -> wrapped\n // wrapped.__sentry_original__ -> original\n\n if (typeof fn !== 'function') {\n return fn;\n }\n\n try {\n // if we're dealing with a function that was previously wrapped, return\n // the original wrapper.\n const wrapper = fn.__sentry_wrapped__;\n if (wrapper) {\n return wrapper;\n }\n\n // We don't wanna wrap it twice\n if (getOriginalFunction(fn)) {\n return fn;\n }\n } catch (e) {\n // Just accessing custom props in some Selenium environments\n // can cause a \"Permission denied\" exception (see raven-js#495).\n // Bail on wrapping and return the function as-is (defers to window.onerror).\n return fn;\n }\n\n /* eslint-disable prefer-rest-params */\n // It is important that `sentryWrapped` is not an arrow function to preserve the context of `this`\n const sentryWrapped = function () {\n const args = Array.prototype.slice.call(arguments);\n\n try {\n if (before && typeof before === 'function') {\n before.apply(this, arguments);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n const wrappedArguments = args.map((arg) => wrap(arg, options));\n\n // Attempt to invoke user-land function\n // NOTE: If you are a Sentry user, and you are seeing this stack frame, it\n // means the sentry.javascript SDK caught an error invoking your application code. This\n // is expected behavior and NOT indicative of a bug with sentry.javascript.\n return fn.apply(this, wrappedArguments);\n } catch (ex) {\n ignoreNextOnError();\n\n withScope(scope => {\n scope.addEventProcessor(event => {\n if (options.mechanism) {\n addExceptionTypeValue(event, undefined, undefined);\n addExceptionMechanism(event, options.mechanism);\n }\n\n event.extra = {\n ...event.extra,\n arguments: args,\n };\n\n return event;\n });\n\n captureException(ex);\n });\n\n throw ex;\n }\n };\n /* eslint-enable prefer-rest-params */\n\n // Accessing some objects may throw\n // ref: https://github.com/getsentry/sentry-javascript/issues/1168\n try {\n for (const property in fn) {\n if (Object.prototype.hasOwnProperty.call(fn, property)) {\n sentryWrapped[property] = fn[property];\n }\n }\n } catch (_oO) {} // eslint-disable-line no-empty\n\n // Signal that this function has been wrapped/filled already\n // for both debugging and to prevent it to being wrapped/filled twice\n markFunctionWrapped(sentryWrapped, fn);\n\n addNonEnumerableProperty(fn, '__sentry_wrapped__', sentryWrapped);\n\n // Restore original function name (not all browsers allow that)\n try {\n const descriptor = Object.getOwnPropertyDescriptor(sentryWrapped, 'name') ;\n if (descriptor.configurable) {\n Object.defineProperty(sentryWrapped, 'name', {\n get() {\n return fn.name;\n },\n });\n }\n // eslint-disable-next-line no-empty\n } catch (_oO) {}\n\n return sentryWrapped;\n}\n\nexport { WINDOW, ignoreNextOnError, shouldIgnoreOnError, wrap };\n","import { BaseClient, applySdkMetadata } from '@sentry/core';\nimport { getSDKSource, logger, createClientReportEnvelope, dsnToString } from '@sentry/utils';\nimport { DEBUG_BUILD } from './debug-build.js';\nimport { eventFromException, eventFromMessage } from './eventbuilder.js';\nimport { WINDOW } from './helpers.js';\nimport { createUserFeedbackEnvelope } from './userfeedback.js';\n\n/**\n * Configuration options for the Sentry Browser SDK.\n * @see @sentry/types Options for more information.\n */\n\n/**\n * The Sentry Browser SDK Client.\n *\n * @see BrowserOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nclass BrowserClient extends BaseClient {\n /**\n * Creates a new Browser SDK instance.\n *\n * @param options Configuration options for this SDK.\n */\n constructor(options) {\n const opts = {\n // We default this to true, as it is the safer scenario\n parentSpanIsAlwaysRootSpan: true,\n ...options,\n };\n const sdkSource = WINDOW.SENTRY_SDK_SOURCE || getSDKSource();\n applySdkMetadata(opts, 'browser', ['browser'], sdkSource);\n\n super(opts);\n\n if (opts.sendClientReports && WINDOW.document) {\n WINDOW.document.addEventListener('visibilitychange', () => {\n if (WINDOW.document.visibilityState === 'hidden') {\n this._flushOutcomes();\n }\n });\n }\n }\n\n /**\n * @inheritDoc\n */\n eventFromException(exception, hint) {\n return eventFromException(this._options.stackParser, exception, hint, this._options.attachStacktrace);\n }\n\n /**\n * @inheritDoc\n */\n eventFromMessage(\n message,\n level = 'info',\n hint,\n ) {\n return eventFromMessage(this._options.stackParser, message, level, hint, this._options.attachStacktrace);\n }\n\n /**\n * Sends user feedback to Sentry.\n *\n * @deprecated Use `captureFeedback` instead.\n */\n captureUserFeedback(feedback) {\n if (!this._isEnabled()) {\n DEBUG_BUILD && logger.warn('SDK not enabled, will not capture user feedback.');\n return;\n }\n\n const envelope = createUserFeedbackEnvelope(feedback, {\n metadata: this.getSdkMetadata(),\n dsn: this.getDsn(),\n tunnel: this.getOptions().tunnel,\n });\n\n // sendEnvelope should not throw\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.sendEnvelope(envelope);\n }\n\n /**\n * @inheritDoc\n */\n _prepareEvent(event, hint, scope) {\n event.platform = event.platform || 'javascript';\n return super._prepareEvent(event, hint, scope);\n }\n\n /**\n * Sends client reports as an envelope.\n */\n _flushOutcomes() {\n const outcomes = this._clearOutcomes();\n\n if (outcomes.length === 0) {\n DEBUG_BUILD && logger.log('No outcomes to send');\n return;\n }\n\n // This is really the only place where we want to check for a DSN and only send outcomes then\n if (!this._dsn) {\n DEBUG_BUILD && logger.log('No dsn provided, will not send outcomes');\n return;\n }\n\n DEBUG_BUILD && logger.log('Sending outcomes:', outcomes);\n\n const envelope = createClientReportEnvelope(outcomes, this._options.tunnel && dsnToString(this._dsn));\n\n // sendEnvelope should not throw\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.sendEnvelope(envelope);\n }\n}\n\nexport { BrowserClient };\n","/*\n * This module exists for optimizations in the build process through rollup and terser. We define some global\n * constants, which can be overridden during build. By guarding certain pieces of code with functions that return these\n * constants, we can control whether or not they appear in the final bundle. (Any code guarded by a false condition will\n * never run, and will hence be dropped during treeshaking.) The two primary uses for this are stripping out calls to\n * `logger` and preventing node-related code from appearing in browser bundles.\n *\n * Attention:\n * This file should not be used to define constants/flags that are intended to be used for tree-shaking conducted by\n * users. These flags should live in their respective packages, as we identified user tooling (specifically webpack)\n * having issues tree-shaking these constants across package boundaries.\n * An example for this is the __SENTRY_DEBUG__ constant. It is declared in each package individually because we want\n * users to be able to shake away expressions that it guards.\n */\n\n/**\n * Figures out if we're building a browser bundle.\n *\n * @returns true if this is a browser bundle build.\n */\nfunction isBrowserBundle() {\n return typeof __SENTRY_BROWSER_BUNDLE__ !== 'undefined' && !!__SENTRY_BROWSER_BUNDLE__;\n}\n\n/**\n * Get source of SDK.\n */\nfunction getSDKSource() {\n // @ts-expect-error \"npm\" is injected by rollup during build process\n return \"npm\";\n}\n\nexport { getSDKSource, isBrowserBundle };\n","import { dsnToString, createEnvelope } from '@sentry/utils';\n\n/**\n * Creates an envelope from a user feedback.\n */\nfunction createUserFeedbackEnvelope(\n feedback,\n {\n metadata,\n tunnel,\n dsn,\n }\n\n,\n) {\n const headers = {\n event_id: feedback.event_id,\n sent_at: new Date().toISOString(),\n ...(metadata &&\n metadata.sdk && {\n sdk: {\n name: metadata.sdk.name,\n version: metadata.sdk.version,\n },\n }),\n ...(!!tunnel && !!dsn && { dsn: dsnToString(dsn) }),\n };\n const item = createUserFeedbackEnvelopeItem(feedback);\n\n return createEnvelope(headers, [item]);\n}\n\nfunction createUserFeedbackEnvelopeItem(feedback) {\n const feedbackHeaders = {\n type: 'user_report',\n };\n return [feedbackHeaders, feedback];\n}\n\nexport { createUserFeedbackEnvelope };\n","import { createEnvelope } from './envelope.js';\nimport { dateTimestampInSeconds } from './time.js';\n\n/**\n * Creates client report envelope\n * @param discarded_events An array of discard events\n * @param dsn A DSN that can be set on the header. Optional.\n */\nfunction createClientReportEnvelope(\n discarded_events,\n dsn,\n timestamp,\n) {\n const clientReportItem = [\n { type: 'client_report' },\n {\n timestamp: timestamp || dateTimestampInSeconds(),\n discarded_events,\n },\n ];\n return createEnvelope(dsn ? { dsn } : {}, [clientReportItem]);\n}\n\nexport { createClientReportEnvelope };\n","import { addHandler, maybeInstrument, triggerHandlers, fill, addNonEnumerableProperty, uuid4 } from '@sentry/utils';\nimport { WINDOW } from '../types.js';\n\nconst DEBOUNCE_DURATION = 1000;\n\nlet debounceTimerID;\nlet lastCapturedEventType;\nlet lastCapturedEventTargetId;\n\n/**\n * Add an instrumentation handler for when a click or a keypress happens.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nfunction addClickKeypressInstrumentationHandler(handler) {\n const type = 'dom';\n addHandler(type, handler);\n maybeInstrument(type, instrumentDOM);\n}\n\n/** Exported for tests only. */\nfunction instrumentDOM() {\n if (!WINDOW.document) {\n return;\n }\n\n // Make it so that any click or keypress that is unhandled / bubbled up all the way to the document triggers our dom\n // handlers. (Normally we have only one, which captures a breadcrumb for each click or keypress.) Do this before\n // we instrument `addEventListener` so that we don't end up attaching this handler twice.\n const triggerDOMHandler = triggerHandlers.bind(null, 'dom');\n const globalDOMEventHandler = makeDOMEventHandler(triggerDOMHandler, true);\n WINDOW.document.addEventListener('click', globalDOMEventHandler, false);\n WINDOW.document.addEventListener('keypress', globalDOMEventHandler, false);\n\n // After hooking into click and keypress events bubbled up to `document`, we also hook into user-handled\n // clicks & keypresses, by adding an event listener of our own to any element to which they add a listener. That\n // way, whenever one of their handlers is triggered, ours will be, too. (This is needed because their handler\n // could potentially prevent the event from bubbling up to our global listeners. This way, our handler are still\n // guaranteed to fire at least once.)\n ['EventTarget', 'Node'].forEach((target) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n const proto = (WINDOW )[target] && (WINDOW )[target].prototype;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, no-prototype-builtins\n if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty('addEventListener')) {\n return;\n }\n\n fill(proto, 'addEventListener', function (originalAddEventListener) {\n return function (\n\n type,\n listener,\n options,\n ) {\n if (type === 'click' || type == 'keypress') {\n try {\n const el = this ;\n const handlers = (el.__sentry_instrumentation_handlers__ = el.__sentry_instrumentation_handlers__ || {});\n const handlerForType = (handlers[type] = handlers[type] || { refCount: 0 });\n\n if (!handlerForType.handler) {\n const handler = makeDOMEventHandler(triggerDOMHandler);\n handlerForType.handler = handler;\n originalAddEventListener.call(this, type, handler, options);\n }\n\n handlerForType.refCount++;\n } catch (e) {\n // Accessing dom properties is always fragile.\n // Also allows us to skip `addEventListenrs` calls with no proper `this` context.\n }\n }\n\n return originalAddEventListener.call(this, type, listener, options);\n };\n });\n\n fill(\n proto,\n 'removeEventListener',\n function (originalRemoveEventListener) {\n return function (\n\n type,\n listener,\n options,\n ) {\n if (type === 'click' || type == 'keypress') {\n try {\n const el = this ;\n const handlers = el.__sentry_instrumentation_handlers__ || {};\n const handlerForType = handlers[type];\n\n if (handlerForType) {\n handlerForType.refCount--;\n // If there are no longer any custom handlers of the current type on this element, we can remove ours, too.\n if (handlerForType.refCount <= 0) {\n originalRemoveEventListener.call(this, type, handlerForType.handler, options);\n handlerForType.handler = undefined;\n delete handlers[type]; // eslint-disable-line @typescript-eslint/no-dynamic-delete\n }\n\n // If there are no longer any custom handlers of any type on this element, cleanup everything.\n if (Object.keys(handlers).length === 0) {\n delete el.__sentry_instrumentation_handlers__;\n }\n }\n } catch (e) {\n // Accessing dom properties is always fragile.\n // Also allows us to skip `addEventListenrs` calls with no proper `this` context.\n }\n }\n\n return originalRemoveEventListener.call(this, type, listener, options);\n };\n },\n );\n });\n}\n\n/**\n * Check whether the event is similar to the last captured one. For example, two click events on the same button.\n */\nfunction isSimilarToLastCapturedEvent(event) {\n // If both events have different type, then user definitely performed two separate actions. e.g. click + keypress.\n if (event.type !== lastCapturedEventType) {\n return false;\n }\n\n try {\n // If both events have the same type, it's still possible that actions were performed on different targets.\n // e.g. 2 clicks on different buttons.\n if (!event.target || (event.target )._sentryId !== lastCapturedEventTargetId) {\n return false;\n }\n } catch (e) {\n // just accessing `target` property can throw an exception in some rare circumstances\n // see: https://github.com/getsentry/sentry-javascript/issues/838\n }\n\n // If both events have the same type _and_ same `target` (an element which triggered an event, _not necessarily_\n // to which an event listener was attached), we treat them as the same action, as we want to capture\n // only one breadcrumb. e.g. multiple clicks on the same button, or typing inside a user input box.\n return true;\n}\n\n/**\n * Decide whether an event should be captured.\n * @param event event to be captured\n */\nfunction shouldSkipDOMEvent(eventType, target) {\n // We are only interested in filtering `keypress` events for now.\n if (eventType !== 'keypress') {\n return false;\n }\n\n if (!target || !target.tagName) {\n return true;\n }\n\n // Only consider keypress events on actual input elements. This will disregard keypresses targeting body\n // e.g.tabbing through elements, hotkeys, etc.\n if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.isContentEditable) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Wraps addEventListener to capture UI breadcrumbs\n */\nfunction makeDOMEventHandler(\n handler,\n globalListener = false,\n) {\n return (event) => {\n // It's possible this handler might trigger multiple times for the same\n // event (e.g. event propagation through node ancestors).\n // Ignore if we've already captured that event.\n if (!event || event['_sentryCaptured']) {\n return;\n }\n\n const target = getEventTarget(event);\n\n // We always want to skip _some_ events.\n if (shouldSkipDOMEvent(event.type, target)) {\n return;\n }\n\n // Mark event as \"seen\"\n addNonEnumerableProperty(event, '_sentryCaptured', true);\n\n if (target && !target._sentryId) {\n // Add UUID to event target so we can identify if\n addNonEnumerableProperty(target, '_sentryId', uuid4());\n }\n\n const name = event.type === 'keypress' ? 'input' : event.type;\n\n // If there is no last captured event, it means that we can safely capture the new event and store it for future comparisons.\n // If there is a last captured event, see if the new event is different enough to treat it as a unique one.\n // If that's the case, emit the previous event and store locally the newly-captured DOM event.\n if (!isSimilarToLastCapturedEvent(event)) {\n const handlerData = { event, name, global: globalListener };\n handler(handlerData);\n lastCapturedEventType = event.type;\n lastCapturedEventTargetId = target ? target._sentryId : undefined;\n }\n\n // Start a new debounce timer that will prevent us from capturing multiple events that should be grouped together.\n clearTimeout(debounceTimerID);\n debounceTimerID = WINDOW.setTimeout(() => {\n lastCapturedEventTargetId = undefined;\n lastCapturedEventType = undefined;\n }, DEBOUNCE_DURATION);\n };\n}\n\nfunction getEventTarget(event) {\n try {\n return event.target ;\n } catch (e) {\n // just accessing `target` property can throw an exception in some rare circumstances\n // see: https://github.com/getsentry/sentry-javascript/issues/838\n return null;\n }\n}\n\nexport { addClickKeypressInstrumentationHandler, instrumentDOM };\n","import { addNonEnumerableProperty } from './object.js';\nimport { snipLine } from './string.js';\nimport { GLOBAL_OBJ } from './worldwide.js';\n\n/**\n * UUID4 generator\n *\n * @returns string Generated UUID4.\n */\nfunction uuid4() {\n const gbl = GLOBAL_OBJ ;\n const crypto = gbl.crypto || gbl.msCrypto;\n\n let getRandomByte = () => Math.random() * 16;\n try {\n if (crypto && crypto.randomUUID) {\n return crypto.randomUUID().replace(/-/g, '');\n }\n if (crypto && crypto.getRandomValues) {\n getRandomByte = () => {\n // crypto.getRandomValues might return undefined instead of the typed array\n // in old Chromium versions (e.g. 23.0.1235.0 (151422))\n // However, `typedArray` is still filled in-place.\n // @see https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues#typedarray\n const typedArray = new Uint8Array(1);\n crypto.getRandomValues(typedArray);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return typedArray[0];\n };\n }\n } catch (_) {\n // some runtimes can crash invoking crypto\n // https://github.com/getsentry/sentry-javascript/issues/8935\n }\n\n // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523\n // Concatenating the following numbers as strings results in '10000000100040008000100000000000'\n return (([1e7] ) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, c =>\n // eslint-disable-next-line no-bitwise\n ((c ) ^ ((getRandomByte() & 15) >> ((c ) / 4))).toString(16),\n );\n}\n\nfunction getFirstException(event) {\n return event.exception && event.exception.values ? event.exception.values[0] : undefined;\n}\n\n/**\n * Extracts either message or type+value from an event that can be used for user-facing logs\n * @returns event's description\n */\nfunction getEventDescription(event) {\n const { message, event_id: eventId } = event;\n if (message) {\n return message;\n }\n\n const firstException = getFirstException(event);\n if (firstException) {\n if (firstException.type && firstException.value) {\n return `${firstException.type}: ${firstException.value}`;\n }\n return firstException.type || firstException.value || eventId || '';\n }\n return eventId || '';\n}\n\n/**\n * Adds exception values, type and value to an synthetic Exception.\n * @param event The event to modify.\n * @param value Value of the exception.\n * @param type Type of the exception.\n * @hidden\n */\nfunction addExceptionTypeValue(event, value, type) {\n const exception = (event.exception = event.exception || {});\n const values = (exception.values = exception.values || []);\n const firstException = (values[0] = values[0] || {});\n if (!firstException.value) {\n firstException.value = value || '';\n }\n if (!firstException.type) {\n firstException.type = type || 'Error';\n }\n}\n\n/**\n * Adds exception mechanism data to a given event. Uses defaults if the second parameter is not passed.\n *\n * @param event The event to modify.\n * @param newMechanism Mechanism data to add to the event.\n * @hidden\n */\nfunction addExceptionMechanism(event, newMechanism) {\n const firstException = getFirstException(event);\n if (!firstException) {\n return;\n }\n\n const defaultMechanism = { type: 'generic', handled: true };\n const currentMechanism = firstException.mechanism;\n firstException.mechanism = { ...defaultMechanism, ...currentMechanism, ...newMechanism };\n\n if (newMechanism && 'data' in newMechanism) {\n const mergedData = { ...(currentMechanism && currentMechanism.data), ...newMechanism.data };\n firstException.mechanism.data = mergedData;\n }\n}\n\n// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string\nconst SEMVER_REGEXP =\n /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/;\n\n/**\n * Represents Semantic Versioning object\n */\n\nfunction _parseInt(input) {\n return parseInt(input || '', 10);\n}\n\n/**\n * Parses input into a SemVer interface\n * @param input string representation of a semver version\n */\nfunction parseSemver(input) {\n const match = input.match(SEMVER_REGEXP) || [];\n const major = _parseInt(match[1]);\n const minor = _parseInt(match[2]);\n const patch = _parseInt(match[3]);\n return {\n buildmetadata: match[5],\n major: isNaN(major) ? undefined : major,\n minor: isNaN(minor) ? undefined : minor,\n patch: isNaN(patch) ? undefined : patch,\n prerelease: match[4],\n };\n}\n\n/**\n * This function adds context (pre/post/line) lines to the provided frame\n *\n * @param lines string[] containing all lines\n * @param frame StackFrame that will be mutated\n * @param linesOfContext number of context lines we want to add pre/post\n */\nfunction addContextToFrame(lines, frame, linesOfContext = 5) {\n // When there is no line number in the frame, attaching context is nonsensical and will even break grouping\n if (frame.lineno === undefined) {\n return;\n }\n\n const maxLines = lines.length;\n const sourceLine = Math.max(Math.min(maxLines - 1, frame.lineno - 1), 0);\n\n frame.pre_context = lines\n .slice(Math.max(0, sourceLine - linesOfContext), sourceLine)\n .map((line) => snipLine(line, 0));\n\n // We guard here to ensure this is not larger than the existing number of lines\n const lineIndex = Math.min(maxLines - 1, sourceLine);\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n frame.context_line = snipLine(lines[lineIndex], frame.colno || 0);\n\n frame.post_context = lines\n .slice(Math.min(sourceLine + 1, maxLines), sourceLine + 1 + linesOfContext)\n .map((line) => snipLine(line, 0));\n}\n\n/**\n * Checks whether or not we've already captured the given exception (note: not an identical exception - the very object\n * in question), and marks it captured if not.\n *\n * This is useful because it's possible for an error to get captured by more than one mechanism. After we intercept and\n * record an error, we rethrow it (assuming we've intercepted it before it's reached the top-level global handlers), so\n * that we don't interfere with whatever effects the error might have had were the SDK not there. At that point, because\n * the error has been rethrown, it's possible for it to bubble up to some other code we've instrumented. If it's not\n * caught after that, it will bubble all the way up to the global handlers (which of course we also instrument). This\n * function helps us ensure that even if we encounter the same error more than once, we only record it the first time we\n * see it.\n *\n * Note: It will ignore primitives (always return `false` and not mark them as seen), as properties can't be set on\n * them. {@link: Object.objectify} can be used on exceptions to convert any that are primitives into their equivalent\n * object wrapper forms so that this check will always work. However, because we need to flag the exact object which\n * will get rethrown, and because that rethrowing happens outside of the event processing pipeline, the objectification\n * must be done before the exception captured.\n *\n * @param A thrown exception to check or flag as having been seen\n * @returns `true` if the exception has already been captured, `false` if not (with the side effect of marking it seen)\n */\nfunction checkOrSetAlreadyCaught(exception) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (exception && (exception ).__sentry_captured__) {\n return true;\n }\n\n try {\n // set it this way rather than by assignment so that it's not ennumerable and therefore isn't recorded by the\n // `ExtraErrorData` integration\n addNonEnumerableProperty(exception , '__sentry_captured__', true);\n } catch (err) {\n // `exception` is a primitive, so we can't mark it seen\n }\n\n return false;\n}\n\n/**\n * Checks whether the given input is already an array, and if it isn't, wraps it in one.\n *\n * @param maybeArray Input to turn into an array, if necessary\n * @returns The input, if already an array, or an array with the input as the only element, if not\n */\nfunction arrayify(maybeArray) {\n return Array.isArray(maybeArray) ? maybeArray : [maybeArray];\n}\n\nexport { addContextToFrame, addExceptionMechanism, addExceptionTypeValue, arrayify, checkOrSetAlreadyCaught, getEventDescription, parseSemver, uuid4 };\n","import { GLOBAL_OBJ } from './worldwide.js';\n\nconst ONE_SECOND_IN_MS = 1000;\n\n/**\n * A partial definition of the [Performance Web API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Performance}\n * for accessing a high-resolution monotonic clock.\n */\n\n/**\n * Returns a timestamp in seconds since the UNIX epoch using the Date API.\n *\n * TODO(v8): Return type should be rounded.\n */\nfunction dateTimestampInSeconds() {\n return Date.now() / ONE_SECOND_IN_MS;\n}\n\n/**\n * Returns a wrapper around the native Performance API browser implementation, or undefined for browsers that do not\n * support the API.\n *\n * Wrapping the native API works around differences in behavior from different browsers.\n */\nfunction createUnixTimestampInSecondsFunc() {\n const { performance } = GLOBAL_OBJ ;\n if (!performance || !performance.now) {\n return dateTimestampInSeconds;\n }\n\n // Some browser and environments don't have a timeOrigin, so we fallback to\n // using Date.now() to compute the starting time.\n const approxStartingTimeOrigin = Date.now() - performance.now();\n const timeOrigin = performance.timeOrigin == undefined ? approxStartingTimeOrigin : performance.timeOrigin;\n\n // performance.now() is a monotonic clock, which means it starts at 0 when the process begins. To get the current\n // wall clock time (actual UNIX timestamp), we need to add the starting time origin and the current time elapsed.\n //\n // TODO: This does not account for the case where the monotonic clock that powers performance.now() drifts from the\n // wall clock time, which causes the returned timestamp to be inaccurate. We should investigate how to detect and\n // correct for this.\n // See: https://github.com/getsentry/sentry-javascript/issues/2590\n // See: https://github.com/mdn/content/issues/4713\n // See: https://dev.to/noamr/when-a-millisecond-is-not-a-millisecond-3h6\n return () => {\n return (timeOrigin + performance.now()) / ONE_SECOND_IN_MS;\n };\n}\n\n/**\n * Returns a timestamp in seconds since the UNIX epoch using either the Performance or Date APIs, depending on the\n * availability of the Performance API.\n *\n * BUG: Note that because of how browsers implement the Performance API, the clock might stop when the computer is\n * asleep. This creates a skew between `dateTimestampInSeconds` and `timestampInSeconds`. The\n * skew can grow to arbitrary amounts like days, weeks or months.\n * See https://github.com/getsentry/sentry-javascript/issues/2590.\n */\nconst timestampInSeconds = createUnixTimestampInSecondsFunc();\n\n/**\n * Internal helper to store what is the source of browserPerformanceTimeOrigin below. For debugging only.\n */\nlet _browserPerformanceTimeOriginMode;\n\n/**\n * The number of milliseconds since the UNIX epoch. This value is only usable in a browser, and only when the\n * performance API is available.\n */\nconst browserPerformanceTimeOrigin = (() => {\n // Unfortunately browsers may report an inaccurate time origin data, through either performance.timeOrigin or\n // performance.timing.navigationStart, which results in poor results in performance data. We only treat time origin\n // data as reliable if they are within a reasonable threshold of the current time.\n\n const { performance } = GLOBAL_OBJ ;\n if (!performance || !performance.now) {\n _browserPerformanceTimeOriginMode = 'none';\n return undefined;\n }\n\n const threshold = 3600 * 1000;\n const performanceNow = performance.now();\n const dateNow = Date.now();\n\n // if timeOrigin isn't available set delta to threshold so it isn't used\n const timeOriginDelta = performance.timeOrigin\n ? Math.abs(performance.timeOrigin + performanceNow - dateNow)\n : threshold;\n const timeOriginIsReliable = timeOriginDelta < threshold;\n\n // While performance.timing.navigationStart is deprecated in favor of performance.timeOrigin, performance.timeOrigin\n // is not as widely supported. Namely, performance.timeOrigin is undefined in Safari as of writing.\n // Also as of writing, performance.timing is not available in Web Workers in mainstream browsers, so it is not always\n // a valid fallback. In the absence of an initial time provided by the browser, fallback to the current time from the\n // Date API.\n // eslint-disable-next-line deprecation/deprecation\n const navigationStart = performance.timing && performance.timing.navigationStart;\n const hasNavigationStart = typeof navigationStart === 'number';\n // if navigationStart isn't available set delta to threshold so it isn't used\n const navigationStartDelta = hasNavigationStart ? Math.abs(navigationStart + performanceNow - dateNow) : threshold;\n const navigationStartIsReliable = navigationStartDelta < threshold;\n\n if (timeOriginIsReliable || navigationStartIsReliable) {\n // Use the more reliable time origin\n if (timeOriginDelta <= navigationStartDelta) {\n _browserPerformanceTimeOriginMode = 'timeOrigin';\n return performance.timeOrigin;\n } else {\n _browserPerformanceTimeOriginMode = 'navigationStart';\n return navigationStart;\n }\n }\n\n // Either both timeOrigin and navigationStart are skewed or neither is available, fallback to Date.\n _browserPerformanceTimeOriginMode = 'dateNow';\n return dateNow;\n})();\n\nexport { _browserPerformanceTimeOriginMode, browserPerformanceTimeOrigin, dateTimestampInSeconds, timestampInSeconds };\n","// eslint-disable-next-line @typescript-eslint/unbound-method\nconst objectToString = Object.prototype.toString;\n\n/**\n * Checks whether given value's type is one of a few Error or Error-like\n * {@link isError}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isError(wat) {\n switch (objectToString.call(wat)) {\n case '[object Error]':\n case '[object Exception]':\n case '[object DOMException]':\n return true;\n default:\n return isInstanceOf(wat, Error);\n }\n}\n/**\n * Checks whether given value is an instance of the given built-in class.\n *\n * @param wat The value to be checked\n * @param className\n * @returns A boolean representing the result.\n */\nfunction isBuiltin(wat, className) {\n return objectToString.call(wat) === `[object ${className}]`;\n}\n\n/**\n * Checks whether given value's type is ErrorEvent\n * {@link isErrorEvent}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isErrorEvent(wat) {\n return isBuiltin(wat, 'ErrorEvent');\n}\n\n/**\n * Checks whether given value's type is DOMError\n * {@link isDOMError}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isDOMError(wat) {\n return isBuiltin(wat, 'DOMError');\n}\n\n/**\n * Checks whether given value's type is DOMException\n * {@link isDOMException}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isDOMException(wat) {\n return isBuiltin(wat, 'DOMException');\n}\n\n/**\n * Checks whether given value's type is a string\n * {@link isString}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isString(wat) {\n return isBuiltin(wat, 'String');\n}\n\n/**\n * Checks whether given string is parameterized\n * {@link isParameterizedString}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isParameterizedString(wat) {\n return (\n typeof wat === 'object' &&\n wat !== null &&\n '__sentry_template_string__' in wat &&\n '__sentry_template_values__' in wat\n );\n}\n\n/**\n * Checks whether given value is a primitive (undefined, null, number, boolean, string, bigint, symbol)\n * {@link isPrimitive}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isPrimitive(wat) {\n return wat === null || isParameterizedString(wat) || (typeof wat !== 'object' && typeof wat !== 'function');\n}\n\n/**\n * Checks whether given value's type is an object literal, or a class instance.\n * {@link isPlainObject}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isPlainObject(wat) {\n return isBuiltin(wat, 'Object');\n}\n\n/**\n * Checks whether given value's type is an Event instance\n * {@link isEvent}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isEvent(wat) {\n return typeof Event !== 'undefined' && isInstanceOf(wat, Event);\n}\n\n/**\n * Checks whether given value's type is an Element instance\n * {@link isElement}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isElement(wat) {\n return typeof Element !== 'undefined' && isInstanceOf(wat, Element);\n}\n\n/**\n * Checks whether given value's type is an regexp\n * {@link isRegExp}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isRegExp(wat) {\n return isBuiltin(wat, 'RegExp');\n}\n\n/**\n * Checks whether given value has a then function.\n * @param wat A value to be checked.\n */\nfunction isThenable(wat) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return Boolean(wat && wat.then && typeof wat.then === 'function');\n}\n\n/**\n * Checks whether given value's type is a SyntheticEvent\n * {@link isSyntheticEvent}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isSyntheticEvent(wat) {\n return isPlainObject(wat) && 'nativeEvent' in wat && 'preventDefault' in wat && 'stopPropagation' in wat;\n}\n\n/**\n * Checks whether given value's type is an instance of provided constructor.\n * {@link isInstanceOf}.\n *\n * @param wat A value to be checked.\n * @param base A constructor to be used in a check.\n * @returns A boolean representing the result.\n */\nfunction isInstanceOf(wat, base) {\n try {\n return wat instanceof base;\n } catch (_e) {\n return false;\n }\n}\n\n/**\n * Checks whether given value's type is a Vue ViewModel.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isVueViewModel(wat) {\n // Not using Object.prototype.toString because in Vue 3 it would read the instance's Symbol(Symbol.toStringTag) property.\n return !!(typeof wat === 'object' && wat !== null && ((wat ).__isVue || (wat )._isVue));\n}\n\nexport { isDOMError, isDOMException, isElement, isError, isErrorEvent, isEvent, isInstanceOf, isParameterizedString, isPlainObject, isPrimitive, isRegExp, isString, isSyntheticEvent, isThenable, isVueViewModel };\n","import { addHandler, maybeInstrument, fill, timestampInSeconds, isString, triggerHandlers } from '@sentry/utils';\nimport { WINDOW } from '../types.js';\n\nconst SENTRY_XHR_DATA_KEY = '__sentry_xhr_v3__';\n\n/**\n * Add an instrumentation handler for when an XHR request happens.\n * The handler function is called once when the request starts and once when it ends,\n * which can be identified by checking if it has an `endTimestamp`.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nfunction addXhrInstrumentationHandler(handler) {\n const type = 'xhr';\n addHandler(type, handler);\n maybeInstrument(type, instrumentXHR);\n}\n\n/** Exported only for tests. */\nfunction instrumentXHR() {\n if (!(WINDOW ).XMLHttpRequest) {\n return;\n }\n\n const xhrproto = XMLHttpRequest.prototype;\n\n fill(xhrproto, 'open', function (originalOpen) {\n return function ( ...args) {\n const startTimestamp = timestampInSeconds() * 1000;\n\n // open() should always be called with two or more arguments\n // But to be on the safe side, we actually validate this and bail out if we don't have a method & url\n const method = isString(args[0]) ? args[0].toUpperCase() : undefined;\n const url = parseUrl(args[1]);\n\n if (!method || !url) {\n return originalOpen.apply(this, args);\n }\n\n this[SENTRY_XHR_DATA_KEY] = {\n method,\n url,\n request_headers: {},\n };\n\n // if Sentry key appears in URL, don't capture it as a request\n if (method === 'POST' && url.match(/sentry_key/)) {\n this.__sentry_own_request__ = true;\n }\n\n const onreadystatechangeHandler = () => {\n // For whatever reason, this is not the same instance here as from the outer method\n const xhrInfo = this[SENTRY_XHR_DATA_KEY];\n\n if (!xhrInfo) {\n return;\n }\n\n if (this.readyState === 4) {\n try {\n // touching statusCode in some platforms throws\n // an exception\n xhrInfo.status_code = this.status;\n } catch (e) {\n /* do nothing */\n }\n\n const handlerData = {\n endTimestamp: timestampInSeconds() * 1000,\n startTimestamp,\n xhr: this,\n };\n triggerHandlers('xhr', handlerData);\n }\n };\n\n if ('onreadystatechange' in this && typeof this.onreadystatechange === 'function') {\n fill(this, 'onreadystatechange', function (original) {\n return function ( ...readyStateArgs) {\n onreadystatechangeHandler();\n return original.apply(this, readyStateArgs);\n };\n });\n } else {\n this.addEventListener('readystatechange', onreadystatechangeHandler);\n }\n\n // Intercepting `setRequestHeader` to access the request headers of XHR instance.\n // This will only work for user/library defined headers, not for the default/browser-assigned headers.\n // Request cookies are also unavailable for XHR, as `Cookie` header can't be defined by `setRequestHeader`.\n fill(this, 'setRequestHeader', function (original) {\n return function ( ...setRequestHeaderArgs) {\n const [header, value] = setRequestHeaderArgs;\n\n const xhrInfo = this[SENTRY_XHR_DATA_KEY];\n\n if (xhrInfo && isString(header) && isString(value)) {\n xhrInfo.request_headers[header.toLowerCase()] = value;\n }\n\n return original.apply(this, setRequestHeaderArgs);\n };\n });\n\n return originalOpen.apply(this, args);\n };\n });\n\n fill(xhrproto, 'send', function (originalSend) {\n return function ( ...args) {\n const sentryXhrData = this[SENTRY_XHR_DATA_KEY];\n\n if (!sentryXhrData) {\n return originalSend.apply(this, args);\n }\n\n if (args[0] !== undefined) {\n sentryXhrData.body = args[0];\n }\n\n const handlerData = {\n startTimestamp: timestampInSeconds() * 1000,\n xhr: this,\n };\n triggerHandlers('xhr', handlerData);\n\n return originalSend.apply(this, args);\n };\n });\n}\n\nfunction parseUrl(url) {\n if (isString(url)) {\n return url;\n }\n\n try {\n // url can be a string or URL\n // but since URL is not available in IE11, we do not check for it,\n // but simply assume it is an URL and return `toString()` from it (which returns the full URL)\n // If that fails, we just return undefined\n return (url ).toString();\n } catch (e2) {} // eslint-disable-line no-empty\n\n return undefined;\n}\n\nexport { SENTRY_XHR_DATA_KEY, addXhrInstrumentationHandler, instrumentXHR };\n","import { dateTimestampInSeconds, consoleSandbox } from '@sentry/utils';\nimport { getClient, getIsolationScope } from './currentScopes.js';\n\n/**\n * Default maximum number of breadcrumbs added to an event. Can be overwritten\n * with {@link Options.maxBreadcrumbs}.\n */\nconst DEFAULT_BREADCRUMBS = 100;\n\n/**\n * Records a new breadcrumb which will be attached to future events.\n *\n * Breadcrumbs will be added to subsequent events to provide more context on\n * user's actions prior to an error or crash.\n */\nfunction addBreadcrumb(breadcrumb, hint) {\n const client = getClient();\n const isolationScope = getIsolationScope();\n\n if (!client) return;\n\n const { beforeBreadcrumb = null, maxBreadcrumbs = DEFAULT_BREADCRUMBS } = client.getOptions();\n\n if (maxBreadcrumbs <= 0) return;\n\n const timestamp = dateTimestampInSeconds();\n const mergedBreadcrumb = { timestamp, ...breadcrumb };\n const finalBreadcrumb = beforeBreadcrumb\n ? (consoleSandbox(() => beforeBreadcrumb(mergedBreadcrumb, hint)) )\n : mergedBreadcrumb;\n\n if (finalBreadcrumb === null) return;\n\n if (client.emit) {\n client.emit('beforeAddBreadcrumb', finalBreadcrumb, hint);\n }\n\n isolationScope.addBreadcrumb(finalBreadcrumb, maxBreadcrumbs);\n}\n\nexport { addBreadcrumb };\n","import { DEBUG_BUILD } from '../debug-build.js';\nimport { logger } from '../logger.js';\nimport { getFunctionName } from '../stacktrace.js';\n\n// We keep the handlers globally\nconst handlers = {};\nconst instrumented = {};\n\n/** Add a handler function. */\nfunction addHandler(type, handler) {\n handlers[type] = handlers[type] || [];\n (handlers[type] ).push(handler);\n}\n\n/**\n * Reset all instrumentation handlers.\n * This can be used by tests to ensure we have a clean slate of instrumentation handlers.\n */\nfunction resetInstrumentationHandlers() {\n Object.keys(handlers).forEach(key => {\n handlers[key ] = undefined;\n });\n}\n\n/** Maybe run an instrumentation function, unless it was already called. */\nfunction maybeInstrument(type, instrumentFn) {\n if (!instrumented[type]) {\n instrumentFn();\n instrumented[type] = true;\n }\n}\n\n/** Trigger handlers for a given instrumentation type. */\nfunction triggerHandlers(type, data) {\n const typeHandlers = type && handlers[type];\n if (!typeHandlers) {\n return;\n }\n\n for (const handler of typeHandlers) {\n try {\n handler(data);\n } catch (e) {\n DEBUG_BUILD &&\n logger.error(\n `Error while triggering instrumentation handler.\\nType: ${type}\\nName: ${getFunctionName(handler)}\\nError:`,\n e,\n );\n }\n }\n}\n\nexport { addHandler, maybeInstrument, resetInstrumentationHandlers, triggerHandlers };\n","import { CONSOLE_LEVELS, originalConsoleMethods } from '../logger.js';\nimport { fill } from '../object.js';\nimport { GLOBAL_OBJ } from '../worldwide.js';\nimport { addHandler, maybeInstrument, triggerHandlers } from './handlers.js';\n\n/**\n * Add an instrumentation handler for when a console.xxx method is called.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nfunction addConsoleInstrumentationHandler(handler) {\n const type = 'console';\n addHandler(type, handler);\n maybeInstrument(type, instrumentConsole);\n}\n\nfunction instrumentConsole() {\n if (!('console' in GLOBAL_OBJ)) {\n return;\n }\n\n CONSOLE_LEVELS.forEach(function (level) {\n if (!(level in GLOBAL_OBJ.console)) {\n return;\n }\n\n fill(GLOBAL_OBJ.console, level, function (originalConsoleMethod) {\n originalConsoleMethods[level] = originalConsoleMethod;\n\n return function (...args) {\n const handlerData = { args, level };\n triggerHandlers('console', handlerData);\n\n const log = originalConsoleMethods[level];\n log && log.apply(GLOBAL_OBJ.console, args);\n };\n });\n });\n}\n\nexport { addConsoleInstrumentationHandler };\n","import { isError } from '../is.js';\nimport { fill, addNonEnumerableProperty } from '../object.js';\nimport { supportsNativeFetch } from '../supports.js';\nimport { timestampInSeconds } from '../time.js';\nimport { GLOBAL_OBJ } from '../worldwide.js';\nimport { addHandler, maybeInstrument, triggerHandlers } from './handlers.js';\n\n/**\n * Add an instrumentation handler for when a fetch request happens.\n * The handler function is called once when the request starts and once when it ends,\n * which can be identified by checking if it has an `endTimestamp`.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nfunction addFetchInstrumentationHandler(handler) {\n const type = 'fetch';\n addHandler(type, handler);\n maybeInstrument(type, instrumentFetch);\n}\n\nfunction instrumentFetch() {\n if (!supportsNativeFetch()) {\n return;\n }\n\n fill(GLOBAL_OBJ, 'fetch', function (originalFetch) {\n return function (...args) {\n const { method, url } = parseFetchArgs(args);\n\n const handlerData = {\n args,\n fetchData: {\n method,\n url,\n },\n startTimestamp: timestampInSeconds() * 1000,\n };\n\n triggerHandlers('fetch', {\n ...handlerData,\n });\n\n // We capture the stack right here and not in the Promise error callback because Safari (and probably other\n // browsers too) will wipe the stack trace up to this point, only leaving us with this file which is useless.\n\n // NOTE: If you are a Sentry user, and you are seeing this stack frame,\n // it means the error, that was caused by your fetch call did not\n // have a stack trace, so the SDK backfilled the stack trace so\n // you can see which fetch call failed.\n const virtualStackTrace = new Error().stack;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return originalFetch.apply(GLOBAL_OBJ, args).then(\n (response) => {\n const finishedHandlerData = {\n ...handlerData,\n endTimestamp: timestampInSeconds() * 1000,\n response,\n };\n\n triggerHandlers('fetch', finishedHandlerData);\n return response;\n },\n (error) => {\n const erroredHandlerData = {\n ...handlerData,\n endTimestamp: timestampInSeconds() * 1000,\n error,\n };\n\n triggerHandlers('fetch', erroredHandlerData);\n\n if (isError(error) && error.stack === undefined) {\n // NOTE: If you are a Sentry user, and you are seeing this stack frame,\n // it means the error, that was caused by your fetch call did not\n // have a stack trace, so the SDK backfilled the stack trace so\n // you can see which fetch call failed.\n error.stack = virtualStackTrace;\n addNonEnumerableProperty(error, 'framesToPop', 1);\n }\n\n // NOTE: If you are a Sentry user, and you are seeing this stack frame,\n // it means the sentry.javascript SDK caught an error invoking your application code.\n // This is expected behavior and NOT indicative of a bug with sentry.javascript.\n throw error;\n },\n );\n };\n });\n}\n\nfunction hasProp(obj, prop) {\n return !!obj && typeof obj === 'object' && !!(obj )[prop];\n}\n\nfunction getUrlFromResource(resource) {\n if (typeof resource === 'string') {\n return resource;\n }\n\n if (!resource) {\n return '';\n }\n\n if (hasProp(resource, 'url')) {\n return resource.url;\n }\n\n if (resource.toString) {\n return resource.toString();\n }\n\n return '';\n}\n\n/**\n * Parses the fetch arguments to find the used Http method and the url of the request.\n * Exported for tests only.\n */\nfunction parseFetchArgs(fetchArgs) {\n if (fetchArgs.length === 0) {\n return { method: 'GET', url: '' };\n }\n\n if (fetchArgs.length === 2) {\n const [url, options] = fetchArgs ;\n\n return {\n url: getUrlFromResource(url),\n method: hasProp(options, 'method') ? String(options.method).toUpperCase() : 'GET',\n };\n }\n\n const arg = fetchArgs[0];\n return {\n url: getUrlFromResource(arg ),\n method: hasProp(arg, 'method') ? String(arg.method).toUpperCase() : 'GET',\n };\n}\n\nexport { addFetchInstrumentationHandler, parseFetchArgs };\n","// Note: Ideally the `SeverityLevel` type would be derived from `validSeverityLevels`, but that would mean either\n//\n// a) moving `validSeverityLevels` to `@sentry/types`,\n// b) moving the`SeverityLevel` type here, or\n// c) importing `validSeverityLevels` from here into `@sentry/types`.\n//\n// Option A would make `@sentry/types` a runtime dependency of `@sentry/utils` (not good), and options B and C would\n// create a circular dependency between `@sentry/types` and `@sentry/utils` (also not good). So a TODO accompanying the\n// type, reminding anyone who changes it to change this list also, will have to do.\n\nconst validSeverityLevels = ['fatal', 'error', 'warning', 'log', 'info', 'debug'];\n\n/**\n * Converts a string-based level into a `SeverityLevel`, normalizing it along the way.\n *\n * @param level String representation of desired `SeverityLevel`.\n * @returns The `SeverityLevel` corresponding to the given string, or 'log' if the string isn't a valid level.\n */\nfunction severityLevelFromString(level) {\n return (level === 'warn' ? 'warning' : validSeverityLevels.includes(level) ? level : 'log') ;\n}\n\nexport { severityLevelFromString, validSeverityLevels };\n","/**\n * Parses string form of URL into an object\n * // borrowed from https://tools.ietf.org/html/rfc3986#appendix-B\n * // intentionally using regex and not href parsing trick because React Native and other\n * // environments where DOM might not be available\n * @returns parsed URL object\n */\nfunction parseUrl(url) {\n if (!url) {\n return {};\n }\n\n const match = url.match(/^(([^:/?#]+):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$/);\n\n if (!match) {\n return {};\n }\n\n // coerce to undefined values to empty string so we don't get 'undefined'\n const query = match[6] || '';\n const fragment = match[8] || '';\n return {\n host: match[4],\n path: match[5],\n protocol: match[2],\n search: query,\n hash: fragment,\n relative: match[5] + query + fragment, // everything minus origin\n };\n}\n\n/**\n * Strip the query string and fragment off of a given URL or path (if present)\n *\n * @param urlPath Full URL or path, including possible query string and/or fragment\n * @returns URL or path without query string or fragment\n */\nfunction stripUrlQueryAndFragment(urlPath) {\n return (urlPath.split(/[?#]/, 1) )[0];\n}\n\n/**\n * Returns number of URL segments of a passed string URL.\n */\nfunction getNumberOfUrlSegments(url) {\n // split at '/' or at '\\/' to split regex urls correctly\n return url.split(/\\\\?\\//).filter(s => s.length > 0 && s !== ',').length;\n}\n\n/**\n * Takes a URL object and returns a sanitized string which is safe to use as span name\n * see: https://develop.sentry.dev/sdk/data-handling/#structuring-data\n */\nfunction getSanitizedUrlString(url) {\n const { protocol, host, path } = url;\n\n const filteredHost =\n (host &&\n host\n // Always filter out authority\n .replace(/^.*@/, '[filtered]:[filtered]@')\n // Don't show standard :80 (http) and :443 (https) ports to reduce the noise\n // TODO: Use new URL global if it exists\n .replace(/(:80)$/, '')\n .replace(/(:443)$/, '')) ||\n '';\n\n return `${protocol ? `${protocol}://` : ''}${filteredHost}${path}`;\n}\n\nexport { getNumberOfUrlSegments, getSanitizedUrlString, parseUrl, stripUrlQueryAndFragment };\n","import { addClickKeypressInstrumentationHandler, addXhrInstrumentationHandler, addHistoryInstrumentationHandler, SENTRY_XHR_DATA_KEY } from '@sentry-internal/browser-utils';\nimport { defineIntegration, getClient, addBreadcrumb } from '@sentry/core';\nimport { addConsoleInstrumentationHandler, addFetchInstrumentationHandler, getEventDescription, logger, htmlTreeAsString, getComponentName, severityLevelFromString, safeJoin, parseUrl } from '@sentry/utils';\nimport { DEBUG_BUILD } from '../debug-build.js';\nimport { WINDOW } from '../helpers.js';\n\n/** maxStringLength gets capped to prevent 100 breadcrumbs exceeding 1MB event payload size */\nconst MAX_ALLOWED_STRING_LENGTH = 1024;\n\nconst INTEGRATION_NAME = 'Breadcrumbs';\n\nconst _breadcrumbsIntegration = ((options = {}) => {\n const _options = {\n console: true,\n dom: true,\n fetch: true,\n history: true,\n sentry: true,\n xhr: true,\n ...options,\n };\n\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n if (_options.console) {\n addConsoleInstrumentationHandler(_getConsoleBreadcrumbHandler(client));\n }\n if (_options.dom) {\n addClickKeypressInstrumentationHandler(_getDomBreadcrumbHandler(client, _options.dom));\n }\n if (_options.xhr) {\n addXhrInstrumentationHandler(_getXhrBreadcrumbHandler(client));\n }\n if (_options.fetch) {\n addFetchInstrumentationHandler(_getFetchBreadcrumbHandler(client));\n }\n if (_options.history) {\n addHistoryInstrumentationHandler(_getHistoryBreadcrumbHandler(client));\n }\n if (_options.sentry) {\n client.on('beforeSendEvent', _getSentryBreadcrumbHandler(client));\n }\n },\n };\n}) ;\n\nconst breadcrumbsIntegration = defineIntegration(_breadcrumbsIntegration);\n\n/**\n * Adds a breadcrumb for Sentry events or transactions if this option is enabled.\n */\nfunction _getSentryBreadcrumbHandler(client) {\n return function addSentryBreadcrumb(event) {\n if (getClient() !== client) {\n return;\n }\n\n addBreadcrumb(\n {\n category: `sentry.${event.type === 'transaction' ? 'transaction' : 'event'}`,\n event_id: event.event_id,\n level: event.level,\n message: getEventDescription(event),\n },\n {\n event,\n },\n );\n };\n}\n\n/**\n * A HOC that creaes a function that creates breadcrumbs from DOM API calls.\n * This is a HOC so that we get access to dom options in the closure.\n */\nfunction _getDomBreadcrumbHandler(\n client,\n dom,\n) {\n return function _innerDomBreadcrumb(handlerData) {\n if (getClient() !== client) {\n return;\n }\n\n let target;\n let componentName;\n let keyAttrs = typeof dom === 'object' ? dom.serializeAttribute : undefined;\n\n let maxStringLength =\n typeof dom === 'object' && typeof dom.maxStringLength === 'number' ? dom.maxStringLength : undefined;\n if (maxStringLength && maxStringLength > MAX_ALLOWED_STRING_LENGTH) {\n DEBUG_BUILD &&\n logger.warn(\n `\\`dom.maxStringLength\\` cannot exceed ${MAX_ALLOWED_STRING_LENGTH}, but a value of ${maxStringLength} was configured. Sentry will use ${MAX_ALLOWED_STRING_LENGTH} instead.`,\n );\n maxStringLength = MAX_ALLOWED_STRING_LENGTH;\n }\n\n if (typeof keyAttrs === 'string') {\n keyAttrs = [keyAttrs];\n }\n\n // Accessing event.target can throw (see getsentry/raven-js#838, #768)\n try {\n const event = handlerData.event ;\n const element = _isEvent(event) ? event.target : event;\n\n target = htmlTreeAsString(element, { keyAttrs, maxStringLength });\n componentName = getComponentName(element);\n } catch (e) {\n target = '';\n }\n\n if (target.length === 0) {\n return;\n }\n\n const breadcrumb = {\n category: `ui.${handlerData.name}`,\n message: target,\n };\n\n if (componentName) {\n breadcrumb.data = { 'ui.component_name': componentName };\n }\n\n addBreadcrumb(breadcrumb, {\n event: handlerData.event,\n name: handlerData.name,\n global: handlerData.global,\n });\n };\n}\n\n/**\n * Creates breadcrumbs from console API calls\n */\nfunction _getConsoleBreadcrumbHandler(client) {\n return function _consoleBreadcrumb(handlerData) {\n if (getClient() !== client) {\n return;\n }\n\n const breadcrumb = {\n category: 'console',\n data: {\n arguments: handlerData.args,\n logger: 'console',\n },\n level: severityLevelFromString(handlerData.level),\n message: safeJoin(handlerData.args, ' '),\n };\n\n if (handlerData.level === 'assert') {\n if (handlerData.args[0] === false) {\n breadcrumb.message = `Assertion failed: ${safeJoin(handlerData.args.slice(1), ' ') || 'console.assert'}`;\n breadcrumb.data.arguments = handlerData.args.slice(1);\n } else {\n // Don't capture a breadcrumb for passed assertions\n return;\n }\n }\n\n addBreadcrumb(breadcrumb, {\n input: handlerData.args,\n level: handlerData.level,\n });\n };\n}\n\n/**\n * Creates breadcrumbs from XHR API calls\n */\nfunction _getXhrBreadcrumbHandler(client) {\n return function _xhrBreadcrumb(handlerData) {\n if (getClient() !== client) {\n return;\n }\n\n const { startTimestamp, endTimestamp } = handlerData;\n\n const sentryXhrData = handlerData.xhr[SENTRY_XHR_DATA_KEY];\n\n // We only capture complete, non-sentry requests\n if (!startTimestamp || !endTimestamp || !sentryXhrData) {\n return;\n }\n\n const { method, url, status_code, body } = sentryXhrData;\n\n const data = {\n method,\n url,\n status_code,\n };\n\n const hint = {\n xhr: handlerData.xhr,\n input: body,\n startTimestamp,\n endTimestamp,\n };\n\n addBreadcrumb(\n {\n category: 'xhr',\n data,\n type: 'http',\n },\n hint,\n );\n };\n}\n\n/**\n * Creates breadcrumbs from fetch API calls\n */\nfunction _getFetchBreadcrumbHandler(client) {\n return function _fetchBreadcrumb(handlerData) {\n if (getClient() !== client) {\n return;\n }\n\n const { startTimestamp, endTimestamp } = handlerData;\n\n // We only capture complete fetch requests\n if (!endTimestamp) {\n return;\n }\n\n if (handlerData.fetchData.url.match(/sentry_key/) && handlerData.fetchData.method === 'POST') {\n // We will not create breadcrumbs for fetch requests that contain `sentry_key` (internal sentry requests)\n return;\n }\n\n if (handlerData.error) {\n const data = handlerData.fetchData;\n const hint = {\n data: handlerData.error,\n input: handlerData.args,\n startTimestamp,\n endTimestamp,\n };\n\n addBreadcrumb(\n {\n category: 'fetch',\n data,\n level: 'error',\n type: 'http',\n },\n hint,\n );\n } else {\n const response = handlerData.response ;\n const data = {\n ...handlerData.fetchData,\n status_code: response && response.status,\n };\n const hint = {\n input: handlerData.args,\n response,\n startTimestamp,\n endTimestamp,\n };\n addBreadcrumb(\n {\n category: 'fetch',\n data,\n type: 'http',\n },\n hint,\n );\n }\n };\n}\n\n/**\n * Creates breadcrumbs from history API calls\n */\nfunction _getHistoryBreadcrumbHandler(client) {\n return function _historyBreadcrumb(handlerData) {\n if (getClient() !== client) {\n return;\n }\n\n let from = handlerData.from;\n let to = handlerData.to;\n const parsedLoc = parseUrl(WINDOW.location.href);\n let parsedFrom = from ? parseUrl(from) : undefined;\n const parsedTo = parseUrl(to);\n\n // Initial pushState doesn't provide `from` information\n if (!parsedFrom || !parsedFrom.path) {\n parsedFrom = parsedLoc;\n }\n\n // Use only the path component of the URL if the URL matches the current\n // document (almost all the time when using pushState)\n if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host) {\n to = parsedTo.relative;\n }\n if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host) {\n from = parsedFrom.relative;\n }\n\n addBreadcrumb({\n category: 'navigation',\n data: {\n from,\n to,\n },\n });\n };\n}\n\nfunction _isEvent(event) {\n return !!event && !!(event ).target;\n}\n\nexport { breadcrumbsIntegration };\n","import { defineIntegration } from '@sentry/core';\nimport { fill, getFunctionName, getOriginalFunction } from '@sentry/utils';\nimport { WINDOW, wrap } from '../helpers.js';\n\nconst DEFAULT_EVENT_TARGET = [\n 'EventTarget',\n 'Window',\n 'Node',\n 'ApplicationCache',\n 'AudioTrackList',\n 'BroadcastChannel',\n 'ChannelMergerNode',\n 'CryptoOperation',\n 'EventSource',\n 'FileReader',\n 'HTMLUnknownElement',\n 'IDBDatabase',\n 'IDBRequest',\n 'IDBTransaction',\n 'KeyOperation',\n 'MediaController',\n 'MessagePort',\n 'ModalWindow',\n 'Notification',\n 'SVGElementInstance',\n 'Screen',\n 'SharedWorker',\n 'TextTrack',\n 'TextTrackCue',\n 'TextTrackList',\n 'WebSocket',\n 'WebSocketWorker',\n 'Worker',\n 'XMLHttpRequest',\n 'XMLHttpRequestEventTarget',\n 'XMLHttpRequestUpload',\n];\n\nconst INTEGRATION_NAME = 'BrowserApiErrors';\n\nconst _browserApiErrorsIntegration = ((options = {}) => {\n const _options = {\n XMLHttpRequest: true,\n eventTarget: true,\n requestAnimationFrame: true,\n setInterval: true,\n setTimeout: true,\n ...options,\n };\n\n return {\n name: INTEGRATION_NAME,\n // TODO: This currently only works for the first client this is setup\n // We may want to adjust this to check for client etc.\n setupOnce() {\n if (_options.setTimeout) {\n fill(WINDOW, 'setTimeout', _wrapTimeFunction);\n }\n\n if (_options.setInterval) {\n fill(WINDOW, 'setInterval', _wrapTimeFunction);\n }\n\n if (_options.requestAnimationFrame) {\n fill(WINDOW, 'requestAnimationFrame', _wrapRAF);\n }\n\n if (_options.XMLHttpRequest && 'XMLHttpRequest' in WINDOW) {\n fill(XMLHttpRequest.prototype, 'send', _wrapXHR);\n }\n\n const eventTargetOption = _options.eventTarget;\n if (eventTargetOption) {\n const eventTarget = Array.isArray(eventTargetOption) ? eventTargetOption : DEFAULT_EVENT_TARGET;\n eventTarget.forEach(_wrapEventTarget);\n }\n },\n };\n}) ;\n\n/**\n * Wrap timer functions and event targets to catch errors and provide better meta data.\n */\nconst browserApiErrorsIntegration = defineIntegration(_browserApiErrorsIntegration);\n\nfunction _wrapTimeFunction(original) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function ( ...args) {\n const originalCallback = args[0];\n args[0] = wrap(originalCallback, {\n mechanism: {\n data: { function: getFunctionName(original) },\n handled: false,\n type: 'instrument',\n },\n });\n return original.apply(this, args);\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _wrapRAF(original) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function ( callback) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return original.apply(this, [\n wrap(callback, {\n mechanism: {\n data: {\n function: 'requestAnimationFrame',\n handler: getFunctionName(original),\n },\n handled: false,\n type: 'instrument',\n },\n }),\n ]);\n };\n}\n\nfunction _wrapXHR(originalSend) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function ( ...args) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const xhr = this;\n const xmlHttpRequestProps = ['onload', 'onerror', 'onprogress', 'onreadystatechange'];\n\n xmlHttpRequestProps.forEach(prop => {\n if (prop in xhr && typeof xhr[prop] === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fill(xhr, prop, function (original) {\n const wrapOptions = {\n mechanism: {\n data: {\n function: prop,\n handler: getFunctionName(original),\n },\n handled: false,\n type: 'instrument',\n },\n };\n\n // If Instrument integration has been called before BrowserApiErrors, get the name of original function\n const originalFunction = getOriginalFunction(original);\n if (originalFunction) {\n wrapOptions.mechanism.data.handler = getFunctionName(originalFunction);\n }\n\n // Otherwise wrap directly\n return wrap(original, wrapOptions);\n });\n }\n });\n\n return originalSend.apply(this, args);\n };\n}\n\nfunction _wrapEventTarget(target) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const globalObject = WINDOW ;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const proto = globalObject[target] && globalObject[target].prototype;\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, no-prototype-builtins\n if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty('addEventListener')) {\n return;\n }\n\n fill(proto, 'addEventListener', function (original,)\n\n {\n return function (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n\n eventName,\n fn,\n options,\n ) {\n try {\n if (typeof fn.handleEvent === 'function') {\n // ESlint disable explanation:\n // First, it is generally safe to call `wrap` with an unbound function. Furthermore, using `.bind()` would\n // introduce a bug here, because bind returns a new function that doesn't have our\n // flags(like __sentry_original__) attached. `wrap` checks for those flags to avoid unnecessary wrapping.\n // Without those flags, every call to addEventListener wraps the function again, causing a memory leak.\n // eslint-disable-next-line @typescript-eslint/unbound-method\n fn.handleEvent = wrap(fn.handleEvent, {\n mechanism: {\n data: {\n function: 'handleEvent',\n handler: getFunctionName(fn),\n target,\n },\n handled: false,\n type: 'instrument',\n },\n });\n }\n } catch (err) {\n // can sometimes get 'Permission denied to access property \"handle Event'\n }\n\n return original.apply(this, [\n eventName,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n wrap(fn , {\n mechanism: {\n data: {\n function: 'addEventListener',\n handler: getFunctionName(fn),\n target,\n },\n handled: false,\n type: 'instrument',\n },\n }),\n options,\n ]);\n };\n });\n\n fill(\n proto,\n 'removeEventListener',\n function (\n originalRemoveEventListener,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ) {\n return function (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n\n eventName,\n fn,\n options,\n ) {\n /**\n * There are 2 possible scenarios here:\n *\n * 1. Someone passes a callback, which was attached prior to Sentry initialization, or by using unmodified\n * method, eg. `document.addEventListener.call(el, name, handler). In this case, we treat this function\n * as a pass-through, and call original `removeEventListener` with it.\n *\n * 2. Someone passes a callback, which was attached after Sentry was initialized, which means that it was using\n * our wrapped version of `addEventListener`, which internally calls `wrap` helper.\n * This helper \"wraps\" whole callback inside a try/catch statement, and attached appropriate metadata to it,\n * in order for us to make a distinction between wrapped/non-wrapped functions possible.\n * If a function was wrapped, it has additional property of `__sentry_wrapped__`, holding the handler.\n *\n * When someone adds a handler prior to initialization, and then do it again, but after,\n * then we have to detach both of them. Otherwise, if we'd detach only wrapped one, it'd be impossible\n * to get rid of the initial handler and it'd stick there forever.\n */\n const wrappedEventHandler = fn ;\n try {\n const originalEventHandler = wrappedEventHandler && wrappedEventHandler.__sentry_wrapped__;\n if (originalEventHandler) {\n originalRemoveEventListener.call(this, eventName, originalEventHandler, options);\n }\n } catch (e) {\n // ignore, accessing __sentry_wrapped__ will throw in some Selenium environments\n }\n return originalRemoveEventListener.call(this, eventName, wrappedEventHandler, options);\n };\n },\n );\n}\n\nexport { browserApiErrorsIntegration };\n","import { GLOBAL_OBJ } from '../worldwide.js';\nimport { addHandler, maybeInstrument, triggerHandlers } from './handlers.js';\n\nlet _oldOnErrorHandler = null;\n\n/**\n * Add an instrumentation handler for when an error is captured by the global error handler.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nfunction addGlobalErrorInstrumentationHandler(handler) {\n const type = 'error';\n addHandler(type, handler);\n maybeInstrument(type, instrumentError);\n}\n\nfunction instrumentError() {\n _oldOnErrorHandler = GLOBAL_OBJ.onerror;\n\n GLOBAL_OBJ.onerror = function (\n msg,\n url,\n line,\n column,\n error,\n ) {\n const handlerData = {\n column,\n error,\n line,\n msg,\n url,\n };\n triggerHandlers('error', handlerData);\n\n if (_oldOnErrorHandler && !_oldOnErrorHandler.__SENTRY_LOADER__) {\n // eslint-disable-next-line prefer-rest-params\n return _oldOnErrorHandler.apply(this, arguments);\n }\n\n return false;\n };\n\n GLOBAL_OBJ.onerror.__SENTRY_INSTRUMENTED__ = true;\n}\n\nexport { addGlobalErrorInstrumentationHandler };\n","import { GLOBAL_OBJ } from '../worldwide.js';\nimport { addHandler, maybeInstrument, triggerHandlers } from './handlers.js';\n\nlet _oldOnUnhandledRejectionHandler = null;\n\n/**\n * Add an instrumentation handler for when an unhandled promise rejection is captured.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nfunction addGlobalUnhandledRejectionInstrumentationHandler(\n handler,\n) {\n const type = 'unhandledrejection';\n addHandler(type, handler);\n maybeInstrument(type, instrumentUnhandledRejection);\n}\n\nfunction instrumentUnhandledRejection() {\n _oldOnUnhandledRejectionHandler = GLOBAL_OBJ.onunhandledrejection;\n\n GLOBAL_OBJ.onunhandledrejection = function (e) {\n const handlerData = e;\n triggerHandlers('unhandledrejection', handlerData);\n\n if (_oldOnUnhandledRejectionHandler && !_oldOnUnhandledRejectionHandler.__SENTRY_LOADER__) {\n // eslint-disable-next-line prefer-rest-params\n return _oldOnUnhandledRejectionHandler.apply(this, arguments);\n }\n\n return true;\n };\n\n GLOBAL_OBJ.onunhandledrejection.__SENTRY_INSTRUMENTED__ = true;\n}\n\nexport { addGlobalUnhandledRejectionInstrumentationHandler };\n","import { defineIntegration, getClient, captureEvent } from '@sentry/core';\nimport { addGlobalErrorInstrumentationHandler, addGlobalUnhandledRejectionInstrumentationHandler, isPrimitive, isString, getLocationHref, UNKNOWN_FUNCTION, logger } from '@sentry/utils';\nimport { DEBUG_BUILD } from '../debug-build.js';\nimport { eventFromUnknownInput } from '../eventbuilder.js';\nimport { shouldIgnoreOnError } from '../helpers.js';\n\nconst INTEGRATION_NAME = 'GlobalHandlers';\n\nconst _globalHandlersIntegration = ((options = {}) => {\n const _options = {\n onerror: true,\n onunhandledrejection: true,\n ...options,\n };\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n Error.stackTraceLimit = 50;\n },\n setup(client) {\n if (_options.onerror) {\n _installGlobalOnErrorHandler(client);\n globalHandlerLog('onerror');\n }\n if (_options.onunhandledrejection) {\n _installGlobalOnUnhandledRejectionHandler(client);\n globalHandlerLog('onunhandledrejection');\n }\n },\n };\n}) ;\n\nconst globalHandlersIntegration = defineIntegration(_globalHandlersIntegration);\n\nfunction _installGlobalOnErrorHandler(client) {\n addGlobalErrorInstrumentationHandler(data => {\n const { stackParser, attachStacktrace } = getOptions();\n\n if (getClient() !== client || shouldIgnoreOnError()) {\n return;\n }\n\n const { msg, url, line, column, error } = data;\n\n const event = _enhanceEventWithInitialFrame(\n eventFromUnknownInput(stackParser, error || msg, undefined, attachStacktrace, false),\n url,\n line,\n column,\n );\n\n event.level = 'error';\n\n captureEvent(event, {\n originalException: error,\n mechanism: {\n handled: false,\n type: 'onerror',\n },\n });\n });\n}\n\nfunction _installGlobalOnUnhandledRejectionHandler(client) {\n addGlobalUnhandledRejectionInstrumentationHandler(e => {\n const { stackParser, attachStacktrace } = getOptions();\n\n if (getClient() !== client || shouldIgnoreOnError()) {\n return;\n }\n\n const error = _getUnhandledRejectionError(e );\n\n const event = isPrimitive(error)\n ? _eventFromRejectionWithPrimitive(error)\n : eventFromUnknownInput(stackParser, error, undefined, attachStacktrace, true);\n\n event.level = 'error';\n\n captureEvent(event, {\n originalException: error,\n mechanism: {\n handled: false,\n type: 'onunhandledrejection',\n },\n });\n });\n}\n\nfunction _getUnhandledRejectionError(error) {\n if (isPrimitive(error)) {\n return error;\n }\n\n // dig the object of the rejection out of known event types\n try {\n\n // PromiseRejectionEvents store the object of the rejection under 'reason'\n // see https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent\n if ('reason' in (error )) {\n return (error ).reason;\n }\n\n // something, somewhere, (likely a browser extension) effectively casts PromiseRejectionEvents\n // to CustomEvents, moving the `promise` and `reason` attributes of the PRE into\n // the CustomEvent's `detail` attribute, since they're not part of CustomEvent's spec\n // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent and\n // https://github.com/getsentry/sentry-javascript/issues/2380\n if ('detail' in (error ) && 'reason' in (error ).detail) {\n return (error ).detail.reason;\n }\n } catch (e2) {} // eslint-disable-line no-empty\n\n return error;\n}\n\n/**\n * Create an event from a promise rejection where the `reason` is a primitive.\n *\n * @param reason: The `reason` property of the promise rejection\n * @returns An Event object with an appropriate `exception` value\n */\nfunction _eventFromRejectionWithPrimitive(reason) {\n return {\n exception: {\n values: [\n {\n type: 'UnhandledRejection',\n // String() is needed because the Primitive type includes symbols (which can't be automatically stringified)\n value: `Non-Error promise rejection captured with value: ${String(reason)}`,\n },\n ],\n },\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _enhanceEventWithInitialFrame(event, url, line, column) {\n // event.exception\n const e = (event.exception = event.exception || {});\n // event.exception.values\n const ev = (e.values = e.values || []);\n // event.exception.values[0]\n const ev0 = (ev[0] = ev[0] || {});\n // event.exception.values[0].stacktrace\n const ev0s = (ev0.stacktrace = ev0.stacktrace || {});\n // event.exception.values[0].stacktrace.frames\n const ev0sf = (ev0s.frames = ev0s.frames || []);\n\n const colno = isNaN(parseInt(column, 10)) ? undefined : column;\n const lineno = isNaN(parseInt(line, 10)) ? undefined : line;\n const filename = isString(url) && url.length > 0 ? url : getLocationHref();\n\n // event.exception.values[0].stacktrace.frames\n if (ev0sf.length === 0) {\n ev0sf.push({\n colno,\n filename,\n function: UNKNOWN_FUNCTION,\n in_app: true,\n lineno,\n });\n }\n\n return event;\n}\n\nfunction globalHandlerLog(type) {\n DEBUG_BUILD && logger.log(`Global Handler attached: ${type}`);\n}\n\nfunction getOptions() {\n const client = getClient();\n const options = (client && client.getOptions()) || {\n stackParser: () => [],\n attachStacktrace: false,\n };\n return options;\n}\n\nexport { globalHandlersIntegration };\n","import { defineIntegration } from '@sentry/core';\nimport { WINDOW } from '../helpers.js';\n\n/**\n * Collects information about HTTP request headers and\n * attaches them to the event.\n */\nconst httpContextIntegration = defineIntegration(() => {\n return {\n name: 'HttpContext',\n preprocessEvent(event) {\n // if none of the information we want exists, don't bother\n if (!WINDOW.navigator && !WINDOW.location && !WINDOW.document) {\n return;\n }\n\n // grab as much info as exists and add it to the event\n const url = (event.request && event.request.url) || (WINDOW.location && WINDOW.location.href);\n const { referrer } = WINDOW.document || {};\n const { userAgent } = WINDOW.navigator || {};\n\n const headers = {\n ...(event.request && event.request.headers),\n ...(referrer && { Referer: referrer }),\n ...(userAgent && { 'User-Agent': userAgent }),\n };\n const request = { ...event.request, ...(url && { url }), headers };\n\n event.request = request;\n },\n };\n});\n\nexport { httpContextIntegration };\n","import { isInstanceOf } from './is.js';\nimport { truncate } from './string.js';\n\n/**\n * Creates exceptions inside `event.exception.values` for errors that are nested on properties based on the `key` parameter.\n */\nfunction applyAggregateErrorsToEvent(\n exceptionFromErrorImplementation,\n parser,\n maxValueLimit = 250,\n key,\n limit,\n event,\n hint,\n) {\n if (!event.exception || !event.exception.values || !hint || !isInstanceOf(hint.originalException, Error)) {\n return;\n }\n\n // Generally speaking the last item in `event.exception.values` is the exception originating from the original Error\n const originalException =\n event.exception.values.length > 0 ? event.exception.values[event.exception.values.length - 1] : undefined;\n\n // We only create exception grouping if there is an exception in the event.\n if (originalException) {\n event.exception.values = truncateAggregateExceptions(\n aggregateExceptionsFromError(\n exceptionFromErrorImplementation,\n parser,\n limit,\n hint.originalException ,\n key,\n event.exception.values,\n originalException,\n 0,\n ),\n maxValueLimit,\n );\n }\n}\n\nfunction aggregateExceptionsFromError(\n exceptionFromErrorImplementation,\n parser,\n limit,\n error,\n key,\n prevExceptions,\n exception,\n exceptionId,\n) {\n if (prevExceptions.length >= limit + 1) {\n return prevExceptions;\n }\n\n let newExceptions = [...prevExceptions];\n\n // Recursively call this function in order to walk down a chain of errors\n if (isInstanceOf(error[key], Error)) {\n applyExceptionGroupFieldsForParentException(exception, exceptionId);\n const newException = exceptionFromErrorImplementation(parser, error[key]);\n const newExceptionId = newExceptions.length;\n applyExceptionGroupFieldsForChildException(newException, key, newExceptionId, exceptionId);\n newExceptions = aggregateExceptionsFromError(\n exceptionFromErrorImplementation,\n parser,\n limit,\n error[key],\n key,\n [newException, ...newExceptions],\n newException,\n newExceptionId,\n );\n }\n\n // This will create exception grouping for AggregateErrors\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AggregateError\n if (Array.isArray(error.errors)) {\n error.errors.forEach((childError, i) => {\n if (isInstanceOf(childError, Error)) {\n applyExceptionGroupFieldsForParentException(exception, exceptionId);\n const newException = exceptionFromErrorImplementation(parser, childError);\n const newExceptionId = newExceptions.length;\n applyExceptionGroupFieldsForChildException(newException, `errors[${i}]`, newExceptionId, exceptionId);\n newExceptions = aggregateExceptionsFromError(\n exceptionFromErrorImplementation,\n parser,\n limit,\n childError,\n key,\n [newException, ...newExceptions],\n newException,\n newExceptionId,\n );\n }\n });\n }\n\n return newExceptions;\n}\n\nfunction applyExceptionGroupFieldsForParentException(exception, exceptionId) {\n // Don't know if this default makes sense. The protocol requires us to set these values so we pick *some* default.\n exception.mechanism = exception.mechanism || { type: 'generic', handled: true };\n\n exception.mechanism = {\n ...exception.mechanism,\n ...(exception.type === 'AggregateError' && { is_exception_group: true }),\n exception_id: exceptionId,\n };\n}\n\nfunction applyExceptionGroupFieldsForChildException(\n exception,\n source,\n exceptionId,\n parentId,\n) {\n // Don't know if this default makes sense. The protocol requires us to set these values so we pick *some* default.\n exception.mechanism = exception.mechanism || { type: 'generic', handled: true };\n\n exception.mechanism = {\n ...exception.mechanism,\n type: 'chained',\n source,\n exception_id: exceptionId,\n parent_id: parentId,\n };\n}\n\n/**\n * Truncate the message (exception.value) of all exceptions in the event.\n * Because this event processor is ran after `applyClientOptions`,\n * we need to truncate the message of the added exceptions here.\n */\nfunction truncateAggregateExceptions(exceptions, maxValueLength) {\n return exceptions.map(exception => {\n if (exception.value) {\n exception.value = truncate(exception.value, maxValueLength);\n }\n return exception;\n });\n}\n\nexport { applyAggregateErrorsToEvent };\n","import { defineIntegration } from '@sentry/core';\nimport { applyAggregateErrorsToEvent } from '@sentry/utils';\nimport { exceptionFromError } from '../eventbuilder.js';\n\nconst DEFAULT_KEY = 'cause';\nconst DEFAULT_LIMIT = 5;\n\nconst INTEGRATION_NAME = 'LinkedErrors';\n\nconst _linkedErrorsIntegration = ((options = {}) => {\n const limit = options.limit || DEFAULT_LIMIT;\n const key = options.key || DEFAULT_KEY;\n\n return {\n name: INTEGRATION_NAME,\n preprocessEvent(event, hint, client) {\n const options = client.getOptions();\n\n applyAggregateErrorsToEvent(\n // This differs from the LinkedErrors integration in core by using a different exceptionFromError function\n exceptionFromError,\n options.stackParser,\n options.maxValueLength,\n key,\n limit,\n event,\n hint,\n );\n },\n };\n}) ;\n\n/**\n * Aggregrate linked errors in an event.\n */\nconst linkedErrorsIntegration = defineIntegration(_linkedErrorsIntegration);\n\nexport { linkedErrorsIntegration };\n","import { createStackParser, UNKNOWN_FUNCTION } from '@sentry/utils';\n\nconst OPERA10_PRIORITY = 10;\nconst OPERA11_PRIORITY = 20;\nconst CHROME_PRIORITY = 30;\nconst WINJS_PRIORITY = 40;\nconst GECKO_PRIORITY = 50;\n\nfunction createFrame(filename, func, lineno, colno) {\n const frame = {\n filename,\n function: func === '' ? UNKNOWN_FUNCTION : func,\n in_app: true, // All browser frames are considered in_app\n };\n\n if (lineno !== undefined) {\n frame.lineno = lineno;\n }\n\n if (colno !== undefined) {\n frame.colno = colno;\n }\n\n return frame;\n}\n\n// This regex matches frames that have no function name (ie. are at the top level of a module).\n// For example \"at http://localhost:5000//script.js:1:126\"\n// Frames _with_ function names usually look as follows: \"at commitLayoutEffects (react-dom.development.js:23426:1)\"\nconst chromeRegexNoFnName = /^\\s*at (\\S+?)(?::(\\d+))(?::(\\d+))\\s*$/i;\n\n// This regex matches all the frames that have a function name.\nconst chromeRegex =\n /^\\s*at (?:(.+?\\)(?: \\[.+\\])?|.*?) ?\\((?:address at )?)?(?:async )?((?:|[-a-z]+:|.*bundle|\\/)?.*?)(?::(\\d+))?(?::(\\d+))?\\)?\\s*$/i;\n\nconst chromeEvalRegex = /\\((\\S*)(?::(\\d+))(?::(\\d+))\\)/;\n\n// Chromium based browsers: Chrome, Brave, new Opera, new Edge\n// We cannot call this variable `chrome` because it can conflict with global `chrome` variable in certain environments\n// See: https://github.com/getsentry/sentry-javascript/issues/6880\nconst chromeStackParserFn = line => {\n // If the stack line has no function name, we need to parse it differently\n const noFnParts = chromeRegexNoFnName.exec(line) ;\n\n if (noFnParts) {\n const [, filename, line, col] = noFnParts;\n return createFrame(filename, UNKNOWN_FUNCTION, +line, +col);\n }\n\n const parts = chromeRegex.exec(line) ;\n\n if (parts) {\n const isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line\n\n if (isEval) {\n const subMatch = chromeEvalRegex.exec(parts[2]) ;\n\n if (subMatch) {\n // throw out eval line/column and use top-most line/column number\n parts[2] = subMatch[1]; // url\n parts[3] = subMatch[2]; // line\n parts[4] = subMatch[3]; // column\n }\n }\n\n // Kamil: One more hack won't hurt us right? Understanding and adding more rules on top of these regexps right now\n // would be way too time consuming. (TODO: Rewrite whole RegExp to be more readable)\n const [func, filename] = extractSafariExtensionDetails(parts[1] || UNKNOWN_FUNCTION, parts[2]);\n\n return createFrame(filename, func, parts[3] ? +parts[3] : undefined, parts[4] ? +parts[4] : undefined);\n }\n\n return;\n};\n\nconst chromeStackLineParser = [CHROME_PRIORITY, chromeStackParserFn];\n\n// gecko regex: `(?:bundle|\\d+\\.js)`: `bundle` is for react native, `\\d+\\.js` also but specifically for ram bundles because it\n// generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js\n// We need this specific case for now because we want no other regex to match.\nconst geckoREgex =\n /^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)?((?:[-a-z]+)?:\\/.*?|\\[native code\\]|[^@]*(?:bundle|\\d+\\.js)|\\/[\\w\\-. /=]+)(?::(\\d+))?(?::(\\d+))?\\s*$/i;\nconst geckoEvalRegex = /(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;\n\nconst gecko = line => {\n const parts = geckoREgex.exec(line) ;\n\n if (parts) {\n const isEval = parts[3] && parts[3].indexOf(' > eval') > -1;\n if (isEval) {\n const subMatch = geckoEvalRegex.exec(parts[3]) ;\n\n if (subMatch) {\n // throw out eval line/column and use top-most line number\n parts[1] = parts[1] || 'eval';\n parts[3] = subMatch[1];\n parts[4] = subMatch[2];\n parts[5] = ''; // no column when eval\n }\n }\n\n let filename = parts[3];\n let func = parts[1] || UNKNOWN_FUNCTION;\n [func, filename] = extractSafariExtensionDetails(func, filename);\n\n return createFrame(filename, func, parts[4] ? +parts[4] : undefined, parts[5] ? +parts[5] : undefined);\n }\n\n return;\n};\n\nconst geckoStackLineParser = [GECKO_PRIORITY, gecko];\n\nconst winjsRegex = /^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:[-a-z]+):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;\n\nconst winjs = line => {\n const parts = winjsRegex.exec(line) ;\n\n return parts\n ? createFrame(parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : undefined)\n : undefined;\n};\n\nconst winjsStackLineParser = [WINJS_PRIORITY, winjs];\n\nconst opera10Regex = / line (\\d+).*script (?:in )?(\\S+)(?:: in function (\\S+))?$/i;\n\nconst opera10 = line => {\n const parts = opera10Regex.exec(line) ;\n return parts ? createFrame(parts[2], parts[3] || UNKNOWN_FUNCTION, +parts[1]) : undefined;\n};\n\nconst opera10StackLineParser = [OPERA10_PRIORITY, opera10];\n\nconst opera11Regex =\n / line (\\d+), column (\\d+)\\s*(?:in (?:]+)>|([^)]+))\\(.*\\))? in (.*):\\s*$/i;\n\nconst opera11 = line => {\n const parts = opera11Regex.exec(line) ;\n return parts ? createFrame(parts[5], parts[3] || parts[4] || UNKNOWN_FUNCTION, +parts[1], +parts[2]) : undefined;\n};\n\nconst opera11StackLineParser = [OPERA11_PRIORITY, opera11];\n\nconst defaultStackLineParsers = [chromeStackLineParser, geckoStackLineParser];\n\nconst defaultStackParser = createStackParser(...defaultStackLineParsers);\n\n/**\n * Safari web extensions, starting version unknown, can produce \"frames-only\" stacktraces.\n * What it means, is that instead of format like:\n *\n * Error: wat\n * at function@url:row:col\n * at function@url:row:col\n * at function@url:row:col\n *\n * it produces something like:\n *\n * function@url:row:col\n * function@url:row:col\n * function@url:row:col\n *\n * Because of that, it won't be captured by `chrome` RegExp and will fall into `Gecko` branch.\n * This function is extracted so that we can use it in both places without duplicating the logic.\n * Unfortunately \"just\" changing RegExp is too complicated now and making it pass all tests\n * and fix this case seems like an impossible, or at least way too time-consuming task.\n */\nconst extractSafariExtensionDetails = (func, filename) => {\n const isSafariExtension = func.indexOf('safari-extension') !== -1;\n const isSafariWebExtension = func.indexOf('safari-web-extension') !== -1;\n\n return isSafariExtension || isSafariWebExtension\n ? [\n func.indexOf('@') !== -1 ? (func.split('@')[0] ) : UNKNOWN_FUNCTION,\n isSafariExtension ? `safari-extension:${filename}` : `safari-web-extension:${filename}`,\n ]\n : [func, filename];\n};\n\nexport { chromeStackLineParser, defaultStackLineParsers, defaultStackParser, geckoStackLineParser, opera10StackLineParser, opera11StackLineParser, winjsStackLineParser };\n","/**\n * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nconst DEBUG_BUILD = (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__);\n\nexport { DEBUG_BUILD };\n","import { isNativeFunction, logger } from '@sentry/utils';\nimport { DEBUG_BUILD } from './debug-build.js';\nimport { WINDOW } from './types.js';\n\n/**\n * We generally want to use window.fetch / window.setTimeout.\n * However, in some cases this may be wrapped (e.g. by Zone.js for Angular),\n * so we try to get an unpatched version of this from a sandboxed iframe.\n */\n\nconst cachedImplementations = {};\n\n/**\n * Get the native implementation of a browser function.\n *\n * This can be used to ensure we get an unwrapped version of a function, in cases where a wrapped function can lead to problems.\n *\n * The following methods can be retrieved:\n * - `setTimeout`: This can be wrapped by e.g. Angular, causing change detection to be triggered.\n * - `fetch`: This can be wrapped by e.g. ad-blockers, causing an infinite loop when a request is blocked.\n */\nfunction getNativeImplementation(\n name,\n) {\n const cached = cachedImplementations[name];\n if (cached) {\n return cached;\n }\n\n let impl = WINDOW[name] ;\n\n // Fast path to avoid DOM I/O\n if (isNativeFunction(impl)) {\n return (cachedImplementations[name] = impl.bind(WINDOW) );\n }\n\n const document = WINDOW.document;\n // eslint-disable-next-line deprecation/deprecation\n if (document && typeof document.createElement === 'function') {\n try {\n const sandbox = document.createElement('iframe');\n sandbox.hidden = true;\n document.head.appendChild(sandbox);\n const contentWindow = sandbox.contentWindow;\n if (contentWindow && contentWindow[name]) {\n impl = contentWindow[name] ;\n }\n document.head.removeChild(sandbox);\n } catch (e) {\n // Could not create sandbox iframe, just use window.xxx\n DEBUG_BUILD && logger.warn(`Could not create sandbox iframe for ${name} check, bailing to window.${name}: `, e);\n }\n }\n\n // Sanity check: This _should_ not happen, but if it does, we just skip caching...\n // This can happen e.g. in tests where fetch may not be available in the env, or similar.\n if (!impl) {\n return impl;\n }\n\n return (cachedImplementations[name] = impl.bind(WINDOW) );\n}\n\n/** Clear a cached implementation. */\nfunction clearCachedImplementation(name) {\n cachedImplementations[name] = undefined;\n}\n\n/**\n * A special usecase for incorrectly wrapped Fetch APIs in conjunction with ad-blockers.\n * Whenever someone wraps the Fetch API and returns the wrong promise chain,\n * this chain becomes orphaned and there is no possible way to capture it's rejections\n * other than allowing it bubble up to this very handler. eg.\n *\n * const f = window.fetch;\n * window.fetch = function () {\n * const p = f.apply(this, arguments);\n *\n * p.then(function() {\n * console.log('hi.');\n * });\n *\n * return p;\n * }\n *\n * `p.then(function () { ... })` is producing a completely separate promise chain,\n * however, what's returned is `p` - the result of original `fetch` call.\n *\n * This mean, that whenever we use the Fetch API to send our own requests, _and_\n * some ad-blocker blocks it, this orphaned chain will _always_ reject,\n * effectively causing another event to be captured.\n * This makes a whole process become an infinite loop, which we need to somehow\n * deal with, and break it in one way or another.\n *\n * To deal with this issue, we are making sure that we _always_ use the real\n * browser Fetch API, instead of relying on what `window.fetch` exposes.\n * The only downside to this would be missing our own requests as breadcrumbs,\n * but because we are already not doing this, it should be just fine.\n *\n * Possible failed fetch error messages per-browser:\n *\n * Chrome: Failed to fetch\n * Edge: Failed to Fetch\n * Firefox: NetworkError when attempting to fetch resource\n * Safari: resource blocked by content blocker\n */\nfunction fetch(...rest) {\n return getNativeImplementation('fetch')(...rest);\n}\n\n/**\n * Get an unwrapped `setTimeout` method.\n * This ensures that even if e.g. Angular wraps `setTimeout`, we get the native implementation,\n * avoiding triggering change detection.\n */\nfunction setTimeout(...rest) {\n return getNativeImplementation('setTimeout')(...rest);\n}\n\nexport { clearCachedImplementation, fetch, getNativeImplementation, setTimeout };\n","// Intentionally keeping the key broad, as we don't know for sure what rate limit headers get returned from backend\n\nconst DEFAULT_RETRY_AFTER = 60 * 1000; // 60 seconds\n\n/**\n * Extracts Retry-After value from the request header or returns default value\n * @param header string representation of 'Retry-After' header\n * @param now current unix timestamp\n *\n */\nfunction parseRetryAfterHeader(header, now = Date.now()) {\n const headerDelay = parseInt(`${header}`, 10);\n if (!isNaN(headerDelay)) {\n return headerDelay * 1000;\n }\n\n const headerDate = Date.parse(`${header}`);\n if (!isNaN(headerDate)) {\n return headerDate - now;\n }\n\n return DEFAULT_RETRY_AFTER;\n}\n\n/**\n * Gets the time that the given category is disabled until for rate limiting.\n * In case no category-specific limit is set but a general rate limit across all categories is active,\n * that time is returned.\n *\n * @return the time in ms that the category is disabled until or 0 if there's no active rate limit.\n */\nfunction disabledUntil(limits, dataCategory) {\n return limits[dataCategory] || limits.all || 0;\n}\n\n/**\n * Checks if a category is rate limited\n */\nfunction isRateLimited(limits, dataCategory, now = Date.now()) {\n return disabledUntil(limits, dataCategory) > now;\n}\n\n/**\n * Update ratelimits from incoming headers.\n *\n * @return the updated RateLimits object.\n */\nfunction updateRateLimits(\n limits,\n { statusCode, headers },\n now = Date.now(),\n) {\n const updatedRateLimits = {\n ...limits,\n };\n\n // \"The name is case-insensitive.\"\n // https://developer.mozilla.org/en-US/docs/Web/API/Headers/get\n const rateLimitHeader = headers && headers['x-sentry-rate-limits'];\n const retryAfterHeader = headers && headers['retry-after'];\n\n if (rateLimitHeader) {\n /**\n * rate limit headers are of the form\n *
,
,..\n * where each
is of the form\n * : : : : \n * where\n * is a delay in seconds\n * is the event type(s) (error, transaction, etc) being rate limited and is of the form\n * ;;...\n * is what's being limited (org, project, or key) - ignored by SDK\n * is an arbitrary string like \"org_quota\" - ignored by SDK\n * Semicolon-separated list of metric namespace identifiers. Defines which namespace(s) will be affected.\n * Only present if rate limit applies to the metric_bucket data category.\n */\n for (const limit of rateLimitHeader.trim().split(',')) {\n const [retryAfter, categories, , , namespaces] = limit.split(':', 5) ;\n const headerDelay = parseInt(retryAfter, 10);\n const delay = (!isNaN(headerDelay) ? headerDelay : 60) * 1000; // 60sec default\n if (!categories) {\n updatedRateLimits.all = now + delay;\n } else {\n for (const category of categories.split(';')) {\n if (category === 'metric_bucket') {\n // namespaces will be present when category === 'metric_bucket'\n if (!namespaces || namespaces.split(';').includes('custom')) {\n updatedRateLimits[category] = now + delay;\n }\n } else {\n updatedRateLimits[category] = now + delay;\n }\n }\n }\n }\n } else if (retryAfterHeader) {\n updatedRateLimits.all = now + parseRetryAfterHeader(retryAfterHeader, now);\n } else if (statusCode === 429) {\n updatedRateLimits.all = now + 60 * 1000;\n }\n\n return updatedRateLimits;\n}\n\nexport { DEFAULT_RETRY_AFTER, disabledUntil, isRateLimited, parseRetryAfterHeader, updateRateLimits };\n","import { makePromiseBuffer, forEachEnvelopeItem, envelopeItemTypeToDataCategory, isRateLimited, resolvedSyncPromise, createEnvelope, SentryError, logger, serializeEnvelope, updateRateLimits } from '@sentry/utils';\nimport { DEBUG_BUILD } from '../debug-build.js';\n\nconst DEFAULT_TRANSPORT_BUFFER_SIZE = 64;\n\n/**\n * Creates an instance of a Sentry `Transport`\n *\n * @param options\n * @param makeRequest\n */\nfunction createTransport(\n options,\n makeRequest,\n buffer = makePromiseBuffer(\n options.bufferSize || DEFAULT_TRANSPORT_BUFFER_SIZE,\n ),\n) {\n let rateLimits = {};\n const flush = (timeout) => buffer.drain(timeout);\n\n function send(envelope) {\n const filteredEnvelopeItems = [];\n\n // Drop rate limited items from envelope\n forEachEnvelopeItem(envelope, (item, type) => {\n const dataCategory = envelopeItemTypeToDataCategory(type);\n if (isRateLimited(rateLimits, dataCategory)) {\n const event = getEventForEnvelopeItem(item, type);\n options.recordDroppedEvent('ratelimit_backoff', dataCategory, event);\n } else {\n filteredEnvelopeItems.push(item);\n }\n });\n\n // Skip sending if envelope is empty after filtering out rate limited events\n if (filteredEnvelopeItems.length === 0) {\n return resolvedSyncPromise({});\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const filteredEnvelope = createEnvelope(envelope[0], filteredEnvelopeItems );\n\n // Creates client report for each item in an envelope\n const recordEnvelopeLoss = (reason) => {\n forEachEnvelopeItem(filteredEnvelope, (item, type) => {\n const event = getEventForEnvelopeItem(item, type);\n options.recordDroppedEvent(reason, envelopeItemTypeToDataCategory(type), event);\n });\n };\n\n const requestTask = () =>\n makeRequest({ body: serializeEnvelope(filteredEnvelope) }).then(\n response => {\n // We don't want to throw on NOK responses, but we want to at least log them\n if (response.statusCode !== undefined && (response.statusCode < 200 || response.statusCode >= 300)) {\n DEBUG_BUILD && logger.warn(`Sentry responded with status code ${response.statusCode} to sent event.`);\n }\n\n rateLimits = updateRateLimits(rateLimits, response);\n return response;\n },\n error => {\n recordEnvelopeLoss('network_error');\n throw error;\n },\n );\n\n return buffer.add(requestTask).then(\n result => result,\n error => {\n if (error instanceof SentryError) {\n DEBUG_BUILD && logger.error('Skipped sending event because buffer is full.');\n recordEnvelopeLoss('queue_overflow');\n return resolvedSyncPromise({});\n } else {\n throw error;\n }\n },\n );\n }\n\n return {\n send,\n flush,\n };\n}\n\nfunction getEventForEnvelopeItem(item, type) {\n if (type !== 'event' && type !== 'transaction') {\n return undefined;\n }\n\n return Array.isArray(item) ? (item )[1] : undefined;\n}\n\nexport { DEFAULT_TRANSPORT_BUFFER_SIZE, createTransport };\n","import { SentryError } from './error.js';\nimport { rejectedSyncPromise, SyncPromise, resolvedSyncPromise } from './syncpromise.js';\n\n/**\n * Creates an new PromiseBuffer object with the specified limit\n * @param limit max number of promises that can be stored in the buffer\n */\nfunction makePromiseBuffer(limit) {\n const buffer = [];\n\n function isReady() {\n return limit === undefined || buffer.length < limit;\n }\n\n /**\n * Remove a promise from the queue.\n *\n * @param task Can be any PromiseLike\n * @returns Removed promise.\n */\n function remove(task) {\n return buffer.splice(buffer.indexOf(task), 1)[0] || Promise.resolve(undefined);\n }\n\n /**\n * Add a promise (representing an in-flight action) to the queue, and set it to remove itself on fulfillment.\n *\n * @param taskProducer A function producing any PromiseLike; In previous versions this used to be `task:\n * PromiseLike`, but under that model, Promises were instantly created on the call-site and their executor\n * functions therefore ran immediately. Thus, even if the buffer was full, the action still happened. By\n * requiring the promise to be wrapped in a function, we can defer promise creation until after the buffer\n * limit check.\n * @returns The original promise.\n */\n function add(taskProducer) {\n if (!isReady()) {\n return rejectedSyncPromise(new SentryError('Not adding Promise because buffer limit was reached.'));\n }\n\n // start the task and add its promise to the queue\n const task = taskProducer();\n if (buffer.indexOf(task) === -1) {\n buffer.push(task);\n }\n void task\n .then(() => remove(task))\n // Use `then(null, rejectionHandler)` rather than `catch(rejectionHandler)` so that we can use `PromiseLike`\n // rather than `Promise`. `PromiseLike` doesn't have a `.catch` method, making its polyfill smaller. (ES5 didn't\n // have promises, so TS has to polyfill when down-compiling.)\n .then(null, () =>\n remove(task).then(null, () => {\n // We have to add another catch here because `remove()` starts a new promise chain.\n }),\n );\n return task;\n }\n\n /**\n * Wait for all promises in the queue to resolve or for timeout to expire, whichever comes first.\n *\n * @param timeout The time, in ms, after which to resolve to `false` if the queue is still non-empty. Passing `0` (or\n * not passing anything) will make the promise wait as long as it takes for the queue to drain before resolving to\n * `true`.\n * @returns A promise which will resolve to `true` if the queue is already empty or drains before the timeout, and\n * `false` otherwise\n */\n function drain(timeout) {\n return new SyncPromise((resolve, reject) => {\n let counter = buffer.length;\n\n if (!counter) {\n return resolve(true);\n }\n\n // wait for `timeout` ms and then resolve to `false` (if not cancelled first)\n const capturedSetTimeout = setTimeout(() => {\n if (timeout && timeout > 0) {\n resolve(false);\n }\n }, timeout);\n\n // if all promises resolve in time, cancel the timer and resolve to `true`\n buffer.forEach(item => {\n void resolvedSyncPromise(item).then(() => {\n if (!--counter) {\n clearTimeout(capturedSetTimeout);\n resolve(true);\n }\n }, reject);\n });\n });\n }\n\n return {\n $: buffer,\n add,\n drain,\n };\n}\n\nexport { makePromiseBuffer };\n","import { getNativeImplementation, clearCachedImplementation } from '@sentry-internal/browser-utils';\nimport { createTransport } from '@sentry/core';\nimport { rejectedSyncPromise } from '@sentry/utils';\n\n/**\n * Creates a Transport that uses the Fetch API to send events to Sentry.\n */\nfunction makeFetchTransport(\n options,\n nativeFetch = getNativeImplementation('fetch'),\n) {\n let pendingBodySize = 0;\n let pendingCount = 0;\n\n function makeRequest(request) {\n const requestSize = request.body.length;\n pendingBodySize += requestSize;\n pendingCount++;\n\n const requestOptions = {\n body: request.body,\n method: 'POST',\n referrerPolicy: 'origin',\n headers: options.headers,\n // Outgoing requests are usually cancelled when navigating to a different page, causing a \"TypeError: Failed to\n // fetch\" error and sending a \"network_error\" client-outcome - in Chrome, the request status shows \"(cancelled)\".\n // The `keepalive` flag keeps outgoing requests alive, even when switching pages. We want this since we're\n // frequently sending events right before the user is switching pages (eg. whenfinishing navigation transactions).\n // Gotchas:\n // - `keepalive` isn't supported by Firefox\n // - As per spec (https://fetch.spec.whatwg.org/#http-network-or-cache-fetch):\n // If the sum of contentLength and inflightKeepaliveBytes is greater than 64 kibibytes, then return a network error.\n // We will therefore only activate the flag when we're below that limit.\n // There is also a limit of requests that can be open at the same time, so we also limit this to 15\n // See https://github.com/getsentry/sentry-javascript/pull/7553 for details\n keepalive: pendingBodySize <= 60000 && pendingCount < 15,\n ...options.fetchOptions,\n };\n\n if (!nativeFetch) {\n clearCachedImplementation('fetch');\n return rejectedSyncPromise('No fetch implementation available');\n }\n\n try {\n return nativeFetch(options.url, requestOptions).then(response => {\n pendingBodySize -= requestSize;\n pendingCount--;\n return {\n statusCode: response.status,\n headers: {\n 'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),\n 'retry-after': response.headers.get('Retry-After'),\n },\n };\n });\n } catch (e) {\n clearCachedImplementation('fetch');\n pendingBodySize -= requestSize;\n pendingCount--;\n return rejectedSyncPromise(e);\n }\n }\n\n return createTransport(options, makeRequest);\n}\n\nexport { makeFetchTransport };\n","import { DEBUG_BUILD } from './debug-build.js';\nimport { logger } from './logger.js';\nimport { GLOBAL_OBJ } from './worldwide.js';\n\nconst WINDOW = GLOBAL_OBJ ;\n\n/**\n * Tells whether current environment supports ErrorEvent objects\n * {@link supportsErrorEvent}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsErrorEvent() {\n try {\n new ErrorEvent('');\n return true;\n } catch (e) {\n return false;\n }\n}\n\n/**\n * Tells whether current environment supports DOMError objects\n * {@link supportsDOMError}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsDOMError() {\n try {\n // Chrome: VM89:1 Uncaught TypeError: Failed to construct 'DOMError':\n // 1 argument required, but only 0 present.\n // @ts-expect-error It really needs 1 argument, not 0.\n new DOMError('');\n return true;\n } catch (e) {\n return false;\n }\n}\n\n/**\n * Tells whether current environment supports DOMException objects\n * {@link supportsDOMException}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsDOMException() {\n try {\n new DOMException('');\n return true;\n } catch (e) {\n return false;\n }\n}\n\n/**\n * Tells whether current environment supports Fetch API\n * {@link supportsFetch}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsFetch() {\n if (!('fetch' in WINDOW)) {\n return false;\n }\n\n try {\n new Headers();\n new Request('http://www.example.com');\n new Response();\n return true;\n } catch (e) {\n return false;\n }\n}\n\n/**\n * isNative checks if the given function is a native implementation\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction isNativeFunction(func) {\n return func && /^function\\s+\\w+\\(\\)\\s+\\{\\s+\\[native code\\]\\s+\\}$/.test(func.toString());\n}\n\n/**\n * Tells whether current environment supports Fetch API natively\n * {@link supportsNativeFetch}.\n *\n * @returns true if `window.fetch` is natively implemented, false otherwise\n */\nfunction supportsNativeFetch() {\n if (typeof EdgeRuntime === 'string') {\n return true;\n }\n\n if (!supportsFetch()) {\n return false;\n }\n\n // Fast path to avoid DOM I/O\n // eslint-disable-next-line @typescript-eslint/unbound-method\n if (isNativeFunction(WINDOW.fetch)) {\n return true;\n }\n\n // window.fetch is implemented, but is polyfilled or already wrapped (e.g: by a chrome extension)\n // so create a \"pure\" iframe to see if that has native fetch\n let result = false;\n const doc = WINDOW.document;\n // eslint-disable-next-line deprecation/deprecation\n if (doc && typeof (doc.createElement ) === 'function') {\n try {\n const sandbox = doc.createElement('iframe');\n sandbox.hidden = true;\n doc.head.appendChild(sandbox);\n if (sandbox.contentWindow && sandbox.contentWindow.fetch) {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n result = isNativeFunction(sandbox.contentWindow.fetch);\n }\n doc.head.removeChild(sandbox);\n } catch (err) {\n DEBUG_BUILD &&\n logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', err);\n }\n }\n\n return result;\n}\n\n/**\n * Tells whether current environment supports ReportingObserver API\n * {@link supportsReportingObserver}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsReportingObserver() {\n return 'ReportingObserver' in WINDOW;\n}\n\n/**\n * Tells whether current environment supports Referrer Policy API\n * {@link supportsReferrerPolicy}.\n *\n * @returns Answer to the given question.\n */\nfunction supportsReferrerPolicy() {\n // Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default'\n // (see https://caniuse.com/#feat=referrer-policy),\n // it doesn't. And it throws an exception instead of ignoring this parameter...\n // REF: https://github.com/getsentry/raven-js/issues/1233\n\n if (!supportsFetch()) {\n return false;\n }\n\n try {\n new Request('_', {\n referrerPolicy: 'origin' ,\n });\n return true;\n } catch (e) {\n return false;\n }\n}\n\nexport { isNativeFunction, supportsDOMError, supportsDOMException, supportsErrorEvent, supportsFetch, supportsNativeFetch, supportsReferrerPolicy, supportsReportingObserver };\n","import { inboundFiltersIntegration, functionToStringIntegration, dedupeIntegration, getIntegrationsToSetup, initAndBind, getCurrentScope, lastEventId, getReportDialogEndpoint, startSession, captureSession, getClient } from '@sentry/core';\nimport { consoleSandbox, supportsFetch, logger, stackParserFromStackParserOptions } from '@sentry/utils';\nimport { addHistoryInstrumentationHandler } from '@sentry-internal/browser-utils';\nimport { BrowserClient } from './client.js';\nimport { DEBUG_BUILD } from './debug-build.js';\nimport { WINDOW } from './helpers.js';\nimport { breadcrumbsIntegration } from './integrations/breadcrumbs.js';\nimport { browserApiErrorsIntegration } from './integrations/browserapierrors.js';\nimport { globalHandlersIntegration } from './integrations/globalhandlers.js';\nimport { httpContextIntegration } from './integrations/httpcontext.js';\nimport { linkedErrorsIntegration } from './integrations/linkederrors.js';\nimport { defaultStackParser } from './stack-parsers.js';\nimport { makeFetchTransport } from './transports/fetch.js';\n\n/** Get the default integrations for the browser SDK. */\nfunction getDefaultIntegrations(_options) {\n /**\n * Note: Please make sure this stays in sync with Angular SDK, which re-exports\n * `getDefaultIntegrations` but with an adjusted set of integrations.\n */\n return [\n inboundFiltersIntegration(),\n functionToStringIntegration(),\n browserApiErrorsIntegration(),\n breadcrumbsIntegration(),\n globalHandlersIntegration(),\n linkedErrorsIntegration(),\n dedupeIntegration(),\n httpContextIntegration(),\n ];\n}\n\nfunction applyDefaultOptions(optionsArg = {}) {\n const defaultOptions = {\n defaultIntegrations: getDefaultIntegrations(),\n release:\n typeof __SENTRY_RELEASE__ === 'string' // This allows build tooling to find-and-replace __SENTRY_RELEASE__ to inject a release value\n ? __SENTRY_RELEASE__\n : WINDOW.SENTRY_RELEASE && WINDOW.SENTRY_RELEASE.id // This supports the variable that sentry-webpack-plugin injects\n ? WINDOW.SENTRY_RELEASE.id\n : undefined,\n autoSessionTracking: true,\n sendClientReports: true,\n };\n\n return { ...defaultOptions, ...optionsArg };\n}\n\nfunction shouldShowBrowserExtensionError() {\n const windowWithMaybeExtension = WINDOW ;\n\n const extensionKey = windowWithMaybeExtension.chrome ? 'chrome' : 'browser';\n const extensionObject = windowWithMaybeExtension[extensionKey];\n\n const runtimeId = extensionObject && extensionObject.runtime && extensionObject.runtime.id;\n const href = (WINDOW.location && WINDOW.location.href) || '';\n\n const extensionProtocols = ['chrome-extension:', 'moz-extension:', 'ms-browser-extension:'];\n\n // Running the SDK in a dedicated extension page and calling Sentry.init is fine; no risk of data leakage\n const isDedicatedExtensionPage =\n !!runtimeId && WINDOW === WINDOW.top && extensionProtocols.some(protocol => href.startsWith(`${protocol}//`));\n\n return !!runtimeId && !isDedicatedExtensionPage;\n}\n\n/**\n * A magic string that build tooling can leverage in order to inject a release value into the SDK.\n */\n\n/**\n * The Sentry Browser SDK Client.\n *\n * To use this SDK, call the {@link init} function as early as possible when\n * loading the web page. To set context information or send manual events, use\n * the provided methods.\n *\n * @example\n *\n * ```\n *\n * import { init } from '@sentry/browser';\n *\n * init({\n * dsn: '__DSN__',\n * // ...\n * });\n * ```\n *\n * @example\n * ```\n *\n * import { addBreadcrumb } from '@sentry/browser';\n * addBreadcrumb({\n * message: 'My Breadcrumb',\n * // ...\n * });\n * ```\n *\n * @example\n *\n * ```\n *\n * import * as Sentry from '@sentry/browser';\n * Sentry.captureMessage('Hello, world!');\n * Sentry.captureException(new Error('Good bye'));\n * Sentry.captureEvent({\n * message: 'Manual',\n * stacktrace: [\n * // ...\n * ],\n * });\n * ```\n *\n * @see {@link BrowserOptions} for documentation on configuration options.\n */\nfunction init(browserOptions = {}) {\n const options = applyDefaultOptions(browserOptions);\n\n if (shouldShowBrowserExtensionError()) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.error(\n '[Sentry] You cannot run Sentry this way in a browser extension, check: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/',\n );\n });\n return;\n }\n\n if (DEBUG_BUILD) {\n if (!supportsFetch()) {\n logger.warn(\n 'No Fetch API detected. The Sentry SDK requires a Fetch API compatible environment to send events. Please add a Fetch API polyfill.',\n );\n }\n }\n const clientOptions = {\n ...options,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations: getIntegrationsToSetup(options),\n transport: options.transport || makeFetchTransport,\n };\n\n const client = initAndBind(BrowserClient, clientOptions);\n\n if (options.autoSessionTracking) {\n startSessionTracking();\n }\n\n return client;\n}\n\n/**\n * All properties the report dialog supports\n */\n\n/**\n * Present the user with a report dialog.\n *\n * @param options Everything is optional, we try to fetch all info need from the global scope.\n */\nfunction showReportDialog(options = {}) {\n // doesn't work without a document (React Native)\n if (!WINDOW.document) {\n DEBUG_BUILD && logger.error('Global document not defined in showReportDialog call');\n return;\n }\n\n const scope = getCurrentScope();\n const client = scope.getClient();\n const dsn = client && client.getDsn();\n\n if (!dsn) {\n DEBUG_BUILD && logger.error('DSN not configured for showReportDialog call');\n return;\n }\n\n if (scope) {\n options.user = {\n ...scope.getUser(),\n ...options.user,\n };\n }\n\n if (!options.eventId) {\n const eventId = lastEventId();\n if (eventId) {\n options.eventId = eventId;\n }\n }\n\n const script = WINDOW.document.createElement('script');\n script.async = true;\n script.crossOrigin = 'anonymous';\n script.src = getReportDialogEndpoint(dsn, options);\n\n if (options.onLoad) {\n script.onload = options.onLoad;\n }\n\n const { onClose } = options;\n if (onClose) {\n const reportDialogClosedMessageHandler = (event) => {\n if (event.data === '__sentry_reportdialog_closed__') {\n try {\n onClose();\n } finally {\n WINDOW.removeEventListener('message', reportDialogClosedMessageHandler);\n }\n }\n };\n WINDOW.addEventListener('message', reportDialogClosedMessageHandler);\n }\n\n const injectionPoint = WINDOW.document.head || WINDOW.document.body;\n if (injectionPoint) {\n injectionPoint.appendChild(script);\n } else {\n DEBUG_BUILD && logger.error('Not injecting report dialog. No injection point found in HTML');\n }\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nfunction forceLoad() {\n // Noop\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nfunction onLoad(callback) {\n callback();\n}\n\n/**\n * Enable automatic Session Tracking for the initial page load.\n */\nfunction startSessionTracking() {\n if (typeof WINDOW.document === 'undefined') {\n DEBUG_BUILD && logger.warn('Session tracking in non-browser environment with @sentry/browser is not supported.');\n return;\n }\n\n // The session duration for browser sessions does not track a meaningful\n // concept that can be used as a metric.\n // Automatically captured sessions are akin to page views, and thus we\n // discard their duration.\n startSession({ ignoreDuration: true });\n captureSession();\n\n // We want to create a session for every navigation as well\n addHistoryInstrumentationHandler(({ from, to }) => {\n // Don't create an additional session for the initial route or if the location did not change\n if (from !== undefined && from !== to) {\n startSession({ ignoreDuration: true });\n captureSession();\n }\n });\n}\n\n/**\n * Captures user feedback and sends it to Sentry.\n *\n * @deprecated Use `captureFeedback` instead.\n */\nfunction captureUserFeedback(feedback) {\n const client = getClient();\n if (client) {\n // eslint-disable-next-line deprecation/deprecation\n client.captureUserFeedback(feedback);\n }\n}\n\nexport { captureUserFeedback, forceLoad, getDefaultIntegrations, init, onLoad, showReportDialog };\n","import { logger, consoleSandbox } from '@sentry/utils';\nimport { getCurrentScope } from './currentScopes.js';\nimport { DEBUG_BUILD } from './debug-build.js';\n\n/** A class object that can instantiate Client objects. */\n\n/**\n * Internal function to create a new SDK client instance. The client is\n * installed and then bound to the current scope.\n *\n * @param clientClass The client class to instantiate.\n * @param options Options to pass to the client.\n */\nfunction initAndBind(\n clientClass,\n options,\n) {\n if (options.debug === true) {\n if (DEBUG_BUILD) {\n logger.enable();\n } else {\n // use `console.warn` rather than `logger.warn` since by non-debug bundles have all `logger.x` statements stripped\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn('[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.');\n });\n }\n }\n const scope = getCurrentScope();\n scope.update(options.initialScope);\n\n const client = new clientClass(options);\n setCurrentClient(client);\n client.init();\n return client;\n}\n\n/**\n * Make the given client the current client.\n */\nfunction setCurrentClient(client) {\n getCurrentScope().setClient(client);\n}\n\nexport { initAndBind, setCurrentClient };\n","import * as Sentry from '@sentry/browser';\nimport { breadcrumbsIntegration, globalHandlersIntegration, linkedErrorsIntegration, httpContextIntegration, init as init$1, setContext, browserTracingIntegration as browserTracingIntegration$1, spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, getClient, startBrowserTracingNavigationSpan, startInactiveSpan, getCurrentScope, getActiveSpan, getRootSpan } from '@sentry/browser';\nexport * from '@sentry/browser';\nimport * as i0 from '@angular/core';\nimport { VERSION, Injectable, Inject, Directive, Input, NgModule } from '@angular/core';\nimport { inboundFiltersIntegration, functionToStringIntegration, dedupeIntegration, applySdkMetadata } from '@sentry/core';\nimport { logger, isString, stripUrlQueryAndFragment, timestampInSeconds } from '@sentry/utils';\nimport { HttpErrorResponse } from '@angular/common/http';\nimport * as i1 from '@angular/router';\nimport { NavigationStart, ResolveEnd, NavigationEnd, NavigationCancel, NavigationError } from '@angular/router';\nimport { Subscription } from 'rxjs';\nimport { filter, tap } from 'rxjs/operators';\n\n/*\n * This file defines flags and constants that can be modified during compile time in order to facilitate tree shaking\n * for users.\n *\n * We define \"magic strings\" like `__SENTRY_DEBUG__` that may get replaced with actual values during our, or the user's\n * build process. Take care when introducing new flags - they must not throw if they are not replaced. See the Debug\n * Build Flags section in CONTRIBUTING.md.\n */\n/** Flag that is true for debug builds, false otherwise. */\nconst IS_DEBUG_BUILD = typeof __SENTRY_DEBUG__ === 'undefined' ? true : __SENTRY_DEBUG__;\n\n/**\n * Get the default integrations for the Angular SDK.\n */\nfunction getDefaultIntegrations() {\n // Don't include the BrowserApiErrors integration as it interferes with the Angular SDK's `ErrorHandler`:\n // BrowserApiErrors would catch certain errors before they reach the `ErrorHandler` and\n // thus provide a lower fidelity error than what `SentryErrorHandler`\n // (see errorhandler.ts) would provide.\n //\n // see:\n // - https://github.com/getsentry/sentry-javascript/issues/5417#issuecomment-1453407097\n // - https://github.com/getsentry/sentry-javascript/issues/2744\n return [\n inboundFiltersIntegration(),\n functionToStringIntegration(),\n breadcrumbsIntegration(),\n globalHandlersIntegration(),\n linkedErrorsIntegration(),\n dedupeIntegration(),\n httpContextIntegration(),\n ];\n}\n/**\n * Inits the Angular SDK\n */\nfunction init(options) {\n const opts = {\n defaultIntegrations: getDefaultIntegrations(),\n ...options,\n };\n applySdkMetadata(opts, 'angular');\n checkAndSetAngularVersion();\n return init$1(opts);\n}\nfunction checkAndSetAngularVersion() {\n const ANGULAR_MINIMUM_VERSION = 14;\n const angularVersion = VERSION && VERSION.major ? parseInt(VERSION.major, 10) : undefined;\n if (angularVersion) {\n if (angularVersion < ANGULAR_MINIMUM_VERSION) {\n IS_DEBUG_BUILD &&\n logger.warn(`This Sentry SDK does not officially support Angular ${angularVersion}.`, `This SDK only supports Angular ${ANGULAR_MINIMUM_VERSION} and above.`, \"If you're using lower Angular versions, check the Angular Version Compatibility table in our docs: https://docs.sentry.io/platforms/javascript/guides/angular/#angular-version-compatibility.\", 'Otherwise, please consider upgrading your Angular version.');\n }\n setContext('angular', { version: angularVersion });\n }\n}\n\n// In Angular 17 and future versions, zoneless support is forthcoming.\n// Therefore, it's advisable to safely check whether the `run` function is\n// available in the `` context.\n// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\nconst isNgZoneEnabled = typeof Zone !== 'undefined' && Zone.root && Zone.root.run;\n/**\n * The function that does the same job as `NgZone.runOutsideAngular`.\n *\n * ⚠️ Note: All of the Sentry functionality called from inside the Angular\n * execution context must be wrapped in this function. Angular's rendering\n * relies on asynchronous tasks being scheduled within its execution context.\n * Since Sentry schedules tasks that do not interact with Angular's rendering,\n * it may prevent Angular from functioning reliably. Consequently, it may disrupt\n * processes such as server-side rendering or client-side hydration.\n */\nfunction runOutsideAngular(callback) {\n // Running the `callback` within the root execution context enables Angular\n // processes (such as SSR and hydration) to continue functioning normally without\n // timeouts and delays that could affect the user experience. This approach is\n // necessary because some of the Sentry functionality continues to run in the background.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return isNgZoneEnabled ? Zone.root.run(callback) : callback();\n}\n\n// https://github.com/angular/angular/blob/master/packages/core/src/util/errors.ts\nfunction tryToUnwrapZonejsError(error) {\n // TODO: once Angular14 is the minimum requirement ERROR_ORIGINAL_ERROR and\n // getOriginalError from error.ts can be used directly.\n return error && error.ngOriginalError\n ? error.ngOriginalError\n : error;\n}\nfunction extractHttpModuleError(error) {\n // The `error` property of http exception can be either an `Error` object, which we can use directly...\n if (isErrorOrErrorLikeObject(error.error)) {\n return error.error;\n }\n // ... or an`ErrorEvent`, which can provide us with the message but no stack...\n if (error.error instanceof ErrorEvent && error.error.message) {\n return error.error.message;\n }\n // ...or the request body itself, which we can use as a message instead.\n if (typeof error.error === 'string') {\n return `Server returned code ${error.status} with body \"${error.error}\"`;\n }\n // If we don't have any detailed information, fallback to the request message itself.\n return error.message;\n}\nfunction isErrorOrErrorLikeObject(value) {\n if (value instanceof Error) {\n return true;\n }\n if (value === null || typeof value !== 'object') {\n return false;\n }\n const candidate = value;\n return (isString(candidate.name) &&\n isString(candidate.message) &&\n (undefined === candidate.stack || isString(candidate.stack)));\n}\n/**\n * Implementation of Angular's ErrorHandler provider that can be used as a drop-in replacement for the stock one.\n */\nclass SentryErrorHandler {\n constructor(options) {\n this._registeredAfterSendEventHandler = false;\n this._options = {\n logErrors: true,\n ...options,\n };\n }\n /**\n * Method called for every value captured through the ErrorHandler\n */\n handleError(error) {\n const extractedError = this._extractError(error) || 'Handled unknown error';\n // Capture handled exception and send it to Sentry.\n const eventId = runOutsideAngular(() => Sentry.captureException(extractedError, {\n mechanism: { type: 'angular', handled: false },\n }));\n // When in development mode, log the error to console for immediate feedback.\n if (this._options.logErrors) {\n // eslint-disable-next-line no-console\n console.error(extractedError);\n }\n // Optionally show user dialog to provide details on what happened.\n if (this._options.showDialog) {\n const client = Sentry.getClient();\n if (client && !this._registeredAfterSendEventHandler) {\n client.on('afterSendEvent', (event) => {\n if (!event.type && event.event_id) {\n runOutsideAngular(() => {\n Sentry.showReportDialog({ ...this._options.dialogOptions, eventId: event.event_id });\n });\n }\n });\n // We only want to register this hook once in the lifetime of the error handler\n this._registeredAfterSendEventHandler = true;\n }\n else if (!client) {\n runOutsideAngular(() => {\n Sentry.showReportDialog({ ...this._options.dialogOptions, eventId });\n });\n }\n }\n }\n /**\n * Used to pull a desired value that will be used to capture an event out of the raw value captured by ErrorHandler.\n */\n _extractError(error) {\n // Allow custom overrides of extracting function\n if (this._options.extractor) {\n const defaultExtractor = this._defaultExtractor.bind(this);\n return this._options.extractor(error, defaultExtractor);\n }\n return this._defaultExtractor(error);\n }\n /**\n * Default implementation of error extraction that handles default error wrapping, HTTP responses, ErrorEvent and few other known cases.\n */\n _defaultExtractor(errorCandidate) {\n const error = tryToUnwrapZonejsError(errorCandidate);\n // If it's http module error, extract as much information from it as we can.\n if (error instanceof HttpErrorResponse) {\n return extractHttpModuleError(error);\n }\n // We can handle messages and Error objects directly.\n if (typeof error === 'string' || isErrorOrErrorLikeObject(error)) {\n return error;\n }\n // Nothing was extracted, fallback to default error message.\n return null;\n }\n}\nSentryErrorHandler.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"14.3.0\", ngImport: i0, type: SentryErrorHandler, deps: [{ token: 'errorHandlerOptions' }], target: i0.ɵɵFactoryTarget.Injectable });\nSentryErrorHandler.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"14.3.0\", ngImport: i0, type: SentryErrorHandler, providedIn: 'root' });\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"14.3.0\", ngImport: i0, type: SentryErrorHandler, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }], ctorParameters: function () { return [{ type: undefined, decorators: [{\n type: Inject,\n args: ['errorHandlerOptions']\n }] }]; } });\n/**\n * Factory function that creates an instance of a preconfigured ErrorHandler provider.\n */\nfunction createErrorHandler(config) {\n return new SentryErrorHandler(config);\n}\n\nconst ANGULAR_ROUTING_OP = 'ui.angular.routing';\nconst ANGULAR_INIT_OP = 'ui.angular.init';\nconst ANGULAR_OP = 'ui.angular';\n\nlet instrumentationInitialized;\n/**\n * A custom browser tracing integration for Angular.\n *\n * Use this integration in combination with `TraceService`\n */\nfunction browserTracingIntegration(options = {}) {\n // If the user opts out to set this up, we just don't initialize this.\n // That way, the TraceService will not actually do anything, functionally disabling this.\n if (options.instrumentNavigation !== false) {\n instrumentationInitialized = true;\n }\n return browserTracingIntegration$1({\n ...options,\n instrumentNavigation: false,\n });\n}\n/**\n * This function is extracted to make unit testing easier.\n */\nfunction _updateSpanAttributesForParametrizedUrl(route, span) {\n const attributes = (span && spanToJSON(span).data) || {};\n if (span && attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] === 'url') {\n span.updateName(route);\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, `auto.${spanToJSON(span).op}.angular`);\n }\n}\n/**\n * Angular's Service responsible for hooking into Angular Router and tracking current navigation process.\n * Creates a new transaction for every route change and measures a duration of routing process.\n */\nclass TraceService {\n constructor(_router) {\n this._router = _router;\n this.navStart$ = this._router.events.pipe(filter((event) => event instanceof NavigationStart), tap(navigationEvent => {\n if (!instrumentationInitialized) {\n IS_DEBUG_BUILD &&\n logger.error('Angular integration has tracing enabled, but Tracing integration is not configured');\n return;\n }\n if (this._routingSpan) {\n this._routingSpan.end();\n this._routingSpan = null;\n }\n const client = getClient();\n const strippedUrl = stripUrlQueryAndFragment(navigationEvent.url);\n if (client) {\n // see comment in `_isPageloadOngoing` for rationale\n if (!this._isPageloadOngoing()) {\n runOutsideAngular(() => {\n startBrowserTracingNavigationSpan(client, {\n name: strippedUrl,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.navigation.angular',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',\n },\n });\n });\n }\n else {\n // The first time we end up here, we set the pageload flag to false\n // Subsequent navigations are going to get their own navigation root span\n // even if the pageload root span is still ongoing.\n this._pageloadOngoing = false;\n }\n this._routingSpan =\n runOutsideAngular(() => startInactiveSpan({\n name: `${navigationEvent.url}`,\n op: ANGULAR_ROUTING_OP,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular',\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url',\n url: strippedUrl,\n ...(navigationEvent.navigationTrigger && {\n navigationTrigger: navigationEvent.navigationTrigger,\n }),\n },\n })) || null;\n return;\n }\n }));\n // The ResolveEnd event is fired when the Angular router has resolved the URL and\n // the parameter<->value mapping. It holds the new resolved router state with\n // the mapping and the new URL.\n // Only After this event, the route is activated, meaning that the transaction\n // can be updated with the parameterized route name before e.g. the route's root\n // component is initialized. This should be early enough before outgoing requests\n // are made from the new route, with the exceptions of requests being made during\n // a navigation.\n this.resEnd$ = this._router.events.pipe(filter((event) => event instanceof ResolveEnd), tap(event => {\n const route = getParameterizedRouteFromSnapshot(event.state.root);\n if (route) {\n getCurrentScope().setTransactionName(route);\n }\n const activeSpan = getActiveSpan();\n const rootSpan = activeSpan && getRootSpan(activeSpan);\n _updateSpanAttributesForParametrizedUrl(route, rootSpan);\n }));\n this.navEnd$ = this._router.events.pipe(filter(event => event instanceof NavigationEnd || event instanceof NavigationCancel || event instanceof NavigationError), tap(() => {\n if (this._routingSpan) {\n runOutsideAngular(() => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this._routingSpan.end();\n });\n this._routingSpan = null;\n }\n }));\n this._routingSpan = null;\n this._pageloadOngoing = true;\n this._subscription = new Subscription();\n this._subscription.add(this.navStart$.subscribe());\n this._subscription.add(this.resEnd$.subscribe());\n this._subscription.add(this.navEnd$.subscribe());\n }\n /**\n * This is used to prevent memory leaks when the root view is created and destroyed multiple times,\n * since `subscribe` callbacks capture `this` and prevent many resources from being GC'd.\n */\n ngOnDestroy() {\n this._subscription.unsubscribe();\n }\n /**\n * We only _avoid_ creating a navigation root span in one case:\n *\n * There is an ongoing pageload span AND the router didn't yet emit the first navigation start event\n *\n * The first navigation start event will create the child routing span\n * and update the pageload root span name on ResolveEnd.\n *\n * There's an edge case we need to avoid here: If the router fires the first navigation start event\n * _after_ the pageload root span finished. This is why we check for the pageload root span.\n * Possible real-world scenario: Angular application and/or router is bootstrapped after the pageload\n * idle root span finished\n *\n * The overall rationale is:\n * - if we already avoided creating a navigation root span once, we don't avoid it again\n * (i.e. set `_pageloadOngoing` to `false`)\n * - if `_pageloadOngoing` is already `false`, create a navigation root span\n * - if there's no active/pageload root span, create a navigation root span\n * - only if there's an ongoing pageload root span AND `_pageloadOngoing` is still `true,\n * don't create a navigation root span\n */\n _isPageloadOngoing() {\n if (!this._pageloadOngoing) {\n // pageload is already finished, no need to update\n return false;\n }\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n this._pageloadOngoing = false;\n return false;\n }\n const rootSpan = getRootSpan(activeSpan);\n this._pageloadOngoing = spanToJSON(rootSpan).op === 'pageload';\n return this._pageloadOngoing;\n }\n}\nTraceService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"14.3.0\", ngImport: i0, type: TraceService, deps: [{ token: i1.Router }], target: i0.ɵɵFactoryTarget.Injectable });\nTraceService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"14.3.0\", ngImport: i0, type: TraceService, providedIn: 'root' });\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"14.3.0\", ngImport: i0, type: TraceService, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }], ctorParameters: function () { return [{ type: i1.Router }]; } });\nconst UNKNOWN_COMPONENT = 'unknown';\n/**\n * A directive that can be used to capture initialization lifecycle of the whole component.\n */\nclass TraceDirective {\n /**\n * Implementation of OnInit lifecycle method\n * @inheritdoc\n */\n ngOnInit() {\n if (!this.componentName) {\n this.componentName = UNKNOWN_COMPONENT;\n }\n if (getActiveSpan()) {\n this._tracingSpan = runOutsideAngular(() => startInactiveSpan({\n name: `<${this.componentName}>`,\n op: ANGULAR_INIT_OP,\n attributes: { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_directive' },\n }));\n }\n }\n /**\n * Implementation of AfterViewInit lifecycle method\n * @inheritdoc\n */\n ngAfterViewInit() {\n if (this._tracingSpan) {\n runOutsideAngular(() => this._tracingSpan.end());\n }\n }\n}\nTraceDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"14.3.0\", ngImport: i0, type: TraceDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });\nTraceDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"14.3.0\", type: TraceDirective, selector: \"[trace]\", inputs: { componentName: [\"trace\", \"componentName\"] }, ngImport: i0 });\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"14.3.0\", ngImport: i0, type: TraceDirective, decorators: [{\n type: Directive,\n args: [{ selector: '[trace]' }]\n }], propDecorators: { componentName: [{\n type: Input,\n args: ['trace']\n }] } });\n/**\n * A module serves as a single compilation unit for the `TraceDirective` and can be re-used by any other module.\n */\nclass TraceModule {\n}\nTraceModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"14.3.0\", ngImport: i0, type: TraceModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });\nTraceModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"14.0.0\", version: \"14.3.0\", ngImport: i0, type: TraceModule, declarations: [TraceDirective], exports: [TraceDirective] });\nTraceModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"14.3.0\", ngImport: i0, type: TraceModule });\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"14.3.0\", ngImport: i0, type: TraceModule, decorators: [{\n type: NgModule,\n args: [{\n declarations: [TraceDirective],\n exports: [TraceDirective],\n }]\n }] });\n/**\n * Decorator function that can be used to capture initialization lifecycle of the whole component.\n */\nfunction TraceClass(options) {\n let tracingSpan;\n /* eslint-disable @typescript-eslint/no-unsafe-member-access */\n return target => {\n const originalOnInit = target.prototype.ngOnInit;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n target.prototype.ngOnInit = function (...args) {\n tracingSpan = runOutsideAngular(() => startInactiveSpan({\n onlyIfParent: true,\n name: `<${options && options.name ? options.name : 'unnamed'}>`,\n op: ANGULAR_INIT_OP,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_class_decorator',\n },\n }));\n if (originalOnInit) {\n return originalOnInit.apply(this, args);\n }\n };\n const originalAfterViewInit = target.prototype.ngAfterViewInit;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n target.prototype.ngAfterViewInit = function (...args) {\n if (tracingSpan) {\n runOutsideAngular(() => tracingSpan.end());\n }\n if (originalAfterViewInit) {\n return originalAfterViewInit.apply(this, args);\n }\n };\n };\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n}\n/**\n * Decorator function that can be used to capture a single lifecycle methods of the component.\n */\nfunction TraceMethod(options) {\n // eslint-disable-next-line @typescript-eslint/ban-types\n return (target, propertyKey, descriptor) => {\n const originalMethod = descriptor.value;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n descriptor.value = function (...args) {\n const now = timestampInSeconds();\n runOutsideAngular(() => {\n startInactiveSpan({\n onlyIfParent: true,\n name: `<${options && options.name ? options.name : 'unnamed'}>`,\n op: `${ANGULAR_OP}.${String(propertyKey)}`,\n startTime: now,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.angular.trace_method_decorator',\n },\n }).end(now);\n });\n if (originalMethod) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return originalMethod.apply(this, args);\n }\n };\n return descriptor;\n };\n}\n/**\n * Takes the parameterized route from a given ActivatedRouteSnapshot and concatenates the snapshot's\n * child route with its parent to produce the complete parameterized URL of the activated route.\n * This happens recursively until the last child (i.e. the end of the URL) is reached.\n *\n * @param route the ActivatedRouteSnapshot of which its path and its child's path is concatenated\n *\n * @returns the concatenated parameterized route string\n */\nfunction getParameterizedRouteFromSnapshot(route) {\n const parts = [];\n let currentRoute = route && route.firstChild;\n while (currentRoute) {\n const path = currentRoute && currentRoute.routeConfig && currentRoute.routeConfig.path;\n if (path === null || path === undefined) {\n break;\n }\n parts.push(path);\n currentRoute = currentRoute.firstChild;\n }\n const fullPath = parts.filter(part => part).join('/');\n return fullPath ? `/${fullPath}/` : '/';\n}\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { SentryErrorHandler, TraceClass, TraceDirective, TraceMethod, TraceModule, TraceService, browserTracingIntegration, createErrorHandler, getDefaultIntegrations, init };\n","import * as i0 from '@angular/core';\nimport { InjectionToken, PLATFORM_ID, Injectable, Inject, Optional, EventEmitter, Component, Input, HostBinding, Output, NgModule, forwardRef, Directive, HostListener } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { of, BehaviorSubject, Subject } from 'rxjs';\nimport { filter } from 'rxjs/operators';\nimport { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';\n\n/** @deprecated Use `LOADER_OPTIONS` instead. See `RecaptchaLoaderOptions.onBeforeLoad` */\nconst RECAPTCHA_LANGUAGE = new InjectionToken(\"recaptcha-language\");\n/** @deprecated Use `LOADER_OPTIONS` instead. See `RecaptchaLoaderOptions.onBeforeLoad` */\nconst RECAPTCHA_BASE_URL = new InjectionToken(\"recaptcha-base-url\");\n/** @deprecated Use `LOADER_OPTIONS` instead. See `RecaptchaLoaderOptions.onBeforeLoad` */\nconst RECAPTCHA_NONCE = new InjectionToken(\"recaptcha-nonce-tag\");\nconst RECAPTCHA_SETTINGS = new InjectionToken(\"recaptcha-settings\");\nconst RECAPTCHA_V3_SITE_KEY = new InjectionToken(\"recaptcha-v3-site-key\");\n/**\n * See the documentation for `RecaptchaLoaderOptions`.\n */\nconst RECAPTCHA_LOADER_OPTIONS = new InjectionToken(\"recaptcha-loader-options\");\n\nfunction loadScript(renderMode, onBeforeLoad, onLoaded, { url, lang, nonce } = {}) {\n window.ng2recaptchaloaded = () => {\n onLoaded(grecaptcha);\n };\n const script = document.createElement(\"script\");\n script.innerHTML = \"\";\n const { url: baseUrl, nonce: onBeforeLoadNonce } = onBeforeLoad(new URL(url || \"https://www.google.com/recaptcha/api.js\"));\n baseUrl.searchParams.set(\"render\", renderMode === \"explicit\" ? renderMode : renderMode.key);\n baseUrl.searchParams.set(\"onload\", \"ng2recaptchaloaded\");\n baseUrl.searchParams.set(\"trustedtypes\", \"true\");\n if (lang) {\n baseUrl.searchParams.set(\"hl\", lang);\n }\n script.src = baseUrl.href;\n const nonceValue = onBeforeLoadNonce || nonce;\n if (nonceValue) {\n script.setAttribute(\"nonce\", nonceValue);\n }\n script.async = true;\n script.defer = true;\n document.head.appendChild(script);\n}\nfunction newLoadScript({ v3SiteKey, onBeforeLoad, onLoaded, }) {\n const renderMode = v3SiteKey ? { key: v3SiteKey } : \"explicit\";\n loader.loadScript(renderMode, onBeforeLoad, onLoaded);\n}\nconst loader = { loadScript, newLoadScript };\n\nfunction toNonNullObservable(subject) {\n return subject.asObservable().pipe(filter((value) => value !== null));\n}\nclass RecaptchaLoaderService {\n /**\n * @internal\n * @nocollapse\n */\n static { this.ready = null; }\n constructor(\n // eslint-disable-next-line @typescript-eslint/ban-types\n platformId, \n // eslint-disable-next-line deprecation/deprecation\n language, \n // eslint-disable-next-line deprecation/deprecation\n baseUrl, \n // eslint-disable-next-line deprecation/deprecation\n nonce, v3SiteKey, options) {\n this.platformId = platformId;\n this.language = language;\n this.baseUrl = baseUrl;\n this.nonce = nonce;\n this.v3SiteKey = v3SiteKey;\n this.options = options;\n const subject = this.init();\n this.ready = subject ? toNonNullObservable(subject) : of();\n }\n /** @internal */\n init() {\n if (RecaptchaLoaderService.ready) {\n return RecaptchaLoaderService.ready;\n }\n if (!isPlatformBrowser(this.platformId)) {\n return undefined;\n }\n const subject = new BehaviorSubject(null);\n RecaptchaLoaderService.ready = subject;\n loader.newLoadScript({\n v3SiteKey: this.v3SiteKey,\n onBeforeLoad: (url) => {\n if (this.options?.onBeforeLoad) {\n return this.options.onBeforeLoad(url);\n }\n const newUrl = new URL(this.baseUrl ?? url);\n if (this.language) {\n newUrl.searchParams.set(\"hl\", this.language);\n }\n return {\n url: newUrl,\n nonce: this.nonce,\n };\n },\n onLoaded: (recaptcha) => {\n let value = recaptcha;\n if (this.options?.onLoaded) {\n value = this.options.onLoaded(recaptcha);\n }\n subject.next(value);\n },\n });\n return subject;\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaLoaderService, deps: [{ token: PLATFORM_ID }, { token: RECAPTCHA_LANGUAGE, optional: true }, { token: RECAPTCHA_BASE_URL, optional: true }, { token: RECAPTCHA_NONCE, optional: true }, { token: RECAPTCHA_V3_SITE_KEY, optional: true }, { token: RECAPTCHA_LOADER_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaLoaderService }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaLoaderService, decorators: [{\n type: Injectable\n }], ctorParameters: () => [{ type: Object, decorators: [{\n type: Inject,\n args: [PLATFORM_ID]\n }] }, { type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: [RECAPTCHA_LANGUAGE]\n }] }, { type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: [RECAPTCHA_BASE_URL]\n }] }, { type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: [RECAPTCHA_NONCE]\n }] }, { type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: [RECAPTCHA_V3_SITE_KEY]\n }] }, { type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: [RECAPTCHA_LOADER_OPTIONS]\n }] }] });\n\nlet nextId = 0;\nclass RecaptchaComponent {\n constructor(elementRef, loader, zone, settings) {\n this.elementRef = elementRef;\n this.loader = loader;\n this.zone = zone;\n this.id = `ngrecaptcha-${nextId++}`;\n this.errorMode = \"default\";\n this.resolved = new EventEmitter();\n /**\n * @deprecated `(error) output will be removed in the next major version. Use (errored) instead\n */\n // eslint-disable-next-line @angular-eslint/no-output-native\n this.error = new EventEmitter();\n this.errored = new EventEmitter();\n if (settings) {\n this.siteKey = settings.siteKey;\n this.theme = settings.theme;\n this.type = settings.type;\n this.size = settings.size;\n this.badge = settings.badge;\n }\n }\n ngAfterViewInit() {\n this.subscription = this.loader.ready.subscribe((grecaptcha) => {\n if (grecaptcha != null && grecaptcha.render instanceof Function) {\n this.grecaptcha = grecaptcha;\n this.renderRecaptcha();\n }\n });\n }\n ngOnDestroy() {\n // reset the captcha to ensure it does not leave anything behind\n // after the component is no longer needed\n this.grecaptchaReset();\n if (this.subscription) {\n this.subscription.unsubscribe();\n }\n }\n /**\n * Executes the invisible recaptcha.\n * Does nothing if component's size is not set to \"invisible\".\n */\n execute() {\n if (this.size !== \"invisible\") {\n return;\n }\n if (this.widget != null) {\n void this.grecaptcha.execute(this.widget);\n }\n else {\n // delay execution of recaptcha until it actually renders\n this.executeRequested = true;\n }\n }\n reset() {\n if (this.widget != null) {\n if (this.grecaptcha.getResponse(this.widget)) {\n // Only emit an event in case if something would actually change.\n // That way we do not trigger \"touching\" of the control if someone does a \"reset\"\n // on a non-resolved captcha.\n this.resolved.emit(null);\n }\n this.grecaptchaReset();\n }\n }\n /**\n * ⚠️ Warning! Use this property at your own risk!\n *\n * While this member is `public`, it is not a part of the component's public API.\n * The semantic versioning guarantees _will not be honored_! Thus, you might find that this property behavior changes in incompatible ways in minor or even patch releases.\n * You are **strongly advised** against using this property.\n * Instead, use more idiomatic ways to get reCAPTCHA value, such as `resolved` EventEmitter, or form-bound methods (ngModel, formControl, and the likes).å\n */\n get __unsafe_widgetValue() {\n return this.widget != null ? this.grecaptcha.getResponse(this.widget) : null;\n }\n /** @internal */\n expired() {\n this.resolved.emit(null);\n }\n /** @internal */\n onError(args) {\n // eslint-disable-next-line deprecation/deprecation\n this.error.emit(args);\n this.errored.emit(args);\n }\n /** @internal */\n captchaResponseCallback(response) {\n this.resolved.emit(response);\n }\n /** @internal */\n grecaptchaReset() {\n if (this.widget != null) {\n this.zone.runOutsideAngular(() => this.grecaptcha.reset(this.widget));\n }\n }\n /** @internal */\n renderRecaptcha() {\n // This `any` can be removed after @types/grecaptcha get updated\n const renderOptions = {\n badge: this.badge,\n callback: (response) => {\n this.zone.run(() => this.captchaResponseCallback(response));\n },\n \"expired-callback\": () => {\n this.zone.run(() => this.expired());\n },\n sitekey: this.siteKey,\n size: this.size,\n tabindex: this.tabIndex,\n theme: this.theme,\n type: this.type,\n };\n if (this.errorMode === \"handled\") {\n renderOptions[\"error-callback\"] = (...args) => {\n this.zone.run(() => this.onError(args));\n };\n }\n this.widget = this.grecaptcha.render(this.elementRef.nativeElement, renderOptions);\n if (this.executeRequested === true) {\n this.executeRequested = false;\n this.execute();\n }\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaComponent, deps: [{ token: i0.ElementRef }, { token: RecaptchaLoaderService }, { token: i0.NgZone }, { token: RECAPTCHA_SETTINGS, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }\n static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: \"14.0.0\", version: \"17.0.1\", type: RecaptchaComponent, selector: \"re-captcha\", inputs: { id: \"id\", siteKey: \"siteKey\", theme: \"theme\", type: \"type\", size: \"size\", tabIndex: \"tabIndex\", badge: \"badge\", errorMode: \"errorMode\" }, outputs: { resolved: \"resolved\", error: \"error\", errored: \"errored\" }, host: { properties: { \"attr.id\": \"this.id\" } }, exportAs: [\"reCaptcha\"], ngImport: i0, template: ``, isInline: true }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaComponent, decorators: [{\n type: Component,\n args: [{\n exportAs: \"reCaptcha\",\n selector: \"re-captcha\",\n template: ``,\n }]\n }], ctorParameters: () => [{ type: i0.ElementRef }, { type: RecaptchaLoaderService }, { type: i0.NgZone }, { type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: [RECAPTCHA_SETTINGS]\n }] }], propDecorators: { id: [{\n type: Input\n }, {\n type: HostBinding,\n args: [\"attr.id\"]\n }], siteKey: [{\n type: Input\n }], theme: [{\n type: Input\n }], type: [{\n type: Input\n }], size: [{\n type: Input\n }], tabIndex: [{\n type: Input\n }], badge: [{\n type: Input\n }], errorMode: [{\n type: Input\n }], resolved: [{\n type: Output\n }], error: [{\n type: Output\n }], errored: [{\n type: Output\n }] } });\n\nclass RecaptchaCommonModule {\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }\n static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"14.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaCommonModule, declarations: [RecaptchaComponent], exports: [RecaptchaComponent] }); }\n static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaCommonModule }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaCommonModule, decorators: [{\n type: NgModule,\n args: [{\n declarations: [RecaptchaComponent],\n exports: [RecaptchaComponent],\n }]\n }] });\n\nclass RecaptchaModule {\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }\n static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"14.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaModule, imports: [RecaptchaCommonModule], exports: [RecaptchaComponent] }); }\n static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaModule, providers: [RecaptchaLoaderService], imports: [RecaptchaCommonModule] }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaModule, decorators: [{\n type: NgModule,\n args: [{\n exports: [RecaptchaComponent],\n imports: [RecaptchaCommonModule],\n providers: [RecaptchaLoaderService],\n }]\n }] });\n\n/**\n * The main service for working with reCAPTCHA v3 APIs.\n *\n * Use the `execute` method for executing a single action, and\n * `onExecute` observable for listening to all actions at once.\n */\nclass ReCaptchaV3Service {\n constructor(zone, recaptchaLoader, siteKey) {\n this.recaptchaLoader = recaptchaLoader;\n this.zone = zone;\n this.siteKey = siteKey;\n this.init();\n }\n get onExecute() {\n if (!this.onExecuteSubject) {\n this.onExecuteSubject = new Subject();\n this.onExecuteObservable = this.onExecuteSubject.asObservable();\n }\n return this.onExecuteObservable;\n }\n get onExecuteError() {\n if (!this.onExecuteErrorSubject) {\n this.onExecuteErrorSubject = new Subject();\n this.onExecuteErrorObservable = this.onExecuteErrorSubject.asObservable();\n }\n return this.onExecuteErrorObservable;\n }\n /**\n * Executes the provided `action` with reCAPTCHA v3 API.\n * Use the emitted token value for verification purposes on the backend.\n *\n * For more information about reCAPTCHA v3 actions and tokens refer to the official documentation at\n * https://developers.google.com/recaptcha/docs/v3.\n *\n * @param {string} action the action to execute\n * @returns {Observable} an `Observable` that will emit the reCAPTCHA v3 string `token` value whenever ready.\n * The returned `Observable` completes immediately after emitting a value.\n */\n execute(action) {\n const subject = new Subject();\n if (!this.grecaptcha) {\n if (!this.actionBacklog) {\n this.actionBacklog = [];\n }\n this.actionBacklog.push([action, subject]);\n }\n else {\n this.executeActionWithSubject(action, subject);\n }\n return subject.asObservable();\n }\n /** @internal */\n executeActionWithSubject(action, subject) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const onError = (error) => {\n this.zone.run(() => {\n subject.error(error);\n if (this.onExecuteErrorSubject) {\n // We don't know any better at this point, unfortunately, so have to resort to `any`\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n this.onExecuteErrorSubject.next({ action, error });\n }\n });\n };\n this.zone.runOutsideAngular(() => {\n try {\n this.grecaptcha.execute(this.siteKey, { action }).then((token) => {\n this.zone.run(() => {\n subject.next(token);\n subject.complete();\n if (this.onExecuteSubject) {\n this.onExecuteSubject.next({ action, token });\n }\n });\n }, onError);\n }\n catch (e) {\n onError(e);\n }\n });\n }\n /** @internal */\n init() {\n this.recaptchaLoader.ready.subscribe((value) => {\n this.grecaptcha = value;\n if (this.actionBacklog && this.actionBacklog.length > 0) {\n this.actionBacklog.forEach(([action, subject]) => this.executeActionWithSubject(action, subject));\n this.actionBacklog = undefined;\n }\n });\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: ReCaptchaV3Service, deps: [{ token: i0.NgZone }, { token: RecaptchaLoaderService }, { token: RECAPTCHA_V3_SITE_KEY }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: ReCaptchaV3Service }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: ReCaptchaV3Service, decorators: [{\n type: Injectable\n }], ctorParameters: () => [{ type: i0.NgZone }, { type: RecaptchaLoaderService }, { type: undefined, decorators: [{\n type: Inject,\n args: [RECAPTCHA_V3_SITE_KEY]\n }] }] });\n\nclass RecaptchaV3Module {\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaV3Module, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }\n static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"14.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaV3Module }); }\n static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaV3Module, providers: [ReCaptchaV3Service, RecaptchaLoaderService] }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaV3Module, decorators: [{\n type: NgModule,\n args: [{\n providers: [ReCaptchaV3Service, RecaptchaLoaderService],\n }]\n }] });\n\nclass RecaptchaValueAccessorDirective {\n constructor(host) {\n this.host = host;\n this.requiresControllerReset = false;\n }\n writeValue(value) {\n if (!value) {\n this.host.reset();\n }\n else {\n // In this case, it is most likely that a form controller has requested to write a specific value into the component.\n // This isn't really a supported case - reCAPTCHA values are single-use, and, in a sense, readonly.\n // What this means is that the form controller has recaptcha control state of X, while reCAPTCHA itself can't \"restore\"\n // to that state. In order to make form controller aware of this discrepancy, and to fix the said misalignment,\n // we'll be telling the controller to \"reset\" the value back to null.\n if (this.host.__unsafe_widgetValue !== value && Boolean(this.host.__unsafe_widgetValue) === false) {\n this.requiresControllerReset = true;\n }\n }\n }\n registerOnChange(fn) {\n this.onChange = fn;\n if (this.requiresControllerReset) {\n this.requiresControllerReset = false;\n this.onChange(null);\n }\n }\n registerOnTouched(fn) {\n this.onTouched = fn;\n }\n onResolve($event) {\n if (this.onChange) {\n this.onChange($event);\n }\n if (this.onTouched) {\n this.onTouched();\n }\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaValueAccessorDirective, deps: [{ token: RecaptchaComponent }], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"17.0.1\", type: RecaptchaValueAccessorDirective, selector: \"re-captcha[formControlName],re-captcha[formControl],re-captcha[ngModel]\", host: { listeners: { \"resolved\": \"onResolve($event)\" } }, providers: [\n {\n multi: true,\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => RecaptchaValueAccessorDirective),\n },\n ], ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaValueAccessorDirective, decorators: [{\n type: Directive,\n args: [{\n providers: [\n {\n multi: true,\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => RecaptchaValueAccessorDirective),\n },\n ],\n selector: \"re-captcha[formControlName],re-captcha[formControl],re-captcha[ngModel]\",\n }]\n }], ctorParameters: () => [{ type: RecaptchaComponent }], propDecorators: { onResolve: [{\n type: HostListener,\n args: [\"resolved\", [\"$event\"]]\n }] } });\n\nclass RecaptchaFormsModule {\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaFormsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }\n static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"14.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaFormsModule, declarations: [RecaptchaValueAccessorDirective], imports: [FormsModule, RecaptchaCommonModule], exports: [RecaptchaValueAccessorDirective] }); }\n static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaFormsModule, imports: [FormsModule, RecaptchaCommonModule] }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"17.0.1\", ngImport: i0, type: RecaptchaFormsModule, decorators: [{\n type: NgModule,\n args: [{\n declarations: [RecaptchaValueAccessorDirective],\n exports: [RecaptchaValueAccessorDirective],\n imports: [FormsModule, RecaptchaCommonModule],\n }]\n }] });\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { RECAPTCHA_BASE_URL, RECAPTCHA_LANGUAGE, RECAPTCHA_LOADER_OPTIONS, RECAPTCHA_NONCE, RECAPTCHA_SETTINGS, RECAPTCHA_V3_SITE_KEY, ReCaptchaV3Service, RecaptchaComponent, RecaptchaFormsModule, RecaptchaLoaderService, RecaptchaModule, RecaptchaV3Module, RecaptchaValueAccessorDirective };\n","/**\n * @license Angular v18.0.6\n * (c) 2010-2024 Google LLC. https://angular.io/\n * License: MIT\n */\n\nimport { ɵAnimationGroupPlayer, NoopAnimationPlayer, AUTO_STYLE, ɵPRE_STYLE, sequence, AnimationMetadataType, style } from '@angular/animations';\nimport * as i0 from '@angular/core';\nimport { ɵRuntimeError, Injectable } from '@angular/core';\n\nconst LINE_START = '\\n - ';\nfunction invalidTimingValue(exp) {\n return new ɵRuntimeError(3000 /* RuntimeErrorCode.INVALID_TIMING_VALUE */, ngDevMode && `The provided timing value \"${exp}\" is invalid.`);\n}\nfunction negativeStepValue() {\n return new ɵRuntimeError(3100 /* RuntimeErrorCode.NEGATIVE_STEP_VALUE */, ngDevMode && 'Duration values below 0 are not allowed for this animation step.');\n}\nfunction negativeDelayValue() {\n return new ɵRuntimeError(3101 /* RuntimeErrorCode.NEGATIVE_DELAY_VALUE */, ngDevMode && 'Delay values below 0 are not allowed for this animation step.');\n}\nfunction invalidStyleParams(varName) {\n return new ɵRuntimeError(3001 /* RuntimeErrorCode.INVALID_STYLE_PARAMS */, ngDevMode &&\n `Unable to resolve the local animation param ${varName} in the given list of values`);\n}\nfunction invalidParamValue(varName) {\n return new ɵRuntimeError(3003 /* RuntimeErrorCode.INVALID_PARAM_VALUE */, ngDevMode && `Please provide a value for the animation param ${varName}`);\n}\nfunction invalidNodeType(nodeType) {\n return new ɵRuntimeError(3004 /* RuntimeErrorCode.INVALID_NODE_TYPE */, ngDevMode && `Unable to resolve animation metadata node #${nodeType}`);\n}\nfunction invalidCssUnitValue(userProvidedProperty, value) {\n return new ɵRuntimeError(3005 /* RuntimeErrorCode.INVALID_CSS_UNIT_VALUE */, ngDevMode && `Please provide a CSS unit value for ${userProvidedProperty}:${value}`);\n}\nfunction invalidTrigger() {\n return new ɵRuntimeError(3006 /* RuntimeErrorCode.INVALID_TRIGGER */, ngDevMode &&\n \"animation triggers cannot be prefixed with an `@` sign (e.g. trigger('@foo', [...]))\");\n}\nfunction invalidDefinition() {\n return new ɵRuntimeError(3007 /* RuntimeErrorCode.INVALID_DEFINITION */, ngDevMode && 'only state() and transition() definitions can sit inside of a trigger()');\n}\nfunction invalidState(metadataName, missingSubs) {\n return new ɵRuntimeError(3008 /* RuntimeErrorCode.INVALID_STATE */, ngDevMode &&\n `state(\"${metadataName}\", ...) must define default values for all the following style substitutions: ${missingSubs.join(', ')}`);\n}\nfunction invalidStyleValue(value) {\n return new ɵRuntimeError(3002 /* RuntimeErrorCode.INVALID_STYLE_VALUE */, ngDevMode && `The provided style string value ${value} is not allowed.`);\n}\nfunction invalidProperty(prop) {\n return new ɵRuntimeError(3009 /* RuntimeErrorCode.INVALID_PROPERTY */, ngDevMode &&\n `The provided animation property \"${prop}\" is not a supported CSS property for animations`);\n}\nfunction invalidParallelAnimation(prop, firstStart, firstEnd, secondStart, secondEnd) {\n return new ɵRuntimeError(3010 /* RuntimeErrorCode.INVALID_PARALLEL_ANIMATION */, ngDevMode &&\n `The CSS property \"${prop}\" that exists between the times of \"${firstStart}ms\" and \"${firstEnd}ms\" is also being animated in a parallel animation between the times of \"${secondStart}ms\" and \"${secondEnd}ms\"`);\n}\nfunction invalidKeyframes() {\n return new ɵRuntimeError(3011 /* RuntimeErrorCode.INVALID_KEYFRAMES */, ngDevMode && `keyframes() must be placed inside of a call to animate()`);\n}\nfunction invalidOffset() {\n return new ɵRuntimeError(3012 /* RuntimeErrorCode.INVALID_OFFSET */, ngDevMode && `Please ensure that all keyframe offsets are between 0 and 1`);\n}\nfunction keyframeOffsetsOutOfOrder() {\n return new ɵRuntimeError(3200 /* RuntimeErrorCode.KEYFRAME_OFFSETS_OUT_OF_ORDER */, ngDevMode && `Please ensure that all keyframe offsets are in order`);\n}\nfunction keyframesMissingOffsets() {\n return new ɵRuntimeError(3202 /* RuntimeErrorCode.KEYFRAMES_MISSING_OFFSETS */, ngDevMode && `Not all style() steps within the declared keyframes() contain offsets`);\n}\nfunction invalidStagger() {\n return new ɵRuntimeError(3013 /* RuntimeErrorCode.INVALID_STAGGER */, ngDevMode && `stagger() can only be used inside of query()`);\n}\nfunction invalidQuery(selector) {\n return new ɵRuntimeError(3014 /* RuntimeErrorCode.INVALID_QUERY */, ngDevMode &&\n `\\`query(\"${selector}\")\\` returned zero elements. (Use \\`query(\"${selector}\", { optional: true })\\` if you wish to allow this.)`);\n}\nfunction invalidExpression(expr) {\n return new ɵRuntimeError(3015 /* RuntimeErrorCode.INVALID_EXPRESSION */, ngDevMode && `The provided transition expression \"${expr}\" is not supported`);\n}\nfunction invalidTransitionAlias(alias) {\n return new ɵRuntimeError(3016 /* RuntimeErrorCode.INVALID_TRANSITION_ALIAS */, ngDevMode && `The transition alias value \"${alias}\" is not supported`);\n}\nfunction validationFailed(errors) {\n return new ɵRuntimeError(3500 /* RuntimeErrorCode.VALIDATION_FAILED */, ngDevMode && `animation validation failed:\\n${errors.map((err) => err.message).join('\\n')}`);\n}\nfunction buildingFailed(errors) {\n return new ɵRuntimeError(3501 /* RuntimeErrorCode.BUILDING_FAILED */, ngDevMode && `animation building failed:\\n${errors.map((err) => err.message).join('\\n')}`);\n}\nfunction triggerBuildFailed(name, errors) {\n return new ɵRuntimeError(3404 /* RuntimeErrorCode.TRIGGER_BUILD_FAILED */, ngDevMode &&\n `The animation trigger \"${name}\" has failed to build due to the following errors:\\n - ${errors\n .map((err) => err.message)\n .join('\\n - ')}`);\n}\nfunction animationFailed(errors) {\n return new ɵRuntimeError(3502 /* RuntimeErrorCode.ANIMATION_FAILED */, ngDevMode &&\n `Unable to animate due to the following errors:${LINE_START}${errors\n .map((err) => err.message)\n .join(LINE_START)}`);\n}\nfunction registerFailed(errors) {\n return new ɵRuntimeError(3503 /* RuntimeErrorCode.REGISTRATION_FAILED */, ngDevMode &&\n `Unable to build the animation due to the following errors: ${errors\n .map((err) => err.message)\n .join('\\n')}`);\n}\nfunction missingOrDestroyedAnimation() {\n return new ɵRuntimeError(3300 /* RuntimeErrorCode.MISSING_OR_DESTROYED_ANIMATION */, ngDevMode && \"The requested animation doesn't exist or has already been destroyed\");\n}\nfunction createAnimationFailed(errors) {\n return new ɵRuntimeError(3504 /* RuntimeErrorCode.CREATE_ANIMATION_FAILED */, ngDevMode &&\n `Unable to create the animation due to the following errors:${errors\n .map((err) => err.message)\n .join('\\n')}`);\n}\nfunction missingPlayer(id) {\n return new ɵRuntimeError(3301 /* RuntimeErrorCode.MISSING_PLAYER */, ngDevMode && `Unable to find the timeline player referenced by ${id}`);\n}\nfunction missingTrigger(phase, name) {\n return new ɵRuntimeError(3302 /* RuntimeErrorCode.MISSING_TRIGGER */, ngDevMode &&\n `Unable to listen on the animation trigger event \"${phase}\" because the animation trigger \"${name}\" doesn\\'t exist!`);\n}\nfunction missingEvent(name) {\n return new ɵRuntimeError(3303 /* RuntimeErrorCode.MISSING_EVENT */, ngDevMode &&\n `Unable to listen on the animation trigger \"${name}\" because the provided event is undefined!`);\n}\nfunction unsupportedTriggerEvent(phase, name) {\n return new ɵRuntimeError(3400 /* RuntimeErrorCode.UNSUPPORTED_TRIGGER_EVENT */, ngDevMode &&\n `The provided animation trigger event \"${phase}\" for the animation trigger \"${name}\" is not supported!`);\n}\nfunction unregisteredTrigger(name) {\n return new ɵRuntimeError(3401 /* RuntimeErrorCode.UNREGISTERED_TRIGGER */, ngDevMode && `The provided animation trigger \"${name}\" has not been registered!`);\n}\nfunction triggerTransitionsFailed(errors) {\n return new ɵRuntimeError(3402 /* RuntimeErrorCode.TRIGGER_TRANSITIONS_FAILED */, ngDevMode &&\n `Unable to process animations due to the following failed trigger transitions\\n ${errors\n .map((err) => err.message)\n .join('\\n')}`);\n}\nfunction triggerParsingFailed(name, errors) {\n return new ɵRuntimeError(3403 /* RuntimeErrorCode.TRIGGER_PARSING_FAILED */, ngDevMode &&\n `Animation parsing for the ${name} trigger have failed:${LINE_START}${errors\n .map((err) => err.message)\n .join(LINE_START)}`);\n}\nfunction transitionFailed(name, errors) {\n return new ɵRuntimeError(3505 /* RuntimeErrorCode.TRANSITION_FAILED */, ngDevMode && `@${name} has failed due to:\\n ${errors.map((err) => err.message).join('\\n- ')}`);\n}\n\n/**\n * Set of all animatable CSS properties\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animated_properties\n */\nconst ANIMATABLE_PROP_SET = new Set([\n '-moz-outline-radius',\n '-moz-outline-radius-bottomleft',\n '-moz-outline-radius-bottomright',\n '-moz-outline-radius-topleft',\n '-moz-outline-radius-topright',\n '-ms-grid-columns',\n '-ms-grid-rows',\n '-webkit-line-clamp',\n '-webkit-text-fill-color',\n '-webkit-text-stroke',\n '-webkit-text-stroke-color',\n 'accent-color',\n 'all',\n 'backdrop-filter',\n 'background',\n 'background-color',\n 'background-position',\n 'background-size',\n 'block-size',\n 'border',\n 'border-block-end',\n 'border-block-end-color',\n 'border-block-end-width',\n 'border-block-start',\n 'border-block-start-color',\n 'border-block-start-width',\n 'border-bottom',\n 'border-bottom-color',\n 'border-bottom-left-radius',\n 'border-bottom-right-radius',\n 'border-bottom-width',\n 'border-color',\n 'border-end-end-radius',\n 'border-end-start-radius',\n 'border-image-outset',\n 'border-image-slice',\n 'border-image-width',\n 'border-inline-end',\n 'border-inline-end-color',\n 'border-inline-end-width',\n 'border-inline-start',\n 'border-inline-start-color',\n 'border-inline-start-width',\n 'border-left',\n 'border-left-color',\n 'border-left-width',\n 'border-radius',\n 'border-right',\n 'border-right-color',\n 'border-right-width',\n 'border-start-end-radius',\n 'border-start-start-radius',\n 'border-top',\n 'border-top-color',\n 'border-top-left-radius',\n 'border-top-right-radius',\n 'border-top-width',\n 'border-width',\n 'bottom',\n 'box-shadow',\n 'caret-color',\n 'clip',\n 'clip-path',\n 'color',\n 'column-count',\n 'column-gap',\n 'column-rule',\n 'column-rule-color',\n 'column-rule-width',\n 'column-width',\n 'columns',\n 'filter',\n 'flex',\n 'flex-basis',\n 'flex-grow',\n 'flex-shrink',\n 'font',\n 'font-size',\n 'font-size-adjust',\n 'font-stretch',\n 'font-variation-settings',\n 'font-weight',\n 'gap',\n 'grid-column-gap',\n 'grid-gap',\n 'grid-row-gap',\n 'grid-template-columns',\n 'grid-template-rows',\n 'height',\n 'inline-size',\n 'input-security',\n 'inset',\n 'inset-block',\n 'inset-block-end',\n 'inset-block-start',\n 'inset-inline',\n 'inset-inline-end',\n 'inset-inline-start',\n 'left',\n 'letter-spacing',\n 'line-clamp',\n 'line-height',\n 'margin',\n 'margin-block-end',\n 'margin-block-start',\n 'margin-bottom',\n 'margin-inline-end',\n 'margin-inline-start',\n 'margin-left',\n 'margin-right',\n 'margin-top',\n 'mask',\n 'mask-border',\n 'mask-position',\n 'mask-size',\n 'max-block-size',\n 'max-height',\n 'max-inline-size',\n 'max-lines',\n 'max-width',\n 'min-block-size',\n 'min-height',\n 'min-inline-size',\n 'min-width',\n 'object-position',\n 'offset',\n 'offset-anchor',\n 'offset-distance',\n 'offset-path',\n 'offset-position',\n 'offset-rotate',\n 'opacity',\n 'order',\n 'outline',\n 'outline-color',\n 'outline-offset',\n 'outline-width',\n 'padding',\n 'padding-block-end',\n 'padding-block-start',\n 'padding-bottom',\n 'padding-inline-end',\n 'padding-inline-start',\n 'padding-left',\n 'padding-right',\n 'padding-top',\n 'perspective',\n 'perspective-origin',\n 'right',\n 'rotate',\n 'row-gap',\n 'scale',\n 'scroll-margin',\n 'scroll-margin-block',\n 'scroll-margin-block-end',\n 'scroll-margin-block-start',\n 'scroll-margin-bottom',\n 'scroll-margin-inline',\n 'scroll-margin-inline-end',\n 'scroll-margin-inline-start',\n 'scroll-margin-left',\n 'scroll-margin-right',\n 'scroll-margin-top',\n 'scroll-padding',\n 'scroll-padding-block',\n 'scroll-padding-block-end',\n 'scroll-padding-block-start',\n 'scroll-padding-bottom',\n 'scroll-padding-inline',\n 'scroll-padding-inline-end',\n 'scroll-padding-inline-start',\n 'scroll-padding-left',\n 'scroll-padding-right',\n 'scroll-padding-top',\n 'scroll-snap-coordinate',\n 'scroll-snap-destination',\n 'scrollbar-color',\n 'shape-image-threshold',\n 'shape-margin',\n 'shape-outside',\n 'tab-size',\n 'text-decoration',\n 'text-decoration-color',\n 'text-decoration-thickness',\n 'text-emphasis',\n 'text-emphasis-color',\n 'text-indent',\n 'text-shadow',\n 'text-underline-offset',\n 'top',\n 'transform',\n 'transform-origin',\n 'translate',\n 'vertical-align',\n 'visibility',\n 'width',\n 'word-spacing',\n 'z-index',\n 'zoom',\n]);\n\nfunction optimizeGroupPlayer(players) {\n switch (players.length) {\n case 0:\n return new NoopAnimationPlayer();\n case 1:\n return players[0];\n default:\n return new ɵAnimationGroupPlayer(players);\n }\n}\nfunction normalizeKeyframes$1(normalizer, keyframes, preStyles = new Map(), postStyles = new Map()) {\n const errors = [];\n const normalizedKeyframes = [];\n let previousOffset = -1;\n let previousKeyframe = null;\n keyframes.forEach((kf) => {\n const offset = kf.get('offset');\n const isSameOffset = offset == previousOffset;\n const normalizedKeyframe = (isSameOffset && previousKeyframe) || new Map();\n kf.forEach((val, prop) => {\n let normalizedProp = prop;\n let normalizedValue = val;\n if (prop !== 'offset') {\n normalizedProp = normalizer.normalizePropertyName(normalizedProp, errors);\n switch (normalizedValue) {\n case ɵPRE_STYLE:\n normalizedValue = preStyles.get(prop);\n break;\n case AUTO_STYLE:\n normalizedValue = postStyles.get(prop);\n break;\n default:\n normalizedValue = normalizer.normalizeStyleValue(prop, normalizedProp, normalizedValue, errors);\n break;\n }\n }\n normalizedKeyframe.set(normalizedProp, normalizedValue);\n });\n if (!isSameOffset) {\n normalizedKeyframes.push(normalizedKeyframe);\n }\n previousKeyframe = normalizedKeyframe;\n previousOffset = offset;\n });\n if (errors.length) {\n throw animationFailed(errors);\n }\n return normalizedKeyframes;\n}\nfunction listenOnPlayer(player, eventName, event, callback) {\n switch (eventName) {\n case 'start':\n player.onStart(() => callback(event && copyAnimationEvent(event, 'start', player)));\n break;\n case 'done':\n player.onDone(() => callback(event && copyAnimationEvent(event, 'done', player)));\n break;\n case 'destroy':\n player.onDestroy(() => callback(event && copyAnimationEvent(event, 'destroy', player)));\n break;\n }\n}\nfunction copyAnimationEvent(e, phaseName, player) {\n const totalTime = player.totalTime;\n const disabled = player.disabled ? true : false;\n const event = makeAnimationEvent(e.element, e.triggerName, e.fromState, e.toState, phaseName || e.phaseName, totalTime == undefined ? e.totalTime : totalTime, disabled);\n const data = e['_data'];\n if (data != null) {\n event['_data'] = data;\n }\n return event;\n}\nfunction makeAnimationEvent(element, triggerName, fromState, toState, phaseName = '', totalTime = 0, disabled) {\n return { element, triggerName, fromState, toState, phaseName, totalTime, disabled: !!disabled };\n}\nfunction getOrSetDefaultValue(map, key, defaultValue) {\n let value = map.get(key);\n if (!value) {\n map.set(key, (value = defaultValue));\n }\n return value;\n}\nfunction parseTimelineCommand(command) {\n const separatorPos = command.indexOf(':');\n const id = command.substring(1, separatorPos);\n const action = command.slice(separatorPos + 1);\n return [id, action];\n}\nconst documentElement = /* @__PURE__ */ (() => typeof document === 'undefined' ? null : document.documentElement)();\nfunction getParentElement(element) {\n const parent = element.parentNode || element.host || null; // consider host to support shadow DOM\n if (parent === documentElement) {\n return null;\n }\n return parent;\n}\nfunction containsVendorPrefix(prop) {\n // Webkit is the only real popular vendor prefix nowadays\n // cc: http://shouldiprefix.com/\n return prop.substring(1, 6) == 'ebkit'; // webkit or Webkit\n}\nlet _CACHED_BODY = null;\nlet _IS_WEBKIT = false;\nfunction validateStyleProperty(prop) {\n if (!_CACHED_BODY) {\n _CACHED_BODY = getBodyNode() || {};\n _IS_WEBKIT = _CACHED_BODY.style ? 'WebkitAppearance' in _CACHED_BODY.style : false;\n }\n let result = true;\n if (_CACHED_BODY.style && !containsVendorPrefix(prop)) {\n result = prop in _CACHED_BODY.style;\n if (!result && _IS_WEBKIT) {\n const camelProp = 'Webkit' + prop.charAt(0).toUpperCase() + prop.slice(1);\n result = camelProp in _CACHED_BODY.style;\n }\n }\n return result;\n}\nfunction validateWebAnimatableStyleProperty(prop) {\n return ANIMATABLE_PROP_SET.has(prop);\n}\nfunction getBodyNode() {\n if (typeof document != 'undefined') {\n return document.body;\n }\n return null;\n}\nfunction containsElement(elm1, elm2) {\n while (elm2) {\n if (elm2 === elm1) {\n return true;\n }\n elm2 = getParentElement(elm2);\n }\n return false;\n}\nfunction invokeQuery(element, selector, multi) {\n if (multi) {\n return Array.from(element.querySelectorAll(selector));\n }\n const elem = element.querySelector(selector);\n return elem ? [elem] : [];\n}\nfunction hypenatePropsKeys(original) {\n const newMap = new Map();\n original.forEach((val, prop) => {\n const newProp = prop.replace(/([a-z])([A-Z])/g, '$1-$2');\n newMap.set(newProp, val);\n });\n return newMap;\n}\n\n/**\n * @publicApi\n *\n * `AnimationDriver` implentation for Noop animations\n */\nclass NoopAnimationDriver {\n /**\n * @returns Whether `prop` is a valid CSS property\n */\n validateStyleProperty(prop) {\n return validateStyleProperty(prop);\n }\n /**\n *\n * @returns Whether elm1 contains elm2.\n */\n containsElement(elm1, elm2) {\n return containsElement(elm1, elm2);\n }\n /**\n * @returns Rhe parent of the given element or `null` if the element is the `document`\n */\n getParentElement(element) {\n return getParentElement(element);\n }\n /**\n * @returns The result of the query selector on the element. The array will contain up to 1 item\n * if `multi` is `false`.\n */\n query(element, selector, multi) {\n return invokeQuery(element, selector, multi);\n }\n /**\n * @returns The `defaultValue` or empty string\n */\n computeStyle(element, prop, defaultValue) {\n return defaultValue || '';\n }\n /**\n * @returns An `NoopAnimationPlayer`\n */\n animate(element, keyframes, duration, delay, easing, previousPlayers = [], scrubberAccessRequested) {\n return new NoopAnimationPlayer(duration, delay);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NoopAnimationDriver, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NoopAnimationDriver }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NoopAnimationDriver, decorators: [{\n type: Injectable\n }] });\n/**\n * @publicApi\n */\nclass AnimationDriver {\n /**\n * @deprecated Use the NoopAnimationDriver class.\n */\n static { this.NOOP = new NoopAnimationDriver(); }\n}\n\nclass AnimationStyleNormalizer {\n}\nclass NoopAnimationStyleNormalizer {\n normalizePropertyName(propertyName, errors) {\n return propertyName;\n }\n normalizeStyleValue(userProvidedProperty, normalizedProperty, value, errors) {\n return value;\n }\n}\n\nconst ONE_SECOND = 1000;\nconst SUBSTITUTION_EXPR_START = '{{';\nconst SUBSTITUTION_EXPR_END = '}}';\nconst ENTER_CLASSNAME = 'ng-enter';\nconst LEAVE_CLASSNAME = 'ng-leave';\nconst NG_TRIGGER_CLASSNAME = 'ng-trigger';\nconst NG_TRIGGER_SELECTOR = '.ng-trigger';\nconst NG_ANIMATING_CLASSNAME = 'ng-animating';\nconst NG_ANIMATING_SELECTOR = '.ng-animating';\nfunction resolveTimingValue(value) {\n if (typeof value == 'number')\n return value;\n const matches = value.match(/^(-?[\\.\\d]+)(m?s)/);\n if (!matches || matches.length < 2)\n return 0;\n return _convertTimeValueToMS(parseFloat(matches[1]), matches[2]);\n}\nfunction _convertTimeValueToMS(value, unit) {\n switch (unit) {\n case 's':\n return value * ONE_SECOND;\n default: // ms or something else\n return value;\n }\n}\nfunction resolveTiming(timings, errors, allowNegativeValues) {\n return timings.hasOwnProperty('duration')\n ? timings\n : parseTimeExpression(timings, errors, allowNegativeValues);\n}\nfunction parseTimeExpression(exp, errors, allowNegativeValues) {\n const regex = /^(-?[\\.\\d]+)(m?s)(?:\\s+(-?[\\.\\d]+)(m?s))?(?:\\s+([-a-z]+(?:\\(.+?\\))?))?$/i;\n let duration;\n let delay = 0;\n let easing = '';\n if (typeof exp === 'string') {\n const matches = exp.match(regex);\n if (matches === null) {\n errors.push(invalidTimingValue(exp));\n return { duration: 0, delay: 0, easing: '' };\n }\n duration = _convertTimeValueToMS(parseFloat(matches[1]), matches[2]);\n const delayMatch = matches[3];\n if (delayMatch != null) {\n delay = _convertTimeValueToMS(parseFloat(delayMatch), matches[4]);\n }\n const easingVal = matches[5];\n if (easingVal) {\n easing = easingVal;\n }\n }\n else {\n duration = exp;\n }\n if (!allowNegativeValues) {\n let containsErrors = false;\n let startIndex = errors.length;\n if (duration < 0) {\n errors.push(negativeStepValue());\n containsErrors = true;\n }\n if (delay < 0) {\n errors.push(negativeDelayValue());\n containsErrors = true;\n }\n if (containsErrors) {\n errors.splice(startIndex, 0, invalidTimingValue(exp));\n }\n }\n return { duration, delay, easing };\n}\nfunction normalizeKeyframes(keyframes) {\n if (!keyframes.length) {\n return [];\n }\n if (keyframes[0] instanceof Map) {\n return keyframes;\n }\n return keyframes.map((kf) => new Map(Object.entries(kf)));\n}\nfunction normalizeStyles(styles) {\n return Array.isArray(styles) ? new Map(...styles) : new Map(styles);\n}\nfunction setStyles(element, styles, formerStyles) {\n styles.forEach((val, prop) => {\n const camelProp = dashCaseToCamelCase(prop);\n if (formerStyles && !formerStyles.has(prop)) {\n formerStyles.set(prop, element.style[camelProp]);\n }\n element.style[camelProp] = val;\n });\n}\nfunction eraseStyles(element, styles) {\n styles.forEach((_, prop) => {\n const camelProp = dashCaseToCamelCase(prop);\n element.style[camelProp] = '';\n });\n}\nfunction normalizeAnimationEntry(steps) {\n if (Array.isArray(steps)) {\n if (steps.length == 1)\n return steps[0];\n return sequence(steps);\n }\n return steps;\n}\nfunction validateStyleParams(value, options, errors) {\n const params = options.params || {};\n const matches = extractStyleParams(value);\n if (matches.length) {\n matches.forEach((varName) => {\n if (!params.hasOwnProperty(varName)) {\n errors.push(invalidStyleParams(varName));\n }\n });\n }\n}\nconst PARAM_REGEX = new RegExp(`${SUBSTITUTION_EXPR_START}\\\\s*(.+?)\\\\s*${SUBSTITUTION_EXPR_END}`, 'g');\nfunction extractStyleParams(value) {\n let params = [];\n if (typeof value === 'string') {\n let match;\n while ((match = PARAM_REGEX.exec(value))) {\n params.push(match[1]);\n }\n PARAM_REGEX.lastIndex = 0;\n }\n return params;\n}\nfunction interpolateParams(value, params, errors) {\n const original = `${value}`;\n const str = original.replace(PARAM_REGEX, (_, varName) => {\n let localVal = params[varName];\n // this means that the value was never overridden by the data passed in by the user\n if (localVal == null) {\n errors.push(invalidParamValue(varName));\n localVal = '';\n }\n return localVal.toString();\n });\n // we do this to assert that numeric values stay as they are\n return str == original ? value : str;\n}\nconst DASH_CASE_REGEXP = /-+([a-z0-9])/g;\nfunction dashCaseToCamelCase(input) {\n return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());\n}\nfunction camelCaseToDashCase(input) {\n return input.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n}\nfunction allowPreviousPlayerStylesMerge(duration, delay) {\n return duration === 0 || delay === 0;\n}\nfunction balancePreviousStylesIntoKeyframes(element, keyframes, previousStyles) {\n if (previousStyles.size && keyframes.length) {\n let startingKeyframe = keyframes[0];\n let missingStyleProps = [];\n previousStyles.forEach((val, prop) => {\n if (!startingKeyframe.has(prop)) {\n missingStyleProps.push(prop);\n }\n startingKeyframe.set(prop, val);\n });\n if (missingStyleProps.length) {\n for (let i = 1; i < keyframes.length; i++) {\n let kf = keyframes[i];\n missingStyleProps.forEach((prop) => kf.set(prop, computeStyle(element, prop)));\n }\n }\n }\n return keyframes;\n}\nfunction visitDslNode(visitor, node, context) {\n switch (node.type) {\n case AnimationMetadataType.Trigger:\n return visitor.visitTrigger(node, context);\n case AnimationMetadataType.State:\n return visitor.visitState(node, context);\n case AnimationMetadataType.Transition:\n return visitor.visitTransition(node, context);\n case AnimationMetadataType.Sequence:\n return visitor.visitSequence(node, context);\n case AnimationMetadataType.Group:\n return visitor.visitGroup(node, context);\n case AnimationMetadataType.Animate:\n return visitor.visitAnimate(node, context);\n case AnimationMetadataType.Keyframes:\n return visitor.visitKeyframes(node, context);\n case AnimationMetadataType.Style:\n return visitor.visitStyle(node, context);\n case AnimationMetadataType.Reference:\n return visitor.visitReference(node, context);\n case AnimationMetadataType.AnimateChild:\n return visitor.visitAnimateChild(node, context);\n case AnimationMetadataType.AnimateRef:\n return visitor.visitAnimateRef(node, context);\n case AnimationMetadataType.Query:\n return visitor.visitQuery(node, context);\n case AnimationMetadataType.Stagger:\n return visitor.visitStagger(node, context);\n default:\n throw invalidNodeType(node.type);\n }\n}\nfunction computeStyle(element, prop) {\n return window.getComputedStyle(element)[prop];\n}\n\nconst DIMENSIONAL_PROP_SET = new Set([\n 'width',\n 'height',\n 'minWidth',\n 'minHeight',\n 'maxWidth',\n 'maxHeight',\n 'left',\n 'top',\n 'bottom',\n 'right',\n 'fontSize',\n 'outlineWidth',\n 'outlineOffset',\n 'paddingTop',\n 'paddingLeft',\n 'paddingBottom',\n 'paddingRight',\n 'marginTop',\n 'marginLeft',\n 'marginBottom',\n 'marginRight',\n 'borderRadius',\n 'borderWidth',\n 'borderTopWidth',\n 'borderLeftWidth',\n 'borderRightWidth',\n 'borderBottomWidth',\n 'textIndent',\n 'perspective',\n]);\nclass WebAnimationsStyleNormalizer extends AnimationStyleNormalizer {\n normalizePropertyName(propertyName, errors) {\n return dashCaseToCamelCase(propertyName);\n }\n normalizeStyleValue(userProvidedProperty, normalizedProperty, value, errors) {\n let unit = '';\n const strVal = value.toString().trim();\n if (DIMENSIONAL_PROP_SET.has(normalizedProperty) && value !== 0 && value !== '0') {\n if (typeof value === 'number') {\n unit = 'px';\n }\n else {\n const valAndSuffixMatch = value.match(/^[+-]?[\\d\\.]+([a-z]*)$/);\n if (valAndSuffixMatch && valAndSuffixMatch[1].length == 0) {\n errors.push(invalidCssUnitValue(userProvidedProperty, value));\n }\n }\n }\n return strVal + unit;\n }\n}\n\nfunction createListOfWarnings(warnings) {\n const LINE_START = '\\n - ';\n return `${LINE_START}${warnings\n .filter(Boolean)\n .map((warning) => warning)\n .join(LINE_START)}`;\n}\nfunction warnValidation(warnings) {\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n console.warn(`animation validation warnings:${createListOfWarnings(warnings)}`);\n}\nfunction warnTriggerBuild(name, warnings) {\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n console.warn(`The animation trigger \"${name}\" has built with the following warnings:${createListOfWarnings(warnings)}`);\n}\nfunction warnRegister(warnings) {\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n console.warn(`Animation built with the following warnings:${createListOfWarnings(warnings)}`);\n}\nfunction triggerParsingWarnings(name, warnings) {\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n console.warn(`Animation parsing for the ${name} trigger presents the following warnings:${createListOfWarnings(warnings)}`);\n}\nfunction pushUnrecognizedPropertiesWarning(warnings, props) {\n if (props.length) {\n warnings.push(`The following provided properties are not recognized: ${props.join(', ')}`);\n }\n}\n\nconst ANY_STATE = '*';\nfunction parseTransitionExpr(transitionValue, errors) {\n const expressions = [];\n if (typeof transitionValue == 'string') {\n transitionValue\n .split(/\\s*,\\s*/)\n .forEach((str) => parseInnerTransitionStr(str, expressions, errors));\n }\n else {\n expressions.push(transitionValue);\n }\n return expressions;\n}\nfunction parseInnerTransitionStr(eventStr, expressions, errors) {\n if (eventStr[0] == ':') {\n const result = parseAnimationAlias(eventStr, errors);\n if (typeof result == 'function') {\n expressions.push(result);\n return;\n }\n eventStr = result;\n }\n const match = eventStr.match(/^(\\*|[-\\w]+)\\s*()\\s*(\\*|[-\\w]+)$/);\n if (match == null || match.length < 4) {\n errors.push(invalidExpression(eventStr));\n return expressions;\n }\n const fromState = match[1];\n const separator = match[2];\n const toState = match[3];\n expressions.push(makeLambdaFromStates(fromState, toState));\n const isFullAnyStateExpr = fromState == ANY_STATE && toState == ANY_STATE;\n if (separator[0] == '<' && !isFullAnyStateExpr) {\n expressions.push(makeLambdaFromStates(toState, fromState));\n }\n return;\n}\nfunction parseAnimationAlias(alias, errors) {\n switch (alias) {\n case ':enter':\n return 'void => *';\n case ':leave':\n return '* => void';\n case ':increment':\n return (fromState, toState) => parseFloat(toState) > parseFloat(fromState);\n case ':decrement':\n return (fromState, toState) => parseFloat(toState) < parseFloat(fromState);\n default:\n errors.push(invalidTransitionAlias(alias));\n return '* => *';\n }\n}\n// DO NOT REFACTOR ... keep the follow set instantiations\n// with the values intact (closure compiler for some reason\n// removes follow-up lines that add the values outside of\n// the constructor...\nconst TRUE_BOOLEAN_VALUES = new Set(['true', '1']);\nconst FALSE_BOOLEAN_VALUES = new Set(['false', '0']);\nfunction makeLambdaFromStates(lhs, rhs) {\n const LHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(lhs) || FALSE_BOOLEAN_VALUES.has(lhs);\n const RHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(rhs) || FALSE_BOOLEAN_VALUES.has(rhs);\n return (fromState, toState) => {\n let lhsMatch = lhs == ANY_STATE || lhs == fromState;\n let rhsMatch = rhs == ANY_STATE || rhs == toState;\n if (!lhsMatch && LHS_MATCH_BOOLEAN && typeof fromState === 'boolean') {\n lhsMatch = fromState ? TRUE_BOOLEAN_VALUES.has(lhs) : FALSE_BOOLEAN_VALUES.has(lhs);\n }\n if (!rhsMatch && RHS_MATCH_BOOLEAN && typeof toState === 'boolean') {\n rhsMatch = toState ? TRUE_BOOLEAN_VALUES.has(rhs) : FALSE_BOOLEAN_VALUES.has(rhs);\n }\n return lhsMatch && rhsMatch;\n };\n}\n\nconst SELF_TOKEN = ':self';\nconst SELF_TOKEN_REGEX = new RegExp(`s*${SELF_TOKEN}s*,?`, 'g');\n/*\n * [Validation]\n * The visitor code below will traverse the animation AST generated by the animation verb functions\n * (the output is a tree of objects) and attempt to perform a series of validations on the data. The\n * following corner-cases will be validated:\n *\n * 1. Overlap of animations\n * Given that a CSS property cannot be animated in more than one place at the same time, it's\n * important that this behavior is detected and validated. The way in which this occurs is that\n * each time a style property is examined, a string-map containing the property will be updated with\n * the start and end times for when the property is used within an animation step.\n *\n * If there are two or more parallel animations that are currently running (these are invoked by the\n * group()) on the same element then the validator will throw an error. Since the start/end timing\n * values are collected for each property then if the current animation step is animating the same\n * property and its timing values fall anywhere into the window of time that the property is\n * currently being animated within then this is what causes an error.\n *\n * 2. Timing values\n * The validator will validate to see if a timing value of `duration delay easing` or\n * `durationNumber` is valid or not.\n *\n * (note that upon validation the code below will replace the timing data with an object containing\n * {duration,delay,easing}.\n *\n * 3. Offset Validation\n * Each of the style() calls are allowed to have an offset value when placed inside of keyframes().\n * Offsets within keyframes() are considered valid when:\n *\n * - No offsets are used at all\n * - Each style() entry contains an offset value\n * - Each offset is between 0 and 1\n * - Each offset is greater to or equal than the previous one\n *\n * Otherwise an error will be thrown.\n */\nfunction buildAnimationAst(driver, metadata, errors, warnings) {\n return new AnimationAstBuilderVisitor(driver).build(metadata, errors, warnings);\n}\nconst ROOT_SELECTOR = '';\nclass AnimationAstBuilderVisitor {\n constructor(_driver) {\n this._driver = _driver;\n }\n build(metadata, errors, warnings) {\n const context = new AnimationAstBuilderContext(errors);\n this._resetContextStyleTimingState(context);\n const ast = (visitDslNode(this, normalizeAnimationEntry(metadata), context));\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (context.unsupportedCSSPropertiesFound.size) {\n pushUnrecognizedPropertiesWarning(warnings, [\n ...context.unsupportedCSSPropertiesFound.keys(),\n ]);\n }\n }\n return ast;\n }\n _resetContextStyleTimingState(context) {\n context.currentQuerySelector = ROOT_SELECTOR;\n context.collectedStyles = new Map();\n context.collectedStyles.set(ROOT_SELECTOR, new Map());\n context.currentTime = 0;\n }\n visitTrigger(metadata, context) {\n let queryCount = (context.queryCount = 0);\n let depCount = (context.depCount = 0);\n const states = [];\n const transitions = [];\n if (metadata.name.charAt(0) == '@') {\n context.errors.push(invalidTrigger());\n }\n metadata.definitions.forEach((def) => {\n this._resetContextStyleTimingState(context);\n if (def.type == AnimationMetadataType.State) {\n const stateDef = def;\n const name = stateDef.name;\n name\n .toString()\n .split(/\\s*,\\s*/)\n .forEach((n) => {\n stateDef.name = n;\n states.push(this.visitState(stateDef, context));\n });\n stateDef.name = name;\n }\n else if (def.type == AnimationMetadataType.Transition) {\n const transition = this.visitTransition(def, context);\n queryCount += transition.queryCount;\n depCount += transition.depCount;\n transitions.push(transition);\n }\n else {\n context.errors.push(invalidDefinition());\n }\n });\n return {\n type: AnimationMetadataType.Trigger,\n name: metadata.name,\n states,\n transitions,\n queryCount,\n depCount,\n options: null,\n };\n }\n visitState(metadata, context) {\n const styleAst = this.visitStyle(metadata.styles, context);\n const astParams = (metadata.options && metadata.options.params) || null;\n if (styleAst.containsDynamicStyles) {\n const missingSubs = new Set();\n const params = astParams || {};\n styleAst.styles.forEach((style) => {\n if (style instanceof Map) {\n style.forEach((value) => {\n extractStyleParams(value).forEach((sub) => {\n if (!params.hasOwnProperty(sub)) {\n missingSubs.add(sub);\n }\n });\n });\n }\n });\n if (missingSubs.size) {\n context.errors.push(invalidState(metadata.name, [...missingSubs.values()]));\n }\n }\n return {\n type: AnimationMetadataType.State,\n name: metadata.name,\n style: styleAst,\n options: astParams ? { params: astParams } : null,\n };\n }\n visitTransition(metadata, context) {\n context.queryCount = 0;\n context.depCount = 0;\n const animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context);\n const matchers = parseTransitionExpr(metadata.expr, context.errors);\n return {\n type: AnimationMetadataType.Transition,\n matchers,\n animation,\n queryCount: context.queryCount,\n depCount: context.depCount,\n options: normalizeAnimationOptions(metadata.options),\n };\n }\n visitSequence(metadata, context) {\n return {\n type: AnimationMetadataType.Sequence,\n steps: metadata.steps.map((s) => visitDslNode(this, s, context)),\n options: normalizeAnimationOptions(metadata.options),\n };\n }\n visitGroup(metadata, context) {\n const currentTime = context.currentTime;\n let furthestTime = 0;\n const steps = metadata.steps.map((step) => {\n context.currentTime = currentTime;\n const innerAst = visitDslNode(this, step, context);\n furthestTime = Math.max(furthestTime, context.currentTime);\n return innerAst;\n });\n context.currentTime = furthestTime;\n return {\n type: AnimationMetadataType.Group,\n steps,\n options: normalizeAnimationOptions(metadata.options),\n };\n }\n visitAnimate(metadata, context) {\n const timingAst = constructTimingAst(metadata.timings, context.errors);\n context.currentAnimateTimings = timingAst;\n let styleAst;\n let styleMetadata = metadata.styles\n ? metadata.styles\n : style({});\n if (styleMetadata.type == AnimationMetadataType.Keyframes) {\n styleAst = this.visitKeyframes(styleMetadata, context);\n }\n else {\n let styleMetadata = metadata.styles;\n let isEmpty = false;\n if (!styleMetadata) {\n isEmpty = true;\n const newStyleData = {};\n if (timingAst.easing) {\n newStyleData['easing'] = timingAst.easing;\n }\n styleMetadata = style(newStyleData);\n }\n context.currentTime += timingAst.duration + timingAst.delay;\n const _styleAst = this.visitStyle(styleMetadata, context);\n _styleAst.isEmptyStep = isEmpty;\n styleAst = _styleAst;\n }\n context.currentAnimateTimings = null;\n return {\n type: AnimationMetadataType.Animate,\n timings: timingAst,\n style: styleAst,\n options: null,\n };\n }\n visitStyle(metadata, context) {\n const ast = this._makeStyleAst(metadata, context);\n this._validateStyleAst(ast, context);\n return ast;\n }\n _makeStyleAst(metadata, context) {\n const styles = [];\n const metadataStyles = Array.isArray(metadata.styles) ? metadata.styles : [metadata.styles];\n for (let styleTuple of metadataStyles) {\n if (typeof styleTuple === 'string') {\n if (styleTuple === AUTO_STYLE) {\n styles.push(styleTuple);\n }\n else {\n context.errors.push(invalidStyleValue(styleTuple));\n }\n }\n else {\n styles.push(new Map(Object.entries(styleTuple)));\n }\n }\n let containsDynamicStyles = false;\n let collectedEasing = null;\n styles.forEach((styleData) => {\n if (styleData instanceof Map) {\n if (styleData.has('easing')) {\n collectedEasing = styleData.get('easing');\n styleData.delete('easing');\n }\n if (!containsDynamicStyles) {\n for (let value of styleData.values()) {\n if (value.toString().indexOf(SUBSTITUTION_EXPR_START) >= 0) {\n containsDynamicStyles = true;\n break;\n }\n }\n }\n }\n });\n return {\n type: AnimationMetadataType.Style,\n styles,\n easing: collectedEasing,\n offset: metadata.offset,\n containsDynamicStyles,\n options: null,\n };\n }\n _validateStyleAst(ast, context) {\n const timings = context.currentAnimateTimings;\n let endTime = context.currentTime;\n let startTime = context.currentTime;\n if (timings && startTime > 0) {\n startTime -= timings.duration + timings.delay;\n }\n ast.styles.forEach((tuple) => {\n if (typeof tuple === 'string')\n return;\n tuple.forEach((value, prop) => {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (!this._driver.validateStyleProperty(prop)) {\n tuple.delete(prop);\n context.unsupportedCSSPropertiesFound.add(prop);\n return;\n }\n }\n // This is guaranteed to have a defined Map at this querySelector location making it\n // safe to add the assertion here. It is set as a default empty map in prior methods.\n const collectedStyles = context.collectedStyles.get(context.currentQuerySelector);\n const collectedEntry = collectedStyles.get(prop);\n let updateCollectedStyle = true;\n if (collectedEntry) {\n if (startTime != endTime &&\n startTime >= collectedEntry.startTime &&\n endTime <= collectedEntry.endTime) {\n context.errors.push(invalidParallelAnimation(prop, collectedEntry.startTime, collectedEntry.endTime, startTime, endTime));\n updateCollectedStyle = false;\n }\n // we always choose the smaller start time value since we\n // want to have a record of the entire animation window where\n // the style property is being animated in between\n startTime = collectedEntry.startTime;\n }\n if (updateCollectedStyle) {\n collectedStyles.set(prop, { startTime, endTime });\n }\n if (context.options) {\n validateStyleParams(value, context.options, context.errors);\n }\n });\n });\n }\n visitKeyframes(metadata, context) {\n const ast = { type: AnimationMetadataType.Keyframes, styles: [], options: null };\n if (!context.currentAnimateTimings) {\n context.errors.push(invalidKeyframes());\n return ast;\n }\n const MAX_KEYFRAME_OFFSET = 1;\n let totalKeyframesWithOffsets = 0;\n const offsets = [];\n let offsetsOutOfOrder = false;\n let keyframesOutOfRange = false;\n let previousOffset = 0;\n const keyframes = metadata.steps.map((styles) => {\n const style = this._makeStyleAst(styles, context);\n let offsetVal = style.offset != null ? style.offset : consumeOffset(style.styles);\n let offset = 0;\n if (offsetVal != null) {\n totalKeyframesWithOffsets++;\n offset = style.offset = offsetVal;\n }\n keyframesOutOfRange = keyframesOutOfRange || offset < 0 || offset > 1;\n offsetsOutOfOrder = offsetsOutOfOrder || offset < previousOffset;\n previousOffset = offset;\n offsets.push(offset);\n return style;\n });\n if (keyframesOutOfRange) {\n context.errors.push(invalidOffset());\n }\n if (offsetsOutOfOrder) {\n context.errors.push(keyframeOffsetsOutOfOrder());\n }\n const length = metadata.steps.length;\n let generatedOffset = 0;\n if (totalKeyframesWithOffsets > 0 && totalKeyframesWithOffsets < length) {\n context.errors.push(keyframesMissingOffsets());\n }\n else if (totalKeyframesWithOffsets == 0) {\n generatedOffset = MAX_KEYFRAME_OFFSET / (length - 1);\n }\n const limit = length - 1;\n const currentTime = context.currentTime;\n const currentAnimateTimings = context.currentAnimateTimings;\n const animateDuration = currentAnimateTimings.duration;\n keyframes.forEach((kf, i) => {\n const offset = generatedOffset > 0 ? (i == limit ? 1 : generatedOffset * i) : offsets[i];\n const durationUpToThisFrame = offset * animateDuration;\n context.currentTime = currentTime + currentAnimateTimings.delay + durationUpToThisFrame;\n currentAnimateTimings.duration = durationUpToThisFrame;\n this._validateStyleAst(kf, context);\n kf.offset = offset;\n ast.styles.push(kf);\n });\n return ast;\n }\n visitReference(metadata, context) {\n return {\n type: AnimationMetadataType.Reference,\n animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context),\n options: normalizeAnimationOptions(metadata.options),\n };\n }\n visitAnimateChild(metadata, context) {\n context.depCount++;\n return {\n type: AnimationMetadataType.AnimateChild,\n options: normalizeAnimationOptions(metadata.options),\n };\n }\n visitAnimateRef(metadata, context) {\n return {\n type: AnimationMetadataType.AnimateRef,\n animation: this.visitReference(metadata.animation, context),\n options: normalizeAnimationOptions(metadata.options),\n };\n }\n visitQuery(metadata, context) {\n const parentSelector = context.currentQuerySelector;\n const options = (metadata.options || {});\n context.queryCount++;\n context.currentQuery = metadata;\n const [selector, includeSelf] = normalizeSelector(metadata.selector);\n context.currentQuerySelector = parentSelector.length\n ? parentSelector + ' ' + selector\n : selector;\n getOrSetDefaultValue(context.collectedStyles, context.currentQuerySelector, new Map());\n const animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context);\n context.currentQuery = null;\n context.currentQuerySelector = parentSelector;\n return {\n type: AnimationMetadataType.Query,\n selector,\n limit: options.limit || 0,\n optional: !!options.optional,\n includeSelf,\n animation,\n originalSelector: metadata.selector,\n options: normalizeAnimationOptions(metadata.options),\n };\n }\n visitStagger(metadata, context) {\n if (!context.currentQuery) {\n context.errors.push(invalidStagger());\n }\n const timings = metadata.timings === 'full'\n ? { duration: 0, delay: 0, easing: 'full' }\n : resolveTiming(metadata.timings, context.errors, true);\n return {\n type: AnimationMetadataType.Stagger,\n animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context),\n timings,\n options: null,\n };\n }\n}\nfunction normalizeSelector(selector) {\n const hasAmpersand = selector.split(/\\s*,\\s*/).find((token) => token == SELF_TOKEN)\n ? true\n : false;\n if (hasAmpersand) {\n selector = selector.replace(SELF_TOKEN_REGEX, '');\n }\n // Note: the :enter and :leave aren't normalized here since those\n // selectors are filled in at runtime during timeline building\n selector = selector\n .replace(/@\\*/g, NG_TRIGGER_SELECTOR)\n .replace(/@\\w+/g, (match) => NG_TRIGGER_SELECTOR + '-' + match.slice(1))\n .replace(/:animating/g, NG_ANIMATING_SELECTOR);\n return [selector, hasAmpersand];\n}\nfunction normalizeParams(obj) {\n return obj ? { ...obj } : null;\n}\nclass AnimationAstBuilderContext {\n constructor(errors) {\n this.errors = errors;\n this.queryCount = 0;\n this.depCount = 0;\n this.currentTransition = null;\n this.currentQuery = null;\n this.currentQuerySelector = null;\n this.currentAnimateTimings = null;\n this.currentTime = 0;\n this.collectedStyles = new Map();\n this.options = null;\n this.unsupportedCSSPropertiesFound = new Set();\n }\n}\nfunction consumeOffset(styles) {\n if (typeof styles == 'string')\n return null;\n let offset = null;\n if (Array.isArray(styles)) {\n styles.forEach((styleTuple) => {\n if (styleTuple instanceof Map && styleTuple.has('offset')) {\n const obj = styleTuple;\n offset = parseFloat(obj.get('offset'));\n obj.delete('offset');\n }\n });\n }\n else if (styles instanceof Map && styles.has('offset')) {\n const obj = styles;\n offset = parseFloat(obj.get('offset'));\n obj.delete('offset');\n }\n return offset;\n}\nfunction constructTimingAst(value, errors) {\n if (value.hasOwnProperty('duration')) {\n return value;\n }\n if (typeof value == 'number') {\n const duration = resolveTiming(value, errors).duration;\n return makeTimingAst(duration, 0, '');\n }\n const strValue = value;\n const isDynamic = strValue.split(/\\s+/).some((v) => v.charAt(0) == '{' && v.charAt(1) == '{');\n if (isDynamic) {\n const ast = makeTimingAst(0, 0, '');\n ast.dynamic = true;\n ast.strValue = strValue;\n return ast;\n }\n const timings = resolveTiming(strValue, errors);\n return makeTimingAst(timings.duration, timings.delay, timings.easing);\n}\nfunction normalizeAnimationOptions(options) {\n if (options) {\n options = { ...options };\n if (options['params']) {\n options['params'] = normalizeParams(options['params']);\n }\n }\n else {\n options = {};\n }\n return options;\n}\nfunction makeTimingAst(duration, delay, easing) {\n return { duration, delay, easing };\n}\n\nfunction createTimelineInstruction(element, keyframes, preStyleProps, postStyleProps, duration, delay, easing = null, subTimeline = false) {\n return {\n type: 1 /* AnimationTransitionInstructionType.TimelineAnimation */,\n element,\n keyframes,\n preStyleProps,\n postStyleProps,\n duration,\n delay,\n totalTime: duration + delay,\n easing,\n subTimeline,\n };\n}\n\nclass ElementInstructionMap {\n constructor() {\n this._map = new Map();\n }\n get(element) {\n return this._map.get(element) || [];\n }\n append(element, instructions) {\n let existingInstructions = this._map.get(element);\n if (!existingInstructions) {\n this._map.set(element, (existingInstructions = []));\n }\n existingInstructions.push(...instructions);\n }\n has(element) {\n return this._map.has(element);\n }\n clear() {\n this._map.clear();\n }\n}\n\nconst ONE_FRAME_IN_MILLISECONDS = 1;\nconst ENTER_TOKEN = ':enter';\nconst ENTER_TOKEN_REGEX = new RegExp(ENTER_TOKEN, 'g');\nconst LEAVE_TOKEN = ':leave';\nconst LEAVE_TOKEN_REGEX = new RegExp(LEAVE_TOKEN, 'g');\n/*\n * The code within this file aims to generate web-animations-compatible keyframes from Angular's\n * animation DSL code.\n *\n * The code below will be converted from:\n *\n * ```\n * sequence([\n * style({ opacity: 0 }),\n * animate(1000, style({ opacity: 0 }))\n * ])\n * ```\n *\n * To:\n * ```\n * keyframes = [{ opacity: 0, offset: 0 }, { opacity: 1, offset: 1 }]\n * duration = 1000\n * delay = 0\n * easing = ''\n * ```\n *\n * For this operation to cover the combination of animation verbs (style, animate, group, etc...) a\n * combination of AST traversal and merge-sort-like algorithms are used.\n *\n * [AST Traversal]\n * Each of the animation verbs, when executed, will return an string-map object representing what\n * type of action it is (style, animate, group, etc...) and the data associated with it. This means\n * that when functional composition mix of these functions is evaluated (like in the example above)\n * then it will end up producing a tree of objects representing the animation itself.\n *\n * When this animation object tree is processed by the visitor code below it will visit each of the\n * verb statements within the visitor. And during each visit it will build the context of the\n * animation keyframes by interacting with the `TimelineBuilder`.\n *\n * [TimelineBuilder]\n * This class is responsible for tracking the styles and building a series of keyframe objects for a\n * timeline between a start and end time. The builder starts off with an initial timeline and each\n * time the AST comes across a `group()`, `keyframes()` or a combination of the two within a\n * `sequence()` then it will generate a sub timeline for each step as well as a new one after\n * they are complete.\n *\n * As the AST is traversed, the timing state on each of the timelines will be incremented. If a sub\n * timeline was created (based on one of the cases above) then the parent timeline will attempt to\n * merge the styles used within the sub timelines into itself (only with group() this will happen).\n * This happens with a merge operation (much like how the merge works in mergeSort) and it will only\n * copy the most recently used styles from the sub timelines into the parent timeline. This ensures\n * that if the styles are used later on in another phase of the animation then they will be the most\n * up-to-date values.\n *\n * [How Missing Styles Are Updated]\n * Each timeline has a `backFill` property which is responsible for filling in new styles into\n * already processed keyframes if a new style shows up later within the animation sequence.\n *\n * ```\n * sequence([\n * style({ width: 0 }),\n * animate(1000, style({ width: 100 })),\n * animate(1000, style({ width: 200 })),\n * animate(1000, style({ width: 300 }))\n * animate(1000, style({ width: 400, height: 400 })) // notice how `height` doesn't exist anywhere\n * else\n * ])\n * ```\n *\n * What is happening here is that the `height` value is added later in the sequence, but is missing\n * from all previous animation steps. Therefore when a keyframe is created it would also be missing\n * from all previous keyframes up until where it is first used. For the timeline keyframe generation\n * to properly fill in the style it will place the previous value (the value from the parent\n * timeline) or a default value of `*` into the backFill map.\n *\n * When a sub-timeline is created it will have its own backFill property. This is done so that\n * styles present within the sub-timeline do not accidentally seep into the previous/future timeline\n * keyframes\n *\n * [Validation]\n * The code in this file is not responsible for validation. That functionality happens with within\n * the `AnimationValidatorVisitor` code.\n */\nfunction buildAnimationTimelines(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles = new Map(), finalStyles = new Map(), options, subInstructions, errors = []) {\n return new AnimationTimelineBuilderVisitor().buildKeyframes(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors);\n}\nclass AnimationTimelineBuilderVisitor {\n buildKeyframes(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors = []) {\n subInstructions = subInstructions || new ElementInstructionMap();\n const context = new AnimationTimelineContext(driver, rootElement, subInstructions, enterClassName, leaveClassName, errors, []);\n context.options = options;\n const delay = options.delay ? resolveTimingValue(options.delay) : 0;\n context.currentTimeline.delayNextStep(delay);\n context.currentTimeline.setStyles([startingStyles], null, context.errors, options);\n visitDslNode(this, ast, context);\n // this checks to see if an actual animation happened\n const timelines = context.timelines.filter((timeline) => timeline.containsAnimation());\n // note: we just want to apply the final styles for the rootElement, so we do not\n // just apply the styles to the last timeline but the last timeline which\n // element is the root one (basically `*`-styles are replaced with the actual\n // state style values only for the root element)\n if (timelines.length && finalStyles.size) {\n let lastRootTimeline;\n for (let i = timelines.length - 1; i >= 0; i--) {\n const timeline = timelines[i];\n if (timeline.element === rootElement) {\n lastRootTimeline = timeline;\n break;\n }\n }\n if (lastRootTimeline && !lastRootTimeline.allowOnlyTimelineStyles()) {\n lastRootTimeline.setStyles([finalStyles], null, context.errors, options);\n }\n }\n return timelines.length\n ? timelines.map((timeline) => timeline.buildKeyframes())\n : [createTimelineInstruction(rootElement, [], [], [], 0, delay, '', false)];\n }\n visitTrigger(ast, context) {\n // these values are not visited in this AST\n }\n visitState(ast, context) {\n // these values are not visited in this AST\n }\n visitTransition(ast, context) {\n // these values are not visited in this AST\n }\n visitAnimateChild(ast, context) {\n const elementInstructions = context.subInstructions.get(context.element);\n if (elementInstructions) {\n const innerContext = context.createSubContext(ast.options);\n const startTime = context.currentTimeline.currentTime;\n const endTime = this._visitSubInstructions(elementInstructions, innerContext, innerContext.options);\n if (startTime != endTime) {\n // we do this on the upper context because we created a sub context for\n // the sub child animations\n context.transformIntoNewTimeline(endTime);\n }\n }\n context.previousNode = ast;\n }\n visitAnimateRef(ast, context) {\n const innerContext = context.createSubContext(ast.options);\n innerContext.transformIntoNewTimeline();\n this._applyAnimationRefDelays([ast.options, ast.animation.options], context, innerContext);\n this.visitReference(ast.animation, innerContext);\n context.transformIntoNewTimeline(innerContext.currentTimeline.currentTime);\n context.previousNode = ast;\n }\n _applyAnimationRefDelays(animationsRefsOptions, context, innerContext) {\n for (const animationRefOptions of animationsRefsOptions) {\n const animationDelay = animationRefOptions?.delay;\n if (animationDelay) {\n const animationDelayValue = typeof animationDelay === 'number'\n ? animationDelay\n : resolveTimingValue(interpolateParams(animationDelay, animationRefOptions?.params ?? {}, context.errors));\n innerContext.delayNextStep(animationDelayValue);\n }\n }\n }\n _visitSubInstructions(instructions, context, options) {\n const startTime = context.currentTimeline.currentTime;\n let furthestTime = startTime;\n // this is a special-case for when a user wants to skip a sub\n // animation from being fired entirely.\n const duration = options.duration != null ? resolveTimingValue(options.duration) : null;\n const delay = options.delay != null ? resolveTimingValue(options.delay) : null;\n if (duration !== 0) {\n instructions.forEach((instruction) => {\n const instructionTimings = context.appendInstructionToTimeline(instruction, duration, delay);\n furthestTime = Math.max(furthestTime, instructionTimings.duration + instructionTimings.delay);\n });\n }\n return furthestTime;\n }\n visitReference(ast, context) {\n context.updateOptions(ast.options, true);\n visitDslNode(this, ast.animation, context);\n context.previousNode = ast;\n }\n visitSequence(ast, context) {\n const subContextCount = context.subContextCount;\n let ctx = context;\n const options = ast.options;\n if (options && (options.params || options.delay)) {\n ctx = context.createSubContext(options);\n ctx.transformIntoNewTimeline();\n if (options.delay != null) {\n if (ctx.previousNode.type == AnimationMetadataType.Style) {\n ctx.currentTimeline.snapshotCurrentStyles();\n ctx.previousNode = DEFAULT_NOOP_PREVIOUS_NODE;\n }\n const delay = resolveTimingValue(options.delay);\n ctx.delayNextStep(delay);\n }\n }\n if (ast.steps.length) {\n ast.steps.forEach((s) => visitDslNode(this, s, ctx));\n // this is here just in case the inner steps only contain or end with a style() call\n ctx.currentTimeline.applyStylesToKeyframe();\n // this means that some animation function within the sequence\n // ended up creating a sub timeline (which means the current\n // timeline cannot overlap with the contents of the sequence)\n if (ctx.subContextCount > subContextCount) {\n ctx.transformIntoNewTimeline();\n }\n }\n context.previousNode = ast;\n }\n visitGroup(ast, context) {\n const innerTimelines = [];\n let furthestTime = context.currentTimeline.currentTime;\n const delay = ast.options && ast.options.delay ? resolveTimingValue(ast.options.delay) : 0;\n ast.steps.forEach((s) => {\n const innerContext = context.createSubContext(ast.options);\n if (delay) {\n innerContext.delayNextStep(delay);\n }\n visitDslNode(this, s, innerContext);\n furthestTime = Math.max(furthestTime, innerContext.currentTimeline.currentTime);\n innerTimelines.push(innerContext.currentTimeline);\n });\n // this operation is run after the AST loop because otherwise\n // if the parent timeline's collected styles were updated then\n // it would pass in invalid data into the new-to-be forked items\n innerTimelines.forEach((timeline) => context.currentTimeline.mergeTimelineCollectedStyles(timeline));\n context.transformIntoNewTimeline(furthestTime);\n context.previousNode = ast;\n }\n _visitTiming(ast, context) {\n if (ast.dynamic) {\n const strValue = ast.strValue;\n const timingValue = context.params\n ? interpolateParams(strValue, context.params, context.errors)\n : strValue;\n return resolveTiming(timingValue, context.errors);\n }\n else {\n return { duration: ast.duration, delay: ast.delay, easing: ast.easing };\n }\n }\n visitAnimate(ast, context) {\n const timings = (context.currentAnimateTimings = this._visitTiming(ast.timings, context));\n const timeline = context.currentTimeline;\n if (timings.delay) {\n context.incrementTime(timings.delay);\n timeline.snapshotCurrentStyles();\n }\n const style = ast.style;\n if (style.type == AnimationMetadataType.Keyframes) {\n this.visitKeyframes(style, context);\n }\n else {\n context.incrementTime(timings.duration);\n this.visitStyle(style, context);\n timeline.applyStylesToKeyframe();\n }\n context.currentAnimateTimings = null;\n context.previousNode = ast;\n }\n visitStyle(ast, context) {\n const timeline = context.currentTimeline;\n const timings = context.currentAnimateTimings;\n // this is a special case for when a style() call\n // directly follows an animate() call (but not inside of an animate() call)\n if (!timings && timeline.hasCurrentStyleProperties()) {\n timeline.forwardFrame();\n }\n const easing = (timings && timings.easing) || ast.easing;\n if (ast.isEmptyStep) {\n timeline.applyEmptyStep(easing);\n }\n else {\n timeline.setStyles(ast.styles, easing, context.errors, context.options);\n }\n context.previousNode = ast;\n }\n visitKeyframes(ast, context) {\n const currentAnimateTimings = context.currentAnimateTimings;\n const startTime = context.currentTimeline.duration;\n const duration = currentAnimateTimings.duration;\n const innerContext = context.createSubContext();\n const innerTimeline = innerContext.currentTimeline;\n innerTimeline.easing = currentAnimateTimings.easing;\n ast.styles.forEach((step) => {\n const offset = step.offset || 0;\n innerTimeline.forwardTime(offset * duration);\n innerTimeline.setStyles(step.styles, step.easing, context.errors, context.options);\n innerTimeline.applyStylesToKeyframe();\n });\n // this will ensure that the parent timeline gets all the styles from\n // the child even if the new timeline below is not used\n context.currentTimeline.mergeTimelineCollectedStyles(innerTimeline);\n // we do this because the window between this timeline and the sub timeline\n // should ensure that the styles within are exactly the same as they were before\n context.transformIntoNewTimeline(startTime + duration);\n context.previousNode = ast;\n }\n visitQuery(ast, context) {\n // in the event that the first step before this is a style step we need\n // to ensure the styles are applied before the children are animated\n const startTime = context.currentTimeline.currentTime;\n const options = (ast.options || {});\n const delay = options.delay ? resolveTimingValue(options.delay) : 0;\n if (delay &&\n (context.previousNode.type === AnimationMetadataType.Style ||\n (startTime == 0 && context.currentTimeline.hasCurrentStyleProperties()))) {\n context.currentTimeline.snapshotCurrentStyles();\n context.previousNode = DEFAULT_NOOP_PREVIOUS_NODE;\n }\n let furthestTime = startTime;\n const elms = context.invokeQuery(ast.selector, ast.originalSelector, ast.limit, ast.includeSelf, options.optional ? true : false, context.errors);\n context.currentQueryTotal = elms.length;\n let sameElementTimeline = null;\n elms.forEach((element, i) => {\n context.currentQueryIndex = i;\n const innerContext = context.createSubContext(ast.options, element);\n if (delay) {\n innerContext.delayNextStep(delay);\n }\n if (element === context.element) {\n sameElementTimeline = innerContext.currentTimeline;\n }\n visitDslNode(this, ast.animation, innerContext);\n // this is here just incase the inner steps only contain or end\n // with a style() call (which is here to signal that this is a preparatory\n // call to style an element before it is animated again)\n innerContext.currentTimeline.applyStylesToKeyframe();\n const endTime = innerContext.currentTimeline.currentTime;\n furthestTime = Math.max(furthestTime, endTime);\n });\n context.currentQueryIndex = 0;\n context.currentQueryTotal = 0;\n context.transformIntoNewTimeline(furthestTime);\n if (sameElementTimeline) {\n context.currentTimeline.mergeTimelineCollectedStyles(sameElementTimeline);\n context.currentTimeline.snapshotCurrentStyles();\n }\n context.previousNode = ast;\n }\n visitStagger(ast, context) {\n const parentContext = context.parentContext;\n const tl = context.currentTimeline;\n const timings = ast.timings;\n const duration = Math.abs(timings.duration);\n const maxTime = duration * (context.currentQueryTotal - 1);\n let delay = duration * context.currentQueryIndex;\n let staggerTransformer = timings.duration < 0 ? 'reverse' : timings.easing;\n switch (staggerTransformer) {\n case 'reverse':\n delay = maxTime - delay;\n break;\n case 'full':\n delay = parentContext.currentStaggerTime;\n break;\n }\n const timeline = context.currentTimeline;\n if (delay) {\n timeline.delayNextStep(delay);\n }\n const startingTime = timeline.currentTime;\n visitDslNode(this, ast.animation, context);\n context.previousNode = ast;\n // time = duration + delay\n // the reason why this computation is so complex is because\n // the inner timeline may either have a delay value or a stretched\n // keyframe depending on if a subtimeline is not used or is used.\n parentContext.currentStaggerTime =\n tl.currentTime - startingTime + (tl.startTime - parentContext.currentTimeline.startTime);\n }\n}\nconst DEFAULT_NOOP_PREVIOUS_NODE = {};\nclass AnimationTimelineContext {\n constructor(_driver, element, subInstructions, _enterClassName, _leaveClassName, errors, timelines, initialTimeline) {\n this._driver = _driver;\n this.element = element;\n this.subInstructions = subInstructions;\n this._enterClassName = _enterClassName;\n this._leaveClassName = _leaveClassName;\n this.errors = errors;\n this.timelines = timelines;\n this.parentContext = null;\n this.currentAnimateTimings = null;\n this.previousNode = DEFAULT_NOOP_PREVIOUS_NODE;\n this.subContextCount = 0;\n this.options = {};\n this.currentQueryIndex = 0;\n this.currentQueryTotal = 0;\n this.currentStaggerTime = 0;\n this.currentTimeline = initialTimeline || new TimelineBuilder(this._driver, element, 0);\n timelines.push(this.currentTimeline);\n }\n get params() {\n return this.options.params;\n }\n updateOptions(options, skipIfExists) {\n if (!options)\n return;\n const newOptions = options;\n let optionsToUpdate = this.options;\n // NOTE: this will get patched up when other animation methods support duration overrides\n if (newOptions.duration != null) {\n optionsToUpdate.duration = resolveTimingValue(newOptions.duration);\n }\n if (newOptions.delay != null) {\n optionsToUpdate.delay = resolveTimingValue(newOptions.delay);\n }\n const newParams = newOptions.params;\n if (newParams) {\n let paramsToUpdate = optionsToUpdate.params;\n if (!paramsToUpdate) {\n paramsToUpdate = this.options.params = {};\n }\n Object.keys(newParams).forEach((name) => {\n if (!skipIfExists || !paramsToUpdate.hasOwnProperty(name)) {\n paramsToUpdate[name] = interpolateParams(newParams[name], paramsToUpdate, this.errors);\n }\n });\n }\n }\n _copyOptions() {\n const options = {};\n if (this.options) {\n const oldParams = this.options.params;\n if (oldParams) {\n const params = (options['params'] = {});\n Object.keys(oldParams).forEach((name) => {\n params[name] = oldParams[name];\n });\n }\n }\n return options;\n }\n createSubContext(options = null, element, newTime) {\n const target = element || this.element;\n const context = new AnimationTimelineContext(this._driver, target, this.subInstructions, this._enterClassName, this._leaveClassName, this.errors, this.timelines, this.currentTimeline.fork(target, newTime || 0));\n context.previousNode = this.previousNode;\n context.currentAnimateTimings = this.currentAnimateTimings;\n context.options = this._copyOptions();\n context.updateOptions(options);\n context.currentQueryIndex = this.currentQueryIndex;\n context.currentQueryTotal = this.currentQueryTotal;\n context.parentContext = this;\n this.subContextCount++;\n return context;\n }\n transformIntoNewTimeline(newTime) {\n this.previousNode = DEFAULT_NOOP_PREVIOUS_NODE;\n this.currentTimeline = this.currentTimeline.fork(this.element, newTime);\n this.timelines.push(this.currentTimeline);\n return this.currentTimeline;\n }\n appendInstructionToTimeline(instruction, duration, delay) {\n const updatedTimings = {\n duration: duration != null ? duration : instruction.duration,\n delay: this.currentTimeline.currentTime + (delay != null ? delay : 0) + instruction.delay,\n easing: '',\n };\n const builder = new SubTimelineBuilder(this._driver, instruction.element, instruction.keyframes, instruction.preStyleProps, instruction.postStyleProps, updatedTimings, instruction.stretchStartingKeyframe);\n this.timelines.push(builder);\n return updatedTimings;\n }\n incrementTime(time) {\n this.currentTimeline.forwardTime(this.currentTimeline.duration + time);\n }\n delayNextStep(delay) {\n // negative delays are not yet supported\n if (delay > 0) {\n this.currentTimeline.delayNextStep(delay);\n }\n }\n invokeQuery(selector, originalSelector, limit, includeSelf, optional, errors) {\n let results = [];\n if (includeSelf) {\n results.push(this.element);\n }\n if (selector.length > 0) {\n // only if :self is used then the selector can be empty\n selector = selector.replace(ENTER_TOKEN_REGEX, '.' + this._enterClassName);\n selector = selector.replace(LEAVE_TOKEN_REGEX, '.' + this._leaveClassName);\n const multi = limit != 1;\n let elements = this._driver.query(this.element, selector, multi);\n if (limit !== 0) {\n elements =\n limit < 0\n ? elements.slice(elements.length + limit, elements.length)\n : elements.slice(0, limit);\n }\n results.push(...elements);\n }\n if (!optional && results.length == 0) {\n errors.push(invalidQuery(originalSelector));\n }\n return results;\n }\n}\nclass TimelineBuilder {\n constructor(_driver, element, startTime, _elementTimelineStylesLookup) {\n this._driver = _driver;\n this.element = element;\n this.startTime = startTime;\n this._elementTimelineStylesLookup = _elementTimelineStylesLookup;\n this.duration = 0;\n this.easing = null;\n this._previousKeyframe = new Map();\n this._currentKeyframe = new Map();\n this._keyframes = new Map();\n this._styleSummary = new Map();\n this._localTimelineStyles = new Map();\n this._pendingStyles = new Map();\n this._backFill = new Map();\n this._currentEmptyStepKeyframe = null;\n if (!this._elementTimelineStylesLookup) {\n this._elementTimelineStylesLookup = new Map();\n }\n this._globalTimelineStyles = this._elementTimelineStylesLookup.get(element);\n if (!this._globalTimelineStyles) {\n this._globalTimelineStyles = this._localTimelineStyles;\n this._elementTimelineStylesLookup.set(element, this._localTimelineStyles);\n }\n this._loadKeyframe();\n }\n containsAnimation() {\n switch (this._keyframes.size) {\n case 0:\n return false;\n case 1:\n return this.hasCurrentStyleProperties();\n default:\n return true;\n }\n }\n hasCurrentStyleProperties() {\n return this._currentKeyframe.size > 0;\n }\n get currentTime() {\n return this.startTime + this.duration;\n }\n delayNextStep(delay) {\n // in the event that a style() step is placed right before a stagger()\n // and that style() step is the very first style() value in the animation\n // then we need to make a copy of the keyframe [0, copy, 1] so that the delay\n // properly applies the style() values to work with the stagger...\n const hasPreStyleStep = this._keyframes.size === 1 && this._pendingStyles.size;\n if (this.duration || hasPreStyleStep) {\n this.forwardTime(this.currentTime + delay);\n if (hasPreStyleStep) {\n this.snapshotCurrentStyles();\n }\n }\n else {\n this.startTime += delay;\n }\n }\n fork(element, currentTime) {\n this.applyStylesToKeyframe();\n return new TimelineBuilder(this._driver, element, currentTime || this.currentTime, this._elementTimelineStylesLookup);\n }\n _loadKeyframe() {\n if (this._currentKeyframe) {\n this._previousKeyframe = this._currentKeyframe;\n }\n this._currentKeyframe = this._keyframes.get(this.duration);\n if (!this._currentKeyframe) {\n this._currentKeyframe = new Map();\n this._keyframes.set(this.duration, this._currentKeyframe);\n }\n }\n forwardFrame() {\n this.duration += ONE_FRAME_IN_MILLISECONDS;\n this._loadKeyframe();\n }\n forwardTime(time) {\n this.applyStylesToKeyframe();\n this.duration = time;\n this._loadKeyframe();\n }\n _updateStyle(prop, value) {\n this._localTimelineStyles.set(prop, value);\n this._globalTimelineStyles.set(prop, value);\n this._styleSummary.set(prop, { time: this.currentTime, value });\n }\n allowOnlyTimelineStyles() {\n return this._currentEmptyStepKeyframe !== this._currentKeyframe;\n }\n applyEmptyStep(easing) {\n if (easing) {\n this._previousKeyframe.set('easing', easing);\n }\n // special case for animate(duration):\n // all missing styles are filled with a `*` value then\n // if any destination styles are filled in later on the same\n // keyframe then they will override the overridden styles\n // We use `_globalTimelineStyles` here because there may be\n // styles in previous keyframes that are not present in this timeline\n for (let [prop, value] of this._globalTimelineStyles) {\n this._backFill.set(prop, value || AUTO_STYLE);\n this._currentKeyframe.set(prop, AUTO_STYLE);\n }\n this._currentEmptyStepKeyframe = this._currentKeyframe;\n }\n setStyles(input, easing, errors, options) {\n if (easing) {\n this._previousKeyframe.set('easing', easing);\n }\n const params = (options && options.params) || {};\n const styles = flattenStyles(input, this._globalTimelineStyles);\n for (let [prop, value] of styles) {\n const val = interpolateParams(value, params, errors);\n this._pendingStyles.set(prop, val);\n if (!this._localTimelineStyles.has(prop)) {\n this._backFill.set(prop, this._globalTimelineStyles.get(prop) ?? AUTO_STYLE);\n }\n this._updateStyle(prop, val);\n }\n }\n applyStylesToKeyframe() {\n if (this._pendingStyles.size == 0)\n return;\n this._pendingStyles.forEach((val, prop) => {\n this._currentKeyframe.set(prop, val);\n });\n this._pendingStyles.clear();\n this._localTimelineStyles.forEach((val, prop) => {\n if (!this._currentKeyframe.has(prop)) {\n this._currentKeyframe.set(prop, val);\n }\n });\n }\n snapshotCurrentStyles() {\n for (let [prop, val] of this._localTimelineStyles) {\n this._pendingStyles.set(prop, val);\n this._updateStyle(prop, val);\n }\n }\n getFinalKeyframe() {\n return this._keyframes.get(this.duration);\n }\n get properties() {\n const properties = [];\n for (let prop in this._currentKeyframe) {\n properties.push(prop);\n }\n return properties;\n }\n mergeTimelineCollectedStyles(timeline) {\n timeline._styleSummary.forEach((details1, prop) => {\n const details0 = this._styleSummary.get(prop);\n if (!details0 || details1.time > details0.time) {\n this._updateStyle(prop, details1.value);\n }\n });\n }\n buildKeyframes() {\n this.applyStylesToKeyframe();\n const preStyleProps = new Set();\n const postStyleProps = new Set();\n const isEmpty = this._keyframes.size === 1 && this.duration === 0;\n let finalKeyframes = [];\n this._keyframes.forEach((keyframe, time) => {\n const finalKeyframe = new Map([...this._backFill, ...keyframe]);\n finalKeyframe.forEach((value, prop) => {\n if (value === ɵPRE_STYLE) {\n preStyleProps.add(prop);\n }\n else if (value === AUTO_STYLE) {\n postStyleProps.add(prop);\n }\n });\n if (!isEmpty) {\n finalKeyframe.set('offset', time / this.duration);\n }\n finalKeyframes.push(finalKeyframe);\n });\n const preProps = [...preStyleProps.values()];\n const postProps = [...postStyleProps.values()];\n // special case for a 0-second animation (which is designed just to place styles onscreen)\n if (isEmpty) {\n const kf0 = finalKeyframes[0];\n const kf1 = new Map(kf0);\n kf0.set('offset', 0);\n kf1.set('offset', 1);\n finalKeyframes = [kf0, kf1];\n }\n return createTimelineInstruction(this.element, finalKeyframes, preProps, postProps, this.duration, this.startTime, this.easing, false);\n }\n}\nclass SubTimelineBuilder extends TimelineBuilder {\n constructor(driver, element, keyframes, preStyleProps, postStyleProps, timings, _stretchStartingKeyframe = false) {\n super(driver, element, timings.delay);\n this.keyframes = keyframes;\n this.preStyleProps = preStyleProps;\n this.postStyleProps = postStyleProps;\n this._stretchStartingKeyframe = _stretchStartingKeyframe;\n this.timings = { duration: timings.duration, delay: timings.delay, easing: timings.easing };\n }\n containsAnimation() {\n return this.keyframes.length > 1;\n }\n buildKeyframes() {\n let keyframes = this.keyframes;\n let { delay, duration, easing } = this.timings;\n if (this._stretchStartingKeyframe && delay) {\n const newKeyframes = [];\n const totalTime = duration + delay;\n const startingGap = delay / totalTime;\n // the original starting keyframe now starts once the delay is done\n const newFirstKeyframe = new Map(keyframes[0]);\n newFirstKeyframe.set('offset', 0);\n newKeyframes.push(newFirstKeyframe);\n const oldFirstKeyframe = new Map(keyframes[0]);\n oldFirstKeyframe.set('offset', roundOffset(startingGap));\n newKeyframes.push(oldFirstKeyframe);\n /*\n When the keyframe is stretched then it means that the delay before the animation\n starts is gone. Instead the first keyframe is placed at the start of the animation\n and it is then copied to where it starts when the original delay is over. This basically\n means nothing animates during that delay, but the styles are still rendered. For this\n to work the original offset values that exist in the original keyframes must be \"warped\"\n so that they can take the new keyframe + delay into account.\n \n delay=1000, duration=1000, keyframes = 0 .5 1\n \n turns into\n \n delay=0, duration=2000, keyframes = 0 .33 .66 1\n */\n // offsets between 1 ... n -1 are all warped by the keyframe stretch\n const limit = keyframes.length - 1;\n for (let i = 1; i <= limit; i++) {\n let kf = new Map(keyframes[i]);\n const oldOffset = kf.get('offset');\n const timeAtKeyframe = delay + oldOffset * duration;\n kf.set('offset', roundOffset(timeAtKeyframe / totalTime));\n newKeyframes.push(kf);\n }\n // the new starting keyframe should be added at the start\n duration = totalTime;\n delay = 0;\n easing = '';\n keyframes = newKeyframes;\n }\n return createTimelineInstruction(this.element, keyframes, this.preStyleProps, this.postStyleProps, duration, delay, easing, true);\n }\n}\nfunction roundOffset(offset, decimalPoints = 3) {\n const mult = Math.pow(10, decimalPoints - 1);\n return Math.round(offset * mult) / mult;\n}\nfunction flattenStyles(input, allStyles) {\n const styles = new Map();\n let allProperties;\n input.forEach((token) => {\n if (token === '*') {\n allProperties ??= allStyles.keys();\n for (let prop of allProperties) {\n styles.set(prop, AUTO_STYLE);\n }\n }\n else {\n for (let [prop, val] of token) {\n styles.set(prop, val);\n }\n }\n });\n return styles;\n}\n\nfunction createTransitionInstruction(element, triggerName, fromState, toState, isRemovalTransition, fromStyles, toStyles, timelines, queriedElements, preStyleProps, postStyleProps, totalTime, errors) {\n return {\n type: 0 /* AnimationTransitionInstructionType.TransitionAnimation */,\n element,\n triggerName,\n isRemovalTransition,\n fromState,\n fromStyles,\n toState,\n toStyles,\n timelines,\n queriedElements,\n preStyleProps,\n postStyleProps,\n totalTime,\n errors,\n };\n}\n\nconst EMPTY_OBJECT = {};\nclass AnimationTransitionFactory {\n constructor(_triggerName, ast, _stateStyles) {\n this._triggerName = _triggerName;\n this.ast = ast;\n this._stateStyles = _stateStyles;\n }\n match(currentState, nextState, element, params) {\n return oneOrMoreTransitionsMatch(this.ast.matchers, currentState, nextState, element, params);\n }\n buildStyles(stateName, params, errors) {\n let styler = this._stateStyles.get('*');\n if (stateName !== undefined) {\n styler = this._stateStyles.get(stateName?.toString()) || styler;\n }\n return styler ? styler.buildStyles(params, errors) : new Map();\n }\n build(driver, element, currentState, nextState, enterClassName, leaveClassName, currentOptions, nextOptions, subInstructions, skipAstBuild) {\n const errors = [];\n const transitionAnimationParams = (this.ast.options && this.ast.options.params) || EMPTY_OBJECT;\n const currentAnimationParams = (currentOptions && currentOptions.params) || EMPTY_OBJECT;\n const currentStateStyles = this.buildStyles(currentState, currentAnimationParams, errors);\n const nextAnimationParams = (nextOptions && nextOptions.params) || EMPTY_OBJECT;\n const nextStateStyles = this.buildStyles(nextState, nextAnimationParams, errors);\n const queriedElements = new Set();\n const preStyleMap = new Map();\n const postStyleMap = new Map();\n const isRemoval = nextState === 'void';\n const animationOptions = {\n params: applyParamDefaults(nextAnimationParams, transitionAnimationParams),\n delay: this.ast.options?.delay,\n };\n const timelines = skipAstBuild\n ? []\n : buildAnimationTimelines(driver, element, this.ast.animation, enterClassName, leaveClassName, currentStateStyles, nextStateStyles, animationOptions, subInstructions, errors);\n let totalTime = 0;\n timelines.forEach((tl) => {\n totalTime = Math.max(tl.duration + tl.delay, totalTime);\n });\n if (errors.length) {\n return createTransitionInstruction(element, this._triggerName, currentState, nextState, isRemoval, currentStateStyles, nextStateStyles, [], [], preStyleMap, postStyleMap, totalTime, errors);\n }\n timelines.forEach((tl) => {\n const elm = tl.element;\n const preProps = getOrSetDefaultValue(preStyleMap, elm, new Set());\n tl.preStyleProps.forEach((prop) => preProps.add(prop));\n const postProps = getOrSetDefaultValue(postStyleMap, elm, new Set());\n tl.postStyleProps.forEach((prop) => postProps.add(prop));\n if (elm !== element) {\n queriedElements.add(elm);\n }\n });\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n checkNonAnimatableInTimelines(timelines, this._triggerName, driver);\n }\n return createTransitionInstruction(element, this._triggerName, currentState, nextState, isRemoval, currentStateStyles, nextStateStyles, timelines, [...queriedElements.values()], preStyleMap, postStyleMap, totalTime);\n }\n}\n/**\n * Checks inside a set of timelines if they try to animate a css property which is not considered\n * animatable, in that case it prints a warning on the console.\n * Besides that the function doesn't have any other effect.\n *\n * Note: this check is done here after the timelines are built instead of doing on a lower level so\n * that we can make sure that the warning appears only once per instruction (we can aggregate here\n * all the issues instead of finding them separately).\n *\n * @param timelines The built timelines for the current instruction.\n * @param triggerName The name of the trigger for the current instruction.\n * @param driver Animation driver used to perform the check.\n *\n */\nfunction checkNonAnimatableInTimelines(timelines, triggerName, driver) {\n if (!driver.validateAnimatableStyleProperty) {\n return;\n }\n const allowedNonAnimatableProps = new Set([\n // 'easing' is a utility/synthetic prop we use to represent\n // easing functions, it represents a property of the animation\n // which is not animatable but different values can be used\n // in different steps\n 'easing',\n ]);\n const invalidNonAnimatableProps = new Set();\n timelines.forEach(({ keyframes }) => {\n const nonAnimatablePropsInitialValues = new Map();\n keyframes.forEach((keyframe) => {\n const entriesToCheck = Array.from(keyframe.entries()).filter(([prop]) => !allowedNonAnimatableProps.has(prop));\n for (const [prop, value] of entriesToCheck) {\n if (!driver.validateAnimatableStyleProperty(prop)) {\n if (nonAnimatablePropsInitialValues.has(prop) && !invalidNonAnimatableProps.has(prop)) {\n const propInitialValue = nonAnimatablePropsInitialValues.get(prop);\n if (propInitialValue !== value) {\n invalidNonAnimatableProps.add(prop);\n }\n }\n else {\n nonAnimatablePropsInitialValues.set(prop, value);\n }\n }\n }\n });\n });\n if (invalidNonAnimatableProps.size > 0) {\n console.warn(`Warning: The animation trigger \"${triggerName}\" is attempting to animate the following` +\n ' not animatable properties: ' +\n Array.from(invalidNonAnimatableProps).join(', ') +\n '\\n' +\n '(to check the list of all animatable properties visit https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animated_properties)');\n }\n}\nfunction oneOrMoreTransitionsMatch(matchFns, currentState, nextState, element, params) {\n return matchFns.some((fn) => fn(currentState, nextState, element, params));\n}\nfunction applyParamDefaults(userParams, defaults) {\n const result = { ...defaults };\n Object.entries(userParams).forEach(([key, value]) => {\n if (value != null) {\n result[key] = value;\n }\n });\n return result;\n}\nclass AnimationStateStyles {\n constructor(styles, defaultParams, normalizer) {\n this.styles = styles;\n this.defaultParams = defaultParams;\n this.normalizer = normalizer;\n }\n buildStyles(params, errors) {\n const finalStyles = new Map();\n const combinedParams = applyParamDefaults(params, this.defaultParams);\n this.styles.styles.forEach((value) => {\n if (typeof value !== 'string') {\n value.forEach((val, prop) => {\n if (val) {\n val = interpolateParams(val, combinedParams, errors);\n }\n const normalizedProp = this.normalizer.normalizePropertyName(prop, errors);\n val = this.normalizer.normalizeStyleValue(prop, normalizedProp, val, errors);\n finalStyles.set(prop, val);\n });\n }\n });\n return finalStyles;\n }\n}\n\nfunction buildTrigger(name, ast, normalizer) {\n return new AnimationTrigger(name, ast, normalizer);\n}\nclass AnimationTrigger {\n constructor(name, ast, _normalizer) {\n this.name = name;\n this.ast = ast;\n this._normalizer = _normalizer;\n this.transitionFactories = [];\n this.states = new Map();\n ast.states.forEach((ast) => {\n const defaultParams = (ast.options && ast.options.params) || {};\n this.states.set(ast.name, new AnimationStateStyles(ast.style, defaultParams, _normalizer));\n });\n balanceProperties(this.states, 'true', '1');\n balanceProperties(this.states, 'false', '0');\n ast.transitions.forEach((ast) => {\n this.transitionFactories.push(new AnimationTransitionFactory(name, ast, this.states));\n });\n this.fallbackTransition = createFallbackTransition(name, this.states, this._normalizer);\n }\n get containsQueries() {\n return this.ast.queryCount > 0;\n }\n matchTransition(currentState, nextState, element, params) {\n const entry = this.transitionFactories.find((f) => f.match(currentState, nextState, element, params));\n return entry || null;\n }\n matchStyles(currentState, params, errors) {\n return this.fallbackTransition.buildStyles(currentState, params, errors);\n }\n}\nfunction createFallbackTransition(triggerName, states, normalizer) {\n const matchers = [(fromState, toState) => true];\n const animation = { type: AnimationMetadataType.Sequence, steps: [], options: null };\n const transition = {\n type: AnimationMetadataType.Transition,\n animation,\n matchers,\n options: null,\n queryCount: 0,\n depCount: 0,\n };\n return new AnimationTransitionFactory(triggerName, transition, states);\n}\nfunction balanceProperties(stateMap, key1, key2) {\n if (stateMap.has(key1)) {\n if (!stateMap.has(key2)) {\n stateMap.set(key2, stateMap.get(key1));\n }\n }\n else if (stateMap.has(key2)) {\n stateMap.set(key1, stateMap.get(key2));\n }\n}\n\nconst EMPTY_INSTRUCTION_MAP = new ElementInstructionMap();\nclass TimelineAnimationEngine {\n constructor(bodyNode, _driver, _normalizer) {\n this.bodyNode = bodyNode;\n this._driver = _driver;\n this._normalizer = _normalizer;\n this._animations = new Map();\n this._playersById = new Map();\n this.players = [];\n }\n register(id, metadata) {\n const errors = [];\n const warnings = [];\n const ast = buildAnimationAst(this._driver, metadata, errors, warnings);\n if (errors.length) {\n throw registerFailed(errors);\n }\n else {\n if (warnings.length) {\n warnRegister(warnings);\n }\n this._animations.set(id, ast);\n }\n }\n _buildPlayer(i, preStyles, postStyles) {\n const element = i.element;\n const keyframes = normalizeKeyframes$1(this._normalizer, i.keyframes, preStyles, postStyles);\n return this._driver.animate(element, keyframes, i.duration, i.delay, i.easing, [], true);\n }\n create(id, element, options = {}) {\n const errors = [];\n const ast = this._animations.get(id);\n let instructions;\n const autoStylesMap = new Map();\n if (ast) {\n instructions = buildAnimationTimelines(this._driver, element, ast, ENTER_CLASSNAME, LEAVE_CLASSNAME, new Map(), new Map(), options, EMPTY_INSTRUCTION_MAP, errors);\n instructions.forEach((inst) => {\n const styles = getOrSetDefaultValue(autoStylesMap, inst.element, new Map());\n inst.postStyleProps.forEach((prop) => styles.set(prop, null));\n });\n }\n else {\n errors.push(missingOrDestroyedAnimation());\n instructions = [];\n }\n if (errors.length) {\n throw createAnimationFailed(errors);\n }\n autoStylesMap.forEach((styles, element) => {\n styles.forEach((_, prop) => {\n styles.set(prop, this._driver.computeStyle(element, prop, AUTO_STYLE));\n });\n });\n const players = instructions.map((i) => {\n const styles = autoStylesMap.get(i.element);\n return this._buildPlayer(i, new Map(), styles);\n });\n const player = optimizeGroupPlayer(players);\n this._playersById.set(id, player);\n player.onDestroy(() => this.destroy(id));\n this.players.push(player);\n return player;\n }\n destroy(id) {\n const player = this._getPlayer(id);\n player.destroy();\n this._playersById.delete(id);\n const index = this.players.indexOf(player);\n if (index >= 0) {\n this.players.splice(index, 1);\n }\n }\n _getPlayer(id) {\n const player = this._playersById.get(id);\n if (!player) {\n throw missingPlayer(id);\n }\n return player;\n }\n listen(id, element, eventName, callback) {\n // triggerName, fromState, toState are all ignored for timeline animations\n const baseEvent = makeAnimationEvent(element, '', '', '');\n listenOnPlayer(this._getPlayer(id), eventName, baseEvent, callback);\n return () => { };\n }\n command(id, element, command, args) {\n if (command == 'register') {\n this.register(id, args[0]);\n return;\n }\n if (command == 'create') {\n const options = (args[0] || {});\n this.create(id, element, options);\n return;\n }\n const player = this._getPlayer(id);\n switch (command) {\n case 'play':\n player.play();\n break;\n case 'pause':\n player.pause();\n break;\n case 'reset':\n player.reset();\n break;\n case 'restart':\n player.restart();\n break;\n case 'finish':\n player.finish();\n break;\n case 'init':\n player.init();\n break;\n case 'setPosition':\n player.setPosition(parseFloat(args[0]));\n break;\n case 'destroy':\n this.destroy(id);\n break;\n }\n }\n}\n\nconst QUEUED_CLASSNAME = 'ng-animate-queued';\nconst QUEUED_SELECTOR = '.ng-animate-queued';\nconst DISABLED_CLASSNAME = 'ng-animate-disabled';\nconst DISABLED_SELECTOR = '.ng-animate-disabled';\nconst STAR_CLASSNAME = 'ng-star-inserted';\nconst STAR_SELECTOR = '.ng-star-inserted';\nconst EMPTY_PLAYER_ARRAY = [];\nconst NULL_REMOVAL_STATE = {\n namespaceId: '',\n setForRemoval: false,\n setForMove: false,\n hasAnimation: false,\n removedBeforeQueried: false,\n};\nconst NULL_REMOVED_QUERIED_STATE = {\n namespaceId: '',\n setForMove: false,\n setForRemoval: false,\n hasAnimation: false,\n removedBeforeQueried: true,\n};\nconst REMOVAL_FLAG = '__ng_removed';\nclass StateValue {\n get params() {\n return this.options.params;\n }\n constructor(input, namespaceId = '') {\n this.namespaceId = namespaceId;\n const isObj = input && input.hasOwnProperty('value');\n const value = isObj ? input['value'] : input;\n this.value = normalizeTriggerValue(value);\n if (isObj) {\n // we drop the value property from options.\n const { value, ...options } = input;\n this.options = options;\n }\n else {\n this.options = {};\n }\n if (!this.options.params) {\n this.options.params = {};\n }\n }\n absorbOptions(options) {\n const newParams = options.params;\n if (newParams) {\n const oldParams = this.options.params;\n Object.keys(newParams).forEach((prop) => {\n if (oldParams[prop] == null) {\n oldParams[prop] = newParams[prop];\n }\n });\n }\n }\n}\nconst VOID_VALUE = 'void';\nconst DEFAULT_STATE_VALUE = new StateValue(VOID_VALUE);\nclass AnimationTransitionNamespace {\n constructor(id, hostElement, _engine) {\n this.id = id;\n this.hostElement = hostElement;\n this._engine = _engine;\n this.players = [];\n this._triggers = new Map();\n this._queue = [];\n this._elementListeners = new Map();\n this._hostClassName = 'ng-tns-' + id;\n addClass(hostElement, this._hostClassName);\n }\n listen(element, name, phase, callback) {\n if (!this._triggers.has(name)) {\n throw missingTrigger(phase, name);\n }\n if (phase == null || phase.length == 0) {\n throw missingEvent(name);\n }\n if (!isTriggerEventValid(phase)) {\n throw unsupportedTriggerEvent(phase, name);\n }\n const listeners = getOrSetDefaultValue(this._elementListeners, element, []);\n const data = { name, phase, callback };\n listeners.push(data);\n const triggersWithStates = getOrSetDefaultValue(this._engine.statesByElement, element, new Map());\n if (!triggersWithStates.has(name)) {\n addClass(element, NG_TRIGGER_CLASSNAME);\n addClass(element, NG_TRIGGER_CLASSNAME + '-' + name);\n triggersWithStates.set(name, DEFAULT_STATE_VALUE);\n }\n return () => {\n // the event listener is removed AFTER the flush has occurred such\n // that leave animations callbacks can fire (otherwise if the node\n // is removed in between then the listeners would be deregistered)\n this._engine.afterFlush(() => {\n const index = listeners.indexOf(data);\n if (index >= 0) {\n listeners.splice(index, 1);\n }\n if (!this._triggers.has(name)) {\n triggersWithStates.delete(name);\n }\n });\n };\n }\n register(name, ast) {\n if (this._triggers.has(name)) {\n // throw\n return false;\n }\n else {\n this._triggers.set(name, ast);\n return true;\n }\n }\n _getTrigger(name) {\n const trigger = this._triggers.get(name);\n if (!trigger) {\n throw unregisteredTrigger(name);\n }\n return trigger;\n }\n trigger(element, triggerName, value, defaultToFallback = true) {\n const trigger = this._getTrigger(triggerName);\n const player = new TransitionAnimationPlayer(this.id, triggerName, element);\n let triggersWithStates = this._engine.statesByElement.get(element);\n if (!triggersWithStates) {\n addClass(element, NG_TRIGGER_CLASSNAME);\n addClass(element, NG_TRIGGER_CLASSNAME + '-' + triggerName);\n this._engine.statesByElement.set(element, (triggersWithStates = new Map()));\n }\n let fromState = triggersWithStates.get(triggerName);\n const toState = new StateValue(value, this.id);\n const isObj = value && value.hasOwnProperty('value');\n if (!isObj && fromState) {\n toState.absorbOptions(fromState.options);\n }\n triggersWithStates.set(triggerName, toState);\n if (!fromState) {\n fromState = DEFAULT_STATE_VALUE;\n }\n const isRemoval = toState.value === VOID_VALUE;\n // normally this isn't reached by here, however, if an object expression\n // is passed in then it may be a new object each time. Comparing the value\n // is important since that will stay the same despite there being a new object.\n // The removal arc here is special cased because the same element is triggered\n // twice in the event that it contains animations on the outer/inner portions\n // of the host container\n if (!isRemoval && fromState.value === toState.value) {\n // this means that despite the value not changing, some inner params\n // have changed which means that the animation final styles need to be applied\n if (!objEquals(fromState.params, toState.params)) {\n const errors = [];\n const fromStyles = trigger.matchStyles(fromState.value, fromState.params, errors);\n const toStyles = trigger.matchStyles(toState.value, toState.params, errors);\n if (errors.length) {\n this._engine.reportError(errors);\n }\n else {\n this._engine.afterFlush(() => {\n eraseStyles(element, fromStyles);\n setStyles(element, toStyles);\n });\n }\n }\n return;\n }\n const playersOnElement = getOrSetDefaultValue(this._engine.playersByElement, element, []);\n playersOnElement.forEach((player) => {\n // only remove the player if it is queued on the EXACT same trigger/namespace\n // we only also deal with queued players here because if the animation has\n // started then we want to keep the player alive until the flush happens\n // (which is where the previousPlayers are passed into the new player)\n if (player.namespaceId == this.id && player.triggerName == triggerName && player.queued) {\n player.destroy();\n }\n });\n let transition = trigger.matchTransition(fromState.value, toState.value, element, toState.params);\n let isFallbackTransition = false;\n if (!transition) {\n if (!defaultToFallback)\n return;\n transition = trigger.fallbackTransition;\n isFallbackTransition = true;\n }\n this._engine.totalQueuedPlayers++;\n this._queue.push({\n element,\n triggerName,\n transition,\n fromState,\n toState,\n player,\n isFallbackTransition,\n });\n if (!isFallbackTransition) {\n addClass(element, QUEUED_CLASSNAME);\n player.onStart(() => {\n removeClass(element, QUEUED_CLASSNAME);\n });\n }\n player.onDone(() => {\n let index = this.players.indexOf(player);\n if (index >= 0) {\n this.players.splice(index, 1);\n }\n const players = this._engine.playersByElement.get(element);\n if (players) {\n let index = players.indexOf(player);\n if (index >= 0) {\n players.splice(index, 1);\n }\n }\n });\n this.players.push(player);\n playersOnElement.push(player);\n return player;\n }\n deregister(name) {\n this._triggers.delete(name);\n this._engine.statesByElement.forEach((stateMap) => stateMap.delete(name));\n this._elementListeners.forEach((listeners, element) => {\n this._elementListeners.set(element, listeners.filter((entry) => {\n return entry.name != name;\n }));\n });\n }\n clearElementCache(element) {\n this._engine.statesByElement.delete(element);\n this._elementListeners.delete(element);\n const elementPlayers = this._engine.playersByElement.get(element);\n if (elementPlayers) {\n elementPlayers.forEach((player) => player.destroy());\n this._engine.playersByElement.delete(element);\n }\n }\n _signalRemovalForInnerTriggers(rootElement, context) {\n const elements = this._engine.driver.query(rootElement, NG_TRIGGER_SELECTOR, true);\n // emulate a leave animation for all inner nodes within this node.\n // If there are no animations found for any of the nodes then clear the cache\n // for the element.\n elements.forEach((elm) => {\n // this means that an inner remove() operation has already kicked off\n // the animation on this element...\n if (elm[REMOVAL_FLAG])\n return;\n const namespaces = this._engine.fetchNamespacesByElement(elm);\n if (namespaces.size) {\n namespaces.forEach((ns) => ns.triggerLeaveAnimation(elm, context, false, true));\n }\n else {\n this.clearElementCache(elm);\n }\n });\n // If the child elements were removed along with the parent, their animations might not\n // have completed. Clear all the elements from the cache so we don't end up with a memory leak.\n this._engine.afterFlushAnimationsDone(() => elements.forEach((elm) => this.clearElementCache(elm)));\n }\n triggerLeaveAnimation(element, context, destroyAfterComplete, defaultToFallback) {\n const triggerStates = this._engine.statesByElement.get(element);\n const previousTriggersValues = new Map();\n if (triggerStates) {\n const players = [];\n triggerStates.forEach((state, triggerName) => {\n previousTriggersValues.set(triggerName, state.value);\n // this check is here in the event that an element is removed\n // twice (both on the host level and the component level)\n if (this._triggers.has(triggerName)) {\n const player = this.trigger(element, triggerName, VOID_VALUE, defaultToFallback);\n if (player) {\n players.push(player);\n }\n }\n });\n if (players.length) {\n this._engine.markElementAsRemoved(this.id, element, true, context, previousTriggersValues);\n if (destroyAfterComplete) {\n optimizeGroupPlayer(players).onDone(() => this._engine.processLeaveNode(element));\n }\n return true;\n }\n }\n return false;\n }\n prepareLeaveAnimationListeners(element) {\n const listeners = this._elementListeners.get(element);\n const elementStates = this._engine.statesByElement.get(element);\n // if this statement fails then it means that the element was picked up\n // by an earlier flush (or there are no listeners at all to track the leave).\n if (listeners && elementStates) {\n const visitedTriggers = new Set();\n listeners.forEach((listener) => {\n const triggerName = listener.name;\n if (visitedTriggers.has(triggerName))\n return;\n visitedTriggers.add(triggerName);\n const trigger = this._triggers.get(triggerName);\n const transition = trigger.fallbackTransition;\n const fromState = elementStates.get(triggerName) || DEFAULT_STATE_VALUE;\n const toState = new StateValue(VOID_VALUE);\n const player = new TransitionAnimationPlayer(this.id, triggerName, element);\n this._engine.totalQueuedPlayers++;\n this._queue.push({\n element,\n triggerName,\n transition,\n fromState,\n toState,\n player,\n isFallbackTransition: true,\n });\n });\n }\n }\n removeNode(element, context) {\n const engine = this._engine;\n if (element.childElementCount) {\n this._signalRemovalForInnerTriggers(element, context);\n }\n // this means that a * => VOID animation was detected and kicked off\n if (this.triggerLeaveAnimation(element, context, true))\n return;\n // find the player that is animating and make sure that the\n // removal is delayed until that player has completed\n let containsPotentialParentTransition = false;\n if (engine.totalAnimations) {\n const currentPlayers = engine.players.length\n ? engine.playersByQueriedElement.get(element)\n : [];\n // when this `if statement` does not continue forward it means that\n // a previous animation query has selected the current element and\n // is animating it. In this situation want to continue forwards and\n // allow the element to be queued up for animation later.\n if (currentPlayers && currentPlayers.length) {\n containsPotentialParentTransition = true;\n }\n else {\n let parent = element;\n while ((parent = parent.parentNode)) {\n const triggers = engine.statesByElement.get(parent);\n if (triggers) {\n containsPotentialParentTransition = true;\n break;\n }\n }\n }\n }\n // at this stage we know that the element will either get removed\n // during flush or will be picked up by a parent query. Either way\n // we need to fire the listeners for this element when it DOES get\n // removed (once the query parent animation is done or after flush)\n this.prepareLeaveAnimationListeners(element);\n // whether or not a parent has an animation we need to delay the deferral of the leave\n // operation until we have more information (which we do after flush() has been called)\n if (containsPotentialParentTransition) {\n engine.markElementAsRemoved(this.id, element, false, context);\n }\n else {\n const removalFlag = element[REMOVAL_FLAG];\n if (!removalFlag || removalFlag === NULL_REMOVAL_STATE) {\n // we do this after the flush has occurred such\n // that the callbacks can be fired\n engine.afterFlush(() => this.clearElementCache(element));\n engine.destroyInnerAnimations(element);\n engine._onRemovalComplete(element, context);\n }\n }\n }\n insertNode(element, parent) {\n addClass(element, this._hostClassName);\n }\n drainQueuedTransitions(microtaskId) {\n const instructions = [];\n this._queue.forEach((entry) => {\n const player = entry.player;\n if (player.destroyed)\n return;\n const element = entry.element;\n const listeners = this._elementListeners.get(element);\n if (listeners) {\n listeners.forEach((listener) => {\n if (listener.name == entry.triggerName) {\n const baseEvent = makeAnimationEvent(element, entry.triggerName, entry.fromState.value, entry.toState.value);\n baseEvent['_data'] = microtaskId;\n listenOnPlayer(entry.player, listener.phase, baseEvent, listener.callback);\n }\n });\n }\n if (player.markedForDestroy) {\n this._engine.afterFlush(() => {\n // now we can destroy the element properly since the event listeners have\n // been bound to the player\n player.destroy();\n });\n }\n else {\n instructions.push(entry);\n }\n });\n this._queue = [];\n return instructions.sort((a, b) => {\n // if depCount == 0 them move to front\n // otherwise if a contains b then move back\n const d0 = a.transition.ast.depCount;\n const d1 = b.transition.ast.depCount;\n if (d0 == 0 || d1 == 0) {\n return d0 - d1;\n }\n return this._engine.driver.containsElement(a.element, b.element) ? 1 : -1;\n });\n }\n destroy(context) {\n this.players.forEach((p) => p.destroy());\n this._signalRemovalForInnerTriggers(this.hostElement, context);\n }\n}\nclass TransitionAnimationEngine {\n /** @internal */\n _onRemovalComplete(element, context) {\n this.onRemovalComplete(element, context);\n }\n constructor(bodyNode, driver, _normalizer) {\n this.bodyNode = bodyNode;\n this.driver = driver;\n this._normalizer = _normalizer;\n this.players = [];\n this.newHostElements = new Map();\n this.playersByElement = new Map();\n this.playersByQueriedElement = new Map();\n this.statesByElement = new Map();\n this.disabledNodes = new Set();\n this.totalAnimations = 0;\n this.totalQueuedPlayers = 0;\n this._namespaceLookup = {};\n this._namespaceList = [];\n this._flushFns = [];\n this._whenQuietFns = [];\n this.namespacesByHostElement = new Map();\n this.collectedEnterElements = [];\n this.collectedLeaveElements = [];\n // this method is designed to be overridden by the code that uses this engine\n this.onRemovalComplete = (element, context) => { };\n }\n get queuedPlayers() {\n const players = [];\n this._namespaceList.forEach((ns) => {\n ns.players.forEach((player) => {\n if (player.queued) {\n players.push(player);\n }\n });\n });\n return players;\n }\n createNamespace(namespaceId, hostElement) {\n const ns = new AnimationTransitionNamespace(namespaceId, hostElement, this);\n if (this.bodyNode && this.driver.containsElement(this.bodyNode, hostElement)) {\n this._balanceNamespaceList(ns, hostElement);\n }\n else {\n // defer this later until flush during when the host element has\n // been inserted so that we know exactly where to place it in\n // the namespace list\n this.newHostElements.set(hostElement, ns);\n // given that this host element is a part of the animation code, it\n // may or may not be inserted by a parent node that is of an\n // animation renderer type. If this happens then we can still have\n // access to this item when we query for :enter nodes. If the parent\n // is a renderer then the set data-structure will normalize the entry\n this.collectEnterElement(hostElement);\n }\n return (this._namespaceLookup[namespaceId] = ns);\n }\n _balanceNamespaceList(ns, hostElement) {\n const namespaceList = this._namespaceList;\n const namespacesByHostElement = this.namespacesByHostElement;\n const limit = namespaceList.length - 1;\n if (limit >= 0) {\n let found = false;\n // Find the closest ancestor with an existing namespace so we can then insert `ns` after it,\n // establishing a top-down ordering of namespaces in `this._namespaceList`.\n let ancestor = this.driver.getParentElement(hostElement);\n while (ancestor) {\n const ancestorNs = namespacesByHostElement.get(ancestor);\n if (ancestorNs) {\n // An animation namespace has been registered for this ancestor, so we insert `ns`\n // right after it to establish top-down ordering of animation namespaces.\n const index = namespaceList.indexOf(ancestorNs);\n namespaceList.splice(index + 1, 0, ns);\n found = true;\n break;\n }\n ancestor = this.driver.getParentElement(ancestor);\n }\n if (!found) {\n // No namespace exists that is an ancestor of `ns`, so `ns` is inserted at the front to\n // ensure that any existing descendants are ordered after `ns`, retaining the desired\n // top-down ordering.\n namespaceList.unshift(ns);\n }\n }\n else {\n namespaceList.push(ns);\n }\n namespacesByHostElement.set(hostElement, ns);\n return ns;\n }\n register(namespaceId, hostElement) {\n let ns = this._namespaceLookup[namespaceId];\n if (!ns) {\n ns = this.createNamespace(namespaceId, hostElement);\n }\n return ns;\n }\n registerTrigger(namespaceId, name, trigger) {\n let ns = this._namespaceLookup[namespaceId];\n if (ns && ns.register(name, trigger)) {\n this.totalAnimations++;\n }\n }\n destroy(namespaceId, context) {\n if (!namespaceId)\n return;\n this.afterFlush(() => { });\n this.afterFlushAnimationsDone(() => {\n const ns = this._fetchNamespace(namespaceId);\n this.namespacesByHostElement.delete(ns.hostElement);\n const index = this._namespaceList.indexOf(ns);\n if (index >= 0) {\n this._namespaceList.splice(index, 1);\n }\n ns.destroy(context);\n delete this._namespaceLookup[namespaceId];\n });\n }\n _fetchNamespace(id) {\n return this._namespaceLookup[id];\n }\n fetchNamespacesByElement(element) {\n // normally there should only be one namespace per element, however\n // if @triggers are placed on both the component element and then\n // its host element (within the component code) then there will be\n // two namespaces returned. We use a set here to simply deduplicate\n // the namespaces in case (for the reason described above) there are multiple triggers\n const namespaces = new Set();\n const elementStates = this.statesByElement.get(element);\n if (elementStates) {\n for (let stateValue of elementStates.values()) {\n if (stateValue.namespaceId) {\n const ns = this._fetchNamespace(stateValue.namespaceId);\n if (ns) {\n namespaces.add(ns);\n }\n }\n }\n }\n return namespaces;\n }\n trigger(namespaceId, element, name, value) {\n if (isElementNode(element)) {\n const ns = this._fetchNamespace(namespaceId);\n if (ns) {\n ns.trigger(element, name, value);\n return true;\n }\n }\n return false;\n }\n insertNode(namespaceId, element, parent, insertBefore) {\n if (!isElementNode(element))\n return;\n // special case for when an element is removed and reinserted (move operation)\n // when this occurs we do not want to use the element for deletion later\n const details = element[REMOVAL_FLAG];\n if (details && details.setForRemoval) {\n details.setForRemoval = false;\n details.setForMove = true;\n const index = this.collectedLeaveElements.indexOf(element);\n if (index >= 0) {\n this.collectedLeaveElements.splice(index, 1);\n }\n }\n // in the event that the namespaceId is blank then the caller\n // code does not contain any animation code in it, but it is\n // just being called so that the node is marked as being inserted\n if (namespaceId) {\n const ns = this._fetchNamespace(namespaceId);\n // This if-statement is a workaround for router issue #21947.\n // The router sometimes hits a race condition where while a route\n // is being instantiated a new navigation arrives, triggering leave\n // animation of DOM that has not been fully initialized, until this\n // is resolved, we need to handle the scenario when DOM is not in a\n // consistent state during the animation.\n if (ns) {\n ns.insertNode(element, parent);\n }\n }\n // only *directives and host elements are inserted before\n if (insertBefore) {\n this.collectEnterElement(element);\n }\n }\n collectEnterElement(element) {\n this.collectedEnterElements.push(element);\n }\n markElementAsDisabled(element, value) {\n if (value) {\n if (!this.disabledNodes.has(element)) {\n this.disabledNodes.add(element);\n addClass(element, DISABLED_CLASSNAME);\n }\n }\n else if (this.disabledNodes.has(element)) {\n this.disabledNodes.delete(element);\n removeClass(element, DISABLED_CLASSNAME);\n }\n }\n removeNode(namespaceId, element, context) {\n if (isElementNode(element)) {\n const ns = namespaceId ? this._fetchNamespace(namespaceId) : null;\n if (ns) {\n ns.removeNode(element, context);\n }\n else {\n this.markElementAsRemoved(namespaceId, element, false, context);\n }\n const hostNS = this.namespacesByHostElement.get(element);\n if (hostNS && hostNS.id !== namespaceId) {\n hostNS.removeNode(element, context);\n }\n }\n else {\n this._onRemovalComplete(element, context);\n }\n }\n markElementAsRemoved(namespaceId, element, hasAnimation, context, previousTriggersValues) {\n this.collectedLeaveElements.push(element);\n element[REMOVAL_FLAG] = {\n namespaceId,\n setForRemoval: context,\n hasAnimation,\n removedBeforeQueried: false,\n previousTriggersValues,\n };\n }\n listen(namespaceId, element, name, phase, callback) {\n if (isElementNode(element)) {\n return this._fetchNamespace(namespaceId).listen(element, name, phase, callback);\n }\n return () => { };\n }\n _buildInstruction(entry, subTimelines, enterClassName, leaveClassName, skipBuildAst) {\n return entry.transition.build(this.driver, entry.element, entry.fromState.value, entry.toState.value, enterClassName, leaveClassName, entry.fromState.options, entry.toState.options, subTimelines, skipBuildAst);\n }\n destroyInnerAnimations(containerElement) {\n let elements = this.driver.query(containerElement, NG_TRIGGER_SELECTOR, true);\n elements.forEach((element) => this.destroyActiveAnimationsForElement(element));\n if (this.playersByQueriedElement.size == 0)\n return;\n elements = this.driver.query(containerElement, NG_ANIMATING_SELECTOR, true);\n elements.forEach((element) => this.finishActiveQueriedAnimationOnElement(element));\n }\n destroyActiveAnimationsForElement(element) {\n const players = this.playersByElement.get(element);\n if (players) {\n players.forEach((player) => {\n // special case for when an element is set for destruction, but hasn't started.\n // in this situation we want to delay the destruction until the flush occurs\n // so that any event listeners attached to the player are triggered.\n if (player.queued) {\n player.markedForDestroy = true;\n }\n else {\n player.destroy();\n }\n });\n }\n }\n finishActiveQueriedAnimationOnElement(element) {\n const players = this.playersByQueriedElement.get(element);\n if (players) {\n players.forEach((player) => player.finish());\n }\n }\n whenRenderingDone() {\n return new Promise((resolve) => {\n if (this.players.length) {\n return optimizeGroupPlayer(this.players).onDone(() => resolve());\n }\n else {\n resolve();\n }\n });\n }\n processLeaveNode(element) {\n const details = element[REMOVAL_FLAG];\n if (details && details.setForRemoval) {\n // this will prevent it from removing it twice\n element[REMOVAL_FLAG] = NULL_REMOVAL_STATE;\n if (details.namespaceId) {\n this.destroyInnerAnimations(element);\n const ns = this._fetchNamespace(details.namespaceId);\n if (ns) {\n ns.clearElementCache(element);\n }\n }\n this._onRemovalComplete(element, details.setForRemoval);\n }\n if (element.classList?.contains(DISABLED_CLASSNAME)) {\n this.markElementAsDisabled(element, false);\n }\n this.driver.query(element, DISABLED_SELECTOR, true).forEach((node) => {\n this.markElementAsDisabled(node, false);\n });\n }\n flush(microtaskId = -1) {\n let players = [];\n if (this.newHostElements.size) {\n this.newHostElements.forEach((ns, element) => this._balanceNamespaceList(ns, element));\n this.newHostElements.clear();\n }\n if (this.totalAnimations && this.collectedEnterElements.length) {\n for (let i = 0; i < this.collectedEnterElements.length; i++) {\n const elm = this.collectedEnterElements[i];\n addClass(elm, STAR_CLASSNAME);\n }\n }\n if (this._namespaceList.length &&\n (this.totalQueuedPlayers || this.collectedLeaveElements.length)) {\n const cleanupFns = [];\n try {\n players = this._flushAnimations(cleanupFns, microtaskId);\n }\n finally {\n for (let i = 0; i < cleanupFns.length; i++) {\n cleanupFns[i]();\n }\n }\n }\n else {\n for (let i = 0; i < this.collectedLeaveElements.length; i++) {\n const element = this.collectedLeaveElements[i];\n this.processLeaveNode(element);\n }\n }\n this.totalQueuedPlayers = 0;\n this.collectedEnterElements.length = 0;\n this.collectedLeaveElements.length = 0;\n this._flushFns.forEach((fn) => fn());\n this._flushFns = [];\n if (this._whenQuietFns.length) {\n // we move these over to a variable so that\n // if any new callbacks are registered in another\n // flush they do not populate the existing set\n const quietFns = this._whenQuietFns;\n this._whenQuietFns = [];\n if (players.length) {\n optimizeGroupPlayer(players).onDone(() => {\n quietFns.forEach((fn) => fn());\n });\n }\n else {\n quietFns.forEach((fn) => fn());\n }\n }\n }\n reportError(errors) {\n throw triggerTransitionsFailed(errors);\n }\n _flushAnimations(cleanupFns, microtaskId) {\n const subTimelines = new ElementInstructionMap();\n const skippedPlayers = [];\n const skippedPlayersMap = new Map();\n const queuedInstructions = [];\n const queriedElements = new Map();\n const allPreStyleElements = new Map();\n const allPostStyleElements = new Map();\n const disabledElementsSet = new Set();\n this.disabledNodes.forEach((node) => {\n disabledElementsSet.add(node);\n const nodesThatAreDisabled = this.driver.query(node, QUEUED_SELECTOR, true);\n for (let i = 0; i < nodesThatAreDisabled.length; i++) {\n disabledElementsSet.add(nodesThatAreDisabled[i]);\n }\n });\n const bodyNode = this.bodyNode;\n const allTriggerElements = Array.from(this.statesByElement.keys());\n const enterNodeMap = buildRootMap(allTriggerElements, this.collectedEnterElements);\n // this must occur before the instructions are built below such that\n // the :enter queries match the elements (since the timeline queries\n // are fired during instruction building).\n const enterNodeMapIds = new Map();\n let i = 0;\n enterNodeMap.forEach((nodes, root) => {\n const className = ENTER_CLASSNAME + i++;\n enterNodeMapIds.set(root, className);\n nodes.forEach((node) => addClass(node, className));\n });\n const allLeaveNodes = [];\n const mergedLeaveNodes = new Set();\n const leaveNodesWithoutAnimations = new Set();\n for (let i = 0; i < this.collectedLeaveElements.length; i++) {\n const element = this.collectedLeaveElements[i];\n const details = element[REMOVAL_FLAG];\n if (details && details.setForRemoval) {\n allLeaveNodes.push(element);\n mergedLeaveNodes.add(element);\n if (details.hasAnimation) {\n this.driver\n .query(element, STAR_SELECTOR, true)\n .forEach((elm) => mergedLeaveNodes.add(elm));\n }\n else {\n leaveNodesWithoutAnimations.add(element);\n }\n }\n }\n const leaveNodeMapIds = new Map();\n const leaveNodeMap = buildRootMap(allTriggerElements, Array.from(mergedLeaveNodes));\n leaveNodeMap.forEach((nodes, root) => {\n const className = LEAVE_CLASSNAME + i++;\n leaveNodeMapIds.set(root, className);\n nodes.forEach((node) => addClass(node, className));\n });\n cleanupFns.push(() => {\n enterNodeMap.forEach((nodes, root) => {\n const className = enterNodeMapIds.get(root);\n nodes.forEach((node) => removeClass(node, className));\n });\n leaveNodeMap.forEach((nodes, root) => {\n const className = leaveNodeMapIds.get(root);\n nodes.forEach((node) => removeClass(node, className));\n });\n allLeaveNodes.forEach((element) => {\n this.processLeaveNode(element);\n });\n });\n const allPlayers = [];\n const erroneousTransitions = [];\n for (let i = this._namespaceList.length - 1; i >= 0; i--) {\n const ns = this._namespaceList[i];\n ns.drainQueuedTransitions(microtaskId).forEach((entry) => {\n const player = entry.player;\n const element = entry.element;\n allPlayers.push(player);\n if (this.collectedEnterElements.length) {\n const details = element[REMOVAL_FLAG];\n // animations for move operations (elements being removed and reinserted,\n // e.g. when the order of an *ngFor list changes) are currently not supported\n if (details && details.setForMove) {\n if (details.previousTriggersValues &&\n details.previousTriggersValues.has(entry.triggerName)) {\n const previousValue = details.previousTriggersValues.get(entry.triggerName);\n // we need to restore the previous trigger value since the element has\n // only been moved and hasn't actually left the DOM\n const triggersWithStates = this.statesByElement.get(entry.element);\n if (triggersWithStates && triggersWithStates.has(entry.triggerName)) {\n const state = triggersWithStates.get(entry.triggerName);\n state.value = previousValue;\n triggersWithStates.set(entry.triggerName, state);\n }\n }\n player.destroy();\n return;\n }\n }\n const nodeIsOrphaned = !bodyNode || !this.driver.containsElement(bodyNode, element);\n const leaveClassName = leaveNodeMapIds.get(element);\n const enterClassName = enterNodeMapIds.get(element);\n const instruction = this._buildInstruction(entry, subTimelines, enterClassName, leaveClassName, nodeIsOrphaned);\n if (instruction.errors && instruction.errors.length) {\n erroneousTransitions.push(instruction);\n return;\n }\n // even though the element may not be in the DOM, it may still\n // be added at a later point (due to the mechanics of content\n // projection and/or dynamic component insertion) therefore it's\n // important to still style the element.\n if (nodeIsOrphaned) {\n player.onStart(() => eraseStyles(element, instruction.fromStyles));\n player.onDestroy(() => setStyles(element, instruction.toStyles));\n skippedPlayers.push(player);\n return;\n }\n // if an unmatched transition is queued and ready to go\n // then it SHOULD NOT render an animation and cancel the\n // previously running animations.\n if (entry.isFallbackTransition) {\n player.onStart(() => eraseStyles(element, instruction.fromStyles));\n player.onDestroy(() => setStyles(element, instruction.toStyles));\n skippedPlayers.push(player);\n return;\n }\n // this means that if a parent animation uses this animation as a sub-trigger\n // then it will instruct the timeline builder not to add a player delay, but\n // instead stretch the first keyframe gap until the animation starts. This is\n // important in order to prevent extra initialization styles from being\n // required by the user for the animation.\n const timelines = [];\n instruction.timelines.forEach((tl) => {\n tl.stretchStartingKeyframe = true;\n if (!this.disabledNodes.has(tl.element)) {\n timelines.push(tl);\n }\n });\n instruction.timelines = timelines;\n subTimelines.append(element, instruction.timelines);\n const tuple = { instruction, player, element };\n queuedInstructions.push(tuple);\n instruction.queriedElements.forEach((element) => getOrSetDefaultValue(queriedElements, element, []).push(player));\n instruction.preStyleProps.forEach((stringMap, element) => {\n if (stringMap.size) {\n let setVal = allPreStyleElements.get(element);\n if (!setVal) {\n allPreStyleElements.set(element, (setVal = new Set()));\n }\n stringMap.forEach((_, prop) => setVal.add(prop));\n }\n });\n instruction.postStyleProps.forEach((stringMap, element) => {\n let setVal = allPostStyleElements.get(element);\n if (!setVal) {\n allPostStyleElements.set(element, (setVal = new Set()));\n }\n stringMap.forEach((_, prop) => setVal.add(prop));\n });\n });\n }\n if (erroneousTransitions.length) {\n const errors = [];\n erroneousTransitions.forEach((instruction) => {\n errors.push(transitionFailed(instruction.triggerName, instruction.errors));\n });\n allPlayers.forEach((player) => player.destroy());\n this.reportError(errors);\n }\n const allPreviousPlayersMap = new Map();\n // this map tells us which element in the DOM tree is contained by\n // which animation. Further down this map will get populated once\n // the players are built and in doing so we can use it to efficiently\n // figure out if a sub player is skipped due to a parent player having priority.\n const animationElementMap = new Map();\n queuedInstructions.forEach((entry) => {\n const element = entry.element;\n if (subTimelines.has(element)) {\n animationElementMap.set(element, element);\n this._beforeAnimationBuild(entry.player.namespaceId, entry.instruction, allPreviousPlayersMap);\n }\n });\n skippedPlayers.forEach((player) => {\n const element = player.element;\n const previousPlayers = this._getPreviousPlayers(element, false, player.namespaceId, player.triggerName, null);\n previousPlayers.forEach((prevPlayer) => {\n getOrSetDefaultValue(allPreviousPlayersMap, element, []).push(prevPlayer);\n prevPlayer.destroy();\n });\n });\n // this is a special case for nodes that will be removed either by\n // having their own leave animations or by being queried in a container\n // that will be removed once a parent animation is complete. The idea\n // here is that * styles must be identical to ! styles because of\n // backwards compatibility (* is also filled in by default in many places).\n // Otherwise * styles will return an empty value or \"auto\" since the element\n // passed to getComputedStyle will not be visible (since * === destination)\n const replaceNodes = allLeaveNodes.filter((node) => {\n return replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements);\n });\n // POST STAGE: fill the * styles\n const postStylesMap = new Map();\n const allLeaveQueriedNodes = cloakAndComputeStyles(postStylesMap, this.driver, leaveNodesWithoutAnimations, allPostStyleElements, AUTO_STYLE);\n allLeaveQueriedNodes.forEach((node) => {\n if (replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements)) {\n replaceNodes.push(node);\n }\n });\n // PRE STAGE: fill the ! styles\n const preStylesMap = new Map();\n enterNodeMap.forEach((nodes, root) => {\n cloakAndComputeStyles(preStylesMap, this.driver, new Set(nodes), allPreStyleElements, ɵPRE_STYLE);\n });\n replaceNodes.forEach((node) => {\n const post = postStylesMap.get(node);\n const pre = preStylesMap.get(node);\n postStylesMap.set(node, new Map([...(post?.entries() ?? []), ...(pre?.entries() ?? [])]));\n });\n const rootPlayers = [];\n const subPlayers = [];\n const NO_PARENT_ANIMATION_ELEMENT_DETECTED = {};\n queuedInstructions.forEach((entry) => {\n const { element, player, instruction } = entry;\n // this means that it was never consumed by a parent animation which\n // means that it is independent and therefore should be set for animation\n if (subTimelines.has(element)) {\n if (disabledElementsSet.has(element)) {\n player.onDestroy(() => setStyles(element, instruction.toStyles));\n player.disabled = true;\n player.overrideTotalTime(instruction.totalTime);\n skippedPlayers.push(player);\n return;\n }\n // this will flow up the DOM and query the map to figure out\n // if a parent animation has priority over it. In the situation\n // that a parent is detected then it will cancel the loop. If\n // nothing is detected, or it takes a few hops to find a parent,\n // then it will fill in the missing nodes and signal them as having\n // a detected parent (or a NO_PARENT value via a special constant).\n let parentWithAnimation = NO_PARENT_ANIMATION_ELEMENT_DETECTED;\n if (animationElementMap.size > 1) {\n let elm = element;\n const parentsToAdd = [];\n while ((elm = elm.parentNode)) {\n const detectedParent = animationElementMap.get(elm);\n if (detectedParent) {\n parentWithAnimation = detectedParent;\n break;\n }\n parentsToAdd.push(elm);\n }\n parentsToAdd.forEach((parent) => animationElementMap.set(parent, parentWithAnimation));\n }\n const innerPlayer = this._buildAnimation(player.namespaceId, instruction, allPreviousPlayersMap, skippedPlayersMap, preStylesMap, postStylesMap);\n player.setRealPlayer(innerPlayer);\n if (parentWithAnimation === NO_PARENT_ANIMATION_ELEMENT_DETECTED) {\n rootPlayers.push(player);\n }\n else {\n const parentPlayers = this.playersByElement.get(parentWithAnimation);\n if (parentPlayers && parentPlayers.length) {\n player.parentPlayer = optimizeGroupPlayer(parentPlayers);\n }\n skippedPlayers.push(player);\n }\n }\n else {\n eraseStyles(element, instruction.fromStyles);\n player.onDestroy(() => setStyles(element, instruction.toStyles));\n // there still might be a ancestor player animating this\n // element therefore we will still add it as a sub player\n // even if its animation may be disabled\n subPlayers.push(player);\n if (disabledElementsSet.has(element)) {\n skippedPlayers.push(player);\n }\n }\n });\n // find all of the sub players' corresponding inner animation players\n subPlayers.forEach((player) => {\n // even if no players are found for a sub animation it\n // will still complete itself after the next tick since it's Noop\n const playersForElement = skippedPlayersMap.get(player.element);\n if (playersForElement && playersForElement.length) {\n const innerPlayer = optimizeGroupPlayer(playersForElement);\n player.setRealPlayer(innerPlayer);\n }\n });\n // the reason why we don't actually play the animation is\n // because all that a skipped player is designed to do is to\n // fire the start/done transition callback events\n skippedPlayers.forEach((player) => {\n if (player.parentPlayer) {\n player.syncPlayerEvents(player.parentPlayer);\n }\n else {\n player.destroy();\n }\n });\n // run through all of the queued removals and see if they\n // were picked up by a query. If not then perform the removal\n // operation right away unless a parent animation is ongoing.\n for (let i = 0; i < allLeaveNodes.length; i++) {\n const element = allLeaveNodes[i];\n const details = element[REMOVAL_FLAG];\n removeClass(element, LEAVE_CLASSNAME);\n // this means the element has a removal animation that is being\n // taken care of and therefore the inner elements will hang around\n // until that animation is over (or the parent queried animation)\n if (details && details.hasAnimation)\n continue;\n let players = [];\n // if this element is queried or if it contains queried children\n // then we want for the element not to be removed from the page\n // until the queried animations have finished\n if (queriedElements.size) {\n let queriedPlayerResults = queriedElements.get(element);\n if (queriedPlayerResults && queriedPlayerResults.length) {\n players.push(...queriedPlayerResults);\n }\n let queriedInnerElements = this.driver.query(element, NG_ANIMATING_SELECTOR, true);\n for (let j = 0; j < queriedInnerElements.length; j++) {\n let queriedPlayers = queriedElements.get(queriedInnerElements[j]);\n if (queriedPlayers && queriedPlayers.length) {\n players.push(...queriedPlayers);\n }\n }\n }\n const activePlayers = players.filter((p) => !p.destroyed);\n if (activePlayers.length) {\n removeNodesAfterAnimationDone(this, element, activePlayers);\n }\n else {\n this.processLeaveNode(element);\n }\n }\n // this is required so the cleanup method doesn't remove them\n allLeaveNodes.length = 0;\n rootPlayers.forEach((player) => {\n this.players.push(player);\n player.onDone(() => {\n player.destroy();\n const index = this.players.indexOf(player);\n this.players.splice(index, 1);\n });\n player.play();\n });\n return rootPlayers;\n }\n afterFlush(callback) {\n this._flushFns.push(callback);\n }\n afterFlushAnimationsDone(callback) {\n this._whenQuietFns.push(callback);\n }\n _getPreviousPlayers(element, isQueriedElement, namespaceId, triggerName, toStateValue) {\n let players = [];\n if (isQueriedElement) {\n const queriedElementPlayers = this.playersByQueriedElement.get(element);\n if (queriedElementPlayers) {\n players = queriedElementPlayers;\n }\n }\n else {\n const elementPlayers = this.playersByElement.get(element);\n if (elementPlayers) {\n const isRemovalAnimation = !toStateValue || toStateValue == VOID_VALUE;\n elementPlayers.forEach((player) => {\n if (player.queued)\n return;\n if (!isRemovalAnimation && player.triggerName != triggerName)\n return;\n players.push(player);\n });\n }\n }\n if (namespaceId || triggerName) {\n players = players.filter((player) => {\n if (namespaceId && namespaceId != player.namespaceId)\n return false;\n if (triggerName && triggerName != player.triggerName)\n return false;\n return true;\n });\n }\n return players;\n }\n _beforeAnimationBuild(namespaceId, instruction, allPreviousPlayersMap) {\n const triggerName = instruction.triggerName;\n const rootElement = instruction.element;\n // when a removal animation occurs, ALL previous players are collected\n // and destroyed (even if they are outside of the current namespace)\n const targetNameSpaceId = instruction.isRemovalTransition\n ? undefined\n : namespaceId;\n const targetTriggerName = instruction.isRemovalTransition\n ? undefined\n : triggerName;\n for (const timelineInstruction of instruction.timelines) {\n const element = timelineInstruction.element;\n const isQueriedElement = element !== rootElement;\n const players = getOrSetDefaultValue(allPreviousPlayersMap, element, []);\n const previousPlayers = this._getPreviousPlayers(element, isQueriedElement, targetNameSpaceId, targetTriggerName, instruction.toState);\n previousPlayers.forEach((player) => {\n const realPlayer = player.getRealPlayer();\n if (realPlayer.beforeDestroy) {\n realPlayer.beforeDestroy();\n }\n player.destroy();\n players.push(player);\n });\n }\n // this needs to be done so that the PRE/POST styles can be\n // computed properly without interfering with the previous animation\n eraseStyles(rootElement, instruction.fromStyles);\n }\n _buildAnimation(namespaceId, instruction, allPreviousPlayersMap, skippedPlayersMap, preStylesMap, postStylesMap) {\n const triggerName = instruction.triggerName;\n const rootElement = instruction.element;\n // we first run this so that the previous animation player\n // data can be passed into the successive animation players\n const allQueriedPlayers = [];\n const allConsumedElements = new Set();\n const allSubElements = new Set();\n const allNewPlayers = instruction.timelines.map((timelineInstruction) => {\n const element = timelineInstruction.element;\n allConsumedElements.add(element);\n // FIXME (matsko): make sure to-be-removed animations are removed properly\n const details = element[REMOVAL_FLAG];\n if (details && details.removedBeforeQueried)\n return new NoopAnimationPlayer(timelineInstruction.duration, timelineInstruction.delay);\n const isQueriedElement = element !== rootElement;\n const previousPlayers = flattenGroupPlayers((allPreviousPlayersMap.get(element) || EMPTY_PLAYER_ARRAY).map((p) => p.getRealPlayer())).filter((p) => {\n // the `element` is not apart of the AnimationPlayer definition, but\n // Mock/WebAnimations\n // use the element within their implementation. This will be added in Angular5 to\n // AnimationPlayer\n const pp = p;\n return pp.element ? pp.element === element : false;\n });\n const preStyles = preStylesMap.get(element);\n const postStyles = postStylesMap.get(element);\n const keyframes = normalizeKeyframes$1(this._normalizer, timelineInstruction.keyframes, preStyles, postStyles);\n const player = this._buildPlayer(timelineInstruction, keyframes, previousPlayers);\n // this means that this particular player belongs to a sub trigger. It is\n // important that we match this player up with the corresponding (@trigger.listener)\n if (timelineInstruction.subTimeline && skippedPlayersMap) {\n allSubElements.add(element);\n }\n if (isQueriedElement) {\n const wrappedPlayer = new TransitionAnimationPlayer(namespaceId, triggerName, element);\n wrappedPlayer.setRealPlayer(player);\n allQueriedPlayers.push(wrappedPlayer);\n }\n return player;\n });\n allQueriedPlayers.forEach((player) => {\n getOrSetDefaultValue(this.playersByQueriedElement, player.element, []).push(player);\n player.onDone(() => deleteOrUnsetInMap(this.playersByQueriedElement, player.element, player));\n });\n allConsumedElements.forEach((element) => addClass(element, NG_ANIMATING_CLASSNAME));\n const player = optimizeGroupPlayer(allNewPlayers);\n player.onDestroy(() => {\n allConsumedElements.forEach((element) => removeClass(element, NG_ANIMATING_CLASSNAME));\n setStyles(rootElement, instruction.toStyles);\n });\n // this basically makes all of the callbacks for sub element animations\n // be dependent on the upper players for when they finish\n allSubElements.forEach((element) => {\n getOrSetDefaultValue(skippedPlayersMap, element, []).push(player);\n });\n return player;\n }\n _buildPlayer(instruction, keyframes, previousPlayers) {\n if (keyframes.length > 0) {\n return this.driver.animate(instruction.element, keyframes, instruction.duration, instruction.delay, instruction.easing, previousPlayers);\n }\n // special case for when an empty transition|definition is provided\n // ... there is no point in rendering an empty animation\n return new NoopAnimationPlayer(instruction.duration, instruction.delay);\n }\n}\nclass TransitionAnimationPlayer {\n constructor(namespaceId, triggerName, element) {\n this.namespaceId = namespaceId;\n this.triggerName = triggerName;\n this.element = element;\n this._player = new NoopAnimationPlayer();\n this._containsRealPlayer = false;\n this._queuedCallbacks = new Map();\n this.destroyed = false;\n this.parentPlayer = null;\n this.markedForDestroy = false;\n this.disabled = false;\n this.queued = true;\n this.totalTime = 0;\n }\n setRealPlayer(player) {\n if (this._containsRealPlayer)\n return;\n this._player = player;\n this._queuedCallbacks.forEach((callbacks, phase) => {\n callbacks.forEach((callback) => listenOnPlayer(player, phase, undefined, callback));\n });\n this._queuedCallbacks.clear();\n this._containsRealPlayer = true;\n this.overrideTotalTime(player.totalTime);\n this.queued = false;\n }\n getRealPlayer() {\n return this._player;\n }\n overrideTotalTime(totalTime) {\n this.totalTime = totalTime;\n }\n syncPlayerEvents(player) {\n const p = this._player;\n if (p.triggerCallback) {\n player.onStart(() => p.triggerCallback('start'));\n }\n player.onDone(() => this.finish());\n player.onDestroy(() => this.destroy());\n }\n _queueEvent(name, callback) {\n getOrSetDefaultValue(this._queuedCallbacks, name, []).push(callback);\n }\n onDone(fn) {\n if (this.queued) {\n this._queueEvent('done', fn);\n }\n this._player.onDone(fn);\n }\n onStart(fn) {\n if (this.queued) {\n this._queueEvent('start', fn);\n }\n this._player.onStart(fn);\n }\n onDestroy(fn) {\n if (this.queued) {\n this._queueEvent('destroy', fn);\n }\n this._player.onDestroy(fn);\n }\n init() {\n this._player.init();\n }\n hasStarted() {\n return this.queued ? false : this._player.hasStarted();\n }\n play() {\n !this.queued && this._player.play();\n }\n pause() {\n !this.queued && this._player.pause();\n }\n restart() {\n !this.queued && this._player.restart();\n }\n finish() {\n this._player.finish();\n }\n destroy() {\n this.destroyed = true;\n this._player.destroy();\n }\n reset() {\n !this.queued && this._player.reset();\n }\n setPosition(p) {\n if (!this.queued) {\n this._player.setPosition(p);\n }\n }\n getPosition() {\n return this.queued ? 0 : this._player.getPosition();\n }\n /** @internal */\n triggerCallback(phaseName) {\n const p = this._player;\n if (p.triggerCallback) {\n p.triggerCallback(phaseName);\n }\n }\n}\nfunction deleteOrUnsetInMap(map, key, value) {\n let currentValues = map.get(key);\n if (currentValues) {\n if (currentValues.length) {\n const index = currentValues.indexOf(value);\n currentValues.splice(index, 1);\n }\n if (currentValues.length == 0) {\n map.delete(key);\n }\n }\n return currentValues;\n}\nfunction normalizeTriggerValue(value) {\n // we use `!= null` here because it's the most simple\n // way to test against a \"falsy\" value without mixing\n // in empty strings or a zero value. DO NOT OPTIMIZE.\n return value != null ? value : null;\n}\nfunction isElementNode(node) {\n return node && node['nodeType'] === 1;\n}\nfunction isTriggerEventValid(eventName) {\n return eventName == 'start' || eventName == 'done';\n}\nfunction cloakElement(element, value) {\n const oldValue = element.style.display;\n element.style.display = value != null ? value : 'none';\n return oldValue;\n}\nfunction cloakAndComputeStyles(valuesMap, driver, elements, elementPropsMap, defaultStyle) {\n const cloakVals = [];\n elements.forEach((element) => cloakVals.push(cloakElement(element)));\n const failedElements = [];\n elementPropsMap.forEach((props, element) => {\n const styles = new Map();\n props.forEach((prop) => {\n const value = driver.computeStyle(element, prop, defaultStyle);\n styles.set(prop, value);\n // there is no easy way to detect this because a sub element could be removed\n // by a parent animation element being detached.\n if (!value || value.length == 0) {\n element[REMOVAL_FLAG] = NULL_REMOVED_QUERIED_STATE;\n failedElements.push(element);\n }\n });\n valuesMap.set(element, styles);\n });\n // we use a index variable here since Set.forEach(a, i) does not return\n // an index value for the closure (but instead just the value)\n let i = 0;\n elements.forEach((element) => cloakElement(element, cloakVals[i++]));\n return failedElements;\n}\n/*\nSince the Angular renderer code will return a collection of inserted\nnodes in all areas of a DOM tree, it's up to this algorithm to figure\nout which nodes are roots for each animation @trigger.\n\nBy placing each inserted node into a Set and traversing upwards, it\nis possible to find the @trigger elements and well any direct *star\ninsertion nodes, if a @trigger root is found then the enter element\nis placed into the Map[@trigger] spot.\n */\nfunction buildRootMap(roots, nodes) {\n const rootMap = new Map();\n roots.forEach((root) => rootMap.set(root, []));\n if (nodes.length == 0)\n return rootMap;\n const NULL_NODE = 1;\n const nodeSet = new Set(nodes);\n const localRootMap = new Map();\n function getRoot(node) {\n if (!node)\n return NULL_NODE;\n let root = localRootMap.get(node);\n if (root)\n return root;\n const parent = node.parentNode;\n if (rootMap.has(parent)) {\n // ngIf inside @trigger\n root = parent;\n }\n else if (nodeSet.has(parent)) {\n // ngIf inside ngIf\n root = NULL_NODE;\n }\n else {\n // recurse upwards\n root = getRoot(parent);\n }\n localRootMap.set(node, root);\n return root;\n }\n nodes.forEach((node) => {\n const root = getRoot(node);\n if (root !== NULL_NODE) {\n rootMap.get(root).push(node);\n }\n });\n return rootMap;\n}\nfunction addClass(element, className) {\n element.classList?.add(className);\n}\nfunction removeClass(element, className) {\n element.classList?.remove(className);\n}\nfunction removeNodesAfterAnimationDone(engine, element, players) {\n optimizeGroupPlayer(players).onDone(() => engine.processLeaveNode(element));\n}\nfunction flattenGroupPlayers(players) {\n const finalPlayers = [];\n _flattenGroupPlayersRecur(players, finalPlayers);\n return finalPlayers;\n}\nfunction _flattenGroupPlayersRecur(players, finalPlayers) {\n for (let i = 0; i < players.length; i++) {\n const player = players[i];\n if (player instanceof ɵAnimationGroupPlayer) {\n _flattenGroupPlayersRecur(player.players, finalPlayers);\n }\n else {\n finalPlayers.push(player);\n }\n }\n}\nfunction objEquals(a, b) {\n const k1 = Object.keys(a);\n const k2 = Object.keys(b);\n if (k1.length != k2.length)\n return false;\n for (let i = 0; i < k1.length; i++) {\n const prop = k1[i];\n if (!b.hasOwnProperty(prop) || a[prop] !== b[prop])\n return false;\n }\n return true;\n}\nfunction replacePostStylesAsPre(element, allPreStyleElements, allPostStyleElements) {\n const postEntry = allPostStyleElements.get(element);\n if (!postEntry)\n return false;\n let preEntry = allPreStyleElements.get(element);\n if (preEntry) {\n postEntry.forEach((data) => preEntry.add(data));\n }\n else {\n allPreStyleElements.set(element, postEntry);\n }\n allPostStyleElements.delete(element);\n return true;\n}\n\nclass AnimationEngine {\n constructor(doc, _driver, _normalizer) {\n this._driver = _driver;\n this._normalizer = _normalizer;\n this._triggerCache = {};\n // this method is designed to be overridden by the code that uses this engine\n this.onRemovalComplete = (element, context) => { };\n this._transitionEngine = new TransitionAnimationEngine(doc.body, _driver, _normalizer);\n this._timelineEngine = new TimelineAnimationEngine(doc.body, _driver, _normalizer);\n this._transitionEngine.onRemovalComplete = (element, context) => this.onRemovalComplete(element, context);\n }\n registerTrigger(componentId, namespaceId, hostElement, name, metadata) {\n const cacheKey = componentId + '-' + name;\n let trigger = this._triggerCache[cacheKey];\n if (!trigger) {\n const errors = [];\n const warnings = [];\n const ast = buildAnimationAst(this._driver, metadata, errors, warnings);\n if (errors.length) {\n throw triggerBuildFailed(name, errors);\n }\n if (warnings.length) {\n warnTriggerBuild(name, warnings);\n }\n trigger = buildTrigger(name, ast, this._normalizer);\n this._triggerCache[cacheKey] = trigger;\n }\n this._transitionEngine.registerTrigger(namespaceId, name, trigger);\n }\n register(namespaceId, hostElement) {\n this._transitionEngine.register(namespaceId, hostElement);\n }\n destroy(namespaceId, context) {\n this._transitionEngine.destroy(namespaceId, context);\n }\n onInsert(namespaceId, element, parent, insertBefore) {\n this._transitionEngine.insertNode(namespaceId, element, parent, insertBefore);\n }\n onRemove(namespaceId, element, context) {\n this._transitionEngine.removeNode(namespaceId, element, context);\n }\n disableAnimations(element, disable) {\n this._transitionEngine.markElementAsDisabled(element, disable);\n }\n process(namespaceId, element, property, value) {\n if (property.charAt(0) == '@') {\n const [id, action] = parseTimelineCommand(property);\n const args = value;\n this._timelineEngine.command(id, element, action, args);\n }\n else {\n this._transitionEngine.trigger(namespaceId, element, property, value);\n }\n }\n listen(namespaceId, element, eventName, eventPhase, callback) {\n // @@listen\n if (eventName.charAt(0) == '@') {\n const [id, action] = parseTimelineCommand(eventName);\n return this._timelineEngine.listen(id, element, action, callback);\n }\n return this._transitionEngine.listen(namespaceId, element, eventName, eventPhase, callback);\n }\n flush(microtaskId = -1) {\n this._transitionEngine.flush(microtaskId);\n }\n get players() {\n return [...this._transitionEngine.players, ...this._timelineEngine.players];\n }\n whenRenderingDone() {\n return this._transitionEngine.whenRenderingDone();\n }\n afterFlushAnimationsDone(cb) {\n this._transitionEngine.afterFlushAnimationsDone(cb);\n }\n}\n\n/**\n * Returns an instance of `SpecialCasedStyles` if and when any special (non animateable) styles are\n * detected.\n *\n * In CSS there exist properties that cannot be animated within a keyframe animation\n * (whether it be via CSS keyframes or web-animations) and the animation implementation\n * will ignore them. This function is designed to detect those special cased styles and\n * return a container that will be executed at the start and end of the animation.\n *\n * @returns an instance of `SpecialCasedStyles` if any special styles are detected otherwise `null`\n */\nfunction packageNonAnimatableStyles(element, styles) {\n let startStyles = null;\n let endStyles = null;\n if (Array.isArray(styles) && styles.length) {\n startStyles = filterNonAnimatableStyles(styles[0]);\n if (styles.length > 1) {\n endStyles = filterNonAnimatableStyles(styles[styles.length - 1]);\n }\n }\n else if (styles instanceof Map) {\n startStyles = filterNonAnimatableStyles(styles);\n }\n return startStyles || endStyles ? new SpecialCasedStyles(element, startStyles, endStyles) : null;\n}\n/**\n * Designed to be executed during a keyframe-based animation to apply any special-cased styles.\n *\n * When started (when the `start()` method is run) then the provided `startStyles`\n * will be applied. When finished (when the `finish()` method is called) the\n * `endStyles` will be applied as well any any starting styles. Finally when\n * `destroy()` is called then all styles will be removed.\n */\nclass SpecialCasedStyles {\n static { this.initialStylesByElement = new WeakMap(); }\n constructor(_element, _startStyles, _endStyles) {\n this._element = _element;\n this._startStyles = _startStyles;\n this._endStyles = _endStyles;\n this._state = 0 /* SpecialCasedStylesState.Pending */;\n let initialStyles = SpecialCasedStyles.initialStylesByElement.get(_element);\n if (!initialStyles) {\n SpecialCasedStyles.initialStylesByElement.set(_element, (initialStyles = new Map()));\n }\n this._initialStyles = initialStyles;\n }\n start() {\n if (this._state < 1 /* SpecialCasedStylesState.Started */) {\n if (this._startStyles) {\n setStyles(this._element, this._startStyles, this._initialStyles);\n }\n this._state = 1 /* SpecialCasedStylesState.Started */;\n }\n }\n finish() {\n this.start();\n if (this._state < 2 /* SpecialCasedStylesState.Finished */) {\n setStyles(this._element, this._initialStyles);\n if (this._endStyles) {\n setStyles(this._element, this._endStyles);\n this._endStyles = null;\n }\n this._state = 1 /* SpecialCasedStylesState.Started */;\n }\n }\n destroy() {\n this.finish();\n if (this._state < 3 /* SpecialCasedStylesState.Destroyed */) {\n SpecialCasedStyles.initialStylesByElement.delete(this._element);\n if (this._startStyles) {\n eraseStyles(this._element, this._startStyles);\n this._endStyles = null;\n }\n if (this._endStyles) {\n eraseStyles(this._element, this._endStyles);\n this._endStyles = null;\n }\n setStyles(this._element, this._initialStyles);\n this._state = 3 /* SpecialCasedStylesState.Destroyed */;\n }\n }\n}\nfunction filterNonAnimatableStyles(styles) {\n let result = null;\n styles.forEach((val, prop) => {\n if (isNonAnimatableStyle(prop)) {\n result = result || new Map();\n result.set(prop, val);\n }\n });\n return result;\n}\nfunction isNonAnimatableStyle(prop) {\n return prop === 'display' || prop === 'position';\n}\n\nclass WebAnimationsPlayer {\n constructor(element, keyframes, options, _specialStyles) {\n this.element = element;\n this.keyframes = keyframes;\n this.options = options;\n this._specialStyles = _specialStyles;\n this._onDoneFns = [];\n this._onStartFns = [];\n this._onDestroyFns = [];\n this._initialized = false;\n this._finished = false;\n this._started = false;\n this._destroyed = false;\n // the following original fns are persistent copies of the _onStartFns and _onDoneFns\n // and are used to reset the fns to their original values upon reset()\n // (since the _onStartFns and _onDoneFns get deleted after they are called)\n this._originalOnDoneFns = [];\n this._originalOnStartFns = [];\n this.time = 0;\n this.parentPlayer = null;\n this.currentSnapshot = new Map();\n this._duration = options['duration'];\n this._delay = options['delay'] || 0;\n this.time = this._duration + this._delay;\n }\n _onFinish() {\n if (!this._finished) {\n this._finished = true;\n this._onDoneFns.forEach((fn) => fn());\n this._onDoneFns = [];\n }\n }\n init() {\n this._buildPlayer();\n this._preparePlayerBeforeStart();\n }\n _buildPlayer() {\n if (this._initialized)\n return;\n this._initialized = true;\n const keyframes = this.keyframes;\n // @ts-expect-error overwriting a readonly property\n this.domPlayer = this._triggerWebAnimation(this.element, keyframes, this.options);\n this._finalKeyframe = keyframes.length ? keyframes[keyframes.length - 1] : new Map();\n const onFinish = () => this._onFinish();\n this.domPlayer.addEventListener('finish', onFinish);\n this.onDestroy(() => {\n // We must remove the `finish` event listener once an animation has completed all its\n // iterations. This action is necessary to prevent a memory leak since the listener captures\n // `this`, creating a closure that prevents `this` from being garbage collected.\n this.domPlayer.removeEventListener('finish', onFinish);\n });\n }\n _preparePlayerBeforeStart() {\n // this is required so that the player doesn't start to animate right away\n if (this._delay) {\n this._resetDomPlayerState();\n }\n else {\n this.domPlayer.pause();\n }\n }\n _convertKeyframesToObject(keyframes) {\n const kfs = [];\n keyframes.forEach((frame) => {\n kfs.push(Object.fromEntries(frame));\n });\n return kfs;\n }\n /** @internal */\n _triggerWebAnimation(element, keyframes, options) {\n return element.animate(this._convertKeyframesToObject(keyframes), options);\n }\n onStart(fn) {\n this._originalOnStartFns.push(fn);\n this._onStartFns.push(fn);\n }\n onDone(fn) {\n this._originalOnDoneFns.push(fn);\n this._onDoneFns.push(fn);\n }\n onDestroy(fn) {\n this._onDestroyFns.push(fn);\n }\n play() {\n this._buildPlayer();\n if (!this.hasStarted()) {\n this._onStartFns.forEach((fn) => fn());\n this._onStartFns = [];\n this._started = true;\n if (this._specialStyles) {\n this._specialStyles.start();\n }\n }\n this.domPlayer.play();\n }\n pause() {\n this.init();\n this.domPlayer.pause();\n }\n finish() {\n this.init();\n if (this._specialStyles) {\n this._specialStyles.finish();\n }\n this._onFinish();\n this.domPlayer.finish();\n }\n reset() {\n this._resetDomPlayerState();\n this._destroyed = false;\n this._finished = false;\n this._started = false;\n this._onStartFns = this._originalOnStartFns;\n this._onDoneFns = this._originalOnDoneFns;\n }\n _resetDomPlayerState() {\n if (this.domPlayer) {\n this.domPlayer.cancel();\n }\n }\n restart() {\n this.reset();\n this.play();\n }\n hasStarted() {\n return this._started;\n }\n destroy() {\n if (!this._destroyed) {\n this._destroyed = true;\n this._resetDomPlayerState();\n this._onFinish();\n if (this._specialStyles) {\n this._specialStyles.destroy();\n }\n this._onDestroyFns.forEach((fn) => fn());\n this._onDestroyFns = [];\n }\n }\n setPosition(p) {\n if (this.domPlayer === undefined) {\n this.init();\n }\n this.domPlayer.currentTime = p * this.time;\n }\n getPosition() {\n // tsc is complaining with TS2362 without the conversion to number\n return +(this.domPlayer.currentTime ?? 0) / this.time;\n }\n get totalTime() {\n return this._delay + this._duration;\n }\n beforeDestroy() {\n const styles = new Map();\n if (this.hasStarted()) {\n // note: this code is invoked only when the `play` function was called prior to this\n // (thus `hasStarted` returns true), this implies that the code that initializes\n // `_finalKeyframe` has also been executed and the non-null assertion can be safely used here\n const finalKeyframe = this._finalKeyframe;\n finalKeyframe.forEach((val, prop) => {\n if (prop !== 'offset') {\n styles.set(prop, this._finished ? val : computeStyle(this.element, prop));\n }\n });\n }\n this.currentSnapshot = styles;\n }\n /** @internal */\n triggerCallback(phaseName) {\n const methods = phaseName === 'start' ? this._onStartFns : this._onDoneFns;\n methods.forEach((fn) => fn());\n methods.length = 0;\n }\n}\n\nclass WebAnimationsDriver {\n validateStyleProperty(prop) {\n // Perform actual validation in dev mode only, in prod mode this check is a noop.\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n return validateStyleProperty(prop);\n }\n return true;\n }\n validateAnimatableStyleProperty(prop) {\n // Perform actual validation in dev mode only, in prod mode this check is a noop.\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const cssProp = camelCaseToDashCase(prop);\n return validateWebAnimatableStyleProperty(cssProp);\n }\n return true;\n }\n containsElement(elm1, elm2) {\n return containsElement(elm1, elm2);\n }\n getParentElement(element) {\n return getParentElement(element);\n }\n query(element, selector, multi) {\n return invokeQuery(element, selector, multi);\n }\n computeStyle(element, prop, defaultValue) {\n return computeStyle(element, prop);\n }\n animate(element, keyframes, duration, delay, easing, previousPlayers = []) {\n const fill = delay == 0 ? 'both' : 'forwards';\n const playerOptions = { duration, delay, fill };\n // we check for this to avoid having a null|undefined value be present\n // for the easing (which results in an error for certain browsers #9752)\n if (easing) {\n playerOptions['easing'] = easing;\n }\n const previousStyles = new Map();\n const previousWebAnimationPlayers = (previousPlayers.filter((player) => player instanceof WebAnimationsPlayer));\n if (allowPreviousPlayerStylesMerge(duration, delay)) {\n previousWebAnimationPlayers.forEach((player) => {\n player.currentSnapshot.forEach((val, prop) => previousStyles.set(prop, val));\n });\n }\n let _keyframes = normalizeKeyframes(keyframes).map((styles) => new Map(styles));\n _keyframes = balancePreviousStylesIntoKeyframes(element, _keyframes, previousStyles);\n const specialStyles = packageNonAnimatableStyles(element, _keyframes);\n return new WebAnimationsPlayer(element, _keyframes, playerOptions, specialStyles);\n }\n}\n\nfunction createEngine(type, doc) {\n // TODO: find a way to make this tree shakable.\n if (type === 'noop') {\n return new AnimationEngine(doc, new NoopAnimationDriver(), new NoopAnimationStyleNormalizer());\n }\n return new AnimationEngine(doc, new WebAnimationsDriver(), new WebAnimationsStyleNormalizer());\n}\n\nclass Animation {\n constructor(_driver, input) {\n this._driver = _driver;\n const errors = [];\n const warnings = [];\n const ast = buildAnimationAst(_driver, input, errors, warnings);\n if (errors.length) {\n throw validationFailed(errors);\n }\n if (warnings.length) {\n warnValidation(warnings);\n }\n this._animationAst = ast;\n }\n buildTimelines(element, startingStyles, destinationStyles, options, subInstructions) {\n const start = Array.isArray(startingStyles)\n ? normalizeStyles(startingStyles)\n : startingStyles;\n const dest = Array.isArray(destinationStyles)\n ? normalizeStyles(destinationStyles)\n : destinationStyles;\n const errors = [];\n subInstructions = subInstructions || new ElementInstructionMap();\n const result = buildAnimationTimelines(this._driver, element, this._animationAst, ENTER_CLASSNAME, LEAVE_CLASSNAME, start, dest, options, subInstructions, errors);\n if (errors.length) {\n throw buildingFailed(errors);\n }\n return result;\n }\n}\n\nconst ANIMATION_PREFIX = '@';\nconst DISABLE_ANIMATIONS_FLAG = '@.disabled';\nclass BaseAnimationRenderer {\n constructor(namespaceId, delegate, engine, _onDestroy) {\n this.namespaceId = namespaceId;\n this.delegate = delegate;\n this.engine = engine;\n this._onDestroy = _onDestroy;\n // We need to explicitly type this property because of an api-extractor bug\n // See https://github.com/microsoft/rushstack/issues/4390\n this.ɵtype = 0 /* AnimationRendererType.Regular */;\n }\n get data() {\n return this.delegate.data;\n }\n destroyNode(node) {\n this.delegate.destroyNode?.(node);\n }\n destroy() {\n this.engine.destroy(this.namespaceId, this.delegate);\n this.engine.afterFlushAnimationsDone(() => {\n // Call the renderer destroy method after the animations has finished as otherwise\n // styles will be removed too early which will cause an unstyled animation.\n queueMicrotask(() => {\n this.delegate.destroy();\n });\n });\n this._onDestroy?.();\n }\n createElement(name, namespace) {\n return this.delegate.createElement(name, namespace);\n }\n createComment(value) {\n return this.delegate.createComment(value);\n }\n createText(value) {\n return this.delegate.createText(value);\n }\n appendChild(parent, newChild) {\n this.delegate.appendChild(parent, newChild);\n this.engine.onInsert(this.namespaceId, newChild, parent, false);\n }\n insertBefore(parent, newChild, refChild, isMove = true) {\n this.delegate.insertBefore(parent, newChild, refChild);\n // If `isMove` true than we should animate this insert.\n this.engine.onInsert(this.namespaceId, newChild, parent, isMove);\n }\n removeChild(parent, oldChild, isHostElement) {\n this.engine.onRemove(this.namespaceId, oldChild, this.delegate);\n }\n selectRootElement(selectorOrNode, preserveContent) {\n return this.delegate.selectRootElement(selectorOrNode, preserveContent);\n }\n parentNode(node) {\n return this.delegate.parentNode(node);\n }\n nextSibling(node) {\n return this.delegate.nextSibling(node);\n }\n setAttribute(el, name, value, namespace) {\n this.delegate.setAttribute(el, name, value, namespace);\n }\n removeAttribute(el, name, namespace) {\n this.delegate.removeAttribute(el, name, namespace);\n }\n addClass(el, name) {\n this.delegate.addClass(el, name);\n }\n removeClass(el, name) {\n this.delegate.removeClass(el, name);\n }\n setStyle(el, style, value, flags) {\n this.delegate.setStyle(el, style, value, flags);\n }\n removeStyle(el, style, flags) {\n this.delegate.removeStyle(el, style, flags);\n }\n setProperty(el, name, value) {\n if (name.charAt(0) == ANIMATION_PREFIX && name == DISABLE_ANIMATIONS_FLAG) {\n this.disableAnimations(el, !!value);\n }\n else {\n this.delegate.setProperty(el, name, value);\n }\n }\n setValue(node, value) {\n this.delegate.setValue(node, value);\n }\n listen(target, eventName, callback) {\n return this.delegate.listen(target, eventName, callback);\n }\n disableAnimations(element, value) {\n this.engine.disableAnimations(element, value);\n }\n}\nclass AnimationRenderer extends BaseAnimationRenderer {\n constructor(factory, namespaceId, delegate, engine, onDestroy) {\n super(namespaceId, delegate, engine, onDestroy);\n this.factory = factory;\n this.namespaceId = namespaceId;\n }\n setProperty(el, name, value) {\n if (name.charAt(0) == ANIMATION_PREFIX) {\n if (name.charAt(1) == '.' && name == DISABLE_ANIMATIONS_FLAG) {\n value = value === undefined ? true : !!value;\n this.disableAnimations(el, value);\n }\n else {\n this.engine.process(this.namespaceId, el, name.slice(1), value);\n }\n }\n else {\n this.delegate.setProperty(el, name, value);\n }\n }\n listen(target, eventName, callback) {\n if (eventName.charAt(0) == ANIMATION_PREFIX) {\n const element = resolveElementFromTarget(target);\n let name = eventName.slice(1);\n let phase = '';\n // @listener.phase is for trigger animation callbacks\n // @@listener is for animation builder callbacks\n if (name.charAt(0) != ANIMATION_PREFIX) {\n [name, phase] = parseTriggerCallbackName(name);\n }\n return this.engine.listen(this.namespaceId, element, name, phase, (event) => {\n const countId = event['_data'] || -1;\n this.factory.scheduleListenerCallback(countId, callback, event);\n });\n }\n return this.delegate.listen(target, eventName, callback);\n }\n}\nfunction resolveElementFromTarget(target) {\n switch (target) {\n case 'body':\n return document.body;\n case 'document':\n return document;\n case 'window':\n return window;\n default:\n return target;\n }\n}\nfunction parseTriggerCallbackName(triggerName) {\n const dotIndex = triggerName.indexOf('.');\n const trigger = triggerName.substring(0, dotIndex);\n const phase = triggerName.slice(dotIndex + 1);\n return [trigger, phase];\n}\n\nclass AnimationRendererFactory {\n constructor(delegate, engine, _zone) {\n this.delegate = delegate;\n this.engine = engine;\n this._zone = _zone;\n this._currentId = 0;\n this._microtaskId = 1;\n this._animationCallbacksBuffer = [];\n this._rendererCache = new Map();\n this._cdRecurDepth = 0;\n engine.onRemovalComplete = (element, delegate) => {\n // Note: if a component element has a leave animation, and a host leave animation,\n // the view engine will call `removeChild` for the parent\n // component renderer as well as for the child component renderer.\n // Therefore, we need to check if we already removed the element.\n const parentNode = delegate?.parentNode(element);\n if (parentNode) {\n delegate.removeChild(parentNode, element);\n }\n };\n }\n createRenderer(hostElement, type) {\n const EMPTY_NAMESPACE_ID = '';\n // cache the delegates to find out which cached delegate can\n // be used by which cached renderer\n const delegate = this.delegate.createRenderer(hostElement, type);\n if (!hostElement || !type?.data?.['animation']) {\n const cache = this._rendererCache;\n let renderer = cache.get(delegate);\n if (!renderer) {\n // Ensure that the renderer is removed from the cache on destroy\n // since it may contain references to detached DOM nodes.\n const onRendererDestroy = () => cache.delete(delegate);\n renderer = new BaseAnimationRenderer(EMPTY_NAMESPACE_ID, delegate, this.engine, onRendererDestroy);\n // only cache this result when the base renderer is used\n cache.set(delegate, renderer);\n }\n return renderer;\n }\n const componentId = type.id;\n const namespaceId = type.id + '-' + this._currentId;\n this._currentId++;\n this.engine.register(namespaceId, hostElement);\n const registerTrigger = (trigger) => {\n if (Array.isArray(trigger)) {\n trigger.forEach(registerTrigger);\n }\n else {\n this.engine.registerTrigger(componentId, namespaceId, hostElement, trigger.name, trigger);\n }\n };\n const animationTriggers = type.data['animation'];\n animationTriggers.forEach(registerTrigger);\n return new AnimationRenderer(this, namespaceId, delegate, this.engine);\n }\n begin() {\n this._cdRecurDepth++;\n if (this.delegate.begin) {\n this.delegate.begin();\n }\n }\n _scheduleCountTask() {\n queueMicrotask(() => {\n this._microtaskId++;\n });\n }\n /** @internal */\n scheduleListenerCallback(count, fn, data) {\n if (count >= 0 && count < this._microtaskId) {\n this._zone.run(() => fn(data));\n return;\n }\n const animationCallbacksBuffer = this._animationCallbacksBuffer;\n if (animationCallbacksBuffer.length == 0) {\n queueMicrotask(() => {\n this._zone.run(() => {\n animationCallbacksBuffer.forEach((tuple) => {\n const [fn, data] = tuple;\n fn(data);\n });\n this._animationCallbacksBuffer = [];\n });\n });\n }\n animationCallbacksBuffer.push([fn, data]);\n }\n end() {\n this._cdRecurDepth--;\n // this is to prevent animations from running twice when an inner\n // component does CD when a parent component instead has inserted it\n if (this._cdRecurDepth == 0) {\n this._zone.runOutsideAngular(() => {\n this._scheduleCountTask();\n this.engine.flush(this._microtaskId);\n });\n }\n if (this.delegate.end) {\n this.delegate.end();\n }\n }\n whenRenderingDone() {\n return this.engine.whenRenderingDone();\n }\n}\n\n/**\n * @module\n * @description\n * Entry point for all animation APIs of the animation browser package.\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\n\n// This file is not used to build this module. It is only used during editing\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { AnimationDriver, NoopAnimationDriver, Animation as ɵAnimation, AnimationEngine as ɵAnimationEngine, AnimationRenderer as ɵAnimationRenderer, AnimationRendererFactory as ɵAnimationRendererFactory, AnimationStyleNormalizer as ɵAnimationStyleNormalizer, BaseAnimationRenderer as ɵBaseAnimationRenderer, NoopAnimationStyleNormalizer as ɵNoopAnimationStyleNormalizer, WebAnimationsDriver as ɵWebAnimationsDriver, WebAnimationsPlayer as ɵWebAnimationsPlayer, WebAnimationsStyleNormalizer as ɵWebAnimationsStyleNormalizer, allowPreviousPlayerStylesMerge as ɵallowPreviousPlayerStylesMerge, camelCaseToDashCase as ɵcamelCaseToDashCase, containsElement as ɵcontainsElement, createEngine as ɵcreateEngine, getParentElement as ɵgetParentElement, invokeQuery as ɵinvokeQuery, normalizeKeyframes as ɵnormalizeKeyframes, validateStyleProperty as ɵvalidateStyleProperty, validateWebAnimatableStyleProperty as ɵvalidateWebAnimatableStyleProperty };\n","/**\n * @license Angular v18.0.6\n * (c) 2010-2024 Google LLC. https://angular.io/\n * License: MIT\n */\n\nimport * as i0 from '@angular/core';\nimport { Injectable, Inject, RendererFactory2, NgZone, ANIMATION_MODULE_TYPE, NgModule, ɵperformanceMarkFeature } from '@angular/core';\nexport { ANIMATION_MODULE_TYPE } from '@angular/core';\nimport { ɵDomRendererFactory2, BrowserModule } from '@angular/platform-browser';\nimport * as i1 from '@angular/animations/browser';\nimport { ɵAnimationEngine, ɵWebAnimationsStyleNormalizer, ɵAnimationRendererFactory, ɵAnimationStyleNormalizer, AnimationDriver, ɵWebAnimationsDriver, NoopAnimationDriver } from '@angular/animations/browser';\nimport { DOCUMENT } from '@angular/common';\n\nclass InjectableAnimationEngine extends ɵAnimationEngine {\n // The `ApplicationRef` is injected here explicitly to force the dependency ordering.\n // Since the `ApplicationRef` should be created earlier before the `AnimationEngine`, they\n // both have `ngOnDestroy` hooks and `flush()` must be called after all views are destroyed.\n constructor(doc, driver, normalizer) {\n super(doc, driver, normalizer);\n }\n ngOnDestroy() {\n this.flush();\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: InjectableAnimationEngine, deps: [{ token: DOCUMENT }, { token: i1.AnimationDriver }, { token: i1.ɵAnimationStyleNormalizer }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: InjectableAnimationEngine }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: InjectableAnimationEngine, decorators: [{\n type: Injectable\n }], ctorParameters: () => [{ type: Document, decorators: [{\n type: Inject,\n args: [DOCUMENT]\n }] }, { type: i1.AnimationDriver }, { type: i1.ɵAnimationStyleNormalizer }] });\nfunction instantiateDefaultStyleNormalizer() {\n return new ɵWebAnimationsStyleNormalizer();\n}\nfunction instantiateRendererFactory(renderer, engine, zone) {\n return new ɵAnimationRendererFactory(renderer, engine, zone);\n}\nconst SHARED_ANIMATION_PROVIDERS = [\n { provide: ɵAnimationStyleNormalizer, useFactory: instantiateDefaultStyleNormalizer },\n { provide: ɵAnimationEngine, useClass: InjectableAnimationEngine },\n {\n provide: RendererFactory2,\n useFactory: instantiateRendererFactory,\n deps: [ɵDomRendererFactory2, ɵAnimationEngine, NgZone],\n },\n];\n/**\n * Separate providers from the actual module so that we can do a local modification in Google3 to\n * include them in the BrowserModule.\n */\nconst BROWSER_ANIMATIONS_PROVIDERS = [\n { provide: AnimationDriver, useFactory: () => new ɵWebAnimationsDriver() },\n { provide: ANIMATION_MODULE_TYPE, useValue: 'BrowserAnimations' },\n ...SHARED_ANIMATION_PROVIDERS,\n];\n/**\n * Separate providers from the actual module so that we can do a local modification in Google3 to\n * include them in the BrowserTestingModule.\n */\nconst BROWSER_NOOP_ANIMATIONS_PROVIDERS = [\n { provide: AnimationDriver, useClass: NoopAnimationDriver },\n { provide: ANIMATION_MODULE_TYPE, useValue: 'NoopAnimations' },\n ...SHARED_ANIMATION_PROVIDERS,\n];\n\n/**\n * Exports `BrowserModule` with additional dependency-injection providers\n * for use with animations. See [Animations](guide/animations).\n * @publicApi\n */\nclass BrowserAnimationsModule {\n /**\n * Configures the module based on the specified object.\n *\n * @param config Object used to configure the behavior of the `BrowserAnimationsModule`.\n * @see {@link BrowserAnimationsModuleConfig}\n *\n * @usageNotes\n * When registering the `BrowserAnimationsModule`, you can use the `withConfig`\n * function as follows:\n * ```\n * @NgModule({\n * imports: [BrowserAnimationsModule.withConfig(config)]\n * })\n * class MyNgModule {}\n * ```\n */\n static withConfig(config) {\n return {\n ngModule: BrowserAnimationsModule,\n providers: config.disableAnimations\n ? BROWSER_NOOP_ANIMATIONS_PROVIDERS\n : BROWSER_ANIMATIONS_PROVIDERS,\n };\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: BrowserAnimationsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }\n static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"14.0.0\", version: \"18.0.6\", ngImport: i0, type: BrowserAnimationsModule, exports: [BrowserModule] }); }\n static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: BrowserAnimationsModule, providers: BROWSER_ANIMATIONS_PROVIDERS, imports: [BrowserModule] }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: BrowserAnimationsModule, decorators: [{\n type: NgModule,\n args: [{\n exports: [BrowserModule],\n providers: BROWSER_ANIMATIONS_PROVIDERS,\n }]\n }] });\n/**\n * Returns the set of dependency-injection providers\n * to enable animations in an application. See [animations guide](guide/animations)\n * to learn more about animations in Angular.\n *\n * @usageNotes\n *\n * The function is useful when you want to enable animations in an application\n * bootstrapped using the `bootstrapApplication` function. In this scenario there\n * is no need to import the `BrowserAnimationsModule` NgModule at all, just add\n * providers returned by this function to the `providers` list as show below.\n *\n * ```typescript\n * bootstrapApplication(RootComponent, {\n * providers: [\n * provideAnimations()\n * ]\n * });\n * ```\n *\n * @publicApi\n */\nfunction provideAnimations() {\n ɵperformanceMarkFeature('NgEagerAnimations');\n // Return a copy to prevent changes to the original array in case any in-place\n // alterations are performed to the `provideAnimations` call results in app code.\n return [...BROWSER_ANIMATIONS_PROVIDERS];\n}\n/**\n * A null player that must be imported to allow disabling of animations.\n * @publicApi\n */\nclass NoopAnimationsModule {\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NoopAnimationsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }\n static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"14.0.0\", version: \"18.0.6\", ngImport: i0, type: NoopAnimationsModule, exports: [BrowserModule] }); }\n static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NoopAnimationsModule, providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS, imports: [BrowserModule] }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NoopAnimationsModule, decorators: [{\n type: NgModule,\n args: [{\n exports: [BrowserModule],\n providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS,\n }]\n }] });\n/**\n * Returns the set of dependency-injection providers\n * to disable animations in an application. See [animations guide](guide/animations)\n * to learn more about animations in Angular.\n *\n * @usageNotes\n *\n * The function is useful when you want to bootstrap an application using\n * the `bootstrapApplication` function, but you need to disable animations\n * (for example, when running tests).\n *\n * ```typescript\n * bootstrapApplication(RootComponent, {\n * providers: [\n * provideNoopAnimations()\n * ]\n * });\n * ```\n *\n * @publicApi\n */\nfunction provideNoopAnimations() {\n // Return a copy to prevent changes to the original array in case any in-place\n // alterations are performed to the `provideNoopAnimations` call results in app code.\n return [...BROWSER_NOOP_ANIMATIONS_PROVIDERS];\n}\n\n/**\n * @module\n * @description\n * Entry point for all animation APIs of the animation browser package.\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\n\n// This file is not used to build this module. It is only used during editing\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { BrowserAnimationsModule, NoopAnimationsModule, provideAnimations, provideNoopAnimations, InjectableAnimationEngine as ɵInjectableAnimationEngine };\n","import { HttpClient } from '@angular/common/http';\nimport { LanguageCode, LocationCode } from '@geneplanet/ngx-utils/src/lib/localization';\nimport { TranslateLoader } from '@ngx-translate/core';\nimport { forkJoin, Observable, of } from 'rxjs';\nimport { map, catchError } from 'rxjs/operators';\nimport { environment } from 'src/environments/environment';\n\nexport class MultipleFilesHttpTranslationsLoader implements TranslateLoader {\n constructor(\n private http: HttpClient,\n public resources: { prefix: string; suffix: string }[] = [\n {\n prefix: '/assets/i18n/',\n suffix: '.json',\n },\n ]\n ) {}\n\n getTranslation(locCode: LocationCode): Observable {\n return forkJoin(\n this.resources.map((config) =>\n this.http\n .get(\n `${config.prefix}${this.getLanguageCodeByLocationCode(locCode)}${\n config.suffix\n }`\n )\n .pipe(catchError(() => of({})))\n )\n ).pipe(\n map((response) =>\n response\n .map((a) => this.parseTranslationsObject(a))\n .reduce((a: any, b: any) => ({\n ...a,\n ...this.parseTranslationsObject(b),\n }))\n )\n );\n }\n\n private createArrayFromObj(obj: object) {\n const array: any[] = [];\n for (const key of Object.keys(obj)) {\n array.push(obj[key]);\n }\n return array;\n }\n\n private parseTranslationsObject(input: object) {\n // eslint-disable-next-line no-prototype-builtins\n if (input.hasOwnProperty('0')) {\n const newArray = this.createArrayFromObj(input);\n for (let i = 0; i < newArray.length; i++) {\n if (typeof newArray[i] === 'object') {\n newArray[i] = this.parseTranslationsObject(newArray[i]);\n }\n }\n return newArray;\n } else {\n for (const key of Object.keys(input)) {\n if (typeof input[key] === 'object') {\n input[key] = this.parseTranslationsObject(input[key]);\n }\n }\n return input;\n }\n }\n\n private getLanguageCodeByLocationCode(locCode: LocationCode): LanguageCode {\n return (\n environment.locations.find((l) => l.code === locCode)?.lang?.code ||\n LanguageCode.EN\n );\n }\n}\n","import * as i0 from '@angular/core';\nimport { InjectionToken, Injectable, Optional, Inject, NgModule } from '@angular/core';\n\nconst GoogleTagManagerConfigService = new InjectionToken('google-tag-manager-config');\n// adapted from https://github.com/auth0/auth0-angular#dynamic-configuration\nclass GoogleTagManagerConfiguration {\n constructor(googleTagManagerConfig) {\n this._googleTagManagerConfig = {\n id: null,\n gtm_auth: '',\n gtm_preview: '',\n };\n if (googleTagManagerConfig) {\n this.set(googleTagManagerConfig);\n }\n }\n set(googleTagManagerConfig) {\n this._googleTagManagerConfig = googleTagManagerConfig;\n }\n get() {\n return this._googleTagManagerConfig;\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"17.0.5\", ngImport: i0, type: GoogleTagManagerConfiguration, deps: [{ token: GoogleTagManagerConfigService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"17.0.5\", ngImport: i0, type: GoogleTagManagerConfiguration, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"17.0.5\", ngImport: i0, type: GoogleTagManagerConfiguration, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }], ctorParameters: () => [{ type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: [GoogleTagManagerConfigService]\n }] }] });\n\nclass GoogleTagManagerService {\n constructor(googleTagManagerConfiguration, googleTagManagerId, googleTagManagerMode = \"noisy\", googleTagManagerAuth, googleTagManagerPreview, googleTagManagerResourcePath, googleTagManagerCSPNonce) {\n this.googleTagManagerConfiguration = googleTagManagerConfiguration;\n this.googleTagManagerId = googleTagManagerId;\n this.googleTagManagerMode = googleTagManagerMode;\n this.googleTagManagerAuth = googleTagManagerAuth;\n this.googleTagManagerPreview = googleTagManagerPreview;\n this.googleTagManagerResourcePath = googleTagManagerResourcePath;\n this.googleTagManagerCSPNonce = googleTagManagerCSPNonce;\n this.isLoaded = false;\n this.browserGlobals = {\n windowRef() {\n return window;\n },\n documentRef() {\n return document;\n },\n };\n this.config = this.googleTagManagerConfiguration?.get();\n if (this.config == null) {\n this.config = { id: null };\n }\n this.config = {\n ...this.config,\n id: googleTagManagerId || this.config.id,\n gtm_auth: googleTagManagerAuth || this.config.gtm_auth,\n gtm_preview: googleTagManagerPreview || this.config.gtm_preview,\n gtm_resource_path: googleTagManagerResourcePath || this.config.gtm_resource_path,\n };\n if (this.config.id == null) {\n return;\n }\n }\n checkForId() {\n if (this.googleTagManagerMode !== \"silent\" && !this.config.id) {\n throw new Error('Google tag manager ID not provided.');\n }\n else if (!this.config.id) {\n return false;\n }\n return true;\n }\n getDataLayer() {\n this.checkForId();\n const window = this.browserGlobals.windowRef();\n window.dataLayer = window.dataLayer || [];\n return window.dataLayer;\n }\n pushOnDataLayer(obj) {\n this.checkForId();\n const dataLayer = this.getDataLayer();\n dataLayer.push(obj);\n }\n addGtmToDom() {\n return new Promise((resolve, reject) => {\n if (this.isLoaded) {\n return resolve(this.isLoaded);\n }\n else if (!this.checkForId()) {\n return resolve(false);\n }\n const doc = this.browserGlobals.documentRef();\n this.pushOnDataLayer({\n 'gtm.start': new Date().getTime(),\n event: 'gtm.js',\n });\n const gtmScript = doc.createElement('script');\n gtmScript.id = 'GTMscript';\n gtmScript.async = true;\n gtmScript.src = this.applyGtmQueryParams(this.config.gtm_resource_path\n ? this.config.gtm_resource_path\n : 'https://www.googletagmanager.com/gtm.js');\n gtmScript.addEventListener('load', () => {\n return resolve((this.isLoaded = true));\n });\n gtmScript.addEventListener('error', () => {\n return reject(false);\n });\n if (this.googleTagManagerCSPNonce) {\n gtmScript.setAttribute('nonce', this.googleTagManagerCSPNonce);\n }\n doc.head.insertBefore(gtmScript, doc.head.firstChild);\n });\n }\n pushTag(item) {\n return new Promise((resolve, reject) => {\n if (!this.checkForId()) {\n return resolve();\n }\n if (!this.isLoaded) {\n this.addGtmToDom()\n .then(() => {\n this.pushOnDataLayer(item);\n return resolve();\n })\n .catch(() => reject());\n }\n else {\n this.pushOnDataLayer(item);\n return resolve();\n }\n });\n }\n applyGtmQueryParams(url) {\n if (url.indexOf('?') === -1) {\n url += '?';\n }\n return (url +\n Object.keys(this.config)\n .filter((k) => this.config[k])\n .map((k) => `${k}=${this.config[k]}`)\n .join('&'));\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"17.0.5\", ngImport: i0, type: GoogleTagManagerService, deps: [{ token: GoogleTagManagerConfiguration, optional: true }, { token: 'googleTagManagerId', optional: true }, { token: 'googleTagManagerMode', optional: true }, { token: 'googleTagManagerAuth', optional: true }, { token: 'googleTagManagerPreview', optional: true }, { token: 'googleTagManagerResourcePath', optional: true }, { token: 'googleTagManagerCSPNonce', optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"17.0.5\", ngImport: i0, type: GoogleTagManagerService, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"17.0.5\", ngImport: i0, type: GoogleTagManagerService, decorators: [{\n type: Injectable,\n args: [{\n providedIn: 'root',\n }]\n }], ctorParameters: () => [{ type: GoogleTagManagerConfiguration, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: [GoogleTagManagerConfiguration]\n }] }, { type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: ['googleTagManagerId']\n }] }, { type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: ['googleTagManagerMode']\n }] }, { type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: ['googleTagManagerAuth']\n }] }, { type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: ['googleTagManagerPreview']\n }] }, { type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: ['googleTagManagerResourcePath']\n }] }, { type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: ['googleTagManagerCSPNonce']\n }] }] });\n\nclass GoogleTagManagerModule {\n static forRoot(config) {\n return {\n ngModule: GoogleTagManagerModule,\n providers: [{ provide: GoogleTagManagerConfigService, useValue: config }],\n };\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"17.0.5\", ngImport: i0, type: GoogleTagManagerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }\n static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"14.0.0\", version: \"17.0.5\", ngImport: i0, type: GoogleTagManagerModule }); }\n static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"17.0.5\", ngImport: i0, type: GoogleTagManagerModule }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"17.0.5\", ngImport: i0, type: GoogleTagManagerModule, decorators: [{\n type: NgModule\n }] });\n\n/*\n * Public API Surface of angular-google-tag-manager\n */\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { GoogleTagManagerConfigService, GoogleTagManagerConfiguration, GoogleTagManagerModule, GoogleTagManagerService };\n","import { DOCUMENT, isPlatformServer } from '@angular/common';\nimport { Inject, Injectable, PLATFORM_ID } from '@angular/core';\nimport { NavigationEnd, Router } from '@angular/router';\nimport { GoogleTagManagerService } from 'angular-google-tag-manager';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AnalyticsService {\n constructor(\n @Inject(DOCUMENT) private document: Document,\n @Inject(PLATFORM_ID) private readonly platformId: object,\n private gtmService: GoogleTagManagerService,\n private router: Router\n ) {}\n\n init() {\n this.trackInitOriginalLocation();\n\n this.router.events.subscribe((event) => {\n if (event instanceof NavigationEnd) {\n const isPortrait = window.matchMedia('(orientation: portrait)').matches;\n\n const gtmTag = {\n event: 'virtualPageview',\n virtualPageURL: event.url,\n virtualPageTitle: this.document.title,\n orientation: isPortrait ? 'Portrait' : 'Landscape',\n devicePixelRatio: window.devicePixelRatio,\n };\n\n this.gtmService.pushTag(gtmTag).catch(() => {});\n }\n });\n }\n\n trackInitOriginalLocation() {\n if (isPlatformServer(this.platformId)) {\n return;\n }\n\n const gtmTag = {\n originalLocation:\n this.document.location.protocol +\n '//' +\n this.document.location.hostname +\n this.document.location.pathname +\n this.document.location.search,\n };\n\n this.gtmService.pushTag(gtmTag).catch(() => {});\n }\n}\n","import { Injectable } from '@angular/core';\nimport { NavigationEnd, Router } from '@angular/router';\nimport { distinctUntilChanged, filter, first } from 'rxjs';\n// eslint-disable-next-line @typescript-eslint/naming-convention\nimport * as Sentry from '@sentry/angular';\nimport { Auth0Account } from './accounts/interfaces/accounts.types';\nimport {\n AnalyticsService,\n RudderstackAnalytics,\n} from '@geneplanet/ngx-utils/src/lib/analytics';\n\ndeclare const window: {\n rudderanalytics: RudderstackAnalytics;\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SentryErrorService {\n private account: Auth0Account;\n\n constructor(\n private router: Router,\n private analyticsService: AnalyticsService\n ) {}\n\n public setAccount(account: Auth0Account) {\n this.account = account;\n }\n\n public errorOnMissingUserId() {\n const subscription = this.router.events\n .pipe(\n filter((event) => event instanceof NavigationEnd),\n distinctUntilChanged()\n )\n .subscribe((event: NavigationEnd) => {\n const anonymousUrls = [\n '/accounts/logged-out',\n '/accounts/check',\n '/accounts/create',\n '/accounts/reset',\n '/onboarding/adrialab/welcome',\n '/onboarding/biolab/welcome',\n '/onboarding/dna/welcome',\n '/onboarding/nipt/welcome',\n '/onboarding/blood/welcome',\n '/onboarding/already-activated',\n '/nipt/nipt-expired',\n ];\n\n if (anonymousUrls.some((url) => event.url.startsWith(url))) {\n return;\n }\n\n this.analyticsService\n .loaded()\n .pipe(\n filter((loaded) => loaded),\n first()\n )\n .subscribe(() => {\n if (!this.analyticsService.getUserId()) {\n Sentry.captureMessage(\n `user ${\n this.account?.sub\n } should be identified, \\ncheckExisting: ${\n this.analyticsService.checkExisting\n }, \\nanonymous id: ${this.analyticsService.getAnonymousId()}, \\ncustomer id: ${\n this.account?.['http://schemas.nomnio.com/2017/5/customer']\n }, \\nanalytics: ${JSON.stringify(window.rudderanalytics)}`\n );\n }\n });\n\n subscription.unsubscribe();\n });\n }\n}\n","/* eslint-disable @typescript-eslint/naming-convention */\nexport interface CookieSettings {\n configured?: boolean;\n cookies_pref: 0 | 1;\n cookies_stat: 0 | 1;\n cookies_mkt: 0 | 1;\n}\n\nexport const defaultCookieSettings: CookieSettings = {\n cookies_pref: 1,\n cookies_stat: 1,\n cookies_mkt: 1,\n configured: true,\n};\nexport const defaultAcceptedCookieSettings: CookieSettings = {\n cookies_pref: 1,\n cookies_stat: 1,\n cookies_mkt: 1,\n};\n\nexport const defaultRejectedCookieSettings: CookieSettings = {\n cookies_pref: 0,\n cookies_stat: 0,\n cookies_mkt: 0,\n configured: true,\n};\n","import { Injectable } from '@angular/core';\nimport { CookieService } from 'ngx-cookie-service';\nimport { Subject } from 'rxjs';\nimport {\n CookieSettings,\n defaultAcceptedCookieSettings,\n defaultCookieSettings,\n defaultRejectedCookieSettings,\n} from './cookie-settings/cookie.types';\n\n@Injectable({ providedIn: 'root' })\nexport class CookiesService {\n domainName =\n window.location.href.indexOf('localhost') !== -1\n ? 'localhost'\n : 'geneplanet.com';\n\n cookiesAccepted$: Subject = new Subject();\n LScookiesSettings = '@geneplanet/cookie_settings';\n\n private readonly cPref = 'cookies_pref';\n private readonly cStat = 'cookies_stat';\n private readonly cMkt = 'cookies_mkt';\n private readonly cLang = 'pref_lang';\n private readonly cAff = 'cookies_aff';\n private readonly cConf = 'cookies_configured';\n\n // eslint-disable-next-line @typescript-eslint/member-ordering\n listOfCookies = [this.cPref, this.cStat, this.cMkt];\n\n constructor(\n private cookieService: CookieService // private analytics: AnalyticsService\n ) {}\n\n areCookiesSet(): boolean {\n return this.listOfCookies.every((c) => {\n return this.cookieService.get(c) ? true : false;\n });\n }\n\n saveCookies(cookieSettings: CookieSettings, lang?: string) {\n if (\n this.saveCookieSettingsToLocalStorage(true) &&\n this.saveCookieSettingsToCookies(cookieSettings, true)\n ) {\n // this.analytics.trackPageViewEvent();\n if (lang && cookieSettings.cookies_pref === 1) {\n this.saveLanguagePreference(lang);\n }\n this.cookiesAccepted$.next(true);\n }\n }\n\n acceptAllCookies() {\n const currentCookieSettings = this.getCookieSettings();\n const allAccepted = this.listOfCookies.every((cookie) => {\n return currentCookieSettings[cookie] === 1;\n });\n if (!allAccepted) {\n this.saveCookieSettingsToCookies(defaultAcceptedCookieSettings, true);\n }\n this.saveConfiguredCookie(true);\n this.cookiesAccepted$.next(true);\n }\n\n checkIfAtLeastOneAccepted(): boolean {\n const currentCookieSettings = this.getCookieSettings();\n return this.listOfCookies.some((cookie) => {\n return currentCookieSettings[cookie] === 1;\n });\n }\n\n saveCookiesFirstPageView() {\n this.saveCookieSettingsToCookies(defaultRejectedCookieSettings, false);\n }\n\n getCookieSettings(): CookieSettings {\n const cookieSettings: CookieSettings = defaultCookieSettings;\n this.listOfCookies.forEach((cookie) => {\n const cookieValue = this.cookieService.get(cookie);\n cookieSettings[cookie] = cookieValue ? Number(cookieValue) : 0;\n });\n return cookieSettings;\n }\n\n saveAffiliateCookie(code: string) {\n if (!this.checkIfAffiliateCookieExists()) {\n const expirationDate = new Date(\n new Date().setFullYear(new Date().getFullYear() + 1)\n );\n this.cookieService.set(\n this.cAff,\n code,\n expirationDate,\n '/',\n this.domainName\n );\n }\n }\n\n saveLanguagePreference(lang: string) {\n const cookieSettings = this.getCookieSettings();\n if (cookieSettings.cookies_pref && cookieSettings.cookies_pref === 1) {\n const expirationDate = new Date(\n new Date().setFullYear(new Date().getFullYear() + 1)\n );\n this.cookieService.set(\n this.cLang,\n lang,\n expirationDate,\n '/',\n this.domainName\n );\n }\n }\n\n saveConfiguredCookie(allAcepted: boolean) {\n if (!this.checkIfConfiguredCookieExists()) {\n const expirationDate = allAcepted\n ? new Date(new Date().setFullYear(new Date().getFullYear() + 2))\n : new Date(new Date().setDate(new Date().getDate() + 14));\n this.cookieService.set(\n this.cConf,\n '1',\n expirationDate,\n '/',\n this.domainName\n );\n }\n }\n\n getLanguagePreference(): string {\n return this.cookieService.get(this.cLang);\n }\n\n checkIfConfiguredCookieExists(): boolean {\n return !!this.cookieService.get(this.cConf);\n }\n\n private checkIfAffiliateCookieExists(): boolean {\n return this.cookieService.get(this.cAff) ? true : false;\n }\n\n private saveCookieSettingsToLocalStorage(configured: boolean): boolean {\n window.localStorage.setItem(\n this.LScookiesSettings,\n JSON.stringify({ configured })\n );\n return true;\n }\n\n private saveCookieSettingsToCookies(cookieSettings, first = false): boolean {\n const expirationDate = new Date(\n new Date().setFullYear(new Date().getFullYear() + 2)\n );\n this.listOfCookies.forEach((cookie) => {\n this.cookieService.set(\n cookie,\n cookieSettings[cookie],\n expirationDate,\n '/',\n this.domainName\n );\n });\n this.saveCookieSettingsToLocalStorage(first);\n return true;\n }\n}\n","import * as i0 from '@angular/core';\nimport { EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nclass GpuSwitchComponent {\n constructor() {\n this.id = 'gpu-switch';\n this.change = new EventEmitter();\n }\n onChange(event) {\n event.stopPropagation();\n const { checked } = event.target;\n this.change.emit(checked);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"17.1.3\", ngImport: i0, type: GpuSwitchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }\n static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: \"14.0.0\", version: \"17.1.3\", type: GpuSwitchComponent, selector: \"gpu-switch\", inputs: { checked: \"checked\", disabled: \"disabled\", id: \"id\" }, outputs: { change: \"change\" }, ngImport: i0, template: \"
\\n \\n \\n
\\n\", styles: [\".gswitch-control{position:relative;z-index:1;display:block;min-height:25px;padding-left:3rem;-webkit-print-color-adjust:exact;print-color-adjust:exact}.gswitch-control-input{position:absolute;left:0;z-index:-1;width:46px;height:25px;opacity:0}.gswitch-control-label{position:relative;margin-bottom:0;vertical-align:top;-webkit-user-select:none;user-select:none}.gswitch-switch .gswitch-control-label:before{left:-3rem;width:46px;pointer-events:all;border-radius:50px}.gswitch-control-label:before{transition:background-color .3s ease-in-out .1s,border-color .3s ease-in-out,box-shadow .3s ease-in-out}.gswitch-control-label:before{position:absolute;top:1px;left:-1.5rem;display:block;width:1rem;height:23px;pointer-events:none;content:\\\"\\\";background-color:#ff397f;opacity:.25;cursor:pointer}.gswitch-switch .gswitch-control-label:after{top:0;left:-3rem;width:25px;height:25px;background-color:#fff;border:2px solid #ff397f;border-radius:50%;transition:transform .3s ease-in-out,background-color .3s ease-in-out,border-color .3s ease-in-out,box-shadow .3s ease-in-out;cursor:pointer}.gswitch-control-label:after{position:absolute;top:0;left:-1.5rem;display:block;width:1rem;height:25px;content:\\\"\\\"}.gswitch-control-input:checked~.gswitch-control-label:before{color:#fff;background-color:#00b9bb}.gswitch-switch .gswitch-control-input:checked~.gswitch-control-label:after{background-color:#fff;border-color:#00b9bb;transform:translate(21px)}.gswitch-control-input:disabled~.gswitch-control-label:before,.gswitch-control-input[disabled]~.gswitch-control-label:before{background-color:#efeff4!important;opacity:1}.gswitch-control-input:disabled~.gswitch-control-label:after,.gswitch-control-input[disabled]~.gswitch-control-label:after{border-color:#c7c7d2!important}\\n\"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"17.1.3\", ngImport: i0, type: GpuSwitchComponent, decorators: [{\n type: Component,\n args: [{ selector: 'gpu-switch', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: \"
\\n \\n \\n
\\n\", styles: [\".gswitch-control{position:relative;z-index:1;display:block;min-height:25px;padding-left:3rem;-webkit-print-color-adjust:exact;print-color-adjust:exact}.gswitch-control-input{position:absolute;left:0;z-index:-1;width:46px;height:25px;opacity:0}.gswitch-control-label{position:relative;margin-bottom:0;vertical-align:top;-webkit-user-select:none;user-select:none}.gswitch-switch .gswitch-control-label:before{left:-3rem;width:46px;pointer-events:all;border-radius:50px}.gswitch-control-label:before{transition:background-color .3s ease-in-out .1s,border-color .3s ease-in-out,box-shadow .3s ease-in-out}.gswitch-control-label:before{position:absolute;top:1px;left:-1.5rem;display:block;width:1rem;height:23px;pointer-events:none;content:\\\"\\\";background-color:#ff397f;opacity:.25;cursor:pointer}.gswitch-switch .gswitch-control-label:after{top:0;left:-3rem;width:25px;height:25px;background-color:#fff;border:2px solid #ff397f;border-radius:50%;transition:transform .3s ease-in-out,background-color .3s ease-in-out,border-color .3s ease-in-out,box-shadow .3s ease-in-out;cursor:pointer}.gswitch-control-label:after{position:absolute;top:0;left:-1.5rem;display:block;width:1rem;height:25px;content:\\\"\\\"}.gswitch-control-input:checked~.gswitch-control-label:before{color:#fff;background-color:#00b9bb}.gswitch-switch .gswitch-control-input:checked~.gswitch-control-label:after{background-color:#fff;border-color:#00b9bb;transform:translate(21px)}.gswitch-control-input:disabled~.gswitch-control-label:before,.gswitch-control-input[disabled]~.gswitch-control-label:before{background-color:#efeff4!important;opacity:1}.gswitch-control-input:disabled~.gswitch-control-label:after,.gswitch-control-input[disabled]~.gswitch-control-label:after{border-color:#c7c7d2!important}\\n\"] }]\n }], propDecorators: { checked: [{\n type: Input\n }], disabled: [{\n type: Input\n }], id: [{\n type: Input\n }], \n // eslint-disable-next-line @angular-eslint/no-output-native\n change: [{\n type: Output\n }] } });\n\nclass GpuSwitchModule {\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"17.1.3\", ngImport: i0, type: GpuSwitchModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }\n static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"14.0.0\", version: \"17.1.3\", ngImport: i0, type: GpuSwitchModule, declarations: [GpuSwitchComponent], imports: [CommonModule], exports: [GpuSwitchComponent] }); }\n static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"17.1.3\", ngImport: i0, type: GpuSwitchModule, imports: [CommonModule] }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"17.1.3\", ngImport: i0, type: GpuSwitchModule, decorators: [{\n type: NgModule,\n args: [{\n declarations: [GpuSwitchComponent],\n imports: [CommonModule],\n exports: [GpuSwitchComponent],\n }]\n }] });\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { GpuSwitchComponent, GpuSwitchModule };\n","\n \n \n \n\n \n\n
\n
\n

\n {{ 'COOKIESSETTINGSPAGE.PAGETITLE' | translate }}\n

\n
\n
\n \n

{{ paragraph }}

\n
\n
\n\n
\n \n
\n
\n
\n \n \n
\n \n
\n \n {{ 'COOKIESSETTINGSPAGE.ALWAYS' | translate }}\n \n
\n \n
\n
\n

\n
\n
\n
\n\n \n
\n
\n
\n \n \n
\n \n
\n \n {{\n (cookieSettings.cookies_pref === 1\n ? 'COOKIESSETTINGSPAGE.ALLOW'\n : 'COOKIESSETTINGSPAGE.DECLINE'\n ) | translate\n }}\n \n
\n \n
\n
\n

\n
\n
\n
\n\n \n
\n
\n
\n \n \n
\n \n
\n \n {{\n (cookieSettings.cookies_stat === 1\n ? 'COOKIESSETTINGSPAGE.ALLOW'\n : 'COOKIESSETTINGSPAGE.DECLINE'\n ) | translate\n }}\n \n
\n \n
\n
\n

\n
\n
\n
\n\n \n
\n
\n
\n \n \n
\n \n
\n \n {{\n (cookieSettings.cookies_mkt === 1\n ? 'COOKIESSETTINGSPAGE.ALLOW'\n : 'COOKIESSETTINGSPAGE.DECLINE'\n ) | translate\n }}\n \n
\n \n
\n
\n

\n
\n
\n \n \n\n \n \n {{ 'COOKIESSETTINGSPAGE.SAVESETTINGS' | translate }}\n \n \n \n \n \n
\n","import { Component, OnInit } from '@angular/core';\nimport { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';\nimport { TranslateService } from '@ngx-translate/core';\nimport { CookiesService } from '../cookie.service';\nimport { CookieSettings } from './cookie.types';\n\n@Component({\n selector: 'app-cookie-settings-modal-component',\n templateUrl: './cookie-settings-modal.component.html',\n styleUrls: ['./cookie-settings-modal.component.scss'],\n})\nexport class CookieSettingsModalComponent implements OnInit {\n cookiesSettingsParagraphs: any[];\n cookieSettings: CookieSettings;\n visibleSettings = {\n necessary: false,\n preference: false,\n statistic: false,\n marketing: false,\n };\n\n private readonly cookiesSettingsParagraphsTranslationKey =\n 'COOKIESSETTINGSPAGE.PARAGRAPHS';\n\n constructor(\n private translate: TranslateService,\n public modal: NgbActiveModal,\n private cookiesService: CookiesService\n ) {}\n\n ngOnInit() {\n const cookiesSettingsParagraphs = this.translate.instant(\n this.cookiesSettingsParagraphsTranslationKey\n );\n if (\n cookiesSettingsParagraphs !== this.cookiesSettingsParagraphsTranslationKey\n ) {\n this.cookiesSettingsParagraphs = cookiesSettingsParagraphs;\n }\n this.cookieSettings = this.cookiesService.getCookieSettings();\n }\n\n closeModal() {\n this.modal.dismiss();\n }\n\n saveCookieSettings() {\n this.modal.close(this.cookieSettings);\n }\n\n checkboxClicked(settingName: string) {\n this.cookieSettings[settingName] = this.cookieSettings[settingName] =\n this.cookieSettings[settingName] === 0 ? 1 : 0;\n }\n}\n","import {\n AfterViewInit,\n Component,\n ElementRef,\n Renderer2,\n ViewEncapsulation,\n} from '@angular/core';\nimport { Router } from '@angular/router';\nimport { Auth0Service } from '@geneplanet/ngx-auth0';\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\nimport { ModalService } from 'src/app/shared/services/modal.service';\nimport { CookieSettingsModalComponent } from '../cookie-settings/cookie-settings-modal.component';\nimport {\n CookieSettings,\n defaultAcceptedCookieSettings,\n} from '../cookie-settings/cookie.types';\nimport { CookiesService } from '../cookie.service';\n\n@Component({\n selector: 'app-cookie-consent',\n templateUrl: './cookie-consent.component.html',\n styleUrls: ['./cookie-consent.component.scss'],\n encapsulation: ViewEncapsulation.None,\n})\nexport class CookieConsentComponent implements AfterViewInit {\n cookiesAccepted = false;\n LScookiesSettings = '@geneplanet/cookie_settings';\n private ngUnsubscribe = new Subject();\n\n constructor(\n private router: Router,\n private el: ElementRef,\n private renderer: Renderer2,\n private readonly modalService: ModalService,\n private cookiesService: CookiesService,\n private auth0: Auth0Service\n ) {\n const cSettings: { configured: boolean } = JSON.parse(\n window.localStorage.getItem(this.LScookiesSettings)\n );\n if (cSettings && cSettings.configured) {\n this.cookiesAccepted = true;\n this.updateView();\n } else {\n this.cookiesService.cookiesAccepted$\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((r) => {\n if (r) {\n this.cookiesAccepted = true;\n this.updateView();\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n });\n }\n }\n\n ngAfterViewInit() {\n if (\n !this.cookiesAccepted ||\n !this.cookiesService.checkIfConfiguredCookieExists()\n ) {\n this.auth0.tokens.current$\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((account) => {\n if (account) {\n this.cookiesService.acceptAllCookies();\n this.cookiesAccepted = true;\n this.updateView();\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n } else {\n const atLeastOneAccepted = this.cookiesService.checkIfAtLeastOneAccepted();\n if (atLeastOneAccepted) {\n this.cookiesAccepted = true;\n this.updateView();\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n } else {\n this.cookiesService.saveCookiesFirstPageView();\n this.updateView();\n }\n }\n });\n }\n }\n\n showCookiePolicy() {\n this.router.navigateByUrl('cookie-policy');\n }\n\n openCookieSettings() {\n const ref = this.modalService.openFullScreen(CookieSettingsModalComponent);\n\n ref.result.then(\n (data: CookieSettings) => {\n // on close\n if (data) {\n this.cookiesService.saveCookies(data);\n this.cookiesService.saveConfiguredCookie(\n Object.values(data).filter((d) => !d).length === 0\n );\n } else {\n this.cookiesService.saveConfiguredCookie(false);\n }\n this.updateView();\n },\n () => {\n // on dismiss\n }\n );\n }\n\n acceptCookies(configure = true) {\n this.cookiesService.saveCookies(defaultAcceptedCookieSettings);\n // Temporary fix, show popup until user interact with the popup\n if (configure) {\n this.cookiesService.saveConfiguredCookie(true);\n }\n this.cookiesAccepted = true;\n this.updateView();\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n private updateView() {\n if (this.cookiesService.checkIfConfiguredCookieExists()) {\n this.renderer.setStyle(this.el.nativeElement, 'display', 'none');\n } else {\n this.renderer.setStyle(this.el.nativeElement, 'display', 'block');\n }\n }\n}\n","\n
\n \n
\n \n \n \n\n \n {{ 'COOKIESNOTICEPOPUP.ACCEPT' | translate }}\n \n \n {{ 'COOKIESNOTICEPOPUP.SETTINGSBUTTON' | translate }}\n \n \n\n","import * as i3 from '@angular/common';\nimport { CommonModule } from '@angular/common';\nimport * as i0 from '@angular/core';\nimport { Component, ChangeDetectionStrategy, Input, NgModule } from '@angular/core';\nimport * as i2 from '@angular/router';\nimport { RouterModule } from '@angular/router';\nimport * as i4 from '@gilsdav/ngx-translate-router';\nimport { LocalizeRouterModule } from '@gilsdav/ngx-translate-router';\nimport { __decorate } from 'tslib';\nimport { UntilDestroy } from '@ngneat/until-destroy';\nimport { map } from 'rxjs/operators';\nimport * as i1 from '@geneplanet/ngx-shop/src/lib/shared';\n\nlet GpsCartCountBadgeComponent = class GpsCartCountBadgeComponent {\n constructor(cartService, router) {\n this.cartService = cartService;\n this.router = router;\n this.isNavLink = false;\n this.icon = 'gpicon-cart';\n this.activeIcon = 'gpicon-cart';\n this.badgeClass = 'c3-semibold';\n this.url = '/cart';\n this.cart$ = this.cartService.cart$;\n }\n get cartItemsCount() {\n return this.cartService.cart$.pipe(map((cart) => cart?.orderItems\n .map((oi) => oi.quantity)\n .reduce((acc, val) => acc + val, 0)));\n }\n isRouterLinkActive() {\n return this.router?.isActive(this.url, false);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"17.1.3\", ngImport: i0, type: GpsCartCountBadgeComponent, deps: [{ token: i1.CartService }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Component }); }\n static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: \"14.0.0\", version: \"17.1.3\", type: GpsCartCountBadgeComponent, selector: \"gps-cart-count-badge\", inputs: { isNavLink: \"isNavLink\", icon: \"icon\", activeIcon: \"activeIcon\", badgeClass: \"badgeClass\" }, ngImport: i0, template: \"
\\n\", styles: [\"a{color:inherit}i{font-style:normal}.badge{width:1.5rem;height:1.5rem;right:-.75rem;top:-.75rem}\\n\"], dependencies: [{ kind: \"directive\", type: i3.NgClass, selector: \"[ngClass]\", inputs: [\"class\", \"ngClass\"] }, { kind: \"directive\", type: i3.NgIf, selector: \"[ngIf]\", inputs: [\"ngIf\", \"ngIfThen\", \"ngIfElse\"] }, { kind: \"directive\", type: i2.RouterLink, selector: \"[routerLink]\", inputs: [\"target\", \"queryParams\", \"fragment\", \"queryParamsHandling\", \"state\", \"info\", \"relativeTo\", \"preserveFragment\", \"skipLocationChange\", \"replaceUrl\", \"routerLink\"] }, { kind: \"directive\", type: i2.RouterLinkActive, selector: \"[routerLinkActive]\", inputs: [\"routerLinkActiveOptions\", \"ariaCurrentWhenActive\", \"routerLinkActive\"], outputs: [\"isActiveChange\"], exportAs: [\"routerLinkActive\"] }, { kind: \"pipe\", type: i3.AsyncPipe, name: \"async\" }, { kind: \"pipe\", type: i4.LocalizeRouterPipe, name: \"localize\" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }\n};\nGpsCartCountBadgeComponent = __decorate([\n UntilDestroy()\n], GpsCartCountBadgeComponent);\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"17.1.3\", ngImport: i0, type: GpsCartCountBadgeComponent, decorators: [{\n type: Component,\n args: [{ selector: 'gps-cart-count-badge', changeDetection: ChangeDetectionStrategy.OnPush, template: \"
\\n \\n \\n \\n {{ count }}\\n \\n \\n \\n \\n
\\n\", styles: [\"a{color:inherit}i{font-style:normal}.badge{width:1.5rem;height:1.5rem;right:-.75rem;top:-.75rem}\\n\"] }]\n }], ctorParameters: () => [{ type: i1.CartService }, { type: i2.Router }], propDecorators: { isNavLink: [{\n type: Input\n }], icon: [{\n type: Input\n }], activeIcon: [{\n type: Input\n }], badgeClass: [{\n type: Input\n }] } });\n\nclass GpsCartCountBadgeModule {\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"17.1.3\", ngImport: i0, type: GpsCartCountBadgeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }\n static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"14.0.0\", version: \"17.1.3\", ngImport: i0, type: GpsCartCountBadgeModule, declarations: [GpsCartCountBadgeComponent], imports: [CommonModule, RouterModule, LocalizeRouterModule], exports: [GpsCartCountBadgeComponent] }); }\n static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"17.1.3\", ngImport: i0, type: GpsCartCountBadgeModule, imports: [CommonModule, RouterModule, LocalizeRouterModule] }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"17.1.3\", ngImport: i0, type: GpsCartCountBadgeModule, decorators: [{\n type: NgModule,\n args: [{\n declarations: [GpsCartCountBadgeComponent],\n imports: [CommonModule, RouterModule, LocalizeRouterModule],\n exports: [GpsCartCountBadgeComponent],\n }]\n }] });\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { GpsCartCountBadgeComponent, GpsCartCountBadgeModule };\n","\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\nimport { AnalyticsService } from '@geneplanet/ngx-utils';\nimport { first } from 'rxjs/operators';\nimport { LanguageService } from 'src/app/shared/services/language.service';\nimport { environment } from 'src/environments/environment';\n\n@Component({\n selector: 'app-header-language-switcher',\n templateUrl: './header-language-switcher.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class HeaderLanguageSwitcherComponent {\n environment = environment;\n constructor(\n public languageService: LanguageService,\n private analyticsService: AnalyticsService\n ) {}\n\n locationChange(event: any) {\n this.languageService.onLocationChange(event);\n this.languageService.currentLocation$\n .pipe(first())\n .subscribe((location) => {\n const value = {\n value: location.lang.code + '/' + location.currency,\n };\n\n this.analyticsService.trackFormValue(\n 'header-location-change',\n 'location',\n value\n );\n });\n }\n}\n","\n \n \n \n \n \n\n \n \n \n \n \n \n\n \n @if ('shop' | isFeatureActive) {\n
\n \n
\n }\n\n
\n \n \n \n
\n
\n\n \n \n \n\n \n {{ 'ONBOARDING.COMPLETE.CLOSE' | translate }}\n \n\n \n {{ 'ONBOARDING.HEADER.SKIP' | translate }}\n \n\n \n\n \n {{ 'ME.LOGOUT' | translate }}\n \n \n \n
\n","import { Component, Input, OnChanges, OnInit } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport { finalize } from 'rxjs/operators';\nimport { Auth0Account } from 'src/app/accounts/interfaces/accounts.types';\nimport { MeService } from 'src/app/me/services/me.service';\nimport { OnboardingIntentStep } from 'src/app/shared/enums/intent.enum';\nimport { IntentStrategyService } from 'src/app/shared/services/intent/intent-strategy.service';\nimport { IntentService } from 'src/app/shared/services/intent/intent.service';\nimport { openExternalWebPage } from 'src/app/shared/util/link-util';\nimport { environment } from 'src/environments/environment';\nimport { Layout, NavigationExtras } from '../../interfaces';\nimport { LayoutService } from '../../services/layout.service';\nimport { SideMenuService } from '../../services/side-menu.service';\n\n@UntilDestroy()\n@Component({\n selector: 'app-header',\n templateUrl: './header.component.html',\n styleUrls: ['./header.component.scss'],\n})\nexport class HeaderComponent implements OnInit, OnChanges {\n @Input() account: Auth0Account;\n\n layout: Layout;\n extras: NavigationExtras;\n simple = false;\n hasSideMenu = false;\n isCollapsable = false;\n isCheckout = false;\n\n constructor(\n private router: Router,\n private layoutService: LayoutService,\n private meService: MeService,\n private sideMenuService: SideMenuService,\n private intentService: IntentService,\n private intentStrategyService: IntentStrategyService\n ) {}\n\n ngOnInit() {\n this.layoutService.layout$\n .pipe(untilDestroyed(this))\n .subscribe((layout: Layout) => {\n this.layout = layout;\n this.updateState();\n });\n this.layoutService.navigationExtras$\n .pipe(untilDestroyed(this))\n .subscribe((extras: NavigationExtras) => {\n this.extras = extras;\n this.updateState();\n });\n this.sideMenuService.isCollapsable$.subscribe(\n (collapsable) => (this.isCollapsable = collapsable)\n );\n }\n\n ngOnChanges() {\n this.updateState();\n }\n\n redirectToWebsiteOrDashboard() {\n // when user is onboarding, click in logo should take him to website (open in new tab)\n if (\n this.router.url.startsWith('/accounts') ||\n this.router.url.startsWith('/onboarding') ||\n this.router.url.startsWith('/nipt/nipt-expired')\n ) {\n openExternalWebPage(environment.pages.home);\n } else {\n this.onCancelIntentClick();\n }\n }\n\n openSideMenu() {\n this.sideMenuService.openToggle();\n }\n\n logout(): void {\n this.meService.logout();\n this.router.navigate(['accounts/logged-out']);\n }\n\n isRouterLinkActive(url: string): boolean {\n return this.router.isActive(url, false);\n }\n\n onNavItemClicked() {\n this.sideMenuService.setDefault();\n }\n\n onSkipClick() {\n if (\n this.layout?.header?.skipLink?.step ===\n OnboardingIntentStep.DownloadAfterCheck\n ) {\n this.intentStrategyService.context.onDownloadAfterCheckSkipClick();\n } else {\n this.intentStrategyService.context.onTrackSkipClick();\n }\n }\n\n onClose() {\n if (this.layout?.header?.cancelIntent) {\n this.onCancelIntentClick();\n } else if (this.layout?.header?.closeButton) {\n this.layoutService.headerCloseClick();\n }\n }\n\n private onCancelIntentClick() {\n this.intentService\n .cancelIntent()\n .pipe(\n finalize(() => {\n this.router.navigate(['/dashboard#overview']);\n })\n )\n .subscribe();\n }\n\n private updateState() {\n this.isCheckout = this.layout?.footer?.bottomOffset === 'checkout';\n this.simple = !this.account || this.layout?.header?.simple;\n this.hasSideMenu = this.account && !this.layout?.sideMenu?.hide;\n this.layoutService.headerResized$.next();\n }\n}\n","
\n \n \n \n \n {{ 'RESULTS.MENU.ALL.DNA_INSIGHTS' | translate }}\n

\n \n \n \n\n
\n\n \n \n {{ 'RESULTS.MENU.ALL.LIFESTYLE_INSIGHTS' | translate }}\n \n

\n \n \n \n\n
\n\n \n \n {{ 'RESULTS.MENU.ALL.FEATURES' | translate }}\n \n

\n \n \n \n
\n\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n HostListener,\n Input,\n OnInit,\n Output,\n} from '@angular/core';\nimport { AnalyticsService } from '@geneplanet/ngx-utils/src/lib/analytics';\nimport { NgbModal } from '@ng-bootstrap/ng-bootstrap';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport { distinctUntilChanged, filter, switchMap } from 'rxjs/operators';\nimport { HealthscoreTabs } from 'src/app/healthscore/constants/healthscore-tabs';\nimport { MeService } from 'src/app/me/services/me.service';\nimport { FeatureFlagGuard } from 'src/app/shared/guards/feature.guard';\nimport { CustomerCheckService } from 'src/app/shared/services/customer-check.service';\nimport { environment } from 'src/environments/environment';\nimport { Category } from '../../interfaces';\nimport { SideMenuService } from '../../services/side-menu.service';\nimport { isMobileApp } from 'src/app/shared/util/is-mobile-app';\nimport { LanguageService } from 'src/app/shared/services/language.service';\nimport { isFeatureActive } from 'src/app/shared/util/feature-active';\n\ninterface ResultLink {\n url: string;\n title: string;\n icon: string;\n visible: boolean;\n fragment?: string;\n dataTrack?: string;\n new?: boolean;\n newAnalyses?: boolean;\n}\n\nfunction trueIfUndefined(value: boolean): boolean {\n return value === undefined ? true : value;\n}\n\n@UntilDestroy()\n@Component({\n selector: 'app-results-menu',\n templateUrl: './results-menu.component.html',\n styleUrls: ['./results-menu.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ResultsMenuComponent implements OnInit {\n @Input({ transform: trueIfUndefined }) mobile = true;\n @Input() collapsed = false;\n @Output() navItemClicked = new EventEmitter();\n\n categories: Category[];\n\n dashboardLink: ResultLink;\n dnaLinks: ResultLink[] = [];\n lifestyleLinks: ResultLink[] = [];\n featureLinks: ResultLink[] = [];\n\n constructor(\n private meService: MeService,\n private cdRef: ChangeDetectorRef,\n private sideMenuService: SideMenuService,\n private customerCheckService: CustomerCheckService,\n private modals: NgbModal,\n private analyticsService: AnalyticsService,\n private languageService: LanguageService\n ) {}\n\n @HostListener('window:resize', ['$event'])\n onResize(event) {\n if (event.target.innerWidth < 768) {\n this.dashboardLink.visible = false;\n } else {\n this.dashboardLink.visible = true;\n }\n }\n\n ngOnInit() {\n this.updateLinks();\n this.meService.isNiptUser\n .pipe(untilDestroyed(this), distinctUntilChanged())\n .subscribe(() => this.updateLinks());\n\n this.languageService.currentLocation$\n .pipe(untilDestroyed(this), distinctUntilChanged())\n .subscribe(() => this.updateLinks());\n\n this.sideMenuService.categories$\n .pipe(untilDestroyed(this))\n .subscribe((categories) => {\n this.categories = categories;\n this.updateLinks();\n });\n\n this.customerCheckService.customerExists$\n .pipe(\n filter((exists) => exists),\n switchMap(() => this.sideMenuService.fetchCategories()),\n untilDestroyed(this)\n )\n .subscribe((categories) => {\n this.sideMenuService.categories$.next(categories);\n });\n\n this.meService.getFullProfile()?.subscribe();\n }\n\n navItemClick(data: string) {\n this.analyticsService.trackClicksManually(data);\n this.modals.dismissAll();\n this.navItemClicked.emit();\n }\n\n private updateLinks() {\n const { myLifestyle, myHealth, myAncestry, dnaTestResults } =\n environment.categories;\n\n this.dashboardLink = {\n url: '/dashboard',\n title: 'DASHBOARD.TITLE',\n icon: 'gpicon-dashboard',\n visible: !this.mobile,\n dataTrack: 'results-dashboard',\n };\n\n this.dnaLinks = [\n {\n url: '/dna',\n title: 'RESULTS.MENU.ALL.LIFESTYLE',\n icon: 'gpicon-sports-and-recreation',\n visible: this.categoryExists(myLifestyle),\n dataTrack: 'results-mylifestyle',\n },\n {\n url: '/prs',\n title: 'RESULTS.MENU.ALL.HEALTH',\n icon: 'gpicon-immune-system',\n visible: this.categoryExists(myHealth),\n dataTrack: 'results-myhealth',\n newAnalyses: !isFeatureActive(\n this.languageService.locationCode,\n 'newPrs'\n ),\n },\n {\n url: '/ancestry',\n title: 'RESULTS.MENU.ALL.ANCESTRY',\n icon: 'gpicon-ancestry',\n visible:\n this.categoryExists(myAncestry) &&\n FeatureFlagGuard.isFeatureActive('ancestry'),\n dataTrack: 'results-ancestry',\n },\n {\n url: '/dna-snp',\n title: 'RESULTS.MENU.ALL.DNA',\n icon: 'gpicon-dna',\n visible: this.categoryExists(dnaTestResults),\n dataTrack: 'results-dna-snp',\n },\n {\n url: '/nipt',\n title: 'RESULTS.MENU.ALL.NIPT',\n icon: 'gpicon-nipt',\n visible:\n FeatureFlagGuard.isFeatureActive('nipt') &&\n this.meService.isNiptUser.value,\n dataTrack: 'results-nipt',\n },\n ];\n\n this.lifestyleLinks = [\n {\n url: '/healthscore',\n title: 'RESULTS.MENU.ALL.HEALTHSCORE',\n icon: 'gpicon-healthscore',\n fragment: HealthscoreTabs.DISCOVER,\n visible: true,\n dataTrack: 'results-healthscore',\n },\n {\n url: '/measurement',\n title: 'RESULTS.MENU.ALL.BODY',\n icon: 'gpicon-body',\n visible: true,\n dataTrack: 'results-measurements',\n },\n {\n url: '/blood',\n title: 'RESULTS.MENU.ALL.BLOOD',\n icon: 'gpicon-blood',\n visible: true,\n dataTrack: 'results-blood',\n },\n {\n url: '/habits',\n title: 'RESULTS.MENU.ALL.HABITS',\n icon: 'gpicon-habits',\n visible: true,\n dataTrack: 'results-habits',\n },\n {\n url: '/microbiome',\n title: 'RESULTS.MENU.ALL.MICROBIOME',\n icon: 'gpicon-oral-microbiome',\n visible: FeatureFlagGuard.isFeatureActive('oralMicrobiome'),\n dataTrack: 'results-microbiome',\n },\n ];\n\n this.featureLinks = [\n !isMobileApp() && {\n // TODO: Remove for Recipe mobile release\n url: '/recipes',\n title: 'RESULTS.MENU.ALL.RECIPES',\n icon: 'gpicon-recipe-generator',\n // Thailand should not see recipe generator\n visible: isFeatureActive(\n this.languageService.locationCode,\n 'recipeGenerator'\n ),\n new: true,\n dataTrack: 'results-recipe-generator',\n },\n {\n url: '/foodid',\n title: 'RESULTS.MENU.ALL.FOODID',\n icon: 'gpicon-food',\n visible: FeatureFlagGuard.isFeatureActive('foodid'),\n dataTrack: 'results-foodid',\n },\n ];\n this.cdRef.markForCheck();\n }\n\n private categoryExists(categoryId: string): boolean {\n return !!this.categories?.find((c) => c.categoryId === categoryId);\n }\n}\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n HostBinding,\n OnInit,\n} from '@angular/core';\nimport { SideMenuService } from '../../services/side-menu.service';\nimport { MeService } from 'src/app/me/services/me.service';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\n\n@UntilDestroy()\n@Component({\n selector: 'app-side-menu',\n templateUrl: './side-menu.component.html',\n styleUrls: ['./side-menu.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SideMenuComponent implements OnInit, AfterViewInit {\n @HostBinding('class.collapsed') collapsed = false;\n @HostBinding('class.opened') opened = true;\n\n public navigationLinks = [];\n public isCollapsable = false;\n\n constructor(\n private elementRef: ElementRef,\n private sideMenuService: SideMenuService,\n private cdr: ChangeDetectorRef,\n private meService: MeService\n ) {}\n\n ngOnInit() {\n this.meService.getFullProfile()?.subscribe();\n this.sideMenuService.isCollapsable$.subscribe(\n (collapsable) => (this.isCollapsable = collapsable)\n );\n\n this.sideMenuService.state$\n .pipe(untilDestroyed(this))\n .subscribe((state) => {\n this.opened = state.opened;\n this.collapsed = state.collapsed;\n this.cdr.markForCheck();\n });\n }\n\n ngAfterViewInit() {\n this.sideMenuService.setSideMenuElementRef(this.elementRef);\n }\n\n toggleCollapsed() {\n this.sideMenuService.collapsedToggle();\n }\n\n onNavItemClicked() {\n this.sideMenuService.setDefault();\n }\n}\n","
\n
\n \n
\n
\n\n
\n \n \n {{ 'RESULTS.MENU.COLLAPSE' | translate }}\n \n
\n\n","\n \n \n \n {{ 'DASHBOARD.TITLE' | translate }}\n \n \n\n \n \n \n {{ 'RESULTS.TITLE' | translate }}\n \n \n\n \n \n \n {{ 'RESULTS.MENU.ADD.TITLE' | translate }}\n \n \n\n @if ('shop' | isFeatureActive) {\n \n \n \n {{ 'SHOP.TITLE' | translate }}\n \n \n \n }\n\n","import { Input, Component } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { Auth0Account } from 'src/app/accounts/interfaces/accounts.types';\n\n@Component({\n selector: 'app-mobile-footer',\n templateUrl: './mobile-footer.component.html',\n styleUrls: ['./mobile-footer.component.scss'],\n})\nexport class MobileFooterComponent {\n @Input() account: Auth0Account;\n\n dashboardUrl = '/dashboard';\n resultsUrl = '/results';\n addDataUrl = '/add-data';\n cartUrl = '/cart';\n\n constructor(private router: Router) {}\n\n isActive(route: string): boolean {\n return this.router.isActive(route, {\n paths: 'subset',\n queryParams: 'ignored',\n fragment: 'ignored',\n matrixParams: 'ignored',\n });\n }\n}\n","\n\n\n\n\n\n\n \n\n\n\n \n
\n \n\n","import { Component, OnInit } from '@angular/core';\n\nimport { Auth0Service } from '@geneplanet/ngx-auth0';\nimport { environment } from 'src/environments/environment';\nimport { AnalyticsService } from './analytics.service';\nimport {\n AnalyticsService as Analytics,\n AnalyticsIdentifyType,\n} from '@geneplanet/ngx-utils';\nimport {\n delay,\n distinctUntilChanged,\n filter,\n first,\n map,\n switchMap,\n} from 'rxjs/operators';\nimport { JwtHelperService } from '@auth0/angular-jwt';\nimport { Auth0Account } from './accounts/interfaces/accounts.types';\n// eslint-disable-next-line @typescript-eslint/naming-convention\nimport * as Sentry from '@sentry/angular';\nimport { LayoutService } from './core/services/layout.service';\nimport { Layout } from './core/interfaces';\nimport { LanguageService } from './shared/services/language.service';\nimport { SideMenuService } from './core/services/side-menu.service';\nimport { LocalizeRouterService } from '@gilsdav/ngx-translate-router';\nimport { CommonService } from '@geneplanet/ngx-shop/src/lib/shared';\nimport { NavigationEnd, Router } from '@angular/router';\nimport { BreakpointObserver, BreakpointState } from '@angular/cdk/layout';\nimport { NgbModal } from '@ng-bootstrap/ng-bootstrap';\nimport {\n GpuMediaQueryBreakpoints,\n GPU_MEDIA_QUERIES,\n} from '@geneplanet/ngx-ui/src/lib/layout';\nimport { SentryErrorService } from './sentry-error.service';\nimport { IntentService } from './shared/services/intent/intent.service';\nimport { UserIntentState } from './shared/interfaces/intent.interface';\nimport { of } from 'rxjs';\n\n@Component({\n selector: 'app-root',\n templateUrl: './app.component.html',\n})\nexport class AppComponent implements OnInit {\n public get localize(): LocalizeRouterService {\n return this._localize;\n }\n public set localize(value: LocalizeRouterService) {\n this._localize = value;\n }\n layout: Layout;\n environment = environment;\n account?: Auth0Account = null;\n language: string;\n hubspotNewsletter: {\n formId: string;\n portalId: string;\n submitTextKey: string;\n };\n mainMarginTop = 0;\n sideMenuWidth: number;\n isCheckout: boolean;\n isXlUp: boolean;\n\n private routerUrl: string;\n private isReloading: boolean;\n\n constructor(\n private readonly auth0: Auth0Service,\n private readonly analytics: AnalyticsService,\n public layoutService: LayoutService,\n private commonService: CommonService,\n private _localize: LocalizeRouterService,\n public languageService: LanguageService,\n private sideMenuService: SideMenuService,\n private router: Router,\n private breakpointObserver: BreakpointObserver,\n private modals: NgbModal,\n private analyticsService: Analytics,\n private sentryErrorService: SentryErrorService,\n private intentService: IntentService\n ) {\n this.sideMenuService.state$.subscribe(({ collapsed, opened }) => {\n if (!opened) {\n this.sideMenuWidth = 0;\n } else {\n this.sideMenuWidth = collapsed\n ? 72\n : this.sideMenuService.sideMenuWidth;\n }\n });\n\n const location = this.commonService.getLocationFromCode(\n this.localize.parser.currentLang\n );\n\n this.languageService.onLocationChange(location);\n\n this.intentService.state$\n .pipe(\n first(),\n switchMap((state: UserIntentState) =>\n state ? this.intentService.verifyIntentActive(state) : of(null)\n )\n )\n .subscribe();\n }\n\n ngOnInit(): void {\n this.analytics.init();\n\n if (environment.rudderStackEnabled) {\n this.sentryErrorService.errorOnMissingUserId();\n }\n\n this.auth0.tokens.current$\n .pipe(\n map((token: string) =>\n new JwtHelperService().decodeToken(JSON.parse(token || '{}').idToken)\n ),\n delay(0),\n filter(() => !this.isReloading)\n )\n .subscribe({\n next: (account: Auth0Account) => {\n this.account = account;\n\n this.sentryErrorService.setAccount(account);\n\n // Add user to Sentry\n if (environment.sentry?.logUser) {\n Sentry.setUser({ auth0: account?.sub });\n }\n // If user isn't identified while logged in\n if (environment.rudderStackEnabled && account) {\n this.identifyUser(account);\n }\n },\n error: (error) => {\n Sentry.captureMessage(\n `Failed to verify if user is identified: ${error}`\n );\n },\n });\n\n this.auth0.tokens.otherPageChange$.subscribe(() => {\n this.isReloading = true;\n window.location.reload();\n });\n\n this.router.events\n .pipe(\n filter((event) => event instanceof NavigationEnd),\n map((event: NavigationEnd) => {\n // Remove additional parameter from fragment - HS\n const splits = event.url.split('#');\n if (splits.length > 1) {\n splits[1] = splits[1].split('-')[0];\n }\n return splits.join('#');\n }),\n distinctUntilChanged()\n )\n .subscribe((url: string) => {\n this.routerUrl = url;\n this.modals.dismissAll();\n });\n\n this.layoutService.layout$.subscribe((layout: Layout) => {\n this.layout = layout;\n this.isCheckout = layout?.footer?.bottomOffset === 'checkout';\n });\n this.layoutService.headerHeightChange$.subscribe(\n (height: number) => (this.mainMarginTop = height)\n );\n\n this.breakpointObserver\n .observe(GPU_MEDIA_QUERIES[GpuMediaQueryBreakpoints.XL_UP])\n .subscribe((value: BreakpointState) => (this.isXlUp = value.matches));\n }\n\n get hasSideMenu() {\n return (\n (this.account && !this.layout?.sideMenu?.hide) ||\n this.layout?.sideMenu?.hasClass\n );\n }\n\n get hasFooterMenu() {\n return this.account && !this.layout?.footer?.hideMobileNav;\n }\n\n public showBottomOffset(): boolean {\n return !!this.layout?.footer?.bottomOffset;\n }\n\n public isProductsPage(): boolean {\n return this.routerUrl?.startsWith('/products/');\n }\n\n public isCartOrCheckoutPage(): boolean {\n return (\n this.routerUrl?.startsWith('/cart') ||\n this.routerUrl?.startsWith('/checkout/')\n );\n }\n\n public identifyUser(account: Auth0Account) {\n this.analyticsService\n .loaded()\n .pipe(\n filter((loaded) => loaded),\n first()\n )\n .subscribe(() => {\n this.analyticsService.setUser({\n userId: account.sub,\n traits: {\n type: AnalyticsIdentifyType.HI_NORMAL,\n customerId: account['http://schemas.nomnio.com/2017/5/customer'],\n },\n });\n });\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n HttpInterceptor,\n HttpEvent,\n HttpRequest,\n HttpErrorResponse,\n HttpHandler,\n HttpStatusCode,\n} from '@angular/common/http';\nimport { Observable, throwError, EMPTY } from 'rxjs';\nimport { Router } from '@angular/router';\nimport { catchError } from 'rxjs/operators';\n\n@Injectable()\nexport class ErrorRedirectInterceptor implements HttpInterceptor {\n constructor(private router: Router) {}\n\n intercept(\n httpRequest: HttpRequest,\n next: HttpHandler\n ): Observable> {\n const resultNotFound =\n httpRequest.url.match('/api/ancestry/results') ||\n httpRequest.url.match('/api/prs/analyses') ||\n httpRequest.url.match('/api/dna/analyses') ||\n httpRequest.url.match('/api/dna/reports') ||\n httpRequest.url.match('/api/prs/reports');\n\n const isProductUrl =\n this.router.url.match('/prs/results') ||\n this.router.url.match('/prs/dna') ||\n this.router.url.match('/prs/analyses') ||\n this.router.url.match('/dna/analyses') ||\n this.router.url.match('/dna/results') ||\n this.router.url.match('/ancestry');\n\n return next.handle(httpRequest).pipe(\n catchError((error) => {\n if (error instanceof HttpErrorResponse) {\n if (\n error.status === HttpStatusCode.NotFound &&\n resultNotFound &&\n isProductUrl\n ) {\n this.router.navigate(['/products/premium-pack'], {\n replaceUrl: true,\n });\n return EMPTY;\n }\n }\n return throwError(error);\n })\n );\n }\n}\n","import {\n HttpErrorResponse,\n HttpEvent,\n HttpHandler,\n HttpInterceptor,\n HttpRequest,\n} from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { GpuToastService, GpuToastType } from '@geneplanet/ngx-ui';\nimport { TranslateService } from '@ngx-translate/core';\nimport { Observable, Subject, throwError } from 'rxjs';\n\n@Injectable()\nexport class NoInternetInterceptor implements HttpInterceptor {\n private buttonClicked$ = new Subject();\n\n constructor(\n private toastrService: GpuToastService,\n private translateService: TranslateService\n ) {}\n\n intercept(\n request: HttpRequest,\n next: HttpHandler\n ): Observable> {\n if (!window.navigator.onLine) {\n const text = this.translateService.instant(\n 'FAILURE.NO_INTERNET_TOAST.DESCRIPTION'\n );\n const buttonText = this.translateService.instant('FAILURE.RETRY');\n\n this.showMessage(text, buttonText);\n\n this.buttonClicked$.pipe().subscribe(() => {\n if (window.navigator.onLine) {\n window.location.reload();\n } else {\n this.showMessage(text, buttonText);\n }\n });\n\n return throwError(\n () => new HttpErrorResponse({ error: 'There is no internet' })\n );\n }\n\n return next.handle(request);\n }\n\n public showMessage(text: string, buttonText: string): void {\n this.toastrService.show({ text, buttonText }, GpuToastType.Error, {\n disableTimeout: true,\n buttonClicked$: this.buttonClicked$,\n });\n }\n}\n","/* \"Barrel\" of Http Interceptors */\nimport { HTTP_INTERCEPTORS } from '@angular/common/http';\nimport { RequestInterceptor } from './http-interceptor';\nimport { ErrorRedirectInterceptor } from './http-error-redirect-interceptor';\nimport { NoInternetInterceptor } from './no-internet-toast-interceptor';\nimport { InternalServerErrorInterceptor } from './internal-server-error-interceptor';\n/** Http interceptor providers in outside-in order */\nexport const httpInterceptorProviders = [\n { provide: HTTP_INTERCEPTORS, useClass: RequestInterceptor, multi: true },\n {\n provide: HTTP_INTERCEPTORS,\n useClass: ErrorRedirectInterceptor,\n multi: true,\n },\n {\n provide: HTTP_INTERCEPTORS,\n useClass: NoInternetInterceptor,\n multi: true,\n },\n {\n provide: HTTP_INTERCEPTORS,\n useClass: InternalServerErrorInterceptor,\n multi: true,\n },\n];\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { NgbModule } from '@ng-bootstrap/ng-bootstrap';\nimport { CookiesService } from './cookie.service';\nimport { CookieConsentComponent } from './cookie-consent/cookie-consent.component';\nimport { CookieSettingsModalComponent } from './cookie-settings/cookie-settings-modal.component';\nimport { GpuModalModule } from '@geneplanet/ngx-ui/src/lib/modal';\nimport { GpuSwitchModule } from '@geneplanet/ngx-ui/src/lib/switch';\n\n@NgModule({\n imports: [\n CommonModule,\n TranslateModule,\n NgbModule,\n TranslateModule,\n GpuModalModule,\n GpuSwitchModule,\n ],\n declarations: [CookieConsentComponent, CookieSettingsModalComponent],\n providers: [CookiesService],\n exports: [CookieConsentComponent],\n})\nclass CookiesModule {}\n\nexport { CookiesModule, CookieConsentComponent, CookieSettingsModalComponent };\n","import { Inject, Injectable } from '@angular/core';\nimport { CommonService } from '@geneplanet/ngx-shop/src/lib/shared';\nimport {\n DEFAULT_LANGUAGE,\n MissingTranslationHandler,\n TranslateCompiler,\n TranslateLoader,\n TranslateParser,\n TranslateService,\n TranslateStore,\n USE_DEFAULT_LANG,\n USE_EXTEND,\n USE_STORE,\n} from '@ngx-translate/core';\nimport { Observable } from 'rxjs';\n\n/**\n * Custom translate service will convert LocationCode to LanguageCode.\n * This is to make sure TranslateService will always have language, not location.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class CustomTranslateService extends TranslateService {\n constructor(\n store: TranslateStore,\n currentLoader: TranslateLoader,\n compiler: TranslateCompiler,\n parser: TranslateParser,\n missingTranslationHandler: MissingTranslationHandler,\n @Inject(USE_DEFAULT_LANG) useDefaultLang = true,\n @Inject(USE_STORE) isolate = false,\n @Inject(USE_EXTEND) extend = false,\n @Inject(DEFAULT_LANGUAGE) defaultLanguage: string,\n private commonService: CommonService\n ) {\n super(\n store,\n currentLoader,\n compiler,\n parser,\n missingTranslationHandler,\n useDefaultLang,\n isolate,\n extend,\n defaultLanguage\n );\n }\n\n public setDefaultLang(lang: string): void {\n super.setDefaultLang(\n this.commonService.getLanguageCodeFromLocationCode(lang)\n );\n }\n\n public use(lang: string): Observable {\n return super.use(this.commonService.getLanguageCodeFromLocationCode(lang));\n }\n}\n","import { ActivatedRouteSnapshot, PreloadingStrategy, Route } from '@angular/router';\nimport { Observable, of } from 'rxjs';\nimport { catchError, delay, mergeMap } from 'rxjs/operators';\n\nexport class CustomPreloadingStrategy implements PreloadingStrategy {\n /**\n *\n * @param route\n * @param fn\n *\n * Custom preloading strategy, to avoid preloading all modules.\n * By default all modules are preloaded, with 5000ms delay\n *\n * If you do not wish to preload module, use `noPreload`\n *\n * ```ts\n * {\n * path: 'my-path',\n * data: { noPreload: true },\n * loadChildren: () => ...,\n * },\n * ```\n *\n * If you wish to avoid delay in module preloading, use `noDelay`.\n * Delay has been added to free browser resources while initial content is being rendered.\n *\n * ```ts\n * {\n * path: 'my-path',\n * data: { noDelay: true },\n * loadChildren: () => ...,\n * },\n * ```\n *\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n preload(route: Route, fn: Function): Observable {\n const data = (route as ActivatedRouteSnapshot)?.data;\n\n if (data?.noPreload) {\n return of(null);\n }\n\n // We add default delay, but can turned off if needed\n const delayTime = data?.noDelay ? 0 : 5000;\n\n return of(null).pipe(\n delay(delayTime),\n mergeMap(() => fn()),\n catchError(() => of(null))\n );\n }\n}\n","
\n \n \n\n

{{ 'RESULTS.MENU.ADD.TITLE' | translate }}

\n\n \n
\n\n","import { Component, HostListener } from '@angular/core';\n\n@Component({\n selector: 'app-add-data-menu',\n templateUrl: './add-data-menu.component.html',\n})\nexport class AddDataMenuComponent {\n isLandscape = false;\n\n @HostListener('window:resize', ['$event'])\n onResize(event) {\n if (event.target.innerWidth < 768) {\n this.isLandscape = false;\n } else {\n this.isLandscape = true;\n }\n }\n}\n","import { Injectable } from '@angular/core';\nimport { CanActivate, Router, UrlTree } from '@angular/router';\n\n@Injectable({ providedIn: 'root' })\nexport class MobileGuard implements CanActivate {\n constructor(private readonly router: Router) {}\n\n canActivate(): boolean | UrlTree {\n return window.innerWidth < 768 ? true : this.router.createUrlTree(['/']);\n }\n}\n","import { Location } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { RouterModule, Routes } from '@angular/router';\nimport {\n CacheMechanism,\n LocalizeParser,\n LocalizeRouterModule,\n LocalizeRouterSettings,\n} from '@gilsdav/ngx-translate-router';\nimport { COOKIE_DOMAIN, COOKIE_LANG } from './app.constants';\nimport { AccountsVerifiedGuard } from './accounts/guards/verified.guard';\nimport { ManualLoaderFactory } from './app.utils';\nimport { CustomerExistsGuard } from './customers';\nimport { FeatureFlagGuard } from './shared/guards/feature.guard';\nimport { CustomTranslateService } from './core/services/custom-translate.service';\nimport { Auth0Guard } from '@geneplanet/ngx-auth0';\nimport { CustomPreloadingStrategy } from './core/utils/custom-preload-strategy';\nimport { AddDataMenuComponent, ResultsMenuComponent } from './core/pages';\nimport { MobileGuard } from './core/guards/mobile.guard';\nimport { canActivateFeature } from './shared/guards/feature-active.guard';\n\nconst appRoutes: Routes = [\n {\n path: 'me',\n data: { skipRouteLocalization: true },\n loadChildren: () => import('./me/me.module').then((m) => m.MeModule),\n },\n {\n path: 'healthscore',\n data: { skipRouteLocalization: true },\n loadChildren: () =>\n import('./healthscore/healthscore.module').then(\n (m) => m.HealthscoreModule\n ),\n },\n {\n path: 'prs',\n data: { skipRouteLocalization: true },\n loadChildren: () => import('./prs/prs.module').then((m) => m.PrsModule),\n },\n {\n path: 'accounts',\n data: { skipRouteLocalization: true },\n loadChildren: () =>\n import('./accounts/accounts.module').then((m) => m.AccountsModule),\n },\n {\n canActivate: [FeatureFlagGuard],\n path: 'microbiome',\n loadChildren: () =>\n import('./oral-microbiome/oral-microbiome.module').then(\n (m) => m.OralMicrobiomeModule\n ),\n data: { feature: 'oralMicrobiome' },\n },\n {\n path: 'dashboard',\n data: { skipRouteLocalization: true },\n loadChildren: () =>\n import('./dashboard/dashboard.module').then((m) => m.DashboardModule),\n },\n\n {\n path: 'foodid',\n data: { skipRouteLocalization: true },\n loadChildren: () =>\n import('./foodid/foodid.module').then((m) => m.FoodIdModule),\n },\n {\n path: 'nipt',\n data: { feature: 'nipt', skipRouteLocalization: true },\n loadChildren: () => import('./nipt/nipt.module').then((m) => m.NiptModule),\n canActivateChild: [FeatureFlagGuard],\n },\n {\n path: 'onboarding',\n data: { skipRouteLocalization: true },\n loadChildren: () =>\n import('./onboarding/onboarding.module').then((m) => m.OnboardingModule),\n },\n {\n path: 'ancestry',\n canActivateChild: [\n Auth0Guard,\n AccountsVerifiedGuard,\n CustomerExistsGuard,\n FeatureFlagGuard,\n ],\n data: { feature: 'ancestry', skipRouteLocalization: true, noPreload: true },\n loadChildren: () =>\n import('./ancestry/ancestry.module').then((m) => m.AncestryModule),\n },\n {\n path: '',\n data: { skipRouteLocalization: { localizeRedirectTo: true } },\n redirectTo: '/dashboard',\n pathMatch: 'full',\n },\n {\n data: { skipRouteLocalization: true },\n path: '',\n canActivateChild: [\n AccountsVerifiedGuard,\n CustomerExistsGuard,\n canActivateFeature('shop', '/error/shop-unavailable'),\n ],\n loadChildren: () =>\n import('@geneplanet/ngx-shop/src/lib/shop').then((m) => m.ShopModule),\n },\n {\n path: 'habits',\n data: { skipRouteLocalization: true },\n canActivateChild: [Auth0Guard, AccountsVerifiedGuard, CustomerExistsGuard],\n loadChildren: () =>\n import('./habits/habits.module').then((m) => m.HabitsModule),\n },\n {\n path: 'blood',\n canActivateChild: [Auth0Guard, AccountsVerifiedGuard, CustomerExistsGuard],\n data: { skipRouteLocalization: true },\n loadChildren: () =>\n import('./blood/blood.module').then((m) => m.BloodModule),\n },\n {\n path: 'measurement',\n data: { skipRouteLocalization: true },\n canActivateChild: [CustomerExistsGuard],\n loadChildren: () =>\n import('./body-measurements/body-measurements.module').then(\n (m) => m.BodyMeasurementsModule\n ),\n },\n {\n path: 'dna',\n data: { skipRouteLocalization: true },\n canActivateChild: [Auth0Guard, CustomerExistsGuard],\n loadChildren: () => import('./dna/dna.module').then((m) => m.DnaModule),\n },\n {\n path: 'dna-snp',\n data: { skipRouteLocalization: true },\n canActivateChild: [Auth0Guard, CustomerExistsGuard],\n loadChildren: () =>\n import('./dna-snp/dna-snp.module').then((m) => m.DnaSNPModule),\n },\n {\n path: 'recipes',\n data: { skipRouteLocalization: true },\n canActivateChild: [Auth0Guard, AccountsVerifiedGuard, CustomerExistsGuard],\n loadChildren: async () => (await import('./recipes/routes')).routes,\n },\n {\n path: 'error',\n data: { skipRouteLocalization: true },\n loadChildren: () =>\n import('./error/error.module').then((m) => m.ErrorModule),\n },\n {\n path: 'results',\n data: {\n skipRouteLocalization: true,\n layout: {\n sideMenu: {\n hide: true,\n },\n },\n },\n canActivate: [MobileGuard, Auth0Guard],\n component: ResultsMenuComponent,\n },\n {\n path: 'add-data',\n data: {\n skipRouteLocalization: true,\n layout: {\n sideMenu: {\n hide: true,\n },\n },\n },\n canActivate: [MobileGuard, Auth0Guard],\n component: AddDataMenuComponent,\n },\n {\n path: '**',\n redirectTo: '/dashboard',\n data: { skipRouteLocalization: true },\n },\n];\n\n@NgModule({\n imports: [\n RouterModule.forRoot(appRoutes, {\n onSameUrlNavigation: 'reload',\n preloadingStrategy: CustomPreloadingStrategy,\n paramsInheritanceStrategy: 'always',\n scrollPositionRestoration: 'enabled',\n bindToComponentInputs: true,\n }),\n LocalizeRouterModule.forRoot(appRoutes, {\n parser: {\n provide: LocalizeParser,\n useFactory: ManualLoaderFactory,\n deps: [CustomTranslateService, Location, LocalizeRouterSettings],\n },\n defaultLangFunction: (languages, cachedLang, browserLang) => {\n let locationCode = cachedLang || browserLang;\n if (!languages.includes(locationCode)) {\n locationCode = languages[0];\n }\n\n return locationCode;\n },\n cacheName: COOKIE_LANG,\n cacheMechanism: CacheMechanism.Cookie,\n cookieFormat: `{{value}};{{expires}};path=/;domain=${COOKIE_DOMAIN}`,\n useCachedLang: true,\n alwaysSetPrefix: false,\n }),\n ],\n exports: [RouterModule, LocalizeRouterModule],\n})\nexport class AppRoutingModule {}\n","import { inject } from '@angular/core';\nimport { CanActivateFn, Router } from '@angular/router';\nimport { LanguageService } from '../services/language.service';\nimport { isFeatureActive } from '../util/feature-active';\n\nexport function canActivateFeature(\n feature: string,\n redirectUrl: string = '/'\n): CanActivateFn {\n return () => {\n const router = inject(Router);\n const languageService = inject(LanguageService);\n\n const location = languageService.locationCode;\n\n if (isFeatureActive(location, feature)) {\n return true;\n }\n\n return router.navigateByUrl(redirectUrl);\n };\n}\n","import { NgModule } from '@angular/core';\nimport { components } from './components';\nimport { pages } from './pages';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { CommonModule } from '@angular/common';\nimport { RouterModule } from '@angular/router';\nimport { SharedModule } from '../shared/shared.module';\nimport { LayoutModule } from '@angular/cdk/layout';\nimport { GpsCartCountBadgeModule } from '@geneplanet/ngx-shop/src/lib/cart-count-badge';\nimport { GptLocalizationModule } from '@geneplanet/ngx-utils/src/lib/localization';\nimport { GpuFormFieldModule } from '@geneplanet/ngx-ui/src/lib/form-field';\nimport { GpuLayoutModule } from '@geneplanet/ngx-ui/src/lib/layout';\nimport { LokaliseOverrideModule } from '../lokalise';\nimport { FeatureActivePipe } from '../shared/pipes/feature-active.pipe';\n\n@NgModule({\n declarations: [...pages, ...components],\n imports: [\n CommonModule,\n TranslateModule,\n RouterModule,\n SharedModule,\n LayoutModule,\n GpuFormFieldModule,\n GpsCartCountBadgeModule,\n GptLocalizationModule,\n GpuLayoutModule,\n LokaliseOverrideModule,\n FeatureActivePipe,\n ],\n exports: [...pages, ...components],\n})\nexport class CoreModule {}\n","import { asyncScheduler } from '../scheduler/async';\nimport { isValidDate } from '../util/isDate';\nimport { operate } from '../util/lift';\nimport { innerFrom } from '../observable/innerFrom';\nimport { createErrorClass } from '../util/createErrorClass';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { executeSchedule } from '../util/executeSchedule';\nexport const TimeoutError = createErrorClass((_super) => function TimeoutErrorImpl(info = null) {\n _super(this);\n this.message = 'Timeout has occurred';\n this.name = 'TimeoutError';\n this.info = info;\n});\nexport function timeout(config, schedulerArg) {\n const { first, each, with: _with = timeoutErrorFactory, scheduler = schedulerArg !== null && schedulerArg !== void 0 ? schedulerArg : asyncScheduler, meta = null, } = (isValidDate(config) ? { first: config } : typeof config === 'number' ? { each: config } : config);\n if (first == null && each == null) {\n throw new TypeError('No timeout provided.');\n }\n return operate((source, subscriber) => {\n let originalSourceSubscription;\n let timerSubscription;\n let lastValue = null;\n let seen = 0;\n const startTimer = (delay) => {\n timerSubscription = executeSchedule(subscriber, scheduler, () => {\n try {\n originalSourceSubscription.unsubscribe();\n innerFrom(_with({\n meta,\n lastValue,\n seen,\n })).subscribe(subscriber);\n }\n catch (err) {\n subscriber.error(err);\n }\n }, delay);\n };\n originalSourceSubscription = source.subscribe(createOperatorSubscriber(subscriber, (value) => {\n timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.unsubscribe();\n seen++;\n subscriber.next((lastValue = value));\n each > 0 && startTimer(each);\n }, undefined, undefined, () => {\n if (!(timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.closed)) {\n timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.unsubscribe();\n }\n lastValue = null;\n }));\n !seen && startTimer(first != null ? (typeof first === 'number' ? first : +first - scheduler.now()) : each);\n });\n}\nfunction timeoutErrorFactory(info) {\n throw new TimeoutError(info);\n}\n","import { formatDate } from '@angular/common';\nimport { Injectable } from '@angular/core';\nimport { NgbDatepickerI18n, NgbDateStruct } from '@ng-bootstrap/ng-bootstrap';\nimport { TranslateService } from '@ngx-translate/core';\n\n/**\n * Custom i18n service for datepicker.\n * By default ngbDatepicker will use LOCALE_ID, which doesn't change at runtime.\n * The only change here is to replace LOCALE_ID with TranslateService.currentLang.\n * For default, see https://github.com/ng-bootstrap/ng-bootstrap/blob/master/src/datepicker/datepicker-i18n.ts#L96\n */\n@Injectable()\nexport class NgbDatepickerI18nCustom extends NgbDatepickerI18n {\n private _monthsShort: readonly string[];\n private _monthsFull: readonly string[];\n\n constructor(private translate: TranslateService) {\n super();\n\n this.init();\n // We need to reset whenever language changes\n this.translate.onLangChange.subscribe(() => this.init());\n }\n\n init(): void {\n this._monthsShort = [...Array(12).keys()].map((month) =>\n Intl.DateTimeFormat(this.translate.currentLang, {\n month: 'short',\n }).format(new Date(2000, month))\n );\n\n this._monthsFull = [...Array(12).keys()].map((month) =>\n Intl.DateTimeFormat(this.translate.currentLang, { month: 'long' }).format(\n new Date(2000, month)\n )\n );\n }\n\n getWeekdayLabel(\n weekday: number,\n width?: Exclude\n ): string {\n const weekdaysStartingOnSunday = [...Array(7).keys()].map((day) =>\n Intl.DateTimeFormat(this.translate.currentLang, {\n weekday: width === undefined ? 'short' : width,\n }).format(new Date(Date.UTC(2021, 5, day - 1)))\n );\n const weekdays = weekdaysStartingOnSunday.map(\n (_, index) => weekdaysStartingOnSunday[(index + 1) % 7]\n );\n return weekdays[weekday - 1] || '';\n }\n\n getMonthShortName(month: number): string {\n return this._monthsShort[month - 1] || '';\n }\n\n getMonthFullName(month: number): string {\n return this._monthsFull[month - 1] || '';\n }\n\n getDayAriaLabel(date: NgbDateStruct): string {\n const jsDate = new Date(date.year, date.month - 1, date.day);\n return formatDate(jsDate, 'fullDate', this.translate.currentLang);\n }\n}\n","import {\n HttpClient,\n provideHttpClient,\n withFetch,\n withInterceptorsFromDi,\n} from '@angular/common/http';\nimport {\n APP_INITIALIZER,\n ErrorHandler,\n Injector,\n NgModule,\n} from '@angular/core';\nimport { BrowserModule, HammerModule } from '@angular/platform-browser';\nimport { NgbDatepickerI18n, NgbModule } from '@ng-bootstrap/ng-bootstrap';\nimport { TranslateLoader, TranslateModule } from '@ngx-translate/core';\nimport { BrowserAnimationsModule } from '@angular/platform-browser/animations';\nimport { CommonService } from '@geneplanet/ngx-shop/src/lib/shared';\n\nimport { Auth0Module } from '@geneplanet/ngx-auth0';\n\nimport { environment } from 'src/environments/environment';\n\nimport { MultipleFilesHttpTranslationsLoader } from './multiple-files-http-translations-loader';\n\nimport { SharedModule } from './shared/shared.module';\nimport { AppComponent } from './app.component';\n\nimport { httpInterceptorProviders } from './core/interceptors';\nimport { InlineSVGModule } from 'ng-inline-svg-2';\nimport { CookiesModule } from './cookie-policy/cookies.module';\n\nimport { AppRoutingModule } from './app-routing.module';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nimport * as Sentry from '@sentry/angular';\n\nimport { RecaptchaV3Module, RECAPTCHA_V3_SITE_KEY } from 'ng-recaptcha';\nimport { ANALYTICS_SERVICE, RECAPTCHA } from 'src/app/app.constants';\nimport { CoreModule } from './core/core.module';\nimport { buildInfo } from 'src/environments/buildInfo';\nimport { LocalizeRouterService } from '@gilsdav/ngx-translate-router';\nimport { LanguageService } from './shared/services/language.service';\nimport { AnalyticsService as Analytics } from '@geneplanet/ngx-utils/src/lib/analytics';\nimport {\n catchError,\n filter,\n first,\n map,\n mapTo,\n tap,\n timeout,\n} from 'rxjs/operators';\nimport { combineLatest, Observable, of } from 'rxjs';\nimport { NavigationStart, Router } from '@angular/router';\nimport { UserIntentState } from './shared/interfaces/intent.interface';\nimport { IntentStrategyService } from './shared/services/intent/intent-strategy.service';\nimport { IntentService } from './shared/services/intent/intent.service';\nimport { CustomPreloadingStrategy } from './core/utils/custom-preload-strategy';\nimport { NgbDatepickerI18nCustom } from './core/utils/custom-datepicker-i18n';\nimport { AnalyticsModule } from '@geneplanet/ngx-utils';\nimport {\n provideLokalise,\n withEnvironmentEnabled,\n withProjectId,\n} from './lokalise';\n\nconst appInitializerFactory = (injector: Injector) => {\n return () => {\n const localize = injector.get(LocalizeRouterService);\n const common = injector.get(CommonService);\n const language = injector.get(LanguageService);\n const intentService = injector.get(IntentService);\n const intentStrategyService = injector.get(IntentStrategyService);\n const router = injector.get(Router);\n const analyticsService = injector.get(Analytics);\n\n if (environment.rudderStackEnabled) {\n analyticsService.init(\n 'HI',\n environment.rudderstackKey,\n 'https://geneplanetympr.dataplane.rudderstack.com'\n );\n }\n\n const localizeInitialized = localize.hooks.initialized.pipe(\n map(() => {\n const location = common.getLocationFromCode(\n localize.parser.currentLang\n );\n return language.onLocationChange(location);\n })\n );\n\n // magic link page track\n router.events\n .pipe(\n filter((event) => event instanceof NavigationStart),\n first()\n )\n .subscribe((event: NavigationStart) => {\n if (event.url.startsWith('/nipt/view/')) {\n analyticsService.pageTrack(event.url);\n }\n });\n\n const intentInitialized = (): Observable => {\n return intentService.fetchUserIntent().pipe(\n tap((state: UserIntentState) => {\n intentStrategyService.setStrategyByIntentId(state.intentId);\n }),\n mapTo(true),\n // Make sure API call doesn't block application bootstrap too long\n timeout(4000),\n // If Intent API call fails, whole application will not load.\n catchError((exception: any) => {\n if (exception?.name === 'TimeoutError') {\n Sentry.captureException(`[INTENT BOOTSTRAP] Request timeout!`);\n } else {\n Sentry.captureException(\n `[INTENT BOOTSTRAP] Exception: ${\n exception?.message ?? 'UNKNOWN!!'\n }`\n );\n }\n return of(true);\n })\n );\n };\n\n return combineLatest([\n localizeInitialized,\n intentInitialized(),\n ]).toPromise();\n };\n};\n\n@NgModule({\n declarations: [AppComponent],\n imports: [\n BrowserModule,\n BrowserAnimationsModule,\n NgbModule,\n InlineSVGModule.forRoot(),\n TranslateModule.forRoot({\n loader: {\n provide: TranslateLoader,\n useFactory: createTranslateLoader,\n deps: [HttpClient],\n },\n }),\n Auth0Module.forRoot(environment),\n CookiesModule,\n CoreModule,\n SharedModule,\n AppRoutingModule,\n RecaptchaV3Module,\n AnalyticsModule,\n HammerModule,\n ],\n providers: [\n provideLokalise(\n withProjectId('73322359621e0324812c59.72472535'),\n withEnvironmentEnabled(environment.environment !== 'production')\n ),\n provideHttpClient(withFetch(), withInterceptorsFromDi()),\n LocalizeRouterService,\n httpInterceptorProviders,\n {\n provide: ErrorHandler,\n useValue: Sentry.createErrorHandler({\n showDialog: false,\n }),\n },\n { provide: RECAPTCHA_V3_SITE_KEY, useValue: RECAPTCHA.siteKey },\n { provide: 'environment', useValue: environment },\n {\n provide: APP_INITIALIZER,\n useFactory: appInitializerFactory,\n multi: true,\n deps: [Injector],\n },\n { provide: NgbDatepickerI18n, useClass: NgbDatepickerI18nCustom },\n CustomPreloadingStrategy,\n { provide: ANALYTICS_SERVICE, useExisting: Analytics },\n { provide: 'googleTagManagerId', useValue: environment.gtmContainer },\n ],\n bootstrap: [AppComponent],\n})\nexport class AppModule {}\n\nexport function createTranslateLoader(http: HttpClient) {\n // Add version suffix to translation files, to make sure\n // latest translations are loaded\n const buildSuffix =\n String(buildInfo.buildNumber) !== 'dev'\n ? `?version=${buildInfo.buildNumber}`\n : '';\n return new MultipleFilesHttpTranslationsLoader(http, [\n { prefix: `./assets/i18n/`, suffix: `.json${buildSuffix}` },\n { prefix: `./assets/i18n/shop/`, suffix: `.json${buildSuffix}` },\n ]);\n}\n","export const buildInfo = { version: '1.0.0', buildNumber: 20240924 };\n","import { enableProdMode } from '@angular/core';\nimport { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nimport * as Sentry from '@sentry/angular';\nimport { RecaptchaComponent } from 'ng-recaptcha';\n\nimport { AppModule } from './app/app.module';\nimport { environment } from './environments/environment';\n\nimport 'hammerjs';\n\nif (environment.production) {\n enableProdMode();\n}\n\nSentry.init({\n dsn: environment.sentry.dns,\n environment: environment.environment,\n normalizeDepth: 5,\n ignoreErrors: [\n 'Illegal invocation',\n /Cannot read property 'loaded' of undefined/,\n /Can't find variable: fbq/,\n 'fbq is not defined',\n '@safari-extension',\n 'InvalidAccessError: The object does not support the operation or argument.',\n 'Block-scoped declarations (let, const, function, class) not yet supported outside strict mode',\n /Failed to execute 'sendBeacon' on 'Navigator'/,\n 'Non-Error promise rejection captured',\n ],\n beforeSend(event) {\n if (\n !environment.sentry.enabled ||\n window.location.href.includes('localhost')\n ) {\n // Console error message when developing\n console.error(event.message, event.extra);\n return null;\n }\n return event;\n },\n});\n\nplatformBrowserDynamic()\n .bootstrapModule(AppModule)\n .catch((err) => console.error(err));\n\n// temporary fix, check if needed when updating recaptcha to next version\n// https://github.com/DethAriel/ng-recaptcha/issues/123#issuecomment-426112101\nRecaptchaComponent.prototype.ngOnDestroy = function () {\n if (this.subscription) {\n this.subscription.unsubscribe();\n }\n};\n","import * as i0 from '@angular/core';\nimport { InjectionToken, Injectable, Inject, NgModule, Optional, SkipSelf } from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport { map, mergeMap } from 'rxjs/operators';\nimport { defer, of } from 'rxjs';\nimport { HTTP_INTERCEPTORS } from '@angular/common/http';\n\nconst JWT_OPTIONS = new InjectionToken('JWT_OPTIONS');\n\n// tslint:disable:no-bitwise\nclass JwtHelperService {\n constructor(config = null) {\n this.tokenGetter = (config && config.tokenGetter) || function () { };\n }\n urlBase64Decode(str) {\n let output = str.replace(/-/g, '+').replace(/_/g, '/');\n switch (output.length % 4) {\n case 0: {\n break;\n }\n case 2: {\n output += '==';\n break;\n }\n case 3: {\n output += '=';\n break;\n }\n default: {\n throw new Error('Illegal base64url string!');\n }\n }\n return this.b64DecodeUnicode(output);\n }\n // credits for decoder goes to https://github.com/atk\n b64decode(str) {\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n let output = '';\n str = String(str).replace(/=+$/, '');\n if (str.length % 4 === 1) {\n throw new Error(`'atob' failed: The string to be decoded is not correctly encoded.`);\n }\n for (\n // initialize result and counters\n let bc = 0, bs, buffer, idx = 0; \n // get next character\n (buffer = str.charAt(idx++)); \n // character found in table? initialize bit storage and add its ascii value;\n ~buffer &&\n ((bs = bc % 4 ? bs * 64 + buffer : buffer),\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4)\n ? (output += String.fromCharCode(255 & (bs >> ((-2 * bc) & 6))))\n : 0) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n return output;\n }\n b64DecodeUnicode(str) {\n return decodeURIComponent(Array.prototype.map\n .call(this.b64decode(str), (c) => {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n })\n .join(''));\n }\n decodeToken(token = this.tokenGetter()) {\n if (token instanceof Promise) {\n return token.then(t => this._decodeToken(t));\n }\n return this._decodeToken(token);\n }\n _decodeToken(token) {\n if (!token || token === '') {\n return null;\n }\n const parts = token.split('.');\n if (parts.length !== 3) {\n throw new Error(`The inspected token doesn't appear to be a JWT. Check to make sure it has three parts and see https://jwt.io for more.`);\n }\n const decoded = this.urlBase64Decode(parts[1]);\n if (!decoded) {\n throw new Error('Cannot decode the token.');\n }\n return JSON.parse(decoded);\n }\n getTokenExpirationDate(token = this.tokenGetter()) {\n if (token instanceof Promise) {\n return token.then(t => this._getTokenExpirationDate(t));\n }\n return this._getTokenExpirationDate(token);\n }\n _getTokenExpirationDate(token) {\n let decoded;\n decoded = this.decodeToken(token);\n if (!decoded || !decoded.hasOwnProperty('exp')) {\n return null;\n }\n const date = new Date(0);\n date.setUTCSeconds(decoded.exp);\n return date;\n }\n isTokenExpired(token = this.tokenGetter(), offsetSeconds) {\n if (token instanceof Promise) {\n return token.then(t => this._isTokenExpired(t, offsetSeconds));\n }\n return this._isTokenExpired(token, offsetSeconds);\n }\n _isTokenExpired(token, offsetSeconds) {\n if (!token || token === '') {\n return true;\n }\n const date = this.getTokenExpirationDate(token);\n offsetSeconds = offsetSeconds || 0;\n if (date === null) {\n return false;\n }\n return !(date.valueOf() > new Date().valueOf() + offsetSeconds * 1000);\n }\n getAuthScheme(authScheme, request) {\n if (typeof authScheme === 'function') {\n return authScheme(request);\n }\n return authScheme;\n }\n}\nJwtHelperService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"12.2.16\", ngImport: i0, type: JwtHelperService, deps: [{ token: JWT_OPTIONS }], target: i0.ɵɵFactoryTarget.Injectable });\nJwtHelperService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"12.2.16\", ngImport: i0, type: JwtHelperService });\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"12.2.16\", ngImport: i0, type: JwtHelperService, decorators: [{\n type: Injectable\n }], ctorParameters: function () { return [{ type: undefined, decorators: [{\n type: Inject,\n args: [JWT_OPTIONS]\n }] }]; } });\n\nconst fromPromiseOrValue = (input) => {\n if (input instanceof Promise) {\n return defer(() => input);\n }\n return of(input);\n};\nclass JwtInterceptor {\n constructor(config, jwtHelper, document) {\n this.jwtHelper = jwtHelper;\n this.document = document;\n this.standardPorts = ['80', '443'];\n this.tokenGetter = config.tokenGetter;\n this.headerName = config.headerName || 'Authorization';\n this.authScheme =\n config.authScheme || config.authScheme === ''\n ? config.authScheme\n : 'Bearer ';\n this.allowedDomains = config.allowedDomains || [];\n this.disallowedRoutes = config.disallowedRoutes || [];\n this.throwNoTokenError = config.throwNoTokenError || false;\n this.skipWhenExpired = config.skipWhenExpired;\n }\n isAllowedDomain(request) {\n const requestUrl = new URL(request.url, this.document.location.origin);\n // If the host equals the current window origin,\n // the domain is allowed by default\n if (requestUrl.host === this.document.location.host) {\n return true;\n }\n // If not the current domain, check the allowed list\n const hostName = `${requestUrl.hostname}${requestUrl.port && !this.standardPorts.includes(requestUrl.port)\n ? ':' + requestUrl.port\n : ''}`;\n return (this.allowedDomains.findIndex((domain) => typeof domain === 'string'\n ? domain === hostName\n : domain instanceof RegExp\n ? domain.test(hostName)\n : false) > -1);\n }\n isDisallowedRoute(request) {\n const requestedUrl = new URL(request.url, this.document.location.origin);\n return (this.disallowedRoutes.findIndex((route) => {\n if (typeof route === 'string') {\n const parsedRoute = new URL(route, this.document.location.origin);\n return (parsedRoute.hostname === requestedUrl.hostname &&\n parsedRoute.pathname === requestedUrl.pathname);\n }\n if (route instanceof RegExp) {\n return route.test(request.url);\n }\n return false;\n }) > -1);\n }\n handleInterception(token, request, next) {\n const authScheme = this.jwtHelper.getAuthScheme(this.authScheme, request);\n if (!token && this.throwNoTokenError) {\n throw new Error('Could not get token from tokenGetter function.');\n }\n let tokenIsExpired = of(false);\n if (this.skipWhenExpired) {\n tokenIsExpired = token ? fromPromiseOrValue(this.jwtHelper.isTokenExpired(token)) : of(true);\n }\n if (token) {\n return tokenIsExpired.pipe(map((isExpired) => isExpired && this.skipWhenExpired\n ? request.clone()\n : request.clone({\n setHeaders: {\n [this.headerName]: `${authScheme}${token}`,\n },\n })), mergeMap((innerRequest) => next.handle(innerRequest)));\n }\n return next.handle(request);\n }\n intercept(request, next) {\n if (!this.isAllowedDomain(request) || this.isDisallowedRoute(request)) {\n return next.handle(request);\n }\n const token = this.tokenGetter(request);\n return fromPromiseOrValue(token).pipe(mergeMap((asyncToken) => {\n return this.handleInterception(asyncToken, request, next);\n }));\n }\n}\nJwtInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"12.2.16\", ngImport: i0, type: JwtInterceptor, deps: [{ token: JWT_OPTIONS }, { token: JwtHelperService }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });\nJwtInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"12.2.16\", ngImport: i0, type: JwtInterceptor });\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"12.2.16\", ngImport: i0, type: JwtInterceptor, decorators: [{\n type: Injectable\n }], ctorParameters: function () { return [{ type: undefined, decorators: [{\n type: Inject,\n args: [JWT_OPTIONS]\n }] }, { type: JwtHelperService }, { type: Document, decorators: [{\n type: Inject,\n args: [DOCUMENT]\n }] }]; } });\n\nclass JwtModule {\n constructor(parentModule) {\n if (parentModule) {\n throw new Error(`JwtModule is already loaded. It should only be imported in your application's main module.`);\n }\n }\n static forRoot(options) {\n return {\n ngModule: JwtModule,\n providers: [\n {\n provide: HTTP_INTERCEPTORS,\n useClass: JwtInterceptor,\n multi: true,\n },\n options.jwtOptionsProvider || {\n provide: JWT_OPTIONS,\n useValue: options.config,\n },\n JwtHelperService,\n ],\n };\n }\n}\nJwtModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"12.2.16\", ngImport: i0, type: JwtModule, deps: [{ token: JwtModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule });\nJwtModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"12.0.0\", version: \"12.2.16\", ngImport: i0, type: JwtModule });\nJwtModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"12.2.16\", ngImport: i0, type: JwtModule });\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"12.2.16\", ngImport: i0, type: JwtModule, decorators: [{\n type: NgModule\n }], ctorParameters: function () { return [{ type: JwtModule, decorators: [{\n type: Optional\n }, {\n type: SkipSelf\n }] }]; } });\n\n/*\n * Public API Surface of angular-jwt\n */\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { JWT_OPTIONS, JwtHelperService, JwtInterceptor, JwtModule };\n","/*! Hammer.JS - v2.0.7 - 2016-04-22\n * http://hammerjs.github.io/\n *\n * Copyright (c) 2016 Jorik Tangelder;\n * Licensed under the MIT license */\n(function(window, document, exportName, undefined) {\n 'use strict';\n\nvar VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];\nvar TEST_ELEMENT = document.createElement('div');\n\nvar TYPE_FUNCTION = 'function';\n\nvar round = Math.round;\nvar abs = Math.abs;\nvar now = Date.now;\n\n/**\n * set a timeout with a given scope\n * @param {Function} fn\n * @param {Number} timeout\n * @param {Object} context\n * @returns {number}\n */\nfunction setTimeoutContext(fn, timeout, context) {\n return setTimeout(bindFn(fn, context), timeout);\n}\n\n/**\n * if the argument is an array, we want to execute the fn on each entry\n * if it aint an array we don't want to do a thing.\n * this is used by all the methods that accept a single and array argument.\n * @param {*|Array} arg\n * @param {String} fn\n * @param {Object} [context]\n * @returns {Boolean}\n */\nfunction invokeArrayArg(arg, fn, context) {\n if (Array.isArray(arg)) {\n each(arg, context[fn], context);\n return true;\n }\n return false;\n}\n\n/**\n * walk objects and arrays\n * @param {Object} obj\n * @param {Function} iterator\n * @param {Object} context\n */\nfunction each(obj, iterator, context) {\n var i;\n\n if (!obj) {\n return;\n }\n\n if (obj.forEach) {\n obj.forEach(iterator, context);\n } else if (obj.length !== undefined) {\n i = 0;\n while (i < obj.length) {\n iterator.call(context, obj[i], i, obj);\n i++;\n }\n } else {\n for (i in obj) {\n obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n }\n }\n}\n\n/**\n * wrap a method with a deprecation warning and stack trace\n * @param {Function} method\n * @param {String} name\n * @param {String} message\n * @returns {Function} A new function wrapping the supplied method.\n */\nfunction deprecate(method, name, message) {\n var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\\n' + message + ' AT \\n';\n return function() {\n var e = new Error('get-stack-trace');\n var stack = e && e.stack ? e.stack.replace(/^[^\\(]+?[\\n$]/gm, '')\n .replace(/^\\s+at\\s+/gm, '')\n .replace(/^Object.\\s*\\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';\n\n var log = window.console && (window.console.warn || window.console.log);\n if (log) {\n log.call(window.console, deprecationMessage, stack);\n }\n return method.apply(this, arguments);\n };\n}\n\n/**\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} target\n * @param {...Object} objects_to_assign\n * @returns {Object} target\n */\nvar assign;\nif (typeof Object.assign !== 'function') {\n assign = function assign(target) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n var output = Object(target);\n for (var index = 1; index < arguments.length; index++) {\n var source = arguments[index];\n if (source !== undefined && source !== null) {\n for (var nextKey in source) {\n if (source.hasOwnProperty(nextKey)) {\n output[nextKey] = source[nextKey];\n }\n }\n }\n }\n return output;\n };\n} else {\n assign = Object.assign;\n}\n\n/**\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} dest\n * @param {Object} src\n * @param {Boolean} [merge=false]\n * @returns {Object} dest\n */\nvar extend = deprecate(function extend(dest, src, merge) {\n var keys = Object.keys(src);\n var i = 0;\n while (i < keys.length) {\n if (!merge || (merge && dest[keys[i]] === undefined)) {\n dest[keys[i]] = src[keys[i]];\n }\n i++;\n }\n return dest;\n}, 'extend', 'Use `assign`.');\n\n/**\n * merge the values from src in the dest.\n * means that properties that exist in dest will not be overwritten by src\n * @param {Object} dest\n * @param {Object} src\n * @returns {Object} dest\n */\nvar merge = deprecate(function merge(dest, src) {\n return extend(dest, src, true);\n}, 'merge', 'Use `assign`.');\n\n/**\n * simple class inheritance\n * @param {Function} child\n * @param {Function} base\n * @param {Object} [properties]\n */\nfunction inherit(child, base, properties) {\n var baseP = base.prototype,\n childP;\n\n childP = child.prototype = Object.create(baseP);\n childP.constructor = child;\n childP._super = baseP;\n\n if (properties) {\n assign(childP, properties);\n }\n}\n\n/**\n * simple function bind\n * @param {Function} fn\n * @param {Object} context\n * @returns {Function}\n */\nfunction bindFn(fn, context) {\n return function boundFn() {\n return fn.apply(context, arguments);\n };\n}\n\n/**\n * let a boolean value also be a function that must return a boolean\n * this first item in args will be used as the context\n * @param {Boolean|Function} val\n * @param {Array} [args]\n * @returns {Boolean}\n */\nfunction boolOrFn(val, args) {\n if (typeof val == TYPE_FUNCTION) {\n return val.apply(args ? args[0] || undefined : undefined, args);\n }\n return val;\n}\n\n/**\n * use the val2 when val1 is undefined\n * @param {*} val1\n * @param {*} val2\n * @returns {*}\n */\nfunction ifUndefined(val1, val2) {\n return (val1 === undefined) ? val2 : val1;\n}\n\n/**\n * addEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\nfunction addEventListeners(target, types, handler) {\n each(splitStr(types), function(type) {\n target.addEventListener(type, handler, false);\n });\n}\n\n/**\n * removeEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\nfunction removeEventListeners(target, types, handler) {\n each(splitStr(types), function(type) {\n target.removeEventListener(type, handler, false);\n });\n}\n\n/**\n * find if a node is in the given parent\n * @method hasParent\n * @param {HTMLElement} node\n * @param {HTMLElement} parent\n * @return {Boolean} found\n */\nfunction hasParent(node, parent) {\n while (node) {\n if (node == parent) {\n return true;\n }\n node = node.parentNode;\n }\n return false;\n}\n\n/**\n * small indexOf wrapper\n * @param {String} str\n * @param {String} find\n * @returns {Boolean} found\n */\nfunction inStr(str, find) {\n return str.indexOf(find) > -1;\n}\n\n/**\n * split string on whitespace\n * @param {String} str\n * @returns {Array} words\n */\nfunction splitStr(str) {\n return str.trim().split(/\\s+/g);\n}\n\n/**\n * find if a array contains the object using indexOf or a simple polyFill\n * @param {Array} src\n * @param {String} find\n * @param {String} [findByKey]\n * @return {Boolean|Number} false when not found, or the index\n */\nfunction inArray(src, find, findByKey) {\n if (src.indexOf && !findByKey) {\n return src.indexOf(find);\n } else {\n var i = 0;\n while (i < src.length) {\n if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {\n return i;\n }\n i++;\n }\n return -1;\n }\n}\n\n/**\n * convert array-like objects to real arrays\n * @param {Object} obj\n * @returns {Array}\n */\nfunction toArray(obj) {\n return Array.prototype.slice.call(obj, 0);\n}\n\n/**\n * unique array with objects based on a key (like 'id') or just by the array's value\n * @param {Array} src [{id:1},{id:2},{id:1}]\n * @param {String} [key]\n * @param {Boolean} [sort=False]\n * @returns {Array} [{id:1},{id:2}]\n */\nfunction uniqueArray(src, key, sort) {\n var results = [];\n var values = [];\n var i = 0;\n\n while (i < src.length) {\n var val = key ? src[i][key] : src[i];\n if (inArray(values, val) < 0) {\n results.push(src[i]);\n }\n values[i] = val;\n i++;\n }\n\n if (sort) {\n if (!key) {\n results = results.sort();\n } else {\n results = results.sort(function sortUniqueArray(a, b) {\n return a[key] > b[key];\n });\n }\n }\n\n return results;\n}\n\n/**\n * get the prefixed property\n * @param {Object} obj\n * @param {String} property\n * @returns {String|Undefined} prefixed\n */\nfunction prefixed(obj, property) {\n var prefix, prop;\n var camelProp = property[0].toUpperCase() + property.slice(1);\n\n var i = 0;\n while (i < VENDOR_PREFIXES.length) {\n prefix = VENDOR_PREFIXES[i];\n prop = (prefix) ? prefix + camelProp : property;\n\n if (prop in obj) {\n return prop;\n }\n i++;\n }\n return undefined;\n}\n\n/**\n * get a unique id\n * @returns {number} uniqueId\n */\nvar _uniqueId = 1;\nfunction uniqueId() {\n return _uniqueId++;\n}\n\n/**\n * get the window object of an element\n * @param {HTMLElement} element\n * @returns {DocumentView|Window}\n */\nfunction getWindowForElement(element) {\n var doc = element.ownerDocument || element;\n return (doc.defaultView || doc.parentWindow || window);\n}\n\nvar MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\n\nvar SUPPORT_TOUCH = ('ontouchstart' in window);\nvar SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;\nvar SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\n\nvar INPUT_TYPE_TOUCH = 'touch';\nvar INPUT_TYPE_PEN = 'pen';\nvar INPUT_TYPE_MOUSE = 'mouse';\nvar INPUT_TYPE_KINECT = 'kinect';\n\nvar COMPUTE_INTERVAL = 25;\n\nvar INPUT_START = 1;\nvar INPUT_MOVE = 2;\nvar INPUT_END = 4;\nvar INPUT_CANCEL = 8;\n\nvar DIRECTION_NONE = 1;\nvar DIRECTION_LEFT = 2;\nvar DIRECTION_RIGHT = 4;\nvar DIRECTION_UP = 8;\nvar DIRECTION_DOWN = 16;\n\nvar DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\nvar DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\nvar DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\n\nvar PROPS_XY = ['x', 'y'];\nvar PROPS_CLIENT_XY = ['clientX', 'clientY'];\n\n/**\n * create new input type manager\n * @param {Manager} manager\n * @param {Function} callback\n * @returns {Input}\n * @constructor\n */\nfunction Input(manager, callback) {\n var self = this;\n this.manager = manager;\n this.callback = callback;\n this.element = manager.element;\n this.target = manager.options.inputTarget;\n\n // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n // so when disabled the input events are completely bypassed.\n this.domHandler = function(ev) {\n if (boolOrFn(manager.options.enable, [manager])) {\n self.handler(ev);\n }\n };\n\n this.init();\n\n}\n\nInput.prototype = {\n /**\n * should handle the inputEvent data and trigger the callback\n * @virtual\n */\n handler: function() { },\n\n /**\n * bind the events\n */\n init: function() {\n this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n },\n\n /**\n * unbind the events\n */\n destroy: function() {\n this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n }\n};\n\n/**\n * create new input type manager\n * called by the Manager constructor\n * @param {Hammer} manager\n * @returns {Input}\n */\nfunction createInputInstance(manager) {\n var Type;\n var inputClass = manager.options.inputClass;\n\n if (inputClass) {\n Type = inputClass;\n } else if (SUPPORT_POINTER_EVENTS) {\n Type = PointerEventInput;\n } else if (SUPPORT_ONLY_TOUCH) {\n Type = TouchInput;\n } else if (!SUPPORT_TOUCH) {\n Type = MouseInput;\n } else {\n Type = TouchMouseInput;\n }\n return new (Type)(manager, inputHandler);\n}\n\n/**\n * handle input events\n * @param {Manager} manager\n * @param {String} eventType\n * @param {Object} input\n */\nfunction inputHandler(manager, eventType, input) {\n var pointersLen = input.pointers.length;\n var changedPointersLen = input.changedPointers.length;\n var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));\n var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));\n\n input.isFirst = !!isFirst;\n input.isFinal = !!isFinal;\n\n if (isFirst) {\n manager.session = {};\n }\n\n // source event is the normalized value of the domEvents\n // like 'touchstart, mouseup, pointerdown'\n input.eventType = eventType;\n\n // compute scale, rotation etc\n computeInputData(manager, input);\n\n // emit secret event\n manager.emit('hammer.input', input);\n\n manager.recognize(input);\n manager.session.prevInput = input;\n}\n\n/**\n * extend the data with some usable properties like scale, rotate, velocity etc\n * @param {Object} manager\n * @param {Object} input\n */\nfunction computeInputData(manager, input) {\n var session = manager.session;\n var pointers = input.pointers;\n var pointersLength = pointers.length;\n\n // store the first input to calculate the distance and direction\n if (!session.firstInput) {\n session.firstInput = simpleCloneInputData(input);\n }\n\n // to compute scale and rotation we need to store the multiple touches\n if (pointersLength > 1 && !session.firstMultiple) {\n session.firstMultiple = simpleCloneInputData(input);\n } else if (pointersLength === 1) {\n session.firstMultiple = false;\n }\n\n var firstInput = session.firstInput;\n var firstMultiple = session.firstMultiple;\n var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n\n var center = input.center = getCenter(pointers);\n input.timeStamp = now();\n input.deltaTime = input.timeStamp - firstInput.timeStamp;\n\n input.angle = getAngle(offsetCenter, center);\n input.distance = getDistance(offsetCenter, center);\n\n computeDeltaXY(session, input);\n input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n\n var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);\n input.overallVelocityX = overallVelocity.x;\n input.overallVelocityY = overallVelocity.y;\n input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y;\n\n input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n\n input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length >\n session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers);\n\n computeIntervalInputData(session, input);\n\n // find the correct target\n var target = manager.element;\n if (hasParent(input.srcEvent.target, target)) {\n target = input.srcEvent.target;\n }\n input.target = target;\n}\n\nfunction computeDeltaXY(session, input) {\n var center = input.center;\n var offset = session.offsetDelta || {};\n var prevDelta = session.prevDelta || {};\n var prevInput = session.prevInput || {};\n\n if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n prevDelta = session.prevDelta = {\n x: prevInput.deltaX || 0,\n y: prevInput.deltaY || 0\n };\n\n offset = session.offsetDelta = {\n x: center.x,\n y: center.y\n };\n }\n\n input.deltaX = prevDelta.x + (center.x - offset.x);\n input.deltaY = prevDelta.y + (center.y - offset.y);\n}\n\n/**\n * velocity is calculated every x ms\n * @param {Object} session\n * @param {Object} input\n */\nfunction computeIntervalInputData(session, input) {\n var last = session.lastInterval || input,\n deltaTime = input.timeStamp - last.timeStamp,\n velocity, velocityX, velocityY, direction;\n\n if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n var deltaX = input.deltaX - last.deltaX;\n var deltaY = input.deltaY - last.deltaY;\n\n var v = getVelocity(deltaTime, deltaX, deltaY);\n velocityX = v.x;\n velocityY = v.y;\n velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;\n direction = getDirection(deltaX, deltaY);\n\n session.lastInterval = input;\n } else {\n // use latest velocity info if it doesn't overtake a minimum period\n velocity = last.velocity;\n velocityX = last.velocityX;\n velocityY = last.velocityY;\n direction = last.direction;\n }\n\n input.velocity = velocity;\n input.velocityX = velocityX;\n input.velocityY = velocityY;\n input.direction = direction;\n}\n\n/**\n * create a simple clone from the input used for storage of firstInput and firstMultiple\n * @param {Object} input\n * @returns {Object} clonedInputData\n */\nfunction simpleCloneInputData(input) {\n // make a simple copy of the pointers because we will get a reference if we don't\n // we only need clientXY for the calculations\n var pointers = [];\n var i = 0;\n while (i < input.pointers.length) {\n pointers[i] = {\n clientX: round(input.pointers[i].clientX),\n clientY: round(input.pointers[i].clientY)\n };\n i++;\n }\n\n return {\n timeStamp: now(),\n pointers: pointers,\n center: getCenter(pointers),\n deltaX: input.deltaX,\n deltaY: input.deltaY\n };\n}\n\n/**\n * get the center of all the pointers\n * @param {Array} pointers\n * @return {Object} center contains `x` and `y` properties\n */\nfunction getCenter(pointers) {\n var pointersLength = pointers.length;\n\n // no need to loop when only one touch\n if (pointersLength === 1) {\n return {\n x: round(pointers[0].clientX),\n y: round(pointers[0].clientY)\n };\n }\n\n var x = 0, y = 0, i = 0;\n while (i < pointersLength) {\n x += pointers[i].clientX;\n y += pointers[i].clientY;\n i++;\n }\n\n return {\n x: round(x / pointersLength),\n y: round(y / pointersLength)\n };\n}\n\n/**\n * calculate the velocity between two points. unit is in px per ms.\n * @param {Number} deltaTime\n * @param {Number} x\n * @param {Number} y\n * @return {Object} velocity `x` and `y`\n */\nfunction getVelocity(deltaTime, x, y) {\n return {\n x: x / deltaTime || 0,\n y: y / deltaTime || 0\n };\n}\n\n/**\n * get the direction between two points\n * @param {Number} x\n * @param {Number} y\n * @return {Number} direction\n */\nfunction getDirection(x, y) {\n if (x === y) {\n return DIRECTION_NONE;\n }\n\n if (abs(x) >= abs(y)) {\n return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n }\n return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n}\n\n/**\n * calculate the absolute distance between two points\n * @param {Object} p1 {x, y}\n * @param {Object} p2 {x, y}\n * @param {Array} [props] containing x and y keys\n * @return {Number} distance\n */\nfunction getDistance(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n var x = p2[props[0]] - p1[props[0]],\n y = p2[props[1]] - p1[props[1]];\n\n return Math.sqrt((x * x) + (y * y));\n}\n\n/**\n * calculate the angle between two coordinates\n * @param {Object} p1\n * @param {Object} p2\n * @param {Array} [props] containing x and y keys\n * @return {Number} angle\n */\nfunction getAngle(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n var x = p2[props[0]] - p1[props[0]],\n y = p2[props[1]] - p1[props[1]];\n return Math.atan2(y, x) * 180 / Math.PI;\n}\n\n/**\n * calculate the rotation degrees between two pointersets\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} rotation\n */\nfunction getRotation(start, end) {\n return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);\n}\n\n/**\n * calculate the scale factor between two pointersets\n * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} scale\n */\nfunction getScale(start, end) {\n return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n}\n\nvar MOUSE_INPUT_MAP = {\n mousedown: INPUT_START,\n mousemove: INPUT_MOVE,\n mouseup: INPUT_END\n};\n\nvar MOUSE_ELEMENT_EVENTS = 'mousedown';\nvar MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n\n/**\n * Mouse events input\n * @constructor\n * @extends Input\n */\nfunction MouseInput() {\n this.evEl = MOUSE_ELEMENT_EVENTS;\n this.evWin = MOUSE_WINDOW_EVENTS;\n\n this.pressed = false; // mousedown state\n\n Input.apply(this, arguments);\n}\n\ninherit(MouseInput, Input, {\n /**\n * handle mouse events\n * @param {Object} ev\n */\n handler: function MEhandler(ev) {\n var eventType = MOUSE_INPUT_MAP[ev.type];\n\n // on start we want to have the left mouse button down\n if (eventType & INPUT_START && ev.button === 0) {\n this.pressed = true;\n }\n\n if (eventType & INPUT_MOVE && ev.which !== 1) {\n eventType = INPUT_END;\n }\n\n // mouse must be down\n if (!this.pressed) {\n return;\n }\n\n if (eventType & INPUT_END) {\n this.pressed = false;\n }\n\n this.callback(this.manager, eventType, {\n pointers: [ev],\n changedPointers: [ev],\n pointerType: INPUT_TYPE_MOUSE,\n srcEvent: ev\n });\n }\n});\n\nvar POINTER_INPUT_MAP = {\n pointerdown: INPUT_START,\n pointermove: INPUT_MOVE,\n pointerup: INPUT_END,\n pointercancel: INPUT_CANCEL,\n pointerout: INPUT_CANCEL\n};\n\n// in IE10 the pointer types is defined as an enum\nvar IE10_POINTER_TYPE_ENUM = {\n 2: INPUT_TYPE_TOUCH,\n 3: INPUT_TYPE_PEN,\n 4: INPUT_TYPE_MOUSE,\n 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n};\n\nvar POINTER_ELEMENT_EVENTS = 'pointerdown';\nvar POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';\n\n// IE10 has prefixed support, and case-sensitive\nif (window.MSPointerEvent && !window.PointerEvent) {\n POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n}\n\n/**\n * Pointer events input\n * @constructor\n * @extends Input\n */\nfunction PointerEventInput() {\n this.evEl = POINTER_ELEMENT_EVENTS;\n this.evWin = POINTER_WINDOW_EVENTS;\n\n Input.apply(this, arguments);\n\n this.store = (this.manager.session.pointerEvents = []);\n}\n\ninherit(PointerEventInput, Input, {\n /**\n * handle mouse events\n * @param {Object} ev\n */\n handler: function PEhandler(ev) {\n var store = this.store;\n var removePointer = false;\n\n var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n\n var isTouch = (pointerType == INPUT_TYPE_TOUCH);\n\n // get index of the event in the store\n var storeIndex = inArray(store, ev.pointerId, 'pointerId');\n\n // start and mouse must be down\n if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n if (storeIndex < 0) {\n store.push(ev);\n storeIndex = store.length - 1;\n }\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n removePointer = true;\n }\n\n // it not found, so the pointer hasn't been down (so it's probably a hover)\n if (storeIndex < 0) {\n return;\n }\n\n // update the event in the store\n store[storeIndex] = ev;\n\n this.callback(this.manager, eventType, {\n pointers: store,\n changedPointers: [ev],\n pointerType: pointerType,\n srcEvent: ev\n });\n\n if (removePointer) {\n // remove from the store\n store.splice(storeIndex, 1);\n }\n }\n});\n\nvar SINGLE_TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\n\nvar SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\nvar SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n\n/**\n * Touch events input\n * @constructor\n * @extends Input\n */\nfunction SingleTouchInput() {\n this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n this.started = false;\n\n Input.apply(this, arguments);\n}\n\ninherit(SingleTouchInput, Input, {\n handler: function TEhandler(ev) {\n var type = SINGLE_TOUCH_INPUT_MAP[ev.type];\n\n // should we handle the touch events?\n if (type === INPUT_START) {\n this.started = true;\n }\n\n if (!this.started) {\n return;\n }\n\n var touches = normalizeSingleTouches.call(this, ev, type);\n\n // when done, reset the started state\n if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n this.started = false;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n }\n});\n\n/**\n * @this {TouchInput}\n * @param {Object} ev\n * @param {Number} type flag\n * @returns {undefined|Array} [all, changed]\n */\nfunction normalizeSingleTouches(ev, type) {\n var all = toArray(ev.touches);\n var changed = toArray(ev.changedTouches);\n\n if (type & (INPUT_END | INPUT_CANCEL)) {\n all = uniqueArray(all.concat(changed), 'identifier', true);\n }\n\n return [all, changed];\n}\n\nvar TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\n\nvar TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n\n/**\n * Multi-user touch events input\n * @constructor\n * @extends Input\n */\nfunction TouchInput() {\n this.evTarget = TOUCH_TARGET_EVENTS;\n this.targetIds = {};\n\n Input.apply(this, arguments);\n}\n\ninherit(TouchInput, Input, {\n handler: function MTEhandler(ev) {\n var type = TOUCH_INPUT_MAP[ev.type];\n var touches = getTouches.call(this, ev, type);\n if (!touches) {\n return;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n }\n});\n\n/**\n * @this {TouchInput}\n * @param {Object} ev\n * @param {Number} type flag\n * @returns {undefined|Array} [all, changed]\n */\nfunction getTouches(ev, type) {\n var allTouches = toArray(ev.touches);\n var targetIds = this.targetIds;\n\n // when there is only one touch, the process can be simplified\n if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n targetIds[allTouches[0].identifier] = true;\n return [allTouches, allTouches];\n }\n\n var i,\n targetTouches,\n changedTouches = toArray(ev.changedTouches),\n changedTargetTouches = [],\n target = this.target;\n\n // get target touches from touches\n targetTouches = allTouches.filter(function(touch) {\n return hasParent(touch.target, target);\n });\n\n // collect touches\n if (type === INPUT_START) {\n i = 0;\n while (i < targetTouches.length) {\n targetIds[targetTouches[i].identifier] = true;\n i++;\n }\n }\n\n // filter changed touches to only contain touches that exist in the collected target ids\n i = 0;\n while (i < changedTouches.length) {\n if (targetIds[changedTouches[i].identifier]) {\n changedTargetTouches.push(changedTouches[i]);\n }\n\n // cleanup removed touches\n if (type & (INPUT_END | INPUT_CANCEL)) {\n delete targetIds[changedTouches[i].identifier];\n }\n i++;\n }\n\n if (!changedTargetTouches.length) {\n return;\n }\n\n return [\n // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),\n changedTargetTouches\n ];\n}\n\n/**\n * Combined touch and mouse input\n *\n * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n * This because touch devices also emit mouse events while doing a touch.\n *\n * @constructor\n * @extends Input\n */\n\nvar DEDUP_TIMEOUT = 2500;\nvar DEDUP_DISTANCE = 25;\n\nfunction TouchMouseInput() {\n Input.apply(this, arguments);\n\n var handler = bindFn(this.handler, this);\n this.touch = new TouchInput(this.manager, handler);\n this.mouse = new MouseInput(this.manager, handler);\n\n this.primaryTouch = null;\n this.lastTouches = [];\n}\n\ninherit(TouchMouseInput, Input, {\n /**\n * handle mouse and touch events\n * @param {Hammer} manager\n * @param {String} inputEvent\n * @param {Object} inputData\n */\n handler: function TMEhandler(manager, inputEvent, inputData) {\n var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH),\n isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);\n\n if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {\n return;\n }\n\n // when we're in a touch event, record touches to de-dupe synthetic mouse event\n if (isTouch) {\n recordTouches.call(this, inputEvent, inputData);\n } else if (isMouse && isSyntheticEvent.call(this, inputData)) {\n return;\n }\n\n this.callback(manager, inputEvent, inputData);\n },\n\n /**\n * remove the event listeners\n */\n destroy: function destroy() {\n this.touch.destroy();\n this.mouse.destroy();\n }\n});\n\nfunction recordTouches(eventType, eventData) {\n if (eventType & INPUT_START) {\n this.primaryTouch = eventData.changedPointers[0].identifier;\n setLastTouch.call(this, eventData);\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n setLastTouch.call(this, eventData);\n }\n}\n\nfunction setLastTouch(eventData) {\n var touch = eventData.changedPointers[0];\n\n if (touch.identifier === this.primaryTouch) {\n var lastTouch = {x: touch.clientX, y: touch.clientY};\n this.lastTouches.push(lastTouch);\n var lts = this.lastTouches;\n var removeLastTouch = function() {\n var i = lts.indexOf(lastTouch);\n if (i > -1) {\n lts.splice(i, 1);\n }\n };\n setTimeout(removeLastTouch, DEDUP_TIMEOUT);\n }\n}\n\nfunction isSyntheticEvent(eventData) {\n var x = eventData.srcEvent.clientX, y = eventData.srcEvent.clientY;\n for (var i = 0; i < this.lastTouches.length; i++) {\n var t = this.lastTouches[i];\n var dx = Math.abs(x - t.x), dy = Math.abs(y - t.y);\n if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {\n return true;\n }\n }\n return false;\n}\n\nvar PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\nvar NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\n\n// magical touchAction value\nvar TOUCH_ACTION_COMPUTE = 'compute';\nvar TOUCH_ACTION_AUTO = 'auto';\nvar TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\nvar TOUCH_ACTION_NONE = 'none';\nvar TOUCH_ACTION_PAN_X = 'pan-x';\nvar TOUCH_ACTION_PAN_Y = 'pan-y';\nvar TOUCH_ACTION_MAP = getTouchActionProps();\n\n/**\n * Touch Action\n * sets the touchAction property or uses the js alternative\n * @param {Manager} manager\n * @param {String} value\n * @constructor\n */\nfunction TouchAction(manager, value) {\n this.manager = manager;\n this.set(value);\n}\n\nTouchAction.prototype = {\n /**\n * set the touchAction value on the element or enable the polyfill\n * @param {String} value\n */\n set: function(value) {\n // find out the touch-action by the event handlers\n if (value == TOUCH_ACTION_COMPUTE) {\n value = this.compute();\n }\n\n if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {\n this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n }\n this.actions = value.toLowerCase().trim();\n },\n\n /**\n * just re-set the touchAction value\n */\n update: function() {\n this.set(this.manager.options.touchAction);\n },\n\n /**\n * compute the value for the touchAction property based on the recognizer's settings\n * @returns {String} value\n */\n compute: function() {\n var actions = [];\n each(this.manager.recognizers, function(recognizer) {\n if (boolOrFn(recognizer.options.enable, [recognizer])) {\n actions = actions.concat(recognizer.getTouchAction());\n }\n });\n return cleanTouchActions(actions.join(' '));\n },\n\n /**\n * this method is called on each input cycle and provides the preventing of the browser behavior\n * @param {Object} input\n */\n preventDefaults: function(input) {\n var srcEvent = input.srcEvent;\n var direction = input.offsetDirection;\n\n // if the touch action did prevented once this session\n if (this.manager.session.prevented) {\n srcEvent.preventDefault();\n return;\n }\n\n var actions = this.actions;\n var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];\n\n if (hasNone) {\n //do not prevent defaults if this is a tap gesture\n\n var isTapPointer = input.pointers.length === 1;\n var isTapMovement = input.distance < 2;\n var isTapTouchTime = input.deltaTime < 250;\n\n if (isTapPointer && isTapMovement && isTapTouchTime) {\n return;\n }\n }\n\n if (hasPanX && hasPanY) {\n // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n return;\n }\n\n if (hasNone ||\n (hasPanY && direction & DIRECTION_HORIZONTAL) ||\n (hasPanX && direction & DIRECTION_VERTICAL)) {\n return this.preventSrc(srcEvent);\n }\n },\n\n /**\n * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n * @param {Object} srcEvent\n */\n preventSrc: function(srcEvent) {\n this.manager.session.prevented = true;\n srcEvent.preventDefault();\n }\n};\n\n/**\n * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n * @param {String} actions\n * @returns {*}\n */\nfunction cleanTouchActions(actions) {\n // none\n if (inStr(actions, TOUCH_ACTION_NONE)) {\n return TOUCH_ACTION_NONE;\n }\n\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n\n // if both pan-x and pan-y are set (different recognizers\n // for different directions, e.g. horizontal pan but vertical swipe?)\n // we need none (as otherwise with pan-x pan-y combined none of these\n // recognizers will work, since the browser would handle all panning\n if (hasPanX && hasPanY) {\n return TOUCH_ACTION_NONE;\n }\n\n // pan-x OR pan-y\n if (hasPanX || hasPanY) {\n return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n }\n\n // manipulation\n if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n return TOUCH_ACTION_MANIPULATION;\n }\n\n return TOUCH_ACTION_AUTO;\n}\n\nfunction getTouchActionProps() {\n if (!NATIVE_TOUCH_ACTION) {\n return false;\n }\n var touchMap = {};\n var cssSupports = window.CSS && window.CSS.supports;\n ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function(val) {\n\n // If css.supports is not supported but there is native touch-action assume it supports\n // all values. This is the case for IE 10 and 11.\n touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true;\n });\n return touchMap;\n}\n\n/**\n * Recognizer flow explained; *\n * All recognizers have the initial state of POSSIBLE when a input session starts.\n * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n * Example session for mouse-input: mousedown -> mousemove -> mouseup\n *\n * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n * which determines with state it should be.\n *\n * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n * POSSIBLE to give it another change on the next cycle.\n *\n * Possible\n * |\n * +-----+---------------+\n * | |\n * +-----+-----+ |\n * | | |\n * Failed Cancelled |\n * +-------+------+\n * | |\n * Recognized Began\n * |\n * Changed\n * |\n * Ended/Recognized\n */\nvar STATE_POSSIBLE = 1;\nvar STATE_BEGAN = 2;\nvar STATE_CHANGED = 4;\nvar STATE_ENDED = 8;\nvar STATE_RECOGNIZED = STATE_ENDED;\nvar STATE_CANCELLED = 16;\nvar STATE_FAILED = 32;\n\n/**\n * Recognizer\n * Every recognizer needs to extend from this class.\n * @constructor\n * @param {Object} options\n */\nfunction Recognizer(options) {\n this.options = assign({}, this.defaults, options || {});\n\n this.id = uniqueId();\n\n this.manager = null;\n\n // default is enable true\n this.options.enable = ifUndefined(this.options.enable, true);\n\n this.state = STATE_POSSIBLE;\n\n this.simultaneous = {};\n this.requireFail = [];\n}\n\nRecognizer.prototype = {\n /**\n * @virtual\n * @type {Object}\n */\n defaults: {},\n\n /**\n * set options\n * @param {Object} options\n * @return {Recognizer}\n */\n set: function(options) {\n assign(this.options, options);\n\n // also update the touchAction, in case something changed about the directions/enabled state\n this.manager && this.manager.touchAction.update();\n return this;\n },\n\n /**\n * recognize simultaneous with an other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n recognizeWith: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n return this;\n }\n\n var simultaneous = this.simultaneous;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n if (!simultaneous[otherRecognizer.id]) {\n simultaneous[otherRecognizer.id] = otherRecognizer;\n otherRecognizer.recognizeWith(this);\n }\n return this;\n },\n\n /**\n * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n dropRecognizeWith: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n delete this.simultaneous[otherRecognizer.id];\n return this;\n },\n\n /**\n * recognizer can only run when an other is failing\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n requireFailure: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n return this;\n }\n\n var requireFail = this.requireFail;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n if (inArray(requireFail, otherRecognizer) === -1) {\n requireFail.push(otherRecognizer);\n otherRecognizer.requireFailure(this);\n }\n return this;\n },\n\n /**\n * drop the requireFailure link. it does not remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n dropRequireFailure: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n var index = inArray(this.requireFail, otherRecognizer);\n if (index > -1) {\n this.requireFail.splice(index, 1);\n }\n return this;\n },\n\n /**\n * has require failures boolean\n * @returns {boolean}\n */\n hasRequireFailures: function() {\n return this.requireFail.length > 0;\n },\n\n /**\n * if the recognizer can recognize simultaneous with an other recognizer\n * @param {Recognizer} otherRecognizer\n * @returns {Boolean}\n */\n canRecognizeWith: function(otherRecognizer) {\n return !!this.simultaneous[otherRecognizer.id];\n },\n\n /**\n * You should use `tryEmit` instead of `emit` directly to check\n * that all the needed recognizers has failed before emitting.\n * @param {Object} input\n */\n emit: function(input) {\n var self = this;\n var state = this.state;\n\n function emit(event) {\n self.manager.emit(event, input);\n }\n\n // 'panstart' and 'panmove'\n if (state < STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n\n emit(self.options.event); // simple 'eventName' events\n\n if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...)\n emit(input.additionalEvent);\n }\n\n // panend and pancancel\n if (state >= STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n },\n\n /**\n * Check that all the require failure recognizers has failed,\n * if true, it emits a gesture event,\n * otherwise, setup the state to FAILED.\n * @param {Object} input\n */\n tryEmit: function(input) {\n if (this.canEmit()) {\n return this.emit(input);\n }\n // it's failing anyway\n this.state = STATE_FAILED;\n },\n\n /**\n * can we emit?\n * @returns {boolean}\n */\n canEmit: function() {\n var i = 0;\n while (i < this.requireFail.length) {\n if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n return false;\n }\n i++;\n }\n return true;\n },\n\n /**\n * update the recognizer\n * @param {Object} inputData\n */\n recognize: function(inputData) {\n // make a new copy of the inputData\n // so we can change the inputData without messing up the other recognizers\n var inputDataClone = assign({}, inputData);\n\n // is is enabled and allow recognizing?\n if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n this.reset();\n this.state = STATE_FAILED;\n return;\n }\n\n // reset when we've reached the end\n if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n this.state = STATE_POSSIBLE;\n }\n\n this.state = this.process(inputDataClone);\n\n // the recognizer has recognized a gesture\n // so trigger an event\n if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n this.tryEmit(inputDataClone);\n }\n },\n\n /**\n * return the state of the recognizer\n * the actual recognizing happens in this method\n * @virtual\n * @param {Object} inputData\n * @returns {Const} STATE\n */\n process: function(inputData) { }, // jshint ignore:line\n\n /**\n * return the preferred touch-action\n * @virtual\n * @returns {Array}\n */\n getTouchAction: function() { },\n\n /**\n * called when the gesture isn't allowed to recognize\n * like when another is being recognized or it is disabled\n * @virtual\n */\n reset: function() { }\n};\n\n/**\n * get a usable string, used as event postfix\n * @param {Const} state\n * @returns {String} state\n */\nfunction stateStr(state) {\n if (state & STATE_CANCELLED) {\n return 'cancel';\n } else if (state & STATE_ENDED) {\n return 'end';\n } else if (state & STATE_CHANGED) {\n return 'move';\n } else if (state & STATE_BEGAN) {\n return 'start';\n }\n return '';\n}\n\n/**\n * direction cons to string\n * @param {Const} direction\n * @returns {String}\n */\nfunction directionStr(direction) {\n if (direction == DIRECTION_DOWN) {\n return 'down';\n } else if (direction == DIRECTION_UP) {\n return 'up';\n } else if (direction == DIRECTION_LEFT) {\n return 'left';\n } else if (direction == DIRECTION_RIGHT) {\n return 'right';\n }\n return '';\n}\n\n/**\n * get a recognizer by name if it is bound to a manager\n * @param {Recognizer|String} otherRecognizer\n * @param {Recognizer} recognizer\n * @returns {Recognizer}\n */\nfunction getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n var manager = recognizer.manager;\n if (manager) {\n return manager.get(otherRecognizer);\n }\n return otherRecognizer;\n}\n\n/**\n * This recognizer is just used as a base for the simple attribute recognizers.\n * @constructor\n * @extends Recognizer\n */\nfunction AttrRecognizer() {\n Recognizer.apply(this, arguments);\n}\n\ninherit(AttrRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof AttrRecognizer\n */\n defaults: {\n /**\n * @type {Number}\n * @default 1\n */\n pointers: 1\n },\n\n /**\n * Used to check if it the recognizer receives valid input, like input.distance > 10.\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {Boolean} recognized\n */\n attrTest: function(input) {\n var optionPointers = this.options.pointers;\n return optionPointers === 0 || input.pointers.length === optionPointers;\n },\n\n /**\n * Process the input and return the state for the recognizer\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {*} State\n */\n process: function(input) {\n var state = this.state;\n var eventType = input.eventType;\n\n var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n var isValid = this.attrTest(input);\n\n // on cancel input and we've recognized before, return STATE_CANCELLED\n if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n return state | STATE_CANCELLED;\n } else if (isRecognized || isValid) {\n if (eventType & INPUT_END) {\n return state | STATE_ENDED;\n } else if (!(state & STATE_BEGAN)) {\n return STATE_BEGAN;\n }\n return state | STATE_CHANGED;\n }\n return STATE_FAILED;\n }\n});\n\n/**\n * Pan\n * Recognized when the pointer is down and moved in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\nfunction PanRecognizer() {\n AttrRecognizer.apply(this, arguments);\n\n this.pX = null;\n this.pY = null;\n}\n\ninherit(PanRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof PanRecognizer\n */\n defaults: {\n event: 'pan',\n threshold: 10,\n pointers: 1,\n direction: DIRECTION_ALL\n },\n\n getTouchAction: function() {\n var direction = this.options.direction;\n var actions = [];\n if (direction & DIRECTION_HORIZONTAL) {\n actions.push(TOUCH_ACTION_PAN_Y);\n }\n if (direction & DIRECTION_VERTICAL) {\n actions.push(TOUCH_ACTION_PAN_X);\n }\n return actions;\n },\n\n directionTest: function(input) {\n var options = this.options;\n var hasMoved = true;\n var distance = input.distance;\n var direction = input.direction;\n var x = input.deltaX;\n var y = input.deltaY;\n\n // lock to axis?\n if (!(direction & options.direction)) {\n if (options.direction & DIRECTION_HORIZONTAL) {\n direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;\n hasMoved = x != this.pX;\n distance = Math.abs(input.deltaX);\n } else {\n direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;\n hasMoved = y != this.pY;\n distance = Math.abs(input.deltaY);\n }\n }\n input.direction = direction;\n return hasMoved && distance > options.threshold && direction & options.direction;\n },\n\n attrTest: function(input) {\n return AttrRecognizer.prototype.attrTest.call(this, input) &&\n (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));\n },\n\n emit: function(input) {\n\n this.pX = input.deltaX;\n this.pY = input.deltaY;\n\n var direction = directionStr(input.direction);\n\n if (direction) {\n input.additionalEvent = this.options.event + direction;\n }\n this._super.emit.call(this, input);\n }\n});\n\n/**\n * Pinch\n * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * @constructor\n * @extends AttrRecognizer\n */\nfunction PinchRecognizer() {\n AttrRecognizer.apply(this, arguments);\n}\n\ninherit(PinchRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof PinchRecognizer\n */\n defaults: {\n event: 'pinch',\n threshold: 0,\n pointers: 2\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_NONE];\n },\n\n attrTest: function(input) {\n return this._super.attrTest.call(this, input) &&\n (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n },\n\n emit: function(input) {\n if (input.scale !== 1) {\n var inOut = input.scale < 1 ? 'in' : 'out';\n input.additionalEvent = this.options.event + inOut;\n }\n this._super.emit.call(this, input);\n }\n});\n\n/**\n * Press\n * Recognized when the pointer is down for x ms without any movement.\n * @constructor\n * @extends Recognizer\n */\nfunction PressRecognizer() {\n Recognizer.apply(this, arguments);\n\n this._timer = null;\n this._input = null;\n}\n\ninherit(PressRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof PressRecognizer\n */\n defaults: {\n event: 'press',\n pointers: 1,\n time: 251, // minimal time of the pointer to be pressed\n threshold: 9 // a minimal movement is ok, but keep it low\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_AUTO];\n },\n\n process: function(input) {\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTime = input.deltaTime > options.time;\n\n this._input = input;\n\n // we only allow little movement\n // and we've reached an end event, so a tap is possible\n if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {\n this.reset();\n } else if (input.eventType & INPUT_START) {\n this.reset();\n this._timer = setTimeoutContext(function() {\n this.state = STATE_RECOGNIZED;\n this.tryEmit();\n }, options.time, this);\n } else if (input.eventType & INPUT_END) {\n return STATE_RECOGNIZED;\n }\n return STATE_FAILED;\n },\n\n reset: function() {\n clearTimeout(this._timer);\n },\n\n emit: function(input) {\n if (this.state !== STATE_RECOGNIZED) {\n return;\n }\n\n if (input && (input.eventType & INPUT_END)) {\n this.manager.emit(this.options.event + 'up', input);\n } else {\n this._input.timeStamp = now();\n this.manager.emit(this.options.event, this._input);\n }\n }\n});\n\n/**\n * Rotate\n * Recognized when two or more pointer are moving in a circular motion.\n * @constructor\n * @extends AttrRecognizer\n */\nfunction RotateRecognizer() {\n AttrRecognizer.apply(this, arguments);\n}\n\ninherit(RotateRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof RotateRecognizer\n */\n defaults: {\n event: 'rotate',\n threshold: 0,\n pointers: 2\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_NONE];\n },\n\n attrTest: function(input) {\n return this._super.attrTest.call(this, input) &&\n (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n }\n});\n\n/**\n * Swipe\n * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\nfunction SwipeRecognizer() {\n AttrRecognizer.apply(this, arguments);\n}\n\ninherit(SwipeRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof SwipeRecognizer\n */\n defaults: {\n event: 'swipe',\n threshold: 10,\n velocity: 0.3,\n direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n pointers: 1\n },\n\n getTouchAction: function() {\n return PanRecognizer.prototype.getTouchAction.call(this);\n },\n\n attrTest: function(input) {\n var direction = this.options.direction;\n var velocity;\n\n if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n velocity = input.overallVelocity;\n } else if (direction & DIRECTION_HORIZONTAL) {\n velocity = input.overallVelocityX;\n } else if (direction & DIRECTION_VERTICAL) {\n velocity = input.overallVelocityY;\n }\n\n return this._super.attrTest.call(this, input) &&\n direction & input.offsetDirection &&\n input.distance > this.options.threshold &&\n input.maxPointers == this.options.pointers &&\n abs(velocity) > this.options.velocity && input.eventType & INPUT_END;\n },\n\n emit: function(input) {\n var direction = directionStr(input.offsetDirection);\n if (direction) {\n this.manager.emit(this.options.event + direction, input);\n }\n\n this.manager.emit(this.options.event, input);\n }\n});\n\n/**\n * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n * a single tap.\n *\n * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n * multi-taps being recognized.\n * @constructor\n * @extends Recognizer\n */\nfunction TapRecognizer() {\n Recognizer.apply(this, arguments);\n\n // previous time and center,\n // used for tap counting\n this.pTime = false;\n this.pCenter = false;\n\n this._timer = null;\n this._input = null;\n this.count = 0;\n}\n\ninherit(TapRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof PinchRecognizer\n */\n defaults: {\n event: 'tap',\n pointers: 1,\n taps: 1,\n interval: 300, // max time between the multi-tap taps\n time: 250, // max time of the pointer to be down (like finger on the screen)\n threshold: 9, // a minimal movement is ok, but keep it low\n posThreshold: 10 // a multi-tap can be a bit off the initial position\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_MANIPULATION];\n },\n\n process: function(input) {\n var options = this.options;\n\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTouchTime = input.deltaTime < options.time;\n\n this.reset();\n\n if ((input.eventType & INPUT_START) && (this.count === 0)) {\n return this.failTimeout();\n }\n\n // we only allow little movement\n // and we've reached an end event, so a tap is possible\n if (validMovement && validTouchTime && validPointers) {\n if (input.eventType != INPUT_END) {\n return this.failTimeout();\n }\n\n var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;\n var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n\n this.pTime = input.timeStamp;\n this.pCenter = input.center;\n\n if (!validMultiTap || !validInterval) {\n this.count = 1;\n } else {\n this.count += 1;\n }\n\n this._input = input;\n\n // if tap count matches we have recognized it,\n // else it has began recognizing...\n var tapCount = this.count % options.taps;\n if (tapCount === 0) {\n // no failing requirements, immediately trigger the tap event\n // or wait as long as the multitap interval to trigger\n if (!this.hasRequireFailures()) {\n return STATE_RECOGNIZED;\n } else {\n this._timer = setTimeoutContext(function() {\n this.state = STATE_RECOGNIZED;\n this.tryEmit();\n }, options.interval, this);\n return STATE_BEGAN;\n }\n }\n }\n return STATE_FAILED;\n },\n\n failTimeout: function() {\n this._timer = setTimeoutContext(function() {\n this.state = STATE_FAILED;\n }, this.options.interval, this);\n return STATE_FAILED;\n },\n\n reset: function() {\n clearTimeout(this._timer);\n },\n\n emit: function() {\n if (this.state == STATE_RECOGNIZED) {\n this._input.tapCount = this.count;\n this.manager.emit(this.options.event, this._input);\n }\n }\n});\n\n/**\n * Simple way to create a manager with a default set of recognizers.\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\nfunction Hammer(element, options) {\n options = options || {};\n options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);\n return new Manager(element, options);\n}\n\n/**\n * @const {string}\n */\nHammer.VERSION = '2.0.7';\n\n/**\n * default settings\n * @namespace\n */\nHammer.defaults = {\n /**\n * set if DOM events are being triggered.\n * But this is slower and unused by simple implementations, so disabled by default.\n * @type {Boolean}\n * @default false\n */\n domEvents: false,\n\n /**\n * The value for the touchAction property/fallback.\n * When set to `compute` it will magically set the correct value based on the added recognizers.\n * @type {String}\n * @default compute\n */\n touchAction: TOUCH_ACTION_COMPUTE,\n\n /**\n * @type {Boolean}\n * @default true\n */\n enable: true,\n\n /**\n * EXPERIMENTAL FEATURE -- can be removed/changed\n * Change the parent input target element.\n * If Null, then it is being set the to main element.\n * @type {Null|EventTarget}\n * @default null\n */\n inputTarget: null,\n\n /**\n * force an input class\n * @type {Null|Function}\n * @default null\n */\n inputClass: null,\n\n /**\n * Default recognizer setup when calling `Hammer()`\n * When creating a new Manager these will be skipped.\n * @type {Array}\n */\n preset: [\n // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]\n [RotateRecognizer, {enable: false}],\n [PinchRecognizer, {enable: false}, ['rotate']],\n [SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}],\n [PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']],\n [TapRecognizer],\n [TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']],\n [PressRecognizer]\n ],\n\n /**\n * Some CSS properties can be used to improve the working of Hammer.\n * Add them to this method and they will be set when creating a new Manager.\n * @namespace\n */\n cssProps: {\n /**\n * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userSelect: 'none',\n\n /**\n * Disable the Windows Phone grippers when pressing an element.\n * @type {String}\n * @default 'none'\n */\n touchSelect: 'none',\n\n /**\n * Disables the default callout shown when you touch and hold a touch target.\n * On iOS, when you touch and hold a touch target such as a link, Safari displays\n * a callout containing information about the link. This property allows you to disable that callout.\n * @type {String}\n * @default 'none'\n */\n touchCallout: 'none',\n\n /**\n * Specifies whether zooming is enabled. Used by IE10>\n * @type {String}\n * @default 'none'\n */\n contentZooming: 'none',\n\n /**\n * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userDrag: 'none',\n\n /**\n * Overrides the highlight color shown when the user taps a link or a JavaScript\n * clickable element in iOS. This property obeys the alpha value, if specified.\n * @type {String}\n * @default 'rgba(0,0,0,0)'\n */\n tapHighlightColor: 'rgba(0,0,0,0)'\n }\n};\n\nvar STOP = 1;\nvar FORCED_STOP = 2;\n\n/**\n * Manager\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\nfunction Manager(element, options) {\n this.options = assign({}, Hammer.defaults, options || {});\n\n this.options.inputTarget = this.options.inputTarget || element;\n\n this.handlers = {};\n this.session = {};\n this.recognizers = [];\n this.oldCssProps = {};\n\n this.element = element;\n this.input = createInputInstance(this);\n this.touchAction = new TouchAction(this, this.options.touchAction);\n\n toggleCssProps(this, true);\n\n each(this.options.recognizers, function(item) {\n var recognizer = this.add(new (item[0])(item[1]));\n item[2] && recognizer.recognizeWith(item[2]);\n item[3] && recognizer.requireFailure(item[3]);\n }, this);\n}\n\nManager.prototype = {\n /**\n * set options\n * @param {Object} options\n * @returns {Manager}\n */\n set: function(options) {\n assign(this.options, options);\n\n // Options that need a little more setup\n if (options.touchAction) {\n this.touchAction.update();\n }\n if (options.inputTarget) {\n // Clean up existing event listeners and reinitialize\n this.input.destroy();\n this.input.target = options.inputTarget;\n this.input.init();\n }\n return this;\n },\n\n /**\n * stop recognizing for this session.\n * This session will be discarded, when a new [input]start event is fired.\n * When forced, the recognizer cycle is stopped immediately.\n * @param {Boolean} [force]\n */\n stop: function(force) {\n this.session.stopped = force ? FORCED_STOP : STOP;\n },\n\n /**\n * run the recognizers!\n * called by the inputHandler function on every movement of the pointers (touches)\n * it walks through all the recognizers and tries to detect the gesture that is being made\n * @param {Object} inputData\n */\n recognize: function(inputData) {\n var session = this.session;\n if (session.stopped) {\n return;\n }\n\n // run the touch-action polyfill\n this.touchAction.preventDefaults(inputData);\n\n var recognizer;\n var recognizers = this.recognizers;\n\n // this holds the recognizer that is being recognized.\n // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n // if no recognizer is detecting a thing, it is set to `null`\n var curRecognizer = session.curRecognizer;\n\n // reset when the last recognizer is recognized\n // or when we're in a new session\n if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {\n curRecognizer = session.curRecognizer = null;\n }\n\n var i = 0;\n while (i < recognizers.length) {\n recognizer = recognizers[i];\n\n // find out if we are allowed try to recognize the input for this one.\n // 1. allow if the session is NOT forced stopped (see the .stop() method)\n // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n // that is being recognized.\n // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n // this can be setup with the `recognizeWith()` method on the recognizer.\n if (session.stopped !== FORCED_STOP && ( // 1\n !curRecognizer || recognizer == curRecognizer || // 2\n recognizer.canRecognizeWith(curRecognizer))) { // 3\n recognizer.recognize(inputData);\n } else {\n recognizer.reset();\n }\n\n // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n // current active recognizer. but only if we don't already have an active recognizer\n if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n curRecognizer = session.curRecognizer = recognizer;\n }\n i++;\n }\n },\n\n /**\n * get a recognizer by its event name.\n * @param {Recognizer|String} recognizer\n * @returns {Recognizer|Null}\n */\n get: function(recognizer) {\n if (recognizer instanceof Recognizer) {\n return recognizer;\n }\n\n var recognizers = this.recognizers;\n for (var i = 0; i < recognizers.length; i++) {\n if (recognizers[i].options.event == recognizer) {\n return recognizers[i];\n }\n }\n return null;\n },\n\n /**\n * add a recognizer to the manager\n * existing recognizers with the same event name will be removed\n * @param {Recognizer} recognizer\n * @returns {Recognizer|Manager}\n */\n add: function(recognizer) {\n if (invokeArrayArg(recognizer, 'add', this)) {\n return this;\n }\n\n // remove existing\n var existing = this.get(recognizer.options.event);\n if (existing) {\n this.remove(existing);\n }\n\n this.recognizers.push(recognizer);\n recognizer.manager = this;\n\n this.touchAction.update();\n return recognizer;\n },\n\n /**\n * remove a recognizer by name or instance\n * @param {Recognizer|String} recognizer\n * @returns {Manager}\n */\n remove: function(recognizer) {\n if (invokeArrayArg(recognizer, 'remove', this)) {\n return this;\n }\n\n recognizer = this.get(recognizer);\n\n // let's make sure this recognizer exists\n if (recognizer) {\n var recognizers = this.recognizers;\n var index = inArray(recognizers, recognizer);\n\n if (index !== -1) {\n recognizers.splice(index, 1);\n this.touchAction.update();\n }\n }\n\n return this;\n },\n\n /**\n * bind event\n * @param {String} events\n * @param {Function} handler\n * @returns {EventEmitter} this\n */\n on: function(events, handler) {\n if (events === undefined) {\n return;\n }\n if (handler === undefined) {\n return;\n }\n\n var handlers = this.handlers;\n each(splitStr(events), function(event) {\n handlers[event] = handlers[event] || [];\n handlers[event].push(handler);\n });\n return this;\n },\n\n /**\n * unbind event, leave emit blank to remove all handlers\n * @param {String} events\n * @param {Function} [handler]\n * @returns {EventEmitter} this\n */\n off: function(events, handler) {\n if (events === undefined) {\n return;\n }\n\n var handlers = this.handlers;\n each(splitStr(events), function(event) {\n if (!handler) {\n delete handlers[event];\n } else {\n handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);\n }\n });\n return this;\n },\n\n /**\n * emit event to the listeners\n * @param {String} event\n * @param {Object} data\n */\n emit: function(event, data) {\n // we also want to trigger dom events\n if (this.options.domEvents) {\n triggerDomEvent(event, data);\n }\n\n // no handlers, so skip it all\n var handlers = this.handlers[event] && this.handlers[event].slice();\n if (!handlers || !handlers.length) {\n return;\n }\n\n data.type = event;\n data.preventDefault = function() {\n data.srcEvent.preventDefault();\n };\n\n var i = 0;\n while (i < handlers.length) {\n handlers[i](data);\n i++;\n }\n },\n\n /**\n * destroy the manager and unbinds all events\n * it doesn't unbind dom events, that is the user own responsibility\n */\n destroy: function() {\n this.element && toggleCssProps(this, false);\n\n this.handlers = {};\n this.session = {};\n this.input.destroy();\n this.element = null;\n }\n};\n\n/**\n * add/remove the css properties as defined in manager.options.cssProps\n * @param {Manager} manager\n * @param {Boolean} add\n */\nfunction toggleCssProps(manager, add) {\n var element = manager.element;\n if (!element.style) {\n return;\n }\n var prop;\n each(manager.options.cssProps, function(value, name) {\n prop = prefixed(element.style, name);\n if (add) {\n manager.oldCssProps[prop] = element.style[prop];\n element.style[prop] = value;\n } else {\n element.style[prop] = manager.oldCssProps[prop] || '';\n }\n });\n if (!add) {\n manager.oldCssProps = {};\n }\n}\n\n/**\n * trigger dom event\n * @param {String} event\n * @param {Object} data\n */\nfunction triggerDomEvent(event, data) {\n var gestureEvent = document.createEvent('Event');\n gestureEvent.initEvent(event, true, true);\n gestureEvent.gesture = data;\n data.target.dispatchEvent(gestureEvent);\n}\n\nassign(Hammer, {\n INPUT_START: INPUT_START,\n INPUT_MOVE: INPUT_MOVE,\n INPUT_END: INPUT_END,\n INPUT_CANCEL: INPUT_CANCEL,\n\n STATE_POSSIBLE: STATE_POSSIBLE,\n STATE_BEGAN: STATE_BEGAN,\n STATE_CHANGED: STATE_CHANGED,\n STATE_ENDED: STATE_ENDED,\n STATE_RECOGNIZED: STATE_RECOGNIZED,\n STATE_CANCELLED: STATE_CANCELLED,\n STATE_FAILED: STATE_FAILED,\n\n DIRECTION_NONE: DIRECTION_NONE,\n DIRECTION_LEFT: DIRECTION_LEFT,\n DIRECTION_RIGHT: DIRECTION_RIGHT,\n DIRECTION_UP: DIRECTION_UP,\n DIRECTION_DOWN: DIRECTION_DOWN,\n DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,\n DIRECTION_VERTICAL: DIRECTION_VERTICAL,\n DIRECTION_ALL: DIRECTION_ALL,\n\n Manager: Manager,\n Input: Input,\n TouchAction: TouchAction,\n\n TouchInput: TouchInput,\n MouseInput: MouseInput,\n PointerEventInput: PointerEventInput,\n TouchMouseInput: TouchMouseInput,\n SingleTouchInput: SingleTouchInput,\n\n Recognizer: Recognizer,\n AttrRecognizer: AttrRecognizer,\n Tap: TapRecognizer,\n Pan: PanRecognizer,\n Swipe: SwipeRecognizer,\n Pinch: PinchRecognizer,\n Rotate: RotateRecognizer,\n Press: PressRecognizer,\n\n on: addEventListeners,\n off: removeEventListeners,\n each: each,\n merge: merge,\n extend: extend,\n assign: assign,\n inherit: inherit,\n bindFn: bindFn,\n prefixed: prefixed\n});\n\n// this prevents errors when Hammer is loaded in the presence of an AMD\n// style loader but by script tag, not by the loader.\nvar freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line\nfreeGlobal.Hammer = Hammer;\n\nif (typeof define === 'function' && define.amd) {\n define(function() {\n return Hammer;\n });\n} else if (typeof module != 'undefined' && module.exports) {\n module.exports = Hammer;\n} else {\n window[exportName] = Hammer;\n}\n\n})(window, document, 'Hammer');\n","var InlineSVGConfig = (function () {\n function InlineSVGConfig() {\n }\n return InlineSVGConfig;\n}());\nexport { InlineSVGConfig };\n","import { Injectable, RendererFactory2 } from '@angular/core';\nimport * as i0 from \"@angular/core\";\nvar InlineSVGService = (function () {\n function InlineSVGService(rendererFactory) {\n this._ranScripts = {};\n this._renderer = rendererFactory.createRenderer(null, null);\n }\n InlineSVGService.prototype.insertEl = function (dir, parentEl, content, replaceContents, prepend) {\n if (replaceContents && !prepend) {\n var parentNode = dir._prevSVG && dir._prevSVG.parentNode;\n if (parentNode) {\n this._renderer.removeChild(parentNode, dir._prevSVG);\n }\n parentEl.innerHTML = '';\n }\n if (prepend) {\n this._renderer.insertBefore(parentEl, content, parentEl.firstChild);\n }\n else {\n this._renderer.appendChild(parentEl, content);\n }\n if (content.nodeName === 'svg') {\n dir._prevSVG = content;\n }\n };\n InlineSVGService.prototype.evalScripts = function (svg, url, evalMode) {\n var scripts = svg.querySelectorAll('script');\n var scriptsToEval = [];\n for (var i = 0; i < scripts.length; i++) {\n var scriptType = scripts[i].getAttribute('type');\n if (!scriptType || scriptType === 'application/ecmascript' || scriptType === 'application/javascript') {\n var script = scripts[i].innerText || scripts[i].textContent;\n scriptsToEval.push(script);\n this._renderer.removeChild(scripts[i].parentNode, scripts[i]);\n }\n }\n if (scriptsToEval.length > 0 && (evalMode === \"always\" ||\n (evalMode === \"once\" && !this._ranScripts[url]))) {\n for (var i = 0; i < scriptsToEval.length; i++) {\n new Function(scriptsToEval[i])(window);\n }\n this._ranScripts[url] = true;\n }\n };\n InlineSVGService.ɵfac = function InlineSVGService_Factory(t) { return new (t || InlineSVGService)(i0.ɵɵinject(i0.RendererFactory2)); };\n InlineSVGService.ɵprov = i0.ɵɵdefineInjectable({ token: InlineSVGService, factory: InlineSVGService.ɵfac, providedIn: 'root' });\n return InlineSVGService;\n}());\nexport { InlineSVGService };\n(function () { (typeof ngDevMode === \"undefined\" || ngDevMode) && i0.ɵsetClassMetadata(InlineSVGService, [{\n type: Injectable,\n args: [{\n providedIn: 'root'\n }]\n }], function () { return [{ type: i0.RendererFactory2 }]; }, null); })();\n","import { ChangeDetectionStrategy, Component, ElementRef, Input } from '@angular/core';\nimport { InlineSVGDirective } from './inline-svg.directive';\nimport { InlineSVGService } from './inline-svg.service';\nimport * as i0 from \"@angular/core\";\nimport * as i1 from \"./inline-svg.service\";\nvar InlineSVGComponent = (function () {\n function InlineSVGComponent(_inlineSVGService, el) {\n this._inlineSVGService = _inlineSVGService;\n this._el = el;\n }\n InlineSVGComponent.prototype.ngAfterViewInit = function () {\n this._updateContent();\n };\n InlineSVGComponent.prototype.ngOnChanges = function (changes) {\n if (changes['content']) {\n this._updateContent();\n }\n };\n InlineSVGComponent.prototype._updateContent = function () {\n this._inlineSVGService.insertEl(this.context, this._el.nativeElement, this.content, this.replaceContents, this.prepend);\n };\n InlineSVGComponent.ɵfac = function InlineSVGComponent_Factory(t) { return new (t || InlineSVGComponent)(i0.ɵɵdirectiveInject(i1.InlineSVGService), i0.ɵɵdirectiveInject(i0.ElementRef)); };\n InlineSVGComponent.ɵcmp = i0.ɵɵdefineComponent({ type: InlineSVGComponent, selectors: [[\"inline-svg\"]], inputs: { context: \"context\", content: \"content\", replaceContents: \"replaceContents\", prepend: \"prepend\" }, features: [i0.ɵɵNgOnChangesFeature], decls: 0, vars: 0, template: function InlineSVGComponent_Template(rf, ctx) { }, encapsulation: 2, changeDetection: 0 });\n return InlineSVGComponent;\n}());\nexport { InlineSVGComponent };\n(function () { (typeof ngDevMode === \"undefined\" || ngDevMode) && i0.ɵsetClassMetadata(InlineSVGComponent, [{\n type: Component,\n args: [{\n selector: 'inline-svg',\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush\n }]\n }], function () { return [{ type: i1.InlineSVGService }, { type: i0.ElementRef }]; }, { context: [{\n type: Input\n }], content: [{\n type: Input\n }], replaceContents: [{\n type: Input\n }], prepend: [{\n type: Input\n }] }); })();\n","import { APP_BASE_HREF, PlatformLocation } from '@angular/common';\nimport { HttpBackend, HttpClient } from '@angular/common/http';\nimport { Inject, Injectable, Optional, RendererFactory2 } from '@angular/core';\nimport { of, throwError } from 'rxjs';\nimport { catchError, map, share, tap } from 'rxjs/operators';\nimport { InlineSVGConfig } from './inline-svg.config';\nimport * as i0 from \"@angular/core\";\nimport * as i1 from \"@angular/common\";\nimport * as i2 from \"./inline-svg.config\";\nimport * as i3 from \"@angular/common/http\";\nvar SVGCacheService = (function () {\n function SVGCacheService(_appBase, _location, _config, httpClient, httpBackend, rendererFactory) {\n this._appBase = _appBase;\n this._location = _location;\n this._config = _config;\n this._http = _config && !_config.bypassHttpClientInterceptorChain\n ? httpClient\n : new HttpClient(httpBackend);\n this._renderer = rendererFactory.createRenderer(null, null);\n this.setBaseUrl();\n if (!SVGCacheService._cache) {\n SVGCacheService._cache = new Map();\n }\n if (!SVGCacheService._inProgressReqs) {\n SVGCacheService._inProgressReqs = new Map();\n }\n }\n SVGCacheService.prototype.getSVG = function (url, resolveSVGUrl, cache) {\n var _this = this;\n if (cache === void 0) { cache = true; }\n var svgUrl = (resolveSVGUrl\n ? this.getAbsoluteUrl(url)\n : url).replace(/#.+$/, '');\n if (cache && SVGCacheService._cache.has(svgUrl)) {\n return of(this._cloneSVG(SVGCacheService._cache.get(svgUrl)));\n }\n if (SVGCacheService._inProgressReqs.has(svgUrl)) {\n return SVGCacheService._inProgressReqs.get(svgUrl);\n }\n var req = this._http.get(svgUrl, { responseType: 'text' })\n .pipe(tap(function () {\n SVGCacheService._inProgressReqs.delete(svgUrl);\n }), catchError(function (error) {\n SVGCacheService._inProgressReqs.delete(svgUrl);\n return throwError(error.message);\n }), share(), map(function (svgText) {\n var svgEl = _this._svgElementFromString(svgText);\n SVGCacheService._cache.set(svgUrl, svgEl);\n return _this._cloneSVG(svgEl);\n }));\n SVGCacheService._inProgressReqs.set(svgUrl, req);\n return req;\n };\n SVGCacheService.prototype.setBaseUrl = function () {\n if (this._config) {\n this._baseUrl = this._config.baseUrl;\n }\n else if (this._appBase !== null) {\n this._baseUrl = this._appBase;\n }\n else if (this._location !== null) {\n this._baseUrl = this._location.getBaseHrefFromDOM();\n }\n };\n SVGCacheService.prototype.getAbsoluteUrl = function (url) {\n if (this._baseUrl && !/^https?:\\/\\//i.test(url)) {\n url = this._baseUrl + url;\n if (url.indexOf('//') === 0) {\n url = url.substring(1);\n }\n }\n var base = this._renderer.createElement('BASE');\n base.href = url;\n return base.href;\n };\n SVGCacheService.prototype._svgElementFromString = function (str) {\n var div = this._renderer.createElement('DIV');\n div.innerHTML = str;\n var svg = div.querySelector('svg');\n if (!svg) {\n throw new Error('No SVG found in loaded contents');\n }\n return svg;\n };\n SVGCacheService.prototype._cloneSVG = function (svg) {\n return svg.cloneNode(true);\n };\n SVGCacheService.ɵfac = function SVGCacheService_Factory(t) { return new (t || SVGCacheService)(i0.ɵɵinject(APP_BASE_HREF, 8), i0.ɵɵinject(i1.PlatformLocation, 8), i0.ɵɵinject(i2.InlineSVGConfig, 8), i0.ɵɵinject(i3.HttpClient), i0.ɵɵinject(i3.HttpBackend), i0.ɵɵinject(i0.RendererFactory2)); };\n SVGCacheService.ɵprov = i0.ɵɵdefineInjectable({ token: SVGCacheService, factory: SVGCacheService.ɵfac, providedIn: 'root' });\n return SVGCacheService;\n}());\nexport { SVGCacheService };\n(function () { (typeof ngDevMode === \"undefined\" || ngDevMode) && i0.ɵsetClassMetadata(SVGCacheService, [{\n type: Injectable,\n args: [{\n providedIn: 'root'\n }]\n }], function () { return [{ type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: [APP_BASE_HREF]\n }] }, { type: i1.PlatformLocation, decorators: [{\n type: Optional\n }] }, { type: i2.InlineSVGConfig, decorators: [{\n type: Optional\n }] }, { type: i3.HttpClient }, { type: i3.HttpBackend }, { type: i0.RendererFactory2 }]; }, null); })();\n","export function isUrlSymbol(url) {\n return url.charAt(0) === '#' || url.indexOf('.svg#') > -1;\n}\nexport function isSvgSupported() {\n return typeof SVGRect !== 'undefined';\n}\nexport function createSymbolSvg(renderer, svg, symbolId) {\n var symbol = svg.querySelector(\"[id=\\\"\".concat(symbolId, \"\\\"]\"));\n if (!symbol) {\n throw new Error(\"Symbol \\\"\".concat(symbolId, \"\\\" not found\"));\n }\n var elSvg = renderer.createElement('svg', 'svg');\n renderer.appendChild(elSvg, symbol);\n var elSvgUse = renderer.createElement('use', 'svg');\n renderer.setAttribute(elSvgUse, 'href', \"#\".concat(symbolId), 'xlink');\n renderer.appendChild(elSvg, elSvgUse);\n return elSvg;\n}\nexport function removeAttributes(element, attrs) {\n for (var i = 0; i < attrs.length; i++) {\n var elAttr = element.getAttribute(attrs[i]);\n if (elAttr) {\n element.removeAttribute(attrs[i]);\n }\n }\n var innerEls = element.getElementsByTagName('*');\n for (var i = 0; i < innerEls.length; i++) {\n removeAttributes(innerEls[i], attrs);\n }\n}\nexport function setAttributes(element, attrs) {\n for (var attr in attrs) {\n element.setAttribute(attr, attrs[attr]);\n }\n}\n","import { ComponentFactoryResolver, Directive, ElementRef, EventEmitter, Inject, Input, Optional, Output, PLATFORM_ID, Renderer2, ViewContainerRef, } from '@angular/core';\nimport { isPlatformBrowser, isPlatformServer } from '@angular/common';\nimport { InlineSVGComponent } from './inline-svg.component';\nimport { SVGCacheService } from './svg-cache.service';\nimport { InlineSVGService } from './inline-svg.service';\nimport { InlineSVGConfig } from './inline-svg.config';\nimport * as SvgUtil from './svg-util';\nimport * as i0 from \"@angular/core\";\nimport * as i1 from \"./svg-cache.service\";\nimport * as i2 from \"./inline-svg.service\";\nimport * as i3 from \"./inline-svg.config\";\nvar InlineSVGDirective = (function () {\n function InlineSVGDirective(_el, _viewContainerRef, _resolver, _svgCache, _renderer, _inlineSVGService, _config, platformId) {\n this._el = _el;\n this._viewContainerRef = _viewContainerRef;\n this._resolver = _resolver;\n this._svgCache = _svgCache;\n this._renderer = _renderer;\n this._inlineSVGService = _inlineSVGService;\n this._config = _config;\n this.platformId = platformId;\n this.resolveSVGUrl = true;\n this.replaceContents = true;\n this.prepend = false;\n this.injectComponent = false;\n this.cacheSVG = true;\n this.forceEvalStyles = false;\n this.evalScripts = \"always\";\n this.onSVGInserted = new EventEmitter();\n this.onSVGFailed = new EventEmitter();\n this._supportsSVG = SvgUtil.isSvgSupported();\n if (!isPlatformServer(this.platformId) && !this._supportsSVG) {\n this._fail('Embed SVG are not supported by this browser');\n }\n }\n InlineSVGDirective.prototype.ngOnInit = function () {\n if (!this._isValidPlatform() || this._isSSRDisabled()) {\n return;\n }\n this._insertSVG();\n };\n InlineSVGDirective.prototype.ngOnChanges = function (changes) {\n if (!this._isValidPlatform() || this._isSSRDisabled()) {\n return;\n }\n var setSVGAttributesChanged = Boolean(changes['setSVGAttributes']);\n if (changes['inlineSVG'] || setSVGAttributesChanged) {\n this._insertSVG(setSVGAttributesChanged);\n }\n };\n InlineSVGDirective.prototype.ngOnDestroy = function () {\n if (this._subscription) {\n this._subscription.unsubscribe();\n }\n };\n InlineSVGDirective.prototype._insertSVG = function (force) {\n var _this = this;\n if (force === void 0) { force = false; }\n if (!isPlatformServer(this.platformId) && !this._supportsSVG) {\n return;\n }\n if (!this.inlineSVG) {\n this._fail('No URL passed to [inlineSVG]');\n return;\n }\n if (!force && this.inlineSVG === this._prevUrl) {\n return;\n }\n this._prevUrl = this.inlineSVG;\n this._subscription = this._svgCache.getSVG(this.inlineSVG, this.resolveSVGUrl, this.cacheSVG)\n .subscribe(function (svg) {\n if (SvgUtil.isUrlSymbol(_this.inlineSVG)) {\n var symbolId = _this.inlineSVG.split('#')[1];\n svg = SvgUtil.createSymbolSvg(_this._renderer, svg, symbolId);\n }\n _this._processSvg(svg);\n }, function (err) {\n _this._fail(err);\n });\n };\n InlineSVGDirective.prototype._processSvg = function (svg) {\n if (!svg) {\n return;\n }\n if (this.removeSVGAttributes && isPlatformBrowser(this.platformId)) {\n SvgUtil.removeAttributes(svg, this.removeSVGAttributes);\n }\n if (this.setSVGAttributes) {\n SvgUtil.setAttributes(svg, this.setSVGAttributes);\n }\n if (this.onSVGLoaded) {\n svg = this.onSVGLoaded(svg, this._el.nativeElement);\n }\n this._insertEl(svg);\n if (isPlatformBrowser(this.platformId)) {\n this._inlineSVGService.evalScripts(svg, this.inlineSVG, this.evalScripts);\n }\n if (this.forceEvalStyles) {\n var styleTags = svg.querySelectorAll('style');\n Array.from(styleTags).forEach(function (tag) { return tag.textContent += ''; });\n }\n this.onSVGInserted.emit(svg);\n };\n InlineSVGDirective.prototype._insertEl = function (el) {\n if (this.injectComponent) {\n if (!this._svgComp) {\n var factory = this._resolver.resolveComponentFactory(InlineSVGComponent);\n this._svgComp = this._viewContainerRef.createComponent(factory);\n }\n this._svgComp.instance.context = this;\n this._svgComp.instance.replaceContents = this.replaceContents;\n this._svgComp.instance.prepend = this.prepend;\n this._svgComp.instance.content = el;\n this._renderer.appendChild(this._el.nativeElement, this._svgComp.injector.get(InlineSVGComponent)._el.nativeElement);\n }\n else {\n this._inlineSVGService.insertEl(this, this._el.nativeElement, el, this.replaceContents, this.prepend);\n }\n };\n InlineSVGDirective.prototype._fail = function (msg) {\n this.onSVGFailed.emit(msg);\n if (this.fallbackImgUrl) {\n var elImg = this._renderer.createElement('IMG');\n this._renderer.setAttribute(elImg, 'src', this.fallbackImgUrl);\n this._insertEl(elImg);\n }\n else if (this.fallbackSVG && this.fallbackSVG !== this.inlineSVG) {\n this.inlineSVG = this.fallbackSVG;\n this._insertSVG();\n }\n };\n InlineSVGDirective.prototype._isValidPlatform = function () {\n return isPlatformServer(this.platformId) || isPlatformBrowser(this.platformId);\n };\n InlineSVGDirective.prototype._isSSRDisabled = function () {\n return isPlatformServer(this.platformId) && this._config && this._config.clientOnly;\n };\n InlineSVGDirective.ɵfac = function InlineSVGDirective_Factory(t) { return new (t || InlineSVGDirective)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.ViewContainerRef), i0.ɵɵdirectiveInject(i0.ComponentFactoryResolver), i0.ɵɵdirectiveInject(i1.SVGCacheService), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i2.InlineSVGService), i0.ɵɵdirectiveInject(i3.InlineSVGConfig, 8), i0.ɵɵdirectiveInject(PLATFORM_ID)); };\n InlineSVGDirective.ɵdir = i0.ɵɵdefineDirective({ type: InlineSVGDirective, selectors: [[\"\", \"inlineSVG\", \"\"]], inputs: { inlineSVG: \"inlineSVG\", resolveSVGUrl: \"resolveSVGUrl\", replaceContents: \"replaceContents\", prepend: \"prepend\", injectComponent: \"injectComponent\", cacheSVG: \"cacheSVG\", setSVGAttributes: \"setSVGAttributes\", removeSVGAttributes: \"removeSVGAttributes\", forceEvalStyles: \"forceEvalStyles\", evalScripts: \"evalScripts\", fallbackImgUrl: \"fallbackImgUrl\", fallbackSVG: \"fallbackSVG\", onSVGLoaded: \"onSVGLoaded\" }, outputs: { onSVGInserted: \"onSVGInserted\", onSVGFailed: \"onSVGFailed\" }, features: [i0.ɵɵProvidersFeature([SVGCacheService]), i0.ɵɵNgOnChangesFeature] });\n return InlineSVGDirective;\n}());\nexport { InlineSVGDirective };\n(function () { (typeof ngDevMode === \"undefined\" || ngDevMode) && i0.ɵsetClassMetadata(InlineSVGDirective, [{\n type: Directive,\n args: [{\n selector: '[inlineSVG]',\n providers: [SVGCacheService]\n }]\n }], function () { return [{ type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: i0.ComponentFactoryResolver }, { type: i1.SVGCacheService }, { type: i0.Renderer2 }, { type: i2.InlineSVGService }, { type: i3.InlineSVGConfig, decorators: [{\n type: Optional\n }] }, { type: Object, decorators: [{\n type: Inject,\n args: [PLATFORM_ID]\n }] }]; }, { inlineSVG: [{\n type: Input\n }], resolveSVGUrl: [{\n type: Input\n }], replaceContents: [{\n type: Input\n }], prepend: [{\n type: Input\n }], injectComponent: [{\n type: Input\n }], cacheSVG: [{\n type: Input\n }], setSVGAttributes: [{\n type: Input\n }], removeSVGAttributes: [{\n type: Input\n }], forceEvalStyles: [{\n type: Input\n }], evalScripts: [{\n type: Input\n }], fallbackImgUrl: [{\n type: Input\n }], fallbackSVG: [{\n type: Input\n }], onSVGLoaded: [{\n type: Input\n }], onSVGInserted: [{\n type: Output\n }], onSVGFailed: [{\n type: Output\n }] }); })();\n","import { NgModule } from '@angular/core';\nimport { InlineSVGComponent } from './inline-svg.component';\nimport { InlineSVGConfig } from './inline-svg.config';\nimport { InlineSVGDirective } from './inline-svg.directive';\nimport * as i0 from \"@angular/core\";\nvar InlineSVGModule = (function () {\n function InlineSVGModule() {\n }\n InlineSVGModule.forRoot = function (config) {\n return {\n ngModule: InlineSVGModule,\n providers: [\n { provide: InlineSVGConfig, useValue: config }\n ]\n };\n };\n InlineSVGModule.ɵfac = function InlineSVGModule_Factory(t) { return new (t || InlineSVGModule)(); };\n InlineSVGModule.ɵmod = i0.ɵɵdefineNgModule({ type: InlineSVGModule });\n InlineSVGModule.ɵinj = i0.ɵɵdefineInjector({});\n return InlineSVGModule;\n}());\nexport { InlineSVGModule };\n(function () { (typeof ngDevMode === \"undefined\" || ngDevMode) && i0.ɵsetClassMetadata(InlineSVGModule, [{\n type: NgModule,\n args: [{\n declarations: [InlineSVGDirective, InlineSVGComponent],\n exports: [InlineSVGDirective],\n entryComponents: [InlineSVGComponent]\n }]\n }], null, null); })();\n(function () { (typeof ngJitMode === \"undefined\" || ngJitMode) && i0.ɵɵsetNgModuleScope(InlineSVGModule, { declarations: [InlineSVGDirective, InlineSVGComponent], exports: [InlineSVGDirective] }); })();\n","import { Subject } from './Subject';\nexport class BehaviorSubject extends Subject {\n constructor(_value) {\n super();\n this._value = _value;\n }\n get value() {\n return this.getValue();\n }\n _subscribe(subscriber) {\n const subscription = super._subscribe(subscriber);\n !subscription.closed && subscriber.next(this._value);\n return subscription;\n }\n getValue() {\n const { hasError, thrownError, _value } = this;\n if (hasError) {\n throw thrownError;\n }\n this._throwIfClosed();\n return _value;\n }\n next(value) {\n super.next((this._value = value));\n }\n}\n","import { SafeSubscriber, Subscriber } from './Subscriber';\nimport { isSubscription } from './Subscription';\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';\nexport class Observable {\n constructor(subscribe) {\n if (subscribe) {\n this._subscribe = subscribe;\n }\n }\n lift(operator) {\n const observable = new Observable();\n observable.source = this;\n observable.operator = operator;\n return observable;\n }\n subscribe(observerOrNext, error, complete) {\n const subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);\n errorContext(() => {\n const { operator, source } = this;\n subscriber.add(operator\n ?\n operator.call(subscriber, source)\n : source\n ?\n this._subscribe(subscriber)\n :\n this._trySubscribe(subscriber));\n });\n return subscriber;\n }\n _trySubscribe(sink) {\n try {\n return this._subscribe(sink);\n }\n catch (err) {\n sink.error(err);\n }\n }\n forEach(next, promiseCtor) {\n promiseCtor = getPromiseCtor(promiseCtor);\n return new promiseCtor((resolve, reject) => {\n const subscriber = new SafeSubscriber({\n next: (value) => {\n try {\n next(value);\n }\n catch (err) {\n reject(err);\n subscriber.unsubscribe();\n }\n },\n error: reject,\n complete: resolve,\n });\n this.subscribe(subscriber);\n });\n }\n _subscribe(subscriber) {\n var _a;\n return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);\n }\n [Symbol_observable]() {\n return this;\n }\n pipe(...operations) {\n return pipeFromArray(operations)(this);\n }\n toPromise(promiseCtor) {\n promiseCtor = getPromiseCtor(promiseCtor);\n return new promiseCtor((resolve, reject) => {\n let value;\n this.subscribe((x) => (value = x), (err) => reject(err), () => resolve(value));\n });\n }\n}\nObservable.create = (subscribe) => {\n return new Observable(subscribe);\n};\nfunction getPromiseCtor(promiseCtor) {\n var _a;\n return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;\n}\nfunction isObserver(value) {\n return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);\n}\nfunction isSubscriber(value) {\n return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));\n}\n","import { Subject } from './Subject';\nimport { dateTimestampProvider } from './scheduler/dateTimestampProvider';\nexport class ReplaySubject extends Subject {\n constructor(_bufferSize = Infinity, _windowTime = Infinity, _timestampProvider = dateTimestampProvider) {\n super();\n this._bufferSize = _bufferSize;\n this._windowTime = _windowTime;\n this._timestampProvider = _timestampProvider;\n this._buffer = [];\n this._infiniteTimeWindow = true;\n this._infiniteTimeWindow = _windowTime === Infinity;\n this._bufferSize = Math.max(1, _bufferSize);\n this._windowTime = Math.max(1, _windowTime);\n }\n next(value) {\n const { isStopped, _buffer, _infiniteTimeWindow, _timestampProvider, _windowTime } = this;\n if (!isStopped) {\n _buffer.push(value);\n !_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime);\n }\n this._trimBuffer();\n super.next(value);\n }\n _subscribe(subscriber) {\n this._throwIfClosed();\n this._trimBuffer();\n const subscription = this._innerSubscribe(subscriber);\n const { _infiniteTimeWindow, _buffer } = this;\n const copy = _buffer.slice();\n for (let i = 0; i < copy.length && !subscriber.closed; i += _infiniteTimeWindow ? 1 : 2) {\n subscriber.next(copy[i]);\n }\n this._checkFinalizedStatuses(subscriber);\n return subscription;\n }\n _trimBuffer() {\n const { _bufferSize, _timestampProvider, _buffer, _infiniteTimeWindow } = this;\n const adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize;\n _bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize);\n if (!_infiniteTimeWindow) {\n const now = _timestampProvider.now();\n let last = 0;\n for (let i = 1; i < _buffer.length && _buffer[i] <= now; i += 2) {\n last = i;\n }\n last && _buffer.splice(0, last + 1);\n }\n }\n}\n","import { createErrorClass } from './createErrorClass';\nexport const ObjectUnsubscribedError = createErrorClass((_super) => function ObjectUnsubscribedErrorImpl() {\n _super(this);\n this.name = 'ObjectUnsubscribedError';\n this.message = 'object unsubscribed';\n});\n","import { Observable } from './Observable';\nimport { Subscription, EMPTY_SUBSCRIPTION } from './Subscription';\nimport { ObjectUnsubscribedError } from './util/ObjectUnsubscribedError';\nimport { arrRemove } from './util/arrRemove';\nimport { errorContext } from './util/errorContext';\nexport class Subject extends Observable {\n constructor() {\n super();\n this.closed = false;\n this.currentObservers = null;\n this.observers = [];\n this.isStopped = false;\n this.hasError = false;\n this.thrownError = null;\n }\n lift(operator) {\n const subject = new AnonymousSubject(this, this);\n subject.operator = operator;\n return subject;\n }\n _throwIfClosed() {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n }\n next(value) {\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 error(err) {\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 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 unsubscribe() {\n this.isStopped = this.closed = true;\n this.observers = this.currentObservers = null;\n }\n get observed() {\n var _a;\n return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;\n }\n _trySubscribe(subscriber) {\n this._throwIfClosed();\n return super._trySubscribe(subscriber);\n }\n _subscribe(subscriber) {\n this._throwIfClosed();\n this._checkFinalizedStatuses(subscriber);\n return this._innerSubscribe(subscriber);\n }\n _innerSubscribe(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 _checkFinalizedStatuses(subscriber) {\n const { hasError, thrownError, isStopped } = this;\n if (hasError) {\n subscriber.error(thrownError);\n }\n else if (isStopped) {\n subscriber.complete();\n }\n }\n asObservable() {\n const observable = new Observable();\n observable.source = this;\n return observable;\n }\n}\nSubject.create = (destination, source) => {\n return new AnonymousSubject(destination, source);\n};\nexport class AnonymousSubject extends Subject {\n constructor(destination, source) {\n super();\n this.destination = destination;\n this.source = source;\n }\n next(value) {\n var _a, _b;\n (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);\n }\n error(err) {\n var _a, _b;\n (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);\n }\n complete() {\n var _a, _b;\n (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);\n }\n _subscribe(subscriber) {\n var _a, _b;\n return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;\n }\n}\n","export const COMPLETE_NOTIFICATION = (() => createNotification('C', undefined, undefined))();\nexport function errorNotification(error) {\n return createNotification('E', undefined, error);\n}\nexport function nextNotification(value) {\n return createNotification('N', value, undefined);\n}\nexport function createNotification(kind, value, error) {\n return {\n kind,\n value,\n error,\n };\n}\n","import { isFunction } from './util/isFunction';\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';\nexport class Subscriber extends Subscription {\n constructor(destination) {\n super();\n this.isStopped = false;\n if (destination) {\n this.destination = destination;\n if (isSubscription(destination)) {\n destination.add(this);\n }\n }\n else {\n this.destination = EMPTY_OBSERVER;\n }\n }\n static create(next, error, complete) {\n return new SafeSubscriber(next, error, complete);\n }\n next(value) {\n if (this.isStopped) {\n handleStoppedNotification(nextNotification(value), this);\n }\n else {\n this._next(value);\n }\n }\n error(err) {\n if (this.isStopped) {\n handleStoppedNotification(errorNotification(err), this);\n }\n else {\n this.isStopped = true;\n this._error(err);\n }\n }\n complete() {\n if (this.isStopped) {\n handleStoppedNotification(COMPLETE_NOTIFICATION, this);\n }\n else {\n this.isStopped = true;\n this._complete();\n }\n }\n unsubscribe() {\n if (!this.closed) {\n this.isStopped = true;\n super.unsubscribe();\n this.destination = null;\n }\n }\n _next(value) {\n this.destination.next(value);\n }\n _error(err) {\n try {\n this.destination.error(err);\n }\n finally {\n this.unsubscribe();\n }\n }\n _complete() {\n try {\n this.destination.complete();\n }\n finally {\n this.unsubscribe();\n }\n }\n}\nconst _bind = Function.prototype.bind;\nfunction bind(fn, thisArg) {\n return _bind.call(fn, thisArg);\n}\nclass ConsumerObserver {\n constructor(partialObserver) {\n this.partialObserver = partialObserver;\n }\n next(value) {\n const { partialObserver } = this;\n if (partialObserver.next) {\n try {\n partialObserver.next(value);\n }\n catch (error) {\n handleUnhandledError(error);\n }\n }\n }\n error(err) {\n const { partialObserver } = this;\n if (partialObserver.error) {\n try {\n partialObserver.error(err);\n }\n catch (error) {\n handleUnhandledError(error);\n }\n }\n else {\n handleUnhandledError(err);\n }\n }\n complete() {\n const { partialObserver } = this;\n if (partialObserver.complete) {\n try {\n partialObserver.complete();\n }\n catch (error) {\n handleUnhandledError(error);\n }\n }\n }\n}\nexport class SafeSubscriber extends Subscriber {\n constructor(observerOrNext, error, complete) {\n super();\n let partialObserver;\n if (isFunction(observerOrNext) || !observerOrNext) {\n partialObserver = {\n next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),\n error: error !== null && error !== void 0 ? error : undefined,\n complete: complete !== null && complete !== void 0 ? complete : undefined,\n };\n }\n else {\n let context;\n if (this && config.useDeprecatedNextContext) {\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 }\n else {\n partialObserver = observerOrNext;\n }\n }\n this.destination = new ConsumerObserver(partialObserver);\n }\n}\nfunction handleUnhandledError(error) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n captureError(error);\n }\n else {\n reportUnhandledError(error);\n }\n}\nfunction defaultErrorHandler(err) {\n throw err;\n}\nfunction handleStoppedNotification(notification, subscriber) {\n const { onStoppedNotification } = config;\n onStoppedNotification && timeoutProvider.setTimeout(() => onStoppedNotification(notification, subscriber));\n}\nexport const EMPTY_OBSERVER = {\n closed: true,\n next: noop,\n error: defaultErrorHandler,\n complete: noop,\n};\n","import { createErrorClass } from './createErrorClass';\nexport const UnsubscriptionError = createErrorClass((_super) => function UnsubscriptionErrorImpl(errors) {\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","import { isFunction } from './util/isFunction';\nimport { UnsubscriptionError } from './util/UnsubscriptionError';\nimport { arrRemove } from './util/arrRemove';\nexport class Subscription {\n constructor(initialTeardown) {\n this.initialTeardown = initialTeardown;\n this.closed = false;\n this._parentage = null;\n this._finalizers = null;\n }\n unsubscribe() {\n let errors;\n if (!this.closed) {\n this.closed = true;\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 }\n else {\n _parentage.remove(this);\n }\n }\n const { initialTeardown: initialFinalizer } = this;\n if (isFunction(initialFinalizer)) {\n try {\n initialFinalizer();\n }\n catch (e) {\n errors = e instanceof UnsubscriptionError ? e.errors : [e];\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 }\n catch (err) {\n errors = errors !== null && errors !== void 0 ? errors : [];\n if (err instanceof UnsubscriptionError) {\n errors = [...errors, ...err.errors];\n }\n else {\n errors.push(err);\n }\n }\n }\n }\n if (errors) {\n throw new UnsubscriptionError(errors);\n }\n }\n }\n add(teardown) {\n var _a;\n if (teardown && teardown !== this) {\n if (this.closed) {\n execFinalizer(teardown);\n }\n else {\n if (teardown instanceof Subscription) {\n if (teardown.closed || teardown._hasParent(this)) {\n return;\n }\n teardown._addParent(this);\n }\n (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);\n }\n }\n }\n _hasParent(parent) {\n const { _parentage } = this;\n return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));\n }\n _addParent(parent) {\n const { _parentage } = this;\n this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;\n }\n _removeParent(parent) {\n const { _parentage } = this;\n if (_parentage === parent) {\n this._parentage = null;\n }\n else if (Array.isArray(_parentage)) {\n arrRemove(_parentage, parent);\n }\n }\n remove(teardown) {\n const { _finalizers } = this;\n _finalizers && arrRemove(_finalizers, teardown);\n if (teardown instanceof Subscription) {\n teardown._removeParent(this);\n }\n }\n}\nSubscription.EMPTY = (() => {\n const empty = new Subscription();\n empty.closed = true;\n return empty;\n})();\nexport const EMPTY_SUBSCRIPTION = Subscription.EMPTY;\nexport function isSubscription(value) {\n return (value instanceof Subscription ||\n (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));\n}\nfunction execFinalizer(finalizer) {\n if (isFunction(finalizer)) {\n finalizer();\n }\n else {\n finalizer.unsubscribe();\n }\n}\n","export const config = {\n onUnhandledError: null,\n onStoppedNotification: null,\n Promise: undefined,\n useDeprecatedSynchronousErrorHandling: false,\n useDeprecatedNextContext: false,\n};\n","import { Observable } from '../Observable';\nimport { Subscription } from '../Subscription';\nimport { refCount as higherOrderRefCount } from '../operators/refCount';\nimport { createOperatorSubscriber } from '../operators/OperatorSubscriber';\nimport { hasLift } from '../util/lift';\nexport class ConnectableObservable extends Observable {\n constructor(source, subjectFactory) {\n super();\n this.source = source;\n this.subjectFactory = subjectFactory;\n this._subject = null;\n this._refCount = 0;\n this._connection = null;\n if (hasLift(source)) {\n this.lift = source.lift;\n }\n }\n _subscribe(subscriber) {\n return this.getSubject().subscribe(subscriber);\n }\n getSubject() {\n const subject = this._subject;\n if (!subject || subject.isStopped) {\n this._subject = this.subjectFactory();\n }\n return this._subject;\n }\n _teardown() {\n this._refCount = 0;\n const { _connection } = this;\n this._subject = this._connection = null;\n _connection === null || _connection === void 0 ? void 0 : _connection.unsubscribe();\n }\n connect() {\n let connection = this._connection;\n if (!connection) {\n connection = this._connection = new Subscription();\n const subject = this.getSubject();\n connection.add(this.source.subscribe(createOperatorSubscriber(subject, undefined, () => {\n this._teardown();\n subject.complete();\n }, (err) => {\n this._teardown();\n subject.error(err);\n }, () => this._teardown())));\n if (connection.closed) {\n this._connection = null;\n connection = Subscription.EMPTY;\n }\n }\n return connection;\n }\n refCount() {\n return higherOrderRefCount()(this);\n }\n}\n","import { Observable } from '../Observable';\nimport { argsArgArrayOrObject } from '../util/argsArgArrayOrObject';\nimport { from } from './from';\nimport { identity } from '../util/identity';\nimport { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';\nimport { popResultSelector, popScheduler } from '../util/args';\nimport { createObject } from '../util/createObject';\nimport { createOperatorSubscriber } from '../operators/OperatorSubscriber';\nimport { executeSchedule } from '../util/executeSchedule';\nexport function combineLatest(...args) {\n const scheduler = popScheduler(args);\n const resultSelector = popResultSelector(args);\n const { args: observables, keys } = argsArgArrayOrObject(args);\n if (observables.length === 0) {\n return from([], scheduler);\n }\n const result = new Observable(combineLatestInit(observables, scheduler, keys\n ?\n (values) => createObject(keys, values)\n :\n identity));\n return resultSelector ? result.pipe(mapOneOrManyArgs(resultSelector)) : result;\n}\nexport function combineLatestInit(observables, scheduler, valueTransform = identity) {\n return (subscriber) => {\n maybeSchedule(scheduler, () => {\n const { length } = observables;\n const values = new Array(length);\n let active = length;\n let remainingFirstValues = length;\n for (let i = 0; i < length; i++) {\n maybeSchedule(scheduler, () => {\n const source = from(observables[i], scheduler);\n let hasFirstValue = false;\n source.subscribe(createOperatorSubscriber(subscriber, (value) => {\n values[i] = value;\n if (!hasFirstValue) {\n hasFirstValue = true;\n remainingFirstValues--;\n }\n if (!remainingFirstValues) {\n subscriber.next(valueTransform(values.slice()));\n }\n }, () => {\n if (!--active) {\n subscriber.complete();\n }\n }));\n }, subscriber);\n }\n }, subscriber);\n };\n}\nfunction maybeSchedule(scheduler, execute, subscription) {\n if (scheduler) {\n executeSchedule(subscription, scheduler, execute);\n }\n else {\n execute();\n }\n}\n","import { concatAll } from '../operators/concatAll';\nimport { popScheduler } from '../util/args';\nimport { from } from './from';\nexport function concat(...args) {\n return concatAll()(from(args, popScheduler(args)));\n}\n","import { mergeAll } from './mergeAll';\nexport function concatAll() {\n return mergeAll(1);\n}\n","import { Observable } from '../Observable';\nimport { innerFrom } from './innerFrom';\nexport function defer(observableFactory) {\n return new Observable((subscriber) => {\n innerFrom(observableFactory()).subscribe(subscriber);\n });\n}\n","import { Observable } from '../Observable';\nexport const EMPTY = new Observable((subscriber) => subscriber.complete());\nexport function empty(scheduler) {\n return scheduler ? emptyScheduled(scheduler) : EMPTY;\n}\nfunction emptyScheduled(scheduler) {\n return new Observable((subscriber) => scheduler.schedule(() => subscriber.complete()));\n}\n","import { Observable } from '../Observable';\nimport { argsArgArrayOrObject } from '../util/argsArgArrayOrObject';\nimport { innerFrom } from './innerFrom';\nimport { popResultSelector } from '../util/args';\nimport { createOperatorSubscriber } from '../operators/OperatorSubscriber';\nimport { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';\nimport { createObject } from '../util/createObject';\nexport function forkJoin(...args) {\n const resultSelector = popResultSelector(args);\n const { args: sources, keys } = argsArgArrayOrObject(args);\n const result = new Observable((subscriber) => {\n const { length } = sources;\n if (!length) {\n subscriber.complete();\n return;\n }\n const values = new Array(length);\n let remainingCompletions = length;\n let remainingEmissions = length;\n for (let sourceIndex = 0; sourceIndex < length; sourceIndex++) {\n let hasValue = false;\n innerFrom(sources[sourceIndex]).subscribe(createOperatorSubscriber(subscriber, (value) => {\n if (!hasValue) {\n hasValue = true;\n remainingEmissions--;\n }\n values[sourceIndex] = value;\n }, () => remainingCompletions--, undefined, () => {\n if (!remainingCompletions || !hasValue) {\n if (!remainingEmissions) {\n subscriber.next(keys ? createObject(keys, values) : values);\n }\n subscriber.complete();\n }\n }));\n }\n });\n return resultSelector ? result.pipe(mapOneOrManyArgs(resultSelector)) : result;\n}\n","import { executeSchedule } from '../util/executeSchedule';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function observeOn(scheduler, delay = 0) {\n return operate((source, subscriber) => {\n source.subscribe(createOperatorSubscriber(subscriber, (value) => executeSchedule(subscriber, scheduler, () => subscriber.next(value), delay), () => executeSchedule(subscriber, scheduler, () => subscriber.complete(), delay), (err) => executeSchedule(subscriber, scheduler, () => subscriber.error(err), delay)));\n });\n}\n","import { operate } from '../util/lift';\nexport function subscribeOn(scheduler, delay = 0) {\n return operate((source, subscriber) => {\n subscriber.add(scheduler.schedule(() => source.subscribe(subscriber), delay));\n });\n}\n","import { Observable } from '../Observable';\nimport { executeSchedule } from '../util/executeSchedule';\nexport function scheduleAsyncIterable(input, scheduler) {\n if (!input) {\n throw new Error('Iterable cannot be null');\n }\n return new Observable((subscriber) => {\n executeSchedule(subscriber, scheduler, () => {\n const iterator = input[Symbol.asyncIterator]();\n executeSchedule(subscriber, scheduler, () => {\n iterator.next().then((result) => {\n if (result.done) {\n subscriber.complete();\n }\n else {\n subscriber.next(result.value);\n }\n });\n }, 0, true);\n });\n });\n}\n","import { scheduled } from '../scheduled/scheduled';\nimport { innerFrom } from './innerFrom';\nexport function from(input, scheduler) {\n return scheduler ? scheduled(input, scheduler) : innerFrom(input);\n}\n","import { scheduleObservable } from './scheduleObservable';\nimport { schedulePromise } from './schedulePromise';\nimport { scheduleArray } from './scheduleArray';\nimport { scheduleIterable } from './scheduleIterable';\nimport { scheduleAsyncIterable } from './scheduleAsyncIterable';\nimport { isInteropObservable } from '../util/isInteropObservable';\nimport { isPromise } from '../util/isPromise';\nimport { isArrayLike } from '../util/isArrayLike';\nimport { isIterable } from '../util/isIterable';\nimport { isAsyncIterable } from '../util/isAsyncIterable';\nimport { createInvalidObservableTypeError } from '../util/throwUnobservableError';\nimport { isReadableStreamLike } from '../util/isReadableStreamLike';\nimport { scheduleReadableStreamLike } from './scheduleReadableStreamLike';\nexport function scheduled(input, scheduler) {\n if (input != null) {\n if (isInteropObservable(input)) {\n return scheduleObservable(input, scheduler);\n }\n if (isArrayLike(input)) {\n return scheduleArray(input, scheduler);\n }\n if (isPromise(input)) {\n return schedulePromise(input, scheduler);\n }\n if (isAsyncIterable(input)) {\n return scheduleAsyncIterable(input, scheduler);\n }\n if (isIterable(input)) {\n return scheduleIterable(input, scheduler);\n }\n if (isReadableStreamLike(input)) {\n return scheduleReadableStreamLike(input, scheduler);\n }\n }\n throw createInvalidObservableTypeError(input);\n}\n","import { innerFrom } from '../observable/innerFrom';\nimport { observeOn } from '../operators/observeOn';\nimport { subscribeOn } from '../operators/subscribeOn';\nexport function scheduleObservable(input, scheduler) {\n return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));\n}\n","import { Observable } from '../Observable';\nexport function scheduleArray(input, scheduler) {\n return new Observable((subscriber) => {\n let i = 0;\n return scheduler.schedule(function () {\n if (i === input.length) {\n subscriber.complete();\n }\n else {\n subscriber.next(input[i++]);\n if (!subscriber.closed) {\n this.schedule();\n }\n }\n });\n });\n}\n","import { innerFrom } from '../observable/innerFrom';\nimport { observeOn } from '../operators/observeOn';\nimport { subscribeOn } from '../operators/subscribeOn';\nexport function schedulePromise(input, scheduler) {\n return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));\n}\n","import { Observable } from '../Observable';\nimport { iterator as Symbol_iterator } from '../symbol/iterator';\nimport { isFunction } from '../util/isFunction';\nimport { executeSchedule } from '../util/executeSchedule';\nexport function scheduleIterable(input, scheduler) {\n return new Observable((subscriber) => {\n let iterator;\n executeSchedule(subscriber, scheduler, () => {\n iterator = input[Symbol_iterator]();\n executeSchedule(subscriber, scheduler, () => {\n let value;\n let done;\n try {\n ({ value, done } = iterator.next());\n }\n catch (err) {\n subscriber.error(err);\n return;\n }\n if (done) {\n subscriber.complete();\n }\n else {\n subscriber.next(value);\n }\n }, 0, true);\n });\n return () => isFunction(iterator === null || iterator === void 0 ? void 0 : iterator.return) && iterator.return();\n });\n}\n","import { scheduleAsyncIterable } from './scheduleAsyncIterable';\nimport { readableStreamLikeToAsyncGenerator } from '../util/isReadableStreamLike';\nexport function scheduleReadableStreamLike(input, scheduler) {\n return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler);\n}\n","import { innerFrom } from '../observable/innerFrom';\nimport { Observable } from '../Observable';\nimport { mergeMap } from '../operators/mergeMap';\nimport { isArrayLike } from '../util/isArrayLike';\nimport { isFunction } from '../util/isFunction';\nimport { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';\nconst nodeEventEmitterMethods = ['addListener', 'removeListener'];\nconst eventTargetMethods = ['addEventListener', 'removeEventListener'];\nconst jqueryMethods = ['on', 'off'];\nexport function fromEvent(target, eventName, options, resultSelector) {\n if (isFunction(options)) {\n resultSelector = options;\n options = undefined;\n }\n if (resultSelector) {\n return fromEvent(target, eventName, options).pipe(mapOneOrManyArgs(resultSelector));\n }\n const [add, remove] = isEventTarget(target)\n ? eventTargetMethods.map((methodName) => (handler) => target[methodName](eventName, handler, options))\n :\n isNodeStyleEventEmitter(target)\n ? nodeEventEmitterMethods.map(toCommonHandlerRegistry(target, eventName))\n : isJQueryStyleEventEmitter(target)\n ? jqueryMethods.map(toCommonHandlerRegistry(target, eventName))\n : [];\n if (!add) {\n if (isArrayLike(target)) {\n return mergeMap((subTarget) => fromEvent(subTarget, eventName, options))(innerFrom(target));\n }\n }\n if (!add) {\n throw new TypeError('Invalid event target');\n }\n return new Observable((subscriber) => {\n const handler = (...args) => subscriber.next(1 < args.length ? args : args[0]);\n add(handler);\n return () => remove(handler);\n });\n}\nfunction toCommonHandlerRegistry(target, eventName) {\n return (methodName) => (handler) => target[methodName](eventName, handler);\n}\nfunction isNodeStyleEventEmitter(target) {\n return isFunction(target.addListener) && isFunction(target.removeListener);\n}\nfunction isJQueryStyleEventEmitter(target) {\n return isFunction(target.on) && isFunction(target.off);\n}\nfunction isEventTarget(target) {\n return isFunction(target.addEventListener) && isFunction(target.removeEventListener);\n}\n","import { defer } from './defer';\nexport function iif(condition, trueResult, falseResult) {\n return defer(() => (condition() ? trueResult : falseResult));\n}\n","import { __asyncValues, __awaiter } from \"tslib\";\nimport { isArrayLike } from '../util/isArrayLike';\nimport { isPromise } from '../util/isPromise';\nimport { Observable } from '../Observable';\nimport { isInteropObservable } from '../util/isInteropObservable';\nimport { isAsyncIterable } from '../util/isAsyncIterable';\nimport { createInvalidObservableTypeError } from '../util/throwUnobservableError';\nimport { isIterable } from '../util/isIterable';\nimport { isReadableStreamLike, readableStreamLikeToAsyncGenerator } from '../util/isReadableStreamLike';\nimport { isFunction } from '../util/isFunction';\nimport { reportUnhandledError } from '../util/reportUnhandledError';\nimport { observable as Symbol_observable } from '../symbol/observable';\nexport function innerFrom(input) {\n if (input instanceof Observable) {\n return input;\n }\n if (input != null) {\n if (isInteropObservable(input)) {\n return fromInteropObservable(input);\n }\n if (isArrayLike(input)) {\n return fromArrayLike(input);\n }\n if (isPromise(input)) {\n return fromPromise(input);\n }\n if (isAsyncIterable(input)) {\n return fromAsyncIterable(input);\n }\n if (isIterable(input)) {\n return fromIterable(input);\n }\n if (isReadableStreamLike(input)) {\n return fromReadableStreamLike(input);\n }\n }\n throw createInvalidObservableTypeError(input);\n}\nexport function fromInteropObservable(obj) {\n return new Observable((subscriber) => {\n const obs = obj[Symbol_observable]();\n if (isFunction(obs.subscribe)) {\n return obs.subscribe(subscriber);\n }\n throw new TypeError('Provided object does not correctly implement Symbol.observable');\n });\n}\nexport function fromArrayLike(array) {\n return new Observable((subscriber) => {\n for (let i = 0; i < array.length && !subscriber.closed; i++) {\n subscriber.next(array[i]);\n }\n subscriber.complete();\n });\n}\nexport function fromPromise(promise) {\n return new Observable((subscriber) => {\n promise\n .then((value) => {\n if (!subscriber.closed) {\n subscriber.next(value);\n subscriber.complete();\n }\n }, (err) => subscriber.error(err))\n .then(null, reportUnhandledError);\n });\n}\nexport function fromIterable(iterable) {\n return new Observable((subscriber) => {\n for (const value of iterable) {\n subscriber.next(value);\n if (subscriber.closed) {\n return;\n }\n }\n subscriber.complete();\n });\n}\nexport function fromAsyncIterable(asyncIterable) {\n return new Observable((subscriber) => {\n process(asyncIterable, subscriber).catch((err) => subscriber.error(err));\n });\n}\nexport function fromReadableStreamLike(readableStream) {\n return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));\n}\nfunction process(asyncIterable, subscriber) {\n var asyncIterable_1, asyncIterable_1_1;\n var e_1, _a;\n return __awaiter(this, void 0, void 0, function* () {\n try {\n for (asyncIterable_1 = __asyncValues(asyncIterable); asyncIterable_1_1 = yield asyncIterable_1.next(), !asyncIterable_1_1.done;) {\n const value = asyncIterable_1_1.value;\n subscriber.next(value);\n if (subscriber.closed) {\n return;\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return)) yield _a.call(asyncIterable_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n subscriber.complete();\n });\n}\n","import { asyncScheduler } from '../scheduler/async';\nimport { timer } from './timer';\nexport function interval(period = 0, scheduler = asyncScheduler) {\n if (period < 0) {\n period = 0;\n }\n return timer(period, period, scheduler);\n}\n","import { mergeAll } from '../operators/mergeAll';\nimport { innerFrom } from './innerFrom';\nimport { EMPTY } from './empty';\nimport { popNumber, popScheduler } from '../util/args';\nimport { from } from './from';\nexport function merge(...args) {\n const scheduler = popScheduler(args);\n const concurrent = popNumber(args, Infinity);\n const sources = args;\n return !sources.length\n ?\n EMPTY\n : sources.length === 1\n ?\n innerFrom(sources[0])\n :\n mergeAll(concurrent)(from(sources, scheduler));\n}\n","import { popScheduler } from '../util/args';\nimport { from } from './from';\nexport function of(...args) {\n const scheduler = popScheduler(args);\n return from(args, scheduler);\n}\n","import { Observable } from '../Observable';\nimport { isFunction } from '../util/isFunction';\nexport function throwError(errorOrErrorFactory, scheduler) {\n const errorFactory = isFunction(errorOrErrorFactory) ? errorOrErrorFactory : () => errorOrErrorFactory;\n const init = (subscriber) => subscriber.error(errorFactory());\n return new Observable(scheduler ? (subscriber) => scheduler.schedule(init, 0, subscriber) : init);\n}\n","import { Observable } from '../Observable';\nimport { async as asyncScheduler } from '../scheduler/async';\nimport { isScheduler } from '../util/isScheduler';\nimport { isValidDate } from '../util/isDate';\nexport function timer(dueTime = 0, intervalOrScheduler, scheduler = asyncScheduler) {\n let intervalDuration = -1;\n if (intervalOrScheduler != null) {\n if (isScheduler(intervalOrScheduler)) {\n scheduler = intervalOrScheduler;\n }\n else {\n intervalDuration = intervalOrScheduler;\n }\n }\n return new Observable((subscriber) => {\n let due = isValidDate(dueTime) ? +dueTime - scheduler.now() : dueTime;\n if (due < 0) {\n due = 0;\n }\n let n = 0;\n return scheduler.schedule(function () {\n if (!subscriber.closed) {\n subscriber.next(n++);\n if (0 <= intervalDuration) {\n this.schedule(undefined, intervalDuration);\n }\n else {\n subscriber.complete();\n }\n }\n }, due);\n });\n}\n","import { Observable } from '../Observable';\nimport { innerFrom } from './innerFrom';\nimport { argsOrArgArray } from '../util/argsOrArgArray';\nimport { EMPTY } from './empty';\nimport { createOperatorSubscriber } from '../operators/OperatorSubscriber';\nimport { popResultSelector } from '../util/args';\nexport function zip(...args) {\n const resultSelector = popResultSelector(args);\n const sources = argsOrArgArray(args);\n return sources.length\n ? new Observable((subscriber) => {\n let buffers = sources.map(() => []);\n let completed = sources.map(() => false);\n subscriber.add(() => {\n buffers = completed = null;\n });\n for (let sourceIndex = 0; !subscriber.closed && sourceIndex < sources.length; sourceIndex++) {\n innerFrom(sources[sourceIndex]).subscribe(createOperatorSubscriber(subscriber, (value) => {\n buffers[sourceIndex].push(value);\n if (buffers.every((buffer) => buffer.length)) {\n const result = buffers.map((buffer) => buffer.shift());\n subscriber.next(resultSelector ? resultSelector(...result) : result);\n if (buffers.some((buffer, i) => !buffer.length && completed[i])) {\n subscriber.complete();\n }\n }\n }, () => {\n completed[sourceIndex] = true;\n !buffers[sourceIndex].length && subscriber.complete();\n }));\n }\n return () => {\n buffers = completed = null;\n };\n })\n : EMPTY;\n}\n","import { Subscriber } from '../Subscriber';\nexport function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {\n return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);\n}\nexport class OperatorSubscriber extends Subscriber {\n constructor(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {\n super(destination);\n this.onFinalize = onFinalize;\n this.shouldUnsubscribe = shouldUnsubscribe;\n this._next = onNext\n ? function (value) {\n try {\n onNext(value);\n }\n catch (err) {\n destination.error(err);\n }\n }\n : super._next;\n this._error = onError\n ? function (err) {\n try {\n onError(err);\n }\n catch (err) {\n destination.error(err);\n }\n finally {\n this.unsubscribe();\n }\n }\n : super._error;\n this._complete = onComplete\n ? function () {\n try {\n onComplete();\n }\n catch (err) {\n destination.error(err);\n }\n finally {\n this.unsubscribe();\n }\n }\n : super._complete;\n }\n unsubscribe() {\n var _a;\n if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {\n const { closed } = this;\n super.unsubscribe();\n !closed && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));\n }\n }\n}\n","import { innerFrom } from '../observable/innerFrom';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { operate } from '../util/lift';\nexport function catchError(selector) {\n return operate((source, subscriber) => {\n let innerSub = null;\n let syncUnsub = false;\n let handledResult;\n innerSub = source.subscribe(createOperatorSubscriber(subscriber, undefined, undefined, (err) => {\n handledResult = innerFrom(selector(err, catchError(selector)(source)));\n if (innerSub) {\n innerSub.unsubscribe();\n innerSub = null;\n handledResult.subscribe(subscriber);\n }\n else {\n syncUnsub = true;\n }\n }));\n if (syncUnsub) {\n innerSub.unsubscribe();\n innerSub = null;\n handledResult.subscribe(subscriber);\n }\n });\n}\n","import { mergeMap } from './mergeMap';\nimport { isFunction } from '../util/isFunction';\nexport function concatMap(project, resultSelector) {\n return isFunction(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1);\n}\n","import { asyncScheduler } from '../scheduler/async';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function debounceTime(dueTime, scheduler = asyncScheduler) {\n return operate((source, subscriber) => {\n let activeTask = null;\n let lastValue = null;\n let lastTime = null;\n const emit = () => {\n if (activeTask) {\n activeTask.unsubscribe();\n activeTask = null;\n const value = lastValue;\n lastValue = null;\n subscriber.next(value);\n }\n };\n function emitWhenIdle() {\n const targetTime = lastTime + dueTime;\n const now = scheduler.now();\n if (now < targetTime) {\n activeTask = this.schedule(undefined, targetTime - now);\n subscriber.add(activeTask);\n return;\n }\n emit();\n }\n source.subscribe(createOperatorSubscriber(subscriber, (value) => {\n lastValue = value;\n lastTime = scheduler.now();\n if (!activeTask) {\n activeTask = scheduler.schedule(emitWhenIdle, dueTime);\n subscriber.add(activeTask);\n }\n }, () => {\n emit();\n subscriber.complete();\n }, undefined, () => {\n lastValue = activeTask = null;\n }));\n });\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function defaultIfEmpty(defaultValue) {\n return operate((source, subscriber) => {\n let hasValue = false;\n source.subscribe(createOperatorSubscriber(subscriber, (value) => {\n hasValue = true;\n subscriber.next(value);\n }, () => {\n if (!hasValue) {\n subscriber.next(defaultValue);\n }\n subscriber.complete();\n }));\n });\n}\n","import { concat } from '../observable/concat';\nimport { take } from './take';\nimport { ignoreElements } from './ignoreElements';\nimport { mapTo } from './mapTo';\nimport { mergeMap } from './mergeMap';\nimport { innerFrom } from '../observable/innerFrom';\nexport function delayWhen(delayDurationSelector, subscriptionDelay) {\n if (subscriptionDelay) {\n return (source) => concat(subscriptionDelay.pipe(take(1), ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));\n }\n return mergeMap((value, index) => innerFrom(delayDurationSelector(value, index)).pipe(take(1), mapTo(value)));\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { noop } from '../util/noop';\nexport function ignoreElements() {\n return operate((source, subscriber) => {\n source.subscribe(createOperatorSubscriber(subscriber, noop));\n });\n}\n","import { asyncScheduler } from '../scheduler/async';\nimport { delayWhen } from './delayWhen';\nimport { timer } from '../observable/timer';\nexport function delay(due, scheduler = asyncScheduler) {\n const duration = timer(due, scheduler);\n return delayWhen(() => duration);\n}\n","import { identity } from '../util/identity';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function distinctUntilChanged(comparator, keySelector = identity) {\n comparator = comparator !== null && comparator !== void 0 ? comparator : defaultCompare;\n return operate((source, subscriber) => {\n let previousKey;\n let first = true;\n source.subscribe(createOperatorSubscriber(subscriber, (value) => {\n const currentKey = keySelector(value);\n if (first || !comparator(previousKey, currentKey)) {\n first = false;\n previousKey = currentKey;\n subscriber.next(value);\n }\n }));\n });\n}\nfunction defaultCompare(a, b) {\n return a === b;\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function filter(predicate, thisArg) {\n return operate((source, subscriber) => {\n let index = 0;\n source.subscribe(createOperatorSubscriber(subscriber, (value) => predicate.call(thisArg, value, index++) && subscriber.next(value)));\n });\n}\n","import { operate } from '../util/lift';\nexport function finalize(callback) {\n return operate((source, subscriber) => {\n try {\n source.subscribe(subscriber);\n }\n finally {\n subscriber.add(callback);\n }\n });\n}\n","import { EmptyError } from '../util/EmptyError';\nimport { filter } from './filter';\nimport { take } from './take';\nimport { defaultIfEmpty } from './defaultIfEmpty';\nimport { throwIfEmpty } from './throwIfEmpty';\nimport { identity } from '../util/identity';\nexport function first(predicate, defaultValue) {\n const hasDefaultValue = arguments.length >= 2;\n return (source) => source.pipe(predicate ? filter((v, i) => predicate(v, i, source)) : identity, take(1), hasDefaultValue ? defaultIfEmpty(defaultValue) : throwIfEmpty(() => new EmptyError()));\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function map(project, thisArg) {\n return operate((source, subscriber) => {\n let index = 0;\n source.subscribe(createOperatorSubscriber(subscriber, (value) => {\n subscriber.next(project.call(thisArg, value, index++));\n }));\n });\n}\n","import { map } from './map';\nexport function mapTo(value) {\n return map(() => value);\n}\n","import { mergeMap } from './mergeMap';\nimport { identity } from '../util/identity';\nexport function mergeAll(concurrent = Infinity) {\n return mergeMap(identity, concurrent);\n}\n","import { map } from './map';\nimport { innerFrom } from '../observable/innerFrom';\nimport { operate } from '../util/lift';\nimport { mergeInternals } from './mergeInternals';\nimport { isFunction } from '../util/isFunction';\nexport function mergeMap(project, resultSelector, concurrent = Infinity) {\n if (isFunction(resultSelector)) {\n return mergeMap((a, i) => map((b, ii) => resultSelector(a, b, i, ii))(innerFrom(project(a, i))), concurrent);\n }\n else if (typeof resultSelector === 'number') {\n concurrent = resultSelector;\n }\n return operate((source, subscriber) => mergeInternals(source, subscriber, project, concurrent));\n}\n","import { innerFrom } from '../observable/innerFrom';\nimport { executeSchedule } from '../util/executeSchedule';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {\n const buffer = [];\n let active = 0;\n let index = 0;\n let isComplete = false;\n const checkComplete = () => {\n if (isComplete && !buffer.length && !active) {\n subscriber.complete();\n }\n };\n const outerNext = (value) => (active < concurrent ? doInnerSub(value) : buffer.push(value));\n const doInnerSub = (value) => {\n expand && subscriber.next(value);\n active++;\n let innerComplete = false;\n innerFrom(project(value, index++)).subscribe(createOperatorSubscriber(subscriber, (innerValue) => {\n onBeforeNext === null || onBeforeNext === void 0 ? void 0 : onBeforeNext(innerValue);\n if (expand) {\n outerNext(innerValue);\n }\n else {\n subscriber.next(innerValue);\n }\n }, () => {\n innerComplete = true;\n }, undefined, () => {\n if (innerComplete) {\n try {\n active--;\n while (buffer.length && active < concurrent) {\n const bufferedValue = buffer.shift();\n if (innerSubScheduler) {\n executeSchedule(subscriber, innerSubScheduler, () => doInnerSub(bufferedValue));\n }\n else {\n doInnerSub(bufferedValue);\n }\n }\n checkComplete();\n }\n catch (err) {\n subscriber.error(err);\n }\n }\n }));\n };\n source.subscribe(createOperatorSubscriber(subscriber, outerNext, () => {\n isComplete = true;\n checkComplete();\n }));\n return () => {\n additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();\n };\n}\n","import { map } from './map';\nexport function pluck(...properties) {\n const length = properties.length;\n if (length === 0) {\n throw new Error('list of properties cannot be empty.');\n }\n return map((x) => {\n let currentProp = x;\n for (let i = 0; i < length; i++) {\n const p = currentProp === null || currentProp === void 0 ? void 0 : currentProp[properties[i]];\n if (typeof p !== 'undefined') {\n currentProp = p;\n }\n else {\n return undefined;\n }\n }\n return currentProp;\n });\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function refCount() {\n return operate((source, subscriber) => {\n let connection = null;\n source._refCount++;\n const refCounter = createOperatorSubscriber(subscriber, undefined, undefined, undefined, () => {\n if (!source || source._refCount <= 0 || 0 < --source._refCount) {\n connection = null;\n return;\n }\n const sharedConnection = source._connection;\n const conn = connection;\n connection = null;\n if (sharedConnection && (!conn || sharedConnection === conn)) {\n sharedConnection.unsubscribe();\n }\n subscriber.unsubscribe();\n });\n source.subscribe(refCounter);\n if (!refCounter.closed) {\n connection = source.connect();\n }\n });\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { identity } from '../util/identity';\nimport { timer } from '../observable/timer';\nimport { innerFrom } from '../observable/innerFrom';\nexport function retry(configOrCount = Infinity) {\n let config;\n if (configOrCount && typeof configOrCount === 'object') {\n config = configOrCount;\n }\n else {\n config = {\n count: configOrCount,\n };\n }\n const { count = Infinity, delay, resetOnSuccess: resetOnSuccess = false } = config;\n return count <= 0\n ? identity\n : operate((source, subscriber) => {\n let soFar = 0;\n let innerSub;\n const subscribeForRetry = () => {\n let syncUnsub = false;\n innerSub = source.subscribe(createOperatorSubscriber(subscriber, (value) => {\n if (resetOnSuccess) {\n soFar = 0;\n }\n subscriber.next(value);\n }, undefined, (err) => {\n if (soFar++ < count) {\n const resub = () => {\n if (innerSub) {\n innerSub.unsubscribe();\n innerSub = null;\n subscribeForRetry();\n }\n else {\n syncUnsub = true;\n }\n };\n if (delay != null) {\n const notifier = typeof delay === 'number' ? timer(delay) : innerFrom(delay(err, soFar));\n const notifierSubscriber = createOperatorSubscriber(subscriber, () => {\n notifierSubscriber.unsubscribe();\n resub();\n }, () => {\n subscriber.complete();\n });\n notifier.subscribe(notifierSubscriber);\n }\n else {\n resub();\n }\n }\n else {\n subscriber.error(err);\n }\n }));\n if (syncUnsub) {\n innerSub.unsubscribe();\n innerSub = null;\n subscribeForRetry();\n }\n };\n subscribeForRetry();\n });\n}\n","import { operate } from '../util/lift';\nimport { scanInternals } from './scanInternals';\nexport function scan(accumulator, seed) {\n return operate(scanInternals(accumulator, seed, arguments.length >= 2, true));\n}\n","import { createOperatorSubscriber } from './OperatorSubscriber';\nexport function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplete) {\n return (source, subscriber) => {\n let hasState = hasSeed;\n let state = seed;\n let index = 0;\n source.subscribe(createOperatorSubscriber(subscriber, (value) => {\n const i = index++;\n state = hasState\n ?\n accumulator(state, value, i)\n :\n ((hasState = true), value);\n emitOnNext && subscriber.next(state);\n }, emitBeforeComplete &&\n (() => {\n hasState && subscriber.next(state);\n subscriber.complete();\n })));\n };\n}\n","import { innerFrom } from '../observable/innerFrom';\nimport { Subject } from '../Subject';\nimport { SafeSubscriber } from '../Subscriber';\nimport { operate } from '../util/lift';\nexport function share(options = {}) {\n const { connector = () => new Subject(), resetOnError = true, resetOnComplete = true, resetOnRefCountZero = true } = options;\n return (wrapperSource) => {\n let connection;\n let resetConnection;\n let subject;\n let refCount = 0;\n let hasCompleted = false;\n let hasErrored = false;\n const cancelReset = () => {\n resetConnection === null || resetConnection === void 0 ? void 0 : resetConnection.unsubscribe();\n resetConnection = undefined;\n };\n const reset = () => {\n cancelReset();\n connection = subject = undefined;\n hasCompleted = hasErrored = false;\n };\n const resetAndUnsubscribe = () => {\n const conn = connection;\n reset();\n conn === null || conn === void 0 ? void 0 : conn.unsubscribe();\n };\n return operate((source, subscriber) => {\n refCount++;\n if (!hasErrored && !hasCompleted) {\n cancelReset();\n }\n const dest = (subject = subject !== null && subject !== void 0 ? subject : connector());\n subscriber.add(() => {\n refCount--;\n if (refCount === 0 && !hasErrored && !hasCompleted) {\n resetConnection = handleReset(resetAndUnsubscribe, resetOnRefCountZero);\n }\n });\n dest.subscribe(subscriber);\n if (!connection &&\n refCount > 0) {\n connection = new SafeSubscriber({\n next: (value) => dest.next(value),\n error: (err) => {\n hasErrored = true;\n cancelReset();\n resetConnection = handleReset(reset, resetOnError, err);\n dest.error(err);\n },\n complete: () => {\n hasCompleted = true;\n cancelReset();\n resetConnection = handleReset(reset, resetOnComplete);\n dest.complete();\n },\n });\n innerFrom(source).subscribe(connection);\n }\n })(wrapperSource);\n };\n}\nfunction handleReset(reset, on, ...args) {\n if (on === true) {\n reset();\n return;\n }\n if (on === false) {\n return;\n }\n const onSubscriber = new SafeSubscriber({\n next: () => {\n onSubscriber.unsubscribe();\n reset();\n },\n });\n return innerFrom(on(...args)).subscribe(onSubscriber);\n}\n","import { ReplaySubject } from '../ReplaySubject';\nimport { share } from './share';\nexport function shareReplay(configOrBufferSize, windowTime, scheduler) {\n let bufferSize;\n let refCount = false;\n if (configOrBufferSize && typeof configOrBufferSize === 'object') {\n ({ bufferSize = Infinity, windowTime = Infinity, refCount = false, scheduler } = configOrBufferSize);\n }\n else {\n bufferSize = (configOrBufferSize !== null && configOrBufferSize !== void 0 ? configOrBufferSize : Infinity);\n }\n return share({\n connector: () => new ReplaySubject(bufferSize, windowTime, scheduler),\n resetOnError: true,\n resetOnComplete: false,\n resetOnRefCountZero: refCount,\n });\n}\n","import { filter } from './filter';\nexport function skip(count) {\n return filter((_, index) => count <= index);\n}\n","import { concat } from '../observable/concat';\nimport { popScheduler } from '../util/args';\nimport { operate } from '../util/lift';\nexport function startWith(...values) {\n const scheduler = popScheduler(values);\n return operate((source, subscriber) => {\n (scheduler ? concat(values, source, scheduler) : concat(values, source)).subscribe(subscriber);\n });\n}\n","import { innerFrom } from '../observable/innerFrom';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function switchMap(project, resultSelector) {\n return operate((source, subscriber) => {\n let innerSubscriber = null;\n let index = 0;\n let isComplete = false;\n const checkComplete = () => isComplete && !innerSubscriber && subscriber.complete();\n source.subscribe(createOperatorSubscriber(subscriber, (value) => {\n innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe();\n let innerIndex = 0;\n const outerIndex = index++;\n innerFrom(project(value, outerIndex)).subscribe((innerSubscriber = createOperatorSubscriber(subscriber, (innerValue) => subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue), () => {\n innerSubscriber = null;\n checkComplete();\n })));\n }, () => {\n isComplete = true;\n checkComplete();\n }));\n });\n}\n","import { EMPTY } from '../observable/empty';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function take(count) {\n return count <= 0\n ?\n () => EMPTY\n : operate((source, subscriber) => {\n let seen = 0;\n source.subscribe(createOperatorSubscriber(subscriber, (value) => {\n if (++seen <= count) {\n subscriber.next(value);\n if (count <= seen) {\n subscriber.complete();\n }\n }\n }));\n });\n}\n","import { EMPTY } from '../observable/empty';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function takeLast(count) {\n return count <= 0\n ? () => EMPTY\n : operate((source, subscriber) => {\n let buffer = [];\n source.subscribe(createOperatorSubscriber(subscriber, (value) => {\n buffer.push(value);\n count < buffer.length && buffer.shift();\n }, () => {\n for (const value of buffer) {\n subscriber.next(value);\n }\n subscriber.complete();\n }, undefined, () => {\n buffer = null;\n }));\n });\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/innerFrom';\nimport { noop } from '../util/noop';\nexport function takeUntil(notifier) {\n return operate((source, subscriber) => {\n innerFrom(notifier).subscribe(createOperatorSubscriber(subscriber, () => subscriber.complete(), noop));\n !subscriber.closed && source.subscribe(subscriber);\n });\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function takeWhile(predicate, inclusive = false) {\n return operate((source, subscriber) => {\n let index = 0;\n source.subscribe(createOperatorSubscriber(subscriber, (value) => {\n const result = predicate(value, index++);\n (result || inclusive) && subscriber.next(value);\n !result && subscriber.complete();\n }));\n });\n}\n","import { isFunction } from '../util/isFunction';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { identity } from '../util/identity';\nexport function tap(observerOrNext, error, complete) {\n const tapObserver = isFunction(observerOrNext) || error || complete\n ?\n { next: observerOrNext, error, complete }\n : observerOrNext;\n return tapObserver\n ? operate((source, subscriber) => {\n var _a;\n (_a = tapObserver.subscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);\n let isUnsub = true;\n source.subscribe(createOperatorSubscriber(subscriber, (value) => {\n var _a;\n (_a = tapObserver.next) === null || _a === void 0 ? void 0 : _a.call(tapObserver, value);\n subscriber.next(value);\n }, () => {\n var _a;\n isUnsub = false;\n (_a = tapObserver.complete) === null || _a === void 0 ? void 0 : _a.call(tapObserver);\n subscriber.complete();\n }, (err) => {\n var _a;\n isUnsub = false;\n (_a = tapObserver.error) === null || _a === void 0 ? void 0 : _a.call(tapObserver, err);\n subscriber.error(err);\n }, () => {\n var _a, _b;\n if (isUnsub) {\n (_a = tapObserver.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);\n }\n (_b = tapObserver.finalize) === null || _b === void 0 ? void 0 : _b.call(tapObserver);\n }));\n })\n :\n identity;\n}\n","import { asyncScheduler } from '../scheduler/async';\nimport { throttle } from './throttle';\nimport { timer } from '../observable/timer';\nexport function throttleTime(duration, scheduler = asyncScheduler, config) {\n const duration$ = timer(duration, scheduler);\n return throttle(() => duration$, config);\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/innerFrom';\nexport function throttle(durationSelector, config) {\n return operate((source, subscriber) => {\n const { leading = true, trailing = false } = config !== null && config !== void 0 ? config : {};\n let hasValue = false;\n let sendValue = null;\n let throttled = null;\n let isComplete = false;\n const endThrottling = () => {\n throttled === null || throttled === void 0 ? void 0 : throttled.unsubscribe();\n throttled = null;\n if (trailing) {\n send();\n isComplete && subscriber.complete();\n }\n };\n const cleanupThrottling = () => {\n throttled = null;\n isComplete && subscriber.complete();\n };\n const startThrottle = (value) => (throttled = innerFrom(durationSelector(value)).subscribe(createOperatorSubscriber(subscriber, endThrottling, cleanupThrottling)));\n const send = () => {\n if (hasValue) {\n hasValue = false;\n const value = sendValue;\n sendValue = null;\n subscriber.next(value);\n !isComplete && startThrottle(value);\n }\n };\n source.subscribe(createOperatorSubscriber(subscriber, (value) => {\n hasValue = true;\n sendValue = value;\n !(throttled && !throttled.closed) && (leading ? send() : startThrottle(value));\n }, () => {\n isComplete = true;\n !(trailing && hasValue && throttled && !throttled.closed) && subscriber.complete();\n }));\n });\n}\n","import { EmptyError } from '../util/EmptyError';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function throwIfEmpty(errorFactory = defaultErrorFactory) {\n return operate((source, subscriber) => {\n let hasValue = false;\n source.subscribe(createOperatorSubscriber(subscriber, (value) => {\n hasValue = true;\n subscriber.next(value);\n }, () => (hasValue ? subscriber.complete() : subscriber.error(errorFactory()))));\n });\n}\nfunction defaultErrorFactory() {\n return new EmptyError();\n}\n","import { Subscription } from '../Subscription';\nexport class Action extends Subscription {\n constructor(scheduler, work) {\n super();\n }\n schedule(state, delay = 0) {\n return this;\n }\n}\n","export const intervalProvider = {\n setInterval(handler, timeout, ...args) {\n const { delegate } = intervalProvider;\n if (delegate === null || delegate === void 0 ? void 0 : 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 === null || delegate === void 0 ? void 0 : delegate.clearInterval) || clearInterval)(handle);\n },\n delegate: undefined,\n};\n","import { Action } from './Action';\nimport { intervalProvider } from './intervalProvider';\nimport { arrRemove } from '../util/arrRemove';\nexport class AsyncAction extends Action {\n constructor(scheduler, work) {\n super(scheduler, work);\n this.scheduler = scheduler;\n this.work = work;\n this.pending = false;\n }\n schedule(state, delay = 0) {\n var _a;\n if (this.closed) {\n return this;\n }\n this.state = state;\n const id = this.id;\n const scheduler = this.scheduler;\n if (id != null) {\n this.id = this.recycleAsyncId(scheduler, id, delay);\n }\n this.pending = true;\n this.delay = delay;\n this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay);\n return this;\n }\n requestAsyncId(scheduler, _id, delay = 0) {\n return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);\n }\n recycleAsyncId(_scheduler, id, delay = 0) {\n if (delay != null && this.delay === delay && this.pending === false) {\n return id;\n }\n if (id != null) {\n intervalProvider.clearInterval(id);\n }\n return undefined;\n }\n execute(state, delay) {\n if (this.closed) {\n return new Error('executing a cancelled action');\n }\n this.pending = false;\n const error = this._execute(state, delay);\n if (error) {\n return error;\n }\n else if (this.pending === false && this.id != null) {\n this.id = this.recycleAsyncId(this.scheduler, this.id, null);\n }\n }\n _execute(state, _delay) {\n let errored = false;\n let errorValue;\n try {\n this.work(state);\n }\n catch (e) {\n errored = true;\n errorValue = e ? e : new Error('Scheduled action threw falsy error');\n }\n if (errored) {\n this.unsubscribe();\n return errorValue;\n }\n }\n unsubscribe() {\n if (!this.closed) {\n const { id, scheduler } = this;\n const { actions } = scheduler;\n this.work = this.state = this.scheduler = null;\n this.pending = false;\n arrRemove(actions, this);\n if (id != null) {\n this.id = this.recycleAsyncId(scheduler, id, null);\n }\n this.delay = null;\n super.unsubscribe();\n }\n }\n}\n","import { dateTimestampProvider } from './scheduler/dateTimestampProvider';\nexport class Scheduler {\n constructor(schedulerActionCtor, now = Scheduler.now) {\n this.schedulerActionCtor = schedulerActionCtor;\n this.now = now;\n }\n schedule(work, delay = 0, state) {\n return new this.schedulerActionCtor(this, work).schedule(state, delay);\n }\n}\nScheduler.now = dateTimestampProvider.now;\n","import { Scheduler } from '../Scheduler';\nexport class AsyncScheduler extends Scheduler {\n constructor(SchedulerAction, now = Scheduler.now) {\n super(SchedulerAction, now);\n this.actions = [];\n this._active = false;\n }\n flush(action) {\n const { actions } = this;\n if (this._active) {\n actions.push(action);\n return;\n }\n let error;\n this._active = true;\n do {\n if ((error = action.execute(action.state, action.delay))) {\n break;\n }\n } while ((action = actions.shift()));\n this._active = false;\n if (error) {\n while ((action = actions.shift())) {\n action.unsubscribe();\n }\n throw error;\n }\n }\n}\n","import { Subscription } from '../Subscription';\nexport const animationFrameProvider = {\n schedule(callback) {\n let request = requestAnimationFrame;\n let cancel = cancelAnimationFrame;\n const { delegate } = animationFrameProvider;\n if (delegate) {\n request = delegate.requestAnimationFrame;\n cancel = delegate.cancelAnimationFrame;\n }\n const handle = request((timestamp) => {\n cancel = undefined;\n callback(timestamp);\n });\n return new Subscription(() => cancel === null || cancel === void 0 ? void 0 : cancel(handle));\n },\n requestAnimationFrame(...args) {\n const { delegate } = animationFrameProvider;\n return ((delegate === null || delegate === void 0 ? void 0 : delegate.requestAnimationFrame) || requestAnimationFrame)(...args);\n },\n cancelAnimationFrame(...args) {\n const { delegate } = animationFrameProvider;\n return ((delegate === null || delegate === void 0 ? void 0 : delegate.cancelAnimationFrame) || cancelAnimationFrame)(...args);\n },\n delegate: undefined,\n};\n","import { AnimationFrameAction } from './AnimationFrameAction';\nimport { AnimationFrameScheduler } from './AnimationFrameScheduler';\nexport const animationFrameScheduler = new AnimationFrameScheduler(AnimationFrameAction);\nexport const animationFrame = animationFrameScheduler;\n","import { AsyncScheduler } from './AsyncScheduler';\nexport class AnimationFrameScheduler extends AsyncScheduler {\n flush(action) {\n this._active = true;\n const flushId = this._scheduled;\n this._scheduled = undefined;\n const { actions } = this;\n let error;\n action = action || actions.shift();\n do {\n if ((error = action.execute(action.state, action.delay))) {\n break;\n }\n } while ((action = actions[0]) && action.id === flushId && actions.shift());\n this._active = false;\n if (error) {\n while ((action = actions[0]) && action.id === flushId && actions.shift()) {\n action.unsubscribe();\n }\n throw error;\n }\n }\n}\n","import { AsyncAction } from './AsyncAction';\nimport { animationFrameProvider } from './animationFrameProvider';\nexport class AnimationFrameAction extends AsyncAction {\n constructor(scheduler, work) {\n super(scheduler, work);\n this.scheduler = scheduler;\n this.work = work;\n }\n requestAsyncId(scheduler, id, delay = 0) {\n if (delay !== null && delay > 0) {\n return super.requestAsyncId(scheduler, id, delay);\n }\n scheduler.actions.push(this);\n return scheduler._scheduled || (scheduler._scheduled = animationFrameProvider.requestAnimationFrame(() => scheduler.flush(undefined)));\n }\n recycleAsyncId(scheduler, id, delay = 0) {\n var _a;\n if (delay != null ? delay > 0 : this.delay > 0) {\n return super.recycleAsyncId(scheduler, id, delay);\n }\n const { actions } = scheduler;\n if (id != null && ((_a = actions[actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== id) {\n animationFrameProvider.cancelAnimationFrame(id);\n scheduler._scheduled = undefined;\n }\n return undefined;\n }\n}\n","import { AsyncAction } from './AsyncAction';\nimport { AsyncScheduler } from './AsyncScheduler';\nexport const asyncScheduler = new AsyncScheduler(AsyncAction);\nexport const async = asyncScheduler;\n","export const dateTimestampProvider = {\n now() {\n return (dateTimestampProvider.delegate || Date).now();\n },\n delegate: undefined,\n};\n","export const timeoutProvider = {\n setTimeout(handler, timeout, ...args) {\n const { delegate } = timeoutProvider;\n if (delegate === null || delegate === void 0 ? void 0 : 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 === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);\n },\n delegate: undefined,\n};\n","export function getSymbolIterator() {\n if (typeof Symbol !== 'function' || !Symbol.iterator) {\n return '@@iterator';\n }\n return Symbol.iterator;\n}\nexport const iterator = getSymbolIterator();\n","export const observable = (() => (typeof Symbol === 'function' && Symbol.observable) || '@@observable')();\n","import { createErrorClass } from './createErrorClass';\nexport const EmptyError = createErrorClass((_super) => function EmptyErrorImpl() {\n _super(this);\n this.name = 'EmptyError';\n this.message = 'no elements in sequence';\n});\n","import { isFunction } from './isFunction';\nimport { isScheduler } from './isScheduler';\nfunction last(arr) {\n return arr[arr.length - 1];\n}\nexport function popResultSelector(args) {\n return isFunction(last(args)) ? args.pop() : undefined;\n}\nexport function popScheduler(args) {\n return isScheduler(last(args)) ? args.pop() : undefined;\n}\nexport function popNumber(args, defaultValue) {\n return typeof last(args) === 'number' ? args.pop() : defaultValue;\n}\n","const { isArray } = Array;\nconst { getPrototypeOf, prototype: objectProto, keys: getKeys } = Object;\nexport function argsArgArrayOrObject(args) {\n if (args.length === 1) {\n const first = args[0];\n if (isArray(first)) {\n return { args: first, keys: null };\n }\n if (isPOJO(first)) {\n const keys = getKeys(first);\n return {\n args: keys.map((key) => first[key]),\n keys,\n };\n }\n }\n return { args: args, keys: null };\n}\nfunction isPOJO(obj) {\n return obj && typeof obj === 'object' && getPrototypeOf(obj) === objectProto;\n}\n","const { isArray } = Array;\nexport function argsOrArgArray(args) {\n return args.length === 1 && isArray(args[0]) ? args[0] : args;\n}\n","export function arrRemove(arr, item) {\n if (arr) {\n const index = arr.indexOf(item);\n 0 <= index && arr.splice(index, 1);\n }\n}\n","export function createErrorClass(createImpl) {\n const _super = (instance) => {\n Error.call(instance);\n instance.stack = new Error().stack;\n };\n const ctorFunc = createImpl(_super);\n ctorFunc.prototype = Object.create(Error.prototype);\n ctorFunc.prototype.constructor = ctorFunc;\n return ctorFunc;\n}\n","export function createObject(keys, values) {\n return keys.reduce((result, key, i) => ((result[key] = values[i]), result), {});\n}\n","import { config } from '../config';\nlet context = null;\nexport function errorContext(cb) {\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 }\n else {\n cb();\n }\n}\nexport function captureError(err) {\n if (config.useDeprecatedSynchronousErrorHandling && context) {\n context.errorThrown = true;\n context.error = err;\n }\n}\n","export function executeSchedule(parentSubscription, scheduler, work, delay = 0, repeat = false) {\n const scheduleSubscription = scheduler.schedule(function () {\n work();\n if (repeat) {\n parentSubscription.add(this.schedule(null, delay));\n }\n else {\n this.unsubscribe();\n }\n }, delay);\n parentSubscription.add(scheduleSubscription);\n if (!repeat) {\n return scheduleSubscription;\n }\n}\n","export function identity(x) {\n return x;\n}\n","export const isArrayLike = ((x) => x && typeof x.length === 'number' && typeof x !== 'function');\n","import { isFunction } from './isFunction';\nexport function isAsyncIterable(obj) {\n return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);\n}\n","export function isValidDate(value) {\n return value instanceof Date && !isNaN(value);\n}\n","export function isFunction(value) {\n return typeof value === 'function';\n}\n","import { observable as Symbol_observable } from '../symbol/observable';\nimport { isFunction } from './isFunction';\nexport function isInteropObservable(input) {\n return isFunction(input[Symbol_observable]);\n}\n","import { iterator as Symbol_iterator } from '../symbol/iterator';\nimport { isFunction } from './isFunction';\nexport function isIterable(input) {\n return isFunction(input === null || input === void 0 ? void 0 : input[Symbol_iterator]);\n}\n","import { Observable } from '../Observable';\nimport { isFunction } from './isFunction';\nexport function isObservable(obj) {\n return !!obj && (obj instanceof Observable || (isFunction(obj.lift) && isFunction(obj.subscribe)));\n}\n","import { isFunction } from \"./isFunction\";\nexport function isPromise(value) {\n return isFunction(value === null || value === void 0 ? void 0 : value.then);\n}\n","import { __asyncGenerator, __await } from \"tslib\";\nimport { isFunction } from './isFunction';\nexport function readableStreamLikeToAsyncGenerator(readableStream) {\n return __asyncGenerator(this, arguments, function* readableStreamLikeToAsyncGenerator_1() {\n const reader = readableStream.getReader();\n try {\n while (true) {\n const { value, done } = yield __await(reader.read());\n if (done) {\n return yield __await(void 0);\n }\n yield yield __await(value);\n }\n }\n finally {\n reader.releaseLock();\n }\n });\n}\nexport function isReadableStreamLike(obj) {\n return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader);\n}\n","import { isFunction } from './isFunction';\nexport function isScheduler(value) {\n return value && isFunction(value.schedule);\n}\n","import { isFunction } from './isFunction';\nexport function hasLift(source) {\n return isFunction(source === null || source === void 0 ? void 0 : source.lift);\n}\nexport function operate(init) {\n return (source) => {\n if (hasLift(source)) {\n return source.lift(function (liftedSource) {\n try {\n return init(liftedSource, this);\n }\n catch (err) {\n this.error(err);\n }\n });\n }\n throw new TypeError('Unable to lift unknown Observable type');\n };\n}\n","import { map } from \"../operators/map\";\nconst { isArray } = Array;\nfunction callOrApply(fn, args) {\n return isArray(args) ? fn(...args) : fn(args);\n}\nexport function mapOneOrManyArgs(fn) {\n return map(args => callOrApply(fn, args));\n}\n","export function noop() { }\n","import { identity } from './identity';\nexport function pipe(...fns) {\n return pipeFromArray(fns);\n}\nexport function pipeFromArray(fns) {\n if (fns.length === 0) {\n return identity;\n }\n if (fns.length === 1) {\n return fns[0];\n }\n return function piped(input) {\n return fns.reduce((prev, fn) => fn(prev), input);\n };\n}\n","import { config } from '../config';\nimport { timeoutProvider } from '../scheduler/timeoutProvider';\nexport function reportUnhandledError(err) {\n timeoutProvider.setTimeout(() => {\n const { onUnhandledError } = config;\n if (onUnhandledError) {\n onUnhandledError(err);\n }\n else {\n throw err;\n }\n });\n}\n","export function createInvalidObservableTypeError(input) {\n return new TypeError(`You provided ${input !== null && typeof input === 'object' ? 'an invalid object' : `'${input}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`);\n}\n","/**\n * @license Angular v18.0.6\n * (c) 2010-2024 Google LLC. https://angular.io/\n * License: MIT\n */\n\nimport { DOCUMENT } from '@angular/common';\nimport * as i0 from '@angular/core';\nimport { inject, Injectable, ANIMATION_MODULE_TYPE, ViewEncapsulation, ɵRuntimeError, Inject } from '@angular/core';\n\n/**\n * @description Constants for the categories of parameters that can be defined for animations.\n *\n * A corresponding function defines a set of parameters for each category, and\n * collects them into a corresponding `AnimationMetadata` object.\n *\n * @publicApi\n */\nvar AnimationMetadataType;\n(function (AnimationMetadataType) {\n /**\n * Associates a named animation state with a set of CSS styles.\n * See [`state()`](api/animations/state)\n */\n AnimationMetadataType[AnimationMetadataType[\"State\"] = 0] = \"State\";\n /**\n * Data for a transition from one animation state to another.\n * See `transition()`\n */\n AnimationMetadataType[AnimationMetadataType[\"Transition\"] = 1] = \"Transition\";\n /**\n * Contains a set of animation steps.\n * See `sequence()`\n */\n AnimationMetadataType[AnimationMetadataType[\"Sequence\"] = 2] = \"Sequence\";\n /**\n * Contains a set of animation steps.\n * See `{@link animations/group group()}`\n */\n AnimationMetadataType[AnimationMetadataType[\"Group\"] = 3] = \"Group\";\n /**\n * Contains an animation step.\n * See `animate()`\n */\n AnimationMetadataType[AnimationMetadataType[\"Animate\"] = 4] = \"Animate\";\n /**\n * Contains a set of animation steps.\n * See `keyframes()`\n */\n AnimationMetadataType[AnimationMetadataType[\"Keyframes\"] = 5] = \"Keyframes\";\n /**\n * Contains a set of CSS property-value pairs into a named style.\n * See `style()`\n */\n AnimationMetadataType[AnimationMetadataType[\"Style\"] = 6] = \"Style\";\n /**\n * Associates an animation with an entry trigger that can be attached to an element.\n * See `trigger()`\n */\n AnimationMetadataType[AnimationMetadataType[\"Trigger\"] = 7] = \"Trigger\";\n /**\n * Contains a re-usable animation.\n * See `animation()`\n */\n AnimationMetadataType[AnimationMetadataType[\"Reference\"] = 8] = \"Reference\";\n /**\n * Contains data to use in executing child animations returned by a query.\n * See `animateChild()`\n */\n AnimationMetadataType[AnimationMetadataType[\"AnimateChild\"] = 9] = \"AnimateChild\";\n /**\n * Contains animation parameters for a re-usable animation.\n * See `useAnimation()`\n */\n AnimationMetadataType[AnimationMetadataType[\"AnimateRef\"] = 10] = \"AnimateRef\";\n /**\n * Contains child-animation query data.\n * See `query()`\n */\n AnimationMetadataType[AnimationMetadataType[\"Query\"] = 11] = \"Query\";\n /**\n * Contains data for staggering an animation sequence.\n * See `stagger()`\n */\n AnimationMetadataType[AnimationMetadataType[\"Stagger\"] = 12] = \"Stagger\";\n})(AnimationMetadataType || (AnimationMetadataType = {}));\n/**\n * Specifies automatic styling.\n *\n * @publicApi\n */\nconst AUTO_STYLE = '*';\n/**\n * Creates a named animation trigger, containing a list of [`state()`](api/animations/state)\n * and `transition()` entries to be evaluated when the expression\n * bound to the trigger changes.\n *\n * @param name An identifying string.\n * @param definitions An animation definition object, containing an array of\n * [`state()`](api/animations/state) and `transition()` declarations.\n *\n * @return An object that encapsulates the trigger data.\n *\n * @usageNotes\n * Define an animation trigger in the `animations` section of `@Component` metadata.\n * In the template, reference the trigger by name and bind it to a trigger expression that\n * evaluates to a defined animation state, using the following format:\n *\n * `[@triggerName]=\"expression\"`\n *\n * Animation trigger bindings convert all values to strings, and then match the\n * previous and current values against any linked transitions.\n * Booleans can be specified as `1` or `true` and `0` or `false`.\n *\n * ### Usage Example\n *\n * The following example creates an animation trigger reference based on the provided\n * name value.\n * The provided animation value is expected to be an array consisting of state and\n * transition declarations.\n *\n * ```typescript\n * @Component({\n * selector: \"my-component\",\n * templateUrl: \"my-component-tpl.html\",\n * animations: [\n * trigger(\"myAnimationTrigger\", [\n * state(...),\n * state(...),\n * transition(...),\n * transition(...)\n * ])\n * ]\n * })\n * class MyComponent {\n * myStatusExp = \"something\";\n * }\n * ```\n *\n * The template associated with this component makes use of the defined trigger\n * by binding to an element within its template code.\n *\n * ```html\n * \n *
...
\n * ```\n *\n * ### Using an inline function\n * The `transition` animation method also supports reading an inline function which can decide\n * if its associated animation should be run.\n *\n * ```typescript\n * // this method is run each time the `myAnimationTrigger` trigger value changes.\n * function myInlineMatcherFn(fromState: string, toState: string, element: any, params: {[key:\n string]: any}): boolean {\n * // notice that `element` and `params` are also available here\n * return toState == 'yes-please-animate';\n * }\n *\n * @Component({\n * selector: 'my-component',\n * templateUrl: 'my-component-tpl.html',\n * animations: [\n * trigger('myAnimationTrigger', [\n * transition(myInlineMatcherFn, [\n * // the animation sequence code\n * ]),\n * ])\n * ]\n * })\n * class MyComponent {\n * myStatusExp = \"yes-please-animate\";\n * }\n * ```\n *\n * ### Disabling Animations\n * When true, the special animation control binding `@.disabled` binding prevents\n * all animations from rendering.\n * Place the `@.disabled` binding on an element to disable\n * animations on the element itself, as well as any inner animation triggers\n * within the element.\n *\n * The following example shows how to use this feature:\n *\n * ```typescript\n * @Component({\n * selector: 'my-component',\n * template: `\n *
\n *
\n *
\n * `,\n * animations: [\n * trigger(\"childAnimation\", [\n * // ...\n * ])\n * ]\n * })\n * class MyComponent {\n * isDisabled = true;\n * exp = '...';\n * }\n * ```\n *\n * When `@.disabled` is true, it prevents the `@childAnimation` trigger from animating,\n * along with any inner animations.\n *\n * ### Disable animations application-wide\n * When an area of the template is set to have animations disabled,\n * **all** inner components have their animations disabled as well.\n * This means that you can disable all animations for an app\n * by placing a host binding set on `@.disabled` on the topmost Angular component.\n *\n * ```typescript\n * import {Component, HostBinding} from '@angular/core';\n *\n * @Component({\n * selector: 'app-component',\n * templateUrl: 'app.component.html',\n * })\n * class AppComponent {\n * @HostBinding('@.disabled')\n * public animationsDisabled = true;\n * }\n * ```\n *\n * ### Overriding disablement of inner animations\n * Despite inner animations being disabled, a parent animation can `query()`\n * for inner elements located in disabled areas of the template and still animate\n * them if needed. This is also the case for when a sub animation is\n * queried by a parent and then later animated using `animateChild()`.\n *\n * ### Detecting when an animation is disabled\n * If a region of the DOM (or the entire application) has its animations disabled, the animation\n * trigger callbacks still fire, but for zero seconds. When the callback fires, it provides\n * an instance of an `AnimationEvent`. If animations are disabled,\n * the `.disabled` flag on the event is true.\n *\n * @publicApi\n */\nfunction trigger(name, definitions) {\n return { type: AnimationMetadataType.Trigger, name, definitions, options: {} };\n}\n/**\n * Defines an animation step that combines styling information with timing information.\n *\n * @param timings Sets `AnimateTimings` for the parent animation.\n * A string in the format \"duration [delay] [easing]\".\n * - Duration and delay are expressed as a number and optional time unit,\n * such as \"1s\" or \"10ms\" for one second and 10 milliseconds, respectively.\n * The default unit is milliseconds.\n * - The easing value controls how the animation accelerates and decelerates\n * during its runtime. Value is one of `ease`, `ease-in`, `ease-out`,\n * `ease-in-out`, or a `cubic-bezier()` function call.\n * If not supplied, no easing is applied.\n *\n * For example, the string \"1s 100ms ease-out\" specifies a duration of\n * 1000 milliseconds, and delay of 100 ms, and the \"ease-out\" easing style,\n * which decelerates near the end of the duration.\n * @param styles Sets AnimationStyles for the parent animation.\n * A function call to either `style()` or `keyframes()`\n * that returns a collection of CSS style entries to be applied to the parent animation.\n * When null, uses the styles from the destination state.\n * This is useful when describing an animation step that will complete an animation;\n * see \"Animating to the final state\" in `transitions()`.\n * @returns An object that encapsulates the animation step.\n *\n * @usageNotes\n * Call within an animation `sequence()`, `{@link animations/group group()}`, or\n * `transition()` call to specify an animation step\n * that applies given style data to the parent animation for a given amount of time.\n *\n * ### Syntax Examples\n * **Timing examples**\n *\n * The following examples show various `timings` specifications.\n * - `animate(500)` : Duration is 500 milliseconds.\n * - `animate(\"1s\")` : Duration is 1000 milliseconds.\n * - `animate(\"100ms 0.5s\")` : Duration is 100 milliseconds, delay is 500 milliseconds.\n * - `animate(\"5s ease-in\")` : Duration is 5000 milliseconds, easing in.\n * - `animate(\"5s 10ms cubic-bezier(.17,.67,.88,.1)\")` : Duration is 5000 milliseconds, delay is 10\n * milliseconds, easing according to a bezier curve.\n *\n * **Style examples**\n *\n * The following example calls `style()` to set a single CSS style.\n * ```typescript\n * animate(500, style({ background: \"red\" }))\n * ```\n * The following example calls `keyframes()` to set a CSS style\n * to different values for successive keyframes.\n * ```typescript\n * animate(500, keyframes(\n * [\n * style({ background: \"blue\" }),\n * style({ background: \"red\" })\n * ])\n * ```\n *\n * @publicApi\n */\nfunction animate(timings, styles = null) {\n return { type: AnimationMetadataType.Animate, styles, timings };\n}\n/**\n * @description Defines a list of animation steps to be run in parallel.\n *\n * @param steps An array of animation step objects.\n * - When steps are defined by `style()` or `animate()`\n * function calls, each call within the group is executed instantly.\n * - To specify offset styles to be applied at a later time, define steps with\n * `keyframes()`, or use `animate()` calls with a delay value.\n * For example:\n *\n * ```typescript\n * group([\n * animate(\"1s\", style({ background: \"black\" })),\n * animate(\"2s\", style({ color: \"white\" }))\n * ])\n * ```\n *\n * @param options An options object containing a delay and\n * developer-defined parameters that provide styling defaults and\n * can be overridden on invocation.\n *\n * @return An object that encapsulates the group data.\n *\n * @usageNotes\n * Grouped animations are useful when a series of styles must be\n * animated at different starting times and closed off at different ending times.\n *\n * When called within a `sequence()` or a\n * `transition()` call, does not continue to the next\n * instruction until all of the inner animation steps have completed.\n *\n * @publicApi\n */\nfunction group(steps, options = null) {\n return { type: AnimationMetadataType.Group, steps, options };\n}\n/**\n * Defines a list of animation steps to be run sequentially, one by one.\n *\n * @param steps An array of animation step objects.\n * - Steps defined by `style()` calls apply the styling data immediately.\n * - Steps defined by `animate()` calls apply the styling data over time\n * as specified by the timing data.\n *\n * ```typescript\n * sequence([\n * style({ opacity: 0 }),\n * animate(\"1s\", style({ opacity: 1 }))\n * ])\n * ```\n *\n * @param options An options object containing a delay and\n * developer-defined parameters that provide styling defaults and\n * can be overridden on invocation.\n *\n * @return An object that encapsulates the sequence data.\n *\n * @usageNotes\n * When you pass an array of steps to a\n * `transition()` call, the steps run sequentially by default.\n * Compare this to the `{@link animations/group group()}` call, which runs animation steps in\n *parallel.\n *\n * When a sequence is used within a `{@link animations/group group()}` or a `transition()` call,\n * execution continues to the next instruction only after each of the inner animation\n * steps have completed.\n *\n * @publicApi\n **/\nfunction sequence(steps, options = null) {\n return { type: AnimationMetadataType.Sequence, steps, options };\n}\n/**\n * Declares a key/value object containing CSS properties/styles that\n * can then be used for an animation [`state`](api/animations/state), within an animation\n *`sequence`, or as styling data for calls to `animate()` and `keyframes()`.\n *\n * @param tokens A set of CSS styles or HTML styles associated with an animation state.\n * The value can be any of the following:\n * - A key-value style pair associating a CSS property with a value.\n * - An array of key-value style pairs.\n * - An asterisk (*), to use auto-styling, where styles are derived from the element\n * being animated and applied to the animation when it starts.\n *\n * Auto-styling can be used to define a state that depends on layout or other\n * environmental factors.\n *\n * @return An object that encapsulates the style data.\n *\n * @usageNotes\n * The following examples create animation styles that collect a set of\n * CSS property values:\n *\n * ```typescript\n * // string values for CSS properties\n * style({ background: \"red\", color: \"blue\" })\n *\n * // numerical pixel values\n * style({ width: 100, height: 0 })\n * ```\n *\n * The following example uses auto-styling to allow an element to animate from\n * a height of 0 up to its full height:\n *\n * ```\n * style({ height: 0 }),\n * animate(\"1s\", style({ height: \"*\" }))\n * ```\n *\n * @publicApi\n **/\nfunction style(tokens) {\n return { type: AnimationMetadataType.Style, styles: tokens, offset: null };\n}\n/**\n * Declares an animation state within a trigger attached to an element.\n *\n * @param name One or more names for the defined state in a comma-separated string.\n * The following reserved state names can be supplied to define a style for specific use\n * cases:\n *\n * - `void` You can associate styles with this name to be used when\n * the element is detached from the application. For example, when an `ngIf` evaluates\n * to false, the state of the associated element is void.\n * - `*` (asterisk) Indicates the default state. You can associate styles with this name\n * to be used as the fallback when the state that is being animated is not declared\n * within the trigger.\n *\n * @param styles A set of CSS styles associated with this state, created using the\n * `style()` function.\n * This set of styles persists on the element once the state has been reached.\n * @param options Parameters that can be passed to the state when it is invoked.\n * 0 or more key-value pairs.\n * @return An object that encapsulates the new state data.\n *\n * @usageNotes\n * Use the `trigger()` function to register states to an animation trigger.\n * Use the `transition()` function to animate between states.\n * When a state is active within a component, its associated styles persist on the element,\n * even when the animation ends.\n *\n * @publicApi\n **/\nfunction state(name, styles, options) {\n return { type: AnimationMetadataType.State, name, styles, options };\n}\n/**\n * Defines a set of animation styles, associating each style with an optional `offset` value.\n *\n * @param steps A set of animation styles with optional offset data.\n * The optional `offset` value for a style specifies a percentage of the total animation\n * time at which that style is applied.\n * @returns An object that encapsulates the keyframes data.\n *\n * @usageNotes\n * Use with the `animate()` call. Instead of applying animations\n * from the current state\n * to the destination state, keyframes describe how each style entry is applied and at what point\n * within the animation arc.\n * Compare [CSS Keyframe Animations](https://www.w3schools.com/css/css3_animations.asp).\n *\n * ### Usage\n *\n * In the following example, the offset values describe\n * when each `backgroundColor` value is applied. The color is red at the start, and changes to\n * blue when 20% of the total time has elapsed.\n *\n * ```typescript\n * // the provided offset values\n * animate(\"5s\", keyframes([\n * style({ backgroundColor: \"red\", offset: 0 }),\n * style({ backgroundColor: \"blue\", offset: 0.2 }),\n * style({ backgroundColor: \"orange\", offset: 0.3 }),\n * style({ backgroundColor: \"black\", offset: 1 })\n * ]))\n * ```\n *\n * If there are no `offset` values specified in the style entries, the offsets\n * are calculated automatically.\n *\n * ```typescript\n * animate(\"5s\", keyframes([\n * style({ backgroundColor: \"red\" }) // offset = 0\n * style({ backgroundColor: \"blue\" }) // offset = 0.33\n * style({ backgroundColor: \"orange\" }) // offset = 0.66\n * style({ backgroundColor: \"black\" }) // offset = 1\n * ]))\n *```\n\n * @publicApi\n */\nfunction keyframes(steps) {\n return { type: AnimationMetadataType.Keyframes, steps };\n}\n/**\n * Declares an animation transition which is played when a certain specified condition is met.\n *\n * @param stateChangeExpr A string with a specific format or a function that specifies when the\n * animation transition should occur (see [State Change Expression](#state-change-expression)).\n *\n * @param steps One or more animation objects that represent the animation's instructions.\n *\n * @param options An options object that can be used to specify a delay for the animation or provide\n * custom parameters for it.\n *\n * @returns An object that encapsulates the transition data.\n *\n * @usageNotes\n *\n * ### State Change Expression\n *\n * The State Change Expression instructs Angular when to run the transition's animations, it can\n *either be\n * - a string with a specific syntax\n * - or a function that compares the previous and current state (value of the expression bound to\n * the element's trigger) and returns `true` if the transition should occur or `false` otherwise\n *\n * The string format can be:\n * - `fromState => toState`, which indicates that the transition's animations should occur then the\n * expression bound to the trigger's element goes from `fromState` to `toState`\n *\n * _Example:_\n * ```typescript\n * transition('open => closed', animate('.5s ease-out', style({ height: 0 }) ))\n * ```\n *\n * - `fromState <=> toState`, which indicates that the transition's animations should occur then\n * the expression bound to the trigger's element goes from `fromState` to `toState` or vice versa\n *\n * _Example:_\n * ```typescript\n * transition('enabled <=> disabled', animate('1s cubic-bezier(0.8,0.3,0,1)'))\n * ```\n *\n * - `:enter`/`:leave`, which indicates that the transition's animations should occur when the\n * element enters or exists the DOM\n *\n * _Example:_\n * ```typescript\n * transition(':enter', [\n * style({ opacity: 0 }),\n * animate('500ms', style({ opacity: 1 }))\n * ])\n * ```\n *\n * - `:increment`/`:decrement`, which indicates that the transition's animations should occur when\n * the numerical expression bound to the trigger's element has increased in value or decreased\n *\n * _Example:_\n * ```typescript\n * transition(':increment', query('@counter', animateChild()))\n * ```\n *\n * - a sequence of any of the above divided by commas, which indicates that transition's animations\n * should occur whenever one of the state change expressions matches\n *\n * _Example:_\n * ```typescript\n * transition(':increment, * => enabled, :enter', animate('1s ease', keyframes([\n * style({ transform: 'scale(1)', offset: 0}),\n * style({ transform: 'scale(1.1)', offset: 0.7}),\n * style({ transform: 'scale(1)', offset: 1})\n * ]))),\n * ```\n *\n * Also note that in such context:\n * - `void` can be used to indicate the absence of the element\n * - asterisks can be used as wildcards that match any state\n * - (as a consequence of the above, `void => *` is equivalent to `:enter` and `* => void` is\n * equivalent to `:leave`)\n * - `true` and `false` also match expression values of `1` and `0` respectively (but do not match\n * _truthy_ and _falsy_ values)\n *\n *
\n *\n * Be careful about entering end leaving elements as their transitions present a common\n * pitfall for developers.\n *\n * Note that when an element with a trigger enters the DOM its `:enter` transition always\n * gets executed, but its `:leave` transition will not be executed if the element is removed\n * alongside its parent (as it will be removed \"without warning\" before its transition has\n * a chance to be executed, the only way that such transition can occur is if the element\n * is exiting the DOM on its own).\n *\n *\n *
\n *\n * ### Animating to a Final State\n *\n * If the final step in a transition is a call to `animate()` that uses a timing value\n * with no `style` data, that step is automatically considered the final animation arc,\n * for the element to reach the final state, in such case Angular automatically adds or removes\n * CSS styles to ensure that the element is in the correct final state.\n *\n *\n * ### Usage Examples\n *\n * - Transition animations applied based on\n * the trigger's expression value\n *\n * ```HTML\n *
\n * ...\n *
\n * ```\n *\n * ```typescript\n * trigger(\"myAnimationTrigger\", [\n * ..., // states\n * transition(\"on => off, open => closed\", animate(500)),\n * transition(\"* <=> error\", query('.indicator', animateChild()))\n * ])\n * ```\n *\n * - Transition animations applied based on custom logic dependent\n * on the trigger's expression value and provided parameters\n *\n * ```HTML\n *
\n * ...\n *
\n * ```\n *\n * ```typescript\n * trigger(\"myAnimationTrigger\", [\n * ..., // states\n * transition(\n * (fromState, toState, _element, params) =>\n * ['firststep', 'laststep'].includes(fromState.toLowerCase())\n * && toState === params?.['target'],\n * animate('1s')\n * )\n * ])\n * ```\n *\n * @publicApi\n **/\nfunction transition(stateChangeExpr, steps, options = null) {\n return { type: AnimationMetadataType.Transition, expr: stateChangeExpr, animation: steps, options };\n}\n/**\n * Produces a reusable animation that can be invoked in another animation or sequence,\n * by calling the `useAnimation()` function.\n *\n * @param steps One or more animation objects, as returned by the `animate()`\n * or `sequence()` function, that form a transformation from one state to another.\n * A sequence is used by default when you pass an array.\n * @param options An options object that can contain a delay value for the start of the\n * animation, and additional developer-defined parameters.\n * Provided values for additional parameters are used as defaults,\n * and override values can be passed to the caller on invocation.\n * @returns An object that encapsulates the animation data.\n *\n * @usageNotes\n * The following example defines a reusable animation, providing some default parameter\n * values.\n *\n * ```typescript\n * var fadeAnimation = animation([\n * style({ opacity: '{{ start }}' }),\n * animate('{{ time }}',\n * style({ opacity: '{{ end }}'}))\n * ],\n * { params: { time: '1000ms', start: 0, end: 1 }});\n * ```\n *\n * The following invokes the defined animation with a call to `useAnimation()`,\n * passing in override parameter values.\n *\n * ```js\n * useAnimation(fadeAnimation, {\n * params: {\n * time: '2s',\n * start: 1,\n * end: 0\n * }\n * })\n * ```\n *\n * If any of the passed-in parameter values are missing from this call,\n * the default values are used. If one or more parameter values are missing before a step is\n * animated, `useAnimation()` throws an error.\n *\n * @publicApi\n */\nfunction animation(steps, options = null) {\n return { type: AnimationMetadataType.Reference, animation: steps, options };\n}\n/**\n * Executes a queried inner animation element within an animation sequence.\n *\n * @param options An options object that can contain a delay value for the start of the\n * animation, and additional override values for developer-defined parameters.\n * @return An object that encapsulates the child animation data.\n *\n * @usageNotes\n * Each time an animation is triggered in Angular, the parent animation\n * has priority and any child animations are blocked. In order\n * for a child animation to run, the parent animation must query each of the elements\n * containing child animations, and run them using this function.\n *\n * Note that this feature is designed to be used with `query()` and it will only work\n * with animations that are assigned using the Angular animation library. CSS keyframes\n * and transitions are not handled by this API.\n *\n * @publicApi\n */\nfunction animateChild(options = null) {\n return { type: AnimationMetadataType.AnimateChild, options };\n}\n/**\n * Starts a reusable animation that is created using the `animation()` function.\n *\n * @param animation The reusable animation to start.\n * @param options An options object that can contain a delay value for the start of\n * the animation, and additional override values for developer-defined parameters.\n * @return An object that contains the animation parameters.\n *\n * @publicApi\n */\nfunction useAnimation(animation, options = null) {\n return { type: AnimationMetadataType.AnimateRef, animation, options };\n}\n/**\n * Finds one or more inner elements within the current element that is\n * being animated within a sequence. Use with `animate()`.\n *\n * @param selector The element to query, or a set of elements that contain Angular-specific\n * characteristics, specified with one or more of the following tokens.\n * - `query(\":enter\")` or `query(\":leave\")` : Query for newly inserted/removed elements (not\n * all elements can be queried via these tokens, see\n * [Entering and Leaving Elements](#entering-and-leaving-elements))\n * - `query(\":animating\")` : Query all currently animating elements.\n * - `query(\"@triggerName\")` : Query elements that contain an animation trigger.\n * - `query(\"@*\")` : Query all elements that contain an animation triggers.\n * - `query(\":self\")` : Include the current element into the animation sequence.\n *\n * @param animation One or more animation steps to apply to the queried element or elements.\n * An array is treated as an animation sequence.\n * @param options An options object. Use the 'limit' field to limit the total number of\n * items to collect.\n * @return An object that encapsulates the query data.\n *\n * @usageNotes\n *\n * ### Multiple Tokens\n *\n * Tokens can be merged into a combined query selector string. For example:\n *\n * ```typescript\n * query(':self, .record:enter, .record:leave, @subTrigger', [...])\n * ```\n *\n * The `query()` function collects multiple elements and works internally by using\n * `element.querySelectorAll`. Use the `limit` field of an options object to limit\n * the total number of items to be collected. For example:\n *\n * ```js\n * query('div', [\n * animate(...),\n * animate(...)\n * ], { limit: 1 })\n * ```\n *\n * By default, throws an error when zero items are found. Set the\n * `optional` flag to ignore this error. For example:\n *\n * ```js\n * query('.some-element-that-may-not-be-there', [\n * animate(...),\n * animate(...)\n * ], { optional: true })\n * ```\n *\n * ### Entering and Leaving Elements\n *\n * Not all elements can be queried via the `:enter` and `:leave` tokens, the only ones\n * that can are those that Angular assumes can enter/leave based on their own logic\n * (if their insertion/removal is simply a consequence of that of their parent they\n * should be queried via a different token in their parent's `:enter`/`:leave` transitions).\n *\n * The only elements Angular assumes can enter/leave based on their own logic (thus the only\n * ones that can be queried via the `:enter` and `:leave` tokens) are:\n * - Those inserted dynamically (via `ViewContainerRef`)\n * - Those that have a structural directive (which, under the hood, are a subset of the above ones)\n *\n *
\n *\n * Note that elements will be successfully queried via `:enter`/`:leave` even if their\n * insertion/removal is not done manually via `ViewContainerRef`or caused by their structural\n * directive (e.g. they enter/exit alongside their parent).\n *\n *
\n *\n *
\n *\n * There is an exception to what previously mentioned, besides elements entering/leaving based on\n * their own logic, elements with an animation trigger can always be queried via `:leave` when\n * their parent is also leaving.\n *\n *
\n *\n * ### Usage Example\n *\n * The following example queries for inner elements and animates them\n * individually using `animate()`.\n *\n * ```typescript\n * @Component({\n * selector: 'inner',\n * template: `\n *
\n *

Title

\n *
\n * Blah blah blah\n *
\n *
\n * `,\n * animations: [\n * trigger('queryAnimation', [\n * transition('* => goAnimate', [\n * // hide the inner elements\n * query('h1', style({ opacity: 0 })),\n * query('.content', style({ opacity: 0 })),\n *\n * // animate the inner elements in, one by one\n * query('h1', animate(1000, style({ opacity: 1 }))),\n * query('.content', animate(1000, style({ opacity: 1 }))),\n * ])\n * ])\n * ]\n * })\n * class Cmp {\n * exp = '';\n *\n * goAnimate() {\n * this.exp = 'goAnimate';\n * }\n * }\n * ```\n *\n * @publicApi\n */\nfunction query(selector, animation, options = null) {\n return { type: AnimationMetadataType.Query, selector, animation, options };\n}\n/**\n * Use within an animation `query()` call to issue a timing gap after\n * each queried item is animated.\n *\n * @param timings A delay value.\n * @param animation One ore more animation steps.\n * @returns An object that encapsulates the stagger data.\n *\n * @usageNotes\n * In the following example, a container element wraps a list of items stamped out\n * by an `ngFor`. The container element contains an animation trigger that will later be set\n * to query for each of the inner items.\n *\n * Each time items are added, the opacity fade-in animation runs,\n * and each removed item is faded out.\n * When either of these animations occur, the stagger effect is\n * applied after each item's animation is started.\n *\n * ```html\n * \n * \n *
\n *
\n *
\n * {{ item }}\n *
\n *
\n * ```\n *\n * Here is the component code:\n *\n * ```typescript\n * import {trigger, transition, style, animate, query, stagger} from '@angular/animations';\n * @Component({\n * templateUrl: 'list.component.html',\n * animations: [\n * trigger('listAnimation', [\n * ...\n * ])\n * ]\n * })\n * class ListComponent {\n * items = [];\n *\n * showItems() {\n * this.items = [0,1,2,3,4];\n * }\n *\n * hideItems() {\n * this.items = [];\n * }\n *\n * toggle() {\n * this.items.length ? this.hideItems() : this.showItems();\n * }\n * }\n * ```\n *\n * Here is the animation trigger code:\n *\n * ```typescript\n * trigger('listAnimation', [\n * transition('* => *', [ // each time the binding value changes\n * query(':leave', [\n * stagger(100, [\n * animate('0.5s', style({ opacity: 0 }))\n * ])\n * ]),\n * query(':enter', [\n * style({ opacity: 0 }),\n * stagger(100, [\n * animate('0.5s', style({ opacity: 1 }))\n * ])\n * ])\n * ])\n * ])\n * ```\n *\n * @publicApi\n */\nfunction stagger(timings, animation) {\n return { type: AnimationMetadataType.Stagger, timings, animation };\n}\n\n/**\n * An injectable service that produces an animation sequence programmatically within an\n * Angular component or directive.\n * Provided by the `BrowserAnimationsModule` or `NoopAnimationsModule`.\n *\n * @usageNotes\n *\n * To use this service, add it to your component or directive as a dependency.\n * The service is instantiated along with your component.\n *\n * Apps do not typically need to create their own animation players, but if you\n * do need to, follow these steps:\n *\n * 1. Use the [AnimationBuilder.build](api/animations/AnimationBuilder#build)() method\n * to create a programmatic animation. The method returns an `AnimationFactory` instance.\n *\n * 2. Use the factory object to create an `AnimationPlayer` and attach it to a DOM element.\n *\n * 3. Use the player object to control the animation programmatically.\n *\n * For example:\n *\n * ```ts\n * // import the service from BrowserAnimationsModule\n * import {AnimationBuilder} from '@angular/animations';\n * // require the service as a dependency\n * class MyCmp {\n * constructor(private _builder: AnimationBuilder) {}\n *\n * makeAnimation(element: any) {\n * // first define a reusable animation\n * const myAnimation = this._builder.build([\n * style({ width: 0 }),\n * animate(1000, style({ width: '100px' }))\n * ]);\n *\n * // use the returned factory object to create a player\n * const player = myAnimation.create(element);\n *\n * player.play();\n * }\n * }\n * ```\n *\n * @publicApi\n */\nclass AnimationBuilder {\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: AnimationBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: AnimationBuilder, providedIn: 'root', useFactory: () => inject(BrowserAnimationBuilder) }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: AnimationBuilder, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root', useFactory: () => inject(BrowserAnimationBuilder) }]\n }] });\n/**\n * A factory object returned from the\n * [AnimationBuilder.build](api/animations/AnimationBuilder#build)()\n * method.\n *\n * @publicApi\n */\nclass AnimationFactory {\n}\nclass BrowserAnimationBuilder extends AnimationBuilder {\n constructor(rootRenderer, doc) {\n super();\n this.animationModuleType = inject(ANIMATION_MODULE_TYPE, { optional: true });\n this._nextAnimationId = 0;\n const typeData = {\n id: '0',\n encapsulation: ViewEncapsulation.None,\n styles: [],\n data: { animation: [] },\n };\n this._renderer = rootRenderer.createRenderer(doc.body, typeData);\n if (this.animationModuleType === null && !isAnimationRenderer(this._renderer)) {\n // We only support AnimationRenderer & DynamicDelegationRenderer for this AnimationBuilder\n throw new ɵRuntimeError(3600 /* RuntimeErrorCode.BROWSER_ANIMATION_BUILDER_INJECTED_WITHOUT_ANIMATIONS */, (typeof ngDevMode === 'undefined' || ngDevMode) &&\n 'Angular detected that the `AnimationBuilder` was injected, but animation support was not enabled. ' +\n 'Please make sure that you enable animations in your application by calling `provideAnimations()` or `provideAnimationsAsync()` function.');\n }\n }\n build(animation) {\n const id = this._nextAnimationId;\n this._nextAnimationId++;\n const entry = Array.isArray(animation) ? sequence(animation) : animation;\n issueAnimationCommand(this._renderer, null, id, 'register', [entry]);\n return new BrowserAnimationFactory(id, this._renderer);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: BrowserAnimationBuilder, deps: [{ token: i0.RendererFactory2 }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: BrowserAnimationBuilder, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: BrowserAnimationBuilder, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }], ctorParameters: () => [{ type: i0.RendererFactory2 }, { type: Document, decorators: [{\n type: Inject,\n args: [DOCUMENT]\n }] }] });\nclass BrowserAnimationFactory extends AnimationFactory {\n constructor(_id, _renderer) {\n super();\n this._id = _id;\n this._renderer = _renderer;\n }\n create(element, options) {\n return new RendererAnimationPlayer(this._id, element, options || {}, this._renderer);\n }\n}\nclass RendererAnimationPlayer {\n constructor(id, element, options, _renderer) {\n this.id = id;\n this.element = element;\n this._renderer = _renderer;\n this.parentPlayer = null;\n this._started = false;\n this.totalTime = 0;\n this._command('create', options);\n }\n _listen(eventName, callback) {\n return this._renderer.listen(this.element, `@@${this.id}:${eventName}`, callback);\n }\n _command(command, ...args) {\n issueAnimationCommand(this._renderer, this.element, this.id, command, args);\n }\n onDone(fn) {\n this._listen('done', fn);\n }\n onStart(fn) {\n this._listen('start', fn);\n }\n onDestroy(fn) {\n this._listen('destroy', fn);\n }\n init() {\n this._command('init');\n }\n hasStarted() {\n return this._started;\n }\n play() {\n this._command('play');\n this._started = true;\n }\n pause() {\n this._command('pause');\n }\n restart() {\n this._command('restart');\n }\n finish() {\n this._command('finish');\n }\n destroy() {\n this._command('destroy');\n }\n reset() {\n this._command('reset');\n this._started = false;\n }\n setPosition(p) {\n this._command('setPosition', p);\n }\n getPosition() {\n return unwrapAnimationRenderer(this._renderer)?.engine?.players[this.id]?.getPosition() ?? 0;\n }\n}\nfunction issueAnimationCommand(renderer, element, id, command, args) {\n renderer.setProperty(element, `@@${id}:${command}`, args);\n}\n/**\n * The following 2 methods cannot reference their correct types (AnimationRenderer &\n * DynamicDelegationRenderer) since this would introduce a import cycle.\n */\nfunction unwrapAnimationRenderer(renderer) {\n const type = renderer.ɵtype;\n if (type === 0 /* AnimationRendererType.Regular */) {\n return renderer;\n }\n else if (type === 1 /* AnimationRendererType.Delegated */) {\n return renderer.animationRenderer;\n }\n return null;\n}\nfunction isAnimationRenderer(renderer) {\n const type = renderer.ɵtype;\n return type === 0 /* AnimationRendererType.Regular */ || type === 1 /* AnimationRendererType.Delegated */;\n}\n\n/**\n * An empty programmatic controller for reusable animations.\n * Used internally when animations are disabled, to avoid\n * checking for the null case when an animation player is expected.\n *\n * @see {@link animate}\n * @see {@link AnimationPlayer}\n * @see {@link ɵAnimationGroupPlayer AnimationGroupPlayer}\n *\n * @publicApi\n */\nclass NoopAnimationPlayer {\n constructor(duration = 0, delay = 0) {\n this._onDoneFns = [];\n this._onStartFns = [];\n this._onDestroyFns = [];\n this._originalOnDoneFns = [];\n this._originalOnStartFns = [];\n this._started = false;\n this._destroyed = false;\n this._finished = false;\n this._position = 0;\n this.parentPlayer = null;\n this.totalTime = duration + delay;\n }\n _onFinish() {\n if (!this._finished) {\n this._finished = true;\n this._onDoneFns.forEach((fn) => fn());\n this._onDoneFns = [];\n }\n }\n onStart(fn) {\n this._originalOnStartFns.push(fn);\n this._onStartFns.push(fn);\n }\n onDone(fn) {\n this._originalOnDoneFns.push(fn);\n this._onDoneFns.push(fn);\n }\n onDestroy(fn) {\n this._onDestroyFns.push(fn);\n }\n hasStarted() {\n return this._started;\n }\n init() { }\n play() {\n if (!this.hasStarted()) {\n this._onStart();\n this.triggerMicrotask();\n }\n this._started = true;\n }\n /** @internal */\n triggerMicrotask() {\n queueMicrotask(() => this._onFinish());\n }\n _onStart() {\n this._onStartFns.forEach((fn) => fn());\n this._onStartFns = [];\n }\n pause() { }\n restart() { }\n finish() {\n this._onFinish();\n }\n destroy() {\n if (!this._destroyed) {\n this._destroyed = true;\n if (!this.hasStarted()) {\n this._onStart();\n }\n this.finish();\n this._onDestroyFns.forEach((fn) => fn());\n this._onDestroyFns = [];\n }\n }\n reset() {\n this._started = false;\n this._finished = false;\n this._onStartFns = this._originalOnStartFns;\n this._onDoneFns = this._originalOnDoneFns;\n }\n setPosition(position) {\n this._position = this.totalTime ? position * this.totalTime : 1;\n }\n getPosition() {\n return this.totalTime ? this._position / this.totalTime : 1;\n }\n /** @internal */\n triggerCallback(phaseName) {\n const methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;\n methods.forEach((fn) => fn());\n methods.length = 0;\n }\n}\n\n/**\n * A programmatic controller for a group of reusable animations.\n * Used internally to control animations.\n *\n * @see {@link AnimationPlayer}\n * @see {@link animations/group group}\n *\n */\nclass AnimationGroupPlayer {\n constructor(_players) {\n this._onDoneFns = [];\n this._onStartFns = [];\n this._finished = false;\n this._started = false;\n this._destroyed = false;\n this._onDestroyFns = [];\n this.parentPlayer = null;\n this.totalTime = 0;\n this.players = _players;\n let doneCount = 0;\n let destroyCount = 0;\n let startCount = 0;\n const total = this.players.length;\n if (total == 0) {\n queueMicrotask(() => this._onFinish());\n }\n else {\n this.players.forEach((player) => {\n player.onDone(() => {\n if (++doneCount == total) {\n this._onFinish();\n }\n });\n player.onDestroy(() => {\n if (++destroyCount == total) {\n this._onDestroy();\n }\n });\n player.onStart(() => {\n if (++startCount == total) {\n this._onStart();\n }\n });\n });\n }\n this.totalTime = this.players.reduce((time, player) => Math.max(time, player.totalTime), 0);\n }\n _onFinish() {\n if (!this._finished) {\n this._finished = true;\n this._onDoneFns.forEach((fn) => fn());\n this._onDoneFns = [];\n }\n }\n init() {\n this.players.forEach((player) => player.init());\n }\n onStart(fn) {\n this._onStartFns.push(fn);\n }\n _onStart() {\n if (!this.hasStarted()) {\n this._started = true;\n this._onStartFns.forEach((fn) => fn());\n this._onStartFns = [];\n }\n }\n onDone(fn) {\n this._onDoneFns.push(fn);\n }\n onDestroy(fn) {\n this._onDestroyFns.push(fn);\n }\n hasStarted() {\n return this._started;\n }\n play() {\n if (!this.parentPlayer) {\n this.init();\n }\n this._onStart();\n this.players.forEach((player) => player.play());\n }\n pause() {\n this.players.forEach((player) => player.pause());\n }\n restart() {\n this.players.forEach((player) => player.restart());\n }\n finish() {\n this._onFinish();\n this.players.forEach((player) => player.finish());\n }\n destroy() {\n this._onDestroy();\n }\n _onDestroy() {\n if (!this._destroyed) {\n this._destroyed = true;\n this._onFinish();\n this.players.forEach((player) => player.destroy());\n this._onDestroyFns.forEach((fn) => fn());\n this._onDestroyFns = [];\n }\n }\n reset() {\n this.players.forEach((player) => player.reset());\n this._destroyed = false;\n this._finished = false;\n this._started = false;\n }\n setPosition(p) {\n const timeAtPosition = p * this.totalTime;\n this.players.forEach((player) => {\n const position = player.totalTime ? Math.min(1, timeAtPosition / player.totalTime) : 1;\n player.setPosition(position);\n });\n }\n getPosition() {\n const longestPlayer = this.players.reduce((longestSoFar, player) => {\n const newPlayerIsLongest = longestSoFar === null || player.totalTime > longestSoFar.totalTime;\n return newPlayerIsLongest ? player : longestSoFar;\n }, null);\n return longestPlayer != null ? longestPlayer.getPosition() : 0;\n }\n beforeDestroy() {\n this.players.forEach((player) => {\n if (player.beforeDestroy) {\n player.beforeDestroy();\n }\n });\n }\n /** @internal */\n triggerCallback(phaseName) {\n const methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;\n methods.forEach((fn) => fn());\n methods.length = 0;\n }\n}\n\nconst ɵPRE_STYLE = '!';\n\n/**\n * @module\n * @description\n * Entry point for all animation APIs of the animation package.\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\n\n// This file is not used to build this module. It is only used during editing\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { AUTO_STYLE, AnimationBuilder, AnimationFactory, AnimationMetadataType, NoopAnimationPlayer, animate, animateChild, animation, group, keyframes, query, sequence, stagger, state, style, transition, trigger, useAnimation, AnimationGroupPlayer as ɵAnimationGroupPlayer, BrowserAnimationBuilder as ɵBrowserAnimationBuilder, ɵPRE_STYLE };\n","import { ElementRef } from '@angular/core';\n\n/** Coerces a data-bound value (typically a string) to a boolean. */\nfunction coerceBooleanProperty(value) {\n return value != null && `${value}` !== 'false';\n}\n\nfunction coerceNumberProperty(value, fallbackValue = 0) {\n return _isNumberValue(value) ? Number(value) : fallbackValue;\n}\n/**\n * Whether the provided value is considered a number.\n * @docs-private\n */\nfunction _isNumberValue(value) {\n // parseFloat(value) handles most of the cases we're interested in (it treats null, empty string,\n // and other non-number values as NaN, where Number just uses 0) but it considers the string\n // '123hello' to be a valid number. Therefore we also check if Number(value) is NaN.\n return !isNaN(parseFloat(value)) && !isNaN(Number(value));\n}\n\nfunction coerceArray(value) {\n return Array.isArray(value) ? value : [value];\n}\n\n/** Coerces a value to a CSS pixel value. */\nfunction coerceCssPixelValue(value) {\n if (value == null) {\n return '';\n }\n return typeof value === 'string' ? value : `${value}px`;\n}\n\n/**\n * Coerces an ElementRef or an Element into an element.\n * Useful for APIs that can accept either a ref or the native element itself.\n */\nfunction coerceElement(elementOrRef) {\n return elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : elementOrRef;\n}\n\n/**\n * Coerces a value to an array of trimmed non-empty strings.\n * Any input that is not an array, `null` or `undefined` will be turned into a string\n * via `toString()` and subsequently split with the given separator.\n * `null` and `undefined` will result in an empty array.\n * This results in the following outcomes:\n * - `null` -> `[]`\n * - `[null]` -> `[\"null\"]`\n * - `[\"a\", \"b \", \" \"]` -> `[\"a\", \"b\"]`\n * - `[1, [2, 3]]` -> `[\"1\", \"2,3\"]`\n * - `[{ a: 0 }]` -> `[\"[object Object]\"]`\n * - `{ a: 0 }` -> `[\"[object\", \"Object]\"]`\n *\n * Useful for defining CSS classes or table columns.\n * @param value the value to coerce into an array of strings\n * @param separator split-separator if value isn't an array\n */\nfunction coerceStringArray(value, separator = /\\s+/) {\n const result = [];\n if (value != null) {\n const sourceValues = Array.isArray(value) ? value : `${value}`.split(separator);\n for (const sourceValue of sourceValues) {\n const trimmedString = `${sourceValue}`.trim();\n if (trimmedString) {\n result.push(trimmedString);\n }\n }\n }\n return result;\n}\n\nexport { _isNumberValue, coerceArray, coerceBooleanProperty, coerceCssPixelValue, coerceElement, coerceNumberProperty, coerceStringArray };\n","import * as i0 from '@angular/core';\nimport { NgModule, CSP_NONCE, Injectable, Optional, Inject } from '@angular/core';\nimport { coerceArray } from '@angular/cdk/coercion';\nimport { Subject, combineLatest, concat, Observable } from 'rxjs';\nimport { take, skip, debounceTime, map, startWith, takeUntil } from 'rxjs/operators';\nimport * as i1 from '@angular/cdk/platform';\n\nclass LayoutModule {\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: LayoutModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }\n static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"14.0.0\", version: \"18.0.0\", ngImport: i0, type: LayoutModule }); }\n static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: LayoutModule }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: LayoutModule, decorators: [{\n type: NgModule,\n args: [{}]\n }] });\n\n/** Global registry for all dynamically-created, injected media queries. */\nconst mediaQueriesForWebkitCompatibility = new Set();\n/** Style tag that holds all of the dynamically-created media queries. */\nlet mediaQueryStyleNode;\n/** A utility for calling matchMedia queries. */\nclass MediaMatcher {\n constructor(_platform, _nonce) {\n this._platform = _platform;\n this._nonce = _nonce;\n this._matchMedia =\n this._platform.isBrowser && window.matchMedia\n ? // matchMedia is bound to the window scope intentionally as it is an illegal invocation to\n // call it from a different scope.\n window.matchMedia.bind(window)\n : noopMatchMedia;\n }\n /**\n * Evaluates the given media query and returns the native MediaQueryList from which results\n * can be retrieved.\n * Confirms the layout engine will trigger for the selector query provided and returns the\n * MediaQueryList for the query provided.\n */\n matchMedia(query) {\n if (this._platform.WEBKIT || this._platform.BLINK) {\n createEmptyStyleRule(query, this._nonce);\n }\n return this._matchMedia(query);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: MediaMatcher, deps: [{ token: i1.Platform }, { token: CSP_NONCE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: MediaMatcher, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: MediaMatcher, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }], ctorParameters: () => [{ type: i1.Platform }, { type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: [CSP_NONCE]\n }] }] });\n/**\n * Creates an empty stylesheet that is used to work around browser inconsistencies related to\n * `matchMedia`. At the time of writing, it handles the following cases:\n * 1. On WebKit browsers, a media query has to have at least one rule in order for `matchMedia`\n * to fire. We work around it by declaring a dummy stylesheet with a `@media` declaration.\n * 2. In some cases Blink browsers will stop firing the `matchMedia` listener if none of the rules\n * inside the `@media` match existing elements on the page. We work around it by having one rule\n * targeting the `body`. See https://github.com/angular/components/issues/23546.\n */\nfunction createEmptyStyleRule(query, nonce) {\n if (mediaQueriesForWebkitCompatibility.has(query)) {\n return;\n }\n try {\n if (!mediaQueryStyleNode) {\n mediaQueryStyleNode = document.createElement('style');\n if (nonce) {\n mediaQueryStyleNode.setAttribute('nonce', nonce);\n }\n mediaQueryStyleNode.setAttribute('type', 'text/css');\n document.head.appendChild(mediaQueryStyleNode);\n }\n if (mediaQueryStyleNode.sheet) {\n mediaQueryStyleNode.sheet.insertRule(`@media ${query} {body{ }}`, 0);\n mediaQueriesForWebkitCompatibility.add(query);\n }\n }\n catch (e) {\n console.error(e);\n }\n}\n/** No-op matchMedia replacement for non-browser platforms. */\nfunction noopMatchMedia(query) {\n // Use `as any` here to avoid adding additional necessary properties for\n // the noop matcher.\n return {\n matches: query === 'all' || query === '',\n media: query,\n addListener: () => { },\n removeListener: () => { },\n };\n}\n\n/** Utility for checking the matching state of @media queries. */\nclass BreakpointObserver {\n constructor(_mediaMatcher, _zone) {\n this._mediaMatcher = _mediaMatcher;\n this._zone = _zone;\n /** A map of all media queries currently being listened for. */\n this._queries = new Map();\n /** A subject for all other observables to takeUntil based on. */\n this._destroySubject = new Subject();\n }\n /** Completes the active subject, signalling to all other observables to complete. */\n ngOnDestroy() {\n this._destroySubject.next();\n this._destroySubject.complete();\n }\n /**\n * Whether one or more media queries match the current viewport size.\n * @param value One or more media queries to check.\n * @returns Whether any of the media queries match.\n */\n isMatched(value) {\n const queries = splitQueries(coerceArray(value));\n return queries.some(mediaQuery => this._registerQuery(mediaQuery).mql.matches);\n }\n /**\n * Gets an observable of results for the given queries that will emit new results for any changes\n * in matching of the given queries.\n * @param value One or more media queries to check.\n * @returns A stream of matches for the given queries.\n */\n observe(value) {\n const queries = splitQueries(coerceArray(value));\n const observables = queries.map(query => this._registerQuery(query).observable);\n let stateObservable = combineLatest(observables);\n // Emit the first state immediately, and then debounce the subsequent emissions.\n stateObservable = concat(stateObservable.pipe(take(1)), stateObservable.pipe(skip(1), debounceTime(0)));\n return stateObservable.pipe(map(breakpointStates => {\n const response = {\n matches: false,\n breakpoints: {},\n };\n breakpointStates.forEach(({ matches, query }) => {\n response.matches = response.matches || matches;\n response.breakpoints[query] = matches;\n });\n return response;\n }));\n }\n /** Registers a specific query to be listened for. */\n _registerQuery(query) {\n // Only set up a new MediaQueryList if it is not already being listened for.\n if (this._queries.has(query)) {\n return this._queries.get(query);\n }\n const mql = this._mediaMatcher.matchMedia(query);\n // Create callback for match changes and add it is as a listener.\n const queryObservable = new Observable((observer) => {\n // Listener callback methods are wrapped to be placed back in ngZone. Callbacks must be placed\n // back into the zone because matchMedia is only included in Zone.js by loading the\n // webapis-media-query.js file alongside the zone.js file. Additionally, some browsers do not\n // have MediaQueryList inherit from EventTarget, which causes inconsistencies in how Zone.js\n // patches it.\n const handler = (e) => this._zone.run(() => observer.next(e));\n mql.addListener(handler);\n return () => {\n mql.removeListener(handler);\n };\n }).pipe(startWith(mql), map(({ matches }) => ({ query, matches })), takeUntil(this._destroySubject));\n // Add the MediaQueryList to the set of queries.\n const output = { observable: queryObservable, mql };\n this._queries.set(query, output);\n return output;\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: BreakpointObserver, deps: [{ token: MediaMatcher }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: BreakpointObserver, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: BreakpointObserver, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }], ctorParameters: () => [{ type: MediaMatcher }, { type: i0.NgZone }] });\n/**\n * Split each query string into separate query strings if two queries are provided as comma\n * separated.\n */\nfunction splitQueries(queries) {\n return queries\n .map(query => query.split(','))\n .reduce((a1, a2) => a1.concat(a2))\n .map(query => query.trim());\n}\n\n// PascalCase is being used as Breakpoints is used like an enum.\n// tslint:disable-next-line:variable-name\nconst Breakpoints = {\n XSmall: '(max-width: 599.98px)',\n Small: '(min-width: 600px) and (max-width: 959.98px)',\n Medium: '(min-width: 960px) and (max-width: 1279.98px)',\n Large: '(min-width: 1280px) and (max-width: 1919.98px)',\n XLarge: '(min-width: 1920px)',\n Handset: '(max-width: 599.98px) and (orientation: portrait), ' +\n '(max-width: 959.98px) and (orientation: landscape)',\n Tablet: '(min-width: 600px) and (max-width: 839.98px) and (orientation: portrait), ' +\n '(min-width: 960px) and (max-width: 1279.98px) and (orientation: landscape)',\n Web: '(min-width: 840px) and (orientation: portrait), ' +\n '(min-width: 1280px) and (orientation: landscape)',\n HandsetPortrait: '(max-width: 599.98px) and (orientation: portrait)',\n TabletPortrait: '(min-width: 600px) and (max-width: 839.98px) and (orientation: portrait)',\n WebPortrait: '(min-width: 840px) and (orientation: portrait)',\n HandsetLandscape: '(max-width: 959.98px) and (orientation: landscape)',\n TabletLandscape: '(min-width: 960px) and (max-width: 1279.98px) and (orientation: landscape)',\n WebLandscape: '(min-width: 1280px) and (orientation: landscape)',\n};\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { BreakpointObserver, Breakpoints, LayoutModule, MediaMatcher };\n","let nextHandle = 1;\nlet resolved;\nconst activeHandles = {};\nfunction findAndClearHandle(handle) {\n if (handle in activeHandles) {\n delete activeHandles[handle];\n return true;\n }\n return false;\n}\nexport const Immediate = {\n setImmediate(cb) {\n const handle = nextHandle++;\n activeHandles[handle] = true;\n if (!resolved) {\n resolved = Promise.resolve();\n }\n resolved.then(() => findAndClearHandle(handle) && cb());\n return handle;\n },\n clearImmediate(handle) {\n findAndClearHandle(handle);\n },\n};\nexport const TestTools = {\n pending() {\n return Object.keys(activeHandles).length;\n }\n};\n","import { Immediate } from '../util/Immediate';\nconst { setImmediate, clearImmediate } = Immediate;\nexport const immediateProvider = {\n setImmediate(...args) {\n const { delegate } = immediateProvider;\n return ((delegate === null || delegate === void 0 ? void 0 : delegate.setImmediate) || setImmediate)(...args);\n },\n clearImmediate(handle) {\n const { delegate } = immediateProvider;\n return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearImmediate) || clearImmediate)(handle);\n },\n delegate: undefined,\n};\n","import { AsapAction } from './AsapAction';\nimport { AsapScheduler } from './AsapScheduler';\nexport const asapScheduler = new AsapScheduler(AsapAction);\nexport const asap = asapScheduler;\n","import { AsyncScheduler } from './AsyncScheduler';\nexport class AsapScheduler extends AsyncScheduler {\n flush(action) {\n this._active = true;\n const flushId = this._scheduled;\n this._scheduled = undefined;\n const { actions } = this;\n let error;\n action = action || actions.shift();\n do {\n if ((error = action.execute(action.state, action.delay))) {\n break;\n }\n } while ((action = actions[0]) && action.id === flushId && actions.shift());\n this._active = false;\n if (error) {\n while ((action = actions[0]) && action.id === flushId && actions.shift()) {\n action.unsubscribe();\n }\n throw error;\n }\n }\n}\n","import { AsyncAction } from './AsyncAction';\nimport { immediateProvider } from './immediateProvider';\nexport class AsapAction extends AsyncAction {\n constructor(scheduler, work) {\n super(scheduler, work);\n this.scheduler = scheduler;\n this.work = work;\n }\n requestAsyncId(scheduler, id, delay = 0) {\n if (delay !== null && delay > 0) {\n return super.requestAsyncId(scheduler, id, delay);\n }\n scheduler.actions.push(this);\n return scheduler._scheduled || (scheduler._scheduled = immediateProvider.setImmediate(scheduler.flush.bind(scheduler, undefined)));\n }\n recycleAsyncId(scheduler, id, delay = 0) {\n var _a;\n if (delay != null ? delay > 0 : this.delay > 0) {\n return super.recycleAsyncId(scheduler, id, delay);\n }\n const { actions } = scheduler;\n if (id != null && ((_a = actions[actions.length - 1]) === null || _a === void 0 ? void 0 : _a.id) !== id) {\n immediateProvider.clearImmediate(id);\n if (scheduler._scheduled === id) {\n scheduler._scheduled = undefined;\n }\n }\n return undefined;\n }\n}\n","import { asyncScheduler } from '../scheduler/async';\nimport { audit } from './audit';\nimport { timer } from '../observable/timer';\nexport function auditTime(duration, scheduler = asyncScheduler) {\n return audit(() => timer(duration, scheduler));\n}\n","import { operate } from '../util/lift';\nimport { innerFrom } from '../observable/innerFrom';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function audit(durationSelector) {\n return operate((source, subscriber) => {\n let hasValue = false;\n let lastValue = null;\n let durationSubscriber = null;\n let isComplete = false;\n const endDuration = () => {\n durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe();\n durationSubscriber = null;\n if (hasValue) {\n hasValue = false;\n const value = lastValue;\n lastValue = null;\n subscriber.next(value);\n }\n isComplete && subscriber.complete();\n };\n const cleanupDuration = () => {\n durationSubscriber = null;\n isComplete && subscriber.complete();\n };\n source.subscribe(createOperatorSubscriber(subscriber, (value) => {\n hasValue = true;\n lastValue = value;\n if (!durationSubscriber) {\n innerFrom(durationSelector(value)).subscribe((durationSubscriber = createOperatorSubscriber(subscriber, endDuration, cleanupDuration)));\n }\n }, () => {\n isComplete = true;\n (!hasValue || !durationSubscriber || durationSubscriber.closed) && subscriber.complete();\n }));\n });\n}\n","import * as i0 from '@angular/core';\nimport { InjectionToken, inject, EventEmitter, Injectable, Optional, Inject, Directive, Output, Input, NgModule } from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\n\n/**\n * Injection token used to inject the document into Directionality.\n * This is used so that the value can be faked in tests.\n *\n * We can't use the real document in tests because changing the real `dir` causes geometry-based\n * tests in Safari to fail.\n *\n * We also can't re-provide the DOCUMENT token from platform-browser because the unit tests\n * themselves use things like `querySelector` in test code.\n *\n * This token is defined in a separate file from Directionality as a workaround for\n * https://github.com/angular/angular/issues/22559\n *\n * @docs-private\n */\nconst DIR_DOCUMENT = new InjectionToken('cdk-dir-doc', {\n providedIn: 'root',\n factory: DIR_DOCUMENT_FACTORY,\n});\n/** @docs-private */\nfunction DIR_DOCUMENT_FACTORY() {\n return inject(DOCUMENT);\n}\n\n/** Regex that matches locales with an RTL script. Taken from `goog.i18n.bidi.isRtlLanguage`. */\nconst RTL_LOCALE_PATTERN = /^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Adlm|Arab|Hebr|Nkoo|Rohg|Thaa))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)/i;\n/** Resolves a string value to a specific direction. */\nfunction _resolveDirectionality(rawValue) {\n const value = rawValue?.toLowerCase() || '';\n if (value === 'auto' && typeof navigator !== 'undefined' && navigator?.language) {\n return RTL_LOCALE_PATTERN.test(navigator.language) ? 'rtl' : 'ltr';\n }\n return value === 'rtl' ? 'rtl' : 'ltr';\n}\n/**\n * The directionality (LTR / RTL) context for the application (or a subtree of it).\n * Exposes the current direction and a stream of direction changes.\n */\nclass Directionality {\n constructor(_document) {\n /** The current 'ltr' or 'rtl' value. */\n this.value = 'ltr';\n /** Stream that emits whenever the 'ltr' / 'rtl' state changes. */\n this.change = new EventEmitter();\n if (_document) {\n const bodyDir = _document.body ? _document.body.dir : null;\n const htmlDir = _document.documentElement ? _document.documentElement.dir : null;\n this.value = _resolveDirectionality(bodyDir || htmlDir || 'ltr');\n }\n }\n ngOnDestroy() {\n this.change.complete();\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: Directionality, deps: [{ token: DIR_DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: Directionality, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: Directionality, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }], ctorParameters: () => [{ type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: [DIR_DOCUMENT]\n }] }] });\n\n/**\n * Directive to listen for changes of direction of part of the DOM.\n *\n * Provides itself as Directionality such that descendant directives only need to ever inject\n * Directionality to get the closest direction.\n */\nclass Dir {\n constructor() {\n /** Normalized direction that accounts for invalid/unsupported values. */\n this._dir = 'ltr';\n /** Whether the `value` has been set to its initial value. */\n this._isInitialized = false;\n /** Event emitted when the direction changes. */\n this.change = new EventEmitter();\n }\n /** @docs-private */\n get dir() {\n return this._dir;\n }\n set dir(value) {\n const previousValue = this._dir;\n // Note: `_resolveDirectionality` resolves the language based on the browser's language,\n // whereas the browser does it based on the content of the element. Since doing so based\n // on the content can be expensive, for now we're doing the simpler matching.\n this._dir = _resolveDirectionality(value);\n this._rawDir = value;\n if (previousValue !== this._dir && this._isInitialized) {\n this.change.emit(this._dir);\n }\n }\n /** Current layout direction of the element. */\n get value() {\n return this.dir;\n }\n /** Initialize once default value has been set. */\n ngAfterContentInit() {\n this._isInitialized = true;\n }\n ngOnDestroy() {\n this.change.complete();\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: Dir, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.0\", type: Dir, isStandalone: true, selector: \"[dir]\", inputs: { dir: \"dir\" }, outputs: { change: \"dirChange\" }, host: { properties: { \"attr.dir\": \"_rawDir\" } }, providers: [{ provide: Directionality, useExisting: Dir }], exportAs: [\"dir\"], ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: Dir, decorators: [{\n type: Directive,\n args: [{\n selector: '[dir]',\n providers: [{ provide: Directionality, useExisting: Dir }],\n host: { '[attr.dir]': '_rawDir' },\n exportAs: 'dir',\n standalone: true,\n }]\n }], propDecorators: { change: [{\n type: Output,\n args: ['dirChange']\n }], dir: [{\n type: Input\n }] } });\n\nclass BidiModule {\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: BidiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }\n static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"14.0.0\", version: \"18.0.0\", ngImport: i0, type: BidiModule, imports: [Dir], exports: [Dir] }); }\n static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: BidiModule }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: BidiModule, decorators: [{\n type: NgModule,\n args: [{\n imports: [Dir],\n exports: [Dir],\n }]\n }] });\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { BidiModule, DIR_DOCUMENT, Dir, Directionality };\n","import { coerceNumberProperty, coerceElement } from '@angular/cdk/coercion';\nimport * as i0 from '@angular/core';\nimport { InjectionToken, forwardRef, Directive, Input, Injectable, Optional, Inject, inject, Injector, afterNextRender, booleanAttribute, Component, ViewEncapsulation, ChangeDetectionStrategy, Output, ViewChild, SkipSelf, ElementRef, NgModule } from '@angular/core';\nimport { Subject, of, Observable, fromEvent, animationFrameScheduler, asapScheduler, Subscription, isObservable } from 'rxjs';\nimport { distinctUntilChanged, auditTime, filter, takeUntil, startWith, pairwise, switchMap, shareReplay } from 'rxjs/operators';\nimport * as i1 from '@angular/cdk/platform';\nimport { getRtlScrollAxisType, RtlScrollAxisType, supportsScrollBehavior, Platform } from '@angular/cdk/platform';\nimport { DOCUMENT } from '@angular/common';\nimport * as i2 from '@angular/cdk/bidi';\nimport { BidiModule } from '@angular/cdk/bidi';\nimport * as i2$1 from '@angular/cdk/collections';\nimport { isDataSource, ArrayDataSource, _VIEW_REPEATER_STRATEGY, _RecycleViewRepeaterStrategy } from '@angular/cdk/collections';\n\n/** The injection token used to specify the virtual scrolling strategy. */\nconst VIRTUAL_SCROLL_STRATEGY = new InjectionToken('VIRTUAL_SCROLL_STRATEGY');\n\n/** Virtual scrolling strategy for lists with items of known fixed size. */\nclass FixedSizeVirtualScrollStrategy {\n /**\n * @param itemSize The size of the items in the virtually scrolling list.\n * @param minBufferPx The minimum amount of buffer (in pixels) before needing to render more\n * @param maxBufferPx The amount of buffer (in pixels) to render when rendering more.\n */\n constructor(itemSize, minBufferPx, maxBufferPx) {\n this._scrolledIndexChange = new Subject();\n /** @docs-private Implemented as part of VirtualScrollStrategy. */\n this.scrolledIndexChange = this._scrolledIndexChange.pipe(distinctUntilChanged());\n /** The attached viewport. */\n this._viewport = null;\n this._itemSize = itemSize;\n this._minBufferPx = minBufferPx;\n this._maxBufferPx = maxBufferPx;\n }\n /**\n * Attaches this scroll strategy to a viewport.\n * @param viewport The viewport to attach this strategy to.\n */\n attach(viewport) {\n this._viewport = viewport;\n this._updateTotalContentSize();\n this._updateRenderedRange();\n }\n /** Detaches this scroll strategy from the currently attached viewport. */\n detach() {\n this._scrolledIndexChange.complete();\n this._viewport = null;\n }\n /**\n * Update the item size and buffer size.\n * @param itemSize The size of the items in the virtually scrolling list.\n * @param minBufferPx The minimum amount of buffer (in pixels) before needing to render more\n * @param maxBufferPx The amount of buffer (in pixels) to render when rendering more.\n */\n updateItemAndBufferSize(itemSize, minBufferPx, maxBufferPx) {\n if (maxBufferPx < minBufferPx && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error('CDK virtual scroll: maxBufferPx must be greater than or equal to minBufferPx');\n }\n this._itemSize = itemSize;\n this._minBufferPx = minBufferPx;\n this._maxBufferPx = maxBufferPx;\n this._updateTotalContentSize();\n this._updateRenderedRange();\n }\n /** @docs-private Implemented as part of VirtualScrollStrategy. */\n onContentScrolled() {\n this._updateRenderedRange();\n }\n /** @docs-private Implemented as part of VirtualScrollStrategy. */\n onDataLengthChanged() {\n this._updateTotalContentSize();\n this._updateRenderedRange();\n }\n /** @docs-private Implemented as part of VirtualScrollStrategy. */\n onContentRendered() {\n /* no-op */\n }\n /** @docs-private Implemented as part of VirtualScrollStrategy. */\n onRenderedOffsetChanged() {\n /* no-op */\n }\n /**\n * Scroll to the offset for the given index.\n * @param index The index of the element to scroll to.\n * @param behavior The ScrollBehavior to use when scrolling.\n */\n scrollToIndex(index, behavior) {\n if (this._viewport) {\n this._viewport.scrollToOffset(index * this._itemSize, behavior);\n }\n }\n /** Update the viewport's total content size. */\n _updateTotalContentSize() {\n if (!this._viewport) {\n return;\n }\n this._viewport.setTotalContentSize(this._viewport.getDataLength() * this._itemSize);\n }\n /** Update the viewport's rendered range. */\n _updateRenderedRange() {\n if (!this._viewport) {\n return;\n }\n const renderedRange = this._viewport.getRenderedRange();\n const newRange = { start: renderedRange.start, end: renderedRange.end };\n const viewportSize = this._viewport.getViewportSize();\n const dataLength = this._viewport.getDataLength();\n let scrollOffset = this._viewport.measureScrollOffset();\n // Prevent NaN as result when dividing by zero.\n let firstVisibleIndex = this._itemSize > 0 ? scrollOffset / this._itemSize : 0;\n // If user scrolls to the bottom of the list and data changes to a smaller list\n if (newRange.end > dataLength) {\n // We have to recalculate the first visible index based on new data length and viewport size.\n const maxVisibleItems = Math.ceil(viewportSize / this._itemSize);\n const newVisibleIndex = Math.max(0, Math.min(firstVisibleIndex, dataLength - maxVisibleItems));\n // If first visible index changed we must update scroll offset to handle start/end buffers\n // Current range must also be adjusted to cover the new position (bottom of new list).\n if (firstVisibleIndex != newVisibleIndex) {\n firstVisibleIndex = newVisibleIndex;\n scrollOffset = newVisibleIndex * this._itemSize;\n newRange.start = Math.floor(firstVisibleIndex);\n }\n newRange.end = Math.max(0, Math.min(dataLength, newRange.start + maxVisibleItems));\n }\n const startBuffer = scrollOffset - newRange.start * this._itemSize;\n if (startBuffer < this._minBufferPx && newRange.start != 0) {\n const expandStart = Math.ceil((this._maxBufferPx - startBuffer) / this._itemSize);\n newRange.start = Math.max(0, newRange.start - expandStart);\n newRange.end = Math.min(dataLength, Math.ceil(firstVisibleIndex + (viewportSize + this._minBufferPx) / this._itemSize));\n }\n else {\n const endBuffer = newRange.end * this._itemSize - (scrollOffset + viewportSize);\n if (endBuffer < this._minBufferPx && newRange.end != dataLength) {\n const expandEnd = Math.ceil((this._maxBufferPx - endBuffer) / this._itemSize);\n if (expandEnd > 0) {\n newRange.end = Math.min(dataLength, newRange.end + expandEnd);\n newRange.start = Math.max(0, Math.floor(firstVisibleIndex - this._minBufferPx / this._itemSize));\n }\n }\n }\n this._viewport.setRenderedRange(newRange);\n this._viewport.setRenderedContentOffset(this._itemSize * newRange.start);\n this._scrolledIndexChange.next(Math.floor(firstVisibleIndex));\n }\n}\n/**\n * Provider factory for `FixedSizeVirtualScrollStrategy` that simply extracts the already created\n * `FixedSizeVirtualScrollStrategy` from the given directive.\n * @param fixedSizeDir The instance of `CdkFixedSizeVirtualScroll` to extract the\n * `FixedSizeVirtualScrollStrategy` from.\n */\nfunction _fixedSizeVirtualScrollStrategyFactory(fixedSizeDir) {\n return fixedSizeDir._scrollStrategy;\n}\n/** A virtual scroll strategy that supports fixed-size items. */\nclass CdkFixedSizeVirtualScroll {\n constructor() {\n this._itemSize = 20;\n this._minBufferPx = 100;\n this._maxBufferPx = 200;\n /** The scroll strategy used by this directive. */\n this._scrollStrategy = new FixedSizeVirtualScrollStrategy(this.itemSize, this.minBufferPx, this.maxBufferPx);\n }\n /** The size of the items in the list (in pixels). */\n get itemSize() {\n return this._itemSize;\n }\n set itemSize(value) {\n this._itemSize = coerceNumberProperty(value);\n }\n /**\n * The minimum amount of buffer rendered beyond the viewport (in pixels).\n * If the amount of buffer dips below this number, more items will be rendered. Defaults to 100px.\n */\n get minBufferPx() {\n return this._minBufferPx;\n }\n set minBufferPx(value) {\n this._minBufferPx = coerceNumberProperty(value);\n }\n /**\n * The number of pixels worth of buffer to render for when rendering new items. Defaults to 200px.\n */\n get maxBufferPx() {\n return this._maxBufferPx;\n }\n set maxBufferPx(value) {\n this._maxBufferPx = coerceNumberProperty(value);\n }\n ngOnChanges() {\n this._scrollStrategy.updateItemAndBufferSize(this.itemSize, this.minBufferPx, this.maxBufferPx);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkFixedSizeVirtualScroll, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.0\", type: CdkFixedSizeVirtualScroll, isStandalone: true, selector: \"cdk-virtual-scroll-viewport[itemSize]\", inputs: { itemSize: \"itemSize\", minBufferPx: \"minBufferPx\", maxBufferPx: \"maxBufferPx\" }, providers: [\n {\n provide: VIRTUAL_SCROLL_STRATEGY,\n useFactory: _fixedSizeVirtualScrollStrategyFactory,\n deps: [forwardRef(() => CdkFixedSizeVirtualScroll)],\n },\n ], usesOnChanges: true, ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkFixedSizeVirtualScroll, decorators: [{\n type: Directive,\n args: [{\n selector: 'cdk-virtual-scroll-viewport[itemSize]',\n standalone: true,\n providers: [\n {\n provide: VIRTUAL_SCROLL_STRATEGY,\n useFactory: _fixedSizeVirtualScrollStrategyFactory,\n deps: [forwardRef(() => CdkFixedSizeVirtualScroll)],\n },\n ],\n }]\n }], propDecorators: { itemSize: [{\n type: Input\n }], minBufferPx: [{\n type: Input\n }], maxBufferPx: [{\n type: Input\n }] } });\n\n/** Time in ms to throttle the scrolling events by default. */\nconst DEFAULT_SCROLL_TIME = 20;\n/**\n * Service contained all registered Scrollable references and emits an event when any one of the\n * Scrollable references emit a scrolled event.\n */\nclass ScrollDispatcher {\n constructor(_ngZone, _platform, document) {\n this._ngZone = _ngZone;\n this._platform = _platform;\n /** Subject for notifying that a registered scrollable reference element has been scrolled. */\n this._scrolled = new Subject();\n /** Keeps track of the global `scroll` and `resize` subscriptions. */\n this._globalSubscription = null;\n /** Keeps track of the amount of subscriptions to `scrolled`. Used for cleaning up afterwards. */\n this._scrolledCount = 0;\n /**\n * Map of all the scrollable references that are registered with the service and their\n * scroll event subscriptions.\n */\n this.scrollContainers = new Map();\n this._document = document;\n }\n /**\n * Registers a scrollable instance with the service and listens for its scrolled events. When the\n * scrollable is scrolled, the service emits the event to its scrolled observable.\n * @param scrollable Scrollable instance to be registered.\n */\n register(scrollable) {\n if (!this.scrollContainers.has(scrollable)) {\n this.scrollContainers.set(scrollable, scrollable.elementScrolled().subscribe(() => this._scrolled.next(scrollable)));\n }\n }\n /**\n * De-registers a Scrollable reference and unsubscribes from its scroll event observable.\n * @param scrollable Scrollable instance to be deregistered.\n */\n deregister(scrollable) {\n const scrollableReference = this.scrollContainers.get(scrollable);\n if (scrollableReference) {\n scrollableReference.unsubscribe();\n this.scrollContainers.delete(scrollable);\n }\n }\n /**\n * Returns an observable that emits an event whenever any of the registered Scrollable\n * references (or window, document, or body) fire a scrolled event. Can provide a time in ms\n * to override the default \"throttle\" time.\n *\n * **Note:** in order to avoid hitting change detection for every scroll event,\n * all of the events emitted from this stream will be run outside the Angular zone.\n * If you need to update any data bindings as a result of a scroll event, you have\n * to run the callback using `NgZone.run`.\n */\n scrolled(auditTimeInMs = DEFAULT_SCROLL_TIME) {\n if (!this._platform.isBrowser) {\n return of();\n }\n return new Observable((observer) => {\n if (!this._globalSubscription) {\n this._addGlobalListener();\n }\n // In the case of a 0ms delay, use an observable without auditTime\n // since it does add a perceptible delay in processing overhead.\n const subscription = auditTimeInMs > 0\n ? this._scrolled.pipe(auditTime(auditTimeInMs)).subscribe(observer)\n : this._scrolled.subscribe(observer);\n this._scrolledCount++;\n return () => {\n subscription.unsubscribe();\n this._scrolledCount--;\n if (!this._scrolledCount) {\n this._removeGlobalListener();\n }\n };\n });\n }\n ngOnDestroy() {\n this._removeGlobalListener();\n this.scrollContainers.forEach((_, container) => this.deregister(container));\n this._scrolled.complete();\n }\n /**\n * Returns an observable that emits whenever any of the\n * scrollable ancestors of an element are scrolled.\n * @param elementOrElementRef Element whose ancestors to listen for.\n * @param auditTimeInMs Time to throttle the scroll events.\n */\n ancestorScrolled(elementOrElementRef, auditTimeInMs) {\n const ancestors = this.getAncestorScrollContainers(elementOrElementRef);\n return this.scrolled(auditTimeInMs).pipe(filter(target => {\n return !target || ancestors.indexOf(target) > -1;\n }));\n }\n /** Returns all registered Scrollables that contain the provided element. */\n getAncestorScrollContainers(elementOrElementRef) {\n const scrollingContainers = [];\n this.scrollContainers.forEach((_subscription, scrollable) => {\n if (this._scrollableContainsElement(scrollable, elementOrElementRef)) {\n scrollingContainers.push(scrollable);\n }\n });\n return scrollingContainers;\n }\n /** Use defaultView of injected document if available or fallback to global window reference */\n _getWindow() {\n return this._document.defaultView || window;\n }\n /** Returns true if the element is contained within the provided Scrollable. */\n _scrollableContainsElement(scrollable, elementOrElementRef) {\n let element = coerceElement(elementOrElementRef);\n let scrollableElement = scrollable.getElementRef().nativeElement;\n // Traverse through the element parents until we reach null, checking if any of the elements\n // are the scrollable's element.\n do {\n if (element == scrollableElement) {\n return true;\n }\n } while ((element = element.parentElement));\n return false;\n }\n /** Sets up the global scroll listeners. */\n _addGlobalListener() {\n this._globalSubscription = this._ngZone.runOutsideAngular(() => {\n const window = this._getWindow();\n return fromEvent(window.document, 'scroll').subscribe(() => this._scrolled.next());\n });\n }\n /** Cleans up the global scroll listener. */\n _removeGlobalListener() {\n if (this._globalSubscription) {\n this._globalSubscription.unsubscribe();\n this._globalSubscription = null;\n }\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: ScrollDispatcher, deps: [{ token: i0.NgZone }, { token: i1.Platform }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: ScrollDispatcher, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: ScrollDispatcher, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }], ctorParameters: () => [{ type: i0.NgZone }, { type: i1.Platform }, { type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: [DOCUMENT]\n }] }] });\n\n/**\n * Sends an event when the directive's element is scrolled. Registers itself with the\n * ScrollDispatcher service to include itself as part of its collection of scrolling events that it\n * can be listened to through the service.\n */\nclass CdkScrollable {\n constructor(elementRef, scrollDispatcher, ngZone, dir) {\n this.elementRef = elementRef;\n this.scrollDispatcher = scrollDispatcher;\n this.ngZone = ngZone;\n this.dir = dir;\n this._destroyed = new Subject();\n this._elementScrolled = new Observable((observer) => this.ngZone.runOutsideAngular(() => fromEvent(this.elementRef.nativeElement, 'scroll')\n .pipe(takeUntil(this._destroyed))\n .subscribe(observer)));\n }\n ngOnInit() {\n this.scrollDispatcher.register(this);\n }\n ngOnDestroy() {\n this.scrollDispatcher.deregister(this);\n this._destroyed.next();\n this._destroyed.complete();\n }\n /** Returns observable that emits when a scroll event is fired on the host element. */\n elementScrolled() {\n return this._elementScrolled;\n }\n /** Gets the ElementRef for the viewport. */\n getElementRef() {\n return this.elementRef;\n }\n /**\n * Scrolls to the specified offsets. This is a normalized version of the browser's native scrollTo\n * method, since browsers are not consistent about what scrollLeft means in RTL. For this method\n * left and right always refer to the left and right side of the scrolling container irrespective\n * of the layout direction. start and end refer to left and right in an LTR context and vice-versa\n * in an RTL context.\n * @param options specified the offsets to scroll to.\n */\n scrollTo(options) {\n const el = this.elementRef.nativeElement;\n const isRtl = this.dir && this.dir.value == 'rtl';\n // Rewrite start & end offsets as right or left offsets.\n if (options.left == null) {\n options.left = isRtl ? options.end : options.start;\n }\n if (options.right == null) {\n options.right = isRtl ? options.start : options.end;\n }\n // Rewrite the bottom offset as a top offset.\n if (options.bottom != null) {\n options.top =\n el.scrollHeight - el.clientHeight - options.bottom;\n }\n // Rewrite the right offset as a left offset.\n if (isRtl && getRtlScrollAxisType() != RtlScrollAxisType.NORMAL) {\n if (options.left != null) {\n options.right =\n el.scrollWidth - el.clientWidth - options.left;\n }\n if (getRtlScrollAxisType() == RtlScrollAxisType.INVERTED) {\n options.left = options.right;\n }\n else if (getRtlScrollAxisType() == RtlScrollAxisType.NEGATED) {\n options.left = options.right ? -options.right : options.right;\n }\n }\n else {\n if (options.right != null) {\n options.left =\n el.scrollWidth - el.clientWidth - options.right;\n }\n }\n this._applyScrollToOptions(options);\n }\n _applyScrollToOptions(options) {\n const el = this.elementRef.nativeElement;\n if (supportsScrollBehavior()) {\n el.scrollTo(options);\n }\n else {\n if (options.top != null) {\n el.scrollTop = options.top;\n }\n if (options.left != null) {\n el.scrollLeft = options.left;\n }\n }\n }\n /**\n * Measures the scroll offset relative to the specified edge of the viewport. This method can be\n * used instead of directly checking scrollLeft or scrollTop, since browsers are not consistent\n * about what scrollLeft means in RTL. The values returned by this method are normalized such that\n * left and right always refer to the left and right side of the scrolling container irrespective\n * of the layout direction. start and end refer to left and right in an LTR context and vice-versa\n * in an RTL context.\n * @param from The edge to measure from.\n */\n measureScrollOffset(from) {\n const LEFT = 'left';\n const RIGHT = 'right';\n const el = this.elementRef.nativeElement;\n if (from == 'top') {\n return el.scrollTop;\n }\n if (from == 'bottom') {\n return el.scrollHeight - el.clientHeight - el.scrollTop;\n }\n // Rewrite start & end as left or right offsets.\n const isRtl = this.dir && this.dir.value == 'rtl';\n if (from == 'start') {\n from = isRtl ? RIGHT : LEFT;\n }\n else if (from == 'end') {\n from = isRtl ? LEFT : RIGHT;\n }\n if (isRtl && getRtlScrollAxisType() == RtlScrollAxisType.INVERTED) {\n // For INVERTED, scrollLeft is (scrollWidth - clientWidth) when scrolled all the way left and\n // 0 when scrolled all the way right.\n if (from == LEFT) {\n return el.scrollWidth - el.clientWidth - el.scrollLeft;\n }\n else {\n return el.scrollLeft;\n }\n }\n else if (isRtl && getRtlScrollAxisType() == RtlScrollAxisType.NEGATED) {\n // For NEGATED, scrollLeft is -(scrollWidth - clientWidth) when scrolled all the way left and\n // 0 when scrolled all the way right.\n if (from == LEFT) {\n return el.scrollLeft + el.scrollWidth - el.clientWidth;\n }\n else {\n return -el.scrollLeft;\n }\n }\n else {\n // For NORMAL, as well as non-RTL contexts, scrollLeft is 0 when scrolled all the way left and\n // (scrollWidth - clientWidth) when scrolled all the way right.\n if (from == LEFT) {\n return el.scrollLeft;\n }\n else {\n return el.scrollWidth - el.clientWidth - el.scrollLeft;\n }\n }\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkScrollable, deps: [{ token: i0.ElementRef }, { token: ScrollDispatcher }, { token: i0.NgZone }, { token: i2.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.0\", type: CdkScrollable, isStandalone: true, selector: \"[cdk-scrollable], [cdkScrollable]\", ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkScrollable, decorators: [{\n type: Directive,\n args: [{\n selector: '[cdk-scrollable], [cdkScrollable]',\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: i0.ElementRef }, { type: ScrollDispatcher }, { type: i0.NgZone }, { type: i2.Directionality, decorators: [{\n type: Optional\n }] }] });\n\n/** Time in ms to throttle the resize events by default. */\nconst DEFAULT_RESIZE_TIME = 20;\n/**\n * Simple utility for getting the bounds of the browser viewport.\n * @docs-private\n */\nclass ViewportRuler {\n constructor(_platform, ngZone, document) {\n this._platform = _platform;\n /** Stream of viewport change events. */\n this._change = new Subject();\n /** Event listener that will be used to handle the viewport change events. */\n this._changeListener = (event) => {\n this._change.next(event);\n };\n this._document = document;\n ngZone.runOutsideAngular(() => {\n if (_platform.isBrowser) {\n const window = this._getWindow();\n // Note that bind the events ourselves, rather than going through something like RxJS's\n // `fromEvent` so that we can ensure that they're bound outside of the NgZone.\n window.addEventListener('resize', this._changeListener);\n window.addEventListener('orientationchange', this._changeListener);\n }\n // Clear the cached position so that the viewport is re-measured next time it is required.\n // We don't need to keep track of the subscription, because it is completed on destroy.\n this.change().subscribe(() => (this._viewportSize = null));\n });\n }\n ngOnDestroy() {\n if (this._platform.isBrowser) {\n const window = this._getWindow();\n window.removeEventListener('resize', this._changeListener);\n window.removeEventListener('orientationchange', this._changeListener);\n }\n this._change.complete();\n }\n /** Returns the viewport's width and height. */\n getViewportSize() {\n if (!this._viewportSize) {\n this._updateViewportSize();\n }\n const output = { width: this._viewportSize.width, height: this._viewportSize.height };\n // If we're not on a browser, don't cache the size since it'll be mocked out anyway.\n if (!this._platform.isBrowser) {\n this._viewportSize = null;\n }\n return output;\n }\n /** Gets a DOMRect for the viewport's bounds. */\n getViewportRect() {\n // Use the document element's bounding rect rather than the window scroll properties\n // (e.g. pageYOffset, scrollY) due to in issue in Chrome and IE where window scroll\n // properties and client coordinates (boundingClientRect, clientX/Y, etc.) are in different\n // conceptual viewports. Under most circumstances these viewports are equivalent, but they\n // can disagree when the page is pinch-zoomed (on devices that support touch).\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=489206#c4\n // We use the documentElement instead of the body because, by default (without a css reset)\n // browsers typically give the document body an 8px margin, which is not included in\n // getBoundingClientRect().\n const scrollPosition = this.getViewportScrollPosition();\n const { width, height } = this.getViewportSize();\n return {\n top: scrollPosition.top,\n left: scrollPosition.left,\n bottom: scrollPosition.top + height,\n right: scrollPosition.left + width,\n height,\n width,\n };\n }\n /** Gets the (top, left) scroll position of the viewport. */\n getViewportScrollPosition() {\n // While we can get a reference to the fake document\n // during SSR, it doesn't have getBoundingClientRect.\n if (!this._platform.isBrowser) {\n return { top: 0, left: 0 };\n }\n // The top-left-corner of the viewport is determined by the scroll position of the document\n // body, normally just (scrollLeft, scrollTop). However, Chrome and Firefox disagree about\n // whether `document.body` or `document.documentElement` is the scrolled element, so reading\n // `scrollTop` and `scrollLeft` is inconsistent. However, using the bounding rect of\n // `document.documentElement` works consistently, where the `top` and `left` values will\n // equal negative the scroll position.\n const document = this._document;\n const window = this._getWindow();\n const documentElement = document.documentElement;\n const documentRect = documentElement.getBoundingClientRect();\n const top = -documentRect.top ||\n document.body.scrollTop ||\n window.scrollY ||\n documentElement.scrollTop ||\n 0;\n const left = -documentRect.left ||\n document.body.scrollLeft ||\n window.scrollX ||\n documentElement.scrollLeft ||\n 0;\n return { top, left };\n }\n /**\n * Returns a stream that emits whenever the size of the viewport changes.\n * This stream emits outside of the Angular zone.\n * @param throttleTime Time in milliseconds to throttle the stream.\n */\n change(throttleTime = DEFAULT_RESIZE_TIME) {\n return throttleTime > 0 ? this._change.pipe(auditTime(throttleTime)) : this._change;\n }\n /** Use defaultView of injected document if available or fallback to global window reference */\n _getWindow() {\n return this._document.defaultView || window;\n }\n /** Updates the cached viewport size. */\n _updateViewportSize() {\n const window = this._getWindow();\n this._viewportSize = this._platform.isBrowser\n ? { width: window.innerWidth, height: window.innerHeight }\n : { width: 0, height: 0 };\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: ViewportRuler, deps: [{ token: i1.Platform }, { token: i0.NgZone }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: ViewportRuler, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: ViewportRuler, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }], ctorParameters: () => [{ type: i1.Platform }, { type: i0.NgZone }, { type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: [DOCUMENT]\n }] }] });\n\nconst VIRTUAL_SCROLLABLE = new InjectionToken('VIRTUAL_SCROLLABLE');\n/**\n * Extending the {@link CdkScrollable} to be used as scrolling container for virtual scrolling.\n */\nclass CdkVirtualScrollable extends CdkScrollable {\n constructor(elementRef, scrollDispatcher, ngZone, dir) {\n super(elementRef, scrollDispatcher, ngZone, dir);\n }\n /**\n * Measure the viewport size for the provided orientation.\n *\n * @param orientation The orientation to measure the size from.\n */\n measureViewportSize(orientation) {\n const viewportEl = this.elementRef.nativeElement;\n return orientation === 'horizontal' ? viewportEl.clientWidth : viewportEl.clientHeight;\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkVirtualScrollable, deps: [{ token: i0.ElementRef }, { token: ScrollDispatcher }, { token: i0.NgZone }, { token: i2.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.0\", type: CdkVirtualScrollable, usesInheritance: true, ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkVirtualScrollable, decorators: [{\n type: Directive\n }], ctorParameters: () => [{ type: i0.ElementRef }, { type: ScrollDispatcher }, { type: i0.NgZone }, { type: i2.Directionality, decorators: [{\n type: Optional\n }] }] });\n\n/** Checks if the given ranges are equal. */\nfunction rangesEqual(r1, r2) {\n return r1.start == r2.start && r1.end == r2.end;\n}\n/**\n * Scheduler to be used for scroll events. Needs to fall back to\n * something that doesn't rely on requestAnimationFrame on environments\n * that don't support it (e.g. server-side rendering).\n */\nconst SCROLL_SCHEDULER = typeof requestAnimationFrame !== 'undefined' ? animationFrameScheduler : asapScheduler;\n/** A viewport that virtualizes its scrolling with the help of `CdkVirtualForOf`. */\nclass CdkVirtualScrollViewport extends CdkVirtualScrollable {\n /** The direction the viewport scrolls. */\n get orientation() {\n return this._orientation;\n }\n set orientation(orientation) {\n if (this._orientation !== orientation) {\n this._orientation = orientation;\n this._calculateSpacerSize();\n }\n }\n constructor(elementRef, _changeDetectorRef, ngZone, _scrollStrategy, dir, scrollDispatcher, viewportRuler, scrollable) {\n super(elementRef, scrollDispatcher, ngZone, dir);\n this.elementRef = elementRef;\n this._changeDetectorRef = _changeDetectorRef;\n this._scrollStrategy = _scrollStrategy;\n this.scrollable = scrollable;\n this._platform = inject(Platform);\n /** Emits when the viewport is detached from a CdkVirtualForOf. */\n this._detachedSubject = new Subject();\n /** Emits when the rendered range changes. */\n this._renderedRangeSubject = new Subject();\n this._orientation = 'vertical';\n /**\n * Whether rendered items should persist in the DOM after scrolling out of view. By default, items\n * will be removed.\n */\n this.appendOnly = false;\n // Note: we don't use the typical EventEmitter here because we need to subscribe to the scroll\n // strategy lazily (i.e. only if the user is actually listening to the events). We do this because\n // depending on how the strategy calculates the scrolled index, it may come at a cost to\n // performance.\n /** Emits when the index of the first element visible in the viewport changes. */\n this.scrolledIndexChange = new Observable((observer) => this._scrollStrategy.scrolledIndexChange.subscribe(index => Promise.resolve().then(() => this.ngZone.run(() => observer.next(index)))));\n /** A stream that emits whenever the rendered range changes. */\n this.renderedRangeStream = this._renderedRangeSubject;\n /**\n * The total size of all content (in pixels), including content that is not currently rendered.\n */\n this._totalContentSize = 0;\n /** A string representing the `style.width` property value to be used for the spacer element. */\n this._totalContentWidth = '';\n /** A string representing the `style.height` property value to be used for the spacer element. */\n this._totalContentHeight = '';\n /** The currently rendered range of indices. */\n this._renderedRange = { start: 0, end: 0 };\n /** The length of the data bound to this viewport (in number of items). */\n this._dataLength = 0;\n /** The size of the viewport (in pixels). */\n this._viewportSize = 0;\n /** The last rendered content offset that was set. */\n this._renderedContentOffset = 0;\n /**\n * Whether the last rendered content offset was to the end of the content (and therefore needs to\n * be rewritten as an offset to the start of the content).\n */\n this._renderedContentOffsetNeedsRewrite = false;\n /** Whether there is a pending change detection cycle. */\n this._isChangeDetectionPending = false;\n /** A list of functions to run after the next change detection cycle. */\n this._runAfterChangeDetection = [];\n /** Subscription to changes in the viewport size. */\n this._viewportChanges = Subscription.EMPTY;\n this._injector = inject(Injector);\n this._isDestroyed = false;\n if (!_scrollStrategy && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error('Error: cdk-virtual-scroll-viewport requires the \"itemSize\" property to be set.');\n }\n this._viewportChanges = viewportRuler.change().subscribe(() => {\n this.checkViewportSize();\n });\n if (!this.scrollable) {\n // No scrollable is provided, so the virtual-scroll-viewport needs to become a scrollable\n this.elementRef.nativeElement.classList.add('cdk-virtual-scrollable');\n this.scrollable = this;\n }\n }\n ngOnInit() {\n // Scrolling depends on the element dimensions which we can't get during SSR.\n if (!this._platform.isBrowser) {\n return;\n }\n if (this.scrollable === this) {\n super.ngOnInit();\n }\n // It's still too early to measure the viewport at this point. Deferring with a promise allows\n // the Viewport to be rendered with the correct size before we measure. We run this outside the\n // zone to avoid causing more change detection cycles. We handle the change detection loop\n // ourselves instead.\n this.ngZone.runOutsideAngular(() => Promise.resolve().then(() => {\n this._measureViewportSize();\n this._scrollStrategy.attach(this);\n this.scrollable\n .elementScrolled()\n .pipe(\n // Start off with a fake scroll event so we properly detect our initial position.\n startWith(null), \n // Collect multiple events into one until the next animation frame. This way if\n // there are multiple scroll events in the same frame we only need to recheck\n // our layout once.\n auditTime(0, SCROLL_SCHEDULER), \n // Usually `elementScrolled` is completed when the scrollable is destroyed, but\n // that may not be the case if a `CdkVirtualScrollableElement` is used so we have\n // to unsubscribe here just in case.\n takeUntil(this._destroyed))\n .subscribe(() => this._scrollStrategy.onContentScrolled());\n this._markChangeDetectionNeeded();\n }));\n }\n ngOnDestroy() {\n this.detach();\n this._scrollStrategy.detach();\n // Complete all subjects\n this._renderedRangeSubject.complete();\n this._detachedSubject.complete();\n this._viewportChanges.unsubscribe();\n this._isDestroyed = true;\n super.ngOnDestroy();\n }\n /** Attaches a `CdkVirtualScrollRepeater` to this viewport. */\n attach(forOf) {\n if (this._forOf && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error('CdkVirtualScrollViewport is already attached.');\n }\n // Subscribe to the data stream of the CdkVirtualForOf to keep track of when the data length\n // changes. Run outside the zone to avoid triggering change detection, since we're managing the\n // change detection loop ourselves.\n this.ngZone.runOutsideAngular(() => {\n this._forOf = forOf;\n this._forOf.dataStream.pipe(takeUntil(this._detachedSubject)).subscribe(data => {\n const newLength = data.length;\n if (newLength !== this._dataLength) {\n this._dataLength = newLength;\n this._scrollStrategy.onDataLengthChanged();\n }\n this._doChangeDetection();\n });\n });\n }\n /** Detaches the current `CdkVirtualForOf`. */\n detach() {\n this._forOf = null;\n this._detachedSubject.next();\n }\n /** Gets the length of the data bound to this viewport (in number of items). */\n getDataLength() {\n return this._dataLength;\n }\n /** Gets the size of the viewport (in pixels). */\n getViewportSize() {\n return this._viewportSize;\n }\n // TODO(mmalerba): This is technically out of sync with what's really rendered until a render\n // cycle happens. I'm being careful to only call it after the render cycle is complete and before\n // setting it to something else, but its error prone and should probably be split into\n // `pendingRange` and `renderedRange`, the latter reflecting whats actually in the DOM.\n /** Get the current rendered range of items. */\n getRenderedRange() {\n return this._renderedRange;\n }\n measureBoundingClientRectWithScrollOffset(from) {\n return this.getElementRef().nativeElement.getBoundingClientRect()[from];\n }\n /**\n * Sets the total size of all content (in pixels), including content that is not currently\n * rendered.\n */\n setTotalContentSize(size) {\n if (this._totalContentSize !== size) {\n this._totalContentSize = size;\n this._calculateSpacerSize();\n this._markChangeDetectionNeeded();\n }\n }\n /** Sets the currently rendered range of indices. */\n setRenderedRange(range) {\n if (!rangesEqual(this._renderedRange, range)) {\n if (this.appendOnly) {\n range = { start: 0, end: Math.max(this._renderedRange.end, range.end) };\n }\n this._renderedRangeSubject.next((this._renderedRange = range));\n this._markChangeDetectionNeeded(() => this._scrollStrategy.onContentRendered());\n }\n }\n /**\n * Gets the offset from the start of the viewport to the start of the rendered data (in pixels).\n */\n getOffsetToRenderedContentStart() {\n return this._renderedContentOffsetNeedsRewrite ? null : this._renderedContentOffset;\n }\n /**\n * Sets the offset from the start of the viewport to either the start or end of the rendered data\n * (in pixels).\n */\n setRenderedContentOffset(offset, to = 'to-start') {\n // In appendOnly, we always start from the top\n offset = this.appendOnly && to === 'to-start' ? 0 : offset;\n // For a horizontal viewport in a right-to-left language we need to translate along the x-axis\n // in the negative direction.\n const isRtl = this.dir && this.dir.value == 'rtl';\n const isHorizontal = this.orientation == 'horizontal';\n const axis = isHorizontal ? 'X' : 'Y';\n const axisDirection = isHorizontal && isRtl ? -1 : 1;\n let transform = `translate${axis}(${Number(axisDirection * offset)}px)`;\n this._renderedContentOffset = offset;\n if (to === 'to-end') {\n transform += ` translate${axis}(-100%)`;\n // The viewport should rewrite this as a `to-start` offset on the next render cycle. Otherwise\n // elements will appear to expand in the wrong direction (e.g. `mat-expansion-panel` would\n // expand upward).\n this._renderedContentOffsetNeedsRewrite = true;\n }\n if (this._renderedContentTransform != transform) {\n // We know this value is safe because we parse `offset` with `Number()` before passing it\n // into the string.\n this._renderedContentTransform = transform;\n this._markChangeDetectionNeeded(() => {\n if (this._renderedContentOffsetNeedsRewrite) {\n this._renderedContentOffset -= this.measureRenderedContentSize();\n this._renderedContentOffsetNeedsRewrite = false;\n this.setRenderedContentOffset(this._renderedContentOffset);\n }\n else {\n this._scrollStrategy.onRenderedOffsetChanged();\n }\n });\n }\n }\n /**\n * Scrolls to the given offset from the start of the viewport. Please note that this is not always\n * the same as setting `scrollTop` or `scrollLeft`. In a horizontal viewport with right-to-left\n * direction, this would be the equivalent of setting a fictional `scrollRight` property.\n * @param offset The offset to scroll to.\n * @param behavior The ScrollBehavior to use when scrolling. Default is behavior is `auto`.\n */\n scrollToOffset(offset, behavior = 'auto') {\n const options = { behavior };\n if (this.orientation === 'horizontal') {\n options.start = offset;\n }\n else {\n options.top = offset;\n }\n this.scrollable.scrollTo(options);\n }\n /**\n * Scrolls to the offset for the given index.\n * @param index The index of the element to scroll to.\n * @param behavior The ScrollBehavior to use when scrolling. Default is behavior is `auto`.\n */\n scrollToIndex(index, behavior = 'auto') {\n this._scrollStrategy.scrollToIndex(index, behavior);\n }\n /**\n * Gets the current scroll offset from the start of the scrollable (in pixels).\n * @param from The edge to measure the offset from. Defaults to 'top' in vertical mode and 'start'\n * in horizontal mode.\n */\n measureScrollOffset(from) {\n // This is to break the call cycle\n let measureScrollOffset;\n if (this.scrollable == this) {\n measureScrollOffset = (_from) => super.measureScrollOffset(_from);\n }\n else {\n measureScrollOffset = (_from) => this.scrollable.measureScrollOffset(_from);\n }\n return Math.max(0, measureScrollOffset(from ?? (this.orientation === 'horizontal' ? 'start' : 'top')) -\n this.measureViewportOffset());\n }\n /**\n * Measures the offset of the viewport from the scrolling container\n * @param from The edge to measure from.\n */\n measureViewportOffset(from) {\n let fromRect;\n const LEFT = 'left';\n const RIGHT = 'right';\n const isRtl = this.dir?.value == 'rtl';\n if (from == 'start') {\n fromRect = isRtl ? RIGHT : LEFT;\n }\n else if (from == 'end') {\n fromRect = isRtl ? LEFT : RIGHT;\n }\n else if (from) {\n fromRect = from;\n }\n else {\n fromRect = this.orientation === 'horizontal' ? 'left' : 'top';\n }\n const scrollerClientRect = this.scrollable.measureBoundingClientRectWithScrollOffset(fromRect);\n const viewportClientRect = this.elementRef.nativeElement.getBoundingClientRect()[fromRect];\n return viewportClientRect - scrollerClientRect;\n }\n /** Measure the combined size of all of the rendered items. */\n measureRenderedContentSize() {\n const contentEl = this._contentWrapper.nativeElement;\n return this.orientation === 'horizontal' ? contentEl.offsetWidth : contentEl.offsetHeight;\n }\n /**\n * Measure the total combined size of the given range. Throws if the range includes items that are\n * not rendered.\n */\n measureRangeSize(range) {\n if (!this._forOf) {\n return 0;\n }\n return this._forOf.measureRangeSize(range, this.orientation);\n }\n /** Update the viewport dimensions and re-render. */\n checkViewportSize() {\n // TODO: Cleanup later when add logic for handling content resize\n this._measureViewportSize();\n this._scrollStrategy.onDataLengthChanged();\n }\n /** Measure the viewport size. */\n _measureViewportSize() {\n this._viewportSize = this.scrollable.measureViewportSize(this.orientation);\n }\n /** Queue up change detection to run. */\n _markChangeDetectionNeeded(runAfter) {\n if (runAfter) {\n this._runAfterChangeDetection.push(runAfter);\n }\n // Use a Promise to batch together calls to `_doChangeDetection`. This way if we set a bunch of\n // properties sequentially we only have to run `_doChangeDetection` once at the end.\n if (!this._isChangeDetectionPending) {\n this._isChangeDetectionPending = true;\n this.ngZone.runOutsideAngular(() => Promise.resolve().then(() => {\n this._doChangeDetection();\n }));\n }\n }\n /** Run change detection. */\n _doChangeDetection() {\n if (this._isDestroyed) {\n return;\n }\n this.ngZone.run(() => {\n // Apply changes to Angular bindings. Note: We must call `markForCheck` to run change detection\n // from the root, since the repeated items are content projected in. Calling `detectChanges`\n // instead does not properly check the projected content.\n this._changeDetectorRef.markForCheck();\n // Apply the content transform. The transform can't be set via an Angular binding because\n // bypassSecurityTrustStyle is banned in Google. However the value is safe, it's composed of\n // string literals, a variable that can only be 'X' or 'Y', and user input that is run through\n // the `Number` function first to coerce it to a numeric value.\n this._contentWrapper.nativeElement.style.transform = this._renderedContentTransform;\n afterNextRender(() => {\n this._isChangeDetectionPending = false;\n const runAfterChangeDetection = this._runAfterChangeDetection;\n this._runAfterChangeDetection = [];\n for (const fn of runAfterChangeDetection) {\n fn();\n }\n }, { injector: this._injector });\n });\n }\n /** Calculates the `style.width` and `style.height` for the spacer element. */\n _calculateSpacerSize() {\n this._totalContentHeight =\n this.orientation === 'horizontal' ? '' : `${this._totalContentSize}px`;\n this._totalContentWidth =\n this.orientation === 'horizontal' ? `${this._totalContentSize}px` : '';\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkVirtualScrollViewport, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: VIRTUAL_SCROLL_STRATEGY, optional: true }, { token: i2.Directionality, optional: true }, { token: ScrollDispatcher }, { token: ViewportRuler }, { token: VIRTUAL_SCROLLABLE, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }\n static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: \"16.1.0\", version: \"18.0.0\", type: CdkVirtualScrollViewport, isStandalone: true, selector: \"cdk-virtual-scroll-viewport\", inputs: { orientation: \"orientation\", appendOnly: [\"appendOnly\", \"appendOnly\", booleanAttribute] }, outputs: { scrolledIndexChange: \"scrolledIndexChange\" }, host: { properties: { \"class.cdk-virtual-scroll-orientation-horizontal\": \"orientation === \\\"horizontal\\\"\", \"class.cdk-virtual-scroll-orientation-vertical\": \"orientation !== \\\"horizontal\\\"\" }, classAttribute: \"cdk-virtual-scroll-viewport\" }, providers: [\n {\n provide: CdkScrollable,\n useFactory: (virtualScrollable, viewport) => virtualScrollable || viewport,\n deps: [[new Optional(), new Inject(VIRTUAL_SCROLLABLE)], CdkVirtualScrollViewport],\n },\n ], viewQueries: [{ propertyName: \"_contentWrapper\", first: true, predicate: [\"contentWrapper\"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: \"\\n
\\n \\n
\\n\\n
\\n\", styles: [\"cdk-virtual-scroll-viewport{display:block;position:relative;transform:translateZ(0)}.cdk-virtual-scrollable{overflow:auto;will-change:scroll-position;contain:strict;-webkit-overflow-scrolling:touch}.cdk-virtual-scroll-content-wrapper{position:absolute;top:0;left:0;contain:content}[dir=rtl] .cdk-virtual-scroll-content-wrapper{right:0;left:auto}.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper{min-height:100%}.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>dl:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>ol:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>table:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>ul:not([cdkVirtualFor]){padding-left:0;padding-right:0;margin-left:0;margin-right:0;border-left-width:0;border-right-width:0;outline:none}.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper{min-width:100%}.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>dl:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>ol:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>table:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>ul:not([cdkVirtualFor]){padding-top:0;padding-bottom:0;margin-top:0;margin-bottom:0;border-top-width:0;border-bottom-width:0;outline:none}.cdk-virtual-scroll-spacer{height:1px;transform-origin:0 0;flex:0 0 auto}[dir=rtl] .cdk-virtual-scroll-spacer{transform-origin:100% 0}\"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkVirtualScrollViewport, decorators: [{\n type: Component,\n args: [{ selector: 'cdk-virtual-scroll-viewport', host: {\n 'class': 'cdk-virtual-scroll-viewport',\n '[class.cdk-virtual-scroll-orientation-horizontal]': 'orientation === \"horizontal\"',\n '[class.cdk-virtual-scroll-orientation-vertical]': 'orientation !== \"horizontal\"',\n }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, providers: [\n {\n provide: CdkScrollable,\n useFactory: (virtualScrollable, viewport) => virtualScrollable || viewport,\n deps: [[new Optional(), new Inject(VIRTUAL_SCROLLABLE)], CdkVirtualScrollViewport],\n },\n ], template: \"\\n
\\n \\n
\\n\\n
\\n\", styles: [\"cdk-virtual-scroll-viewport{display:block;position:relative;transform:translateZ(0)}.cdk-virtual-scrollable{overflow:auto;will-change:scroll-position;contain:strict;-webkit-overflow-scrolling:touch}.cdk-virtual-scroll-content-wrapper{position:absolute;top:0;left:0;contain:content}[dir=rtl] .cdk-virtual-scroll-content-wrapper{right:0;left:auto}.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper{min-height:100%}.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>dl:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>ol:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>table:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-horizontal .cdk-virtual-scroll-content-wrapper>ul:not([cdkVirtualFor]){padding-left:0;padding-right:0;margin-left:0;margin-right:0;border-left-width:0;border-right-width:0;outline:none}.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper{min-width:100%}.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>dl:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>ol:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>table:not([cdkVirtualFor]),.cdk-virtual-scroll-orientation-vertical .cdk-virtual-scroll-content-wrapper>ul:not([cdkVirtualFor]){padding-top:0;padding-bottom:0;margin-top:0;margin-bottom:0;border-top-width:0;border-bottom-width:0;outline:none}.cdk-virtual-scroll-spacer{height:1px;transform-origin:0 0;flex:0 0 auto}[dir=rtl] .cdk-virtual-scroll-spacer{transform-origin:100% 0}\"] }]\n }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: [VIRTUAL_SCROLL_STRATEGY]\n }] }, { type: i2.Directionality, decorators: [{\n type: Optional\n }] }, { type: ScrollDispatcher }, { type: ViewportRuler }, { type: CdkVirtualScrollable, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: [VIRTUAL_SCROLLABLE]\n }] }], propDecorators: { orientation: [{\n type: Input\n }], appendOnly: [{\n type: Input,\n args: [{ transform: booleanAttribute }]\n }], scrolledIndexChange: [{\n type: Output\n }], _contentWrapper: [{\n type: ViewChild,\n args: ['contentWrapper', { static: true }]\n }] } });\n\n/** Helper to extract the offset of a DOM Node in a certain direction. */\nfunction getOffset(orientation, direction, node) {\n const el = node;\n if (!el.getBoundingClientRect) {\n return 0;\n }\n const rect = el.getBoundingClientRect();\n if (orientation === 'horizontal') {\n return direction === 'start' ? rect.left : rect.right;\n }\n return direction === 'start' ? rect.top : rect.bottom;\n}\n/**\n * A directive similar to `ngForOf` to be used for rendering data inside a virtual scrolling\n * container.\n */\nclass CdkVirtualForOf {\n /** The DataSource to display. */\n get cdkVirtualForOf() {\n return this._cdkVirtualForOf;\n }\n set cdkVirtualForOf(value) {\n this._cdkVirtualForOf = value;\n if (isDataSource(value)) {\n this._dataSourceChanges.next(value);\n }\n else {\n // If value is an an NgIterable, convert it to an array.\n this._dataSourceChanges.next(new ArrayDataSource(isObservable(value) ? value : Array.from(value || [])));\n }\n }\n /**\n * The `TrackByFunction` to use for tracking changes. The `TrackByFunction` takes the index and\n * the item and produces a value to be used as the item's identity when tracking changes.\n */\n get cdkVirtualForTrackBy() {\n return this._cdkVirtualForTrackBy;\n }\n set cdkVirtualForTrackBy(fn) {\n this._needsUpdate = true;\n this._cdkVirtualForTrackBy = fn\n ? (index, item) => fn(index + (this._renderedRange ? this._renderedRange.start : 0), item)\n : undefined;\n }\n /** The template used to stamp out new elements. */\n set cdkVirtualForTemplate(value) {\n if (value) {\n this._needsUpdate = true;\n this._template = value;\n }\n }\n /**\n * The size of the cache used to store templates that are not being used for re-use later.\n * Setting the cache size to `0` will disable caching. Defaults to 20 templates.\n */\n get cdkVirtualForTemplateCacheSize() {\n return this._viewRepeater.viewCacheSize;\n }\n set cdkVirtualForTemplateCacheSize(size) {\n this._viewRepeater.viewCacheSize = coerceNumberProperty(size);\n }\n constructor(\n /** The view container to add items to. */\n _viewContainerRef, \n /** The template to use when stamping out new items. */\n _template, \n /** The set of available differs. */\n _differs, \n /** The strategy used to render items in the virtual scroll viewport. */\n _viewRepeater, \n /** The virtual scrolling viewport that these items are being rendered in. */\n _viewport, ngZone) {\n this._viewContainerRef = _viewContainerRef;\n this._template = _template;\n this._differs = _differs;\n this._viewRepeater = _viewRepeater;\n this._viewport = _viewport;\n /** Emits when the rendered view of the data changes. */\n this.viewChange = new Subject();\n /** Subject that emits when a new DataSource instance is given. */\n this._dataSourceChanges = new Subject();\n /** Emits whenever the data in the current DataSource changes. */\n this.dataStream = this._dataSourceChanges.pipe(\n // Start off with null `DataSource`.\n startWith(null), \n // Bundle up the previous and current data sources so we can work with both.\n pairwise(), \n // Use `_changeDataSource` to disconnect from the previous data source and connect to the\n // new one, passing back a stream of data changes which we run through `switchMap` to give\n // us a data stream that emits the latest data from whatever the current `DataSource` is.\n switchMap(([prev, cur]) => this._changeDataSource(prev, cur)), \n // Replay the last emitted data when someone subscribes.\n shareReplay(1));\n /** The differ used to calculate changes to the data. */\n this._differ = null;\n /** Whether the rendered data should be updated during the next ngDoCheck cycle. */\n this._needsUpdate = false;\n this._destroyed = new Subject();\n this.dataStream.subscribe(data => {\n this._data = data;\n this._onRenderedDataChange();\n });\n this._viewport.renderedRangeStream.pipe(takeUntil(this._destroyed)).subscribe(range => {\n this._renderedRange = range;\n if (this.viewChange.observers.length) {\n ngZone.run(() => this.viewChange.next(this._renderedRange));\n }\n this._onRenderedDataChange();\n });\n this._viewport.attach(this);\n }\n /**\n * Measures the combined size (width for horizontal orientation, height for vertical) of all items\n * in the specified range. Throws an error if the range includes items that are not currently\n * rendered.\n */\n measureRangeSize(range, orientation) {\n if (range.start >= range.end) {\n return 0;\n }\n if ((range.start < this._renderedRange.start || range.end > this._renderedRange.end) &&\n (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error(`Error: attempted to measure an item that isn't rendered.`);\n }\n // The index into the list of rendered views for the first item in the range.\n const renderedStartIndex = range.start - this._renderedRange.start;\n // The length of the range we're measuring.\n const rangeLen = range.end - range.start;\n // Loop over all the views, find the first and land node and compute the size by subtracting\n // the top of the first node from the bottom of the last one.\n let firstNode;\n let lastNode;\n // Find the first node by starting from the beginning and going forwards.\n for (let i = 0; i < rangeLen; i++) {\n const view = this._viewContainerRef.get(i + renderedStartIndex);\n if (view && view.rootNodes.length) {\n firstNode = lastNode = view.rootNodes[0];\n break;\n }\n }\n // Find the last node by starting from the end and going backwards.\n for (let i = rangeLen - 1; i > -1; i--) {\n const view = this._viewContainerRef.get(i + renderedStartIndex);\n if (view && view.rootNodes.length) {\n lastNode = view.rootNodes[view.rootNodes.length - 1];\n break;\n }\n }\n return firstNode && lastNode\n ? getOffset(orientation, 'end', lastNode) - getOffset(orientation, 'start', firstNode)\n : 0;\n }\n ngDoCheck() {\n if (this._differ && this._needsUpdate) {\n // TODO(mmalerba): We should differentiate needs update due to scrolling and a new portion of\n // this list being rendered (can use simpler algorithm) vs needs update due to data actually\n // changing (need to do this diff).\n const changes = this._differ.diff(this._renderedItems);\n if (!changes) {\n this._updateContext();\n }\n else {\n this._applyChanges(changes);\n }\n this._needsUpdate = false;\n }\n }\n ngOnDestroy() {\n this._viewport.detach();\n this._dataSourceChanges.next(undefined);\n this._dataSourceChanges.complete();\n this.viewChange.complete();\n this._destroyed.next();\n this._destroyed.complete();\n this._viewRepeater.detach();\n }\n /** React to scroll state changes in the viewport. */\n _onRenderedDataChange() {\n if (!this._renderedRange) {\n return;\n }\n this._renderedItems = this._data.slice(this._renderedRange.start, this._renderedRange.end);\n if (!this._differ) {\n // Use a wrapper function for the `trackBy` so any new values are\n // picked up automatically without having to recreate the differ.\n this._differ = this._differs.find(this._renderedItems).create((index, item) => {\n return this.cdkVirtualForTrackBy ? this.cdkVirtualForTrackBy(index, item) : item;\n });\n }\n this._needsUpdate = true;\n }\n /** Swap out one `DataSource` for another. */\n _changeDataSource(oldDs, newDs) {\n if (oldDs) {\n oldDs.disconnect(this);\n }\n this._needsUpdate = true;\n return newDs ? newDs.connect(this) : of();\n }\n /** Update the `CdkVirtualForOfContext` for all views. */\n _updateContext() {\n const count = this._data.length;\n let i = this._viewContainerRef.length;\n while (i--) {\n const view = this._viewContainerRef.get(i);\n view.context.index = this._renderedRange.start + i;\n view.context.count = count;\n this._updateComputedContextProperties(view.context);\n view.detectChanges();\n }\n }\n /** Apply changes to the DOM. */\n _applyChanges(changes) {\n this._viewRepeater.applyChanges(changes, this._viewContainerRef, (record, _adjustedPreviousIndex, currentIndex) => this._getEmbeddedViewArgs(record, currentIndex), record => record.item);\n // Update $implicit for any items that had an identity change.\n changes.forEachIdentityChange((record) => {\n const view = this._viewContainerRef.get(record.currentIndex);\n view.context.$implicit = record.item;\n });\n // Update the context variables on all items.\n const count = this._data.length;\n let i = this._viewContainerRef.length;\n while (i--) {\n const view = this._viewContainerRef.get(i);\n view.context.index = this._renderedRange.start + i;\n view.context.count = count;\n this._updateComputedContextProperties(view.context);\n }\n }\n /** Update the computed properties on the `CdkVirtualForOfContext`. */\n _updateComputedContextProperties(context) {\n context.first = context.index === 0;\n context.last = context.index === context.count - 1;\n context.even = context.index % 2 === 0;\n context.odd = !context.even;\n }\n _getEmbeddedViewArgs(record, index) {\n // Note that it's important that we insert the item directly at the proper index,\n // rather than inserting it and the moving it in place, because if there's a directive\n // on the same node that injects the `ViewContainerRef`, Angular will insert another\n // comment node which can throw off the move when it's being repeated for all items.\n return {\n templateRef: this._template,\n context: {\n $implicit: record.item,\n // It's guaranteed that the iterable is not \"undefined\" or \"null\" because we only\n // generate views for elements if the \"cdkVirtualForOf\" iterable has elements.\n cdkVirtualForOf: this._cdkVirtualForOf,\n index: -1,\n count: -1,\n first: false,\n last: false,\n odd: false,\n even: false,\n },\n index,\n };\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkVirtualForOf, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }, { token: i0.IterableDiffers }, { token: _VIEW_REPEATER_STRATEGY }, { token: CdkVirtualScrollViewport, skipSelf: true }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.0\", type: CdkVirtualForOf, isStandalone: true, selector: \"[cdkVirtualFor][cdkVirtualForOf]\", inputs: { cdkVirtualForOf: \"cdkVirtualForOf\", cdkVirtualForTrackBy: \"cdkVirtualForTrackBy\", cdkVirtualForTemplate: \"cdkVirtualForTemplate\", cdkVirtualForTemplateCacheSize: \"cdkVirtualForTemplateCacheSize\" }, providers: [{ provide: _VIEW_REPEATER_STRATEGY, useClass: _RecycleViewRepeaterStrategy }], ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkVirtualForOf, decorators: [{\n type: Directive,\n args: [{\n selector: '[cdkVirtualFor][cdkVirtualForOf]',\n providers: [{ provide: _VIEW_REPEATER_STRATEGY, useClass: _RecycleViewRepeaterStrategy }],\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }, { type: i0.IterableDiffers }, { type: i2$1._RecycleViewRepeaterStrategy, decorators: [{\n type: Inject,\n args: [_VIEW_REPEATER_STRATEGY]\n }] }, { type: CdkVirtualScrollViewport, decorators: [{\n type: SkipSelf\n }] }, { type: i0.NgZone }], propDecorators: { cdkVirtualForOf: [{\n type: Input\n }], cdkVirtualForTrackBy: [{\n type: Input\n }], cdkVirtualForTemplate: [{\n type: Input\n }], cdkVirtualForTemplateCacheSize: [{\n type: Input\n }] } });\n\n/**\n * Provides a virtual scrollable for the element it is attached to.\n */\nclass CdkVirtualScrollableElement extends CdkVirtualScrollable {\n constructor(elementRef, scrollDispatcher, ngZone, dir) {\n super(elementRef, scrollDispatcher, ngZone, dir);\n }\n measureBoundingClientRectWithScrollOffset(from) {\n return (this.getElementRef().nativeElement.getBoundingClientRect()[from] -\n this.measureScrollOffset(from));\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkVirtualScrollableElement, deps: [{ token: i0.ElementRef }, { token: ScrollDispatcher }, { token: i0.NgZone }, { token: i2.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.0\", type: CdkVirtualScrollableElement, isStandalone: true, selector: \"[cdkVirtualScrollingElement]\", host: { classAttribute: \"cdk-virtual-scrollable\" }, providers: [{ provide: VIRTUAL_SCROLLABLE, useExisting: CdkVirtualScrollableElement }], usesInheritance: true, ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkVirtualScrollableElement, decorators: [{\n type: Directive,\n args: [{\n selector: '[cdkVirtualScrollingElement]',\n providers: [{ provide: VIRTUAL_SCROLLABLE, useExisting: CdkVirtualScrollableElement }],\n standalone: true,\n host: {\n 'class': 'cdk-virtual-scrollable',\n },\n }]\n }], ctorParameters: () => [{ type: i0.ElementRef }, { type: ScrollDispatcher }, { type: i0.NgZone }, { type: i2.Directionality, decorators: [{\n type: Optional\n }] }] });\n\n/**\n * Provides as virtual scrollable for the global / window scrollbar.\n */\nclass CdkVirtualScrollableWindow extends CdkVirtualScrollable {\n constructor(scrollDispatcher, ngZone, dir) {\n super(new ElementRef(document.documentElement), scrollDispatcher, ngZone, dir);\n this._elementScrolled = new Observable((observer) => this.ngZone.runOutsideAngular(() => fromEvent(document, 'scroll').pipe(takeUntil(this._destroyed)).subscribe(observer)));\n }\n measureBoundingClientRectWithScrollOffset(from) {\n return this.getElementRef().nativeElement.getBoundingClientRect()[from];\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkVirtualScrollableWindow, deps: [{ token: ScrollDispatcher }, { token: i0.NgZone }, { token: i2.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.0\", type: CdkVirtualScrollableWindow, isStandalone: true, selector: \"cdk-virtual-scroll-viewport[scrollWindow]\", providers: [{ provide: VIRTUAL_SCROLLABLE, useExisting: CdkVirtualScrollableWindow }], usesInheritance: true, ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkVirtualScrollableWindow, decorators: [{\n type: Directive,\n args: [{\n selector: 'cdk-virtual-scroll-viewport[scrollWindow]',\n providers: [{ provide: VIRTUAL_SCROLLABLE, useExisting: CdkVirtualScrollableWindow }],\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: ScrollDispatcher }, { type: i0.NgZone }, { type: i2.Directionality, decorators: [{\n type: Optional\n }] }] });\n\nclass CdkScrollableModule {\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkScrollableModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }\n static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"14.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkScrollableModule, imports: [CdkScrollable], exports: [CdkScrollable] }); }\n static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkScrollableModule }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkScrollableModule, decorators: [{\n type: NgModule,\n args: [{\n exports: [CdkScrollable],\n imports: [CdkScrollable],\n }]\n }] });\n/**\n * @docs-primary-export\n */\nclass ScrollingModule {\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: ScrollingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }\n static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"14.0.0\", version: \"18.0.0\", ngImport: i0, type: ScrollingModule, imports: [BidiModule, CdkScrollableModule, CdkVirtualScrollViewport,\n CdkFixedSizeVirtualScroll,\n CdkVirtualForOf,\n CdkVirtualScrollableWindow,\n CdkVirtualScrollableElement], exports: [BidiModule, CdkScrollableModule, CdkFixedSizeVirtualScroll,\n CdkVirtualForOf,\n CdkVirtualScrollViewport,\n CdkVirtualScrollableWindow,\n CdkVirtualScrollableElement] }); }\n static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: ScrollingModule, imports: [BidiModule,\n CdkScrollableModule, BidiModule, CdkScrollableModule] }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: ScrollingModule, decorators: [{\n type: NgModule,\n args: [{\n imports: [\n BidiModule,\n CdkScrollableModule,\n CdkVirtualScrollViewport,\n CdkFixedSizeVirtualScroll,\n CdkVirtualForOf,\n CdkVirtualScrollableWindow,\n CdkVirtualScrollableElement,\n ],\n exports: [\n BidiModule,\n CdkScrollableModule,\n CdkFixedSizeVirtualScroll,\n CdkVirtualForOf,\n CdkVirtualScrollViewport,\n CdkVirtualScrollableWindow,\n CdkVirtualScrollableElement,\n ],\n }]\n }] });\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { CdkFixedSizeVirtualScroll, CdkScrollable, CdkScrollableModule, CdkVirtualForOf, CdkVirtualScrollViewport, CdkVirtualScrollable, CdkVirtualScrollableElement, CdkVirtualScrollableWindow, DEFAULT_RESIZE_TIME, DEFAULT_SCROLL_TIME, FixedSizeVirtualScrollStrategy, ScrollDispatcher, ScrollingModule, VIRTUAL_SCROLLABLE, VIRTUAL_SCROLL_STRATEGY, ViewportRuler, _fixedSizeVirtualScrollStrategyFactory };\n","import * as i1 from '@angular/cdk/scrolling';\nimport { ScrollingModule } from '@angular/cdk/scrolling';\nexport { CdkScrollable, ScrollDispatcher, ViewportRuler } from '@angular/cdk/scrolling';\nimport * as i6 from '@angular/common';\nimport { DOCUMENT } from '@angular/common';\nimport * as i0 from '@angular/core';\nimport { Injectable, Inject, Optional, untracked, afterRender, afterNextRender, ElementRef, EnvironmentInjector, ApplicationRef, ANIMATION_MODULE_TYPE, InjectionToken, inject, Directive, NgZone, EventEmitter, booleanAttribute, Input, Output, NgModule } from '@angular/core';\nimport { coerceCssPixelValue, coerceArray } from '@angular/cdk/coercion';\nimport * as i1$1 from '@angular/cdk/platform';\nimport { supportsScrollBehavior, _getEventTarget, _isTestEnvironment } from '@angular/cdk/platform';\nimport { filter, takeUntil, takeWhile } from 'rxjs/operators';\nimport * as i5 from '@angular/cdk/bidi';\nimport { BidiModule } from '@angular/cdk/bidi';\nimport { DomPortalOutlet, TemplatePortal, PortalModule } from '@angular/cdk/portal';\nimport { Subject, Subscription, merge } from 'rxjs';\nimport { ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';\n\nconst scrollBehaviorSupported = supportsScrollBehavior();\n/**\n * Strategy that will prevent the user from scrolling while the overlay is visible.\n */\nclass BlockScrollStrategy {\n constructor(_viewportRuler, document) {\n this._viewportRuler = _viewportRuler;\n this._previousHTMLStyles = { top: '', left: '' };\n this._isEnabled = false;\n this._document = document;\n }\n /** Attaches this scroll strategy to an overlay. */\n attach() { }\n /** Blocks page-level scroll while the attached overlay is open. */\n enable() {\n if (this._canBeEnabled()) {\n const root = this._document.documentElement;\n this._previousScrollPosition = this._viewportRuler.getViewportScrollPosition();\n // Cache the previous inline styles in case the user had set them.\n this._previousHTMLStyles.left = root.style.left || '';\n this._previousHTMLStyles.top = root.style.top || '';\n // Note: we're using the `html` node, instead of the `body`, because the `body` may\n // have the user agent margin, whereas the `html` is guaranteed not to have one.\n root.style.left = coerceCssPixelValue(-this._previousScrollPosition.left);\n root.style.top = coerceCssPixelValue(-this._previousScrollPosition.top);\n root.classList.add('cdk-global-scrollblock');\n this._isEnabled = true;\n }\n }\n /** Unblocks page-level scroll while the attached overlay is open. */\n disable() {\n if (this._isEnabled) {\n const html = this._document.documentElement;\n const body = this._document.body;\n const htmlStyle = html.style;\n const bodyStyle = body.style;\n const previousHtmlScrollBehavior = htmlStyle.scrollBehavior || '';\n const previousBodyScrollBehavior = bodyStyle.scrollBehavior || '';\n this._isEnabled = false;\n htmlStyle.left = this._previousHTMLStyles.left;\n htmlStyle.top = this._previousHTMLStyles.top;\n html.classList.remove('cdk-global-scrollblock');\n // Disable user-defined smooth scrolling temporarily while we restore the scroll position.\n // See https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-behavior\n // Note that we don't mutate the property if the browser doesn't support `scroll-behavior`,\n // because it can throw off feature detections in `supportsScrollBehavior` which\n // checks for `'scrollBehavior' in documentElement.style`.\n if (scrollBehaviorSupported) {\n htmlStyle.scrollBehavior = bodyStyle.scrollBehavior = 'auto';\n }\n window.scroll(this._previousScrollPosition.left, this._previousScrollPosition.top);\n if (scrollBehaviorSupported) {\n htmlStyle.scrollBehavior = previousHtmlScrollBehavior;\n bodyStyle.scrollBehavior = previousBodyScrollBehavior;\n }\n }\n }\n _canBeEnabled() {\n // Since the scroll strategies can't be singletons, we have to use a global CSS class\n // (`cdk-global-scrollblock`) to make sure that we don't try to disable global\n // scrolling multiple times.\n const html = this._document.documentElement;\n if (html.classList.contains('cdk-global-scrollblock') || this._isEnabled) {\n return false;\n }\n const body = this._document.body;\n const viewport = this._viewportRuler.getViewportSize();\n return body.scrollHeight > viewport.height || body.scrollWidth > viewport.width;\n }\n}\n\n/**\n * Returns an error to be thrown when attempting to attach an already-attached scroll strategy.\n */\nfunction getMatScrollStrategyAlreadyAttachedError() {\n return Error(`Scroll strategy has already been attached.`);\n}\n\n/**\n * Strategy that will close the overlay as soon as the user starts scrolling.\n */\nclass CloseScrollStrategy {\n constructor(_scrollDispatcher, _ngZone, _viewportRuler, _config) {\n this._scrollDispatcher = _scrollDispatcher;\n this._ngZone = _ngZone;\n this._viewportRuler = _viewportRuler;\n this._config = _config;\n this._scrollSubscription = null;\n /** Detaches the overlay ref and disables the scroll strategy. */\n this._detach = () => {\n this.disable();\n if (this._overlayRef.hasAttached()) {\n this._ngZone.run(() => this._overlayRef.detach());\n }\n };\n }\n /** Attaches this scroll strategy to an overlay. */\n attach(overlayRef) {\n if (this._overlayRef && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw getMatScrollStrategyAlreadyAttachedError();\n }\n this._overlayRef = overlayRef;\n }\n /** Enables the closing of the attached overlay on scroll. */\n enable() {\n if (this._scrollSubscription) {\n return;\n }\n const stream = this._scrollDispatcher.scrolled(0).pipe(filter(scrollable => {\n return (!scrollable ||\n !this._overlayRef.overlayElement.contains(scrollable.getElementRef().nativeElement));\n }));\n if (this._config && this._config.threshold && this._config.threshold > 1) {\n this._initialScrollPosition = this._viewportRuler.getViewportScrollPosition().top;\n this._scrollSubscription = stream.subscribe(() => {\n const scrollPosition = this._viewportRuler.getViewportScrollPosition().top;\n if (Math.abs(scrollPosition - this._initialScrollPosition) > this._config.threshold) {\n this._detach();\n }\n else {\n this._overlayRef.updatePosition();\n }\n });\n }\n else {\n this._scrollSubscription = stream.subscribe(this._detach);\n }\n }\n /** Disables the closing the attached overlay on scroll. */\n disable() {\n if (this._scrollSubscription) {\n this._scrollSubscription.unsubscribe();\n this._scrollSubscription = null;\n }\n }\n detach() {\n this.disable();\n this._overlayRef = null;\n }\n}\n\n/** Scroll strategy that doesn't do anything. */\nclass NoopScrollStrategy {\n /** Does nothing, as this scroll strategy is a no-op. */\n enable() { }\n /** Does nothing, as this scroll strategy is a no-op. */\n disable() { }\n /** Does nothing, as this scroll strategy is a no-op. */\n attach() { }\n}\n\n/**\n * Gets whether an element is scrolled outside of view by any of its parent scrolling containers.\n * @param element Dimensions of the element (from getBoundingClientRect)\n * @param scrollContainers Dimensions of element's scrolling containers (from getBoundingClientRect)\n * @returns Whether the element is scrolled out of view\n * @docs-private\n */\nfunction isElementScrolledOutsideView(element, scrollContainers) {\n return scrollContainers.some(containerBounds => {\n const outsideAbove = element.bottom < containerBounds.top;\n const outsideBelow = element.top > containerBounds.bottom;\n const outsideLeft = element.right < containerBounds.left;\n const outsideRight = element.left > containerBounds.right;\n return outsideAbove || outsideBelow || outsideLeft || outsideRight;\n });\n}\n/**\n * Gets whether an element is clipped by any of its scrolling containers.\n * @param element Dimensions of the element (from getBoundingClientRect)\n * @param scrollContainers Dimensions of element's scrolling containers (from getBoundingClientRect)\n * @returns Whether the element is clipped\n * @docs-private\n */\nfunction isElementClippedByScrolling(element, scrollContainers) {\n return scrollContainers.some(scrollContainerRect => {\n const clippedAbove = element.top < scrollContainerRect.top;\n const clippedBelow = element.bottom > scrollContainerRect.bottom;\n const clippedLeft = element.left < scrollContainerRect.left;\n const clippedRight = element.right > scrollContainerRect.right;\n return clippedAbove || clippedBelow || clippedLeft || clippedRight;\n });\n}\n\n/**\n * Strategy that will update the element position as the user is scrolling.\n */\nclass RepositionScrollStrategy {\n constructor(_scrollDispatcher, _viewportRuler, _ngZone, _config) {\n this._scrollDispatcher = _scrollDispatcher;\n this._viewportRuler = _viewportRuler;\n this._ngZone = _ngZone;\n this._config = _config;\n this._scrollSubscription = null;\n }\n /** Attaches this scroll strategy to an overlay. */\n attach(overlayRef) {\n if (this._overlayRef && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw getMatScrollStrategyAlreadyAttachedError();\n }\n this._overlayRef = overlayRef;\n }\n /** Enables repositioning of the attached overlay on scroll. */\n enable() {\n if (!this._scrollSubscription) {\n const throttle = this._config ? this._config.scrollThrottle : 0;\n this._scrollSubscription = this._scrollDispatcher.scrolled(throttle).subscribe(() => {\n this._overlayRef.updatePosition();\n // TODO(crisbeto): make `close` on by default once all components can handle it.\n if (this._config && this._config.autoClose) {\n const overlayRect = this._overlayRef.overlayElement.getBoundingClientRect();\n const { width, height } = this._viewportRuler.getViewportSize();\n // TODO(crisbeto): include all ancestor scroll containers here once\n // we have a way of exposing the trigger element to the scroll strategy.\n const parentRects = [{ width, height, bottom: height, right: width, top: 0, left: 0 }];\n if (isElementScrolledOutsideView(overlayRect, parentRects)) {\n this.disable();\n this._ngZone.run(() => this._overlayRef.detach());\n }\n }\n });\n }\n }\n /** Disables repositioning of the attached overlay on scroll. */\n disable() {\n if (this._scrollSubscription) {\n this._scrollSubscription.unsubscribe();\n this._scrollSubscription = null;\n }\n }\n detach() {\n this.disable();\n this._overlayRef = null;\n }\n}\n\n/**\n * Options for how an overlay will handle scrolling.\n *\n * Users can provide a custom value for `ScrollStrategyOptions` to replace the default\n * behaviors. This class primarily acts as a factory for ScrollStrategy instances.\n */\nclass ScrollStrategyOptions {\n constructor(_scrollDispatcher, _viewportRuler, _ngZone, document) {\n this._scrollDispatcher = _scrollDispatcher;\n this._viewportRuler = _viewportRuler;\n this._ngZone = _ngZone;\n /** Do nothing on scroll. */\n this.noop = () => new NoopScrollStrategy();\n /**\n * Close the overlay as soon as the user scrolls.\n * @param config Configuration to be used inside the scroll strategy.\n */\n this.close = (config) => new CloseScrollStrategy(this._scrollDispatcher, this._ngZone, this._viewportRuler, config);\n /** Block scrolling. */\n this.block = () => new BlockScrollStrategy(this._viewportRuler, this._document);\n /**\n * Update the overlay's position on scroll.\n * @param config Configuration to be used inside the scroll strategy.\n * Allows debouncing the reposition calls.\n */\n this.reposition = (config) => new RepositionScrollStrategy(this._scrollDispatcher, this._viewportRuler, this._ngZone, config);\n this._document = document;\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: ScrollStrategyOptions, deps: [{ token: i1.ScrollDispatcher }, { token: i1.ViewportRuler }, { token: i0.NgZone }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: ScrollStrategyOptions, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: ScrollStrategyOptions, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }], ctorParameters: () => [{ type: i1.ScrollDispatcher }, { type: i1.ViewportRuler }, { type: i0.NgZone }, { type: undefined, decorators: [{\n type: Inject,\n args: [DOCUMENT]\n }] }] });\n\n/** Initial configuration used when creating an overlay. */\nclass OverlayConfig {\n constructor(config) {\n /** Strategy to be used when handling scroll events while the overlay is open. */\n this.scrollStrategy = new NoopScrollStrategy();\n /** Custom class to add to the overlay pane. */\n this.panelClass = '';\n /** Whether the overlay has a backdrop. */\n this.hasBackdrop = false;\n /** Custom class to add to the backdrop */\n this.backdropClass = 'cdk-overlay-dark-backdrop';\n /**\n * Whether the overlay should be disposed of when the user goes backwards/forwards in history.\n * Note that this usually doesn't include clicking on links (unless the user is using\n * the `HashLocationStrategy`).\n */\n this.disposeOnNavigation = false;\n if (config) {\n // Use `Iterable` instead of `Array` because TypeScript, as of 3.6.3,\n // loses the array generic type in the `for of`. But we *also* have to use `Array` because\n // typescript won't iterate over an `Iterable` unless you compile with `--downlevelIteration`\n const configKeys = Object.keys(config);\n for (const key of configKeys) {\n if (config[key] !== undefined) {\n // TypeScript, as of version 3.5, sees the left-hand-side of this expression\n // as \"I don't know *which* key this is, so the only valid value is the intersection\n // of all the possible values.\" In this case, that happens to be `undefined`. TypeScript\n // is not smart enough to see that the right-hand-side is actually an access of the same\n // exact type with the same exact key, meaning that the value type must be identical.\n // So we use `any` to work around this.\n this[key] = config[key];\n }\n }\n }\n }\n}\n\n/** The points of the origin element and the overlay element to connect. */\nclass ConnectionPositionPair {\n constructor(origin, overlay, \n /** Offset along the X axis. */\n offsetX, \n /** Offset along the Y axis. */\n offsetY, \n /** Class(es) to be applied to the panel while this position is active. */\n panelClass) {\n this.offsetX = offsetX;\n this.offsetY = offsetY;\n this.panelClass = panelClass;\n this.originX = origin.originX;\n this.originY = origin.originY;\n this.overlayX = overlay.overlayX;\n this.overlayY = overlay.overlayY;\n }\n}\n/**\n * Set of properties regarding the position of the origin and overlay relative to the viewport\n * with respect to the containing Scrollable elements.\n *\n * The overlay and origin are clipped if any part of their bounding client rectangle exceeds the\n * bounds of any one of the strategy's Scrollable's bounding client rectangle.\n *\n * The overlay and origin are outside view if there is no overlap between their bounding client\n * rectangle and any one of the strategy's Scrollable's bounding client rectangle.\n *\n * ----------- -----------\n * | outside | | clipped |\n * | view | --------------------------\n * | | | | | |\n * ---------- | ----------- |\n * -------------------------- | |\n * | | | Scrollable |\n * | | | |\n * | | --------------------------\n * | Scrollable |\n * | |\n * --------------------------\n *\n * @docs-private\n */\nclass ScrollingVisibility {\n}\n/** The change event emitted by the strategy when a fallback position is used. */\nclass ConnectedOverlayPositionChange {\n constructor(\n /** The position used as a result of this change. */\n connectionPair, \n /** @docs-private */\n scrollableViewProperties) {\n this.connectionPair = connectionPair;\n this.scrollableViewProperties = scrollableViewProperties;\n }\n}\n/**\n * Validates whether a vertical position property matches the expected values.\n * @param property Name of the property being validated.\n * @param value Value of the property being validated.\n * @docs-private\n */\nfunction validateVerticalPosition(property, value) {\n if (value !== 'top' && value !== 'bottom' && value !== 'center') {\n throw Error(`ConnectedPosition: Invalid ${property} \"${value}\". ` +\n `Expected \"top\", \"bottom\" or \"center\".`);\n }\n}\n/**\n * Validates whether a horizontal position property matches the expected values.\n * @param property Name of the property being validated.\n * @param value Value of the property being validated.\n * @docs-private\n */\nfunction validateHorizontalPosition(property, value) {\n if (value !== 'start' && value !== 'end' && value !== 'center') {\n throw Error(`ConnectedPosition: Invalid ${property} \"${value}\". ` +\n `Expected \"start\", \"end\" or \"center\".`);\n }\n}\n\n/**\n * Service for dispatching events that land on the body to appropriate overlay ref,\n * if any. It maintains a list of attached overlays to determine best suited overlay based\n * on event target and order of overlay opens.\n */\nclass BaseOverlayDispatcher {\n constructor(document) {\n /** Currently attached overlays in the order they were attached. */\n this._attachedOverlays = [];\n this._document = document;\n }\n ngOnDestroy() {\n this.detach();\n }\n /** Add a new overlay to the list of attached overlay refs. */\n add(overlayRef) {\n // Ensure that we don't get the same overlay multiple times.\n this.remove(overlayRef);\n this._attachedOverlays.push(overlayRef);\n }\n /** Remove an overlay from the list of attached overlay refs. */\n remove(overlayRef) {\n const index = this._attachedOverlays.indexOf(overlayRef);\n if (index > -1) {\n this._attachedOverlays.splice(index, 1);\n }\n // Remove the global listener once there are no more overlays.\n if (this._attachedOverlays.length === 0) {\n this.detach();\n }\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: BaseOverlayDispatcher, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: BaseOverlayDispatcher, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: BaseOverlayDispatcher, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }], ctorParameters: () => [{ type: undefined, decorators: [{\n type: Inject,\n args: [DOCUMENT]\n }] }] });\n\n/**\n * Service for dispatching keyboard events that land on the body to appropriate overlay ref,\n * if any. It maintains a list of attached overlays to determine best suited overlay based\n * on event target and order of overlay opens.\n */\nclass OverlayKeyboardDispatcher extends BaseOverlayDispatcher {\n constructor(document, \n /** @breaking-change 14.0.0 _ngZone will be required. */\n _ngZone) {\n super(document);\n this._ngZone = _ngZone;\n /** Keyboard event listener that will be attached to the body. */\n this._keydownListener = (event) => {\n const overlays = this._attachedOverlays;\n for (let i = overlays.length - 1; i > -1; i--) {\n // Dispatch the keydown event to the top overlay which has subscribers to its keydown events.\n // We want to target the most recent overlay, rather than trying to match where the event came\n // from, because some components might open an overlay, but keep focus on a trigger element\n // (e.g. for select and autocomplete). We skip overlays without keydown event subscriptions,\n // because we don't want overlays that don't handle keyboard events to block the ones below\n // them that do.\n if (overlays[i]._keydownEvents.observers.length > 0) {\n const keydownEvents = overlays[i]._keydownEvents;\n /** @breaking-change 14.0.0 _ngZone will be required. */\n if (this._ngZone) {\n this._ngZone.run(() => keydownEvents.next(event));\n }\n else {\n keydownEvents.next(event);\n }\n break;\n }\n }\n };\n }\n /** Add a new overlay to the list of attached overlay refs. */\n add(overlayRef) {\n super.add(overlayRef);\n // Lazily start dispatcher once first overlay is added\n if (!this._isAttached) {\n /** @breaking-change 14.0.0 _ngZone will be required. */\n if (this._ngZone) {\n this._ngZone.runOutsideAngular(() => this._document.body.addEventListener('keydown', this._keydownListener));\n }\n else {\n this._document.body.addEventListener('keydown', this._keydownListener);\n }\n this._isAttached = true;\n }\n }\n /** Detaches the global keyboard event listener. */\n detach() {\n if (this._isAttached) {\n this._document.body.removeEventListener('keydown', this._keydownListener);\n this._isAttached = false;\n }\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: OverlayKeyboardDispatcher, deps: [{ token: DOCUMENT }, { token: i0.NgZone, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: OverlayKeyboardDispatcher, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: OverlayKeyboardDispatcher, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }], ctorParameters: () => [{ type: undefined, decorators: [{\n type: Inject,\n args: [DOCUMENT]\n }] }, { type: i0.NgZone, decorators: [{\n type: Optional\n }] }] });\n\n/**\n * Service for dispatching mouse click events that land on the body to appropriate overlay ref,\n * if any. It maintains a list of attached overlays to determine best suited overlay based\n * on event target and order of overlay opens.\n */\nclass OverlayOutsideClickDispatcher extends BaseOverlayDispatcher {\n constructor(document, _platform, \n /** @breaking-change 14.0.0 _ngZone will be required. */\n _ngZone) {\n super(document);\n this._platform = _platform;\n this._ngZone = _ngZone;\n this._cursorStyleIsSet = false;\n /** Store pointerdown event target to track origin of click. */\n this._pointerDownListener = (event) => {\n this._pointerDownEventTarget = _getEventTarget(event);\n };\n /** Click event listener that will be attached to the body propagate phase. */\n this._clickListener = (event) => {\n const target = _getEventTarget(event);\n // In case of a click event, we want to check the origin of the click\n // (e.g. in case where a user starts a click inside the overlay and\n // releases the click outside of it).\n // This is done by using the event target of the preceding pointerdown event.\n // Every click event caused by a pointer device has a preceding pointerdown\n // event, unless the click was programmatically triggered (e.g. in a unit test).\n const origin = event.type === 'click' && this._pointerDownEventTarget\n ? this._pointerDownEventTarget\n : target;\n // Reset the stored pointerdown event target, to avoid having it interfere\n // in subsequent events.\n this._pointerDownEventTarget = null;\n // We copy the array because the original may be modified asynchronously if the\n // outsidePointerEvents listener decides to detach overlays resulting in index errors inside\n // the for loop.\n const overlays = this._attachedOverlays.slice();\n // Dispatch the mouse event to the top overlay which has subscribers to its mouse events.\n // We want to target all overlays for which the click could be considered as outside click.\n // As soon as we reach an overlay for which the click is not outside click we break off\n // the loop.\n for (let i = overlays.length - 1; i > -1; i--) {\n const overlayRef = overlays[i];\n if (overlayRef._outsidePointerEvents.observers.length < 1 || !overlayRef.hasAttached()) {\n continue;\n }\n // If it's a click inside the overlay, just break - we should do nothing\n // If it's an outside click (both origin and target of the click) dispatch the mouse event,\n // and proceed with the next overlay\n if (containsPierceShadowDom(overlayRef.overlayElement, target) ||\n containsPierceShadowDom(overlayRef.overlayElement, origin)) {\n break;\n }\n const outsidePointerEvents = overlayRef._outsidePointerEvents;\n /** @breaking-change 14.0.0 _ngZone will be required. */\n if (this._ngZone) {\n this._ngZone.run(() => outsidePointerEvents.next(event));\n }\n else {\n outsidePointerEvents.next(event);\n }\n }\n };\n }\n /** Add a new overlay to the list of attached overlay refs. */\n add(overlayRef) {\n super.add(overlayRef);\n // Safari on iOS does not generate click events for non-interactive\n // elements. However, we want to receive a click for any element outside\n // the overlay. We can force a \"clickable\" state by setting\n // `cursor: pointer` on the document body. See:\n // https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event#Safari_Mobile\n // https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html\n if (!this._isAttached) {\n const body = this._document.body;\n /** @breaking-change 14.0.0 _ngZone will be required. */\n if (this._ngZone) {\n this._ngZone.runOutsideAngular(() => this._addEventListeners(body));\n }\n else {\n this._addEventListeners(body);\n }\n // click event is not fired on iOS. To make element \"clickable\" we are\n // setting the cursor to pointer\n if (this._platform.IOS && !this._cursorStyleIsSet) {\n this._cursorOriginalValue = body.style.cursor;\n body.style.cursor = 'pointer';\n this._cursorStyleIsSet = true;\n }\n this._isAttached = true;\n }\n }\n /** Detaches the global keyboard event listener. */\n detach() {\n if (this._isAttached) {\n const body = this._document.body;\n body.removeEventListener('pointerdown', this._pointerDownListener, true);\n body.removeEventListener('click', this._clickListener, true);\n body.removeEventListener('auxclick', this._clickListener, true);\n body.removeEventListener('contextmenu', this._clickListener, true);\n if (this._platform.IOS && this._cursorStyleIsSet) {\n body.style.cursor = this._cursorOriginalValue;\n this._cursorStyleIsSet = false;\n }\n this._isAttached = false;\n }\n }\n _addEventListeners(body) {\n body.addEventListener('pointerdown', this._pointerDownListener, true);\n body.addEventListener('click', this._clickListener, true);\n body.addEventListener('auxclick', this._clickListener, true);\n body.addEventListener('contextmenu', this._clickListener, true);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: OverlayOutsideClickDispatcher, deps: [{ token: DOCUMENT }, { token: i1$1.Platform }, { token: i0.NgZone, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: OverlayOutsideClickDispatcher, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: OverlayOutsideClickDispatcher, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }], ctorParameters: () => [{ type: undefined, decorators: [{\n type: Inject,\n args: [DOCUMENT]\n }] }, { type: i1$1.Platform }, { type: i0.NgZone, decorators: [{\n type: Optional\n }] }] });\n/** Version of `Element.contains` that transcends shadow DOM boundaries. */\nfunction containsPierceShadowDom(parent, child) {\n const supportsShadowRoot = typeof ShadowRoot !== 'undefined' && ShadowRoot;\n let current = child;\n while (current) {\n if (current === parent) {\n return true;\n }\n current =\n supportsShadowRoot && current instanceof ShadowRoot ? current.host : current.parentNode;\n }\n return false;\n}\n\n/** Container inside which all overlays will render. */\nclass OverlayContainer {\n constructor(document, _platform) {\n this._platform = _platform;\n this._document = document;\n }\n ngOnDestroy() {\n this._containerElement?.remove();\n }\n /**\n * This method returns the overlay container element. It will lazily\n * create the element the first time it is called to facilitate using\n * the container in non-browser environments.\n * @returns the container element\n */\n getContainerElement() {\n if (!this._containerElement) {\n this._createContainer();\n }\n return this._containerElement;\n }\n /**\n * Create the overlay container element, which is simply a div\n * with the 'cdk-overlay-container' class on the document body.\n */\n _createContainer() {\n const containerClass = 'cdk-overlay-container';\n // TODO(crisbeto): remove the testing check once we have an overlay testing\n // module or Angular starts tearing down the testing `NgModule`. See:\n // https://github.com/angular/angular/issues/18831\n if (this._platform.isBrowser || _isTestEnvironment()) {\n const oppositePlatformContainers = this._document.querySelectorAll(`.${containerClass}[platform=\"server\"], ` + `.${containerClass}[platform=\"test\"]`);\n // Remove any old containers from the opposite platform.\n // This can happen when transitioning from the server to the client.\n for (let i = 0; i < oppositePlatformContainers.length; i++) {\n oppositePlatformContainers[i].remove();\n }\n }\n const container = this._document.createElement('div');\n container.classList.add(containerClass);\n // A long time ago we kept adding new overlay containers whenever a new app was instantiated,\n // but at some point we added logic which clears the duplicate ones in order to avoid leaks.\n // The new logic was a little too aggressive since it was breaking some legitimate use cases.\n // To mitigate the problem we made it so that only containers from a different platform are\n // cleared, but the side-effect was that people started depending on the overly-aggressive\n // logic to clean up their tests for them. Until we can introduce an overlay-specific testing\n // module which does the cleanup, we try to detect that we're in a test environment and we\n // always clear the container. See #17006.\n // TODO(crisbeto): remove the test environment check once we have an overlay testing module.\n if (_isTestEnvironment()) {\n container.setAttribute('platform', 'test');\n }\n else if (!this._platform.isBrowser) {\n container.setAttribute('platform', 'server');\n }\n this._document.body.appendChild(container);\n this._containerElement = container;\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: OverlayContainer, deps: [{ token: DOCUMENT }, { token: i1$1.Platform }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: OverlayContainer, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: OverlayContainer, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }], ctorParameters: () => [{ type: undefined, decorators: [{\n type: Inject,\n args: [DOCUMENT]\n }] }, { type: i1$1.Platform }] });\n\n/**\n * Reference to an overlay that has been created with the Overlay service.\n * Used to manipulate or dispose of said overlay.\n */\nclass OverlayRef {\n constructor(_portalOutlet, _host, _pane, _config, _ngZone, _keyboardDispatcher, _document, _location, _outsideClickDispatcher, _animationsDisabled = false, _injector) {\n this._portalOutlet = _portalOutlet;\n this._host = _host;\n this._pane = _pane;\n this._config = _config;\n this._ngZone = _ngZone;\n this._keyboardDispatcher = _keyboardDispatcher;\n this._document = _document;\n this._location = _location;\n this._outsideClickDispatcher = _outsideClickDispatcher;\n this._animationsDisabled = _animationsDisabled;\n this._injector = _injector;\n this._backdropElement = null;\n this._backdropClick = new Subject();\n this._attachments = new Subject();\n this._detachments = new Subject();\n this._locationChanges = Subscription.EMPTY;\n this._backdropClickHandler = (event) => this._backdropClick.next(event);\n this._backdropTransitionendHandler = (event) => {\n this._disposeBackdrop(event.target);\n };\n /** Stream of keydown events dispatched to this overlay. */\n this._keydownEvents = new Subject();\n /** Stream of mouse outside events dispatched to this overlay. */\n this._outsidePointerEvents = new Subject();\n this._renders = new Subject();\n if (_config.scrollStrategy) {\n this._scrollStrategy = _config.scrollStrategy;\n this._scrollStrategy.attach(this);\n }\n this._positionStrategy = _config.positionStrategy;\n // Users could open the overlay from an `effect`, in which case we need to\n // run the `afterRender` as `untracked`. We don't recommend that users do\n // this, but we also don't want to break users who are doing it.\n this._afterRenderRef = untracked(() => afterRender(() => {\n this._renders.next();\n }, { injector: this._injector }));\n }\n /** The overlay's HTML element */\n get overlayElement() {\n return this._pane;\n }\n /** The overlay's backdrop HTML element. */\n get backdropElement() {\n return this._backdropElement;\n }\n /**\n * Wrapper around the panel element. Can be used for advanced\n * positioning where a wrapper with specific styling is\n * required around the overlay pane.\n */\n get hostElement() {\n return this._host;\n }\n /**\n * Attaches content, given via a Portal, to the overlay.\n * If the overlay is configured to have a backdrop, it will be created.\n *\n * @param portal Portal instance to which to attach the overlay.\n * @returns The portal attachment result.\n */\n attach(portal) {\n // Insert the host into the DOM before attaching the portal, otherwise\n // the animations module will skip animations on repeat attachments.\n if (!this._host.parentElement && this._previousHostParent) {\n this._previousHostParent.appendChild(this._host);\n }\n const attachResult = this._portalOutlet.attach(portal);\n if (this._positionStrategy) {\n this._positionStrategy.attach(this);\n }\n this._updateStackingOrder();\n this._updateElementSize();\n this._updateElementDirection();\n if (this._scrollStrategy) {\n this._scrollStrategy.enable();\n }\n // Update the position once the overlay is fully rendered before attempting to position it,\n // as the position may depend on the size of the rendered content.\n afterNextRender(() => {\n // The overlay could've been detached before the callback executed.\n if (this.hasAttached()) {\n this.updatePosition();\n }\n }, { injector: this._injector });\n // Enable pointer events for the overlay pane element.\n this._togglePointerEvents(true);\n if (this._config.hasBackdrop) {\n this._attachBackdrop();\n }\n if (this._config.panelClass) {\n this._toggleClasses(this._pane, this._config.panelClass, true);\n }\n // Only emit the `attachments` event once all other setup is done.\n this._attachments.next();\n // Track this overlay by the keyboard dispatcher\n this._keyboardDispatcher.add(this);\n if (this._config.disposeOnNavigation) {\n this._locationChanges = this._location.subscribe(() => this.dispose());\n }\n this._outsideClickDispatcher.add(this);\n // TODO(crisbeto): the null check is here, because the portal outlet returns `any`.\n // We should be guaranteed for the result to be `ComponentRef | EmbeddedViewRef`, but\n // `instanceof EmbeddedViewRef` doesn't appear to work at the moment.\n if (typeof attachResult?.onDestroy === 'function') {\n // In most cases we control the portal and we know when it is being detached so that\n // we can finish the disposal process. The exception is if the user passes in a custom\n // `ViewContainerRef` that isn't destroyed through the overlay API. Note that we use\n // `detach` here instead of `dispose`, because we don't know if the user intends to\n // reattach the overlay at a later point. It also has the advantage of waiting for animations.\n attachResult.onDestroy(() => {\n if (this.hasAttached()) {\n // We have to delay the `detach` call, because detaching immediately prevents\n // other destroy hooks from running. This is likely a framework bug similar to\n // https://github.com/angular/angular/issues/46119\n this._ngZone.runOutsideAngular(() => Promise.resolve().then(() => this.detach()));\n }\n });\n }\n return attachResult;\n }\n /**\n * Detaches an overlay from a portal.\n * @returns The portal detachment result.\n */\n detach() {\n if (!this.hasAttached()) {\n return;\n }\n this.detachBackdrop();\n // When the overlay is detached, the pane element should disable pointer events.\n // This is necessary because otherwise the pane element will cover the page and disable\n // pointer events therefore. Depends on the position strategy and the applied pane boundaries.\n this._togglePointerEvents(false);\n if (this._positionStrategy && this._positionStrategy.detach) {\n this._positionStrategy.detach();\n }\n if (this._scrollStrategy) {\n this._scrollStrategy.disable();\n }\n const detachmentResult = this._portalOutlet.detach();\n // Only emit after everything is detached.\n this._detachments.next();\n // Remove this overlay from keyboard dispatcher tracking.\n this._keyboardDispatcher.remove(this);\n // Keeping the host element in the DOM can cause scroll jank, because it still gets\n // rendered, even though it's transparent and unclickable which is why we remove it.\n this._detachContentWhenEmpty();\n this._locationChanges.unsubscribe();\n this._outsideClickDispatcher.remove(this);\n return detachmentResult;\n }\n /** Cleans up the overlay from the DOM. */\n dispose() {\n const isAttached = this.hasAttached();\n if (this._positionStrategy) {\n this._positionStrategy.dispose();\n }\n this._disposeScrollStrategy();\n this._disposeBackdrop(this._backdropElement);\n this._locationChanges.unsubscribe();\n this._keyboardDispatcher.remove(this);\n this._portalOutlet.dispose();\n this._attachments.complete();\n this._backdropClick.complete();\n this._keydownEvents.complete();\n this._outsidePointerEvents.complete();\n this._outsideClickDispatcher.remove(this);\n this._host?.remove();\n this._previousHostParent = this._pane = this._host = null;\n if (isAttached) {\n this._detachments.next();\n }\n this._detachments.complete();\n this._afterRenderRef.destroy();\n this._renders.complete();\n }\n /** Whether the overlay has attached content. */\n hasAttached() {\n return this._portalOutlet.hasAttached();\n }\n /** Gets an observable that emits when the backdrop has been clicked. */\n backdropClick() {\n return this._backdropClick;\n }\n /** Gets an observable that emits when the overlay has been attached. */\n attachments() {\n return this._attachments;\n }\n /** Gets an observable that emits when the overlay has been detached. */\n detachments() {\n return this._detachments;\n }\n /** Gets an observable of keydown events targeted to this overlay. */\n keydownEvents() {\n return this._keydownEvents;\n }\n /** Gets an observable of pointer events targeted outside this overlay. */\n outsidePointerEvents() {\n return this._outsidePointerEvents;\n }\n /** Gets the current overlay configuration, which is immutable. */\n getConfig() {\n return this._config;\n }\n /** Updates the position of the overlay based on the position strategy. */\n updatePosition() {\n if (this._positionStrategy) {\n this._positionStrategy.apply();\n }\n }\n /** Switches to a new position strategy and updates the overlay position. */\n updatePositionStrategy(strategy) {\n if (strategy === this._positionStrategy) {\n return;\n }\n if (this._positionStrategy) {\n this._positionStrategy.dispose();\n }\n this._positionStrategy = strategy;\n if (this.hasAttached()) {\n strategy.attach(this);\n this.updatePosition();\n }\n }\n /** Update the size properties of the overlay. */\n updateSize(sizeConfig) {\n this._config = { ...this._config, ...sizeConfig };\n this._updateElementSize();\n }\n /** Sets the LTR/RTL direction for the overlay. */\n setDirection(dir) {\n this._config = { ...this._config, direction: dir };\n this._updateElementDirection();\n }\n /** Add a CSS class or an array of classes to the overlay pane. */\n addPanelClass(classes) {\n if (this._pane) {\n this._toggleClasses(this._pane, classes, true);\n }\n }\n /** Remove a CSS class or an array of classes from the overlay pane. */\n removePanelClass(classes) {\n if (this._pane) {\n this._toggleClasses(this._pane, classes, false);\n }\n }\n /**\n * Returns the layout direction of the overlay panel.\n */\n getDirection() {\n const direction = this._config.direction;\n if (!direction) {\n return 'ltr';\n }\n return typeof direction === 'string' ? direction : direction.value;\n }\n /** Switches to a new scroll strategy. */\n updateScrollStrategy(strategy) {\n if (strategy === this._scrollStrategy) {\n return;\n }\n this._disposeScrollStrategy();\n this._scrollStrategy = strategy;\n if (this.hasAttached()) {\n strategy.attach(this);\n strategy.enable();\n }\n }\n /** Updates the text direction of the overlay panel. */\n _updateElementDirection() {\n this._host.setAttribute('dir', this.getDirection());\n }\n /** Updates the size of the overlay element based on the overlay config. */\n _updateElementSize() {\n if (!this._pane) {\n return;\n }\n const style = this._pane.style;\n style.width = coerceCssPixelValue(this._config.width);\n style.height = coerceCssPixelValue(this._config.height);\n style.minWidth = coerceCssPixelValue(this._config.minWidth);\n style.minHeight = coerceCssPixelValue(this._config.minHeight);\n style.maxWidth = coerceCssPixelValue(this._config.maxWidth);\n style.maxHeight = coerceCssPixelValue(this._config.maxHeight);\n }\n /** Toggles the pointer events for the overlay pane element. */\n _togglePointerEvents(enablePointer) {\n this._pane.style.pointerEvents = enablePointer ? '' : 'none';\n }\n /** Attaches a backdrop for this overlay. */\n _attachBackdrop() {\n const showingClass = 'cdk-overlay-backdrop-showing';\n this._backdropElement = this._document.createElement('div');\n this._backdropElement.classList.add('cdk-overlay-backdrop');\n if (this._animationsDisabled) {\n this._backdropElement.classList.add('cdk-overlay-backdrop-noop-animation');\n }\n if (this._config.backdropClass) {\n this._toggleClasses(this._backdropElement, this._config.backdropClass, true);\n }\n // Insert the backdrop before the pane in the DOM order,\n // in order to handle stacked overlays properly.\n this._host.parentElement.insertBefore(this._backdropElement, this._host);\n // Forward backdrop clicks such that the consumer of the overlay can perform whatever\n // action desired when such a click occurs (usually closing the overlay).\n this._backdropElement.addEventListener('click', this._backdropClickHandler);\n // Add class to fade-in the backdrop after one frame.\n if (!this._animationsDisabled && typeof requestAnimationFrame !== 'undefined') {\n this._ngZone.runOutsideAngular(() => {\n requestAnimationFrame(() => {\n if (this._backdropElement) {\n this._backdropElement.classList.add(showingClass);\n }\n });\n });\n }\n else {\n this._backdropElement.classList.add(showingClass);\n }\n }\n /**\n * Updates the stacking order of the element, moving it to the top if necessary.\n * This is required in cases where one overlay was detached, while another one,\n * that should be behind it, was destroyed. The next time both of them are opened,\n * the stacking will be wrong, because the detached element's pane will still be\n * in its original DOM position.\n */\n _updateStackingOrder() {\n if (this._host.nextSibling) {\n this._host.parentNode.appendChild(this._host);\n }\n }\n /** Detaches the backdrop (if any) associated with the overlay. */\n detachBackdrop() {\n const backdropToDetach = this._backdropElement;\n if (!backdropToDetach) {\n return;\n }\n if (this._animationsDisabled) {\n this._disposeBackdrop(backdropToDetach);\n return;\n }\n backdropToDetach.classList.remove('cdk-overlay-backdrop-showing');\n this._ngZone.runOutsideAngular(() => {\n backdropToDetach.addEventListener('transitionend', this._backdropTransitionendHandler);\n });\n // If the backdrop doesn't have a transition, the `transitionend` event won't fire.\n // In this case we make it unclickable and we try to remove it after a delay.\n backdropToDetach.style.pointerEvents = 'none';\n // Run this outside the Angular zone because there's nothing that Angular cares about.\n // If it were to run inside the Angular zone, every test that used Overlay would have to be\n // either async or fakeAsync.\n this._backdropTimeout = this._ngZone.runOutsideAngular(() => setTimeout(() => {\n this._disposeBackdrop(backdropToDetach);\n }, 500));\n }\n /** Toggles a single CSS class or an array of classes on an element. */\n _toggleClasses(element, cssClasses, isAdd) {\n const classes = coerceArray(cssClasses || []).filter(c => !!c);\n if (classes.length) {\n isAdd ? element.classList.add(...classes) : element.classList.remove(...classes);\n }\n }\n /** Detaches the overlay content next time the zone stabilizes. */\n _detachContentWhenEmpty() {\n // Normally we wouldn't have to explicitly run this outside the `NgZone`, however\n // if the consumer is using `zone-patch-rxjs`, the `Subscription.unsubscribe` call will\n // be patched to run inside the zone, which will throw us into an infinite loop.\n this._ngZone.runOutsideAngular(() => {\n // We can't remove the host here immediately, because the overlay pane's content\n // might still be animating. This stream helps us avoid interrupting the animation\n // by waiting for the pane to become empty.\n const subscription = this._renders\n .pipe(takeUntil(merge(this._attachments, this._detachments)))\n .subscribe(() => {\n // Needs a couple of checks for the pane and host, because\n // they may have been removed by the time the zone stabilizes.\n if (!this._pane || !this._host || this._pane.children.length === 0) {\n if (this._pane && this._config.panelClass) {\n this._toggleClasses(this._pane, this._config.panelClass, false);\n }\n if (this._host && this._host.parentElement) {\n this._previousHostParent = this._host.parentElement;\n this._host.remove();\n }\n subscription.unsubscribe();\n }\n });\n });\n }\n /** Disposes of a scroll strategy. */\n _disposeScrollStrategy() {\n const scrollStrategy = this._scrollStrategy;\n if (scrollStrategy) {\n scrollStrategy.disable();\n if (scrollStrategy.detach) {\n scrollStrategy.detach();\n }\n }\n }\n /** Removes a backdrop element from the DOM. */\n _disposeBackdrop(backdrop) {\n if (backdrop) {\n backdrop.removeEventListener('click', this._backdropClickHandler);\n backdrop.removeEventListener('transitionend', this._backdropTransitionendHandler);\n backdrop.remove();\n // It is possible that a new portal has been attached to this overlay since we started\n // removing the backdrop. If that is the case, only clear the backdrop reference if it\n // is still the same instance that we started to remove.\n if (this._backdropElement === backdrop) {\n this._backdropElement = null;\n }\n }\n if (this._backdropTimeout) {\n clearTimeout(this._backdropTimeout);\n this._backdropTimeout = undefined;\n }\n }\n}\n\n// TODO: refactor clipping detection into a separate thing (part of scrolling module)\n// TODO: doesn't handle both flexible width and height when it has to scroll along both axis.\n/** Class to be added to the overlay bounding box. */\nconst boundingBoxClass = 'cdk-overlay-connected-position-bounding-box';\n/** Regex used to split a string on its CSS units. */\nconst cssUnitPattern = /([A-Za-z%]+)$/;\n/**\n * A strategy for positioning overlays. Using this strategy, an overlay is given an\n * implicit position relative some origin element. The relative position is defined in terms of\n * a point on the origin element that is connected to a point on the overlay element. For example,\n * a basic dropdown is connecting the bottom-left corner of the origin to the top-left corner\n * of the overlay.\n */\nclass FlexibleConnectedPositionStrategy {\n /** Ordered list of preferred positions, from most to least desirable. */\n get positions() {\n return this._preferredPositions;\n }\n constructor(connectedTo, _viewportRuler, _document, _platform, _overlayContainer) {\n this._viewportRuler = _viewportRuler;\n this._document = _document;\n this._platform = _platform;\n this._overlayContainer = _overlayContainer;\n /** Last size used for the bounding box. Used to avoid resizing the overlay after open. */\n this._lastBoundingBoxSize = { width: 0, height: 0 };\n /** Whether the overlay was pushed in a previous positioning. */\n this._isPushed = false;\n /** Whether the overlay can be pushed on-screen on the initial open. */\n this._canPush = true;\n /** Whether the overlay can grow via flexible width/height after the initial open. */\n this._growAfterOpen = false;\n /** Whether the overlay's width and height can be constrained to fit within the viewport. */\n this._hasFlexibleDimensions = true;\n /** Whether the overlay position is locked. */\n this._positionLocked = false;\n /** Amount of space that must be maintained between the overlay and the edge of the viewport. */\n this._viewportMargin = 0;\n /** The Scrollable containers used to check scrollable view properties on position change. */\n this._scrollables = [];\n /** Ordered list of preferred positions, from most to least desirable. */\n this._preferredPositions = [];\n /** Subject that emits whenever the position changes. */\n this._positionChanges = new Subject();\n /** Subscription to viewport size changes. */\n this._resizeSubscription = Subscription.EMPTY;\n /** Default offset for the overlay along the x axis. */\n this._offsetX = 0;\n /** Default offset for the overlay along the y axis. */\n this._offsetY = 0;\n /** Keeps track of the CSS classes that the position strategy has applied on the overlay panel. */\n this._appliedPanelClasses = [];\n /** Observable sequence of position changes. */\n this.positionChanges = this._positionChanges;\n this.setOrigin(connectedTo);\n }\n /** Attaches this position strategy to an overlay. */\n attach(overlayRef) {\n if (this._overlayRef &&\n overlayRef !== this._overlayRef &&\n (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error('This position strategy is already attached to an overlay');\n }\n this._validatePositions();\n overlayRef.hostElement.classList.add(boundingBoxClass);\n this._overlayRef = overlayRef;\n this._boundingBox = overlayRef.hostElement;\n this._pane = overlayRef.overlayElement;\n this._isDisposed = false;\n this._isInitialRender = true;\n this._lastPosition = null;\n this._resizeSubscription.unsubscribe();\n this._resizeSubscription = this._viewportRuler.change().subscribe(() => {\n // When the window is resized, we want to trigger the next reposition as if it\n // was an initial render, in order for the strategy to pick a new optimal position,\n // otherwise position locking will cause it to stay at the old one.\n this._isInitialRender = true;\n this.apply();\n });\n }\n /**\n * Updates the position of the overlay element, using whichever preferred position relative\n * to the origin best fits on-screen.\n *\n * The selection of a position goes as follows:\n * - If any positions fit completely within the viewport as-is,\n * choose the first position that does so.\n * - If flexible dimensions are enabled and at least one satisfies the given minimum width/height,\n * choose the position with the greatest available size modified by the positions' weight.\n * - If pushing is enabled, take the position that went off-screen the least and push it\n * on-screen.\n * - If none of the previous criteria were met, use the position that goes off-screen the least.\n * @docs-private\n */\n apply() {\n // We shouldn't do anything if the strategy was disposed or we're on the server.\n if (this._isDisposed || !this._platform.isBrowser) {\n return;\n }\n // If the position has been applied already (e.g. when the overlay was opened) and the\n // consumer opted into locking in the position, re-use the old position, in order to\n // prevent the overlay from jumping around.\n if (!this._isInitialRender && this._positionLocked && this._lastPosition) {\n this.reapplyLastPosition();\n return;\n }\n this._clearPanelClasses();\n this._resetOverlayElementStyles();\n this._resetBoundingBoxStyles();\n // We need the bounding rects for the origin, the overlay and the container to determine how to position\n // the overlay relative to the origin.\n // We use the viewport rect to determine whether a position would go off-screen.\n this._viewportRect = this._getNarrowedViewportRect();\n this._originRect = this._getOriginRect();\n this._overlayRect = this._pane.getBoundingClientRect();\n this._containerRect = this._overlayContainer.getContainerElement().getBoundingClientRect();\n const originRect = this._originRect;\n const overlayRect = this._overlayRect;\n const viewportRect = this._viewportRect;\n const containerRect = this._containerRect;\n // Positions where the overlay will fit with flexible dimensions.\n const flexibleFits = [];\n // Fallback if none of the preferred positions fit within the viewport.\n let fallback;\n // Go through each of the preferred positions looking for a good fit.\n // If a good fit is found, it will be applied immediately.\n for (let pos of this._preferredPositions) {\n // Get the exact (x, y) coordinate for the point-of-origin on the origin element.\n let originPoint = this._getOriginPoint(originRect, containerRect, pos);\n // From that point-of-origin, get the exact (x, y) coordinate for the top-left corner of the\n // overlay in this position. We use the top-left corner for calculations and later translate\n // this into an appropriate (top, left, bottom, right) style.\n let overlayPoint = this._getOverlayPoint(originPoint, overlayRect, pos);\n // Calculate how well the overlay would fit into the viewport with this point.\n let overlayFit = this._getOverlayFit(overlayPoint, overlayRect, viewportRect, pos);\n // If the overlay, without any further work, fits into the viewport, use this position.\n if (overlayFit.isCompletelyWithinViewport) {\n this._isPushed = false;\n this._applyPosition(pos, originPoint);\n return;\n }\n // If the overlay has flexible dimensions, we can use this position\n // so long as there's enough space for the minimum dimensions.\n if (this._canFitWithFlexibleDimensions(overlayFit, overlayPoint, viewportRect)) {\n // Save positions where the overlay will fit with flexible dimensions. We will use these\n // if none of the positions fit *without* flexible dimensions.\n flexibleFits.push({\n position: pos,\n origin: originPoint,\n overlayRect,\n boundingBoxRect: this._calculateBoundingBoxRect(originPoint, pos),\n });\n continue;\n }\n // If the current preferred position does not fit on the screen, remember the position\n // if it has more visible area on-screen than we've seen and move onto the next preferred\n // position.\n if (!fallback || fallback.overlayFit.visibleArea < overlayFit.visibleArea) {\n fallback = { overlayFit, overlayPoint, originPoint, position: pos, overlayRect };\n }\n }\n // If there are any positions where the overlay would fit with flexible dimensions, choose the\n // one that has the greatest area available modified by the position's weight\n if (flexibleFits.length) {\n let bestFit = null;\n let bestScore = -1;\n for (const fit of flexibleFits) {\n const score = fit.boundingBoxRect.width * fit.boundingBoxRect.height * (fit.position.weight || 1);\n if (score > bestScore) {\n bestScore = score;\n bestFit = fit;\n }\n }\n this._isPushed = false;\n this._applyPosition(bestFit.position, bestFit.origin);\n return;\n }\n // When none of the preferred positions fit within the viewport, take the position\n // that went off-screen the least and attempt to push it on-screen.\n if (this._canPush) {\n // TODO(jelbourn): after pushing, the opening \"direction\" of the overlay might not make sense.\n this._isPushed = true;\n this._applyPosition(fallback.position, fallback.originPoint);\n return;\n }\n // All options for getting the overlay within the viewport have been exhausted, so go with the\n // position that went off-screen the least.\n this._applyPosition(fallback.position, fallback.originPoint);\n }\n detach() {\n this._clearPanelClasses();\n this._lastPosition = null;\n this._previousPushAmount = null;\n this._resizeSubscription.unsubscribe();\n }\n /** Cleanup after the element gets destroyed. */\n dispose() {\n if (this._isDisposed) {\n return;\n }\n // We can't use `_resetBoundingBoxStyles` here, because it resets\n // some properties to zero, rather than removing them.\n if (this._boundingBox) {\n extendStyles(this._boundingBox.style, {\n top: '',\n left: '',\n right: '',\n bottom: '',\n height: '',\n width: '',\n alignItems: '',\n justifyContent: '',\n });\n }\n if (this._pane) {\n this._resetOverlayElementStyles();\n }\n if (this._overlayRef) {\n this._overlayRef.hostElement.classList.remove(boundingBoxClass);\n }\n this.detach();\n this._positionChanges.complete();\n this._overlayRef = this._boundingBox = null;\n this._isDisposed = true;\n }\n /**\n * This re-aligns the overlay element with the trigger in its last calculated position,\n * even if a position higher in the \"preferred positions\" list would now fit. This\n * allows one to re-align the panel without changing the orientation of the panel.\n */\n reapplyLastPosition() {\n if (this._isDisposed || !this._platform.isBrowser) {\n return;\n }\n const lastPosition = this._lastPosition;\n if (lastPosition) {\n this._originRect = this._getOriginRect();\n this._overlayRect = this._pane.getBoundingClientRect();\n this._viewportRect = this._getNarrowedViewportRect();\n this._containerRect = this._overlayContainer.getContainerElement().getBoundingClientRect();\n const originPoint = this._getOriginPoint(this._originRect, this._containerRect, lastPosition);\n this._applyPosition(lastPosition, originPoint);\n }\n else {\n this.apply();\n }\n }\n /**\n * Sets the list of Scrollable containers that host the origin element so that\n * on reposition we can evaluate if it or the overlay has been clipped or outside view. Every\n * Scrollable must be an ancestor element of the strategy's origin element.\n */\n withScrollableContainers(scrollables) {\n this._scrollables = scrollables;\n return this;\n }\n /**\n * Adds new preferred positions.\n * @param positions List of positions options for this overlay.\n */\n withPositions(positions) {\n this._preferredPositions = positions;\n // If the last calculated position object isn't part of the positions anymore, clear\n // it in order to avoid it being picked up if the consumer tries to re-apply.\n if (positions.indexOf(this._lastPosition) === -1) {\n this._lastPosition = null;\n }\n this._validatePositions();\n return this;\n }\n /**\n * Sets a minimum distance the overlay may be positioned to the edge of the viewport.\n * @param margin Required margin between the overlay and the viewport edge in pixels.\n */\n withViewportMargin(margin) {\n this._viewportMargin = margin;\n return this;\n }\n /** Sets whether the overlay's width and height can be constrained to fit within the viewport. */\n withFlexibleDimensions(flexibleDimensions = true) {\n this._hasFlexibleDimensions = flexibleDimensions;\n return this;\n }\n /** Sets whether the overlay can grow after the initial open via flexible width/height. */\n withGrowAfterOpen(growAfterOpen = true) {\n this._growAfterOpen = growAfterOpen;\n return this;\n }\n /** Sets whether the overlay can be pushed on-screen if none of the provided positions fit. */\n withPush(canPush = true) {\n this._canPush = canPush;\n return this;\n }\n /**\n * Sets whether the overlay's position should be locked in after it is positioned\n * initially. When an overlay is locked in, it won't attempt to reposition itself\n * when the position is re-applied (e.g. when the user scrolls away).\n * @param isLocked Whether the overlay should locked in.\n */\n withLockedPosition(isLocked = true) {\n this._positionLocked = isLocked;\n return this;\n }\n /**\n * Sets the origin, relative to which to position the overlay.\n * Using an element origin is useful for building components that need to be positioned\n * relatively to a trigger (e.g. dropdown menus or tooltips), whereas using a point can be\n * used for cases like contextual menus which open relative to the user's pointer.\n * @param origin Reference to the new origin.\n */\n setOrigin(origin) {\n this._origin = origin;\n return this;\n }\n /**\n * Sets the default offset for the overlay's connection point on the x-axis.\n * @param offset New offset in the X axis.\n */\n withDefaultOffsetX(offset) {\n this._offsetX = offset;\n return this;\n }\n /**\n * Sets the default offset for the overlay's connection point on the y-axis.\n * @param offset New offset in the Y axis.\n */\n withDefaultOffsetY(offset) {\n this._offsetY = offset;\n return this;\n }\n /**\n * Configures that the position strategy should set a `transform-origin` on some elements\n * inside the overlay, depending on the current position that is being applied. This is\n * useful for the cases where the origin of an animation can change depending on the\n * alignment of the overlay.\n * @param selector CSS selector that will be used to find the target\n * elements onto which to set the transform origin.\n */\n withTransformOriginOn(selector) {\n this._transformOriginSelector = selector;\n return this;\n }\n /**\n * Gets the (x, y) coordinate of a connection point on the origin based on a relative position.\n */\n _getOriginPoint(originRect, containerRect, pos) {\n let x;\n if (pos.originX == 'center') {\n // Note: when centering we should always use the `left`\n // offset, otherwise the position will be wrong in RTL.\n x = originRect.left + originRect.width / 2;\n }\n else {\n const startX = this._isRtl() ? originRect.right : originRect.left;\n const endX = this._isRtl() ? originRect.left : originRect.right;\n x = pos.originX == 'start' ? startX : endX;\n }\n // When zooming in Safari the container rectangle contains negative values for the position\n // and we need to re-add them to the calculated coordinates.\n if (containerRect.left < 0) {\n x -= containerRect.left;\n }\n let y;\n if (pos.originY == 'center') {\n y = originRect.top + originRect.height / 2;\n }\n else {\n y = pos.originY == 'top' ? originRect.top : originRect.bottom;\n }\n // Normally the containerRect's top value would be zero, however when the overlay is attached to an input\n // (e.g. in an autocomplete), mobile browsers will shift everything in order to put the input in the middle\n // of the screen and to make space for the virtual keyboard. We need to account for this offset,\n // otherwise our positioning will be thrown off.\n // Additionally, when zooming in Safari this fixes the vertical position.\n if (containerRect.top < 0) {\n y -= containerRect.top;\n }\n return { x, y };\n }\n /**\n * Gets the (x, y) coordinate of the top-left corner of the overlay given a given position and\n * origin point to which the overlay should be connected.\n */\n _getOverlayPoint(originPoint, overlayRect, pos) {\n // Calculate the (overlayStartX, overlayStartY), the start of the\n // potential overlay position relative to the origin point.\n let overlayStartX;\n if (pos.overlayX == 'center') {\n overlayStartX = -overlayRect.width / 2;\n }\n else if (pos.overlayX === 'start') {\n overlayStartX = this._isRtl() ? -overlayRect.width : 0;\n }\n else {\n overlayStartX = this._isRtl() ? 0 : -overlayRect.width;\n }\n let overlayStartY;\n if (pos.overlayY == 'center') {\n overlayStartY = -overlayRect.height / 2;\n }\n else {\n overlayStartY = pos.overlayY == 'top' ? 0 : -overlayRect.height;\n }\n // The (x, y) coordinates of the overlay.\n return {\n x: originPoint.x + overlayStartX,\n y: originPoint.y + overlayStartY,\n };\n }\n /** Gets how well an overlay at the given point will fit within the viewport. */\n _getOverlayFit(point, rawOverlayRect, viewport, position) {\n // Round the overlay rect when comparing against the\n // viewport, because the viewport is always rounded.\n const overlay = getRoundedBoundingClientRect(rawOverlayRect);\n let { x, y } = point;\n let offsetX = this._getOffset(position, 'x');\n let offsetY = this._getOffset(position, 'y');\n // Account for the offsets since they could push the overlay out of the viewport.\n if (offsetX) {\n x += offsetX;\n }\n if (offsetY) {\n y += offsetY;\n }\n // How much the overlay would overflow at this position, on each side.\n let leftOverflow = 0 - x;\n let rightOverflow = x + overlay.width - viewport.width;\n let topOverflow = 0 - y;\n let bottomOverflow = y + overlay.height - viewport.height;\n // Visible parts of the element on each axis.\n let visibleWidth = this._subtractOverflows(overlay.width, leftOverflow, rightOverflow);\n let visibleHeight = this._subtractOverflows(overlay.height, topOverflow, bottomOverflow);\n let visibleArea = visibleWidth * visibleHeight;\n return {\n visibleArea,\n isCompletelyWithinViewport: overlay.width * overlay.height === visibleArea,\n fitsInViewportVertically: visibleHeight === overlay.height,\n fitsInViewportHorizontally: visibleWidth == overlay.width,\n };\n }\n /**\n * Whether the overlay can fit within the viewport when it may resize either its width or height.\n * @param fit How well the overlay fits in the viewport at some position.\n * @param point The (x, y) coordinates of the overlay at some position.\n * @param viewport The geometry of the viewport.\n */\n _canFitWithFlexibleDimensions(fit, point, viewport) {\n if (this._hasFlexibleDimensions) {\n const availableHeight = viewport.bottom - point.y;\n const availableWidth = viewport.right - point.x;\n const minHeight = getPixelValue(this._overlayRef.getConfig().minHeight);\n const minWidth = getPixelValue(this._overlayRef.getConfig().minWidth);\n const verticalFit = fit.fitsInViewportVertically || (minHeight != null && minHeight <= availableHeight);\n const horizontalFit = fit.fitsInViewportHorizontally || (minWidth != null && minWidth <= availableWidth);\n return verticalFit && horizontalFit;\n }\n return false;\n }\n /**\n * Gets the point at which the overlay can be \"pushed\" on-screen. If the overlay is larger than\n * the viewport, the top-left corner will be pushed on-screen (with overflow occurring on the\n * right and bottom).\n *\n * @param start Starting point from which the overlay is pushed.\n * @param rawOverlayRect Dimensions of the overlay.\n * @param scrollPosition Current viewport scroll position.\n * @returns The point at which to position the overlay after pushing. This is effectively a new\n * originPoint.\n */\n _pushOverlayOnScreen(start, rawOverlayRect, scrollPosition) {\n // If the position is locked and we've pushed the overlay already, reuse the previous push\n // amount, rather than pushing it again. If we were to continue pushing, the element would\n // remain in the viewport, which goes against the expectations when position locking is enabled.\n if (this._previousPushAmount && this._positionLocked) {\n return {\n x: start.x + this._previousPushAmount.x,\n y: start.y + this._previousPushAmount.y,\n };\n }\n // Round the overlay rect when comparing against the\n // viewport, because the viewport is always rounded.\n const overlay = getRoundedBoundingClientRect(rawOverlayRect);\n const viewport = this._viewportRect;\n // Determine how much the overlay goes outside the viewport on each\n // side, which we'll use to decide which direction to push it.\n const overflowRight = Math.max(start.x + overlay.width - viewport.width, 0);\n const overflowBottom = Math.max(start.y + overlay.height - viewport.height, 0);\n const overflowTop = Math.max(viewport.top - scrollPosition.top - start.y, 0);\n const overflowLeft = Math.max(viewport.left - scrollPosition.left - start.x, 0);\n // Amount by which to push the overlay in each axis such that it remains on-screen.\n let pushX = 0;\n let pushY = 0;\n // If the overlay fits completely within the bounds of the viewport, push it from whichever\n // direction is goes off-screen. Otherwise, push the top-left corner such that its in the\n // viewport and allow for the trailing end of the overlay to go out of bounds.\n if (overlay.width <= viewport.width) {\n pushX = overflowLeft || -overflowRight;\n }\n else {\n pushX = start.x < this._viewportMargin ? viewport.left - scrollPosition.left - start.x : 0;\n }\n if (overlay.height <= viewport.height) {\n pushY = overflowTop || -overflowBottom;\n }\n else {\n pushY = start.y < this._viewportMargin ? viewport.top - scrollPosition.top - start.y : 0;\n }\n this._previousPushAmount = { x: pushX, y: pushY };\n return {\n x: start.x + pushX,\n y: start.y + pushY,\n };\n }\n /**\n * Applies a computed position to the overlay and emits a position change.\n * @param position The position preference\n * @param originPoint The point on the origin element where the overlay is connected.\n */\n _applyPosition(position, originPoint) {\n this._setTransformOrigin(position);\n this._setOverlayElementStyles(originPoint, position);\n this._setBoundingBoxStyles(originPoint, position);\n if (position.panelClass) {\n this._addPanelClasses(position.panelClass);\n }\n // Notify that the position has been changed along with its change properties.\n // We only emit if we've got any subscriptions, because the scroll visibility\n // calculations can be somewhat expensive.\n if (this._positionChanges.observers.length) {\n const scrollVisibility = this._getScrollVisibility();\n // We're recalculating on scroll, but we only want to emit if anything\n // changed since downstream code might be hitting the `NgZone`.\n if (position !== this._lastPosition ||\n !this._lastScrollVisibility ||\n !compareScrollVisibility(this._lastScrollVisibility, scrollVisibility)) {\n const changeEvent = new ConnectedOverlayPositionChange(position, scrollVisibility);\n this._positionChanges.next(changeEvent);\n }\n this._lastScrollVisibility = scrollVisibility;\n }\n // Save the last connected position in case the position needs to be re-calculated.\n this._lastPosition = position;\n this._isInitialRender = false;\n }\n /** Sets the transform origin based on the configured selector and the passed-in position. */\n _setTransformOrigin(position) {\n if (!this._transformOriginSelector) {\n return;\n }\n const elements = this._boundingBox.querySelectorAll(this._transformOriginSelector);\n let xOrigin;\n let yOrigin = position.overlayY;\n if (position.overlayX === 'center') {\n xOrigin = 'center';\n }\n else if (this._isRtl()) {\n xOrigin = position.overlayX === 'start' ? 'right' : 'left';\n }\n else {\n xOrigin = position.overlayX === 'start' ? 'left' : 'right';\n }\n for (let i = 0; i < elements.length; i++) {\n elements[i].style.transformOrigin = `${xOrigin} ${yOrigin}`;\n }\n }\n /**\n * Gets the position and size of the overlay's sizing container.\n *\n * This method does no measuring and applies no styles so that we can cheaply compute the\n * bounds for all positions and choose the best fit based on these results.\n */\n _calculateBoundingBoxRect(origin, position) {\n const viewport = this._viewportRect;\n const isRtl = this._isRtl();\n let height, top, bottom;\n if (position.overlayY === 'top') {\n // Overlay is opening \"downward\" and thus is bound by the bottom viewport edge.\n top = origin.y;\n height = viewport.height - top + this._viewportMargin;\n }\n else if (position.overlayY === 'bottom') {\n // Overlay is opening \"upward\" and thus is bound by the top viewport edge. We need to add\n // the viewport margin back in, because the viewport rect is narrowed down to remove the\n // margin, whereas the `origin` position is calculated based on its `DOMRect`.\n bottom = viewport.height - origin.y + this._viewportMargin * 2;\n height = viewport.height - bottom + this._viewportMargin;\n }\n else {\n // If neither top nor bottom, it means that the overlay is vertically centered on the\n // origin point. Note that we want the position relative to the viewport, rather than\n // the page, which is why we don't use something like `viewport.bottom - origin.y` and\n // `origin.y - viewport.top`.\n const smallestDistanceToViewportEdge = Math.min(viewport.bottom - origin.y + viewport.top, origin.y);\n const previousHeight = this._lastBoundingBoxSize.height;\n height = smallestDistanceToViewportEdge * 2;\n top = origin.y - smallestDistanceToViewportEdge;\n if (height > previousHeight && !this._isInitialRender && !this._growAfterOpen) {\n top = origin.y - previousHeight / 2;\n }\n }\n // The overlay is opening 'right-ward' (the content flows to the right).\n const isBoundedByRightViewportEdge = (position.overlayX === 'start' && !isRtl) || (position.overlayX === 'end' && isRtl);\n // The overlay is opening 'left-ward' (the content flows to the left).\n const isBoundedByLeftViewportEdge = (position.overlayX === 'end' && !isRtl) || (position.overlayX === 'start' && isRtl);\n let width, left, right;\n if (isBoundedByLeftViewportEdge) {\n right = viewport.width - origin.x + this._viewportMargin * 2;\n width = origin.x - this._viewportMargin;\n }\n else if (isBoundedByRightViewportEdge) {\n left = origin.x;\n width = viewport.right - origin.x;\n }\n else {\n // If neither start nor end, it means that the overlay is horizontally centered on the\n // origin point. Note that we want the position relative to the viewport, rather than\n // the page, which is why we don't use something like `viewport.right - origin.x` and\n // `origin.x - viewport.left`.\n const smallestDistanceToViewportEdge = Math.min(viewport.right - origin.x + viewport.left, origin.x);\n const previousWidth = this._lastBoundingBoxSize.width;\n width = smallestDistanceToViewportEdge * 2;\n left = origin.x - smallestDistanceToViewportEdge;\n if (width > previousWidth && !this._isInitialRender && !this._growAfterOpen) {\n left = origin.x - previousWidth / 2;\n }\n }\n return { top: top, left: left, bottom: bottom, right: right, width, height };\n }\n /**\n * Sets the position and size of the overlay's sizing wrapper. The wrapper is positioned on the\n * origin's connection point and stretches to the bounds of the viewport.\n *\n * @param origin The point on the origin element where the overlay is connected.\n * @param position The position preference\n */\n _setBoundingBoxStyles(origin, position) {\n const boundingBoxRect = this._calculateBoundingBoxRect(origin, position);\n // It's weird if the overlay *grows* while scrolling, so we take the last size into account\n // when applying a new size.\n if (!this._isInitialRender && !this._growAfterOpen) {\n boundingBoxRect.height = Math.min(boundingBoxRect.height, this._lastBoundingBoxSize.height);\n boundingBoxRect.width = Math.min(boundingBoxRect.width, this._lastBoundingBoxSize.width);\n }\n const styles = {};\n if (this._hasExactPosition()) {\n styles.top = styles.left = '0';\n styles.bottom = styles.right = styles.maxHeight = styles.maxWidth = '';\n styles.width = styles.height = '100%';\n }\n else {\n const maxHeight = this._overlayRef.getConfig().maxHeight;\n const maxWidth = this._overlayRef.getConfig().maxWidth;\n styles.height = coerceCssPixelValue(boundingBoxRect.height);\n styles.top = coerceCssPixelValue(boundingBoxRect.top);\n styles.bottom = coerceCssPixelValue(boundingBoxRect.bottom);\n styles.width = coerceCssPixelValue(boundingBoxRect.width);\n styles.left = coerceCssPixelValue(boundingBoxRect.left);\n styles.right = coerceCssPixelValue(boundingBoxRect.right);\n // Push the pane content towards the proper direction.\n if (position.overlayX === 'center') {\n styles.alignItems = 'center';\n }\n else {\n styles.alignItems = position.overlayX === 'end' ? 'flex-end' : 'flex-start';\n }\n if (position.overlayY === 'center') {\n styles.justifyContent = 'center';\n }\n else {\n styles.justifyContent = position.overlayY === 'bottom' ? 'flex-end' : 'flex-start';\n }\n if (maxHeight) {\n styles.maxHeight = coerceCssPixelValue(maxHeight);\n }\n if (maxWidth) {\n styles.maxWidth = coerceCssPixelValue(maxWidth);\n }\n }\n this._lastBoundingBoxSize = boundingBoxRect;\n extendStyles(this._boundingBox.style, styles);\n }\n /** Resets the styles for the bounding box so that a new positioning can be computed. */\n _resetBoundingBoxStyles() {\n extendStyles(this._boundingBox.style, {\n top: '0',\n left: '0',\n right: '0',\n bottom: '0',\n height: '',\n width: '',\n alignItems: '',\n justifyContent: '',\n });\n }\n /** Resets the styles for the overlay pane so that a new positioning can be computed. */\n _resetOverlayElementStyles() {\n extendStyles(this._pane.style, {\n top: '',\n left: '',\n bottom: '',\n right: '',\n position: '',\n transform: '',\n });\n }\n /** Sets positioning styles to the overlay element. */\n _setOverlayElementStyles(originPoint, position) {\n const styles = {};\n const hasExactPosition = this._hasExactPosition();\n const hasFlexibleDimensions = this._hasFlexibleDimensions;\n const config = this._overlayRef.getConfig();\n if (hasExactPosition) {\n const scrollPosition = this._viewportRuler.getViewportScrollPosition();\n extendStyles(styles, this._getExactOverlayY(position, originPoint, scrollPosition));\n extendStyles(styles, this._getExactOverlayX(position, originPoint, scrollPosition));\n }\n else {\n styles.position = 'static';\n }\n // Use a transform to apply the offsets. We do this because the `center` positions rely on\n // being in the normal flex flow and setting a `top` / `left` at all will completely throw\n // off the position. We also can't use margins, because they won't have an effect in some\n // cases where the element doesn't have anything to \"push off of\". Finally, this works\n // better both with flexible and non-flexible positioning.\n let transformString = '';\n let offsetX = this._getOffset(position, 'x');\n let offsetY = this._getOffset(position, 'y');\n if (offsetX) {\n transformString += `translateX(${offsetX}px) `;\n }\n if (offsetY) {\n transformString += `translateY(${offsetY}px)`;\n }\n styles.transform = transformString.trim();\n // If a maxWidth or maxHeight is specified on the overlay, we remove them. We do this because\n // we need these values to both be set to \"100%\" for the automatic flexible sizing to work.\n // The maxHeight and maxWidth are set on the boundingBox in order to enforce the constraint.\n // Note that this doesn't apply when we have an exact position, in which case we do want to\n // apply them because they'll be cleared from the bounding box.\n if (config.maxHeight) {\n if (hasExactPosition) {\n styles.maxHeight = coerceCssPixelValue(config.maxHeight);\n }\n else if (hasFlexibleDimensions) {\n styles.maxHeight = '';\n }\n }\n if (config.maxWidth) {\n if (hasExactPosition) {\n styles.maxWidth = coerceCssPixelValue(config.maxWidth);\n }\n else if (hasFlexibleDimensions) {\n styles.maxWidth = '';\n }\n }\n extendStyles(this._pane.style, styles);\n }\n /** Gets the exact top/bottom for the overlay when not using flexible sizing or when pushing. */\n _getExactOverlayY(position, originPoint, scrollPosition) {\n // Reset any existing styles. This is necessary in case the\n // preferred position has changed since the last `apply`.\n let styles = { top: '', bottom: '' };\n let overlayPoint = this._getOverlayPoint(originPoint, this._overlayRect, position);\n if (this._isPushed) {\n overlayPoint = this._pushOverlayOnScreen(overlayPoint, this._overlayRect, scrollPosition);\n }\n // We want to set either `top` or `bottom` based on whether the overlay wants to appear\n // above or below the origin and the direction in which the element will expand.\n if (position.overlayY === 'bottom') {\n // When using `bottom`, we adjust the y position such that it is the distance\n // from the bottom of the viewport rather than the top.\n const documentHeight = this._document.documentElement.clientHeight;\n styles.bottom = `${documentHeight - (overlayPoint.y + this._overlayRect.height)}px`;\n }\n else {\n styles.top = coerceCssPixelValue(overlayPoint.y);\n }\n return styles;\n }\n /** Gets the exact left/right for the overlay when not using flexible sizing or when pushing. */\n _getExactOverlayX(position, originPoint, scrollPosition) {\n // Reset any existing styles. This is necessary in case the preferred position has\n // changed since the last `apply`.\n let styles = { left: '', right: '' };\n let overlayPoint = this._getOverlayPoint(originPoint, this._overlayRect, position);\n if (this._isPushed) {\n overlayPoint = this._pushOverlayOnScreen(overlayPoint, this._overlayRect, scrollPosition);\n }\n // We want to set either `left` or `right` based on whether the overlay wants to appear \"before\"\n // or \"after\" the origin, which determines the direction in which the element will expand.\n // For the horizontal axis, the meaning of \"before\" and \"after\" change based on whether the\n // page is in RTL or LTR.\n let horizontalStyleProperty;\n if (this._isRtl()) {\n horizontalStyleProperty = position.overlayX === 'end' ? 'left' : 'right';\n }\n else {\n horizontalStyleProperty = position.overlayX === 'end' ? 'right' : 'left';\n }\n // When we're setting `right`, we adjust the x position such that it is the distance\n // from the right edge of the viewport rather than the left edge.\n if (horizontalStyleProperty === 'right') {\n const documentWidth = this._document.documentElement.clientWidth;\n styles.right = `${documentWidth - (overlayPoint.x + this._overlayRect.width)}px`;\n }\n else {\n styles.left = coerceCssPixelValue(overlayPoint.x);\n }\n return styles;\n }\n /**\n * Gets the view properties of the trigger and overlay, including whether they are clipped\n * or completely outside the view of any of the strategy's scrollables.\n */\n _getScrollVisibility() {\n // Note: needs fresh rects since the position could've changed.\n const originBounds = this._getOriginRect();\n const overlayBounds = this._pane.getBoundingClientRect();\n // TODO(jelbourn): instead of needing all of the client rects for these scrolling containers\n // every time, we should be able to use the scrollTop of the containers if the size of those\n // containers hasn't changed.\n const scrollContainerBounds = this._scrollables.map(scrollable => {\n return scrollable.getElementRef().nativeElement.getBoundingClientRect();\n });\n return {\n isOriginClipped: isElementClippedByScrolling(originBounds, scrollContainerBounds),\n isOriginOutsideView: isElementScrolledOutsideView(originBounds, scrollContainerBounds),\n isOverlayClipped: isElementClippedByScrolling(overlayBounds, scrollContainerBounds),\n isOverlayOutsideView: isElementScrolledOutsideView(overlayBounds, scrollContainerBounds),\n };\n }\n /** Subtracts the amount that an element is overflowing on an axis from its length. */\n _subtractOverflows(length, ...overflows) {\n return overflows.reduce((currentValue, currentOverflow) => {\n return currentValue - Math.max(currentOverflow, 0);\n }, length);\n }\n /** Narrows the given viewport rect by the current _viewportMargin. */\n _getNarrowedViewportRect() {\n // We recalculate the viewport rect here ourselves, rather than using the ViewportRuler,\n // because we want to use the `clientWidth` and `clientHeight` as the base. The difference\n // being that the client properties don't include the scrollbar, as opposed to `innerWidth`\n // and `innerHeight` that do. This is necessary, because the overlay container uses\n // 100% `width` and `height` which don't include the scrollbar either.\n const width = this._document.documentElement.clientWidth;\n const height = this._document.documentElement.clientHeight;\n const scrollPosition = this._viewportRuler.getViewportScrollPosition();\n return {\n top: scrollPosition.top + this._viewportMargin,\n left: scrollPosition.left + this._viewportMargin,\n right: scrollPosition.left + width - this._viewportMargin,\n bottom: scrollPosition.top + height - this._viewportMargin,\n width: width - 2 * this._viewportMargin,\n height: height - 2 * this._viewportMargin,\n };\n }\n /** Whether the we're dealing with an RTL context */\n _isRtl() {\n return this._overlayRef.getDirection() === 'rtl';\n }\n /** Determines whether the overlay uses exact or flexible positioning. */\n _hasExactPosition() {\n return !this._hasFlexibleDimensions || this._isPushed;\n }\n /** Retrieves the offset of a position along the x or y axis. */\n _getOffset(position, axis) {\n if (axis === 'x') {\n // We don't do something like `position['offset' + axis]` in\n // order to avoid breaking minifiers that rename properties.\n return position.offsetX == null ? this._offsetX : position.offsetX;\n }\n return position.offsetY == null ? this._offsetY : position.offsetY;\n }\n /** Validates that the current position match the expected values. */\n _validatePositions() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (!this._preferredPositions.length) {\n throw Error('FlexibleConnectedPositionStrategy: At least one position is required.');\n }\n // TODO(crisbeto): remove these once Angular's template type\n // checking is advanced enough to catch these cases.\n this._preferredPositions.forEach(pair => {\n validateHorizontalPosition('originX', pair.originX);\n validateVerticalPosition('originY', pair.originY);\n validateHorizontalPosition('overlayX', pair.overlayX);\n validateVerticalPosition('overlayY', pair.overlayY);\n });\n }\n }\n /** Adds a single CSS class or an array of classes on the overlay panel. */\n _addPanelClasses(cssClasses) {\n if (this._pane) {\n coerceArray(cssClasses).forEach(cssClass => {\n if (cssClass !== '' && this._appliedPanelClasses.indexOf(cssClass) === -1) {\n this._appliedPanelClasses.push(cssClass);\n this._pane.classList.add(cssClass);\n }\n });\n }\n }\n /** Clears the classes that the position strategy has applied from the overlay panel. */\n _clearPanelClasses() {\n if (this._pane) {\n this._appliedPanelClasses.forEach(cssClass => {\n this._pane.classList.remove(cssClass);\n });\n this._appliedPanelClasses = [];\n }\n }\n /** Returns the DOMRect of the current origin. */\n _getOriginRect() {\n const origin = this._origin;\n if (origin instanceof ElementRef) {\n return origin.nativeElement.getBoundingClientRect();\n }\n // Check for Element so SVG elements are also supported.\n if (origin instanceof Element) {\n return origin.getBoundingClientRect();\n }\n const width = origin.width || 0;\n const height = origin.height || 0;\n // If the origin is a point, return a client rect as if it was a 0x0 element at the point.\n return {\n top: origin.y,\n bottom: origin.y + height,\n left: origin.x,\n right: origin.x + width,\n height,\n width,\n };\n }\n}\n/** Shallow-extends a stylesheet object with another stylesheet object. */\nfunction extendStyles(destination, source) {\n for (let key in source) {\n if (source.hasOwnProperty(key)) {\n destination[key] = source[key];\n }\n }\n return destination;\n}\n/**\n * Extracts the pixel value as a number from a value, if it's a number\n * or a CSS pixel string (e.g. `1337px`). Otherwise returns null.\n */\nfunction getPixelValue(input) {\n if (typeof input !== 'number' && input != null) {\n const [value, units] = input.split(cssUnitPattern);\n return !units || units === 'px' ? parseFloat(value) : null;\n }\n return input || null;\n}\n/**\n * Gets a version of an element's bounding `DOMRect` where all the values are rounded down to\n * the nearest pixel. This allows us to account for the cases where there may be sub-pixel\n * deviations in the `DOMRect` returned by the browser (e.g. when zoomed in with a percentage\n * size, see #21350).\n */\nfunction getRoundedBoundingClientRect(clientRect) {\n return {\n top: Math.floor(clientRect.top),\n right: Math.floor(clientRect.right),\n bottom: Math.floor(clientRect.bottom),\n left: Math.floor(clientRect.left),\n width: Math.floor(clientRect.width),\n height: Math.floor(clientRect.height),\n };\n}\n/** Returns whether two `ScrollingVisibility` objects are identical. */\nfunction compareScrollVisibility(a, b) {\n if (a === b) {\n return true;\n }\n return (a.isOriginClipped === b.isOriginClipped &&\n a.isOriginOutsideView === b.isOriginOutsideView &&\n a.isOverlayClipped === b.isOverlayClipped &&\n a.isOverlayOutsideView === b.isOverlayOutsideView);\n}\nconst STANDARD_DROPDOWN_BELOW_POSITIONS = [\n { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },\n { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' },\n { originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top' },\n { originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom' },\n];\nconst STANDARD_DROPDOWN_ADJACENT_POSITIONS = [\n { originX: 'end', originY: 'top', overlayX: 'start', overlayY: 'top' },\n { originX: 'end', originY: 'bottom', overlayX: 'start', overlayY: 'bottom' },\n { originX: 'start', originY: 'top', overlayX: 'end', overlayY: 'top' },\n { originX: 'start', originY: 'bottom', overlayX: 'end', overlayY: 'bottom' },\n];\n\n/** Class to be added to the overlay pane wrapper. */\nconst wrapperClass = 'cdk-global-overlay-wrapper';\n/**\n * A strategy for positioning overlays. Using this strategy, an overlay is given an\n * explicit position relative to the browser's viewport. We use flexbox, instead of\n * transforms, in order to avoid issues with subpixel rendering which can cause the\n * element to become blurry.\n */\nclass GlobalPositionStrategy {\n constructor() {\n this._cssPosition = 'static';\n this._topOffset = '';\n this._bottomOffset = '';\n this._alignItems = '';\n this._xPosition = '';\n this._xOffset = '';\n this._width = '';\n this._height = '';\n this._isDisposed = false;\n }\n attach(overlayRef) {\n const config = overlayRef.getConfig();\n this._overlayRef = overlayRef;\n if (this._width && !config.width) {\n overlayRef.updateSize({ width: this._width });\n }\n if (this._height && !config.height) {\n overlayRef.updateSize({ height: this._height });\n }\n overlayRef.hostElement.classList.add(wrapperClass);\n this._isDisposed = false;\n }\n /**\n * Sets the top position of the overlay. Clears any previously set vertical position.\n * @param value New top offset.\n */\n top(value = '') {\n this._bottomOffset = '';\n this._topOffset = value;\n this._alignItems = 'flex-start';\n return this;\n }\n /**\n * Sets the left position of the overlay. Clears any previously set horizontal position.\n * @param value New left offset.\n */\n left(value = '') {\n this._xOffset = value;\n this._xPosition = 'left';\n return this;\n }\n /**\n * Sets the bottom position of the overlay. Clears any previously set vertical position.\n * @param value New bottom offset.\n */\n bottom(value = '') {\n this._topOffset = '';\n this._bottomOffset = value;\n this._alignItems = 'flex-end';\n return this;\n }\n /**\n * Sets the right position of the overlay. Clears any previously set horizontal position.\n * @param value New right offset.\n */\n right(value = '') {\n this._xOffset = value;\n this._xPosition = 'right';\n return this;\n }\n /**\n * Sets the overlay to the start of the viewport, depending on the overlay direction.\n * This will be to the left in LTR layouts and to the right in RTL.\n * @param offset Offset from the edge of the screen.\n */\n start(value = '') {\n this._xOffset = value;\n this._xPosition = 'start';\n return this;\n }\n /**\n * Sets the overlay to the end of the viewport, depending on the overlay direction.\n * This will be to the right in LTR layouts and to the left in RTL.\n * @param offset Offset from the edge of the screen.\n */\n end(value = '') {\n this._xOffset = value;\n this._xPosition = 'end';\n return this;\n }\n /**\n * Sets the overlay width and clears any previously set width.\n * @param value New width for the overlay\n * @deprecated Pass the `width` through the `OverlayConfig`.\n * @breaking-change 8.0.0\n */\n width(value = '') {\n if (this._overlayRef) {\n this._overlayRef.updateSize({ width: value });\n }\n else {\n this._width = value;\n }\n return this;\n }\n /**\n * Sets the overlay height and clears any previously set height.\n * @param value New height for the overlay\n * @deprecated Pass the `height` through the `OverlayConfig`.\n * @breaking-change 8.0.0\n */\n height(value = '') {\n if (this._overlayRef) {\n this._overlayRef.updateSize({ height: value });\n }\n else {\n this._height = value;\n }\n return this;\n }\n /**\n * Centers the overlay horizontally with an optional offset.\n * Clears any previously set horizontal position.\n *\n * @param offset Overlay offset from the horizontal center.\n */\n centerHorizontally(offset = '') {\n this.left(offset);\n this._xPosition = 'center';\n return this;\n }\n /**\n * Centers the overlay vertically with an optional offset.\n * Clears any previously set vertical position.\n *\n * @param offset Overlay offset from the vertical center.\n */\n centerVertically(offset = '') {\n this.top(offset);\n this._alignItems = 'center';\n return this;\n }\n /**\n * Apply the position to the element.\n * @docs-private\n */\n apply() {\n // Since the overlay ref applies the strategy asynchronously, it could\n // have been disposed before it ends up being applied. If that is the\n // case, we shouldn't do anything.\n if (!this._overlayRef || !this._overlayRef.hasAttached()) {\n return;\n }\n const styles = this._overlayRef.overlayElement.style;\n const parentStyles = this._overlayRef.hostElement.style;\n const config = this._overlayRef.getConfig();\n const { width, height, maxWidth, maxHeight } = config;\n const shouldBeFlushHorizontally = (width === '100%' || width === '100vw') &&\n (!maxWidth || maxWidth === '100%' || maxWidth === '100vw');\n const shouldBeFlushVertically = (height === '100%' || height === '100vh') &&\n (!maxHeight || maxHeight === '100%' || maxHeight === '100vh');\n const xPosition = this._xPosition;\n const xOffset = this._xOffset;\n const isRtl = this._overlayRef.getConfig().direction === 'rtl';\n let marginLeft = '';\n let marginRight = '';\n let justifyContent = '';\n if (shouldBeFlushHorizontally) {\n justifyContent = 'flex-start';\n }\n else if (xPosition === 'center') {\n justifyContent = 'center';\n if (isRtl) {\n marginRight = xOffset;\n }\n else {\n marginLeft = xOffset;\n }\n }\n else if (isRtl) {\n if (xPosition === 'left' || xPosition === 'end') {\n justifyContent = 'flex-end';\n marginLeft = xOffset;\n }\n else if (xPosition === 'right' || xPosition === 'start') {\n justifyContent = 'flex-start';\n marginRight = xOffset;\n }\n }\n else if (xPosition === 'left' || xPosition === 'start') {\n justifyContent = 'flex-start';\n marginLeft = xOffset;\n }\n else if (xPosition === 'right' || xPosition === 'end') {\n justifyContent = 'flex-end';\n marginRight = xOffset;\n }\n styles.position = this._cssPosition;\n styles.marginLeft = shouldBeFlushHorizontally ? '0' : marginLeft;\n styles.marginTop = shouldBeFlushVertically ? '0' : this._topOffset;\n styles.marginBottom = this._bottomOffset;\n styles.marginRight = shouldBeFlushHorizontally ? '0' : marginRight;\n parentStyles.justifyContent = justifyContent;\n parentStyles.alignItems = shouldBeFlushVertically ? 'flex-start' : this._alignItems;\n }\n /**\n * Cleans up the DOM changes from the position strategy.\n * @docs-private\n */\n dispose() {\n if (this._isDisposed || !this._overlayRef) {\n return;\n }\n const styles = this._overlayRef.overlayElement.style;\n const parent = this._overlayRef.hostElement;\n const parentStyles = parent.style;\n parent.classList.remove(wrapperClass);\n parentStyles.justifyContent =\n parentStyles.alignItems =\n styles.marginTop =\n styles.marginBottom =\n styles.marginLeft =\n styles.marginRight =\n styles.position =\n '';\n this._overlayRef = null;\n this._isDisposed = true;\n }\n}\n\n/** Builder for overlay position strategy. */\nclass OverlayPositionBuilder {\n constructor(_viewportRuler, _document, _platform, _overlayContainer) {\n this._viewportRuler = _viewportRuler;\n this._document = _document;\n this._platform = _platform;\n this._overlayContainer = _overlayContainer;\n }\n /**\n * Creates a global position strategy.\n */\n global() {\n return new GlobalPositionStrategy();\n }\n /**\n * Creates a flexible position strategy.\n * @param origin Origin relative to which to position the overlay.\n */\n flexibleConnectedTo(origin) {\n return new FlexibleConnectedPositionStrategy(origin, this._viewportRuler, this._document, this._platform, this._overlayContainer);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: OverlayPositionBuilder, deps: [{ token: i1.ViewportRuler }, { token: DOCUMENT }, { token: i1$1.Platform }, { token: OverlayContainer }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: OverlayPositionBuilder, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: OverlayPositionBuilder, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }], ctorParameters: () => [{ type: i1.ViewportRuler }, { type: undefined, decorators: [{\n type: Inject,\n args: [DOCUMENT]\n }] }, { type: i1$1.Platform }, { type: OverlayContainer }] });\n\n/** Next overlay unique ID. */\nlet nextUniqueId = 0;\n// Note that Overlay is *not* scoped to the app root because of the ComponentFactoryResolver\n// which needs to be different depending on where OverlayModule is imported.\n/**\n * Service to create Overlays. Overlays are dynamically added pieces of floating UI, meant to be\n * used as a low-level building block for other components. Dialogs, tooltips, menus,\n * selects, etc. can all be built using overlays. The service should primarily be used by authors\n * of re-usable components rather than developers building end-user applications.\n *\n * An overlay *is* a PortalOutlet, so any kind of Portal can be loaded into one.\n */\nclass Overlay {\n constructor(\n /** Scrolling strategies that can be used when creating an overlay. */\n scrollStrategies, _overlayContainer, _componentFactoryResolver, _positionBuilder, _keyboardDispatcher, _injector, _ngZone, _document, _directionality, _location, _outsideClickDispatcher, _animationsModuleType) {\n this.scrollStrategies = scrollStrategies;\n this._overlayContainer = _overlayContainer;\n this._componentFactoryResolver = _componentFactoryResolver;\n this._positionBuilder = _positionBuilder;\n this._keyboardDispatcher = _keyboardDispatcher;\n this._injector = _injector;\n this._ngZone = _ngZone;\n this._document = _document;\n this._directionality = _directionality;\n this._location = _location;\n this._outsideClickDispatcher = _outsideClickDispatcher;\n this._animationsModuleType = _animationsModuleType;\n }\n /**\n * Creates an overlay.\n * @param config Configuration applied to the overlay.\n * @returns Reference to the created overlay.\n */\n create(config) {\n const host = this._createHostElement();\n const pane = this._createPaneElement(host);\n const portalOutlet = this._createPortalOutlet(pane);\n const overlayConfig = new OverlayConfig(config);\n overlayConfig.direction = overlayConfig.direction || this._directionality.value;\n return new OverlayRef(portalOutlet, host, pane, overlayConfig, this._ngZone, this._keyboardDispatcher, this._document, this._location, this._outsideClickDispatcher, this._animationsModuleType === 'NoopAnimations', this._injector.get(EnvironmentInjector));\n }\n /**\n * Gets a position builder that can be used, via fluent API,\n * to construct and configure a position strategy.\n * @returns An overlay position builder.\n */\n position() {\n return this._positionBuilder;\n }\n /**\n * Creates the DOM element for an overlay and appends it to the overlay container.\n * @returns Newly-created pane element\n */\n _createPaneElement(host) {\n const pane = this._document.createElement('div');\n pane.id = `cdk-overlay-${nextUniqueId++}`;\n pane.classList.add('cdk-overlay-pane');\n host.appendChild(pane);\n return pane;\n }\n /**\n * Creates the host element that wraps around an overlay\n * and can be used for advanced positioning.\n * @returns Newly-create host element.\n */\n _createHostElement() {\n const host = this._document.createElement('div');\n this._overlayContainer.getContainerElement().appendChild(host);\n return host;\n }\n /**\n * Create a DomPortalOutlet into which the overlay content can be loaded.\n * @param pane The DOM element to turn into a portal outlet.\n * @returns A portal outlet for the given DOM element.\n */\n _createPortalOutlet(pane) {\n // We have to resolve the ApplicationRef later in order to allow people\n // to use overlay-based providers during app initialization.\n if (!this._appRef) {\n this._appRef = this._injector.get(ApplicationRef);\n }\n return new DomPortalOutlet(pane, this._componentFactoryResolver, this._appRef, this._injector, this._document);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: Overlay, deps: [{ token: ScrollStrategyOptions }, { token: OverlayContainer }, { token: i0.ComponentFactoryResolver }, { token: OverlayPositionBuilder }, { token: OverlayKeyboardDispatcher }, { token: i0.Injector }, { token: i0.NgZone }, { token: DOCUMENT }, { token: i5.Directionality }, { token: i6.Location }, { token: OverlayOutsideClickDispatcher }, { token: ANIMATION_MODULE_TYPE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: Overlay, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: Overlay, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }], ctorParameters: () => [{ type: ScrollStrategyOptions }, { type: OverlayContainer }, { type: i0.ComponentFactoryResolver }, { type: OverlayPositionBuilder }, { type: OverlayKeyboardDispatcher }, { type: i0.Injector }, { type: i0.NgZone }, { type: undefined, decorators: [{\n type: Inject,\n args: [DOCUMENT]\n }] }, { type: i5.Directionality }, { type: i6.Location }, { type: OverlayOutsideClickDispatcher }, { type: undefined, decorators: [{\n type: Inject,\n args: [ANIMATION_MODULE_TYPE]\n }, {\n type: Optional\n }] }] });\n\n/** Default set of positions for the overlay. Follows the behavior of a dropdown. */\nconst defaultPositionList = [\n {\n originX: 'start',\n originY: 'bottom',\n overlayX: 'start',\n overlayY: 'top',\n },\n {\n originX: 'start',\n originY: 'top',\n overlayX: 'start',\n overlayY: 'bottom',\n },\n {\n originX: 'end',\n originY: 'top',\n overlayX: 'end',\n overlayY: 'bottom',\n },\n {\n originX: 'end',\n originY: 'bottom',\n overlayX: 'end',\n overlayY: 'top',\n },\n];\n/** Injection token that determines the scroll handling while the connected overlay is open. */\nconst CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY = new InjectionToken('cdk-connected-overlay-scroll-strategy', {\n providedIn: 'root',\n factory: () => {\n const overlay = inject(Overlay);\n return () => overlay.scrollStrategies.reposition();\n },\n});\n/**\n * Directive applied to an element to make it usable as an origin for an Overlay using a\n * ConnectedPositionStrategy.\n */\nclass CdkOverlayOrigin {\n constructor(\n /** Reference to the element on which the directive is applied. */\n elementRef) {\n this.elementRef = elementRef;\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkOverlayOrigin, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.0\", type: CdkOverlayOrigin, isStandalone: true, selector: \"[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]\", exportAs: [\"cdkOverlayOrigin\"], ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkOverlayOrigin, decorators: [{\n type: Directive,\n args: [{\n selector: '[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]',\n exportAs: 'cdkOverlayOrigin',\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: i0.ElementRef }] });\n/**\n * Directive to facilitate declarative creation of an\n * Overlay using a FlexibleConnectedPositionStrategy.\n */\nclass CdkConnectedOverlay {\n /** The offset in pixels for the overlay connection point on the x-axis */\n get offsetX() {\n return this._offsetX;\n }\n set offsetX(offsetX) {\n this._offsetX = offsetX;\n if (this._position) {\n this._updatePositionStrategy(this._position);\n }\n }\n /** The offset in pixels for the overlay connection point on the y-axis */\n get offsetY() {\n return this._offsetY;\n }\n set offsetY(offsetY) {\n this._offsetY = offsetY;\n if (this._position) {\n this._updatePositionStrategy(this._position);\n }\n }\n /** Whether the overlay should be disposed of when the user goes backwards/forwards in history. */\n get disposeOnNavigation() {\n return this._disposeOnNavigation;\n }\n set disposeOnNavigation(value) {\n this._disposeOnNavigation = value;\n }\n // TODO(jelbourn): inputs for size, scroll behavior, animation, etc.\n constructor(_overlay, templateRef, viewContainerRef, scrollStrategyFactory, _dir) {\n this._overlay = _overlay;\n this._dir = _dir;\n this._backdropSubscription = Subscription.EMPTY;\n this._attachSubscription = Subscription.EMPTY;\n this._detachSubscription = Subscription.EMPTY;\n this._positionSubscription = Subscription.EMPTY;\n this._disposeOnNavigation = false;\n this._ngZone = inject(NgZone);\n /** Margin between the overlay and the viewport edges. */\n this.viewportMargin = 0;\n /** Whether the overlay is open. */\n this.open = false;\n /** Whether the overlay can be closed by user interaction. */\n this.disableClose = false;\n /** Whether or not the overlay should attach a backdrop. */\n this.hasBackdrop = false;\n /** Whether or not the overlay should be locked when scrolling. */\n this.lockPosition = false;\n /** Whether the overlay's width and height can be constrained to fit within the viewport. */\n this.flexibleDimensions = false;\n /** Whether the overlay can grow after the initial open when flexible positioning is turned on. */\n this.growAfterOpen = false;\n /** Whether the overlay can be pushed on-screen if none of the provided positions fit. */\n this.push = false;\n /** Event emitted when the backdrop is clicked. */\n this.backdropClick = new EventEmitter();\n /** Event emitted when the position has changed. */\n this.positionChange = new EventEmitter();\n /** Event emitted when the overlay has been attached. */\n this.attach = new EventEmitter();\n /** Event emitted when the overlay has been detached. */\n this.detach = new EventEmitter();\n /** Emits when there are keyboard events that are targeted at the overlay. */\n this.overlayKeydown = new EventEmitter();\n /** Emits when there are mouse outside click events that are targeted at the overlay. */\n this.overlayOutsideClick = new EventEmitter();\n this._templatePortal = new TemplatePortal(templateRef, viewContainerRef);\n this._scrollStrategyFactory = scrollStrategyFactory;\n this.scrollStrategy = this._scrollStrategyFactory();\n }\n /** The associated overlay reference. */\n get overlayRef() {\n return this._overlayRef;\n }\n /** The element's layout direction. */\n get dir() {\n return this._dir ? this._dir.value : 'ltr';\n }\n ngOnDestroy() {\n this._attachSubscription.unsubscribe();\n this._detachSubscription.unsubscribe();\n this._backdropSubscription.unsubscribe();\n this._positionSubscription.unsubscribe();\n if (this._overlayRef) {\n this._overlayRef.dispose();\n }\n }\n ngOnChanges(changes) {\n if (this._position) {\n this._updatePositionStrategy(this._position);\n this._overlayRef.updateSize({\n width: this.width,\n minWidth: this.minWidth,\n height: this.height,\n minHeight: this.minHeight,\n });\n if (changes['origin'] && this.open) {\n this._position.apply();\n }\n }\n if (changes['open']) {\n this.open ? this._attachOverlay() : this._detachOverlay();\n }\n }\n /** Creates an overlay */\n _createOverlay() {\n if (!this.positions || !this.positions.length) {\n this.positions = defaultPositionList;\n }\n const overlayRef = (this._overlayRef = this._overlay.create(this._buildConfig()));\n this._attachSubscription = overlayRef.attachments().subscribe(() => this.attach.emit());\n this._detachSubscription = overlayRef.detachments().subscribe(() => this.detach.emit());\n overlayRef.keydownEvents().subscribe((event) => {\n this.overlayKeydown.next(event);\n if (event.keyCode === ESCAPE && !this.disableClose && !hasModifierKey(event)) {\n event.preventDefault();\n this._detachOverlay();\n }\n });\n this._overlayRef.outsidePointerEvents().subscribe((event) => {\n const origin = this._getOriginElement();\n const target = _getEventTarget(event);\n if (!origin || (origin !== target && !origin.contains(target))) {\n this.overlayOutsideClick.next(event);\n }\n });\n }\n /** Builds the overlay config based on the directive's inputs */\n _buildConfig() {\n const positionStrategy = (this._position =\n this.positionStrategy || this._createPositionStrategy());\n const overlayConfig = new OverlayConfig({\n direction: this._dir,\n positionStrategy,\n scrollStrategy: this.scrollStrategy,\n hasBackdrop: this.hasBackdrop,\n disposeOnNavigation: this.disposeOnNavigation,\n });\n if (this.width || this.width === 0) {\n overlayConfig.width = this.width;\n }\n if (this.height || this.height === 0) {\n overlayConfig.height = this.height;\n }\n if (this.minWidth || this.minWidth === 0) {\n overlayConfig.minWidth = this.minWidth;\n }\n if (this.minHeight || this.minHeight === 0) {\n overlayConfig.minHeight = this.minHeight;\n }\n if (this.backdropClass) {\n overlayConfig.backdropClass = this.backdropClass;\n }\n if (this.panelClass) {\n overlayConfig.panelClass = this.panelClass;\n }\n return overlayConfig;\n }\n /** Updates the state of a position strategy, based on the values of the directive inputs. */\n _updatePositionStrategy(positionStrategy) {\n const positions = this.positions.map(currentPosition => ({\n originX: currentPosition.originX,\n originY: currentPosition.originY,\n overlayX: currentPosition.overlayX,\n overlayY: currentPosition.overlayY,\n offsetX: currentPosition.offsetX || this.offsetX,\n offsetY: currentPosition.offsetY || this.offsetY,\n panelClass: currentPosition.panelClass || undefined,\n }));\n return positionStrategy\n .setOrigin(this._getOrigin())\n .withPositions(positions)\n .withFlexibleDimensions(this.flexibleDimensions)\n .withPush(this.push)\n .withGrowAfterOpen(this.growAfterOpen)\n .withViewportMargin(this.viewportMargin)\n .withLockedPosition(this.lockPosition)\n .withTransformOriginOn(this.transformOriginSelector);\n }\n /** Returns the position strategy of the overlay to be set on the overlay config */\n _createPositionStrategy() {\n const strategy = this._overlay.position().flexibleConnectedTo(this._getOrigin());\n this._updatePositionStrategy(strategy);\n return strategy;\n }\n _getOrigin() {\n if (this.origin instanceof CdkOverlayOrigin) {\n return this.origin.elementRef;\n }\n else {\n return this.origin;\n }\n }\n _getOriginElement() {\n if (this.origin instanceof CdkOverlayOrigin) {\n return this.origin.elementRef.nativeElement;\n }\n if (this.origin instanceof ElementRef) {\n return this.origin.nativeElement;\n }\n if (typeof Element !== 'undefined' && this.origin instanceof Element) {\n return this.origin;\n }\n return null;\n }\n /** Attaches the overlay and subscribes to backdrop clicks if backdrop exists */\n _attachOverlay() {\n if (!this._overlayRef) {\n this._createOverlay();\n }\n else {\n // Update the overlay size, in case the directive's inputs have changed\n this._overlayRef.getConfig().hasBackdrop = this.hasBackdrop;\n }\n if (!this._overlayRef.hasAttached()) {\n this._overlayRef.attach(this._templatePortal);\n }\n if (this.hasBackdrop) {\n this._backdropSubscription = this._overlayRef.backdropClick().subscribe(event => {\n this.backdropClick.emit(event);\n });\n }\n else {\n this._backdropSubscription.unsubscribe();\n }\n this._positionSubscription.unsubscribe();\n // Only subscribe to `positionChanges` if requested, because putting\n // together all the information for it can be expensive.\n if (this.positionChange.observers.length > 0) {\n this._positionSubscription = this._position.positionChanges\n .pipe(takeWhile(() => this.positionChange.observers.length > 0))\n .subscribe(position => {\n this._ngZone.run(() => this.positionChange.emit(position));\n if (this.positionChange.observers.length === 0) {\n this._positionSubscription.unsubscribe();\n }\n });\n }\n }\n /** Detaches the overlay and unsubscribes to backdrop clicks if backdrop exists */\n _detachOverlay() {\n if (this._overlayRef) {\n this._overlayRef.detach();\n }\n this._backdropSubscription.unsubscribe();\n this._positionSubscription.unsubscribe();\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkConnectedOverlay, deps: [{ token: Overlay }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY }, { token: i5.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"16.1.0\", version: \"18.0.0\", type: CdkConnectedOverlay, isStandalone: true, selector: \"[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]\", inputs: { origin: [\"cdkConnectedOverlayOrigin\", \"origin\"], positions: [\"cdkConnectedOverlayPositions\", \"positions\"], positionStrategy: [\"cdkConnectedOverlayPositionStrategy\", \"positionStrategy\"], offsetX: [\"cdkConnectedOverlayOffsetX\", \"offsetX\"], offsetY: [\"cdkConnectedOverlayOffsetY\", \"offsetY\"], width: [\"cdkConnectedOverlayWidth\", \"width\"], height: [\"cdkConnectedOverlayHeight\", \"height\"], minWidth: [\"cdkConnectedOverlayMinWidth\", \"minWidth\"], minHeight: [\"cdkConnectedOverlayMinHeight\", \"minHeight\"], backdropClass: [\"cdkConnectedOverlayBackdropClass\", \"backdropClass\"], panelClass: [\"cdkConnectedOverlayPanelClass\", \"panelClass\"], viewportMargin: [\"cdkConnectedOverlayViewportMargin\", \"viewportMargin\"], scrollStrategy: [\"cdkConnectedOverlayScrollStrategy\", \"scrollStrategy\"], open: [\"cdkConnectedOverlayOpen\", \"open\"], disableClose: [\"cdkConnectedOverlayDisableClose\", \"disableClose\"], transformOriginSelector: [\"cdkConnectedOverlayTransformOriginOn\", \"transformOriginSelector\"], hasBackdrop: [\"cdkConnectedOverlayHasBackdrop\", \"hasBackdrop\", booleanAttribute], lockPosition: [\"cdkConnectedOverlayLockPosition\", \"lockPosition\", booleanAttribute], flexibleDimensions: [\"cdkConnectedOverlayFlexibleDimensions\", \"flexibleDimensions\", booleanAttribute], growAfterOpen: [\"cdkConnectedOverlayGrowAfterOpen\", \"growAfterOpen\", booleanAttribute], push: [\"cdkConnectedOverlayPush\", \"push\", booleanAttribute], disposeOnNavigation: [\"cdkConnectedOverlayDisposeOnNavigation\", \"disposeOnNavigation\", booleanAttribute] }, outputs: { backdropClick: \"backdropClick\", positionChange: \"positionChange\", attach: \"attach\", detach: \"detach\", overlayKeydown: \"overlayKeydown\", overlayOutsideClick: \"overlayOutsideClick\" }, exportAs: [\"cdkConnectedOverlay\"], usesOnChanges: true, ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkConnectedOverlay, decorators: [{\n type: Directive,\n args: [{\n selector: '[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]',\n exportAs: 'cdkConnectedOverlay',\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: Overlay }, { type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{\n type: Inject,\n args: [CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY]\n }] }, { type: i5.Directionality, decorators: [{\n type: Optional\n }] }], propDecorators: { origin: [{\n type: Input,\n args: ['cdkConnectedOverlayOrigin']\n }], positions: [{\n type: Input,\n args: ['cdkConnectedOverlayPositions']\n }], positionStrategy: [{\n type: Input,\n args: ['cdkConnectedOverlayPositionStrategy']\n }], offsetX: [{\n type: Input,\n args: ['cdkConnectedOverlayOffsetX']\n }], offsetY: [{\n type: Input,\n args: ['cdkConnectedOverlayOffsetY']\n }], width: [{\n type: Input,\n args: ['cdkConnectedOverlayWidth']\n }], height: [{\n type: Input,\n args: ['cdkConnectedOverlayHeight']\n }], minWidth: [{\n type: Input,\n args: ['cdkConnectedOverlayMinWidth']\n }], minHeight: [{\n type: Input,\n args: ['cdkConnectedOverlayMinHeight']\n }], backdropClass: [{\n type: Input,\n args: ['cdkConnectedOverlayBackdropClass']\n }], panelClass: [{\n type: Input,\n args: ['cdkConnectedOverlayPanelClass']\n }], viewportMargin: [{\n type: Input,\n args: ['cdkConnectedOverlayViewportMargin']\n }], scrollStrategy: [{\n type: Input,\n args: ['cdkConnectedOverlayScrollStrategy']\n }], open: [{\n type: Input,\n args: ['cdkConnectedOverlayOpen']\n }], disableClose: [{\n type: Input,\n args: ['cdkConnectedOverlayDisableClose']\n }], transformOriginSelector: [{\n type: Input,\n args: ['cdkConnectedOverlayTransformOriginOn']\n }], hasBackdrop: [{\n type: Input,\n args: [{ alias: 'cdkConnectedOverlayHasBackdrop', transform: booleanAttribute }]\n }], lockPosition: [{\n type: Input,\n args: [{ alias: 'cdkConnectedOverlayLockPosition', transform: booleanAttribute }]\n }], flexibleDimensions: [{\n type: Input,\n args: [{ alias: 'cdkConnectedOverlayFlexibleDimensions', transform: booleanAttribute }]\n }], growAfterOpen: [{\n type: Input,\n args: [{ alias: 'cdkConnectedOverlayGrowAfterOpen', transform: booleanAttribute }]\n }], push: [{\n type: Input,\n args: [{ alias: 'cdkConnectedOverlayPush', transform: booleanAttribute }]\n }], disposeOnNavigation: [{\n type: Input,\n args: [{ alias: 'cdkConnectedOverlayDisposeOnNavigation', transform: booleanAttribute }]\n }], backdropClick: [{\n type: Output\n }], positionChange: [{\n type: Output\n }], attach: [{\n type: Output\n }], detach: [{\n type: Output\n }], overlayKeydown: [{\n type: Output\n }], overlayOutsideClick: [{\n type: Output\n }] } });\n/** @docs-private */\nfunction CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay) {\n return () => overlay.scrollStrategies.reposition();\n}\n/** @docs-private */\nconst CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER = {\n provide: CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY,\n deps: [Overlay],\n useFactory: CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER_FACTORY,\n};\n\nclass OverlayModule {\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: OverlayModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }\n static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"14.0.0\", version: \"18.0.0\", ngImport: i0, type: OverlayModule, imports: [BidiModule, PortalModule, ScrollingModule, CdkConnectedOverlay, CdkOverlayOrigin], exports: [CdkConnectedOverlay, CdkOverlayOrigin, ScrollingModule] }); }\n static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: OverlayModule, providers: [Overlay, CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER], imports: [BidiModule, PortalModule, ScrollingModule, ScrollingModule] }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: OverlayModule, decorators: [{\n type: NgModule,\n args: [{\n imports: [BidiModule, PortalModule, ScrollingModule, CdkConnectedOverlay, CdkOverlayOrigin],\n exports: [CdkConnectedOverlay, CdkOverlayOrigin, ScrollingModule],\n providers: [Overlay, CDK_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER],\n }]\n }] });\n\n/**\n * Alternative to OverlayContainer that supports correct displaying of overlay elements in\n * Fullscreen mode\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullScreen\n *\n * Should be provided in the root component.\n */\nclass FullscreenOverlayContainer extends OverlayContainer {\n constructor(_document, platform) {\n super(_document, platform);\n }\n ngOnDestroy() {\n super.ngOnDestroy();\n if (this._fullScreenEventName && this._fullScreenListener) {\n this._document.removeEventListener(this._fullScreenEventName, this._fullScreenListener);\n }\n }\n _createContainer() {\n super._createContainer();\n this._adjustParentForFullscreenChange();\n this._addFullscreenChangeListener(() => this._adjustParentForFullscreenChange());\n }\n _adjustParentForFullscreenChange() {\n if (!this._containerElement) {\n return;\n }\n const fullscreenElement = this.getFullscreenElement();\n const parent = fullscreenElement || this._document.body;\n parent.appendChild(this._containerElement);\n }\n _addFullscreenChangeListener(fn) {\n const eventName = this._getEventName();\n if (eventName) {\n if (this._fullScreenListener) {\n this._document.removeEventListener(eventName, this._fullScreenListener);\n }\n this._document.addEventListener(eventName, fn);\n this._fullScreenListener = fn;\n }\n }\n _getEventName() {\n if (!this._fullScreenEventName) {\n const _document = this._document;\n if (_document.fullscreenEnabled) {\n this._fullScreenEventName = 'fullscreenchange';\n }\n else if (_document.webkitFullscreenEnabled) {\n this._fullScreenEventName = 'webkitfullscreenchange';\n }\n else if (_document.mozFullScreenEnabled) {\n this._fullScreenEventName = 'mozfullscreenchange';\n }\n else if (_document.msFullscreenEnabled) {\n this._fullScreenEventName = 'MSFullscreenChange';\n }\n }\n return this._fullScreenEventName;\n }\n /**\n * When the page is put into fullscreen mode, a specific element is specified.\n * Only that element and its children are visible when in fullscreen mode.\n */\n getFullscreenElement() {\n const _document = this._document;\n return (_document.fullscreenElement ||\n _document.webkitFullscreenElement ||\n _document.mozFullScreenElement ||\n _document.msFullscreenElement ||\n null);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: FullscreenOverlayContainer, deps: [{ token: DOCUMENT }, { token: i1$1.Platform }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: FullscreenOverlayContainer, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: FullscreenOverlayContainer, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }], ctorParameters: () => [{ type: undefined, decorators: [{\n type: Inject,\n args: [DOCUMENT]\n }] }, { type: i1$1.Platform }] });\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { BlockScrollStrategy, CdkConnectedOverlay, CdkOverlayOrigin, CloseScrollStrategy, ConnectedOverlayPositionChange, ConnectionPositionPair, FlexibleConnectedPositionStrategy, FullscreenOverlayContainer, GlobalPositionStrategy, NoopScrollStrategy, Overlay, OverlayConfig, OverlayContainer, OverlayKeyboardDispatcher, OverlayModule, OverlayOutsideClickDispatcher, OverlayPositionBuilder, OverlayRef, RepositionScrollStrategy, STANDARD_DROPDOWN_ADJACENT_POSITIONS, STANDARD_DROPDOWN_BELOW_POSITIONS, ScrollStrategyOptions, ScrollingVisibility, validateHorizontalPosition, validateVerticalPosition };\n","const MAC_ENTER = 3;\nconst BACKSPACE = 8;\nconst TAB = 9;\nconst NUM_CENTER = 12;\nconst ENTER = 13;\nconst SHIFT = 16;\nconst CONTROL = 17;\nconst ALT = 18;\nconst PAUSE = 19;\nconst CAPS_LOCK = 20;\nconst ESCAPE = 27;\nconst SPACE = 32;\nconst PAGE_UP = 33;\nconst PAGE_DOWN = 34;\nconst END = 35;\nconst HOME = 36;\nconst LEFT_ARROW = 37;\nconst UP_ARROW = 38;\nconst RIGHT_ARROW = 39;\nconst DOWN_ARROW = 40;\nconst PLUS_SIGN = 43;\nconst PRINT_SCREEN = 44;\nconst INSERT = 45;\nconst DELETE = 46;\nconst ZERO = 48;\nconst ONE = 49;\nconst TWO = 50;\nconst THREE = 51;\nconst FOUR = 52;\nconst FIVE = 53;\nconst SIX = 54;\nconst SEVEN = 55;\nconst EIGHT = 56;\nconst NINE = 57;\nconst FF_SEMICOLON = 59; // Firefox (Gecko) fires this for semicolon instead of 186\nconst FF_EQUALS = 61; // Firefox (Gecko) fires this for equals instead of 187\nconst QUESTION_MARK = 63;\nconst AT_SIGN = 64;\nconst A = 65;\nconst B = 66;\nconst C = 67;\nconst D = 68;\nconst E = 69;\nconst F = 70;\nconst G = 71;\nconst H = 72;\nconst I = 73;\nconst J = 74;\nconst K = 75;\nconst L = 76;\nconst M = 77;\nconst N = 78;\nconst O = 79;\nconst P = 80;\nconst Q = 81;\nconst R = 82;\nconst S = 83;\nconst T = 84;\nconst U = 85;\nconst V = 86;\nconst W = 87;\nconst X = 88;\nconst Y = 89;\nconst Z = 90;\nconst META = 91; // WIN_KEY_LEFT\nconst MAC_WK_CMD_LEFT = 91;\nconst MAC_WK_CMD_RIGHT = 93;\nconst CONTEXT_MENU = 93;\nconst NUMPAD_ZERO = 96;\nconst NUMPAD_ONE = 97;\nconst NUMPAD_TWO = 98;\nconst NUMPAD_THREE = 99;\nconst NUMPAD_FOUR = 100;\nconst NUMPAD_FIVE = 101;\nconst NUMPAD_SIX = 102;\nconst NUMPAD_SEVEN = 103;\nconst NUMPAD_EIGHT = 104;\nconst NUMPAD_NINE = 105;\nconst NUMPAD_MULTIPLY = 106;\nconst NUMPAD_PLUS = 107;\nconst NUMPAD_MINUS = 109;\nconst NUMPAD_PERIOD = 110;\nconst NUMPAD_DIVIDE = 111;\nconst F1 = 112;\nconst F2 = 113;\nconst F3 = 114;\nconst F4 = 115;\nconst F5 = 116;\nconst F6 = 117;\nconst F7 = 118;\nconst F8 = 119;\nconst F9 = 120;\nconst F10 = 121;\nconst F11 = 122;\nconst F12 = 123;\nconst NUM_LOCK = 144;\nconst SCROLL_LOCK = 145;\nconst FIRST_MEDIA = 166;\nconst FF_MINUS = 173;\nconst MUTE = 173; // Firefox (Gecko) fires 181 for MUTE\nconst VOLUME_DOWN = 174; // Firefox (Gecko) fires 182 for VOLUME_DOWN\nconst VOLUME_UP = 175; // Firefox (Gecko) fires 183 for VOLUME_UP\nconst FF_MUTE = 181;\nconst FF_VOLUME_DOWN = 182;\nconst LAST_MEDIA = 183;\nconst FF_VOLUME_UP = 183;\nconst SEMICOLON = 186; // Firefox (Gecko) fires 59 for SEMICOLON\nconst EQUALS = 187; // Firefox (Gecko) fires 61 for EQUALS\nconst COMMA = 188;\nconst DASH = 189; // Firefox (Gecko) fires 173 for DASH/MINUS\nconst PERIOD = 190;\nconst SLASH = 191;\nconst APOSTROPHE = 192;\nconst TILDE = 192;\nconst OPEN_SQUARE_BRACKET = 219;\nconst BACKSLASH = 220;\nconst CLOSE_SQUARE_BRACKET = 221;\nconst SINGLE_QUOTE = 222;\nconst MAC_META = 224;\n\n/**\n * Checks whether a modifier key is pressed.\n * @param event Event to be checked.\n */\nfunction hasModifierKey(event, ...modifiers) {\n if (modifiers.length) {\n return modifiers.some(modifier => event[modifier]);\n }\n return event.altKey || event.shiftKey || event.ctrlKey || event.metaKey;\n}\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { A, ALT, APOSTROPHE, AT_SIGN, B, BACKSLASH, BACKSPACE, C, CAPS_LOCK, CLOSE_SQUARE_BRACKET, COMMA, CONTEXT_MENU, CONTROL, D, DASH, DELETE, DOWN_ARROW, E, EIGHT, END, ENTER, EQUALS, ESCAPE, F, F1, F10, F11, F12, F2, F3, F4, F5, F6, F7, F8, F9, FF_EQUALS, FF_MINUS, FF_MUTE, FF_SEMICOLON, FF_VOLUME_DOWN, FF_VOLUME_UP, FIRST_MEDIA, FIVE, FOUR, G, H, HOME, I, INSERT, J, K, L, LAST_MEDIA, LEFT_ARROW, M, MAC_ENTER, MAC_META, MAC_WK_CMD_LEFT, MAC_WK_CMD_RIGHT, META, MUTE, N, NINE, NUMPAD_DIVIDE, NUMPAD_EIGHT, NUMPAD_FIVE, NUMPAD_FOUR, NUMPAD_MINUS, NUMPAD_MULTIPLY, NUMPAD_NINE, NUMPAD_ONE, NUMPAD_PERIOD, NUMPAD_PLUS, NUMPAD_SEVEN, NUMPAD_SIX, NUMPAD_THREE, NUMPAD_TWO, NUMPAD_ZERO, NUM_CENTER, NUM_LOCK, O, ONE, OPEN_SQUARE_BRACKET, P, PAGE_DOWN, PAGE_UP, PAUSE, PERIOD, PLUS_SIGN, PRINT_SCREEN, Q, QUESTION_MARK, R, RIGHT_ARROW, S, SCROLL_LOCK, SEMICOLON, SEVEN, SHIFT, SINGLE_QUOTE, SIX, SLASH, SPACE, T, TAB, THREE, TILDE, TWO, U, UP_ARROW, V, VOLUME_DOWN, VOLUME_UP, W, X, Y, Z, ZERO, hasModifierKey };\n","import * as i0 from '@angular/core';\nimport { PLATFORM_ID, Injectable, Inject, NgModule } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\n\n// Whether the current platform supports the V8 Break Iterator. The V8 check\n// is necessary to detect all Blink based browsers.\nlet hasV8BreakIterator;\n// We need a try/catch around the reference to `Intl`, because accessing it in some cases can\n// cause IE to throw. These cases are tied to particular versions of Windows and can happen if\n// the consumer is providing a polyfilled `Map`. See:\n// https://github.com/Microsoft/ChakraCore/issues/3189\n// https://github.com/angular/components/issues/15687\ntry {\n hasV8BreakIterator = typeof Intl !== 'undefined' && Intl.v8BreakIterator;\n}\ncatch {\n hasV8BreakIterator = false;\n}\n/**\n * Service to detect the current platform by comparing the userAgent strings and\n * checking browser-specific global properties.\n */\nclass Platform {\n constructor(_platformId) {\n this._platformId = _platformId;\n // We want to use the Angular platform check because if the Document is shimmed\n // without the navigator, the following checks will fail. This is preferred because\n // sometimes the Document may be shimmed without the user's knowledge or intention\n /** Whether the Angular application is being rendered in the browser. */\n this.isBrowser = this._platformId\n ? isPlatformBrowser(this._platformId)\n : typeof document === 'object' && !!document;\n /** Whether the current browser is Microsoft Edge. */\n this.EDGE = this.isBrowser && /(edge)/i.test(navigator.userAgent);\n /** Whether the current rendering engine is Microsoft Trident. */\n this.TRIDENT = this.isBrowser && /(msie|trident)/i.test(navigator.userAgent);\n // EdgeHTML and Trident mock Blink specific things and need to be excluded from this check.\n /** Whether the current rendering engine is Blink. */\n this.BLINK = this.isBrowser &&\n !!(window.chrome || hasV8BreakIterator) &&\n typeof CSS !== 'undefined' &&\n !this.EDGE &&\n !this.TRIDENT;\n // Webkit is part of the userAgent in EdgeHTML, Blink and Trident. Therefore we need to\n // ensure that Webkit runs standalone and is not used as another engine's base.\n /** Whether the current rendering engine is WebKit. */\n this.WEBKIT = this.isBrowser &&\n /AppleWebKit/i.test(navigator.userAgent) &&\n !this.BLINK &&\n !this.EDGE &&\n !this.TRIDENT;\n /** Whether the current platform is Apple iOS. */\n this.IOS = this.isBrowser && /iPad|iPhone|iPod/.test(navigator.userAgent) && !('MSStream' in window);\n // It's difficult to detect the plain Gecko engine, because most of the browsers identify\n // them self as Gecko-like browsers and modify the userAgent's according to that.\n // Since we only cover one explicit Firefox case, we can simply check for Firefox\n // instead of having an unstable check for Gecko.\n /** Whether the current browser is Firefox. */\n this.FIREFOX = this.isBrowser && /(firefox|minefield)/i.test(navigator.userAgent);\n /** Whether the current platform is Android. */\n // Trident on mobile adds the android platform to the userAgent to trick detections.\n this.ANDROID = this.isBrowser && /android/i.test(navigator.userAgent) && !this.TRIDENT;\n // Safari browsers will include the Safari keyword in their userAgent. Some browsers may fake\n // this and just place the Safari keyword in the userAgent. To be more safe about Safari every\n // Safari browser should also use Webkit as its layout engine.\n /** Whether the current browser is Safari. */\n this.SAFARI = this.isBrowser && /safari/i.test(navigator.userAgent) && this.WEBKIT;\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: Platform, deps: [{ token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: Platform, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: Platform, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }], ctorParameters: () => [{ type: Object, decorators: [{\n type: Inject,\n args: [PLATFORM_ID]\n }] }] });\n\nclass PlatformModule {\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: PlatformModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }\n static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"14.0.0\", version: \"18.0.0\", ngImport: i0, type: PlatformModule }); }\n static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: PlatformModule }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: PlatformModule, decorators: [{\n type: NgModule,\n args: [{}]\n }] });\n\n/** Cached result Set of input types support by the current browser. */\nlet supportedInputTypes;\n/** Types of `` that *might* be supported. */\nconst candidateInputTypes = [\n // `color` must come first. Chrome 56 shows a warning if we change the type to `color` after\n // first changing it to something else:\n // The specified value \"\" does not conform to the required format.\n // The format is \"#rrggbb\" where rr, gg, bb are two-digit hexadecimal numbers.\n 'color',\n 'button',\n 'checkbox',\n 'date',\n 'datetime-local',\n 'email',\n 'file',\n 'hidden',\n 'image',\n 'month',\n 'number',\n 'password',\n 'radio',\n 'range',\n 'reset',\n 'search',\n 'submit',\n 'tel',\n 'text',\n 'time',\n 'url',\n 'week',\n];\n/** @returns The input types supported by this browser. */\nfunction getSupportedInputTypes() {\n // Result is cached.\n if (supportedInputTypes) {\n return supportedInputTypes;\n }\n // We can't check if an input type is not supported until we're on the browser, so say that\n // everything is supported when not on the browser. We don't use `Platform` here since it's\n // just a helper function and can't inject it.\n if (typeof document !== 'object' || !document) {\n supportedInputTypes = new Set(candidateInputTypes);\n return supportedInputTypes;\n }\n let featureTestInput = document.createElement('input');\n supportedInputTypes = new Set(candidateInputTypes.filter(value => {\n featureTestInput.setAttribute('type', value);\n return featureTestInput.type === value;\n }));\n return supportedInputTypes;\n}\n\n/** Cached result of whether the user's browser supports passive event listeners. */\nlet supportsPassiveEvents;\n/**\n * Checks whether the user's browser supports passive event listeners.\n * See: https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md\n */\nfunction supportsPassiveEventListeners() {\n if (supportsPassiveEvents == null && typeof window !== 'undefined') {\n try {\n window.addEventListener('test', null, Object.defineProperty({}, 'passive', {\n get: () => (supportsPassiveEvents = true),\n }));\n }\n finally {\n supportsPassiveEvents = supportsPassiveEvents || false;\n }\n }\n return supportsPassiveEvents;\n}\n/**\n * Normalizes an `AddEventListener` object to something that can be passed\n * to `addEventListener` on any browser, no matter whether it supports the\n * `options` parameter.\n * @param options Object to be normalized.\n */\nfunction normalizePassiveListenerOptions(options) {\n return supportsPassiveEventListeners() ? options : !!options.capture;\n}\n\n/** The possible ways the browser may handle the horizontal scroll axis in RTL languages. */\nvar RtlScrollAxisType;\n(function (RtlScrollAxisType) {\n /**\n * scrollLeft is 0 when scrolled all the way left and (scrollWidth - clientWidth) when scrolled\n * all the way right.\n */\n RtlScrollAxisType[RtlScrollAxisType[\"NORMAL\"] = 0] = \"NORMAL\";\n /**\n * scrollLeft is -(scrollWidth - clientWidth) when scrolled all the way left and 0 when scrolled\n * all the way right.\n */\n RtlScrollAxisType[RtlScrollAxisType[\"NEGATED\"] = 1] = \"NEGATED\";\n /**\n * scrollLeft is (scrollWidth - clientWidth) when scrolled all the way left and 0 when scrolled\n * all the way right.\n */\n RtlScrollAxisType[RtlScrollAxisType[\"INVERTED\"] = 2] = \"INVERTED\";\n})(RtlScrollAxisType || (RtlScrollAxisType = {}));\n/** Cached result of the way the browser handles the horizontal scroll axis in RTL mode. */\nlet rtlScrollAxisType;\n/** Cached result of the check that indicates whether the browser supports scroll behaviors. */\nlet scrollBehaviorSupported;\n/** Check whether the browser supports scroll behaviors. */\nfunction supportsScrollBehavior() {\n if (scrollBehaviorSupported == null) {\n // If we're not in the browser, it can't be supported. Also check for `Element`, because\n // some projects stub out the global `document` during SSR which can throw us off.\n if (typeof document !== 'object' || !document || typeof Element !== 'function' || !Element) {\n scrollBehaviorSupported = false;\n return scrollBehaviorSupported;\n }\n // If the element can have a `scrollBehavior` style, we can be sure that it's supported.\n if ('scrollBehavior' in document.documentElement.style) {\n scrollBehaviorSupported = true;\n }\n else {\n // At this point we have 3 possibilities: `scrollTo` isn't supported at all, it's\n // supported but it doesn't handle scroll behavior, or it has been polyfilled.\n const scrollToFunction = Element.prototype.scrollTo;\n if (scrollToFunction) {\n // We can detect if the function has been polyfilled by calling `toString` on it. Native\n // functions are obfuscated using `[native code]`, whereas if it was overwritten we'd get\n // the actual function source. Via https://davidwalsh.name/detect-native-function. Consider\n // polyfilled functions as supporting scroll behavior.\n scrollBehaviorSupported = !/\\{\\s*\\[native code\\]\\s*\\}/.test(scrollToFunction.toString());\n }\n else {\n scrollBehaviorSupported = false;\n }\n }\n }\n return scrollBehaviorSupported;\n}\n/**\n * Checks the type of RTL scroll axis used by this browser. As of time of writing, Chrome is NORMAL,\n * Firefox & Safari are NEGATED, and IE & Edge are INVERTED.\n */\nfunction getRtlScrollAxisType() {\n // We can't check unless we're on the browser. Just assume 'normal' if we're not.\n if (typeof document !== 'object' || !document) {\n return RtlScrollAxisType.NORMAL;\n }\n if (rtlScrollAxisType == null) {\n // Create a 1px wide scrolling container and a 2px wide content element.\n const scrollContainer = document.createElement('div');\n const containerStyle = scrollContainer.style;\n scrollContainer.dir = 'rtl';\n containerStyle.width = '1px';\n containerStyle.overflow = 'auto';\n containerStyle.visibility = 'hidden';\n containerStyle.pointerEvents = 'none';\n containerStyle.position = 'absolute';\n const content = document.createElement('div');\n const contentStyle = content.style;\n contentStyle.width = '2px';\n contentStyle.height = '1px';\n scrollContainer.appendChild(content);\n document.body.appendChild(scrollContainer);\n rtlScrollAxisType = RtlScrollAxisType.NORMAL;\n // The viewport starts scrolled all the way to the right in RTL mode. If we are in a NORMAL\n // browser this would mean that the scrollLeft should be 1. If it's zero instead we know we're\n // dealing with one of the other two types of browsers.\n if (scrollContainer.scrollLeft === 0) {\n // In a NEGATED browser the scrollLeft is always somewhere in [-maxScrollAmount, 0]. For an\n // INVERTED browser it is always somewhere in [0, maxScrollAmount]. We can determine which by\n // setting to the scrollLeft to 1. This is past the max for a NEGATED browser, so it will\n // return 0 when we read it again.\n scrollContainer.scrollLeft = 1;\n rtlScrollAxisType =\n scrollContainer.scrollLeft === 0 ? RtlScrollAxisType.NEGATED : RtlScrollAxisType.INVERTED;\n }\n scrollContainer.remove();\n }\n return rtlScrollAxisType;\n}\n\nlet shadowDomIsSupported;\n/** Checks whether the user's browser support Shadow DOM. */\nfunction _supportsShadowDom() {\n if (shadowDomIsSupported == null) {\n const head = typeof document !== 'undefined' ? document.head : null;\n shadowDomIsSupported = !!(head && (head.createShadowRoot || head.attachShadow));\n }\n return shadowDomIsSupported;\n}\n/** Gets the shadow root of an element, if supported and the element is inside the Shadow DOM. */\nfunction _getShadowRoot(element) {\n if (_supportsShadowDom()) {\n const rootNode = element.getRootNode ? element.getRootNode() : null;\n // Note that this should be caught by `_supportsShadowDom`, but some\n // teams have been able to hit this code path on unsupported browsers.\n if (typeof ShadowRoot !== 'undefined' && ShadowRoot && rootNode instanceof ShadowRoot) {\n return rootNode;\n }\n }\n return null;\n}\n/**\n * Gets the currently-focused element on the page while\n * also piercing through Shadow DOM boundaries.\n */\nfunction _getFocusedElementPierceShadowDom() {\n let activeElement = typeof document !== 'undefined' && document\n ? document.activeElement\n : null;\n while (activeElement && activeElement.shadowRoot) {\n const newActiveElement = activeElement.shadowRoot.activeElement;\n if (newActiveElement === activeElement) {\n break;\n }\n else {\n activeElement = newActiveElement;\n }\n }\n return activeElement;\n}\n/** Gets the target of an event while accounting for Shadow DOM. */\nfunction _getEventTarget(event) {\n // If an event is bound outside the Shadow DOM, the `event.target` will\n // point to the shadow root so we have to use `composedPath` instead.\n return (event.composedPath ? event.composedPath()[0] : event.target);\n}\n\n/** Gets whether the code is currently running in a test environment. */\nfunction _isTestEnvironment() {\n // We can't use `declare const` because it causes conflicts inside Google with the real typings\n // for these symbols and we can't read them off the global object, because they don't appear to\n // be attached there for some runners like Jest.\n // (see: https://github.com/angular/components/issues/23365#issuecomment-938146643)\n return (\n // @ts-ignore\n (typeof __karma__ !== 'undefined' && !!__karma__) ||\n // @ts-ignore\n (typeof jasmine !== 'undefined' && !!jasmine) ||\n // @ts-ignore\n (typeof jest !== 'undefined' && !!jest) ||\n // @ts-ignore\n (typeof Mocha !== 'undefined' && !!Mocha));\n}\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { Platform, PlatformModule, RtlScrollAxisType, _getEventTarget, _getFocusedElementPierceShadowDom, _getShadowRoot, _isTestEnvironment, _supportsShadowDom, getRtlScrollAxisType, getSupportedInputTypes, normalizePassiveListenerOptions, supportsPassiveEventListeners, supportsScrollBehavior };\n","import * as i0 from '@angular/core';\nimport { ElementRef, Injector, Directive, EventEmitter, Inject, Input, Output, NgModule } from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\n\n/**\n * Throws an exception when attempting to attach a null portal to a host.\n * @docs-private\n */\nfunction throwNullPortalError() {\n throw Error('Must provide a portal to attach');\n}\n/**\n * Throws an exception when attempting to attach a portal to a host that is already attached.\n * @docs-private\n */\nfunction throwPortalAlreadyAttachedError() {\n throw Error('Host already has a portal attached');\n}\n/**\n * Throws an exception when attempting to attach a portal to an already-disposed host.\n * @docs-private\n */\nfunction throwPortalOutletAlreadyDisposedError() {\n throw Error('This PortalOutlet has already been disposed');\n}\n/**\n * Throws an exception when attempting to attach an unknown portal type.\n * @docs-private\n */\nfunction throwUnknownPortalTypeError() {\n throw Error('Attempting to attach an unknown Portal type. BasePortalOutlet accepts either ' +\n 'a ComponentPortal or a TemplatePortal.');\n}\n/**\n * Throws an exception when attempting to attach a portal to a null host.\n * @docs-private\n */\nfunction throwNullPortalOutletError() {\n throw Error('Attempting to attach a portal to a null PortalOutlet');\n}\n/**\n * Throws an exception when attempting to detach a portal that is not attached.\n * @docs-private\n */\nfunction throwNoPortalAttachedError() {\n throw Error('Attempting to detach a portal that is not attached to a host');\n}\n\n/**\n * A `Portal` is something that you want to render somewhere else.\n * It can be attach to / detached from a `PortalOutlet`.\n */\nclass Portal {\n /** Attach this portal to a host. */\n attach(host) {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (host == null) {\n throwNullPortalOutletError();\n }\n if (host.hasAttached()) {\n throwPortalAlreadyAttachedError();\n }\n }\n this._attachedHost = host;\n return host.attach(this);\n }\n /** Detach this portal from its host */\n detach() {\n let host = this._attachedHost;\n if (host != null) {\n this._attachedHost = null;\n host.detach();\n }\n else if (typeof ngDevMode === 'undefined' || ngDevMode) {\n throwNoPortalAttachedError();\n }\n }\n /** Whether this portal is attached to a host. */\n get isAttached() {\n return this._attachedHost != null;\n }\n /**\n * Sets the PortalOutlet reference without performing `attach()`. This is used directly by\n * the PortalOutlet when it is performing an `attach()` or `detach()`.\n */\n setAttachedHost(host) {\n this._attachedHost = host;\n }\n}\n/**\n * A `ComponentPortal` is a portal that instantiates some Component upon attachment.\n */\nclass ComponentPortal extends Portal {\n constructor(component, viewContainerRef, injector, componentFactoryResolver, projectableNodes) {\n super();\n this.component = component;\n this.viewContainerRef = viewContainerRef;\n this.injector = injector;\n this.componentFactoryResolver = componentFactoryResolver;\n this.projectableNodes = projectableNodes;\n }\n}\n/**\n * A `TemplatePortal` is a portal that represents some embedded template (TemplateRef).\n */\nclass TemplatePortal extends Portal {\n constructor(\n /** The embedded template that will be used to instantiate an embedded View in the host. */\n templateRef, \n /** Reference to the ViewContainer into which the template will be stamped out. */\n viewContainerRef, \n /** Contextual data to be passed in to the embedded view. */\n context, \n /** The injector to use for the embedded view. */\n injector) {\n super();\n this.templateRef = templateRef;\n this.viewContainerRef = viewContainerRef;\n this.context = context;\n this.injector = injector;\n }\n get origin() {\n return this.templateRef.elementRef;\n }\n /**\n * Attach the portal to the provided `PortalOutlet`.\n * When a context is provided it will override the `context` property of the `TemplatePortal`\n * instance.\n */\n attach(host, context = this.context) {\n this.context = context;\n return super.attach(host);\n }\n detach() {\n this.context = undefined;\n return super.detach();\n }\n}\n/**\n * A `DomPortal` is a portal whose DOM element will be taken from its current position\n * in the DOM and moved into a portal outlet, when it is attached. On detach, the content\n * will be restored to its original position.\n */\nclass DomPortal extends Portal {\n constructor(element) {\n super();\n this.element = element instanceof ElementRef ? element.nativeElement : element;\n }\n}\n/**\n * Partial implementation of PortalOutlet that handles attaching\n * ComponentPortal and TemplatePortal.\n */\nclass BasePortalOutlet {\n constructor() {\n /** Whether this host has already been permanently disposed. */\n this._isDisposed = false;\n // @breaking-change 10.0.0 `attachDomPortal` to become a required abstract method.\n this.attachDomPortal = null;\n }\n /** Whether this host has an attached portal. */\n hasAttached() {\n return !!this._attachedPortal;\n }\n /** Attaches a portal. */\n attach(portal) {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (!portal) {\n throwNullPortalError();\n }\n if (this.hasAttached()) {\n throwPortalAlreadyAttachedError();\n }\n if (this._isDisposed) {\n throwPortalOutletAlreadyDisposedError();\n }\n }\n if (portal instanceof ComponentPortal) {\n this._attachedPortal = portal;\n return this.attachComponentPortal(portal);\n }\n else if (portal instanceof TemplatePortal) {\n this._attachedPortal = portal;\n return this.attachTemplatePortal(portal);\n // @breaking-change 10.0.0 remove null check for `this.attachDomPortal`.\n }\n else if (this.attachDomPortal && portal instanceof DomPortal) {\n this._attachedPortal = portal;\n return this.attachDomPortal(portal);\n }\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n throwUnknownPortalTypeError();\n }\n }\n /** Detaches a previously attached portal. */\n detach() {\n if (this._attachedPortal) {\n this._attachedPortal.setAttachedHost(null);\n this._attachedPortal = null;\n }\n this._invokeDisposeFn();\n }\n /** Permanently dispose of this portal host. */\n dispose() {\n if (this.hasAttached()) {\n this.detach();\n }\n this._invokeDisposeFn();\n this._isDisposed = true;\n }\n /** @docs-private */\n setDisposeFn(fn) {\n this._disposeFn = fn;\n }\n _invokeDisposeFn() {\n if (this._disposeFn) {\n this._disposeFn();\n this._disposeFn = null;\n }\n }\n}\n/**\n * @deprecated Use `BasePortalOutlet` instead.\n * @breaking-change 9.0.0\n */\nclass BasePortalHost extends BasePortalOutlet {\n}\n\n/**\n * A PortalOutlet for attaching portals to an arbitrary DOM element outside of the Angular\n * application context.\n */\nclass DomPortalOutlet extends BasePortalOutlet {\n /**\n * @param outletElement Element into which the content is projected.\n * @param _componentFactoryResolver Used to resolve the component factory.\n * Only required when attaching component portals.\n * @param _appRef Reference to the application. Only used in component portals when there\n * is no `ViewContainerRef` available.\n * @param _defaultInjector Injector to use as a fallback when the portal being attached doesn't\n * have one. Only used for component portals.\n * @param _document Reference to the document. Used when attaching a DOM portal. Will eventually\n * become a required parameter.\n */\n constructor(\n /** Element into which the content is projected. */\n outletElement, _componentFactoryResolver, _appRef, _defaultInjector, \n /**\n * @deprecated `_document` Parameter to be made required.\n * @breaking-change 10.0.0\n */\n _document) {\n super();\n this.outletElement = outletElement;\n this._componentFactoryResolver = _componentFactoryResolver;\n this._appRef = _appRef;\n this._defaultInjector = _defaultInjector;\n /**\n * Attaches a DOM portal by transferring its content into the outlet.\n * @param portal Portal to be attached.\n * @deprecated To be turned into a method.\n * @breaking-change 10.0.0\n */\n this.attachDomPortal = (portal) => {\n // @breaking-change 10.0.0 Remove check and error once the\n // `_document` constructor parameter is required.\n if (!this._document && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error('Cannot attach DOM portal without _document constructor parameter');\n }\n const element = portal.element;\n if (!element.parentNode && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error('DOM portal content must be attached to a parent node.');\n }\n // Anchor used to save the element's previous position so\n // that we can restore it when the portal is detached.\n const anchorNode = this._document.createComment('dom-portal');\n element.parentNode.insertBefore(anchorNode, element);\n this.outletElement.appendChild(element);\n this._attachedPortal = portal;\n super.setDisposeFn(() => {\n // We can't use `replaceWith` here because IE doesn't support it.\n if (anchorNode.parentNode) {\n anchorNode.parentNode.replaceChild(element, anchorNode);\n }\n });\n };\n this._document = _document;\n }\n /**\n * Attach the given ComponentPortal to DOM element using the ComponentFactoryResolver.\n * @param portal Portal to be attached\n * @returns Reference to the created component.\n */\n attachComponentPortal(portal) {\n const resolver = (portal.componentFactoryResolver || this._componentFactoryResolver);\n if ((typeof ngDevMode === 'undefined' || ngDevMode) && !resolver) {\n throw Error('Cannot attach component portal to outlet without a ComponentFactoryResolver.');\n }\n const componentFactory = resolver.resolveComponentFactory(portal.component);\n let componentRef;\n // If the portal specifies a ViewContainerRef, we will use that as the attachment point\n // for the component (in terms of Angular's component tree, not rendering).\n // When the ViewContainerRef is missing, we use the factory to create the component directly\n // and then manually attach the view to the application.\n if (portal.viewContainerRef) {\n componentRef = portal.viewContainerRef.createComponent(componentFactory, portal.viewContainerRef.length, portal.injector || portal.viewContainerRef.injector, portal.projectableNodes || undefined);\n this.setDisposeFn(() => componentRef.destroy());\n }\n else {\n if ((typeof ngDevMode === 'undefined' || ngDevMode) && !this._appRef) {\n throw Error('Cannot attach component portal to outlet without an ApplicationRef.');\n }\n componentRef = componentFactory.create(portal.injector || this._defaultInjector || Injector.NULL);\n this._appRef.attachView(componentRef.hostView);\n this.setDisposeFn(() => {\n // Verify that the ApplicationRef has registered views before trying to detach a host view.\n // This check also protects the `detachView` from being called on a destroyed ApplicationRef.\n if (this._appRef.viewCount > 0) {\n this._appRef.detachView(componentRef.hostView);\n }\n componentRef.destroy();\n });\n }\n // At this point the component has been instantiated, so we move it to the location in the DOM\n // where we want it to be rendered.\n this.outletElement.appendChild(this._getComponentRootNode(componentRef));\n this._attachedPortal = portal;\n return componentRef;\n }\n /**\n * Attaches a template portal to the DOM as an embedded view.\n * @param portal Portal to be attached.\n * @returns Reference to the created embedded view.\n */\n attachTemplatePortal(portal) {\n let viewContainer = portal.viewContainerRef;\n let viewRef = viewContainer.createEmbeddedView(portal.templateRef, portal.context, {\n injector: portal.injector,\n });\n // The method `createEmbeddedView` will add the view as a child of the viewContainer.\n // But for the DomPortalOutlet the view can be added everywhere in the DOM\n // (e.g Overlay Container) To move the view to the specified host element. We just\n // re-append the existing root nodes.\n viewRef.rootNodes.forEach(rootNode => this.outletElement.appendChild(rootNode));\n // Note that we want to detect changes after the nodes have been moved so that\n // any directives inside the portal that are looking at the DOM inside a lifecycle\n // hook won't be invoked too early.\n viewRef.detectChanges();\n this.setDisposeFn(() => {\n let index = viewContainer.indexOf(viewRef);\n if (index !== -1) {\n viewContainer.remove(index);\n }\n });\n this._attachedPortal = portal;\n // TODO(jelbourn): Return locals from view.\n return viewRef;\n }\n /**\n * Clears out a portal from the DOM.\n */\n dispose() {\n super.dispose();\n this.outletElement.remove();\n }\n /** Gets the root HTMLElement for an instantiated component. */\n _getComponentRootNode(componentRef) {\n return componentRef.hostView.rootNodes[0];\n }\n}\n/**\n * @deprecated Use `DomPortalOutlet` instead.\n * @breaking-change 9.0.0\n */\nclass DomPortalHost extends DomPortalOutlet {\n}\n\n/**\n * Directive version of a `TemplatePortal`. Because the directive *is* a TemplatePortal,\n * the directive instance itself can be attached to a host, enabling declarative use of portals.\n */\nclass CdkPortal extends TemplatePortal {\n constructor(templateRef, viewContainerRef) {\n super(templateRef, viewContainerRef);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkPortal, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.0\", type: CdkPortal, isStandalone: true, selector: \"[cdkPortal]\", exportAs: [\"cdkPortal\"], usesInheritance: true, ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkPortal, decorators: [{\n type: Directive,\n args: [{\n selector: '[cdkPortal]',\n exportAs: 'cdkPortal',\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }] });\n/**\n * @deprecated Use `CdkPortal` instead.\n * @breaking-change 9.0.0\n */\nclass TemplatePortalDirective extends CdkPortal {\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: TemplatePortalDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.0\", type: TemplatePortalDirective, isStandalone: true, selector: \"[cdk-portal], [portal]\", providers: [\n {\n provide: CdkPortal,\n useExisting: TemplatePortalDirective,\n },\n ], exportAs: [\"cdkPortal\"], usesInheritance: true, ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: TemplatePortalDirective, decorators: [{\n type: Directive,\n args: [{\n selector: '[cdk-portal], [portal]',\n exportAs: 'cdkPortal',\n providers: [\n {\n provide: CdkPortal,\n useExisting: TemplatePortalDirective,\n },\n ],\n standalone: true,\n }]\n }] });\n/**\n * Directive version of a PortalOutlet. Because the directive *is* a PortalOutlet, portals can be\n * directly attached to it, enabling declarative use.\n *\n * Usage:\n * ``\n */\nclass CdkPortalOutlet extends BasePortalOutlet {\n constructor(_componentFactoryResolver, _viewContainerRef, \n /**\n * @deprecated `_document` parameter to be made required.\n * @breaking-change 9.0.0\n */\n _document) {\n super();\n this._componentFactoryResolver = _componentFactoryResolver;\n this._viewContainerRef = _viewContainerRef;\n /** Whether the portal component is initialized. */\n this._isInitialized = false;\n /** Emits when a portal is attached to the outlet. */\n this.attached = new EventEmitter();\n /**\n * Attaches the given DomPortal to this PortalHost by moving all of the portal content into it.\n * @param portal Portal to be attached.\n * @deprecated To be turned into a method.\n * @breaking-change 10.0.0\n */\n this.attachDomPortal = (portal) => {\n // @breaking-change 9.0.0 Remove check and error once the\n // `_document` constructor parameter is required.\n if (!this._document && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error('Cannot attach DOM portal without _document constructor parameter');\n }\n const element = portal.element;\n if (!element.parentNode && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error('DOM portal content must be attached to a parent node.');\n }\n // Anchor used to save the element's previous position so\n // that we can restore it when the portal is detached.\n const anchorNode = this._document.createComment('dom-portal');\n portal.setAttachedHost(this);\n element.parentNode.insertBefore(anchorNode, element);\n this._getRootNode().appendChild(element);\n this._attachedPortal = portal;\n super.setDisposeFn(() => {\n if (anchorNode.parentNode) {\n anchorNode.parentNode.replaceChild(element, anchorNode);\n }\n });\n };\n this._document = _document;\n }\n /** Portal associated with the Portal outlet. */\n get portal() {\n return this._attachedPortal;\n }\n set portal(portal) {\n // Ignore the cases where the `portal` is set to a falsy value before the lifecycle hooks have\n // run. This handles the cases where the user might do something like `
`\n // and attach a portal programmatically in the parent component. When Angular does the first CD\n // round, it will fire the setter with empty string, causing the user's content to be cleared.\n if (this.hasAttached() && !portal && !this._isInitialized) {\n return;\n }\n if (this.hasAttached()) {\n super.detach();\n }\n if (portal) {\n super.attach(portal);\n }\n this._attachedPortal = portal || null;\n }\n /** Component or view reference that is attached to the portal. */\n get attachedRef() {\n return this._attachedRef;\n }\n ngOnInit() {\n this._isInitialized = true;\n }\n ngOnDestroy() {\n super.dispose();\n this._attachedRef = this._attachedPortal = null;\n }\n /**\n * Attach the given ComponentPortal to this PortalOutlet using the ComponentFactoryResolver.\n *\n * @param portal Portal to be attached to the portal outlet.\n * @returns Reference to the created component.\n */\n attachComponentPortal(portal) {\n portal.setAttachedHost(this);\n // If the portal specifies an origin, use that as the logical location of the component\n // in the application tree. Otherwise use the location of this PortalOutlet.\n const viewContainerRef = portal.viewContainerRef != null ? portal.viewContainerRef : this._viewContainerRef;\n const resolver = portal.componentFactoryResolver || this._componentFactoryResolver;\n const componentFactory = resolver.resolveComponentFactory(portal.component);\n const ref = viewContainerRef.createComponent(componentFactory, viewContainerRef.length, portal.injector || viewContainerRef.injector, portal.projectableNodes || undefined);\n // If we're using a view container that's different from the injected one (e.g. when the portal\n // specifies its own) we need to move the component into the outlet, otherwise it'll be rendered\n // inside of the alternate view container.\n if (viewContainerRef !== this._viewContainerRef) {\n this._getRootNode().appendChild(ref.hostView.rootNodes[0]);\n }\n super.setDisposeFn(() => ref.destroy());\n this._attachedPortal = portal;\n this._attachedRef = ref;\n this.attached.emit(ref);\n return ref;\n }\n /**\n * Attach the given TemplatePortal to this PortalHost as an embedded View.\n * @param portal Portal to be attached.\n * @returns Reference to the created embedded view.\n */\n attachTemplatePortal(portal) {\n portal.setAttachedHost(this);\n const viewRef = this._viewContainerRef.createEmbeddedView(portal.templateRef, portal.context, {\n injector: portal.injector,\n });\n super.setDisposeFn(() => this._viewContainerRef.clear());\n this._attachedPortal = portal;\n this._attachedRef = viewRef;\n this.attached.emit(viewRef);\n return viewRef;\n }\n /** Gets the root node of the portal outlet. */\n _getRootNode() {\n const nativeElement = this._viewContainerRef.element.nativeElement;\n // The directive could be set on a template which will result in a comment\n // node being the root. Use the comment's parent node if that is the case.\n return (nativeElement.nodeType === nativeElement.ELEMENT_NODE\n ? nativeElement\n : nativeElement.parentNode);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkPortalOutlet, deps: [{ token: i0.ComponentFactoryResolver }, { token: i0.ViewContainerRef }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.0\", type: CdkPortalOutlet, isStandalone: true, selector: \"[cdkPortalOutlet]\", inputs: { portal: [\"cdkPortalOutlet\", \"portal\"] }, outputs: { attached: \"attached\" }, exportAs: [\"cdkPortalOutlet\"], usesInheritance: true, ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: CdkPortalOutlet, decorators: [{\n type: Directive,\n args: [{\n selector: '[cdkPortalOutlet]',\n exportAs: 'cdkPortalOutlet',\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: i0.ComponentFactoryResolver }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{\n type: Inject,\n args: [DOCUMENT]\n }] }], propDecorators: { portal: [{\n type: Input,\n args: ['cdkPortalOutlet']\n }], attached: [{\n type: Output\n }] } });\n/**\n * @deprecated Use `CdkPortalOutlet` instead.\n * @breaking-change 9.0.0\n */\nclass PortalHostDirective extends CdkPortalOutlet {\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: PortalHostDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.0\", type: PortalHostDirective, isStandalone: true, selector: \"[cdkPortalHost], [portalHost]\", inputs: { portal: [\"cdkPortalHost\", \"portal\"] }, providers: [\n {\n provide: CdkPortalOutlet,\n useExisting: PortalHostDirective,\n },\n ], exportAs: [\"cdkPortalHost\"], usesInheritance: true, ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: PortalHostDirective, decorators: [{\n type: Directive,\n args: [{\n selector: '[cdkPortalHost], [portalHost]',\n exportAs: 'cdkPortalHost',\n inputs: [{ name: 'portal', alias: 'cdkPortalHost' }],\n providers: [\n {\n provide: CdkPortalOutlet,\n useExisting: PortalHostDirective,\n },\n ],\n standalone: true,\n }]\n }] });\nclass PortalModule {\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: PortalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }\n static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"14.0.0\", version: \"18.0.0\", ngImport: i0, type: PortalModule, imports: [CdkPortal, CdkPortalOutlet, TemplatePortalDirective, PortalHostDirective], exports: [CdkPortal, CdkPortalOutlet, TemplatePortalDirective, PortalHostDirective] }); }\n static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: PortalModule }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.0\", ngImport: i0, type: PortalModule, decorators: [{\n type: NgModule,\n args: [{\n imports: [CdkPortal, CdkPortalOutlet, TemplatePortalDirective, PortalHostDirective],\n exports: [CdkPortal, CdkPortalOutlet, TemplatePortalDirective, PortalHostDirective],\n }]\n }] });\n\n/**\n * Custom injector to be used when providing custom\n * injection tokens to components inside a portal.\n * @docs-private\n * @deprecated Use `Injector.create` instead.\n * @breaking-change 11.0.0\n */\nclass PortalInjector {\n constructor(_parentInjector, _customTokens) {\n this._parentInjector = _parentInjector;\n this._customTokens = _customTokens;\n }\n get(token, notFoundValue) {\n const value = this._customTokens.get(token);\n if (typeof value !== 'undefined') {\n return value;\n }\n return this._parentInjector.get(token, notFoundValue);\n }\n}\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { BasePortalHost, BasePortalOutlet, CdkPortal, CdkPortalOutlet, ComponentPortal, DomPortal, DomPortalHost, DomPortalOutlet, Portal, PortalHostDirective, PortalInjector, PortalModule, TemplatePortal, TemplatePortalDirective };\n","/**\n * @license Angular v18.0.6\n * (c) 2010-2024 Google LLC. https://angular.io/\n * License: MIT\n */\n\nimport * as i0 from '@angular/core';\nimport { Injectable, InjectionToken, inject, Optional, Inject, EventEmitter, ɵɵinject, ɵfindLocaleData, ɵLocaleDataIndex, ɵgetLocaleCurrencyCode, ɵgetLocalePluralCase, LOCALE_ID, ɵregisterLocaleData, ɵstringify, Directive, Input, createNgModule, NgModuleRef, ɵRuntimeError, Host, Attribute, RendererStyleFlags2, untracked, ɵisPromise, ɵisSubscribable, Pipe, DEFAULT_CURRENCY_CODE, NgModule, Version, ɵɵdefineInjectable, PLATFORM_ID, ɵformatRuntimeError, ɵIMAGE_CONFIG, Renderer2, ElementRef, Injector, ɵperformanceMarkFeature, NgZone, ChangeDetectorRef, numberAttribute, booleanAttribute, ɵIMAGE_CONFIG_DEFAULTS, ɵunwrapSafeValue } from '@angular/core';\nexport { ɵIMAGE_CONFIG as IMAGE_CONFIG } from '@angular/core';\n\nlet _DOM = null;\nfunction getDOM() {\n return _DOM;\n}\nfunction setRootDomAdapter(adapter) {\n _DOM ??= adapter;\n}\n/* tslint:disable:requireParameterType */\n/**\n * Provides DOM operations in an environment-agnostic way.\n *\n * @security Tread carefully! Interacting with the DOM directly is dangerous and\n * can introduce XSS risks.\n */\nclass DomAdapter {\n}\n\n/**\n * This class wraps the platform Navigation API which allows server-specific and test\n * implementations.\n */\nclass PlatformNavigation {\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: PlatformNavigation, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: PlatformNavigation, providedIn: 'platform', useFactory: () => window.navigation }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: PlatformNavigation, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'platform', useFactory: () => window.navigation }]\n }] });\n\n/**\n * A DI Token representing the main rendering context.\n * In a browser and SSR this is the DOM Document.\n * When using SSR, that document is created by [Domino](https://github.com/angular/domino).\n *\n * @publicApi\n */\nconst DOCUMENT = new InjectionToken(ngDevMode ? 'DocumentToken' : '');\n\n/**\n * This class should not be used directly by an application developer. Instead, use\n * {@link Location}.\n *\n * `PlatformLocation` encapsulates all calls to DOM APIs, which allows the Router to be\n * platform-agnostic.\n * This means that we can have different implementation of `PlatformLocation` for the different\n * platforms that Angular supports. For example, `@angular/platform-browser` provides an\n * implementation specific to the browser environment, while `@angular/platform-server` provides\n * one suitable for use with server-side rendering.\n *\n * The `PlatformLocation` class is used directly by all implementations of {@link LocationStrategy}\n * when they need to interact with the DOM APIs like pushState, popState, etc.\n *\n * {@link LocationStrategy} in turn is used by the {@link Location} service which is used directly\n * by the {@link Router} in order to navigate between routes. Since all interactions between {@link\n * Router} /\n * {@link Location} / {@link LocationStrategy} and DOM APIs flow through the `PlatformLocation`\n * class, they are all platform-agnostic.\n *\n * @publicApi\n */\nclass PlatformLocation {\n historyGo(relativePosition) {\n throw new Error(ngDevMode ? 'Not implemented' : '');\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: PlatformLocation, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: PlatformLocation, providedIn: 'platform', useFactory: () => inject(BrowserPlatformLocation) }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: PlatformLocation, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'platform', useFactory: () => inject(BrowserPlatformLocation) }]\n }] });\n/**\n * @description\n * Indicates when a location is initialized.\n *\n * @publicApi\n */\nconst LOCATION_INITIALIZED = new InjectionToken(ngDevMode ? 'Location Initialized' : '');\n/**\n * `PlatformLocation` encapsulates all of the direct calls to platform APIs.\n * This class should not be used directly by an application developer. Instead, use\n * {@link Location}.\n *\n * @publicApi\n */\nclass BrowserPlatformLocation extends PlatformLocation {\n constructor() {\n super();\n this._doc = inject(DOCUMENT);\n this._location = window.location;\n this._history = window.history;\n }\n getBaseHrefFromDOM() {\n return getDOM().getBaseHref(this._doc);\n }\n onPopState(fn) {\n const window = getDOM().getGlobalEventTarget(this._doc, 'window');\n window.addEventListener('popstate', fn, false);\n return () => window.removeEventListener('popstate', fn);\n }\n onHashChange(fn) {\n const window = getDOM().getGlobalEventTarget(this._doc, 'window');\n window.addEventListener('hashchange', fn, false);\n return () => window.removeEventListener('hashchange', fn);\n }\n get href() {\n return this._location.href;\n }\n get protocol() {\n return this._location.protocol;\n }\n get hostname() {\n return this._location.hostname;\n }\n get port() {\n return this._location.port;\n }\n get pathname() {\n return this._location.pathname;\n }\n get search() {\n return this._location.search;\n }\n get hash() {\n return this._location.hash;\n }\n set pathname(newPath) {\n this._location.pathname = newPath;\n }\n pushState(state, title, url) {\n this._history.pushState(state, title, url);\n }\n replaceState(state, title, url) {\n this._history.replaceState(state, title, url);\n }\n forward() {\n this._history.forward();\n }\n back() {\n this._history.back();\n }\n historyGo(relativePosition = 0) {\n this._history.go(relativePosition);\n }\n getState() {\n return this._history.state;\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: BrowserPlatformLocation, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: BrowserPlatformLocation, providedIn: 'platform', useFactory: () => new BrowserPlatformLocation() }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: BrowserPlatformLocation, decorators: [{\n type: Injectable,\n args: [{\n providedIn: 'platform',\n useFactory: () => new BrowserPlatformLocation(),\n }]\n }], ctorParameters: () => [] });\n\n/**\n * Joins two parts of a URL with a slash if needed.\n *\n * @param start URL string\n * @param end URL string\n *\n *\n * @returns The joined URL string.\n */\nfunction joinWithSlash(start, end) {\n if (start.length == 0) {\n return end;\n }\n if (end.length == 0) {\n return start;\n }\n let slashes = 0;\n if (start.endsWith('/')) {\n slashes++;\n }\n if (end.startsWith('/')) {\n slashes++;\n }\n if (slashes == 2) {\n return start + end.substring(1);\n }\n if (slashes == 1) {\n return start + end;\n }\n return start + '/' + end;\n}\n/**\n * Removes a trailing slash from a URL string if needed.\n * Looks for the first occurrence of either `#`, `?`, or the end of the\n * line as `/` characters and removes the trailing slash if one exists.\n *\n * @param url URL string.\n *\n * @returns The URL string, modified if needed.\n */\nfunction stripTrailingSlash(url) {\n const match = url.match(/#|\\?|$/);\n const pathEndIdx = (match && match.index) || url.length;\n const droppedSlashIdx = pathEndIdx - (url[pathEndIdx - 1] === '/' ? 1 : 0);\n return url.slice(0, droppedSlashIdx) + url.slice(pathEndIdx);\n}\n/**\n * Normalizes URL parameters by prepending with `?` if needed.\n *\n * @param params String of URL parameters.\n *\n * @returns The normalized URL parameters string.\n */\nfunction normalizeQueryParams(params) {\n return params && params[0] !== '?' ? '?' + params : params;\n}\n\n/**\n * Enables the `Location` service to read route state from the browser's URL.\n * Angular provides two strategies:\n * `HashLocationStrategy` and `PathLocationStrategy`.\n *\n * Applications should use the `Router` or `Location` services to\n * interact with application route state.\n *\n * For instance, `HashLocationStrategy` produces URLs like\n * http://example.com#/foo,\n * and `PathLocationStrategy` produces\n * http://example.com/foo as an equivalent URL.\n *\n * See these two classes for more.\n *\n * @publicApi\n */\nclass LocationStrategy {\n historyGo(relativePosition) {\n throw new Error(ngDevMode ? 'Not implemented' : '');\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: LocationStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: LocationStrategy, providedIn: 'root', useFactory: () => inject(PathLocationStrategy) }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: LocationStrategy, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root', useFactory: () => inject(PathLocationStrategy) }]\n }] });\n/**\n * A predefined DI token for the base href\n * to be used with the `PathLocationStrategy`.\n * The base href is the URL prefix that should be preserved when generating\n * and recognizing URLs.\n *\n * @usageNotes\n *\n * The following example shows how to use this token to configure the root app injector\n * with a base href value, so that the DI framework can supply the dependency anywhere in the app.\n *\n * ```typescript\n * import {NgModule} from '@angular/core';\n * import {APP_BASE_HREF} from '@angular/common';\n *\n * @NgModule({\n * providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}]\n * })\n * class AppModule {}\n * ```\n *\n * @publicApi\n */\nconst APP_BASE_HREF = new InjectionToken(ngDevMode ? 'appBaseHref' : '');\n/**\n * @description\n * A {@link LocationStrategy} used to configure the {@link Location} service to\n * represent its state in the\n * [path](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) of the\n * browser's URL.\n *\n * If you're using `PathLocationStrategy`, you may provide a {@link APP_BASE_HREF}\n * or add a `` element to the document to override the default.\n *\n * For instance, if you provide an `APP_BASE_HREF` of `'/my/app/'` and call\n * `location.go('/foo')`, the browser's URL will become\n * `example.com/my/app/foo`. To ensure all relative URIs resolve correctly,\n * the `` and/or `APP_BASE_HREF` should end with a `/`.\n *\n * Similarly, if you add `` to the document and call\n * `location.go('/foo')`, the browser's URL will become\n * `example.com/my/app/foo`.\n *\n * Note that when using `PathLocationStrategy`, neither the query nor\n * the fragment in the `` will be preserved, as outlined\n * by the [RFC](https://tools.ietf.org/html/rfc3986#section-5.2.2).\n *\n * @usageNotes\n *\n * ### Example\n *\n * {@example common/location/ts/path_location_component.ts region='LocationComponent'}\n *\n * @publicApi\n */\nclass PathLocationStrategy extends LocationStrategy {\n constructor(_platformLocation, href) {\n super();\n this._platformLocation = _platformLocation;\n this._removeListenerFns = [];\n this._baseHref =\n href ??\n this._platformLocation.getBaseHrefFromDOM() ??\n inject(DOCUMENT).location?.origin ??\n '';\n }\n /** @nodoc */\n ngOnDestroy() {\n while (this._removeListenerFns.length) {\n this._removeListenerFns.pop()();\n }\n }\n onPopState(fn) {\n this._removeListenerFns.push(this._platformLocation.onPopState(fn), this._platformLocation.onHashChange(fn));\n }\n getBaseHref() {\n return this._baseHref;\n }\n prepareExternalUrl(internal) {\n return joinWithSlash(this._baseHref, internal);\n }\n path(includeHash = false) {\n const pathname = this._platformLocation.pathname + normalizeQueryParams(this._platformLocation.search);\n const hash = this._platformLocation.hash;\n return hash && includeHash ? `${pathname}${hash}` : pathname;\n }\n pushState(state, title, url, queryParams) {\n const externalUrl = this.prepareExternalUrl(url + normalizeQueryParams(queryParams));\n this._platformLocation.pushState(state, title, externalUrl);\n }\n replaceState(state, title, url, queryParams) {\n const externalUrl = this.prepareExternalUrl(url + normalizeQueryParams(queryParams));\n this._platformLocation.replaceState(state, title, externalUrl);\n }\n forward() {\n this._platformLocation.forward();\n }\n back() {\n this._platformLocation.back();\n }\n getState() {\n return this._platformLocation.getState();\n }\n historyGo(relativePosition = 0) {\n this._platformLocation.historyGo?.(relativePosition);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: PathLocationStrategy, deps: [{ token: PlatformLocation }, { token: APP_BASE_HREF, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: PathLocationStrategy, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: PathLocationStrategy, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }], ctorParameters: () => [{ type: PlatformLocation }, { type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: [APP_BASE_HREF]\n }] }] });\n\n/**\n * @description\n * A {@link LocationStrategy} used to configure the {@link Location} service to\n * represent its state in the\n * [hash fragment](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax)\n * of the browser's URL.\n *\n * For instance, if you call `location.go('/foo')`, the browser's URL will become\n * `example.com#/foo`.\n *\n * @usageNotes\n *\n * ### Example\n *\n * {@example common/location/ts/hash_location_component.ts region='LocationComponent'}\n *\n * @publicApi\n */\nclass HashLocationStrategy extends LocationStrategy {\n constructor(_platformLocation, _baseHref) {\n super();\n this._platformLocation = _platformLocation;\n this._baseHref = '';\n this._removeListenerFns = [];\n if (_baseHref != null) {\n this._baseHref = _baseHref;\n }\n }\n /** @nodoc */\n ngOnDestroy() {\n while (this._removeListenerFns.length) {\n this._removeListenerFns.pop()();\n }\n }\n onPopState(fn) {\n this._removeListenerFns.push(this._platformLocation.onPopState(fn), this._platformLocation.onHashChange(fn));\n }\n getBaseHref() {\n return this._baseHref;\n }\n path(includeHash = false) {\n // the hash value is always prefixed with a `#`\n // and if it is empty then it will stay empty\n const path = this._platformLocation.hash ?? '#';\n return path.length > 0 ? path.substring(1) : path;\n }\n prepareExternalUrl(internal) {\n const url = joinWithSlash(this._baseHref, internal);\n return url.length > 0 ? '#' + url : url;\n }\n pushState(state, title, path, queryParams) {\n let url = this.prepareExternalUrl(path + normalizeQueryParams(queryParams));\n if (url.length == 0) {\n url = this._platformLocation.pathname;\n }\n this._platformLocation.pushState(state, title, url);\n }\n replaceState(state, title, path, queryParams) {\n let url = this.prepareExternalUrl(path + normalizeQueryParams(queryParams));\n if (url.length == 0) {\n url = this._platformLocation.pathname;\n }\n this._platformLocation.replaceState(state, title, url);\n }\n forward() {\n this._platformLocation.forward();\n }\n back() {\n this._platformLocation.back();\n }\n getState() {\n return this._platformLocation.getState();\n }\n historyGo(relativePosition = 0) {\n this._platformLocation.historyGo?.(relativePosition);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: HashLocationStrategy, deps: [{ token: PlatformLocation }, { token: APP_BASE_HREF, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: HashLocationStrategy }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: HashLocationStrategy, decorators: [{\n type: Injectable\n }], ctorParameters: () => [{ type: PlatformLocation }, { type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: [APP_BASE_HREF]\n }] }] });\n\n/**\n * @description\n *\n * A service that applications can use to interact with a browser's URL.\n *\n * Depending on the `LocationStrategy` used, `Location` persists\n * to the URL's path or the URL's hash segment.\n *\n * @usageNotes\n *\n * It's better to use the `Router.navigate()` service to trigger route changes. Use\n * `Location` only if you need to interact with or create normalized URLs outside of\n * routing.\n *\n * `Location` is responsible for normalizing the URL against the application's base href.\n * A normalized URL is absolute from the URL host, includes the application's base href, and has no\n * trailing slash:\n * - `/my/app/user/123` is normalized\n * - `my/app/user/123` **is not** normalized\n * - `/my/app/user/123/` **is not** normalized\n *\n * ### Example\n *\n * \n *\n * @publicApi\n */\nclass Location {\n constructor(locationStrategy) {\n /** @internal */\n this._subject = new EventEmitter();\n /** @internal */\n this._urlChangeListeners = [];\n /** @internal */\n this._urlChangeSubscription = null;\n this._locationStrategy = locationStrategy;\n const baseHref = this._locationStrategy.getBaseHref();\n // Note: This class's interaction with base HREF does not fully follow the rules\n // outlined in the spec https://www.freesoft.org/CIE/RFC/1808/18.htm.\n // Instead of trying to fix individual bugs with more and more code, we should\n // investigate using the URL constructor and providing the base as a second\n // argument.\n // https://developer.mozilla.org/en-US/docs/Web/API/URL/URL#parameters\n this._basePath = _stripOrigin(stripTrailingSlash(_stripIndexHtml(baseHref)));\n this._locationStrategy.onPopState((ev) => {\n this._subject.emit({\n 'url': this.path(true),\n 'pop': true,\n 'state': ev.state,\n 'type': ev.type,\n });\n });\n }\n /** @nodoc */\n ngOnDestroy() {\n this._urlChangeSubscription?.unsubscribe();\n this._urlChangeListeners = [];\n }\n /**\n * Normalizes the URL path for this location.\n *\n * @param includeHash True to include an anchor fragment in the path.\n *\n * @returns The normalized URL path.\n */\n // TODO: vsavkin. Remove the boolean flag and always include hash once the deprecated router is\n // removed.\n path(includeHash = false) {\n return this.normalize(this._locationStrategy.path(includeHash));\n }\n /**\n * Reports the current state of the location history.\n * @returns The current value of the `history.state` object.\n */\n getState() {\n return this._locationStrategy.getState();\n }\n /**\n * Normalizes the given path and compares to the current normalized path.\n *\n * @param path The given URL path.\n * @param query Query parameters.\n *\n * @returns True if the given URL path is equal to the current normalized path, false\n * otherwise.\n */\n isCurrentPathEqualTo(path, query = '') {\n return this.path() == this.normalize(path + normalizeQueryParams(query));\n }\n /**\n * Normalizes a URL path by stripping any trailing slashes.\n *\n * @param url String representing a URL.\n *\n * @returns The normalized URL string.\n */\n normalize(url) {\n return Location.stripTrailingSlash(_stripBasePath(this._basePath, _stripIndexHtml(url)));\n }\n /**\n * Normalizes an external URL path.\n * If the given URL doesn't begin with a leading slash (`'/'`), adds one\n * before normalizing. Adds a hash if `HashLocationStrategy` is\n * in use, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.\n *\n * @param url String representing a URL.\n *\n * @returns A normalized platform-specific URL.\n */\n prepareExternalUrl(url) {\n if (url && url[0] !== '/') {\n url = '/' + url;\n }\n return this._locationStrategy.prepareExternalUrl(url);\n }\n // TODO: rename this method to pushState\n /**\n * Changes the browser's URL to a normalized version of a given URL, and pushes a\n * new item onto the platform's history.\n *\n * @param path URL path to normalize.\n * @param query Query parameters.\n * @param state Location history state.\n *\n */\n go(path, query = '', state = null) {\n this._locationStrategy.pushState(state, '', path, query);\n this._notifyUrlChangeListeners(this.prepareExternalUrl(path + normalizeQueryParams(query)), state);\n }\n /**\n * Changes the browser's URL to a normalized version of the given URL, and replaces\n * the top item on the platform's history stack.\n *\n * @param path URL path to normalize.\n * @param query Query parameters.\n * @param state Location history state.\n */\n replaceState(path, query = '', state = null) {\n this._locationStrategy.replaceState(state, '', path, query);\n this._notifyUrlChangeListeners(this.prepareExternalUrl(path + normalizeQueryParams(query)), state);\n }\n /**\n * Navigates forward in the platform's history.\n */\n forward() {\n this._locationStrategy.forward();\n }\n /**\n * Navigates back in the platform's history.\n */\n back() {\n this._locationStrategy.back();\n }\n /**\n * Navigate to a specific page from session history, identified by its relative position to the\n * current page.\n *\n * @param relativePosition Position of the target page in the history relative to the current\n * page.\n * A negative value moves backwards, a positive value moves forwards, e.g. `location.historyGo(2)`\n * moves forward two pages and `location.historyGo(-2)` moves back two pages. When we try to go\n * beyond what's stored in the history session, we stay in the current page. Same behaviour occurs\n * when `relativePosition` equals 0.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/History_API#Moving_to_a_specific_point_in_history\n */\n historyGo(relativePosition = 0) {\n this._locationStrategy.historyGo?.(relativePosition);\n }\n /**\n * Registers a URL change listener. Use to catch updates performed by the Angular\n * framework that are not detectible through \"popstate\" or \"hashchange\" events.\n *\n * @param fn The change handler function, which take a URL and a location history state.\n * @returns A function that, when executed, unregisters a URL change listener.\n */\n onUrlChange(fn) {\n this._urlChangeListeners.push(fn);\n this._urlChangeSubscription ??= this.subscribe((v) => {\n this._notifyUrlChangeListeners(v.url, v.state);\n });\n return () => {\n const fnIndex = this._urlChangeListeners.indexOf(fn);\n this._urlChangeListeners.splice(fnIndex, 1);\n if (this._urlChangeListeners.length === 0) {\n this._urlChangeSubscription?.unsubscribe();\n this._urlChangeSubscription = null;\n }\n };\n }\n /** @internal */\n _notifyUrlChangeListeners(url = '', state) {\n this._urlChangeListeners.forEach((fn) => fn(url, state));\n }\n /**\n * Subscribes to the platform's `popState` events.\n *\n * Note: `Location.go()` does not trigger the `popState` event in the browser. Use\n * `Location.onUrlChange()` to subscribe to URL changes instead.\n *\n * @param value Event that is triggered when the state history changes.\n * @param exception The exception to throw.\n *\n * @see [onpopstate](https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onpopstate)\n *\n * @returns Subscribed events.\n */\n subscribe(onNext, onThrow, onReturn) {\n return this._subject.subscribe({ next: onNext, error: onThrow, complete: onReturn });\n }\n /**\n * Normalizes URL parameters by prepending with `?` if needed.\n *\n * @param params String of URL parameters.\n *\n * @returns The normalized URL parameters string.\n */\n static { this.normalizeQueryParams = normalizeQueryParams; }\n /**\n * Joins two parts of a URL with a slash if needed.\n *\n * @param start URL string\n * @param end URL string\n *\n *\n * @returns The joined URL string.\n */\n static { this.joinWithSlash = joinWithSlash; }\n /**\n * Removes a trailing slash from a URL string if needed.\n * Looks for the first occurrence of either `#`, `?`, or the end of the\n * line as `/` characters and removes the trailing slash if one exists.\n *\n * @param url URL string.\n *\n * @returns The URL string, modified if needed.\n */\n static { this.stripTrailingSlash = stripTrailingSlash; }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: Location, deps: [{ token: LocationStrategy }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: Location, providedIn: 'root', useFactory: createLocation }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: Location, decorators: [{\n type: Injectable,\n args: [{\n providedIn: 'root',\n // See #23917\n useFactory: createLocation,\n }]\n }], ctorParameters: () => [{ type: LocationStrategy }] });\nfunction createLocation() {\n return new Location(ɵɵinject(LocationStrategy));\n}\nfunction _stripBasePath(basePath, url) {\n if (!basePath || !url.startsWith(basePath)) {\n return url;\n }\n const strippedUrl = url.substring(basePath.length);\n if (strippedUrl === '' || ['/', ';', '?', '#'].includes(strippedUrl[0])) {\n return strippedUrl;\n }\n return url;\n}\nfunction _stripIndexHtml(url) {\n return url.replace(/\\/index.html$/, '');\n}\nfunction _stripOrigin(baseHref) {\n // DO NOT REFACTOR! Previously, this check looked like this:\n // `/^(https?:)?\\/\\//.test(baseHref)`, but that resulted in\n // syntactically incorrect code after Closure Compiler minification.\n // This was likely caused by a bug in Closure Compiler, but\n // for now, the check is rewritten to use `new RegExp` instead.\n const isAbsoluteUrl = new RegExp('^(https?:)?//').test(baseHref);\n if (isAbsoluteUrl) {\n const [, pathname] = baseHref.split(/\\/\\/[^\\/]+/);\n return pathname;\n }\n return baseHref;\n}\n\n/** @internal */\nconst CURRENCIES_EN = { \"ADP\": [undefined, undefined, 0], \"AFN\": [undefined, \"؋\", 0], \"ALL\": [undefined, undefined, 0], \"AMD\": [undefined, \"֏\", 2], \"AOA\": [undefined, \"Kz\"], \"ARS\": [undefined, \"$\"], \"AUD\": [\"A$\", \"$\"], \"AZN\": [undefined, \"₼\"], \"BAM\": [undefined, \"KM\"], \"BBD\": [undefined, \"$\"], \"BDT\": [undefined, \"৳\"], \"BHD\": [undefined, undefined, 3], \"BIF\": [undefined, undefined, 0], \"BMD\": [undefined, \"$\"], \"BND\": [undefined, \"$\"], \"BOB\": [undefined, \"Bs\"], \"BRL\": [\"R$\"], \"BSD\": [undefined, \"$\"], \"BWP\": [undefined, \"P\"], \"BYN\": [undefined, undefined, 2], \"BYR\": [undefined, undefined, 0], \"BZD\": [undefined, \"$\"], \"CAD\": [\"CA$\", \"$\", 2], \"CHF\": [undefined, undefined, 2], \"CLF\": [undefined, undefined, 4], \"CLP\": [undefined, \"$\", 0], \"CNY\": [\"CN¥\", \"¥\"], \"COP\": [undefined, \"$\", 2], \"CRC\": [undefined, \"₡\", 2], \"CUC\": [undefined, \"$\"], \"CUP\": [undefined, \"$\"], \"CZK\": [undefined, \"Kč\", 2], \"DJF\": [undefined, undefined, 0], \"DKK\": [undefined, \"kr\", 2], \"DOP\": [undefined, \"$\"], \"EGP\": [undefined, \"E£\"], \"ESP\": [undefined, \"₧\", 0], \"EUR\": [\"€\"], \"FJD\": [undefined, \"$\"], \"FKP\": [undefined, \"£\"], \"GBP\": [\"£\"], \"GEL\": [undefined, \"₾\"], \"GHS\": [undefined, \"GH₵\"], \"GIP\": [undefined, \"£\"], \"GNF\": [undefined, \"FG\", 0], \"GTQ\": [undefined, \"Q\"], \"GYD\": [undefined, \"$\", 2], \"HKD\": [\"HK$\", \"$\"], \"HNL\": [undefined, \"L\"], \"HRK\": [undefined, \"kn\"], \"HUF\": [undefined, \"Ft\", 2], \"IDR\": [undefined, \"Rp\", 2], \"ILS\": [\"₪\"], \"INR\": [\"₹\"], \"IQD\": [undefined, undefined, 0], \"IRR\": [undefined, undefined, 0], \"ISK\": [undefined, \"kr\", 0], \"ITL\": [undefined, undefined, 0], \"JMD\": [undefined, \"$\"], \"JOD\": [undefined, undefined, 3], \"JPY\": [\"¥\", undefined, 0], \"KHR\": [undefined, \"៛\"], \"KMF\": [undefined, \"CF\", 0], \"KPW\": [undefined, \"₩\", 0], \"KRW\": [\"₩\", undefined, 0], \"KWD\": [undefined, undefined, 3], \"KYD\": [undefined, \"$\"], \"KZT\": [undefined, \"₸\"], \"LAK\": [undefined, \"₭\", 0], \"LBP\": [undefined, \"L£\", 0], \"LKR\": [undefined, \"Rs\"], \"LRD\": [undefined, \"$\"], \"LTL\": [undefined, \"Lt\"], \"LUF\": [undefined, undefined, 0], \"LVL\": [undefined, \"Ls\"], \"LYD\": [undefined, undefined, 3], \"MGA\": [undefined, \"Ar\", 0], \"MGF\": [undefined, undefined, 0], \"MMK\": [undefined, \"K\", 0], \"MNT\": [undefined, \"₮\", 2], \"MRO\": [undefined, undefined, 0], \"MUR\": [undefined, \"Rs\", 2], \"MXN\": [\"MX$\", \"$\"], \"MYR\": [undefined, \"RM\"], \"NAD\": [undefined, \"$\"], \"NGN\": [undefined, \"₦\"], \"NIO\": [undefined, \"C$\"], \"NOK\": [undefined, \"kr\", 2], \"NPR\": [undefined, \"Rs\"], \"NZD\": [\"NZ$\", \"$\"], \"OMR\": [undefined, undefined, 3], \"PHP\": [\"₱\"], \"PKR\": [undefined, \"Rs\", 2], \"PLN\": [undefined, \"zł\"], \"PYG\": [undefined, \"₲\", 0], \"RON\": [undefined, \"lei\"], \"RSD\": [undefined, undefined, 0], \"RUB\": [undefined, \"₽\"], \"RWF\": [undefined, \"RF\", 0], \"SBD\": [undefined, \"$\"], \"SEK\": [undefined, \"kr\", 2], \"SGD\": [undefined, \"$\"], \"SHP\": [undefined, \"£\"], \"SLE\": [undefined, undefined, 2], \"SLL\": [undefined, undefined, 0], \"SOS\": [undefined, undefined, 0], \"SRD\": [undefined, \"$\"], \"SSP\": [undefined, \"£\"], \"STD\": [undefined, undefined, 0], \"STN\": [undefined, \"Db\"], \"SYP\": [undefined, \"£\", 0], \"THB\": [undefined, \"฿\"], \"TMM\": [undefined, undefined, 0], \"TND\": [undefined, undefined, 3], \"TOP\": [undefined, \"T$\"], \"TRL\": [undefined, undefined, 0], \"TRY\": [undefined, \"₺\"], \"TTD\": [undefined, \"$\"], \"TWD\": [\"NT$\", \"$\", 2], \"TZS\": [undefined, undefined, 2], \"UAH\": [undefined, \"₴\"], \"UGX\": [undefined, undefined, 0], \"USD\": [\"$\"], \"UYI\": [undefined, undefined, 0], \"UYU\": [undefined, \"$\"], \"UYW\": [undefined, undefined, 4], \"UZS\": [undefined, undefined, 2], \"VEF\": [undefined, \"Bs\", 2], \"VND\": [\"₫\", undefined, 0], \"VUV\": [undefined, undefined, 0], \"XAF\": [\"FCFA\", undefined, 0], \"XCD\": [\"EC$\", \"$\"], \"XOF\": [\"F CFA\", undefined, 0], \"XPF\": [\"CFPF\", undefined, 0], \"XXX\": [\"¤\"], \"YER\": [undefined, undefined, 0], \"ZAR\": [undefined, \"R\"], \"ZMK\": [undefined, undefined, 0], \"ZMW\": [undefined, \"ZK\"], \"ZWD\": [undefined, undefined, 0] };\n\n/**\n * Format styles that can be used to represent numbers.\n * @see {@link getLocaleNumberFormat}\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n *\n * @deprecated `getLocaleNumberFormat` is deprecated\n */\nvar NumberFormatStyle;\n(function (NumberFormatStyle) {\n NumberFormatStyle[NumberFormatStyle[\"Decimal\"] = 0] = \"Decimal\";\n NumberFormatStyle[NumberFormatStyle[\"Percent\"] = 1] = \"Percent\";\n NumberFormatStyle[NumberFormatStyle[\"Currency\"] = 2] = \"Currency\";\n NumberFormatStyle[NumberFormatStyle[\"Scientific\"] = 3] = \"Scientific\";\n})(NumberFormatStyle || (NumberFormatStyle = {}));\n/**\n * Plurality cases used for translating plurals to different languages.\n *\n * @see {@link NgPlural}\n * @see {@link NgPluralCase}\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n *\n * @deprecated `getLocalePluralCase` is deprecated\n */\nvar Plural;\n(function (Plural) {\n Plural[Plural[\"Zero\"] = 0] = \"Zero\";\n Plural[Plural[\"One\"] = 1] = \"One\";\n Plural[Plural[\"Two\"] = 2] = \"Two\";\n Plural[Plural[\"Few\"] = 3] = \"Few\";\n Plural[Plural[\"Many\"] = 4] = \"Many\";\n Plural[Plural[\"Other\"] = 5] = \"Other\";\n})(Plural || (Plural = {}));\n/**\n * Context-dependant translation forms for strings.\n * Typically the standalone version is for the nominative form of the word,\n * and the format version is used for the genitive case.\n * @see [CLDR website](http://cldr.unicode.org/translation/date-time-1/date-time#TOC-Standalone-vs.-Format-Styles)\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n *\n * @deprecated locale data getters are deprecated\n */\nvar FormStyle;\n(function (FormStyle) {\n FormStyle[FormStyle[\"Format\"] = 0] = \"Format\";\n FormStyle[FormStyle[\"Standalone\"] = 1] = \"Standalone\";\n})(FormStyle || (FormStyle = {}));\n/**\n * String widths available for translations.\n * The specific character widths are locale-specific.\n * Examples are given for the word \"Sunday\" in English.\n *\n * @publicApi\n *\n * @deprecated locale data getters are deprecated\n */\nvar TranslationWidth;\n(function (TranslationWidth) {\n /** 1 character for `en-US`. For example: 'S' */\n TranslationWidth[TranslationWidth[\"Narrow\"] = 0] = \"Narrow\";\n /** 3 characters for `en-US`. For example: 'Sun' */\n TranslationWidth[TranslationWidth[\"Abbreviated\"] = 1] = \"Abbreviated\";\n /** Full length for `en-US`. For example: \"Sunday\" */\n TranslationWidth[TranslationWidth[\"Wide\"] = 2] = \"Wide\";\n /** 2 characters for `en-US`, For example: \"Su\" */\n TranslationWidth[TranslationWidth[\"Short\"] = 3] = \"Short\";\n})(TranslationWidth || (TranslationWidth = {}));\n/**\n * String widths available for date-time formats.\n * The specific character widths are locale-specific.\n * Examples are given for `en-US`.\n *\n * @see {@link getLocaleDateFormat}\n * @see {@link getLocaleTimeFormat}\n * @see {@link getLocaleDateTimeFormat}\n * @see [Internationalization (i18n) Guide](guide/i18n)\n * @publicApi\n *\n * @deprecated Date locale data getters are deprecated\n */\nvar FormatWidth;\n(function (FormatWidth) {\n /**\n * For `en-US`, `'M/d/yy, h:mm a'`\n * (Example: `6/15/15, 9:03 AM`)\n */\n FormatWidth[FormatWidth[\"Short\"] = 0] = \"Short\";\n /**\n * For `en-US`, `'MMM d, y, h:mm:ss a'`\n * (Example: `Jun 15, 2015, 9:03:01 AM`)\n */\n FormatWidth[FormatWidth[\"Medium\"] = 1] = \"Medium\";\n /**\n * For `en-US`, `'MMMM d, y, h:mm:ss a z'`\n * (Example: `June 15, 2015 at 9:03:01 AM GMT+1`)\n */\n FormatWidth[FormatWidth[\"Long\"] = 2] = \"Long\";\n /**\n * For `en-US`, `'EEEE, MMMM d, y, h:mm:ss a zzzz'`\n * (Example: `Monday, June 15, 2015 at 9:03:01 AM GMT+01:00`)\n */\n FormatWidth[FormatWidth[\"Full\"] = 3] = \"Full\";\n})(FormatWidth || (FormatWidth = {}));\n// This needs to be an object literal, rather than an enum, because TypeScript 5.4+\n// doesn't allow numeric keys and we have `Infinity` and `NaN`.\n/**\n * Symbols that can be used to replace placeholders in number patterns.\n * Examples are based on `en-US` values.\n *\n * @see {@link getLocaleNumberSymbol}\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n *\n * @deprecated `getLocaleNumberSymbol` is deprecated\n *\n * @object-literal-as-enum\n */\nconst NumberSymbol = {\n /**\n * Decimal separator.\n * For `en-US`, the dot character.\n * Example: 2,345`.`67\n */\n Decimal: 0,\n /**\n * Grouping separator, typically for thousands.\n * For `en-US`, the comma character.\n * Example: 2`,`345.67\n */\n Group: 1,\n /**\n * List-item separator.\n * Example: \"one, two, and three\"\n */\n List: 2,\n /**\n * Sign for percentage (out of 100).\n * Example: 23.4%\n */\n PercentSign: 3,\n /**\n * Sign for positive numbers.\n * Example: +23\n */\n PlusSign: 4,\n /**\n * Sign for negative numbers.\n * Example: -23\n */\n MinusSign: 5,\n /**\n * Computer notation for exponential value (n times a power of 10).\n * Example: 1.2E3\n */\n Exponential: 6,\n /**\n * Human-readable format of exponential.\n * Example: 1.2x103\n */\n SuperscriptingExponent: 7,\n /**\n * Sign for permille (out of 1000).\n * Example: 23.4‰\n */\n PerMille: 8,\n /**\n * Infinity, can be used with plus and minus.\n * Example: ∞, +∞, -∞\n */\n Infinity: 9,\n /**\n * Not a number.\n * Example: NaN\n */\n NaN: 10,\n /**\n * Symbol used between time units.\n * Example: 10:52\n */\n TimeSeparator: 11,\n /**\n * Decimal separator for currency values (fallback to `Decimal`).\n * Example: $2,345.67\n */\n CurrencyDecimal: 12,\n /**\n * Group separator for currency values (fallback to `Group`).\n * Example: $2,345.67\n */\n CurrencyGroup: 13,\n};\n/**\n * The value for each day of the week, based on the `en-US` locale\n *\n * @publicApi\n *\n * @deprecated Week locale getters are deprecated\n */\nvar WeekDay;\n(function (WeekDay) {\n WeekDay[WeekDay[\"Sunday\"] = 0] = \"Sunday\";\n WeekDay[WeekDay[\"Monday\"] = 1] = \"Monday\";\n WeekDay[WeekDay[\"Tuesday\"] = 2] = \"Tuesday\";\n WeekDay[WeekDay[\"Wednesday\"] = 3] = \"Wednesday\";\n WeekDay[WeekDay[\"Thursday\"] = 4] = \"Thursday\";\n WeekDay[WeekDay[\"Friday\"] = 5] = \"Friday\";\n WeekDay[WeekDay[\"Saturday\"] = 6] = \"Saturday\";\n})(WeekDay || (WeekDay = {}));\n/**\n * Retrieves the locale ID from the currently loaded locale.\n * The loaded locale could be, for example, a global one rather than a regional one.\n * @param locale A locale code, such as `fr-FR`.\n * @returns The locale code. For example, `fr`.\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n *\n * @deprecated Angular recommends relying on the `Intl` API for i18n.\n * This function serves no purpose when relying on the `Intl` API.\n */\nfunction getLocaleId(locale) {\n return ɵfindLocaleData(locale)[ɵLocaleDataIndex.LocaleId];\n}\n/**\n * Retrieves day period strings for the given locale.\n *\n * @param locale A locale code for the locale format rules to use.\n * @param formStyle The required grammatical form.\n * @param width The required character width.\n * @returns An array of localized period strings. For example, `[AM, PM]` for `en-US`.\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n *\n * @deprecated Angular recommends relying on the `Intl` API for i18n.\n * Use `Intl.DateTimeFormat` for date formating instead.\n */\nfunction getLocaleDayPeriods(locale, formStyle, width) {\n const data = ɵfindLocaleData(locale);\n const amPmData = [\n data[ɵLocaleDataIndex.DayPeriodsFormat],\n data[ɵLocaleDataIndex.DayPeriodsStandalone],\n ];\n const amPm = getLastDefinedValue(amPmData, formStyle);\n return getLastDefinedValue(amPm, width);\n}\n/**\n * Retrieves days of the week for the given locale, using the Gregorian calendar.\n *\n * @param locale A locale code for the locale format rules to use.\n * @param formStyle The required grammatical form.\n * @param width The required character width.\n * @returns An array of localized name strings.\n * For example,`[Sunday, Monday, ... Saturday]` for `en-US`.\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n *\n * @deprecated Angular recommends relying on the `Intl` API for i18n.\n * Use `Intl.DateTimeFormat` for date formating instead.\n */\nfunction getLocaleDayNames(locale, formStyle, width) {\n const data = ɵfindLocaleData(locale);\n const daysData = [\n data[ɵLocaleDataIndex.DaysFormat],\n data[ɵLocaleDataIndex.DaysStandalone],\n ];\n const days = getLastDefinedValue(daysData, formStyle);\n return getLastDefinedValue(days, width);\n}\n/**\n * Retrieves months of the year for the given locale, using the Gregorian calendar.\n *\n * @param locale A locale code for the locale format rules to use.\n * @param formStyle The required grammatical form.\n * @param width The required character width.\n * @returns An array of localized name strings.\n * For example, `[January, February, ...]` for `en-US`.\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n *\n * @deprecated Angular recommends relying on the `Intl` API for i18n.\n * Use `Intl.DateTimeFormat` for date formating instead.\n */\nfunction getLocaleMonthNames(locale, formStyle, width) {\n const data = ɵfindLocaleData(locale);\n const monthsData = [\n data[ɵLocaleDataIndex.MonthsFormat],\n data[ɵLocaleDataIndex.MonthsStandalone],\n ];\n const months = getLastDefinedValue(monthsData, formStyle);\n return getLastDefinedValue(months, width);\n}\n/**\n * Retrieves Gregorian-calendar eras for the given locale.\n * @param locale A locale code for the locale format rules to use.\n * @param width The required character width.\n\n * @returns An array of localized era strings.\n * For example, `[AD, BC]` for `en-US`.\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n *\n * @deprecated Angular recommends relying on the `Intl` API for i18n.\n * Use `Intl.DateTimeFormat` for date formating instead.\n */\nfunction getLocaleEraNames(locale, width) {\n const data = ɵfindLocaleData(locale);\n const erasData = data[ɵLocaleDataIndex.Eras];\n return getLastDefinedValue(erasData, width);\n}\n/**\n * Retrieves the first day of the week for the given locale.\n *\n * @param locale A locale code for the locale format rules to use.\n * @returns A day index number, using the 0-based week-day index for `en-US`\n * (Sunday = 0, Monday = 1, ...).\n * For example, for `fr-FR`, returns 1 to indicate that the first day is Monday.\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n *\n * @deprecated Angular recommends relying on the `Intl` API for i18n.\n * Intl's [`getWeekInfo`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getWeekInfo) has partial support (Chromium M99 & Safari 17).\n * You may want to rely on the following alternatives:\n * - Libraries like [`Luxon`](https://moment.github.io/luxon/#/) rely on `Intl` but fallback on the ISO 8601 definition (monday) if `getWeekInfo` is not supported.\n * - Other librairies like [`date-fns`](https://date-fns.org/), [`day.js`](https://day.js.org/en/) or [`weekstart`](https://www.npmjs.com/package/weekstart) library provide their own locale based data for the first day of the week.\n */\nfunction getLocaleFirstDayOfWeek(locale) {\n const data = ɵfindLocaleData(locale);\n return data[ɵLocaleDataIndex.FirstDayOfWeek];\n}\n/**\n * Range of week days that are considered the week-end for the given locale.\n *\n * @param locale A locale code for the locale format rules to use.\n * @returns The range of day values, `[startDay, endDay]`.\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n *\n * @deprecated Angular recommends relying on the `Intl` API for i18n.\n * Intl's [`getWeekInfo`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getWeekInfo) has partial support (Chromium M99 & Safari 17).\n * Libraries like [`Luxon`](https://moment.github.io/luxon/#/) rely on `Intl` but fallback on the ISO 8601 definition (Saturday+Sunday) if `getWeekInfo` is not supported .\n */\nfunction getLocaleWeekEndRange(locale) {\n const data = ɵfindLocaleData(locale);\n return data[ɵLocaleDataIndex.WeekendRange];\n}\n/**\n * Retrieves a localized date-value formatting string.\n *\n * @param locale A locale code for the locale format rules to use.\n * @param width The format type.\n * @returns The localized formatting string.\n * @see {@link FormatWidth}\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n *\n * @deprecated Angular recommends relying on the `Intl` API for i18n.\n * Use `Intl.DateTimeFormat` for date formating instead.\n */\nfunction getLocaleDateFormat(locale, width) {\n const data = ɵfindLocaleData(locale);\n return getLastDefinedValue(data[ɵLocaleDataIndex.DateFormat], width);\n}\n/**\n * Retrieves a localized time-value formatting string.\n *\n * @param locale A locale code for the locale format rules to use.\n * @param width The format type.\n * @returns The localized formatting string.\n * @see {@link FormatWidth}\n * @see [Internationalization (i18n) Guide](guide/i18n)\n\n * @publicApi\n * @deprecated Angular recommends relying on the `Intl` API for i18n.\n * Use `Intl.DateTimeFormat` for date formating instead.\n */\nfunction getLocaleTimeFormat(locale, width) {\n const data = ɵfindLocaleData(locale);\n return getLastDefinedValue(data[ɵLocaleDataIndex.TimeFormat], width);\n}\n/**\n * Retrieves a localized date-time formatting string.\n *\n * @param locale A locale code for the locale format rules to use.\n * @param width The format type.\n * @returns The localized formatting string.\n * @see {@link FormatWidth}\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n *\n * @deprecated Angular recommends relying on the `Intl` API for i18n.\n * Use `Intl.DateTimeFormat` for date formating instead.\n */\nfunction getLocaleDateTimeFormat(locale, width) {\n const data = ɵfindLocaleData(locale);\n const dateTimeFormatData = data[ɵLocaleDataIndex.DateTimeFormat];\n return getLastDefinedValue(dateTimeFormatData, width);\n}\n/**\n * Retrieves a localized number symbol that can be used to replace placeholders in number formats.\n * @param locale The locale code.\n * @param symbol The symbol to localize. Must be one of `NumberSymbol`.\n * @returns The character for the localized symbol.\n * @see {@link NumberSymbol}\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n *\n * @deprecated Angular recommends relying on the `Intl` API for i18n.\n * Use `Intl.NumberFormat` to format numbers instead.\n */\nfunction getLocaleNumberSymbol(locale, symbol) {\n const data = ɵfindLocaleData(locale);\n const res = data[ɵLocaleDataIndex.NumberSymbols][symbol];\n if (typeof res === 'undefined') {\n if (symbol === NumberSymbol.CurrencyDecimal) {\n return data[ɵLocaleDataIndex.NumberSymbols][NumberSymbol.Decimal];\n }\n else if (symbol === NumberSymbol.CurrencyGroup) {\n return data[ɵLocaleDataIndex.NumberSymbols][NumberSymbol.Group];\n }\n }\n return res;\n}\n/**\n * Retrieves a number format for a given locale.\n *\n * Numbers are formatted using patterns, like `#,###.00`. For example, the pattern `#,###.00`\n * when used to format the number 12345.678 could result in \"12'345,678\". That would happen if the\n * grouping separator for your language is an apostrophe, and the decimal separator is a comma.\n *\n * Important: The characters `.` `,` `0` `#` (and others below) are special placeholders\n * that stand for the decimal separator, and so on, and are NOT real characters.\n * You must NOT \"translate\" the placeholders. For example, don't change `.` to `,` even though in\n * your language the decimal point is written with a comma. The symbols should be replaced by the\n * local equivalents, using the appropriate `NumberSymbol` for your language.\n *\n * Here are the special characters used in number patterns:\n *\n * | Symbol | Meaning |\n * |--------|---------|\n * | . | Replaced automatically by the character used for the decimal point. |\n * | , | Replaced by the \"grouping\" (thousands) separator. |\n * | 0 | Replaced by a digit (or zero if there aren't enough digits). |\n * | # | Replaced by a digit (or nothing if there aren't enough). |\n * | ¤ | Replaced by a currency symbol, such as $ or USD. |\n * | % | Marks a percent format. The % symbol may change position, but must be retained. |\n * | E | Marks a scientific format. The E symbol may change position, but must be retained. |\n * | ' | Special characters used as literal characters are quoted with ASCII single quotes. |\n *\n * @param locale A locale code for the locale format rules to use.\n * @param type The type of numeric value to be formatted (such as `Decimal` or `Currency`.)\n * @returns The localized format string.\n * @see {@link NumberFormatStyle}\n * @see [CLDR website](http://cldr.unicode.org/translation/number-patterns)\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n *\n * @deprecated Angular recommends relying on the `Intl` API for i18n.\n * Let `Intl.NumberFormat` determine the number format instead\n */\nfunction getLocaleNumberFormat(locale, type) {\n const data = ɵfindLocaleData(locale);\n return data[ɵLocaleDataIndex.NumberFormats][type];\n}\n/**\n * Retrieves the symbol used to represent the currency for the main country\n * corresponding to a given locale. For example, '$' for `en-US`.\n *\n * @param locale A locale code for the locale format rules to use.\n * @returns The localized symbol character,\n * or `null` if the main country cannot be determined.\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n *\n * @deprecated Use the `Intl` API to format a currency with from currency code\n */\nfunction getLocaleCurrencySymbol(locale) {\n const data = ɵfindLocaleData(locale);\n return data[ɵLocaleDataIndex.CurrencySymbol] || null;\n}\n/**\n * Retrieves the name of the currency for the main country corresponding\n * to a given locale. For example, 'US Dollar' for `en-US`.\n * @param locale A locale code for the locale format rules to use.\n * @returns The currency name,\n * or `null` if the main country cannot be determined.\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n *\n * @deprecated Use the `Intl` API to format a currency with from currency code\n */\nfunction getLocaleCurrencyName(locale) {\n const data = ɵfindLocaleData(locale);\n return data[ɵLocaleDataIndex.CurrencyName] || null;\n}\n/**\n * Retrieves the default currency code for the given locale.\n *\n * The default is defined as the first currency which is still in use.\n *\n * @param locale The code of the locale whose currency code we want.\n * @returns The code of the default currency for the given locale.\n *\n * @publicApi\n *\n * @deprecated We recommend you create a map of locale to ISO 4217 currency codes.\n * Time relative currency data is provided by the CLDR project. See https://www.unicode.org/cldr/charts/44/supplemental/detailed_territory_currency_information.html\n */\nfunction getLocaleCurrencyCode(locale) {\n return ɵgetLocaleCurrencyCode(locale);\n}\n/**\n * Retrieves the currency values for a given locale.\n * @param locale A locale code for the locale format rules to use.\n * @returns The currency values.\n * @see [Internationalization (i18n) Guide](guide/i18n)\n */\nfunction getLocaleCurrencies(locale) {\n const data = ɵfindLocaleData(locale);\n return data[ɵLocaleDataIndex.Currencies];\n}\n/**\n * @publicApi\n *\n * @deprecated Angular recommends relying on the `Intl` API for i18n.\n * Use `Intl.PluralRules` instead\n */\nconst getLocalePluralCase = ɵgetLocalePluralCase;\nfunction checkFullData(data) {\n if (!data[ɵLocaleDataIndex.ExtraData]) {\n throw new Error(`Missing extra locale data for the locale \"${data[ɵLocaleDataIndex.LocaleId]}\". Use \"registerLocaleData\" to load new data. See the \"I18n guide\" on angular.io to know more.`);\n }\n}\n/**\n * Retrieves locale-specific rules used to determine which day period to use\n * when more than one period is defined for a locale.\n *\n * There is a rule for each defined day period. The\n * first rule is applied to the first day period and so on.\n * Fall back to AM/PM when no rules are available.\n *\n * A rule can specify a period as time range, or as a single time value.\n *\n * This functionality is only available when you have loaded the full locale data.\n * See the [\"I18n guide\"](guide/i18n/format-data-locale).\n *\n * @param locale A locale code for the locale format rules to use.\n * @returns The rules for the locale, a single time value or array of *from-time, to-time*,\n * or null if no periods are available.\n *\n * @see {@link getLocaleExtraDayPeriods}\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n *\n * @deprecated Angular recommends relying on the `Intl` API for i18n.\n * Let `Intl.DateTimeFormat` determine the day period instead.\n */\nfunction getLocaleExtraDayPeriodRules(locale) {\n const data = ɵfindLocaleData(locale);\n checkFullData(data);\n const rules = data[ɵLocaleDataIndex.ExtraData][2 /* ɵExtraLocaleDataIndex.ExtraDayPeriodsRules */] || [];\n return rules.map((rule) => {\n if (typeof rule === 'string') {\n return extractTime(rule);\n }\n return [extractTime(rule[0]), extractTime(rule[1])];\n });\n}\n/**\n * Retrieves locale-specific day periods, which indicate roughly how a day is broken up\n * in different languages.\n * For example, for `en-US`, periods are morning, noon, afternoon, evening, and midnight.\n *\n * This functionality is only available when you have loaded the full locale data.\n * See the [\"I18n guide\"](guide/i18n/format-data-locale).\n *\n * @param locale A locale code for the locale format rules to use.\n * @param formStyle The required grammatical form.\n * @param width The required character width.\n * @returns The translated day-period strings.\n * @see {@link getLocaleExtraDayPeriodRules}\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n *\n * @deprecated Angular recommends relying on the `Intl` API for i18n.\n * To extract a day period use `Intl.DateTimeFormat` with the `dayPeriod` option instead.\n */\nfunction getLocaleExtraDayPeriods(locale, formStyle, width) {\n const data = ɵfindLocaleData(locale);\n checkFullData(data);\n const dayPeriodsData = [\n data[ɵLocaleDataIndex.ExtraData][0 /* ɵExtraLocaleDataIndex.ExtraDayPeriodFormats */],\n data[ɵLocaleDataIndex.ExtraData][1 /* ɵExtraLocaleDataIndex.ExtraDayPeriodStandalone */],\n ];\n const dayPeriods = getLastDefinedValue(dayPeriodsData, formStyle) || [];\n return getLastDefinedValue(dayPeriods, width) || [];\n}\n/**\n * Retrieves the writing direction of a specified locale\n * @param locale A locale code for the locale format rules to use.\n * @publicApi\n * @returns 'rtl' or 'ltr'\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @deprecated Angular recommends relying on the `Intl` API for i18n.\n * For dates and numbers, let `Intl.DateTimeFormat()` and `Intl.NumberFormat()` determine the writing direction.\n * The `Intl` alternative [`getTextInfo`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo).\n * has only partial support (Chromium M99 & Safari 17).\n * 3rd party alternatives like [`rtl-detect`](https://www.npmjs.com/package/rtl-detect) can work around this issue.\n */\nfunction getLocaleDirection(locale) {\n const data = ɵfindLocaleData(locale);\n return data[ɵLocaleDataIndex.Directionality];\n}\n/**\n * Retrieves the first value that is defined in an array, going backwards from an index position.\n *\n * To avoid repeating the same data (as when the \"format\" and \"standalone\" forms are the same)\n * add the first value to the locale data arrays, and add other values only if they are different.\n *\n * @param data The data array to retrieve from.\n * @param index A 0-based index into the array to start from.\n * @returns The value immediately before the given index position.\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n */\nfunction getLastDefinedValue(data, index) {\n for (let i = index; i > -1; i--) {\n if (typeof data[i] !== 'undefined') {\n return data[i];\n }\n }\n throw new Error('Locale data API: locale data undefined');\n}\n/**\n * Extracts the hours and minutes from a string like \"15:45\"\n */\nfunction extractTime(time) {\n const [h, m] = time.split(':');\n return { hours: +h, minutes: +m };\n}\n/**\n * Retrieves the currency symbol for a given currency code.\n *\n * For example, for the default `en-US` locale, the code `USD` can\n * be represented by the narrow symbol `$` or the wide symbol `US$`.\n *\n * @param code The currency code.\n * @param format The format, `wide` or `narrow`.\n * @param locale A locale code for the locale format rules to use.\n *\n * @returns The symbol, or the currency code if no symbol is available.\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n *\n * @deprecated Angular recommends relying on the `Intl` API for i18n.\n * You can use `Intl.NumberFormat().formatToParts()` to extract the currency symbol.\n * For example: `Intl.NumberFormat('en', {style:'currency', currency: 'USD'}).formatToParts().find(part => part.type === 'currency').value`\n * returns `$` for USD currency code in the `en` locale.\n * Note: `US$` is a currency symbol for the `en-ca` locale but not the `en-us` locale.\n */\nfunction getCurrencySymbol(code, format, locale = 'en') {\n const currency = getLocaleCurrencies(locale)[code] || CURRENCIES_EN[code] || [];\n const symbolNarrow = currency[1 /* ɵCurrencyIndex.SymbolNarrow */];\n if (format === 'narrow' && typeof symbolNarrow === 'string') {\n return symbolNarrow;\n }\n return currency[0 /* ɵCurrencyIndex.Symbol */] || code;\n}\n// Most currencies have cents, that's why the default is 2\nconst DEFAULT_NB_OF_CURRENCY_DIGITS = 2;\n/**\n * Reports the number of decimal digits for a given currency.\n * The value depends upon the presence of cents in that particular currency.\n *\n * @param code The currency code.\n * @returns The number of decimal digits, typically 0 or 2.\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n *\n * @deprecated Angular recommends relying on the `Intl` API for i18n.\n * This function should not be used anymore. Let `Intl.NumberFormat` determine the number of digits to display for the currency\n */\nfunction getNumberOfCurrencyDigits(code) {\n let digits;\n const currency = CURRENCIES_EN[code];\n if (currency) {\n digits = currency[2 /* ɵCurrencyIndex.NbOfDigits */];\n }\n return typeof digits === 'number' ? digits : DEFAULT_NB_OF_CURRENCY_DIGITS;\n}\n\nconst ISO8601_DATE_REGEX = /^(\\d{4,})-?(\\d\\d)-?(\\d\\d)(?:T(\\d\\d)(?::?(\\d\\d)(?::?(\\d\\d)(?:\\.(\\d+))?)?)?(Z|([+-])(\\d\\d):?(\\d\\d))?)?$/;\n// 1 2 3 4 5 6 7 8 9 10 11\nconst NAMED_FORMATS = {};\nconst DATE_FORMATS_SPLIT = /((?:[^BEGHLMOSWYZabcdhmswyz']+)|(?:'(?:[^']|'')*')|(?:G{1,5}|y{1,4}|Y{1,4}|M{1,5}|L{1,5}|w{1,2}|W{1}|d{1,2}|E{1,6}|c{1,6}|a{1,5}|b{1,5}|B{1,5}|h{1,2}|H{1,2}|m{1,2}|s{1,2}|S{1,3}|z{1,4}|Z{1,5}|O{1,4}))([\\s\\S]*)/;\nvar ZoneWidth;\n(function (ZoneWidth) {\n ZoneWidth[ZoneWidth[\"Short\"] = 0] = \"Short\";\n ZoneWidth[ZoneWidth[\"ShortGMT\"] = 1] = \"ShortGMT\";\n ZoneWidth[ZoneWidth[\"Long\"] = 2] = \"Long\";\n ZoneWidth[ZoneWidth[\"Extended\"] = 3] = \"Extended\";\n})(ZoneWidth || (ZoneWidth = {}));\nvar DateType;\n(function (DateType) {\n DateType[DateType[\"FullYear\"] = 0] = \"FullYear\";\n DateType[DateType[\"Month\"] = 1] = \"Month\";\n DateType[DateType[\"Date\"] = 2] = \"Date\";\n DateType[DateType[\"Hours\"] = 3] = \"Hours\";\n DateType[DateType[\"Minutes\"] = 4] = \"Minutes\";\n DateType[DateType[\"Seconds\"] = 5] = \"Seconds\";\n DateType[DateType[\"FractionalSeconds\"] = 6] = \"FractionalSeconds\";\n DateType[DateType[\"Day\"] = 7] = \"Day\";\n})(DateType || (DateType = {}));\nvar TranslationType;\n(function (TranslationType) {\n TranslationType[TranslationType[\"DayPeriods\"] = 0] = \"DayPeriods\";\n TranslationType[TranslationType[\"Days\"] = 1] = \"Days\";\n TranslationType[TranslationType[\"Months\"] = 2] = \"Months\";\n TranslationType[TranslationType[\"Eras\"] = 3] = \"Eras\";\n})(TranslationType || (TranslationType = {}));\n/**\n * @ngModule CommonModule\n * @description\n *\n * Formats a date according to locale rules.\n *\n * @param value The date to format, as a Date, or a number (milliseconds since UTC epoch)\n * or an [ISO date-time string](https://www.w3.org/TR/NOTE-datetime).\n * @param format The date-time components to include. See `DatePipe` for details.\n * @param locale A locale code for the locale format rules to use.\n * @param timezone The time zone. A time zone offset from GMT (such as `'+0430'`),\n * or a standard UTC/GMT or continental US time zone abbreviation.\n * If not specified, uses host system settings.\n *\n * @returns The formatted date string.\n *\n * @see {@link DatePipe}\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n */\nfunction formatDate(value, format, locale, timezone) {\n let date = toDate(value);\n const namedFormat = getNamedFormat(locale, format);\n format = namedFormat || format;\n let parts = [];\n let match;\n while (format) {\n match = DATE_FORMATS_SPLIT.exec(format);\n if (match) {\n parts = parts.concat(match.slice(1));\n const part = parts.pop();\n if (!part) {\n break;\n }\n format = part;\n }\n else {\n parts.push(format);\n break;\n }\n }\n let dateTimezoneOffset = date.getTimezoneOffset();\n if (timezone) {\n dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);\n date = convertTimezoneToLocal(date, timezone, true);\n }\n let text = '';\n parts.forEach((value) => {\n const dateFormatter = getDateFormatter(value);\n text += dateFormatter\n ? dateFormatter(date, locale, dateTimezoneOffset)\n : value === \"''\"\n ? \"'\"\n : value.replace(/(^'|'$)/g, '').replace(/''/g, \"'\");\n });\n return text;\n}\n/**\n * Create a new Date object with the given date value, and the time set to midnight.\n *\n * We cannot use `new Date(year, month, date)` because it maps years between 0 and 99 to 1900-1999.\n * See: https://github.com/angular/angular/issues/40377\n *\n * Note that this function returns a Date object whose time is midnight in the current locale's\n * timezone. In the future we might want to change this to be midnight in UTC, but this would be a\n * considerable breaking change.\n */\nfunction createDate(year, month, date) {\n // The `newDate` is set to midnight (UTC) on January 1st 1970.\n // - In PST this will be December 31st 1969 at 4pm.\n // - In GMT this will be January 1st 1970 at 1am.\n // Note that they even have different years, dates and months!\n const newDate = new Date(0);\n // `setFullYear()` allows years like 0001 to be set correctly. This function does not\n // change the internal time of the date.\n // Consider calling `setFullYear(2019, 8, 20)` (September 20, 2019).\n // - In PST this will now be September 20, 2019 at 4pm\n // - In GMT this will now be September 20, 2019 at 1am\n newDate.setFullYear(year, month, date);\n // We want the final date to be at local midnight, so we reset the time.\n // - In PST this will now be September 20, 2019 at 12am\n // - In GMT this will now be September 20, 2019 at 12am\n newDate.setHours(0, 0, 0);\n return newDate;\n}\nfunction getNamedFormat(locale, format) {\n const localeId = getLocaleId(locale);\n NAMED_FORMATS[localeId] ??= {};\n if (NAMED_FORMATS[localeId][format]) {\n return NAMED_FORMATS[localeId][format];\n }\n let formatValue = '';\n switch (format) {\n case 'shortDate':\n formatValue = getLocaleDateFormat(locale, FormatWidth.Short);\n break;\n case 'mediumDate':\n formatValue = getLocaleDateFormat(locale, FormatWidth.Medium);\n break;\n case 'longDate':\n formatValue = getLocaleDateFormat(locale, FormatWidth.Long);\n break;\n case 'fullDate':\n formatValue = getLocaleDateFormat(locale, FormatWidth.Full);\n break;\n case 'shortTime':\n formatValue = getLocaleTimeFormat(locale, FormatWidth.Short);\n break;\n case 'mediumTime':\n formatValue = getLocaleTimeFormat(locale, FormatWidth.Medium);\n break;\n case 'longTime':\n formatValue = getLocaleTimeFormat(locale, FormatWidth.Long);\n break;\n case 'fullTime':\n formatValue = getLocaleTimeFormat(locale, FormatWidth.Full);\n break;\n case 'short':\n const shortTime = getNamedFormat(locale, 'shortTime');\n const shortDate = getNamedFormat(locale, 'shortDate');\n formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Short), [\n shortTime,\n shortDate,\n ]);\n break;\n case 'medium':\n const mediumTime = getNamedFormat(locale, 'mediumTime');\n const mediumDate = getNamedFormat(locale, 'mediumDate');\n formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Medium), [\n mediumTime,\n mediumDate,\n ]);\n break;\n case 'long':\n const longTime = getNamedFormat(locale, 'longTime');\n const longDate = getNamedFormat(locale, 'longDate');\n formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Long), [\n longTime,\n longDate,\n ]);\n break;\n case 'full':\n const fullTime = getNamedFormat(locale, 'fullTime');\n const fullDate = getNamedFormat(locale, 'fullDate');\n formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Full), [\n fullTime,\n fullDate,\n ]);\n break;\n }\n if (formatValue) {\n NAMED_FORMATS[localeId][format] = formatValue;\n }\n return formatValue;\n}\nfunction formatDateTime(str, opt_values) {\n if (opt_values) {\n str = str.replace(/\\{([^}]+)}/g, function (match, key) {\n return opt_values != null && key in opt_values ? opt_values[key] : match;\n });\n }\n return str;\n}\nfunction padNumber(num, digits, minusSign = '-', trim, negWrap) {\n let neg = '';\n if (num < 0 || (negWrap && num <= 0)) {\n if (negWrap) {\n num = -num + 1;\n }\n else {\n num = -num;\n neg = minusSign;\n }\n }\n let strNum = String(num);\n while (strNum.length < digits) {\n strNum = '0' + strNum;\n }\n if (trim) {\n strNum = strNum.slice(strNum.length - digits);\n }\n return neg + strNum;\n}\nfunction formatFractionalSeconds(milliseconds, digits) {\n const strMs = padNumber(milliseconds, 3);\n return strMs.substring(0, digits);\n}\n/**\n * Returns a date formatter that transforms a date into its locale digit representation\n */\nfunction dateGetter(name, size, offset = 0, trim = false, negWrap = false) {\n return function (date, locale) {\n let part = getDatePart(name, date);\n if (offset > 0 || part > -offset) {\n part += offset;\n }\n if (name === DateType.Hours) {\n if (part === 0 && offset === -12) {\n part = 12;\n }\n }\n else if (name === DateType.FractionalSeconds) {\n return formatFractionalSeconds(part, size);\n }\n const localeMinus = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);\n return padNumber(part, size, localeMinus, trim, negWrap);\n };\n}\nfunction getDatePart(part, date) {\n switch (part) {\n case DateType.FullYear:\n return date.getFullYear();\n case DateType.Month:\n return date.getMonth();\n case DateType.Date:\n return date.getDate();\n case DateType.Hours:\n return date.getHours();\n case DateType.Minutes:\n return date.getMinutes();\n case DateType.Seconds:\n return date.getSeconds();\n case DateType.FractionalSeconds:\n return date.getMilliseconds();\n case DateType.Day:\n return date.getDay();\n default:\n throw new Error(`Unknown DateType value \"${part}\".`);\n }\n}\n/**\n * Returns a date formatter that transforms a date into its locale string representation\n */\nfunction dateStrGetter(name, width, form = FormStyle.Format, extended = false) {\n return function (date, locale) {\n return getDateTranslation(date, locale, name, width, form, extended);\n };\n}\n/**\n * Returns the locale translation of a date for a given form, type and width\n */\nfunction getDateTranslation(date, locale, name, width, form, extended) {\n switch (name) {\n case TranslationType.Months:\n return getLocaleMonthNames(locale, form, width)[date.getMonth()];\n case TranslationType.Days:\n return getLocaleDayNames(locale, form, width)[date.getDay()];\n case TranslationType.DayPeriods:\n const currentHours = date.getHours();\n const currentMinutes = date.getMinutes();\n if (extended) {\n const rules = getLocaleExtraDayPeriodRules(locale);\n const dayPeriods = getLocaleExtraDayPeriods(locale, form, width);\n const index = rules.findIndex((rule) => {\n if (Array.isArray(rule)) {\n // morning, afternoon, evening, night\n const [from, to] = rule;\n const afterFrom = currentHours >= from.hours && currentMinutes >= from.minutes;\n const beforeTo = currentHours < to.hours || (currentHours === to.hours && currentMinutes < to.minutes);\n // We must account for normal rules that span a period during the day (e.g. 6am-9am)\n // where `from` is less (earlier) than `to`. But also rules that span midnight (e.g.\n // 10pm - 5am) where `from` is greater (later!) than `to`.\n //\n // In the first case the current time must be BOTH after `from` AND before `to`\n // (e.g. 8am is after 6am AND before 10am).\n //\n // In the second case the current time must be EITHER after `from` OR before `to`\n // (e.g. 4am is before 5am but not after 10pm; and 11pm is not before 5am but it is\n // after 10pm).\n if (from.hours < to.hours) {\n if (afterFrom && beforeTo) {\n return true;\n }\n }\n else if (afterFrom || beforeTo) {\n return true;\n }\n }\n else {\n // noon or midnight\n if (rule.hours === currentHours && rule.minutes === currentMinutes) {\n return true;\n }\n }\n return false;\n });\n if (index !== -1) {\n return dayPeriods[index];\n }\n }\n // if no rules for the day periods, we use am/pm by default\n return getLocaleDayPeriods(locale, form, width)[currentHours < 12 ? 0 : 1];\n case TranslationType.Eras:\n return getLocaleEraNames(locale, width)[date.getFullYear() <= 0 ? 0 : 1];\n default:\n // This default case is not needed by TypeScript compiler, as the switch is exhaustive.\n // However Closure Compiler does not understand that and reports an error in typed mode.\n // The `throw new Error` below works around the problem, and the unexpected: never variable\n // makes sure tsc still checks this code is unreachable.\n const unexpected = name;\n throw new Error(`unexpected translation type ${unexpected}`);\n }\n}\n/**\n * Returns a date formatter that transforms a date and an offset into a timezone with ISO8601 or\n * GMT format depending on the width (eg: short = +0430, short:GMT = GMT+4, long = GMT+04:30,\n * extended = +04:30)\n */\nfunction timeZoneGetter(width) {\n return function (date, locale, offset) {\n const zone = -1 * offset;\n const minusSign = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);\n const hours = zone > 0 ? Math.floor(zone / 60) : Math.ceil(zone / 60);\n switch (width) {\n case ZoneWidth.Short:\n return ((zone >= 0 ? '+' : '') +\n padNumber(hours, 2, minusSign) +\n padNumber(Math.abs(zone % 60), 2, minusSign));\n case ZoneWidth.ShortGMT:\n return 'GMT' + (zone >= 0 ? '+' : '') + padNumber(hours, 1, minusSign);\n case ZoneWidth.Long:\n return ('GMT' +\n (zone >= 0 ? '+' : '') +\n padNumber(hours, 2, minusSign) +\n ':' +\n padNumber(Math.abs(zone % 60), 2, minusSign));\n case ZoneWidth.Extended:\n if (offset === 0) {\n return 'Z';\n }\n else {\n return ((zone >= 0 ? '+' : '') +\n padNumber(hours, 2, minusSign) +\n ':' +\n padNumber(Math.abs(zone % 60), 2, minusSign));\n }\n default:\n throw new Error(`Unknown zone width \"${width}\"`);\n }\n };\n}\nconst JANUARY = 0;\nconst THURSDAY = 4;\nfunction getFirstThursdayOfYear(year) {\n const firstDayOfYear = createDate(year, JANUARY, 1).getDay();\n return createDate(year, 0, 1 + (firstDayOfYear <= THURSDAY ? THURSDAY : THURSDAY + 7) - firstDayOfYear);\n}\n/**\n * ISO Week starts on day 1 (Monday) and ends with day 0 (Sunday)\n */\nfunction getThursdayThisIsoWeek(datetime) {\n // getDay returns 0-6 range with sunday as 0.\n const currentDay = datetime.getDay();\n // On a Sunday, read the previous Thursday since ISO weeks start on Monday.\n const deltaToThursday = currentDay === 0 ? -3 : THURSDAY - currentDay;\n return createDate(datetime.getFullYear(), datetime.getMonth(), datetime.getDate() + deltaToThursday);\n}\nfunction weekGetter(size, monthBased = false) {\n return function (date, locale) {\n let result;\n if (monthBased) {\n const nbDaysBefore1stDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1).getDay() - 1;\n const today = date.getDate();\n result = 1 + Math.floor((today + nbDaysBefore1stDayOfMonth) / 7);\n }\n else {\n const thisThurs = getThursdayThisIsoWeek(date);\n // Some days of a year are part of next year according to ISO 8601.\n // Compute the firstThurs from the year of this week's Thursday\n const firstThurs = getFirstThursdayOfYear(thisThurs.getFullYear());\n const diff = thisThurs.getTime() - firstThurs.getTime();\n result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week\n }\n return padNumber(result, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));\n };\n}\n/**\n * Returns a date formatter that provides the week-numbering year for the input date.\n */\nfunction weekNumberingYearGetter(size, trim = false) {\n return function (date, locale) {\n const thisThurs = getThursdayThisIsoWeek(date);\n const weekNumberingYear = thisThurs.getFullYear();\n return padNumber(weekNumberingYear, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign), trim);\n };\n}\nconst DATE_FORMATS = {};\n// Based on CLDR formats:\n// See complete list: http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n// See also explanations: http://cldr.unicode.org/translation/date-time\n// TODO(ocombe): support all missing cldr formats: U, Q, D, F, e, j, J, C, A, v, V, X, x\nfunction getDateFormatter(format) {\n if (DATE_FORMATS[format]) {\n return DATE_FORMATS[format];\n }\n let formatter;\n switch (format) {\n // Era name (AD/BC)\n case 'G':\n case 'GG':\n case 'GGG':\n formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Abbreviated);\n break;\n case 'GGGG':\n formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Wide);\n break;\n case 'GGGGG':\n formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Narrow);\n break;\n // 1 digit representation of the year, e.g. (AD 1 => 1, AD 199 => 199)\n case 'y':\n formatter = dateGetter(DateType.FullYear, 1, 0, false, true);\n break;\n // 2 digit representation of the year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)\n case 'yy':\n formatter = dateGetter(DateType.FullYear, 2, 0, true, true);\n break;\n // 3 digit representation of the year, padded (000-999). (e.g. AD 2001 => 01, AD 2010 => 10)\n case 'yyy':\n formatter = dateGetter(DateType.FullYear, 3, 0, false, true);\n break;\n // 4 digit representation of the year (e.g. AD 1 => 0001, AD 2010 => 2010)\n case 'yyyy':\n formatter = dateGetter(DateType.FullYear, 4, 0, false, true);\n break;\n // 1 digit representation of the week-numbering year, e.g. (AD 1 => 1, AD 199 => 199)\n case 'Y':\n formatter = weekNumberingYearGetter(1);\n break;\n // 2 digit representation of the week-numbering year, padded (00-99). (e.g. AD 2001 => 01, AD\n // 2010 => 10)\n case 'YY':\n formatter = weekNumberingYearGetter(2, true);\n break;\n // 3 digit representation of the week-numbering year, padded (000-999). (e.g. AD 1 => 001, AD\n // 2010 => 2010)\n case 'YYY':\n formatter = weekNumberingYearGetter(3);\n break;\n // 4 digit representation of the week-numbering year (e.g. AD 1 => 0001, AD 2010 => 2010)\n case 'YYYY':\n formatter = weekNumberingYearGetter(4);\n break;\n // Month of the year (1-12), numeric\n case 'M':\n case 'L':\n formatter = dateGetter(DateType.Month, 1, 1);\n break;\n case 'MM':\n case 'LL':\n formatter = dateGetter(DateType.Month, 2, 1);\n break;\n // Month of the year (January, ...), string, format\n case 'MMM':\n formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated);\n break;\n case 'MMMM':\n formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Wide);\n break;\n case 'MMMMM':\n formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Narrow);\n break;\n // Month of the year (January, ...), string, standalone\n case 'LLL':\n formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated, FormStyle.Standalone);\n break;\n case 'LLLL':\n formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Wide, FormStyle.Standalone);\n break;\n case 'LLLLL':\n formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Narrow, FormStyle.Standalone);\n break;\n // Week of the year (1, ... 52)\n case 'w':\n formatter = weekGetter(1);\n break;\n case 'ww':\n formatter = weekGetter(2);\n break;\n // Week of the month (1, ...)\n case 'W':\n formatter = weekGetter(1, true);\n break;\n // Day of the month (1-31)\n case 'd':\n formatter = dateGetter(DateType.Date, 1);\n break;\n case 'dd':\n formatter = dateGetter(DateType.Date, 2);\n break;\n // Day of the Week StandAlone (1, 1, Mon, Monday, M, Mo)\n case 'c':\n case 'cc':\n formatter = dateGetter(DateType.Day, 1);\n break;\n case 'ccc':\n formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Abbreviated, FormStyle.Standalone);\n break;\n case 'cccc':\n formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Wide, FormStyle.Standalone);\n break;\n case 'ccccc':\n formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Narrow, FormStyle.Standalone);\n break;\n case 'cccccc':\n formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Short, FormStyle.Standalone);\n break;\n // Day of the Week\n case 'E':\n case 'EE':\n case 'EEE':\n formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Abbreviated);\n break;\n case 'EEEE':\n formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Wide);\n break;\n case 'EEEEE':\n formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Narrow);\n break;\n case 'EEEEEE':\n formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Short);\n break;\n // Generic period of the day (am-pm)\n case 'a':\n case 'aa':\n case 'aaa':\n formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated);\n break;\n case 'aaaa':\n formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide);\n break;\n case 'aaaaa':\n formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow);\n break;\n // Extended period of the day (midnight, at night, ...), standalone\n case 'b':\n case 'bb':\n case 'bbb':\n formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Standalone, true);\n break;\n case 'bbbb':\n formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Standalone, true);\n break;\n case 'bbbbb':\n formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Standalone, true);\n break;\n // Extended period of the day (midnight, night, ...), standalone\n case 'B':\n case 'BB':\n case 'BBB':\n formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Format, true);\n break;\n case 'BBBB':\n formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Format, true);\n break;\n case 'BBBBB':\n formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Format, true);\n break;\n // Hour in AM/PM, (1-12)\n case 'h':\n formatter = dateGetter(DateType.Hours, 1, -12);\n break;\n case 'hh':\n formatter = dateGetter(DateType.Hours, 2, -12);\n break;\n // Hour of the day (0-23)\n case 'H':\n formatter = dateGetter(DateType.Hours, 1);\n break;\n // Hour in day, padded (00-23)\n case 'HH':\n formatter = dateGetter(DateType.Hours, 2);\n break;\n // Minute of the hour (0-59)\n case 'm':\n formatter = dateGetter(DateType.Minutes, 1);\n break;\n case 'mm':\n formatter = dateGetter(DateType.Minutes, 2);\n break;\n // Second of the minute (0-59)\n case 's':\n formatter = dateGetter(DateType.Seconds, 1);\n break;\n case 'ss':\n formatter = dateGetter(DateType.Seconds, 2);\n break;\n // Fractional second\n case 'S':\n formatter = dateGetter(DateType.FractionalSeconds, 1);\n break;\n case 'SS':\n formatter = dateGetter(DateType.FractionalSeconds, 2);\n break;\n case 'SSS':\n formatter = dateGetter(DateType.FractionalSeconds, 3);\n break;\n // Timezone ISO8601 short format (-0430)\n case 'Z':\n case 'ZZ':\n case 'ZZZ':\n formatter = timeZoneGetter(ZoneWidth.Short);\n break;\n // Timezone ISO8601 extended format (-04:30)\n case 'ZZZZZ':\n formatter = timeZoneGetter(ZoneWidth.Extended);\n break;\n // Timezone GMT short format (GMT+4)\n case 'O':\n case 'OO':\n case 'OOO':\n // Should be location, but fallback to format O instead because we don't have the data yet\n case 'z':\n case 'zz':\n case 'zzz':\n formatter = timeZoneGetter(ZoneWidth.ShortGMT);\n break;\n // Timezone GMT long format (GMT+0430)\n case 'OOOO':\n case 'ZZZZ':\n // Should be location, but fallback to format O instead because we don't have the data yet\n case 'zzzz':\n formatter = timeZoneGetter(ZoneWidth.Long);\n break;\n default:\n return null;\n }\n DATE_FORMATS[format] = formatter;\n return formatter;\n}\nfunction timezoneToOffset(timezone, fallback) {\n // Support: IE 11 only, Edge 13-15+\n // IE/Edge do not \"understand\" colon (`:`) in timezone\n timezone = timezone.replace(/:/g, '');\n const requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;\n return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;\n}\nfunction addDateMinutes(date, minutes) {\n date = new Date(date.getTime());\n date.setMinutes(date.getMinutes() + minutes);\n return date;\n}\nfunction convertTimezoneToLocal(date, timezone, reverse) {\n const reverseValue = reverse ? -1 : 1;\n const dateTimezoneOffset = date.getTimezoneOffset();\n const timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);\n return addDateMinutes(date, reverseValue * (timezoneOffset - dateTimezoneOffset));\n}\n/**\n * Converts a value to date.\n *\n * Supported input formats:\n * - `Date`\n * - number: timestamp\n * - string: numeric (e.g. \"1234\"), ISO and date strings in a format supported by\n * [Date.parse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse).\n * Note: ISO strings without time return a date without timeoffset.\n *\n * Throws if unable to convert to a date.\n */\nfunction toDate(value) {\n if (isDate(value)) {\n return value;\n }\n if (typeof value === 'number' && !isNaN(value)) {\n return new Date(value);\n }\n if (typeof value === 'string') {\n value = value.trim();\n if (/^(\\d{4}(-\\d{1,2}(-\\d{1,2})?)?)$/.test(value)) {\n /* For ISO Strings without time the day, month and year must be extracted from the ISO String\n before Date creation to avoid time offset and errors in the new Date.\n If we only replace '-' with ',' in the ISO String (\"2015,01,01\"), and try to create a new\n date, some browsers (e.g. IE 9) will throw an invalid Date error.\n If we leave the '-' (\"2015-01-01\") and try to create a new Date(\"2015-01-01\") the timeoffset\n is applied.\n Note: ISO months are 0 for January, 1 for February, ... */\n const [y, m = 1, d = 1] = value.split('-').map((val) => +val);\n return createDate(y, m - 1, d);\n }\n const parsedNb = parseFloat(value);\n // any string that only contains numbers, like \"1234\" but not like \"1234hello\"\n if (!isNaN(value - parsedNb)) {\n return new Date(parsedNb);\n }\n let match;\n if ((match = value.match(ISO8601_DATE_REGEX))) {\n return isoStringToDate(match);\n }\n }\n const date = new Date(value);\n if (!isDate(date)) {\n throw new Error(`Unable to convert \"${value}\" into a date`);\n }\n return date;\n}\n/**\n * Converts a date in ISO8601 to a Date.\n * Used instead of `Date.parse` because of browser discrepancies.\n */\nfunction isoStringToDate(match) {\n const date = new Date(0);\n let tzHour = 0;\n let tzMin = 0;\n // match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\n const dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;\n const timeSetter = match[8] ? date.setUTCHours : date.setHours;\n // if there is a timezone defined like \"+01:00\" or \"+0100\"\n if (match[9]) {\n tzHour = Number(match[9] + match[10]);\n tzMin = Number(match[9] + match[11]);\n }\n dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n const h = Number(match[4] || 0) - tzHour;\n const m = Number(match[5] || 0) - tzMin;\n const s = Number(match[6] || 0);\n // The ECMAScript specification (https://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.11)\n // defines that `DateTime` milliseconds should always be rounded down, so that `999.9ms`\n // becomes `999ms`.\n const ms = Math.floor(parseFloat('0.' + (match[7] || 0)) * 1000);\n timeSetter.call(date, h, m, s, ms);\n return date;\n}\nfunction isDate(value) {\n return value instanceof Date && !isNaN(value.valueOf());\n}\n\nconst NUMBER_FORMAT_REGEXP = /^(\\d+)?\\.((\\d+)(-(\\d+))?)?$/;\nconst MAX_DIGITS = 22;\nconst DECIMAL_SEP = '.';\nconst ZERO_CHAR = '0';\nconst PATTERN_SEP = ';';\nconst GROUP_SEP = ',';\nconst DIGIT_CHAR = '#';\nconst CURRENCY_CHAR = '¤';\nconst PERCENT_CHAR = '%';\n/**\n * Transforms a number to a locale string based on a style and a format.\n */\nfunction formatNumberToLocaleString(value, pattern, locale, groupSymbol, decimalSymbol, digitsInfo, isPercent = false) {\n let formattedText = '';\n let isZero = false;\n if (!isFinite(value)) {\n formattedText = getLocaleNumberSymbol(locale, NumberSymbol.Infinity);\n }\n else {\n let parsedNumber = parseNumber(value);\n if (isPercent) {\n parsedNumber = toPercent(parsedNumber);\n }\n let minInt = pattern.minInt;\n let minFraction = pattern.minFrac;\n let maxFraction = pattern.maxFrac;\n if (digitsInfo) {\n const parts = digitsInfo.match(NUMBER_FORMAT_REGEXP);\n if (parts === null) {\n throw new Error(`${digitsInfo} is not a valid digit info`);\n }\n const minIntPart = parts[1];\n const minFractionPart = parts[3];\n const maxFractionPart = parts[5];\n if (minIntPart != null) {\n minInt = parseIntAutoRadix(minIntPart);\n }\n if (minFractionPart != null) {\n minFraction = parseIntAutoRadix(minFractionPart);\n }\n if (maxFractionPart != null) {\n maxFraction = parseIntAutoRadix(maxFractionPart);\n }\n else if (minFractionPart != null && minFraction > maxFraction) {\n maxFraction = minFraction;\n }\n }\n roundNumber(parsedNumber, minFraction, maxFraction);\n let digits = parsedNumber.digits;\n let integerLen = parsedNumber.integerLen;\n const exponent = parsedNumber.exponent;\n let decimals = [];\n isZero = digits.every((d) => !d);\n // pad zeros for small numbers\n for (; integerLen < minInt; integerLen++) {\n digits.unshift(0);\n }\n // pad zeros for small numbers\n for (; integerLen < 0; integerLen++) {\n digits.unshift(0);\n }\n // extract decimals digits\n if (integerLen > 0) {\n decimals = digits.splice(integerLen, digits.length);\n }\n else {\n decimals = digits;\n digits = [0];\n }\n // format the integer digits with grouping separators\n const groups = [];\n if (digits.length >= pattern.lgSize) {\n groups.unshift(digits.splice(-pattern.lgSize, digits.length).join(''));\n }\n while (digits.length > pattern.gSize) {\n groups.unshift(digits.splice(-pattern.gSize, digits.length).join(''));\n }\n if (digits.length) {\n groups.unshift(digits.join(''));\n }\n formattedText = groups.join(getLocaleNumberSymbol(locale, groupSymbol));\n // append the decimal digits\n if (decimals.length) {\n formattedText += getLocaleNumberSymbol(locale, decimalSymbol) + decimals.join('');\n }\n if (exponent) {\n formattedText += getLocaleNumberSymbol(locale, NumberSymbol.Exponential) + '+' + exponent;\n }\n }\n if (value < 0 && !isZero) {\n formattedText = pattern.negPre + formattedText + pattern.negSuf;\n }\n else {\n formattedText = pattern.posPre + formattedText + pattern.posSuf;\n }\n return formattedText;\n}\n/**\n * @ngModule CommonModule\n * @description\n *\n * Formats a number as currency using locale rules.\n *\n * @param value The number to format.\n * @param locale A locale code for the locale format rules to use.\n * @param currency A string containing the currency symbol or its name,\n * such as \"$\" or \"Canadian Dollar\". Used in output string, but does not affect the operation\n * of the function.\n * @param currencyCode The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)\n * currency code, such as `USD` for the US dollar and `EUR` for the euro.\n * Used to determine the number of digits in the decimal part.\n * @param digitsInfo Decimal representation options, specified by a string in the following format:\n * `{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}`. See `DecimalPipe` for more details.\n *\n * @returns The formatted currency value.\n *\n * @see {@link formatNumber}\n * @see {@link DecimalPipe}\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n */\nfunction formatCurrency(value, locale, currency, currencyCode, digitsInfo) {\n const format = getLocaleNumberFormat(locale, NumberFormatStyle.Currency);\n const pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));\n pattern.minFrac = getNumberOfCurrencyDigits(currencyCode);\n pattern.maxFrac = pattern.minFrac;\n const res = formatNumberToLocaleString(value, pattern, locale, NumberSymbol.CurrencyGroup, NumberSymbol.CurrencyDecimal, digitsInfo);\n return (res\n .replace(CURRENCY_CHAR, currency)\n // if we have 2 time the currency character, the second one is ignored\n .replace(CURRENCY_CHAR, '')\n // If there is a spacing between currency character and the value and\n // the currency character is suppressed by passing an empty string, the\n // spacing character would remain as part of the string. Then we\n // should remove it.\n .trim());\n}\n/**\n * @ngModule CommonModule\n * @description\n *\n * Formats a number as a percentage according to locale rules.\n *\n * @param value The number to format.\n * @param locale A locale code for the locale format rules to use.\n * @param digitsInfo Decimal representation options, specified by a string in the following format:\n * `{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}`. See `DecimalPipe` for more details.\n *\n * @returns The formatted percentage value.\n *\n * @see {@link formatNumber}\n * @see {@link DecimalPipe}\n * @see [Internationalization (i18n) Guide](guide/i18n)\n * @publicApi\n *\n */\nfunction formatPercent(value, locale, digitsInfo) {\n const format = getLocaleNumberFormat(locale, NumberFormatStyle.Percent);\n const pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));\n const res = formatNumberToLocaleString(value, pattern, locale, NumberSymbol.Group, NumberSymbol.Decimal, digitsInfo, true);\n return res.replace(new RegExp(PERCENT_CHAR, 'g'), getLocaleNumberSymbol(locale, NumberSymbol.PercentSign));\n}\n/**\n * @ngModule CommonModule\n * @description\n *\n * Formats a number as text, with group sizing, separator, and other\n * parameters based on the locale.\n *\n * @param value The number to format.\n * @param locale A locale code for the locale format rules to use.\n * @param digitsInfo Decimal representation options, specified by a string in the following format:\n * `{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}`. See `DecimalPipe` for more details.\n *\n * @returns The formatted text string.\n * @see [Internationalization (i18n) Guide](guide/i18n)\n *\n * @publicApi\n */\nfunction formatNumber(value, locale, digitsInfo) {\n const format = getLocaleNumberFormat(locale, NumberFormatStyle.Decimal);\n const pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));\n return formatNumberToLocaleString(value, pattern, locale, NumberSymbol.Group, NumberSymbol.Decimal, digitsInfo);\n}\nfunction parseNumberFormat(format, minusSign = '-') {\n const p = {\n minInt: 1,\n minFrac: 0,\n maxFrac: 0,\n posPre: '',\n posSuf: '',\n negPre: '',\n negSuf: '',\n gSize: 0,\n lgSize: 0,\n };\n const patternParts = format.split(PATTERN_SEP);\n const positive = patternParts[0];\n const negative = patternParts[1];\n const positiveParts = positive.indexOf(DECIMAL_SEP) !== -1\n ? positive.split(DECIMAL_SEP)\n : [\n positive.substring(0, positive.lastIndexOf(ZERO_CHAR) + 1),\n positive.substring(positive.lastIndexOf(ZERO_CHAR) + 1),\n ], integer = positiveParts[0], fraction = positiveParts[1] || '';\n p.posPre = integer.substring(0, integer.indexOf(DIGIT_CHAR));\n for (let i = 0; i < fraction.length; i++) {\n const ch = fraction.charAt(i);\n if (ch === ZERO_CHAR) {\n p.minFrac = p.maxFrac = i + 1;\n }\n else if (ch === DIGIT_CHAR) {\n p.maxFrac = i + 1;\n }\n else {\n p.posSuf += ch;\n }\n }\n const groups = integer.split(GROUP_SEP);\n p.gSize = groups[1] ? groups[1].length : 0;\n p.lgSize = groups[2] || groups[1] ? (groups[2] || groups[1]).length : 0;\n if (negative) {\n const trunkLen = positive.length - p.posPre.length - p.posSuf.length, pos = negative.indexOf(DIGIT_CHAR);\n p.negPre = negative.substring(0, pos).replace(/'/g, '');\n p.negSuf = negative.slice(pos + trunkLen).replace(/'/g, '');\n }\n else {\n p.negPre = minusSign + p.posPre;\n p.negSuf = p.posSuf;\n }\n return p;\n}\n// Transforms a parsed number into a percentage by multiplying it by 100\nfunction toPercent(parsedNumber) {\n // if the number is 0, don't do anything\n if (parsedNumber.digits[0] === 0) {\n return parsedNumber;\n }\n // Getting the current number of decimals\n const fractionLen = parsedNumber.digits.length - parsedNumber.integerLen;\n if (parsedNumber.exponent) {\n parsedNumber.exponent += 2;\n }\n else {\n if (fractionLen === 0) {\n parsedNumber.digits.push(0, 0);\n }\n else if (fractionLen === 1) {\n parsedNumber.digits.push(0);\n }\n parsedNumber.integerLen += 2;\n }\n return parsedNumber;\n}\n/**\n * Parses a number.\n * Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/\n */\nfunction parseNumber(num) {\n let numStr = Math.abs(num) + '';\n let exponent = 0, digits, integerLen;\n let i, j, zeros;\n // Decimal point?\n if ((integerLen = numStr.indexOf(DECIMAL_SEP)) > -1) {\n numStr = numStr.replace(DECIMAL_SEP, '');\n }\n // Exponential form?\n if ((i = numStr.search(/e/i)) > 0) {\n // Work out the exponent.\n if (integerLen < 0)\n integerLen = i;\n integerLen += +numStr.slice(i + 1);\n numStr = numStr.substring(0, i);\n }\n else if (integerLen < 0) {\n // There was no decimal point or exponent so it is an integer.\n integerLen = numStr.length;\n }\n // Count the number of leading zeros.\n for (i = 0; numStr.charAt(i) === ZERO_CHAR; i++) {\n /* empty */\n }\n if (i === (zeros = numStr.length)) {\n // The digits are all zero.\n digits = [0];\n integerLen = 1;\n }\n else {\n // Count the number of trailing zeros\n zeros--;\n while (numStr.charAt(zeros) === ZERO_CHAR)\n zeros--;\n // Trailing zeros are insignificant so ignore them\n integerLen -= i;\n digits = [];\n // Convert string to array of digits without leading/trailing zeros.\n for (j = 0; i <= zeros; i++, j++) {\n digits[j] = Number(numStr.charAt(i));\n }\n }\n // If the number overflows the maximum allowed digits then use an exponent.\n if (integerLen > MAX_DIGITS) {\n digits = digits.splice(0, MAX_DIGITS - 1);\n exponent = integerLen - 1;\n integerLen = 1;\n }\n return { digits, exponent, integerLen };\n}\n/**\n * Round the parsed number to the specified number of decimal places\n * This function changes the parsedNumber in-place\n */\nfunction roundNumber(parsedNumber, minFrac, maxFrac) {\n if (minFrac > maxFrac) {\n throw new Error(`The minimum number of digits after fraction (${minFrac}) is higher than the maximum (${maxFrac}).`);\n }\n let digits = parsedNumber.digits;\n let fractionLen = digits.length - parsedNumber.integerLen;\n const fractionSize = Math.min(Math.max(minFrac, fractionLen), maxFrac);\n // The index of the digit to where rounding is to occur\n let roundAt = fractionSize + parsedNumber.integerLen;\n let digit = digits[roundAt];\n if (roundAt > 0) {\n // Drop fractional digits beyond `roundAt`\n digits.splice(Math.max(parsedNumber.integerLen, roundAt));\n // Set non-fractional digits beyond `roundAt` to 0\n for (let j = roundAt; j < digits.length; j++) {\n digits[j] = 0;\n }\n }\n else {\n // We rounded to zero so reset the parsedNumber\n fractionLen = Math.max(0, fractionLen);\n parsedNumber.integerLen = 1;\n digits.length = Math.max(1, (roundAt = fractionSize + 1));\n digits[0] = 0;\n for (let i = 1; i < roundAt; i++)\n digits[i] = 0;\n }\n if (digit >= 5) {\n if (roundAt - 1 < 0) {\n for (let k = 0; k > roundAt; k--) {\n digits.unshift(0);\n parsedNumber.integerLen++;\n }\n digits.unshift(1);\n parsedNumber.integerLen++;\n }\n else {\n digits[roundAt - 1]++;\n }\n }\n // Pad out with zeros to get the required fraction length\n for (; fractionLen < Math.max(0, fractionSize); fractionLen++)\n digits.push(0);\n let dropTrailingZeros = fractionSize !== 0;\n // Minimal length = nb of decimals required + current nb of integers\n // Any number besides that is optional and can be removed if it's a trailing 0\n const minLen = minFrac + parsedNumber.integerLen;\n // Do any carrying, e.g. a digit was rounded up to 10\n const carry = digits.reduceRight(function (carry, d, i, digits) {\n d = d + carry;\n digits[i] = d < 10 ? d : d - 10; // d % 10\n if (dropTrailingZeros) {\n // Do not keep meaningless fractional trailing zeros (e.g. 15.52000 --> 15.52)\n if (digits[i] === 0 && i >= minLen) {\n digits.pop();\n }\n else {\n dropTrailingZeros = false;\n }\n }\n return d >= 10 ? 1 : 0; // Math.floor(d / 10);\n }, 0);\n if (carry) {\n digits.unshift(carry);\n parsedNumber.integerLen++;\n }\n}\nfunction parseIntAutoRadix(text) {\n const result = parseInt(text);\n if (isNaN(result)) {\n throw new Error('Invalid integer literal when parsing ' + text);\n }\n return result;\n}\n\n/**\n * @publicApi\n */\nclass NgLocalization {\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgLocalization, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgLocalization, providedIn: 'root', useFactory: (locale) => new NgLocaleLocalization(locale), deps: [{ token: LOCALE_ID }] }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgLocalization, decorators: [{\n type: Injectable,\n args: [{\n providedIn: 'root',\n useFactory: (locale) => new NgLocaleLocalization(locale),\n deps: [LOCALE_ID],\n }]\n }] });\n/**\n * Returns the plural category for a given value.\n * - \"=value\" when the case exists,\n * - the plural category otherwise\n */\nfunction getPluralCategory(value, cases, ngLocalization, locale) {\n let key = `=${value}`;\n if (cases.indexOf(key) > -1) {\n return key;\n }\n key = ngLocalization.getPluralCategory(value, locale);\n if (cases.indexOf(key) > -1) {\n return key;\n }\n if (cases.indexOf('other') > -1) {\n return 'other';\n }\n throw new Error(`No plural message found for value \"${value}\"`);\n}\n/**\n * Returns the plural case based on the locale\n *\n * @publicApi\n */\nclass NgLocaleLocalization extends NgLocalization {\n constructor(locale) {\n super();\n this.locale = locale;\n }\n getPluralCategory(value, locale) {\n const plural = getLocalePluralCase(locale || this.locale)(value);\n switch (plural) {\n case Plural.Zero:\n return 'zero';\n case Plural.One:\n return 'one';\n case Plural.Two:\n return 'two';\n case Plural.Few:\n return 'few';\n case Plural.Many:\n return 'many';\n default:\n return 'other';\n }\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgLocaleLocalization, deps: [{ token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgLocaleLocalization }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgLocaleLocalization, decorators: [{\n type: Injectable\n }], ctorParameters: () => [{ type: undefined, decorators: [{\n type: Inject,\n args: [LOCALE_ID]\n }] }] });\n\n/**\n * Register global data to be used internally by Angular. See the\n * [\"I18n guide\"](guide/i18n/format-data-locale) to know how to import additional locale\n * data.\n *\n * The signature registerLocaleData(data: any, extraData?: any) is deprecated since v5.1\n *\n * @publicApi\n */\nfunction registerLocaleData(data, localeId, extraData) {\n return ɵregisterLocaleData(data, localeId, extraData);\n}\n\nfunction parseCookieValue(cookieStr, name) {\n name = encodeURIComponent(name);\n for (const cookie of cookieStr.split(';')) {\n const eqIndex = cookie.indexOf('=');\n const [cookieName, cookieValue] = eqIndex == -1 ? [cookie, ''] : [cookie.slice(0, eqIndex), cookie.slice(eqIndex + 1)];\n if (cookieName.trim() === name) {\n return decodeURIComponent(cookieValue);\n }\n }\n return null;\n}\n\nconst WS_REGEXP = /\\s+/;\nconst EMPTY_ARRAY = [];\n/**\n * @ngModule CommonModule\n *\n * @usageNotes\n * ```\n * ...\n *\n * ...\n *\n * ...\n *\n * ...\n *\n * ...\n * ```\n *\n * @description\n *\n * Adds and removes CSS classes on an HTML element.\n *\n * The CSS classes are updated as follows, depending on the type of the expression evaluation:\n * - `string` - the CSS classes listed in the string (space delimited) are added,\n * - `Array` - the CSS classes declared as Array elements are added,\n * - `Object` - keys are CSS classes that get added when the expression given in the value\n * evaluates to a truthy value, otherwise they are removed.\n *\n * @publicApi\n */\nclass NgClass {\n constructor(_ngEl, _renderer) {\n this._ngEl = _ngEl;\n this._renderer = _renderer;\n this.initialClasses = EMPTY_ARRAY;\n this.stateMap = new Map();\n }\n set klass(value) {\n this.initialClasses = value != null ? value.trim().split(WS_REGEXP) : EMPTY_ARRAY;\n }\n set ngClass(value) {\n this.rawClass = typeof value === 'string' ? value.trim().split(WS_REGEXP) : value;\n }\n /*\n The NgClass directive uses the custom change detection algorithm for its inputs. The custom\n algorithm is necessary since inputs are represented as complex object or arrays that need to be\n deeply-compared.\n \n This algorithm is perf-sensitive since NgClass is used very frequently and its poor performance\n might negatively impact runtime performance of the entire change detection cycle. The design of\n this algorithm is making sure that:\n - there is no unnecessary DOM manipulation (CSS classes are added / removed from the DOM only when\n needed), even if references to bound objects change;\n - there is no memory allocation if nothing changes (even relatively modest memory allocation\n during the change detection cycle can result in GC pauses for some of the CD cycles).\n \n The algorithm works by iterating over the set of bound classes, staring with [class] binding and\n then going over [ngClass] binding. For each CSS class name:\n - check if it was seen before (this information is tracked in the state map) and if its value\n changed;\n - mark it as \"touched\" - names that are not marked are not present in the latest set of binding\n and we can remove such class name from the internal data structures;\n \n After iteration over all the CSS class names we've got data structure with all the information\n necessary to synchronize changes to the DOM - it is enough to iterate over the state map, flush\n changes to the DOM and reset internal data structures so those are ready for the next change\n detection cycle.\n */\n ngDoCheck() {\n // classes from the [class] binding\n for (const klass of this.initialClasses) {\n this._updateState(klass, true);\n }\n // classes from the [ngClass] binding\n const rawClass = this.rawClass;\n if (Array.isArray(rawClass) || rawClass instanceof Set) {\n for (const klass of rawClass) {\n this._updateState(klass, true);\n }\n }\n else if (rawClass != null) {\n for (const klass of Object.keys(rawClass)) {\n this._updateState(klass, Boolean(rawClass[klass]));\n }\n }\n this._applyStateDiff();\n }\n _updateState(klass, nextEnabled) {\n const state = this.stateMap.get(klass);\n if (state !== undefined) {\n if (state.enabled !== nextEnabled) {\n state.changed = true;\n state.enabled = nextEnabled;\n }\n state.touched = true;\n }\n else {\n this.stateMap.set(klass, { enabled: nextEnabled, changed: true, touched: true });\n }\n }\n _applyStateDiff() {\n for (const stateEntry of this.stateMap) {\n const klass = stateEntry[0];\n const state = stateEntry[1];\n if (state.changed) {\n this._toggleClass(klass, state.enabled);\n state.changed = false;\n }\n else if (!state.touched) {\n // A class that was previously active got removed from the new collection of classes -\n // remove from the DOM as well.\n if (state.enabled) {\n this._toggleClass(klass, false);\n }\n this.stateMap.delete(klass);\n }\n state.touched = false;\n }\n }\n _toggleClass(klass, enabled) {\n if (ngDevMode) {\n if (typeof klass !== 'string') {\n throw new Error(`NgClass can only toggle CSS classes expressed as strings, got ${ɵstringify(klass)}`);\n }\n }\n klass = klass.trim();\n if (klass.length > 0) {\n klass.split(WS_REGEXP).forEach((klass) => {\n if (enabled) {\n this._renderer.addClass(this._ngEl.nativeElement, klass);\n }\n else {\n this._renderer.removeClass(this._ngEl.nativeElement, klass);\n }\n });\n }\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgClass, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.6\", type: NgClass, isStandalone: true, selector: \"[ngClass]\", inputs: { klass: [\"class\", \"klass\"], ngClass: \"ngClass\" }, ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgClass, decorators: [{\n type: Directive,\n args: [{\n selector: '[ngClass]',\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { klass: [{\n type: Input,\n args: ['class']\n }], ngClass: [{\n type: Input,\n args: ['ngClass']\n }] } });\n\n/**\n * Instantiates a {@link Component} type and inserts its Host View into the current View.\n * `NgComponentOutlet` provides a declarative approach for dynamic component creation.\n *\n * `NgComponentOutlet` requires a component type, if a falsy value is set the view will clear and\n * any existing component will be destroyed.\n *\n * @usageNotes\n *\n * ### Fine tune control\n *\n * You can control the component creation process by using the following optional attributes:\n *\n * * `ngComponentOutletInputs`: Optional component inputs object, which will be bind to the\n * component.\n *\n * * `ngComponentOutletInjector`: Optional custom {@link Injector} that will be used as parent for\n * the Component. Defaults to the injector of the current view container.\n *\n * * `ngComponentOutletContent`: Optional list of projectable nodes to insert into the content\n * section of the component, if it exists.\n *\n * * `ngComponentOutletNgModule`: Optional NgModule class reference to allow loading another\n * module dynamically, then loading a component from that module.\n *\n * * `ngComponentOutletNgModuleFactory`: Deprecated config option that allows providing optional\n * NgModule factory to allow loading another module dynamically, then loading a component from that\n * module. Use `ngComponentOutletNgModule` instead.\n *\n * ### Syntax\n *\n * Simple\n * ```\n * \n * ```\n *\n * With inputs\n * ```\n * \n * \n * ```\n *\n * Customized injector/content\n * ```\n * \n * \n * ```\n *\n * Customized NgModule reference\n * ```\n * \n * \n * ```\n *\n * ### A simple example\n *\n * {@example common/ngComponentOutlet/ts/module.ts region='SimpleExample'}\n *\n * A more complete example with additional options:\n *\n * {@example common/ngComponentOutlet/ts/module.ts region='CompleteExample'}\n *\n * @publicApi\n * @ngModule CommonModule\n */\nclass NgComponentOutlet {\n constructor(_viewContainerRef) {\n this._viewContainerRef = _viewContainerRef;\n this.ngComponentOutlet = null;\n /**\n * A helper data structure that allows us to track inputs that were part of the\n * ngComponentOutletInputs expression. Tracking inputs is necessary for proper removal of ones\n * that are no longer referenced.\n */\n this._inputsUsed = new Map();\n }\n _needToReCreateNgModuleInstance(changes) {\n // Note: square brackets property accessor is safe for Closure compiler optimizations (the\n // `changes` argument of the `ngOnChanges` lifecycle hook retains the names of the fields that\n // were changed).\n return (changes['ngComponentOutletNgModule'] !== undefined ||\n changes['ngComponentOutletNgModuleFactory'] !== undefined);\n }\n _needToReCreateComponentInstance(changes) {\n // Note: square brackets property accessor is safe for Closure compiler optimizations (the\n // `changes` argument of the `ngOnChanges` lifecycle hook retains the names of the fields that\n // were changed).\n return (changes['ngComponentOutlet'] !== undefined ||\n changes['ngComponentOutletContent'] !== undefined ||\n changes['ngComponentOutletInjector'] !== undefined ||\n this._needToReCreateNgModuleInstance(changes));\n }\n /** @nodoc */\n ngOnChanges(changes) {\n if (this._needToReCreateComponentInstance(changes)) {\n this._viewContainerRef.clear();\n this._inputsUsed.clear();\n this._componentRef = undefined;\n if (this.ngComponentOutlet) {\n const injector = this.ngComponentOutletInjector || this._viewContainerRef.parentInjector;\n if (this._needToReCreateNgModuleInstance(changes)) {\n this._moduleRef?.destroy();\n if (this.ngComponentOutletNgModule) {\n this._moduleRef = createNgModule(this.ngComponentOutletNgModule, getParentInjector(injector));\n }\n else if (this.ngComponentOutletNgModuleFactory) {\n this._moduleRef = this.ngComponentOutletNgModuleFactory.create(getParentInjector(injector));\n }\n else {\n this._moduleRef = undefined;\n }\n }\n this._componentRef = this._viewContainerRef.createComponent(this.ngComponentOutlet, {\n injector,\n ngModuleRef: this._moduleRef,\n projectableNodes: this.ngComponentOutletContent,\n });\n }\n }\n }\n /** @nodoc */\n ngDoCheck() {\n if (this._componentRef) {\n if (this.ngComponentOutletInputs) {\n for (const inputName of Object.keys(this.ngComponentOutletInputs)) {\n this._inputsUsed.set(inputName, true);\n }\n }\n this._applyInputStateDiff(this._componentRef);\n }\n }\n /** @nodoc */\n ngOnDestroy() {\n this._moduleRef?.destroy();\n }\n _applyInputStateDiff(componentRef) {\n for (const [inputName, touched] of this._inputsUsed) {\n if (!touched) {\n // The input that was previously active no longer exists and needs to be set to undefined.\n componentRef.setInput(inputName, undefined);\n this._inputsUsed.delete(inputName);\n }\n else {\n // Since touched is true, it can be asserted that the inputs object is not empty.\n componentRef.setInput(inputName, this.ngComponentOutletInputs[inputName]);\n this._inputsUsed.set(inputName, false);\n }\n }\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgComponentOutlet, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.6\", type: NgComponentOutlet, isStandalone: true, selector: \"[ngComponentOutlet]\", inputs: { ngComponentOutlet: \"ngComponentOutlet\", ngComponentOutletInputs: \"ngComponentOutletInputs\", ngComponentOutletInjector: \"ngComponentOutletInjector\", ngComponentOutletContent: \"ngComponentOutletContent\", ngComponentOutletNgModule: \"ngComponentOutletNgModule\", ngComponentOutletNgModuleFactory: \"ngComponentOutletNgModuleFactory\" }, usesOnChanges: true, ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgComponentOutlet, decorators: [{\n type: Directive,\n args: [{\n selector: '[ngComponentOutlet]',\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: i0.ViewContainerRef }], propDecorators: { ngComponentOutlet: [{\n type: Input\n }], ngComponentOutletInputs: [{\n type: Input\n }], ngComponentOutletInjector: [{\n type: Input\n }], ngComponentOutletContent: [{\n type: Input\n }], ngComponentOutletNgModule: [{\n type: Input\n }], ngComponentOutletNgModuleFactory: [{\n type: Input\n }] } });\n// Helper function that returns an Injector instance of a parent NgModule.\nfunction getParentInjector(injector) {\n const parentNgModule = injector.get(NgModuleRef);\n return parentNgModule.injector;\n}\n\n/**\n * @publicApi\n */\nclass NgForOfContext {\n constructor($implicit, ngForOf, index, count) {\n this.$implicit = $implicit;\n this.ngForOf = ngForOf;\n this.index = index;\n this.count = count;\n }\n get first() {\n return this.index === 0;\n }\n get last() {\n return this.index === this.count - 1;\n }\n get even() {\n return this.index % 2 === 0;\n }\n get odd() {\n return !this.even;\n }\n}\n/**\n * A [structural directive](guide/directives/structural-directives) that renders\n * a template for each item in a collection.\n * The directive is placed on an element, which becomes the parent\n * of the cloned templates.\n *\n * The `ngForOf` directive is generally used in the\n * [shorthand form](guide/directives/structural-directives#asterisk) `*ngFor`.\n * In this form, the template to be rendered for each iteration is the content\n * of an anchor element containing the directive.\n *\n * The following example shows the shorthand syntax with some options,\n * contained in an `
  • ` element.\n *\n * ```\n *
  • ...
  • \n * ```\n *\n * The shorthand form expands into a long form that uses the `ngForOf` selector\n * on an `` element.\n * The content of the `` element is the `
  • ` element that held the\n * short-form directive.\n *\n * Here is the expanded version of the short-form example.\n *\n * ```\n * \n *
  • ...
  • \n *
    \n * ```\n *\n * Angular automatically expands the shorthand syntax as it compiles the template.\n * The context for each embedded view is logically merged to the current component\n * context according to its lexical position.\n *\n * When using the shorthand syntax, Angular allows only [one structural directive\n * on an element](guide/directives/structural-directives#one-per-element).\n * If you want to iterate conditionally, for example,\n * put the `*ngIf` on a container element that wraps the `*ngFor` element.\n * For further discussion, see\n * [Structural Directives](guide/directives/structural-directives#one-per-element).\n *\n * @usageNotes\n *\n * ### Local variables\n *\n * `NgForOf` provides exported values that can be aliased to local variables.\n * For example:\n *\n * ```\n *
  • \n * {{i}}/{{users.length}}. {{user}} default\n *
  • \n * ```\n *\n * The following exported values can be aliased to local variables:\n *\n * - `$implicit: T`: The value of the individual items in the iterable (`ngForOf`).\n * - `ngForOf: NgIterable`: The value of the iterable expression. Useful when the expression is\n * more complex then a property access, for example when using the async pipe (`userStreams |\n * async`).\n * - `index: number`: The index of the current item in the iterable.\n * - `count: number`: The length of the iterable.\n * - `first: boolean`: True when the item is the first item in the iterable.\n * - `last: boolean`: True when the item is the last item in the iterable.\n * - `even: boolean`: True when the item has an even index in the iterable.\n * - `odd: boolean`: True when the item has an odd index in the iterable.\n *\n * ### Change propagation\n *\n * When the contents of the iterator changes, `NgForOf` makes the corresponding changes to the DOM:\n *\n * * When an item is added, a new instance of the template is added to the DOM.\n * * When an item is removed, its template instance is removed from the DOM.\n * * When items are reordered, their respective templates are reordered in the DOM.\n *\n * Angular uses object identity to track insertions and deletions within the iterator and reproduce\n * those changes in the DOM. This has important implications for animations and any stateful\n * controls that are present, such as `` elements that accept user input. Inserted rows can\n * be animated in, deleted rows can be animated out, and unchanged rows retain any unsaved state\n * such as user input.\n * For more on animations, see [Transitions and Triggers](guide/animations/transition-and-triggers).\n *\n * The identities of elements in the iterator can change while the data does not.\n * This can happen, for example, if the iterator is produced from an RPC to the server, and that\n * RPC is re-run. Even if the data hasn't changed, the second response produces objects with\n * different identities, and Angular must tear down the entire DOM and rebuild it (as if all old\n * elements were deleted and all new elements inserted).\n *\n * To avoid this expensive operation, you can customize the default tracking algorithm.\n * by supplying the `trackBy` option to `NgForOf`.\n * `trackBy` takes a function that has two arguments: `index` and `item`.\n * If `trackBy` is given, Angular tracks changes by the return value of the function.\n *\n * @see [Structural Directives](guide/directives/structural-directives)\n * @ngModule CommonModule\n * @publicApi\n */\nclass NgForOf {\n /**\n * The value of the iterable expression, which can be used as a\n * [template input variable](guide/directives/structural-directives#shorthand).\n */\n set ngForOf(ngForOf) {\n this._ngForOf = ngForOf;\n this._ngForOfDirty = true;\n }\n /**\n * Specifies a custom `TrackByFunction` to compute the identity of items in an iterable.\n *\n * If a custom `TrackByFunction` is not provided, `NgForOf` will use the item's [object\n * identity](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is)\n * as the key.\n *\n * `NgForOf` uses the computed key to associate items in an iterable with DOM elements\n * it produces for these items.\n *\n * A custom `TrackByFunction` is useful to provide good user experience in cases when items in an\n * iterable rendered using `NgForOf` have a natural identifier (for example, custom ID or a\n * primary key), and this iterable could be updated with new object instances that still\n * represent the same underlying entity (for example, when data is re-fetched from the server,\n * and the iterable is recreated and re-rendered, but most of the data is still the same).\n *\n * @see {@link TrackByFunction}\n */\n set ngForTrackBy(fn) {\n if ((typeof ngDevMode === 'undefined' || ngDevMode) && fn != null && typeof fn !== 'function') {\n console.warn(`trackBy must be a function, but received ${JSON.stringify(fn)}. ` +\n `See https://angular.io/api/common/NgForOf#change-propagation for more information.`);\n }\n this._trackByFn = fn;\n }\n get ngForTrackBy() {\n return this._trackByFn;\n }\n constructor(_viewContainer, _template, _differs) {\n this._viewContainer = _viewContainer;\n this._template = _template;\n this._differs = _differs;\n this._ngForOf = null;\n this._ngForOfDirty = true;\n this._differ = null;\n }\n /**\n * A reference to the template that is stamped out for each item in the iterable.\n * @see [template reference variable](guide/templates/reference-variables)\n */\n set ngForTemplate(value) {\n // TODO(TS2.1): make TemplateRef>> once we move to TS v2.1\n // The current type is too restrictive; a template that just uses index, for example,\n // should be acceptable.\n if (value) {\n this._template = value;\n }\n }\n /**\n * Applies the changes when needed.\n * @nodoc\n */\n ngDoCheck() {\n if (this._ngForOfDirty) {\n this._ngForOfDirty = false;\n // React on ngForOf changes only once all inputs have been initialized\n const value = this._ngForOf;\n if (!this._differ && value) {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n try {\n // CAUTION: this logic is duplicated for production mode below, as the try-catch\n // is only present in development builds.\n this._differ = this._differs.find(value).create(this.ngForTrackBy);\n }\n catch {\n let errorMessage = `Cannot find a differ supporting object '${value}' of type '` +\n `${getTypeName(value)}'. NgFor only supports binding to Iterables, such as Arrays.`;\n if (typeof value === 'object') {\n errorMessage += ' Did you mean to use the keyvalue pipe?';\n }\n throw new ɵRuntimeError(-2200 /* RuntimeErrorCode.NG_FOR_MISSING_DIFFER */, errorMessage);\n }\n }\n else {\n // CAUTION: this logic is duplicated for development mode above, as the try-catch\n // is only present in development builds.\n this._differ = this._differs.find(value).create(this.ngForTrackBy);\n }\n }\n }\n if (this._differ) {\n const changes = this._differ.diff(this._ngForOf);\n if (changes)\n this._applyChanges(changes);\n }\n }\n _applyChanges(changes) {\n const viewContainer = this._viewContainer;\n changes.forEachOperation((item, adjustedPreviousIndex, currentIndex) => {\n if (item.previousIndex == null) {\n // NgForOf is never \"null\" or \"undefined\" here because the differ detected\n // that a new item needs to be inserted from the iterable. This implies that\n // there is an iterable value for \"_ngForOf\".\n viewContainer.createEmbeddedView(this._template, new NgForOfContext(item.item, this._ngForOf, -1, -1), currentIndex === null ? undefined : currentIndex);\n }\n else if (currentIndex == null) {\n viewContainer.remove(adjustedPreviousIndex === null ? undefined : adjustedPreviousIndex);\n }\n else if (adjustedPreviousIndex !== null) {\n const view = viewContainer.get(adjustedPreviousIndex);\n viewContainer.move(view, currentIndex);\n applyViewChange(view, item);\n }\n });\n for (let i = 0, ilen = viewContainer.length; i < ilen; i++) {\n const viewRef = viewContainer.get(i);\n const context = viewRef.context;\n context.index = i;\n context.count = ilen;\n context.ngForOf = this._ngForOf;\n }\n changes.forEachIdentityChange((record) => {\n const viewRef = viewContainer.get(record.currentIndex);\n applyViewChange(viewRef, record);\n });\n }\n /**\n * Asserts the correct type of the context for the template that `NgForOf` will render.\n *\n * The presence of this method is a signal to the Ivy template type-check compiler that the\n * `NgForOf` structural directive renders its template with a specific context type.\n */\n static ngTemplateContextGuard(dir, ctx) {\n return true;\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgForOf, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }, { token: i0.IterableDiffers }], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.6\", type: NgForOf, isStandalone: true, selector: \"[ngFor][ngForOf]\", inputs: { ngForOf: \"ngForOf\", ngForTrackBy: \"ngForTrackBy\", ngForTemplate: \"ngForTemplate\" }, ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgForOf, decorators: [{\n type: Directive,\n args: [{\n selector: '[ngFor][ngForOf]',\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }, { type: i0.IterableDiffers }], propDecorators: { ngForOf: [{\n type: Input\n }], ngForTrackBy: [{\n type: Input\n }], ngForTemplate: [{\n type: Input\n }] } });\nfunction applyViewChange(view, record) {\n view.context.$implicit = record.item;\n}\nfunction getTypeName(type) {\n return type['name'] || typeof type;\n}\n\n/**\n * A structural directive that conditionally includes a template based on the value of\n * an expression coerced to Boolean.\n * When the expression evaluates to true, Angular renders the template\n * provided in a `then` clause, and when false or null,\n * Angular renders the template provided in an optional `else` clause. The default\n * template for the `else` clause is blank.\n *\n * A [shorthand form](guide/directives/structural-directives#asterisk) of the directive,\n * `*ngIf=\"condition\"`, is generally used, provided\n * as an attribute of the anchor element for the inserted template.\n * Angular expands this into a more explicit version, in which the anchor element\n * is contained in an `` element.\n *\n * Simple form with shorthand syntax:\n *\n * ```\n *
    Content to render when condition is true.
    \n * ```\n *\n * Simple form with expanded syntax:\n *\n * ```\n *
    Content to render when condition is\n * true.
    \n * ```\n *\n * Form with an \"else\" block:\n *\n * ```\n *
    Content to render when condition is true.
    \n * Content to render when condition is false.\n * ```\n *\n * Shorthand form with \"then\" and \"else\" blocks:\n *\n * ```\n *
    \n * Content to render when condition is true.\n * Content to render when condition is false.\n * ```\n *\n * Form with storing the value locally:\n *\n * ```\n *
    {{value}}
    \n * Content to render when value is null.\n * ```\n *\n * @usageNotes\n *\n * The `*ngIf` directive is most commonly used to conditionally show an inline template,\n * as seen in the following example.\n * The default `else` template is blank.\n *\n * {@example common/ngIf/ts/module.ts region='NgIfSimple'}\n *\n * ### Showing an alternative template using `else`\n *\n * To display a template when `expression` evaluates to false, use an `else` template\n * binding as shown in the following example.\n * The `else` binding points to an `` element labeled `#elseBlock`.\n * The template can be defined anywhere in the component view, but is typically placed right after\n * `ngIf` for readability.\n *\n * {@example common/ngIf/ts/module.ts region='NgIfElse'}\n *\n * ### Using an external `then` template\n *\n * In the previous example, the then-clause template is specified inline, as the content of the\n * tag that contains the `ngIf` directive. You can also specify a template that is defined\n * externally, by referencing a labeled `` element. When you do this, you can\n * change which template to use at runtime, as shown in the following example.\n *\n * {@example common/ngIf/ts/module.ts region='NgIfThenElse'}\n *\n * ### Storing a conditional result in a variable\n *\n * You might want to show a set of properties from the same object. If you are waiting\n * for asynchronous data, the object can be undefined.\n * In this case, you can use `ngIf` and store the result of the condition in a local\n * variable as shown in the following example.\n *\n * {@example common/ngIf/ts/module.ts region='NgIfAs'}\n *\n * This code uses only one `AsyncPipe`, so only one subscription is created.\n * The conditional statement stores the result of `userStream|async` in the local variable `user`.\n * You can then bind the local `user` repeatedly.\n *\n * The conditional displays the data only if `userStream` returns a value,\n * so you don't need to use the\n * safe-navigation-operator (`?.`)\n * to guard against null values when accessing properties.\n * You can display an alternative template while waiting for the data.\n *\n * ### Shorthand syntax\n *\n * The shorthand syntax `*ngIf` expands into two separate template specifications\n * for the \"then\" and \"else\" clauses. For example, consider the following shorthand statement,\n * that is meant to show a loading page while waiting for data to be loaded.\n *\n * ```\n *
    \n * ...\n *
    \n *\n * \n *
    Loading...
    \n *
    \n * ```\n *\n * You can see that the \"else\" clause references the ``\n * with the `#loading` label, and the template for the \"then\" clause\n * is provided as the content of the anchor element.\n *\n * However, when Angular expands the shorthand syntax, it creates\n * another `` tag, with `ngIf` and `ngIfElse` directives.\n * The anchor element containing the template for the \"then\" clause becomes\n * the content of this unlabeled `` tag.\n *\n * ```\n * \n *
    \n * ...\n *
    \n *
    \n *\n * \n *
    Loading...
    \n *
    \n * ```\n *\n * The presence of the implicit template object has implications for the nesting of\n * structural directives. For more on this subject, see\n * [Structural Directives](guide/directives/structural-directives#one-per-element).\n *\n * @ngModule CommonModule\n * @publicApi\n */\nclass NgIf {\n constructor(_viewContainer, templateRef) {\n this._viewContainer = _viewContainer;\n this._context = new NgIfContext();\n this._thenTemplateRef = null;\n this._elseTemplateRef = null;\n this._thenViewRef = null;\n this._elseViewRef = null;\n this._thenTemplateRef = templateRef;\n }\n /**\n * The Boolean expression to evaluate as the condition for showing a template.\n */\n set ngIf(condition) {\n this._context.$implicit = this._context.ngIf = condition;\n this._updateView();\n }\n /**\n * A template to show if the condition expression evaluates to true.\n */\n set ngIfThen(templateRef) {\n assertTemplate('ngIfThen', templateRef);\n this._thenTemplateRef = templateRef;\n this._thenViewRef = null; // clear previous view if any.\n this._updateView();\n }\n /**\n * A template to show if the condition expression evaluates to false.\n */\n set ngIfElse(templateRef) {\n assertTemplate('ngIfElse', templateRef);\n this._elseTemplateRef = templateRef;\n this._elseViewRef = null; // clear previous view if any.\n this._updateView();\n }\n _updateView() {\n if (this._context.$implicit) {\n if (!this._thenViewRef) {\n this._viewContainer.clear();\n this._elseViewRef = null;\n if (this._thenTemplateRef) {\n this._thenViewRef = this._viewContainer.createEmbeddedView(this._thenTemplateRef, this._context);\n }\n }\n }\n else {\n if (!this._elseViewRef) {\n this._viewContainer.clear();\n this._thenViewRef = null;\n if (this._elseTemplateRef) {\n this._elseViewRef = this._viewContainer.createEmbeddedView(this._elseTemplateRef, this._context);\n }\n }\n }\n }\n /**\n * Asserts the correct type of the context for the template that `NgIf` will render.\n *\n * The presence of this method is a signal to the Ivy template type-check compiler that the\n * `NgIf` structural directive renders its template with a specific context type.\n */\n static ngTemplateContextGuard(dir, ctx) {\n return true;\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgIf, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.6\", type: NgIf, isStandalone: true, selector: \"[ngIf]\", inputs: { ngIf: \"ngIf\", ngIfThen: \"ngIfThen\", ngIfElse: \"ngIfElse\" }, ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgIf, decorators: [{\n type: Directive,\n args: [{\n selector: '[ngIf]',\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }], propDecorators: { ngIf: [{\n type: Input\n }], ngIfThen: [{\n type: Input\n }], ngIfElse: [{\n type: Input\n }] } });\n/**\n * @publicApi\n */\nclass NgIfContext {\n constructor() {\n this.$implicit = null;\n this.ngIf = null;\n }\n}\nfunction assertTemplate(property, templateRef) {\n const isTemplateRefOrNull = !!(!templateRef || templateRef.createEmbeddedView);\n if (!isTemplateRefOrNull) {\n throw new Error(`${property} must be a TemplateRef, but received '${ɵstringify(templateRef)}'.`);\n }\n}\n\nclass SwitchView {\n constructor(_viewContainerRef, _templateRef) {\n this._viewContainerRef = _viewContainerRef;\n this._templateRef = _templateRef;\n this._created = false;\n }\n create() {\n this._created = true;\n this._viewContainerRef.createEmbeddedView(this._templateRef);\n }\n destroy() {\n this._created = false;\n this._viewContainerRef.clear();\n }\n enforceState(created) {\n if (created && !this._created) {\n this.create();\n }\n else if (!created && this._created) {\n this.destroy();\n }\n }\n}\n/**\n * @ngModule CommonModule\n *\n * @description\n * The `[ngSwitch]` directive on a container specifies an expression to match against.\n * The expressions to match are provided by `ngSwitchCase` directives on views within the container.\n * - Every view that matches is rendered.\n * - If there are no matches, a view with the `ngSwitchDefault` directive is rendered.\n * - Elements within the `[NgSwitch]` statement but outside of any `NgSwitchCase`\n * or `ngSwitchDefault` directive are preserved at the location.\n *\n * @usageNotes\n * Define a container element for the directive, and specify the switch expression\n * to match against as an attribute:\n *\n * ```\n * \n * ```\n *\n * Within the container, `*ngSwitchCase` statements specify the match expressions\n * as attributes. Include `*ngSwitchDefault` as the final case.\n *\n * ```\n * \n * ...\n * ...\n * ...\n * \n * ```\n *\n * ### Usage Examples\n *\n * The following example shows how to use more than one case to display the same view:\n *\n * ```\n * \n * \n * ...\n * ...\n * ...\n * \n * ...\n * \n * ```\n *\n * The following example shows how cases can be nested:\n * ```\n * \n * ...\n * ...\n * ...\n * \n * \n * \n * \n * \n * ...\n * \n * ```\n *\n * @publicApi\n * @see {@link NgSwitchCase}\n * @see {@link NgSwitchDefault}\n * @see [Structural Directives](guide/directives/structural-directives)\n *\n */\nclass NgSwitch {\n constructor() {\n this._defaultViews = [];\n this._defaultUsed = false;\n this._caseCount = 0;\n this._lastCaseCheckIndex = 0;\n this._lastCasesMatched = false;\n }\n set ngSwitch(newValue) {\n this._ngSwitch = newValue;\n if (this._caseCount === 0) {\n this._updateDefaultCases(true);\n }\n }\n /** @internal */\n _addCase() {\n return this._caseCount++;\n }\n /** @internal */\n _addDefault(view) {\n this._defaultViews.push(view);\n }\n /** @internal */\n _matchCase(value) {\n const matched = value === this._ngSwitch;\n this._lastCasesMatched ||= matched;\n this._lastCaseCheckIndex++;\n if (this._lastCaseCheckIndex === this._caseCount) {\n this._updateDefaultCases(!this._lastCasesMatched);\n this._lastCaseCheckIndex = 0;\n this._lastCasesMatched = false;\n }\n return matched;\n }\n _updateDefaultCases(useDefault) {\n if (this._defaultViews.length > 0 && useDefault !== this._defaultUsed) {\n this._defaultUsed = useDefault;\n for (const defaultView of this._defaultViews) {\n defaultView.enforceState(useDefault);\n }\n }\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgSwitch, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.6\", type: NgSwitch, isStandalone: true, selector: \"[ngSwitch]\", inputs: { ngSwitch: \"ngSwitch\" }, ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgSwitch, decorators: [{\n type: Directive,\n args: [{\n selector: '[ngSwitch]',\n standalone: true,\n }]\n }], propDecorators: { ngSwitch: [{\n type: Input\n }] } });\n/**\n * @ngModule CommonModule\n *\n * @description\n * Provides a switch case expression to match against an enclosing `ngSwitch` expression.\n * When the expressions match, the given `NgSwitchCase` template is rendered.\n * If multiple match expressions match the switch expression value, all of them are displayed.\n *\n * @usageNotes\n *\n * Within a switch container, `*ngSwitchCase` statements specify the match expressions\n * as attributes. Include `*ngSwitchDefault` as the final case.\n *\n * ```\n * \n * ...\n * ...\n * ...\n * \n * ```\n *\n * Each switch-case statement contains an in-line HTML template or template reference\n * that defines the subtree to be selected if the value of the match expression\n * matches the value of the switch expression.\n *\n * As of Angular v17 the NgSwitch directive uses strict equality comparison (`===`) instead of\n * loose equality (`==`) to match different cases.\n *\n * @publicApi\n * @see {@link NgSwitch}\n * @see {@link NgSwitchDefault}\n *\n */\nclass NgSwitchCase {\n constructor(viewContainer, templateRef, ngSwitch) {\n this.ngSwitch = ngSwitch;\n if ((typeof ngDevMode === 'undefined' || ngDevMode) && !ngSwitch) {\n throwNgSwitchProviderNotFoundError('ngSwitchCase', 'NgSwitchCase');\n }\n ngSwitch._addCase();\n this._view = new SwitchView(viewContainer, templateRef);\n }\n /**\n * Performs case matching. For internal use only.\n * @nodoc\n */\n ngDoCheck() {\n this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase));\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgSwitchCase, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }, { token: NgSwitch, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.6\", type: NgSwitchCase, isStandalone: true, selector: \"[ngSwitchCase]\", inputs: { ngSwitchCase: \"ngSwitchCase\" }, ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgSwitchCase, decorators: [{\n type: Directive,\n args: [{\n selector: '[ngSwitchCase]',\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }, { type: NgSwitch, decorators: [{\n type: Optional\n }, {\n type: Host\n }] }], propDecorators: { ngSwitchCase: [{\n type: Input\n }] } });\n/**\n * @ngModule CommonModule\n *\n * @description\n *\n * Creates a view that is rendered when no `NgSwitchCase` expressions\n * match the `NgSwitch` expression.\n * This statement should be the final case in an `NgSwitch`.\n *\n * @publicApi\n * @see {@link NgSwitch}\n * @see {@link NgSwitchCase}\n *\n */\nclass NgSwitchDefault {\n constructor(viewContainer, templateRef, ngSwitch) {\n if ((typeof ngDevMode === 'undefined' || ngDevMode) && !ngSwitch) {\n throwNgSwitchProviderNotFoundError('ngSwitchDefault', 'NgSwitchDefault');\n }\n ngSwitch._addDefault(new SwitchView(viewContainer, templateRef));\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgSwitchDefault, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }, { token: NgSwitch, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.6\", type: NgSwitchDefault, isStandalone: true, selector: \"[ngSwitchDefault]\", ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgSwitchDefault, decorators: [{\n type: Directive,\n args: [{\n selector: '[ngSwitchDefault]',\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }, { type: NgSwitch, decorators: [{\n type: Optional\n }, {\n type: Host\n }] }] });\nfunction throwNgSwitchProviderNotFoundError(attrName, directiveName) {\n throw new ɵRuntimeError(2000 /* RuntimeErrorCode.PARENT_NG_SWITCH_NOT_FOUND */, `An element with the \"${attrName}\" attribute ` +\n `(matching the \"${directiveName}\" directive) must be located inside an element with the \"ngSwitch\" attribute ` +\n `(matching \"NgSwitch\" directive)`);\n}\nfunction stringifyValue(value) {\n return typeof value === 'string' ? `'${value}'` : String(value);\n}\n\n/**\n * @ngModule CommonModule\n *\n * @usageNotes\n * ```\n * \n * there is nothing\n * there is one\n * there are a few\n * \n * ```\n *\n * @description\n *\n * Adds / removes DOM sub-trees based on a numeric value. Tailored for pluralization.\n *\n * Displays DOM sub-trees that match the switch expression value, or failing that, DOM sub-trees\n * that match the switch expression's pluralization category.\n *\n * To use this directive you must provide a container element that sets the `[ngPlural]` attribute\n * to a switch expression. Inner elements with a `[ngPluralCase]` will display based on their\n * expression:\n * - if `[ngPluralCase]` is set to a value starting with `=`, it will only display if the value\n * matches the switch expression exactly,\n * - otherwise, the view will be treated as a \"category match\", and will only display if exact\n * value matches aren't found and the value maps to its category for the defined locale.\n *\n * See http://cldr.unicode.org/index/cldr-spec/plural-rules\n *\n * @publicApi\n */\nclass NgPlural {\n constructor(_localization) {\n this._localization = _localization;\n this._caseViews = {};\n }\n set ngPlural(value) {\n this._updateView(value);\n }\n addCase(value, switchView) {\n this._caseViews[value] = switchView;\n }\n _updateView(switchValue) {\n this._clearViews();\n const cases = Object.keys(this._caseViews);\n const key = getPluralCategory(switchValue, cases, this._localization);\n this._activateView(this._caseViews[key]);\n }\n _clearViews() {\n if (this._activeView)\n this._activeView.destroy();\n }\n _activateView(view) {\n if (view) {\n this._activeView = view;\n this._activeView.create();\n }\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgPlural, deps: [{ token: NgLocalization }], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.6\", type: NgPlural, isStandalone: true, selector: \"[ngPlural]\", inputs: { ngPlural: \"ngPlural\" }, ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgPlural, decorators: [{\n type: Directive,\n args: [{\n selector: '[ngPlural]',\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: NgLocalization }], propDecorators: { ngPlural: [{\n type: Input\n }] } });\n/**\n * @ngModule CommonModule\n *\n * @description\n *\n * Creates a view that will be added/removed from the parent {@link NgPlural} when the\n * given expression matches the plural expression according to CLDR rules.\n *\n * @usageNotes\n * ```\n * \n * ...\n * ...\n * \n *```\n *\n * See {@link NgPlural} for more details and example.\n *\n * @publicApi\n */\nclass NgPluralCase {\n constructor(value, template, viewContainer, ngPlural) {\n this.value = value;\n const isANumber = !isNaN(Number(value));\n ngPlural.addCase(isANumber ? `=${value}` : value, new SwitchView(viewContainer, template));\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgPluralCase, deps: [{ token: 'ngPluralCase', attribute: true }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: NgPlural, host: true }], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.6\", type: NgPluralCase, isStandalone: true, selector: \"[ngPluralCase]\", ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgPluralCase, decorators: [{\n type: Directive,\n args: [{\n selector: '[ngPluralCase]',\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: undefined, decorators: [{\n type: Attribute,\n args: ['ngPluralCase']\n }] }, { type: i0.TemplateRef }, { type: i0.ViewContainerRef }, { type: NgPlural, decorators: [{\n type: Host\n }] }] });\n\n/**\n * @ngModule CommonModule\n *\n * @usageNotes\n *\n * Set the font of the containing element to the result of an expression.\n *\n * ```\n * ...\n * ```\n *\n * Set the width of the containing element to a pixel value returned by an expression.\n *\n * ```\n * ...\n * ```\n *\n * Set a collection of style values using an expression that returns key-value pairs.\n *\n * ```\n * ...\n * ```\n *\n * @description\n *\n * An attribute directive that updates styles for the containing HTML element.\n * Sets one or more style properties, specified as colon-separated key-value pairs.\n * The key is a style name, with an optional `.` suffix\n * (such as 'top.px', 'font-style.em').\n * The value is an expression to be evaluated.\n * The resulting non-null value, expressed in the given unit,\n * is assigned to the given style property.\n * If the result of evaluation is null, the corresponding style is removed.\n *\n * @publicApi\n */\nclass NgStyle {\n constructor(_ngEl, _differs, _renderer) {\n this._ngEl = _ngEl;\n this._differs = _differs;\n this._renderer = _renderer;\n this._ngStyle = null;\n this._differ = null;\n }\n set ngStyle(values) {\n this._ngStyle = values;\n if (!this._differ && values) {\n this._differ = this._differs.find(values).create();\n }\n }\n ngDoCheck() {\n if (this._differ) {\n const changes = this._differ.diff(this._ngStyle);\n if (changes) {\n this._applyChanges(changes);\n }\n }\n }\n _setStyle(nameAndUnit, value) {\n const [name, unit] = nameAndUnit.split('.');\n const flags = name.indexOf('-') === -1 ? undefined : RendererStyleFlags2.DashCase;\n if (value != null) {\n this._renderer.setStyle(this._ngEl.nativeElement, name, unit ? `${value}${unit}` : value, flags);\n }\n else {\n this._renderer.removeStyle(this._ngEl.nativeElement, name, flags);\n }\n }\n _applyChanges(changes) {\n changes.forEachRemovedItem((record) => this._setStyle(record.key, null));\n changes.forEachAddedItem((record) => this._setStyle(record.key, record.currentValue));\n changes.forEachChangedItem((record) => this._setStyle(record.key, record.currentValue));\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgStyle, deps: [{ token: i0.ElementRef }, { token: i0.KeyValueDiffers }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.6\", type: NgStyle, isStandalone: true, selector: \"[ngStyle]\", inputs: { ngStyle: \"ngStyle\" }, ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgStyle, decorators: [{\n type: Directive,\n args: [{\n selector: '[ngStyle]',\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.KeyValueDiffers }, { type: i0.Renderer2 }], propDecorators: { ngStyle: [{\n type: Input,\n args: ['ngStyle']\n }] } });\n\n/**\n * @ngModule CommonModule\n *\n * @description\n *\n * Inserts an embedded view from a prepared `TemplateRef`.\n *\n * You can attach a context object to the `EmbeddedViewRef` by setting `[ngTemplateOutletContext]`.\n * `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding\n * by the local template `let` declarations.\n *\n * @usageNotes\n * ```\n * \n * ```\n *\n * Using the key `$implicit` in the context object will set its value as default.\n *\n * ### Example\n *\n * {@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'}\n *\n * @publicApi\n */\nclass NgTemplateOutlet {\n constructor(_viewContainerRef) {\n this._viewContainerRef = _viewContainerRef;\n this._viewRef = null;\n /**\n * A context object to attach to the {@link EmbeddedViewRef}. This should be an\n * object, the object's keys will be available for binding by the local template `let`\n * declarations.\n * Using the key `$implicit` in the context object will set its value as default.\n */\n this.ngTemplateOutletContext = null;\n /**\n * A string defining the template reference and optionally the context object for the template.\n */\n this.ngTemplateOutlet = null;\n /** Injector to be used within the embedded view. */\n this.ngTemplateOutletInjector = null;\n }\n ngOnChanges(changes) {\n if (this._shouldRecreateView(changes)) {\n const viewContainerRef = this._viewContainerRef;\n if (this._viewRef) {\n viewContainerRef.remove(viewContainerRef.indexOf(this._viewRef));\n }\n // If there is no outlet, clear the destroyed view ref.\n if (!this.ngTemplateOutlet) {\n this._viewRef = null;\n return;\n }\n // Create a context forward `Proxy` that will always bind to the user-specified context,\n // without having to destroy and re-create views whenever the context changes.\n const viewContext = this._createContextForwardProxy();\n this._viewRef = viewContainerRef.createEmbeddedView(this.ngTemplateOutlet, viewContext, {\n injector: this.ngTemplateOutletInjector ?? undefined,\n });\n }\n }\n /**\n * We need to re-create existing embedded view if either is true:\n * - the outlet changed.\n * - the injector changed.\n */\n _shouldRecreateView(changes) {\n return !!changes['ngTemplateOutlet'] || !!changes['ngTemplateOutletInjector'];\n }\n /**\n * For a given outlet instance, we create a proxy object that delegates\n * to the user-specified context. This allows changing, or swapping out\n * the context object completely without having to destroy/re-create the view.\n */\n _createContextForwardProxy() {\n return new Proxy({}, {\n set: (_target, prop, newValue) => {\n if (!this.ngTemplateOutletContext) {\n return false;\n }\n return Reflect.set(this.ngTemplateOutletContext, prop, newValue);\n },\n get: (_target, prop, receiver) => {\n if (!this.ngTemplateOutletContext) {\n return undefined;\n }\n return Reflect.get(this.ngTemplateOutletContext, prop, receiver);\n },\n });\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgTemplateOutlet, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"14.0.0\", version: \"18.0.6\", type: NgTemplateOutlet, isStandalone: true, selector: \"[ngTemplateOutlet]\", inputs: { ngTemplateOutletContext: \"ngTemplateOutletContext\", ngTemplateOutlet: \"ngTemplateOutlet\", ngTemplateOutletInjector: \"ngTemplateOutletInjector\" }, usesOnChanges: true, ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgTemplateOutlet, decorators: [{\n type: Directive,\n args: [{\n selector: '[ngTemplateOutlet]',\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: i0.ViewContainerRef }], propDecorators: { ngTemplateOutletContext: [{\n type: Input\n }], ngTemplateOutlet: [{\n type: Input\n }], ngTemplateOutletInjector: [{\n type: Input\n }] } });\n\n/**\n * A collection of Angular directives that are likely to be used in each and every Angular\n * application.\n */\nconst COMMON_DIRECTIVES = [\n NgClass,\n NgComponentOutlet,\n NgForOf,\n NgIf,\n NgTemplateOutlet,\n NgStyle,\n NgSwitch,\n NgSwitchCase,\n NgSwitchDefault,\n NgPlural,\n NgPluralCase,\n];\n\nfunction invalidPipeArgumentError(type, value) {\n return new ɵRuntimeError(2100 /* RuntimeErrorCode.INVALID_PIPE_ARGUMENT */, ngDevMode && `InvalidPipeArgument: '${value}' for pipe '${ɵstringify(type)}'`);\n}\n\nclass SubscribableStrategy {\n createSubscription(async, updateLatestValue) {\n // Subscription can be side-effectful, and we don't want any signal reads which happen in the\n // side effect of the subscription to be tracked by a component's template when that\n // subscription is triggered via the async pipe. So we wrap the subscription in `untracked` to\n // decouple from the current reactive context.\n //\n // `untracked` also prevents signal _writes_ which happen in the subscription side effect from\n // being treated as signal writes during the template evaluation (which throws errors).\n return untracked(() => async.subscribe({\n next: updateLatestValue,\n error: (e) => {\n throw e;\n },\n }));\n }\n dispose(subscription) {\n // See the comment in `createSubscription` above on the use of `untracked`.\n untracked(() => subscription.unsubscribe());\n }\n}\nclass PromiseStrategy {\n createSubscription(async, updateLatestValue) {\n return async.then(updateLatestValue, (e) => {\n throw e;\n });\n }\n dispose(subscription) { }\n}\nconst _promiseStrategy = new PromiseStrategy();\nconst _subscribableStrategy = new SubscribableStrategy();\n/**\n * @ngModule CommonModule\n * @description\n *\n * Unwraps a value from an asynchronous primitive.\n *\n * The `async` pipe subscribes to an `Observable` or `Promise` and returns the latest value it has\n * emitted. When a new value is emitted, the `async` pipe marks the component to be checked for\n * changes. When the component gets destroyed, the `async` pipe unsubscribes automatically to avoid\n * potential memory leaks. When the reference of the expression changes, the `async` pipe\n * automatically unsubscribes from the old `Observable` or `Promise` and subscribes to the new one.\n *\n * @usageNotes\n *\n * ### Examples\n *\n * This example binds a `Promise` to the view. Clicking the `Resolve` button resolves the\n * promise.\n *\n * {@example common/pipes/ts/async_pipe.ts region='AsyncPipePromise'}\n *\n * It's also possible to use `async` with Observables. The example below binds the `time` Observable\n * to the view. The Observable continuously updates the view with the current time.\n *\n * {@example common/pipes/ts/async_pipe.ts region='AsyncPipeObservable'}\n *\n * @publicApi\n */\nclass AsyncPipe {\n constructor(ref) {\n this._latestValue = null;\n this.markForCheckOnValueUpdate = true;\n this._subscription = null;\n this._obj = null;\n this._strategy = null;\n // Assign `ref` into `this._ref` manually instead of declaring `_ref` in the constructor\n // parameter list, as the type of `this._ref` includes `null` unlike the type of `ref`.\n this._ref = ref;\n }\n ngOnDestroy() {\n if (this._subscription) {\n this._dispose();\n }\n // Clear the `ChangeDetectorRef` and its association with the view data, to mitigate\n // potential memory leaks in Observables that could otherwise cause the view data to\n // be retained.\n // https://github.com/angular/angular/issues/17624\n this._ref = null;\n }\n transform(obj) {\n if (!this._obj) {\n if (obj) {\n try {\n // Only call `markForCheck` if the value is updated asynchronously.\n // Synchronous updates _during_ subscription should not wastefully mark for check -\n // this value is already going to be returned from the transform function.\n this.markForCheckOnValueUpdate = false;\n this._subscribe(obj);\n }\n finally {\n this.markForCheckOnValueUpdate = true;\n }\n }\n return this._latestValue;\n }\n if (obj !== this._obj) {\n this._dispose();\n return this.transform(obj);\n }\n return this._latestValue;\n }\n _subscribe(obj) {\n this._obj = obj;\n this._strategy = this._selectStrategy(obj);\n this._subscription = this._strategy.createSubscription(obj, (value) => this._updateLatestValue(obj, value));\n }\n _selectStrategy(obj) {\n if (ɵisPromise(obj)) {\n return _promiseStrategy;\n }\n if (ɵisSubscribable(obj)) {\n return _subscribableStrategy;\n }\n throw invalidPipeArgumentError(AsyncPipe, obj);\n }\n _dispose() {\n // Note: `dispose` is only called if a subscription has been initialized before, indicating\n // that `this._strategy` is also available.\n this._strategy.dispose(this._subscription);\n this._latestValue = null;\n this._subscription = null;\n this._obj = null;\n }\n _updateLatestValue(async, value) {\n if (async === this._obj) {\n this._latestValue = value;\n if (this.markForCheckOnValueUpdate) {\n this._ref?.markForCheck();\n }\n }\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: AsyncPipe, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Pipe }); }\n static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: \"14.0.0\", version: \"18.0.6\", ngImport: i0, type: AsyncPipe, isStandalone: true, name: \"async\", pure: false }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: AsyncPipe, decorators: [{\n type: Pipe,\n args: [{\n name: 'async',\n pure: false,\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }] });\n\n/**\n * Transforms text to all lower case.\n *\n * @see {@link UpperCasePipe}\n * @see {@link TitleCasePipe}\n * @usageNotes\n *\n * The following example defines a view that allows the user to enter\n * text, and then uses the pipe to convert the input text to all lower case.\n *\n * \n *\n * @ngModule CommonModule\n * @publicApi\n */\nclass LowerCasePipe {\n transform(value) {\n if (value == null)\n return null;\n if (typeof value !== 'string') {\n throw invalidPipeArgumentError(LowerCasePipe, value);\n }\n return value.toLowerCase();\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: LowerCasePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }\n static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: \"14.0.0\", version: \"18.0.6\", ngImport: i0, type: LowerCasePipe, isStandalone: true, name: \"lowercase\" }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: LowerCasePipe, decorators: [{\n type: Pipe,\n args: [{\n name: 'lowercase',\n standalone: true,\n }]\n }] });\n//\n// Regex below matches any Unicode word and number compatible with ES5. In ES2018 the same result\n// can be achieved by using /[0-9\\p{L}]\\S*/gu and also known as Unicode Property Escapes\n// (https://2ality.com/2017/07/regexp-unicode-property-escapes.html). Since there is no\n// transpilation of this functionality down to ES5 without external tool, the only solution is\n// to use already transpiled form. Example can be found here -\n// https://mothereff.in/regexpu#input=var+regex+%3D+%2F%5B0-9%5Cp%7BL%7D%5D%5CS*%2Fgu%3B%0A%0A&unicodePropertyEscape=1\n//\nconst unicodeWordMatch = /(?:[0-9A-Za-z\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05D0-\\u05EA\\u05EF-\\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\\u0860-\\u086A\\u0870-\\u0887\\u0889-\\u088E\\u08A0-\\u08C9\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u09FC\\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\\u0AF9\\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-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C5D\\u0C60\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D04-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\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-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u1711\\u171F-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1878\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4C\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C88\\u1C90-\\u1CBA\\u1CBD-\\u1CBF\\u1CE9-\\u1CEC\\u1CEE-\\u1CF3\\u1CF5\\u1CF6\\u1CFA\\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-\\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-\\u312F\\u3131-\\u318E\\u31A0-\\u31BF\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7CA\\uA7D0\\uA7D1\\uA7D3\\uA7D5-\\uA7D9\\uA7F2-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD\\uA8FE\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB69\\uAB70-\\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]|\\uD800[\\uDC00-\\uDC0B\\uDC0D-\\uDC26\\uDC28-\\uDC3A\\uDC3C\\uDC3D\\uDC3F-\\uDC4D\\uDC50-\\uDC5D\\uDC80-\\uDCFA\\uDE80-\\uDE9C\\uDEA0-\\uDED0\\uDF00-\\uDF1F\\uDF2D-\\uDF40\\uDF42-\\uDF49\\uDF50-\\uDF75\\uDF80-\\uDF9D\\uDFA0-\\uDFC3\\uDFC8-\\uDFCF]|\\uD801[\\uDC00-\\uDC9D\\uDCB0-\\uDCD3\\uDCD8-\\uDCFB\\uDD00-\\uDD27\\uDD30-\\uDD63\\uDD70-\\uDD7A\\uDD7C-\\uDD8A\\uDD8C-\\uDD92\\uDD94\\uDD95\\uDD97-\\uDDA1\\uDDA3-\\uDDB1\\uDDB3-\\uDDB9\\uDDBB\\uDDBC\\uDE00-\\uDF36\\uDF40-\\uDF55\\uDF60-\\uDF67\\uDF80-\\uDF85\\uDF87-\\uDFB0\\uDFB2-\\uDFBA]|\\uD802[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDC60-\\uDC76\\uDC80-\\uDC9E\\uDCE0-\\uDCF2\\uDCF4\\uDCF5\\uDD00-\\uDD15\\uDD20-\\uDD39\\uDD80-\\uDDB7\\uDDBE\\uDDBF\\uDE00\\uDE10-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE35\\uDE60-\\uDE7C\\uDE80-\\uDE9C\\uDEC0-\\uDEC7\\uDEC9-\\uDEE4\\uDF00-\\uDF35\\uDF40-\\uDF55\\uDF60-\\uDF72\\uDF80-\\uDF91]|\\uD803[\\uDC00-\\uDC48\\uDC80-\\uDCB2\\uDCC0-\\uDCF2\\uDD00-\\uDD23\\uDE80-\\uDEA9\\uDEB0\\uDEB1\\uDF00-\\uDF1C\\uDF27\\uDF30-\\uDF45\\uDF70-\\uDF81\\uDFB0-\\uDFC4\\uDFE0-\\uDFF6]|\\uD804[\\uDC03-\\uDC37\\uDC71\\uDC72\\uDC75\\uDC83-\\uDCAF\\uDCD0-\\uDCE8\\uDD03-\\uDD26\\uDD44\\uDD47\\uDD50-\\uDD72\\uDD76\\uDD83-\\uDDB2\\uDDC1-\\uDDC4\\uDDDA\\uDDDC\\uDE00-\\uDE11\\uDE13-\\uDE2B\\uDE80-\\uDE86\\uDE88\\uDE8A-\\uDE8D\\uDE8F-\\uDE9D\\uDE9F-\\uDEA8\\uDEB0-\\uDEDE\\uDF05-\\uDF0C\\uDF0F\\uDF10\\uDF13-\\uDF28\\uDF2A-\\uDF30\\uDF32\\uDF33\\uDF35-\\uDF39\\uDF3D\\uDF50\\uDF5D-\\uDF61]|\\uD805[\\uDC00-\\uDC34\\uDC47-\\uDC4A\\uDC5F-\\uDC61\\uDC80-\\uDCAF\\uDCC4\\uDCC5\\uDCC7\\uDD80-\\uDDAE\\uDDD8-\\uDDDB\\uDE00-\\uDE2F\\uDE44\\uDE80-\\uDEAA\\uDEB8\\uDF00-\\uDF1A\\uDF40-\\uDF46]|\\uD806[\\uDC00-\\uDC2B\\uDCA0-\\uDCDF\\uDCFF-\\uDD06\\uDD09\\uDD0C-\\uDD13\\uDD15\\uDD16\\uDD18-\\uDD2F\\uDD3F\\uDD41\\uDDA0-\\uDDA7\\uDDAA-\\uDDD0\\uDDE1\\uDDE3\\uDE00\\uDE0B-\\uDE32\\uDE3A\\uDE50\\uDE5C-\\uDE89\\uDE9D\\uDEB0-\\uDEF8]|\\uD807[\\uDC00-\\uDC08\\uDC0A-\\uDC2E\\uDC40\\uDC72-\\uDC8F\\uDD00-\\uDD06\\uDD08\\uDD09\\uDD0B-\\uDD30\\uDD46\\uDD60-\\uDD65\\uDD67\\uDD68\\uDD6A-\\uDD89\\uDD98\\uDEE0-\\uDEF2\\uDFB0]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC80-\\uDD43]|\\uD80B[\\uDF90-\\uDFF0]|[\\uD80C\\uD81C-\\uD820\\uD822\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872\\uD874-\\uD879\\uD880-\\uD883][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2E]|\\uD811[\\uDC00-\\uDE46]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDE70-\\uDEBE\\uDED0-\\uDEED\\uDF00-\\uDF2F\\uDF40-\\uDF43\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDE40-\\uDE7F\\uDF00-\\uDF4A\\uDF50\\uDF93-\\uDF9F\\uDFE0\\uDFE1\\uDFE3]|\\uD821[\\uDC00-\\uDFF7]|\\uD823[\\uDC00-\\uDCD5\\uDD00-\\uDD08]|\\uD82B[\\uDFF0-\\uDFF3\\uDFF5-\\uDFFB\\uDFFD\\uDFFE]|\\uD82C[\\uDC00-\\uDD22\\uDD50-\\uDD52\\uDD64-\\uDD67\\uDD70-\\uDEFB]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99]|\\uD835[\\uDC00-\\uDC54\\uDC56-\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE-\\uDCB9\\uDCBB\\uDCBD-\\uDCC3\\uDCC5-\\uDD05\\uDD07-\\uDD0A\\uDD0D-\\uDD14\\uDD16-\\uDD1C\\uDD1E-\\uDD39\\uDD3B-\\uDD3E\\uDD40-\\uDD44\\uDD46\\uDD4A-\\uDD50\\uDD52-\\uDEA5\\uDEA8-\\uDEC0\\uDEC2-\\uDEDA\\uDEDC-\\uDEFA\\uDEFC-\\uDF14\\uDF16-\\uDF34\\uDF36-\\uDF4E\\uDF50-\\uDF6E\\uDF70-\\uDF88\\uDF8A-\\uDFA8\\uDFAA-\\uDFC2\\uDFC4-\\uDFCB]|\\uD837[\\uDF00-\\uDF1E]|\\uD838[\\uDD00-\\uDD2C\\uDD37-\\uDD3D\\uDD4E\\uDE90-\\uDEAD\\uDEC0-\\uDEEB]|\\uD839[\\uDFE0-\\uDFE6\\uDFE8-\\uDFEB\\uDFED\\uDFEE\\uDFF0-\\uDFFE]|\\uD83A[\\uDC00-\\uDCC4\\uDD00-\\uDD43\\uDD4B]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDEDF\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF38\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEA1\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0]|\\uD87E[\\uDC00-\\uDE1D]|\\uD884[\\uDC00-\\uDF4A])\\S*/g;\n/**\n * Transforms text to title case.\n * Capitalizes the first letter of each word and transforms the\n * rest of the word to lower case.\n * Words are delimited by any whitespace character, such as a space, tab, or line-feed character.\n *\n * @see {@link LowerCasePipe}\n * @see {@link UpperCasePipe}\n *\n * @usageNotes\n * The following example shows the result of transforming various strings into title case.\n *\n * \n *\n * @ngModule CommonModule\n * @publicApi\n */\nclass TitleCasePipe {\n transform(value) {\n if (value == null)\n return null;\n if (typeof value !== 'string') {\n throw invalidPipeArgumentError(TitleCasePipe, value);\n }\n return value.replace(unicodeWordMatch, (txt) => txt[0].toUpperCase() + txt.slice(1).toLowerCase());\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: TitleCasePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }\n static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: \"14.0.0\", version: \"18.0.6\", ngImport: i0, type: TitleCasePipe, isStandalone: true, name: \"titlecase\" }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: TitleCasePipe, decorators: [{\n type: Pipe,\n args: [{\n name: 'titlecase',\n standalone: true,\n }]\n }] });\n/**\n * Transforms text to all upper case.\n * @see {@link LowerCasePipe}\n * @see {@link TitleCasePipe}\n *\n * @ngModule CommonModule\n * @publicApi\n */\nclass UpperCasePipe {\n transform(value) {\n if (value == null)\n return null;\n if (typeof value !== 'string') {\n throw invalidPipeArgumentError(UpperCasePipe, value);\n }\n return value.toUpperCase();\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: UpperCasePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }\n static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: \"14.0.0\", version: \"18.0.6\", ngImport: i0, type: UpperCasePipe, isStandalone: true, name: \"uppercase\" }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: UpperCasePipe, decorators: [{\n type: Pipe,\n args: [{\n name: 'uppercase',\n standalone: true,\n }]\n }] });\n\n/**\n * The default date format of Angular date pipe, which corresponds to the following format:\n * `'MMM d,y'` (e.g. `Jun 15, 2015`)\n */\nconst DEFAULT_DATE_FORMAT = 'mediumDate';\n\n/**\n * Optionally-provided default timezone to use for all instances of `DatePipe` (such as `'+0430'`).\n * If the value isn't provided, the `DatePipe` will use the end-user's local system timezone.\n *\n * @deprecated use DATE_PIPE_DEFAULT_OPTIONS token to configure DatePipe\n */\nconst DATE_PIPE_DEFAULT_TIMEZONE = new InjectionToken(ngDevMode ? 'DATE_PIPE_DEFAULT_TIMEZONE' : '');\n/**\n * DI token that allows to provide default configuration for the `DatePipe` instances in an\n * application. The value is an object which can include the following fields:\n * - `dateFormat`: configures the default date format. If not provided, the `DatePipe`\n * will use the 'mediumDate' as a value.\n * - `timezone`: configures the default timezone. If not provided, the `DatePipe` will\n * use the end-user's local system timezone.\n *\n * @see {@link DatePipeConfig}\n *\n * @usageNotes\n *\n * Various date pipe default values can be overwritten by providing this token with\n * the value that has this interface.\n *\n * For example:\n *\n * Override the default date format by providing a value using the token:\n * ```typescript\n * providers: [\n * {provide: DATE_PIPE_DEFAULT_OPTIONS, useValue: {dateFormat: 'shortDate'}}\n * ]\n * ```\n *\n * Override the default timezone by providing a value using the token:\n * ```typescript\n * providers: [\n * {provide: DATE_PIPE_DEFAULT_OPTIONS, useValue: {timezone: '-1200'}}\n * ]\n * ```\n */\nconst DATE_PIPE_DEFAULT_OPTIONS = new InjectionToken(ngDevMode ? 'DATE_PIPE_DEFAULT_OPTIONS' : '');\n/**\n * @ngModule CommonModule\n * @description\n *\n * Formats a date value according to locale rules.\n *\n * `DatePipe` is executed only when it detects a pure change to the input value.\n * A pure change is either a change to a primitive input value\n * (such as `String`, `Number`, `Boolean`, or `Symbol`),\n * or a changed object reference (such as `Date`, `Array`, `Function`, or `Object`).\n *\n * Note that mutating a `Date` object does not cause the pipe to be rendered again.\n * To ensure that the pipe is executed, you must create a new `Date` object.\n *\n * Only the `en-US` locale data comes with Angular. To localize dates\n * in another language, you must import the corresponding locale data.\n * See the [I18n guide](guide/i18n/format-data-locale) for more information.\n *\n * The time zone of the formatted value can be specified either by passing it in as the second\n * parameter of the pipe, or by setting the default through the `DATE_PIPE_DEFAULT_OPTIONS`\n * injection token. The value that is passed in as the second parameter takes precedence over\n * the one defined using the injection token.\n *\n * @see {@link formatDate}\n *\n *\n * @usageNotes\n *\n * The result of this pipe is not reevaluated when the input is mutated. To avoid the need to\n * reformat the date on every change-detection cycle, treat the date as an immutable object\n * and change the reference when the pipe needs to run again.\n *\n * ### Pre-defined format options\n *\n * | Option | Equivalent to | Examples (given in `en-US` locale) |\n * |---------------|-------------------------------------|-------------------------------------------------|\n * | `'short'` | `'M/d/yy, h:mm a'` | `6/15/15, 9:03 AM` |\n * | `'medium'` | `'MMM d, y, h:mm:ss a'` | `Jun 15, 2015, 9:03:01 AM` |\n * | `'long'` | `'MMMM d, y, h:mm:ss a z'` | `June 15, 2015 at 9:03:01 AM GMT+1` |\n * | `'full'` | `'EEEE, MMMM d, y, h:mm:ss a zzzz'` | `Monday, June 15, 2015 at 9:03:01 AM GMT+01:00` |\n * | `'shortDate'` | `'M/d/yy'` | `6/15/15` |\n * | `'mediumDate'`| `'MMM d, y'` | `Jun 15, 2015` |\n * | `'longDate'` | `'MMMM d, y'` | `June 15, 2015` |\n * | `'fullDate'` | `'EEEE, MMMM d, y'` | `Monday, June 15, 2015` |\n * | `'shortTime'` | `'h:mm a'` | `9:03 AM` |\n * | `'mediumTime'`| `'h:mm:ss a'` | `9:03:01 AM` |\n * | `'longTime'` | `'h:mm:ss a z'` | `9:03:01 AM GMT+1` |\n * | `'fullTime'` | `'h:mm:ss a zzzz'` | `9:03:01 AM GMT+01:00` |\n *\n * ### Custom format options\n *\n * You can construct a format string using symbols to specify the components\n * of a date-time value, as described in the following table.\n * Format details depend on the locale.\n * Fields marked with (*) are only available in the extra data set for the given locale.\n *\n * | Field type | Format | Description | Example Value |\n * |-------------------------|-------------|---------------------------------------------------------------|------------------------------------------------------------|\n * | Era | G, GG & GGG | Abbreviated | AD |\n * | | GGGG | Wide | Anno Domini |\n * | | GGGGG | Narrow | A |\n * | Year | y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 |\n * | | yy | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 |\n * | | yyy | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 |\n * | | yyyy | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 |\n * | ISO Week-numbering year | Y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 |\n * | | YY | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 |\n * | | YYY | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 |\n * | | YYYY | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 |\n * | Month | M | Numeric: 1 digit | 9, 12 |\n * | | MM | Numeric: 2 digits + zero padded | 09, 12 |\n * | | MMM | Abbreviated | Sep |\n * | | MMMM | Wide | September |\n * | | MMMMM | Narrow | S |\n * | Month standalone | L | Numeric: 1 digit | 9, 12 |\n * | | LL | Numeric: 2 digits + zero padded | 09, 12 |\n * | | LLL | Abbreviated | Sep |\n * | | LLLL | Wide | September |\n * | | LLLLL | Narrow | S |\n * | ISO Week of year | w | Numeric: minimum digits | 1... 53 |\n * | | ww | Numeric: 2 digits + zero padded | 01... 53 |\n * | Week of month | W | Numeric: 1 digit | 1... 5 |\n * | Day of month | d | Numeric: minimum digits | 1 |\n * | | dd | Numeric: 2 digits + zero padded | 01 |\n * | Week day | E, EE & EEE | Abbreviated | Tue |\n * | | EEEE | Wide | Tuesday |\n * | | EEEEE | Narrow | T |\n * | | EEEEEE | Short | Tu |\n * | Week day standalone | c, cc | Numeric: 1 digit | 2 |\n * | | ccc | Abbreviated | Tue |\n * | | cccc | Wide | Tuesday |\n * | | ccccc | Narrow | T |\n * | | cccccc | Short | Tu |\n * | Period | a, aa & aaa | Abbreviated | am/pm or AM/PM |\n * | | aaaa | Wide (fallback to `a` when missing) | ante meridiem/post meridiem |\n * | | aaaaa | Narrow | a/p |\n * | Period* | B, BB & BBB | Abbreviated | mid. |\n * | | BBBB | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |\n * | | BBBBB | Narrow | md |\n * | Period standalone* | b, bb & bbb | Abbreviated | mid. |\n * | | bbbb | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |\n * | | bbbbb | Narrow | md |\n * | Hour 1-12 | h | Numeric: minimum digits | 1, 12 |\n * | | hh | Numeric: 2 digits + zero padded | 01, 12 |\n * | Hour 0-23 | H | Numeric: minimum digits | 0, 23 |\n * | | HH | Numeric: 2 digits + zero padded | 00, 23 |\n * | Minute | m | Numeric: minimum digits | 8, 59 |\n * | | mm | Numeric: 2 digits + zero padded | 08, 59 |\n * | Second | s | Numeric: minimum digits | 0... 59 |\n * | | ss | Numeric: 2 digits + zero padded | 00... 59 |\n * | Fractional seconds | S | Numeric: 1 digit | 0... 9 |\n * | | SS | Numeric: 2 digits + zero padded | 00... 99 |\n * | | SSS | Numeric: 3 digits + zero padded (= milliseconds) | 000... 999 |\n * | Zone | z, zz & zzz | Short specific non location format (fallback to O) | GMT-8 |\n * | | zzzz | Long specific non location format (fallback to OOOO) | GMT-08:00 |\n * | | Z, ZZ & ZZZ | ISO8601 basic format | -0800 |\n * | | ZZZZ | Long localized GMT format | GMT-8:00 |\n * | | ZZZZZ | ISO8601 extended format + Z indicator for offset 0 (= XXXXX) | -08:00 |\n * | | O, OO & OOO | Short localized GMT format | GMT-8 |\n * | | OOOO | Long localized GMT format | GMT-08:00 |\n *\n *\n * ### Format examples\n *\n * These examples transform a date into various formats,\n * assuming that `dateObj` is a JavaScript `Date` object for\n * year: 2015, month: 6, day: 15, hour: 21, minute: 43, second: 11,\n * given in the local time for the `en-US` locale.\n *\n * ```\n * {{ dateObj | date }} // output is 'Jun 15, 2015'\n * {{ dateObj | date:'medium' }} // output is 'Jun 15, 2015, 9:43:11 PM'\n * {{ dateObj | date:'shortTime' }} // output is '9:43 PM'\n * {{ dateObj | date:'mm:ss' }} // output is '43:11'\n * {{ dateObj | date:\"MMM dd, yyyy 'at' hh:mm a\" }} // output is 'Jun 15, 2015 at 09:43 PM'\n * ```\n *\n * ### Usage example\n *\n * The following component uses a date pipe to display the current date in different formats.\n *\n * ```\n * @Component({\n * selector: 'date-pipe',\n * template: `
    \n *

    Today is {{today | date}}

    \n *

    Or if you prefer, {{today | date:'fullDate'}}

    \n *

    The time is {{today | date:'h:mm a z'}}

    \n *
    `\n * })\n * // Get the current date and time as a date-time value.\n * export class DatePipeComponent {\n * today: number = Date.now();\n * }\n * ```\n *\n * @publicApi\n */\nclass DatePipe {\n constructor(locale, defaultTimezone, defaultOptions) {\n this.locale = locale;\n this.defaultTimezone = defaultTimezone;\n this.defaultOptions = defaultOptions;\n }\n transform(value, format, timezone, locale) {\n if (value == null || value === '' || value !== value)\n return null;\n try {\n const _format = format ?? this.defaultOptions?.dateFormat ?? DEFAULT_DATE_FORMAT;\n const _timezone = timezone ?? this.defaultOptions?.timezone ?? this.defaultTimezone ?? undefined;\n return formatDate(value, _format, locale || this.locale, _timezone);\n }\n catch (error) {\n throw invalidPipeArgumentError(DatePipe, error.message);\n }\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: DatePipe, deps: [{ token: LOCALE_ID }, { token: DATE_PIPE_DEFAULT_TIMEZONE, optional: true }, { token: DATE_PIPE_DEFAULT_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Pipe }); }\n static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: \"14.0.0\", version: \"18.0.6\", ngImport: i0, type: DatePipe, isStandalone: true, name: \"date\" }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: DatePipe, decorators: [{\n type: Pipe,\n args: [{\n name: 'date',\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: undefined, decorators: [{\n type: Inject,\n args: [LOCALE_ID]\n }] }, { type: undefined, decorators: [{\n type: Inject,\n args: [DATE_PIPE_DEFAULT_TIMEZONE]\n }, {\n type: Optional\n }] }, { type: undefined, decorators: [{\n type: Inject,\n args: [DATE_PIPE_DEFAULT_OPTIONS]\n }, {\n type: Optional\n }] }] });\n\nconst _INTERPOLATION_REGEXP = /#/g;\n/**\n * @ngModule CommonModule\n * @description\n *\n * Maps a value to a string that pluralizes the value according to locale rules.\n *\n * @usageNotes\n *\n * ### Example\n *\n * {@example common/pipes/ts/i18n_pipe.ts region='I18nPluralPipeComponent'}\n *\n * @publicApi\n */\nclass I18nPluralPipe {\n constructor(_localization) {\n this._localization = _localization;\n }\n /**\n * @param value the number to be formatted\n * @param pluralMap an object that mimics the ICU format, see\n * https://unicode-org.github.io/icu/userguide/format_parse/messages/.\n * @param locale a `string` defining the locale to use (uses the current {@link LOCALE_ID} by\n * default).\n */\n transform(value, pluralMap, locale) {\n if (value == null)\n return '';\n if (typeof pluralMap !== 'object' || pluralMap === null) {\n throw invalidPipeArgumentError(I18nPluralPipe, pluralMap);\n }\n const key = getPluralCategory(value, Object.keys(pluralMap), this._localization, locale);\n return pluralMap[key].replace(_INTERPOLATION_REGEXP, value.toString());\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: I18nPluralPipe, deps: [{ token: NgLocalization }], target: i0.ɵɵFactoryTarget.Pipe }); }\n static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: \"14.0.0\", version: \"18.0.6\", ngImport: i0, type: I18nPluralPipe, isStandalone: true, name: \"i18nPlural\" }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: I18nPluralPipe, decorators: [{\n type: Pipe,\n args: [{\n name: 'i18nPlural',\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: NgLocalization }] });\n\n/**\n * @ngModule CommonModule\n * @description\n *\n * Generic selector that displays the string that matches the current value.\n *\n * If none of the keys of the `mapping` match the `value`, then the content\n * of the `other` key is returned when present, otherwise an empty string is returned.\n *\n * @usageNotes\n *\n * ### Example\n *\n * {@example common/pipes/ts/i18n_pipe.ts region='I18nSelectPipeComponent'}\n *\n * @publicApi\n */\nclass I18nSelectPipe {\n /**\n * @param value a string to be internationalized.\n * @param mapping an object that indicates the text that should be displayed\n * for different values of the provided `value`.\n */\n transform(value, mapping) {\n if (value == null)\n return '';\n if (typeof mapping !== 'object' || typeof value !== 'string') {\n throw invalidPipeArgumentError(I18nSelectPipe, mapping);\n }\n if (mapping.hasOwnProperty(value)) {\n return mapping[value];\n }\n if (mapping.hasOwnProperty('other')) {\n return mapping['other'];\n }\n return '';\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: I18nSelectPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }\n static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: \"14.0.0\", version: \"18.0.6\", ngImport: i0, type: I18nSelectPipe, isStandalone: true, name: \"i18nSelect\" }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: I18nSelectPipe, decorators: [{\n type: Pipe,\n args: [{\n name: 'i18nSelect',\n standalone: true,\n }]\n }] });\n\n/**\n * @ngModule CommonModule\n * @description\n *\n * Converts a value into its JSON-format representation. Useful for debugging.\n *\n * @usageNotes\n *\n * The following component uses a JSON pipe to convert an object\n * to JSON format, and displays the string in both formats for comparison.\n *\n * {@example common/pipes/ts/json_pipe.ts region='JsonPipe'}\n *\n * @publicApi\n */\nclass JsonPipe {\n /**\n * @param value A value of any type to convert into a JSON-format string.\n */\n transform(value) {\n return JSON.stringify(value, null, 2);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: JsonPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }\n static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: \"14.0.0\", version: \"18.0.6\", ngImport: i0, type: JsonPipe, isStandalone: true, name: \"json\", pure: false }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: JsonPipe, decorators: [{\n type: Pipe,\n args: [{\n name: 'json',\n pure: false,\n standalone: true,\n }]\n }] });\n\nfunction makeKeyValuePair(key, value) {\n return { key: key, value: value };\n}\n/**\n * @ngModule CommonModule\n * @description\n *\n * Transforms Object or Map into an array of key value pairs.\n *\n * The output array will be ordered by keys.\n * By default the comparator will be by Unicode point value.\n * You can optionally pass a compareFn if your keys are complex types.\n *\n * @usageNotes\n * ### Examples\n *\n * This examples show how an Object or a Map can be iterated by ngFor with the use of this\n * keyvalue pipe.\n *\n * {@example common/pipes/ts/keyvalue_pipe.ts region='KeyValuePipe'}\n *\n * @publicApi\n */\nclass KeyValuePipe {\n constructor(differs) {\n this.differs = differs;\n this.keyValues = [];\n this.compareFn = defaultComparator;\n }\n transform(input, compareFn = defaultComparator) {\n if (!input || (!(input instanceof Map) && typeof input !== 'object')) {\n return null;\n }\n // make a differ for whatever type we've been passed in\n this.differ ??= this.differs.find(input).create();\n const differChanges = this.differ.diff(input);\n const compareFnChanged = compareFn !== this.compareFn;\n if (differChanges) {\n this.keyValues = [];\n differChanges.forEachItem((r) => {\n this.keyValues.push(makeKeyValuePair(r.key, r.currentValue));\n });\n }\n if (differChanges || compareFnChanged) {\n this.keyValues.sort(compareFn);\n this.compareFn = compareFn;\n }\n return this.keyValues;\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: KeyValuePipe, deps: [{ token: i0.KeyValueDiffers }], target: i0.ɵɵFactoryTarget.Pipe }); }\n static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: \"14.0.0\", version: \"18.0.6\", ngImport: i0, type: KeyValuePipe, isStandalone: true, name: \"keyvalue\", pure: false }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: KeyValuePipe, decorators: [{\n type: Pipe,\n args: [{\n name: 'keyvalue',\n pure: false,\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: i0.KeyValueDiffers }] });\nfunction defaultComparator(keyValueA, keyValueB) {\n const a = keyValueA.key;\n const b = keyValueB.key;\n // if same exit with 0;\n if (a === b)\n return 0;\n // make sure that undefined are at the end of the sort.\n if (a === undefined)\n return 1;\n if (b === undefined)\n return -1;\n // make sure that nulls are at the end of the sort.\n if (a === null)\n return 1;\n if (b === null)\n return -1;\n if (typeof a == 'string' && typeof b == 'string') {\n return a < b ? -1 : 1;\n }\n if (typeof a == 'number' && typeof b == 'number') {\n return a - b;\n }\n if (typeof a == 'boolean' && typeof b == 'boolean') {\n return a < b ? -1 : 1;\n }\n // `a` and `b` are of different types. Compare their string values.\n const aString = String(a);\n const bString = String(b);\n return aString == bString ? 0 : aString < bString ? -1 : 1;\n}\n\n/**\n * @ngModule CommonModule\n * @description\n *\n * Formats a value according to digit options and locale rules.\n * Locale determines group sizing and separator,\n * decimal point character, and other locale-specific configurations.\n *\n * @see {@link formatNumber}\n *\n * @usageNotes\n *\n * ### digitsInfo\n *\n * The value's decimal representation is specified by the `digitsInfo`\n * parameter, written in the following format:
    \n *\n * ```\n * {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}\n * ```\n *\n * - `minIntegerDigits`:\n * The minimum number of integer digits before the decimal point.\n * Default is 1.\n *\n * - `minFractionDigits`:\n * The minimum number of digits after the decimal point.\n * Default is 0.\n *\n * - `maxFractionDigits`:\n * The maximum number of digits after the decimal point.\n * Default is 3.\n *\n * If the formatted value is truncated it will be rounded using the \"to-nearest\" method:\n *\n * ```\n * {{3.6 | number: '1.0-0'}}\n * \n *\n * {{-3.6 | number:'1.0-0'}}\n * \n * ```\n *\n * ### locale\n *\n * `locale` will format a value according to locale rules.\n * Locale determines group sizing and separator,\n * decimal point character, and other locale-specific configurations.\n *\n * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.\n *\n * See [Setting your app locale](guide/i18n/locale-id).\n *\n * ### Example\n *\n * The following code shows how the pipe transforms values\n * according to various format specifications,\n * where the caller's default locale is `en-US`.\n *\n * \n *\n * @publicApi\n */\nclass DecimalPipe {\n constructor(_locale) {\n this._locale = _locale;\n }\n /**\n * @param value The value to be formatted.\n * @param digitsInfo Sets digit and decimal representation.\n * [See more](#digitsinfo).\n * @param locale Specifies what locale format rules to use.\n * [See more](#locale).\n */\n transform(value, digitsInfo, locale) {\n if (!isValue(value))\n return null;\n locale ||= this._locale;\n try {\n const num = strToNumber(value);\n return formatNumber(num, locale, digitsInfo);\n }\n catch (error) {\n throw invalidPipeArgumentError(DecimalPipe, error.message);\n }\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: DecimalPipe, deps: [{ token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Pipe }); }\n static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: \"14.0.0\", version: \"18.0.6\", ngImport: i0, type: DecimalPipe, isStandalone: true, name: \"number\" }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: DecimalPipe, decorators: [{\n type: Pipe,\n args: [{\n name: 'number',\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: undefined, decorators: [{\n type: Inject,\n args: [LOCALE_ID]\n }] }] });\n/**\n * @ngModule CommonModule\n * @description\n *\n * Transforms a number to a percentage\n * string, formatted according to locale rules that determine group sizing and\n * separator, decimal-point character, and other locale-specific\n * configurations.\n *\n * @see {@link formatPercent}\n *\n * @usageNotes\n * The following code shows how the pipe transforms numbers\n * into text strings, according to various format specifications,\n * where the caller's default locale is `en-US`.\n *\n * \n *\n * @publicApi\n */\nclass PercentPipe {\n constructor(_locale) {\n this._locale = _locale;\n }\n /**\n *\n * @param value The number to be formatted as a percentage.\n * @param digitsInfo Decimal representation options, specified by a string\n * in the following format:
    \n * {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}.\n * - `minIntegerDigits`: The minimum number of integer digits before the decimal point.\n * Default is `1`.\n * - `minFractionDigits`: The minimum number of digits after the decimal point.\n * Default is `0`.\n * - `maxFractionDigits`: The maximum number of digits after the decimal point.\n * Default is `0`.\n * @param locale A locale code for the locale format rules to use.\n * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.\n * See [Setting your app locale](guide/i18n/locale-id).\n */\n transform(value, digitsInfo, locale) {\n if (!isValue(value))\n return null;\n locale ||= this._locale;\n try {\n const num = strToNumber(value);\n return formatPercent(num, locale, digitsInfo);\n }\n catch (error) {\n throw invalidPipeArgumentError(PercentPipe, error.message);\n }\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: PercentPipe, deps: [{ token: LOCALE_ID }], target: i0.ɵɵFactoryTarget.Pipe }); }\n static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: \"14.0.0\", version: \"18.0.6\", ngImport: i0, type: PercentPipe, isStandalone: true, name: \"percent\" }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: PercentPipe, decorators: [{\n type: Pipe,\n args: [{\n name: 'percent',\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: undefined, decorators: [{\n type: Inject,\n args: [LOCALE_ID]\n }] }] });\n/**\n * @ngModule CommonModule\n * @description\n *\n * Transforms a number to a currency string, formatted according to locale rules\n * that determine group sizing and separator, decimal-point character,\n * and other locale-specific configurations.\n *\n *\n * @see {@link getCurrencySymbol}\n * @see {@link formatCurrency}\n *\n * @usageNotes\n * The following code shows how the pipe transforms numbers\n * into text strings, according to various format specifications,\n * where the caller's default locale is `en-US`.\n *\n * \n *\n * @publicApi\n */\nclass CurrencyPipe {\n constructor(_locale, _defaultCurrencyCode = 'USD') {\n this._locale = _locale;\n this._defaultCurrencyCode = _defaultCurrencyCode;\n }\n /**\n *\n * @param value The number to be formatted as currency.\n * @param currencyCode The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code,\n * such as `USD` for the US dollar and `EUR` for the euro. The default currency code can be\n * configured using the `DEFAULT_CURRENCY_CODE` injection token.\n * @param display The format for the currency indicator. One of the following:\n * - `code`: Show the code (such as `USD`).\n * - `symbol`(default): Show the symbol (such as `$`).\n * - `symbol-narrow`: Use the narrow symbol for locales that have two symbols for their\n * currency.\n * For example, the Canadian dollar CAD has the symbol `CA$` and the symbol-narrow `$`. If the\n * locale has no narrow symbol, uses the standard symbol for the locale.\n * - String: Use the given string value instead of a code or a symbol.\n * For example, an empty string will suppress the currency & symbol.\n * - Boolean (marked deprecated in v5): `true` for symbol and false for `code`.\n *\n * @param digitsInfo Decimal representation options, specified by a string\n * in the following format:
    \n * {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}.\n * - `minIntegerDigits`: The minimum number of integer digits before the decimal point.\n * Default is `1`.\n * - `minFractionDigits`: The minimum number of digits after the decimal point.\n * Default is `2`.\n * - `maxFractionDigits`: The maximum number of digits after the decimal point.\n * Default is `2`.\n * If not provided, the number will be formatted with the proper amount of digits,\n * depending on what the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) specifies.\n * For example, the Canadian dollar has 2 digits, whereas the Chilean peso has none.\n * @param locale A locale code for the locale format rules to use.\n * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.\n * See [Setting your app locale](guide/i18n/locale-id).\n */\n transform(value, currencyCode = this._defaultCurrencyCode, display = 'symbol', digitsInfo, locale) {\n if (!isValue(value))\n return null;\n locale ||= this._locale;\n if (typeof display === 'boolean') {\n if ((typeof ngDevMode === 'undefined' || ngDevMode) && console && console.warn) {\n console.warn(`Warning: the currency pipe has been changed in Angular v5. The symbolDisplay option (third parameter) is now a string instead of a boolean. The accepted values are \"code\", \"symbol\" or \"symbol-narrow\".`);\n }\n display = display ? 'symbol' : 'code';\n }\n let currency = currencyCode || this._defaultCurrencyCode;\n if (display !== 'code') {\n if (display === 'symbol' || display === 'symbol-narrow') {\n currency = getCurrencySymbol(currency, display === 'symbol' ? 'wide' : 'narrow', locale);\n }\n else {\n currency = display;\n }\n }\n try {\n const num = strToNumber(value);\n return formatCurrency(num, locale, currency, currencyCode, digitsInfo);\n }\n catch (error) {\n throw invalidPipeArgumentError(CurrencyPipe, error.message);\n }\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: CurrencyPipe, deps: [{ token: LOCALE_ID }, { token: DEFAULT_CURRENCY_CODE }], target: i0.ɵɵFactoryTarget.Pipe }); }\n static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: \"14.0.0\", version: \"18.0.6\", ngImport: i0, type: CurrencyPipe, isStandalone: true, name: \"currency\" }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: CurrencyPipe, decorators: [{\n type: Pipe,\n args: [{\n name: 'currency',\n standalone: true,\n }]\n }], ctorParameters: () => [{ type: undefined, decorators: [{\n type: Inject,\n args: [LOCALE_ID]\n }] }, { type: undefined, decorators: [{\n type: Inject,\n args: [DEFAULT_CURRENCY_CODE]\n }] }] });\nfunction isValue(value) {\n return !(value == null || value === '' || value !== value);\n}\n/**\n * Transforms a string into a number (if needed).\n */\nfunction strToNumber(value) {\n // Convert strings to numbers\n if (typeof value === 'string' && !isNaN(Number(value) - parseFloat(value))) {\n return Number(value);\n }\n if (typeof value !== 'number') {\n throw new Error(`${value} is not a number`);\n }\n return value;\n}\n\n/**\n * @ngModule CommonModule\n * @description\n *\n * Creates a new `Array` or `String` containing a subset (slice) of the elements.\n *\n * @usageNotes\n *\n * All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()`\n * and `String.prototype.slice()`.\n *\n * When operating on an `Array`, the returned `Array` is always a copy even when all\n * the elements are being returned.\n *\n * When operating on a blank value, the pipe returns the blank value.\n *\n * ### List Example\n *\n * This `ngFor` example:\n *\n * {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_list'}\n *\n * produces the following:\n *\n * ```html\n *
  • b
  • \n *
  • c
  • \n * ```\n *\n * ### String Examples\n *\n * {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'}\n *\n * @publicApi\n */\nclass SlicePipe {\n transform(value, start, end) {\n if (value == null)\n return null;\n if (!this.supports(value)) {\n throw invalidPipeArgumentError(SlicePipe, value);\n }\n return value.slice(start, end);\n }\n supports(obj) {\n return typeof obj === 'string' || Array.isArray(obj);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: SlicePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }\n static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: \"14.0.0\", version: \"18.0.6\", ngImport: i0, type: SlicePipe, isStandalone: true, name: \"slice\", pure: false }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: SlicePipe, decorators: [{\n type: Pipe,\n args: [{\n name: 'slice',\n pure: false,\n standalone: true,\n }]\n }] });\n\n/**\n * @module\n * @description\n * This module provides a set of common Pipes.\n */\n/**\n * A collection of Angular pipes that are likely to be used in each and every application.\n */\nconst COMMON_PIPES = [\n AsyncPipe,\n UpperCasePipe,\n LowerCasePipe,\n JsonPipe,\n SlicePipe,\n DecimalPipe,\n PercentPipe,\n TitleCasePipe,\n CurrencyPipe,\n DatePipe,\n I18nPluralPipe,\n I18nSelectPipe,\n KeyValuePipe,\n];\n\n// Note: This does not contain the location providers,\n// as they need some platform specific implementations to work.\n/**\n * Exports all the basic Angular directives and pipes,\n * such as `NgIf`, `NgForOf`, `DecimalPipe`, and so on.\n * Re-exported by `BrowserModule`, which is included automatically in the root\n * `AppModule` when you create a new app with the CLI `new` command.\n *\n * @publicApi\n */\nclass CommonModule {\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: CommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }\n static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"14.0.0\", version: \"18.0.6\", ngImport: i0, type: CommonModule, imports: [NgClass, NgComponentOutlet, NgForOf, NgIf, NgTemplateOutlet, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgPlural, NgPluralCase, AsyncPipe, UpperCasePipe, LowerCasePipe, JsonPipe, SlicePipe, DecimalPipe, PercentPipe, TitleCasePipe, CurrencyPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, KeyValuePipe], exports: [NgClass, NgComponentOutlet, NgForOf, NgIf, NgTemplateOutlet, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgPlural, NgPluralCase, AsyncPipe, UpperCasePipe, LowerCasePipe, JsonPipe, SlicePipe, DecimalPipe, PercentPipe, TitleCasePipe, CurrencyPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, KeyValuePipe] }); }\n static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: CommonModule }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: CommonModule, decorators: [{\n type: NgModule,\n args: [{\n imports: [COMMON_DIRECTIVES, COMMON_PIPES],\n exports: [COMMON_DIRECTIVES, COMMON_PIPES],\n }]\n }] });\n\nconst PLATFORM_BROWSER_ID = 'browser';\nconst PLATFORM_SERVER_ID = 'server';\n/**\n * Returns whether a platform id represents a browser platform.\n * @publicApi\n */\nfunction isPlatformBrowser(platformId) {\n return platformId === PLATFORM_BROWSER_ID;\n}\n/**\n * Returns whether a platform id represents a server platform.\n * @publicApi\n */\nfunction isPlatformServer(platformId) {\n return platformId === PLATFORM_SERVER_ID;\n}\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of the common package.\n */\n/**\n * @publicApi\n */\nconst VERSION = new Version('18.0.6');\n\n/**\n * Defines a scroll position manager. Implemented by `BrowserViewportScroller`.\n *\n * @publicApi\n */\nclass ViewportScroller {\n // De-sugared tree-shakable injection\n // See #23917\n /** @nocollapse */\n static { this.ɵprov = ɵɵdefineInjectable({\n token: ViewportScroller,\n providedIn: 'root',\n factory: () => isPlatformBrowser(inject(PLATFORM_ID))\n ? new BrowserViewportScroller(inject(DOCUMENT), window)\n : new NullViewportScroller(),\n }); }\n}\n/**\n * Manages the scroll position for a browser window.\n */\nclass BrowserViewportScroller {\n constructor(document, window) {\n this.document = document;\n this.window = window;\n this.offset = () => [0, 0];\n }\n /**\n * Configures the top offset used when scrolling to an anchor.\n * @param offset A position in screen coordinates (a tuple with x and y values)\n * or a function that returns the top offset position.\n *\n */\n setOffset(offset) {\n if (Array.isArray(offset)) {\n this.offset = () => offset;\n }\n else {\n this.offset = offset;\n }\n }\n /**\n * Retrieves the current scroll position.\n * @returns The position in screen coordinates.\n */\n getScrollPosition() {\n return [this.window.scrollX, this.window.scrollY];\n }\n /**\n * Sets the scroll position.\n * @param position The new position in screen coordinates.\n */\n scrollToPosition(position) {\n this.window.scrollTo(position[0], position[1]);\n }\n /**\n * Scrolls to an element and attempts to focus the element.\n *\n * Note that the function name here is misleading in that the target string may be an ID for a\n * non-anchor element.\n *\n * @param target The ID of an element or name of the anchor.\n *\n * @see https://html.spec.whatwg.org/#the-indicated-part-of-the-document\n * @see https://html.spec.whatwg.org/#scroll-to-fragid\n */\n scrollToAnchor(target) {\n const elSelected = findAnchorFromDocument(this.document, target);\n if (elSelected) {\n this.scrollToElement(elSelected);\n // After scrolling to the element, the spec dictates that we follow the focus steps for the\n // target. Rather than following the robust steps, simply attempt focus.\n //\n // @see https://html.spec.whatwg.org/#get-the-focusable-area\n // @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus\n // @see https://html.spec.whatwg.org/#focusable-area\n elSelected.focus();\n }\n }\n /**\n * Disables automatic scroll restoration provided by the browser.\n */\n setHistoryScrollRestoration(scrollRestoration) {\n this.window.history.scrollRestoration = scrollRestoration;\n }\n /**\n * Scrolls to an element using the native offset and the specified offset set on this scroller.\n *\n * The offset can be used when we know that there is a floating header and scrolling naively to an\n * element (ex: `scrollIntoView`) leaves the element hidden behind the floating header.\n */\n scrollToElement(el) {\n const rect = el.getBoundingClientRect();\n const left = rect.left + this.window.pageXOffset;\n const top = rect.top + this.window.pageYOffset;\n const offset = this.offset();\n this.window.scrollTo(left - offset[0], top - offset[1]);\n }\n}\nfunction findAnchorFromDocument(document, target) {\n const documentResult = document.getElementById(target) || document.getElementsByName(target)[0];\n if (documentResult) {\n return documentResult;\n }\n // `getElementById` and `getElementsByName` won't pierce through the shadow DOM so we\n // have to traverse the DOM manually and do the lookup through the shadow roots.\n if (typeof document.createTreeWalker === 'function' &&\n document.body &&\n typeof document.body.attachShadow === 'function') {\n const treeWalker = document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT);\n let currentNode = treeWalker.currentNode;\n while (currentNode) {\n const shadowRoot = currentNode.shadowRoot;\n if (shadowRoot) {\n // Note that `ShadowRoot` doesn't support `getElementsByName`\n // so we have to fall back to `querySelector`.\n const result = shadowRoot.getElementById(target) || shadowRoot.querySelector(`[name=\"${target}\"]`);\n if (result) {\n return result;\n }\n }\n currentNode = treeWalker.nextNode();\n }\n }\n return null;\n}\n/**\n * Provides an empty implementation of the viewport scroller.\n */\nclass NullViewportScroller {\n /**\n * Empty implementation\n */\n setOffset(offset) { }\n /**\n * Empty implementation\n */\n getScrollPosition() {\n return [0, 0];\n }\n /**\n * Empty implementation\n */\n scrollToPosition(position) { }\n /**\n * Empty implementation\n */\n scrollToAnchor(anchor) { }\n /**\n * Empty implementation\n */\n setHistoryScrollRestoration(scrollRestoration) { }\n}\n\n/**\n * A wrapper around the `XMLHttpRequest` constructor.\n *\n * @publicApi\n */\nclass XhrFactory {\n}\n\n/**\n * Value (out of 100) of the requested quality for placeholder images.\n */\nconst PLACEHOLDER_QUALITY = '20';\n\n// Converts a string that represents a URL into a URL class instance.\nfunction getUrl(src, win) {\n // Don't use a base URL is the URL is absolute.\n return isAbsoluteUrl(src) ? new URL(src) : new URL(src, win.location.href);\n}\n// Checks whether a URL is absolute (i.e. starts with `http://` or `https://`).\nfunction isAbsoluteUrl(src) {\n return /^https?:\\/\\//.test(src);\n}\n// Given a URL, extract the hostname part.\n// If a URL is a relative one - the URL is returned as is.\nfunction extractHostname(url) {\n return isAbsoluteUrl(url) ? new URL(url).hostname : url;\n}\nfunction isValidPath(path) {\n const isString = typeof path === 'string';\n if (!isString || path.trim() === '') {\n return false;\n }\n // Calling new URL() will throw if the path string is malformed\n try {\n const url = new URL(path);\n return true;\n }\n catch {\n return false;\n }\n}\nfunction normalizePath(path) {\n return path.endsWith('/') ? path.slice(0, -1) : path;\n}\nfunction normalizeSrc(src) {\n return src.startsWith('/') ? src.slice(1) : src;\n}\n\n/**\n * Noop image loader that does no transformation to the original src and just returns it as is.\n * This loader is used as a default one if more specific logic is not provided in an app config.\n *\n * @see {@link ImageLoader}\n * @see {@link NgOptimizedImage}\n */\nconst noopImageLoader = (config) => config.src;\n/**\n * Injection token that configures the image loader function.\n *\n * @see {@link ImageLoader}\n * @see {@link NgOptimizedImage}\n * @publicApi\n */\nconst IMAGE_LOADER = new InjectionToken(ngDevMode ? 'ImageLoader' : '', {\n providedIn: 'root',\n factory: () => noopImageLoader,\n});\n/**\n * Internal helper function that makes it easier to introduce custom image loaders for the\n * `NgOptimizedImage` directive. It is enough to specify a URL builder function to obtain full DI\n * configuration for a given loader: a DI token corresponding to the actual loader function, plus DI\n * tokens managing preconnect check functionality.\n * @param buildUrlFn a function returning a full URL based on loader's configuration\n * @param exampleUrls example of full URLs for a given loader (used in error messages)\n * @returns a set of DI providers corresponding to the configured image loader\n */\nfunction createImageLoader(buildUrlFn, exampleUrls) {\n return function provideImageLoader(path) {\n if (!isValidPath(path)) {\n throwInvalidPathError(path, exampleUrls || []);\n }\n // The trailing / is stripped (if provided) to make URL construction (concatenation) easier in\n // the individual loader functions.\n path = normalizePath(path);\n const loaderFn = (config) => {\n if (isAbsoluteUrl(config.src)) {\n // Image loader functions expect an image file name (e.g. `my-image.png`)\n // or a relative path + a file name (e.g. `/a/b/c/my-image.png`) as an input,\n // so the final absolute URL can be constructed.\n // When an absolute URL is provided instead - the loader can not\n // build a final URL, thus the error is thrown to indicate that.\n throwUnexpectedAbsoluteUrlError(path, config.src);\n }\n return buildUrlFn(path, { ...config, src: normalizeSrc(config.src) });\n };\n const providers = [{ provide: IMAGE_LOADER, useValue: loaderFn }];\n return providers;\n };\n}\nfunction throwInvalidPathError(path, exampleUrls) {\n throw new ɵRuntimeError(2959 /* RuntimeErrorCode.INVALID_LOADER_ARGUMENTS */, ngDevMode &&\n `Image loader has detected an invalid path (\\`${path}\\`). ` +\n `To fix this, supply a path using one of the following formats: ${exampleUrls.join(' or ')}`);\n}\nfunction throwUnexpectedAbsoluteUrlError(path, url) {\n throw new ɵRuntimeError(2959 /* RuntimeErrorCode.INVALID_LOADER_ARGUMENTS */, ngDevMode &&\n `Image loader has detected a \\`\\` tag with an invalid \\`ngSrc\\` attribute: ${url}. ` +\n `This image loader expects \\`ngSrc\\` to be a relative URL - ` +\n `however the provided value is an absolute URL. ` +\n `To fix this, provide \\`ngSrc\\` as a path relative to the base URL ` +\n `configured for this loader (\\`${path}\\`).`);\n}\n\n/**\n * Function that generates an ImageLoader for [Cloudflare Image\n * Resizing](https://developers.cloudflare.com/images/image-resizing/) and turns it into an Angular\n * provider. Note: Cloudflare has multiple image products - this provider is specifically for\n * Cloudflare Image Resizing; it will not work with Cloudflare Images or Cloudflare Polish.\n *\n * @param path Your domain name, e.g. https://mysite.com\n * @returns Provider that provides an ImageLoader function\n *\n * @publicApi\n */\nconst provideCloudflareLoader = createImageLoader(createCloudflareUrl, ngDevMode ? ['https:///cdn-cgi/image//'] : undefined);\nfunction createCloudflareUrl(path, config) {\n let params = `format=auto`;\n if (config.width) {\n params += `,width=${config.width}`;\n }\n // When requesting a placeholder image we ask for a low quality image to reduce the load time.\n if (config.isPlaceholder) {\n params += `,quality=${PLACEHOLDER_QUALITY}`;\n }\n // Cloudflare image URLs format:\n // https://developers.cloudflare.com/images/image-resizing/url-format/\n return `${path}/cdn-cgi/image/${params}/${config.src}`;\n}\n\n/**\n * Name and URL tester for Cloudinary.\n */\nconst cloudinaryLoaderInfo = {\n name: 'Cloudinary',\n testUrl: isCloudinaryUrl,\n};\nconst CLOUDINARY_LOADER_REGEX = /https?\\:\\/\\/[^\\/]+\\.cloudinary\\.com\\/.+/;\n/**\n * Tests whether a URL is from Cloudinary CDN.\n */\nfunction isCloudinaryUrl(url) {\n return CLOUDINARY_LOADER_REGEX.test(url);\n}\n/**\n * Function that generates an ImageLoader for Cloudinary and turns it into an Angular provider.\n *\n * @param path Base URL of your Cloudinary images\n * This URL should match one of the following formats:\n * https://res.cloudinary.com/mysite\n * https://mysite.cloudinary.com\n * https://subdomain.mysite.com\n * @returns Set of providers to configure the Cloudinary loader.\n *\n * @publicApi\n */\nconst provideCloudinaryLoader = createImageLoader(createCloudinaryUrl, ngDevMode\n ? [\n 'https://res.cloudinary.com/mysite',\n 'https://mysite.cloudinary.com',\n 'https://subdomain.mysite.com',\n ]\n : undefined);\nfunction createCloudinaryUrl(path, config) {\n // Cloudinary image URLformat:\n // https://cloudinary.com/documentation/image_transformations#transformation_url_structure\n // Example of a Cloudinary image URL:\n // https://res.cloudinary.com/mysite/image/upload/c_scale,f_auto,q_auto,w_600/marketing/tile-topics-m.png\n // For a placeholder image, we use the lowest image setting available to reduce the load time\n // else we use the auto size\n const quality = config.isPlaceholder ? 'q_auto:low' : 'q_auto';\n let params = `f_auto,${quality}`;\n if (config.width) {\n params += `,w_${config.width}`;\n }\n return `${path}/image/upload/${params}/${config.src}`;\n}\n\n/**\n * Name and URL tester for ImageKit.\n */\nconst imageKitLoaderInfo = {\n name: 'ImageKit',\n testUrl: isImageKitUrl,\n};\nconst IMAGE_KIT_LOADER_REGEX = /https?\\:\\/\\/[^\\/]+\\.imagekit\\.io\\/.+/;\n/**\n * Tests whether a URL is from ImageKit CDN.\n */\nfunction isImageKitUrl(url) {\n return IMAGE_KIT_LOADER_REGEX.test(url);\n}\n/**\n * Function that generates an ImageLoader for ImageKit and turns it into an Angular provider.\n *\n * @param path Base URL of your ImageKit images\n * This URL should match one of the following formats:\n * https://ik.imagekit.io/myaccount\n * https://subdomain.mysite.com\n * @returns Set of providers to configure the ImageKit loader.\n *\n * @publicApi\n */\nconst provideImageKitLoader = createImageLoader(createImagekitUrl, ngDevMode ? ['https://ik.imagekit.io/mysite', 'https://subdomain.mysite.com'] : undefined);\nfunction createImagekitUrl(path, config) {\n // Example of an ImageKit image URL:\n // https://ik.imagekit.io/demo/tr:w-300,h-300/medium_cafe_B1iTdD0C.jpg\n const { src, width } = config;\n const params = [];\n if (width) {\n params.push(`w-${width}`);\n }\n // When requesting a placeholder image we ask for a low quality image to reduce the load time.\n if (config.isPlaceholder) {\n params.push(`q-${PLACEHOLDER_QUALITY}`);\n }\n const urlSegments = params.length ? [path, `tr:${params.join(',')}`, src] : [path, src];\n const url = new URL(urlSegments.join('/'));\n return url.href;\n}\n\n/**\n * Name and URL tester for Imgix.\n */\nconst imgixLoaderInfo = {\n name: 'Imgix',\n testUrl: isImgixUrl,\n};\nconst IMGIX_LOADER_REGEX = /https?\\:\\/\\/[^\\/]+\\.imgix\\.net\\/.+/;\n/**\n * Tests whether a URL is from Imgix CDN.\n */\nfunction isImgixUrl(url) {\n return IMGIX_LOADER_REGEX.test(url);\n}\n/**\n * Function that generates an ImageLoader for Imgix and turns it into an Angular provider.\n *\n * @param path path to the desired Imgix origin,\n * e.g. https://somepath.imgix.net or https://images.mysite.com\n * @returns Set of providers to configure the Imgix loader.\n *\n * @publicApi\n */\nconst provideImgixLoader = createImageLoader(createImgixUrl, ngDevMode ? ['https://somepath.imgix.net/'] : undefined);\nfunction createImgixUrl(path, config) {\n const url = new URL(`${path}/${config.src}`);\n // This setting ensures the smallest allowable format is set.\n url.searchParams.set('auto', 'format');\n if (config.width) {\n url.searchParams.set('w', config.width.toString());\n }\n // When requesting a placeholder image we ask a low quality image to reduce the load time.\n if (config.isPlaceholder) {\n url.searchParams.set('q', PLACEHOLDER_QUALITY);\n }\n return url.href;\n}\n\n/**\n * Name and URL tester for Netlify.\n */\nconst netlifyLoaderInfo = {\n name: 'Netlify',\n testUrl: isNetlifyUrl,\n};\nconst NETLIFY_LOADER_REGEX = /https?\\:\\/\\/[^\\/]+\\.netlify\\.app\\/.+/;\n/**\n * Tests whether a URL is from a Netlify site. This won't catch sites with a custom domain,\n * but it's a good start for sites in development. This is only used to warn users who haven't\n * configured an image loader.\n */\nfunction isNetlifyUrl(url) {\n return NETLIFY_LOADER_REGEX.test(url);\n}\n/**\n * Function that generates an ImageLoader for Netlify and turns it into an Angular provider.\n *\n * @param path optional URL of the desired Netlify site. Defaults to the current site.\n * @returns Set of providers to configure the Netlify loader.\n *\n * @publicApi\n */\nfunction provideNetlifyLoader(path) {\n if (path && !isValidPath(path)) {\n throw new ɵRuntimeError(2959 /* RuntimeErrorCode.INVALID_LOADER_ARGUMENTS */, ngDevMode &&\n `Image loader has detected an invalid path (\\`${path}\\`). ` +\n `To fix this, supply either the full URL to the Netlify site, or leave it empty to use the current site.`);\n }\n if (path) {\n const url = new URL(path);\n path = url.origin;\n }\n const loaderFn = (config) => {\n return createNetlifyUrl(config, path);\n };\n const providers = [{ provide: IMAGE_LOADER, useValue: loaderFn }];\n return providers;\n}\nconst validParams = new Map([\n ['height', 'h'],\n ['fit', 'fit'],\n ['quality', 'q'],\n ['q', 'q'],\n ['position', 'position'],\n]);\nfunction createNetlifyUrl(config, path) {\n // Note: `path` can be undefined, in which case we use a fake one to construct a `URL` instance.\n const url = new URL(path ?? 'https://a/');\n url.pathname = '/.netlify/images';\n if (!isAbsoluteUrl(config.src) && !config.src.startsWith('/')) {\n config.src = '/' + config.src;\n }\n url.searchParams.set('url', config.src);\n if (config.width) {\n url.searchParams.set('w', config.width.toString());\n }\n // When requesting a placeholder image we ask for a low quality image to reduce the load time.\n // If the quality is specified in the loader config - always use provided value.\n const configQuality = config.loaderParams?.['quality'] ?? config.loaderParams?.['q'];\n if (config.isPlaceholder && !configQuality) {\n url.searchParams.set('q', PLACEHOLDER_QUALITY);\n }\n for (const [param, value] of Object.entries(config.loaderParams ?? {})) {\n if (validParams.has(param)) {\n url.searchParams.set(validParams.get(param), value.toString());\n }\n else {\n if (ngDevMode) {\n console.warn(ɵformatRuntimeError(2959 /* RuntimeErrorCode.INVALID_LOADER_ARGUMENTS */, `The Netlify image loader has detected an \\`\\` tag with the unsupported attribute \"\\`${param}\\`\".`));\n }\n }\n }\n // The \"a\" hostname is used for relative URLs, so we can remove it from the final URL.\n return url.hostname === 'a' ? url.href.replace(url.origin, '') : url.href;\n}\n\n// Assembles directive details string, useful for error messages.\nfunction imgDirectiveDetails(ngSrc, includeNgSrc = true) {\n const ngSrcInfo = includeNgSrc\n ? `(activated on an element with the \\`ngSrc=\"${ngSrc}\"\\`) `\n : '';\n return `The NgOptimizedImage directive ${ngSrcInfo}has detected that`;\n}\n\n/**\n * Asserts that the application is in development mode. Throws an error if the application is in\n * production mode. This assert can be used to make sure that there is no dev-mode code invoked in\n * the prod mode accidentally.\n */\nfunction assertDevMode(checkName) {\n if (!ngDevMode) {\n throw new ɵRuntimeError(2958 /* RuntimeErrorCode.UNEXPECTED_DEV_MODE_CHECK_IN_PROD_MODE */, `Unexpected invocation of the ${checkName} in the prod mode. ` +\n `Please make sure that the prod mode is enabled for production builds.`);\n }\n}\n\n/**\n * Observer that detects whether an image with `NgOptimizedImage`\n * is treated as a Largest Contentful Paint (LCP) element. If so,\n * asserts that the image has the `priority` attribute.\n *\n * Note: this is a dev-mode only class and it does not appear in prod bundles,\n * thus there is no `ngDevMode` use in the code.\n *\n * Based on https://web.dev/lcp/#measure-lcp-in-javascript.\n */\nclass LCPImageObserver {\n constructor() {\n // Map of full image URLs -> original `ngSrc` values.\n this.images = new Map();\n this.window = null;\n this.observer = null;\n assertDevMode('LCP checker');\n const win = inject(DOCUMENT).defaultView;\n if (typeof win !== 'undefined' && typeof PerformanceObserver !== 'undefined') {\n this.window = win;\n this.observer = this.initPerformanceObserver();\n }\n }\n /**\n * Inits PerformanceObserver and subscribes to LCP events.\n * Based on https://web.dev/lcp/#measure-lcp-in-javascript\n */\n initPerformanceObserver() {\n const observer = new PerformanceObserver((entryList) => {\n const entries = entryList.getEntries();\n if (entries.length === 0)\n return;\n // We use the latest entry produced by the `PerformanceObserver` as the best\n // signal on which element is actually an LCP one. As an example, the first image to load on\n // a page, by virtue of being the only thing on the page so far, is often a LCP candidate\n // and gets reported by PerformanceObserver, but isn't necessarily the LCP element.\n const lcpElement = entries[entries.length - 1];\n // Cast to `any` due to missing `element` on the `LargestContentfulPaint` type of entry.\n // See https://developer.mozilla.org/en-US/docs/Web/API/LargestContentfulPaint\n const imgSrc = lcpElement.element?.src ?? '';\n // Exclude `data:` and `blob:` URLs, since they are not supported by the directive.\n if (imgSrc.startsWith('data:') || imgSrc.startsWith('blob:'))\n return;\n const img = this.images.get(imgSrc);\n if (!img)\n return;\n if (!img.priority && !img.alreadyWarnedPriority) {\n img.alreadyWarnedPriority = true;\n logMissingPriorityError(imgSrc);\n }\n if (img.modified && !img.alreadyWarnedModified) {\n img.alreadyWarnedModified = true;\n logModifiedWarning(imgSrc);\n }\n });\n observer.observe({ type: 'largest-contentful-paint', buffered: true });\n return observer;\n }\n registerImage(rewrittenSrc, originalNgSrc, isPriority) {\n if (!this.observer)\n return;\n const newObservedImageState = {\n priority: isPriority,\n modified: false,\n alreadyWarnedModified: false,\n alreadyWarnedPriority: false,\n };\n this.images.set(getUrl(rewrittenSrc, this.window).href, newObservedImageState);\n }\n unregisterImage(rewrittenSrc) {\n if (!this.observer)\n return;\n this.images.delete(getUrl(rewrittenSrc, this.window).href);\n }\n updateImage(originalSrc, newSrc) {\n const originalUrl = getUrl(originalSrc, this.window).href;\n const img = this.images.get(originalUrl);\n if (img) {\n img.modified = true;\n this.images.set(getUrl(newSrc, this.window).href, img);\n this.images.delete(originalUrl);\n }\n }\n ngOnDestroy() {\n if (!this.observer)\n return;\n this.observer.disconnect();\n this.images.clear();\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: LCPImageObserver, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: LCPImageObserver, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: LCPImageObserver, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }], ctorParameters: () => [] });\nfunction logMissingPriorityError(ngSrc) {\n const directiveDetails = imgDirectiveDetails(ngSrc);\n console.error(ɵformatRuntimeError(2955 /* RuntimeErrorCode.LCP_IMG_MISSING_PRIORITY */, `${directiveDetails} this image is the Largest Contentful Paint (LCP) ` +\n `element but was not marked \"priority\". This image should be marked ` +\n `\"priority\" in order to prioritize its loading. ` +\n `To fix this, add the \"priority\" attribute.`));\n}\nfunction logModifiedWarning(ngSrc) {\n const directiveDetails = imgDirectiveDetails(ngSrc);\n console.warn(ɵformatRuntimeError(2964 /* RuntimeErrorCode.LCP_IMG_NGSRC_MODIFIED */, `${directiveDetails} this image is the Largest Contentful Paint (LCP) ` +\n `element and has had its \"ngSrc\" attribute modified. This can cause ` +\n `slower loading performance. It is recommended not to modify the \"ngSrc\" ` +\n `property on any image which could be the LCP element.`));\n}\n\n// Set of origins that are always excluded from the preconnect checks.\nconst INTERNAL_PRECONNECT_CHECK_BLOCKLIST = new Set(['localhost', '127.0.0.1', '0.0.0.0']);\n/**\n * Injection token to configure which origins should be excluded\n * from the preconnect checks. It can either be a single string or an array of strings\n * to represent a group of origins, for example:\n *\n * ```typescript\n * {provide: PRECONNECT_CHECK_BLOCKLIST, useValue: 'https://your-domain.com'}\n * ```\n *\n * or:\n *\n * ```typescript\n * {provide: PRECONNECT_CHECK_BLOCKLIST,\n * useValue: ['https://your-domain-1.com', 'https://your-domain-2.com']}\n * ```\n *\n * @publicApi\n */\nconst PRECONNECT_CHECK_BLOCKLIST = new InjectionToken(ngDevMode ? 'PRECONNECT_CHECK_BLOCKLIST' : '');\n/**\n * Contains the logic to detect whether an image, marked with the \"priority\" attribute\n * has a corresponding `` tag in the `document.head`.\n *\n * Note: this is a dev-mode only class, which should not appear in prod bundles,\n * thus there is no `ngDevMode` use in the code.\n */\nclass PreconnectLinkChecker {\n constructor() {\n this.document = inject(DOCUMENT);\n /**\n * Set of tags found on this page.\n * The `null` value indicates that there was no DOM query operation performed.\n */\n this.preconnectLinks = null;\n /*\n * Keep track of all already seen origin URLs to avoid repeating the same check.\n */\n this.alreadySeen = new Set();\n this.window = null;\n this.blocklist = new Set(INTERNAL_PRECONNECT_CHECK_BLOCKLIST);\n assertDevMode('preconnect link checker');\n const win = this.document.defaultView;\n if (typeof win !== 'undefined') {\n this.window = win;\n }\n const blocklist = inject(PRECONNECT_CHECK_BLOCKLIST, { optional: true });\n if (blocklist) {\n this.populateBlocklist(blocklist);\n }\n }\n populateBlocklist(origins) {\n if (Array.isArray(origins)) {\n deepForEach(origins, (origin) => {\n this.blocklist.add(extractHostname(origin));\n });\n }\n else {\n this.blocklist.add(extractHostname(origins));\n }\n }\n /**\n * Checks that a preconnect resource hint exists in the head for the\n * given src.\n *\n * @param rewrittenSrc src formatted with loader\n * @param originalNgSrc ngSrc value\n */\n assertPreconnect(rewrittenSrc, originalNgSrc) {\n if (!this.window)\n return;\n const imgUrl = getUrl(rewrittenSrc, this.window);\n if (this.blocklist.has(imgUrl.hostname) || this.alreadySeen.has(imgUrl.origin))\n return;\n // Register this origin as seen, so we don't check it again later.\n this.alreadySeen.add(imgUrl.origin);\n // Note: we query for preconnect links only *once* and cache the results\n // for the entire lifespan of an application, since it's unlikely that the\n // list would change frequently. This allows to make sure there are no\n // performance implications of making extra DOM lookups for each image.\n this.preconnectLinks ??= this.queryPreconnectLinks();\n if (!this.preconnectLinks.has(imgUrl.origin)) {\n console.warn(ɵformatRuntimeError(2956 /* RuntimeErrorCode.PRIORITY_IMG_MISSING_PRECONNECT_TAG */, `${imgDirectiveDetails(originalNgSrc)} there is no preconnect tag present for this ` +\n `image. Preconnecting to the origin(s) that serve priority images ensures that these ` +\n `images are delivered as soon as possible. To fix this, please add the following ` +\n `element into the of the document:\\n` +\n ` `));\n }\n }\n queryPreconnectLinks() {\n const preconnectUrls = new Set();\n const selector = 'link[rel=preconnect]';\n const links = Array.from(this.document.querySelectorAll(selector));\n for (let link of links) {\n const url = getUrl(link.href, this.window);\n preconnectUrls.add(url.origin);\n }\n return preconnectUrls;\n }\n ngOnDestroy() {\n this.preconnectLinks?.clear();\n this.alreadySeen.clear();\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: PreconnectLinkChecker, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: PreconnectLinkChecker, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: PreconnectLinkChecker, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }], ctorParameters: () => [] });\n/**\n * Invokes a callback for each element in the array. Also invokes a callback\n * recursively for each nested array.\n */\nfunction deepForEach(input, fn) {\n for (let value of input) {\n Array.isArray(value) ? deepForEach(value, fn) : fn(value);\n }\n}\n\n/**\n * In SSR scenarios, a preload `` element is generated for priority images.\n * Having a large number of preload tags may negatively affect the performance,\n * so we warn developers (by throwing an error) if the number of preloaded images\n * is above a certain threshold. This const specifies this threshold.\n */\nconst DEFAULT_PRELOADED_IMAGES_LIMIT = 5;\n/**\n * Helps to keep track of priority images that already have a corresponding\n * preload tag (to avoid generating multiple preload tags with the same URL).\n *\n * This Set tracks the original src passed into the `ngSrc` input not the src after it has been\n * run through the specified `IMAGE_LOADER`.\n */\nconst PRELOADED_IMAGES = new InjectionToken('NG_OPTIMIZED_PRELOADED_IMAGES', {\n providedIn: 'root',\n factory: () => new Set(),\n});\n\n/**\n * @description Contains the logic needed to track and add preload link tags to the `` tag. It\n * will also track what images have already had preload link tags added so as to not duplicate link\n * tags.\n *\n * In dev mode this service will validate that the number of preloaded images does not exceed the\n * configured default preloaded images limit: {@link DEFAULT_PRELOADED_IMAGES_LIMIT}.\n */\nclass PreloadLinkCreator {\n constructor() {\n this.preloadedImages = inject(PRELOADED_IMAGES);\n this.document = inject(DOCUMENT);\n }\n /**\n * @description Add a preload `` to the `` of the `index.html` that is served from the\n * server while using Angular Universal and SSR to kick off image loads for high priority images.\n *\n * The `sizes` (passed in from the user) and `srcset` (parsed and formatted from `ngSrcset`)\n * properties used to set the corresponding attributes, `imagesizes` and `imagesrcset`\n * respectively, on the preload `` tag so that the correctly sized image is preloaded from\n * the CDN.\n *\n * {@link https://web.dev/preload-responsive-images/#imagesrcset-and-imagesizes}\n *\n * @param renderer The `Renderer2` passed in from the directive\n * @param src The original src of the image that is set on the `ngSrc` input.\n * @param srcset The parsed and formatted srcset created from the `ngSrcset` input\n * @param sizes The value of the `sizes` attribute passed in to the `` tag\n */\n createPreloadLinkTag(renderer, src, srcset, sizes) {\n if (ngDevMode) {\n if (this.preloadedImages.size >= DEFAULT_PRELOADED_IMAGES_LIMIT) {\n throw new ɵRuntimeError(2961 /* RuntimeErrorCode.TOO_MANY_PRELOADED_IMAGES */, ngDevMode &&\n `The \\`NgOptimizedImage\\` directive has detected that more than ` +\n `${DEFAULT_PRELOADED_IMAGES_LIMIT} images were marked as priority. ` +\n `This might negatively affect an overall performance of the page. ` +\n `To fix this, remove the \"priority\" attribute from images with less priority.`);\n }\n }\n if (this.preloadedImages.has(src)) {\n return;\n }\n this.preloadedImages.add(src);\n const preload = renderer.createElement('link');\n renderer.setAttribute(preload, 'as', 'image');\n renderer.setAttribute(preload, 'href', src);\n renderer.setAttribute(preload, 'rel', 'preload');\n renderer.setAttribute(preload, 'fetchpriority', 'high');\n if (sizes) {\n renderer.setAttribute(preload, 'imageSizes', sizes);\n }\n if (srcset) {\n renderer.setAttribute(preload, 'imageSrcset', srcset);\n }\n renderer.appendChild(this.document.head, preload);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: PreloadLinkCreator, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: PreloadLinkCreator, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: PreloadLinkCreator, decorators: [{\n type: Injectable,\n args: [{ providedIn: 'root' }]\n }] });\n\n/**\n * When a Base64-encoded image is passed as an input to the `NgOptimizedImage` directive,\n * an error is thrown. The image content (as a string) might be very long, thus making\n * it hard to read an error message if the entire string is included. This const defines\n * the number of characters that should be included into the error message. The rest\n * of the content is truncated.\n */\nconst BASE64_IMG_MAX_LENGTH_IN_ERROR = 50;\n/**\n * RegExpr to determine whether a src in a srcset is using width descriptors.\n * Should match something like: \"100w, 200w\".\n */\nconst VALID_WIDTH_DESCRIPTOR_SRCSET = /^((\\s*\\d+w\\s*(,|$)){1,})$/;\n/**\n * RegExpr to determine whether a src in a srcset is using density descriptors.\n * Should match something like: \"1x, 2x, 50x\". Also supports decimals like \"1.5x, 1.50x\".\n */\nconst VALID_DENSITY_DESCRIPTOR_SRCSET = /^((\\s*\\d+(\\.\\d+)?x\\s*(,|$)){1,})$/;\n/**\n * Srcset values with a density descriptor higher than this value will actively\n * throw an error. Such densities are not permitted as they cause image sizes\n * to be unreasonably large and slow down LCP.\n */\nconst ABSOLUTE_SRCSET_DENSITY_CAP = 3;\n/**\n * Used only in error message text to communicate best practices, as we will\n * only throw based on the slightly more conservative ABSOLUTE_SRCSET_DENSITY_CAP.\n */\nconst RECOMMENDED_SRCSET_DENSITY_CAP = 2;\n/**\n * Used in generating automatic density-based srcsets\n */\nconst DENSITY_SRCSET_MULTIPLIERS = [1, 2];\n/**\n * Used to determine which breakpoints to use on full-width images\n */\nconst VIEWPORT_BREAKPOINT_CUTOFF = 640;\n/**\n * Used to determine whether two aspect ratios are similar in value.\n */\nconst ASPECT_RATIO_TOLERANCE = 0.1;\n/**\n * Used to determine whether the image has been requested at an overly\n * large size compared to the actual rendered image size (after taking\n * into account a typical device pixel ratio). In pixels.\n */\nconst OVERSIZED_IMAGE_TOLERANCE = 1000;\n/**\n * Used to limit automatic srcset generation of very large sources for\n * fixed-size images. In pixels.\n */\nconst FIXED_SRCSET_WIDTH_LIMIT = 1920;\nconst FIXED_SRCSET_HEIGHT_LIMIT = 1080;\n/**\n * Default blur radius of the CSS filter used on placeholder images, in pixels\n */\nconst PLACEHOLDER_BLUR_AMOUNT = 15;\n/**\n * Used to warn or error when the user provides an overly large dataURL for the placeholder\n * attribute.\n * Character count of Base64 images is 1 character per byte, and base64 encoding is approximately\n * 33% larger than base images, so 4000 characters is around 3KB on disk and 10000 characters is\n * around 7.7KB. Experimentally, 4000 characters is about 20x20px in PNG or medium-quality JPEG\n * format, and 10,000 is around 50x50px, but there's quite a bit of variation depending on how the\n * image is saved.\n */\nconst DATA_URL_WARN_LIMIT = 4000;\nconst DATA_URL_ERROR_LIMIT = 10000;\n/** Info about built-in loaders we can test for. */\nconst BUILT_IN_LOADERS = [\n imgixLoaderInfo,\n imageKitLoaderInfo,\n cloudinaryLoaderInfo,\n netlifyLoaderInfo,\n];\n/**\n * Directive that improves image loading performance by enforcing best practices.\n *\n * `NgOptimizedImage` ensures that the loading of the Largest Contentful Paint (LCP) image is\n * prioritized by:\n * - Automatically setting the `fetchpriority` attribute on the `` tag\n * - Lazy loading non-priority images by default\n * - Automatically generating a preconnect link tag in the document head\n *\n * In addition, the directive:\n * - Generates appropriate asset URLs if a corresponding `ImageLoader` function is provided\n * - Automatically generates a srcset\n * - Requires that `width` and `height` are set\n * - Warns if `width` or `height` have been set incorrectly\n * - Warns if the image will be visually distorted when rendered\n *\n * @usageNotes\n * The `NgOptimizedImage` directive is marked as [standalone](guide/components/importing) and can\n * be imported directly.\n *\n * Follow the steps below to enable and use the directive:\n * 1. Import it into the necessary NgModule or a standalone Component.\n * 2. Optionally provide an `ImageLoader` if you use an image hosting service.\n * 3. Update the necessary `` tags in templates and replace `src` attributes with `ngSrc`.\n * Using a `ngSrc` allows the directive to control when the `src` gets set, which triggers an image\n * download.\n *\n * Step 1: import the `NgOptimizedImage` directive.\n *\n * ```typescript\n * import { NgOptimizedImage } from '@angular/common';\n *\n * // Include it into the necessary NgModule\n * @NgModule({\n * imports: [NgOptimizedImage],\n * })\n * class AppModule {}\n *\n * // ... or a standalone Component\n * @Component({\n * standalone: true\n * imports: [NgOptimizedImage],\n * })\n * class MyStandaloneComponent {}\n * ```\n *\n * Step 2: configure a loader.\n *\n * To use the **default loader**: no additional code changes are necessary. The URL returned by the\n * generic loader will always match the value of \"src\". In other words, this loader applies no\n * transformations to the resource URL and the value of the `ngSrc` attribute will be used as is.\n *\n * To use an existing loader for a **third-party image service**: add the provider factory for your\n * chosen service to the `providers` array. In the example below, the Imgix loader is used:\n *\n * ```typescript\n * import {provideImgixLoader} from '@angular/common';\n *\n * // Call the function and add the result to the `providers` array:\n * providers: [\n * provideImgixLoader(\"https://my.base.url/\"),\n * ],\n * ```\n *\n * The `NgOptimizedImage` directive provides the following functions:\n * - `provideCloudflareLoader`\n * - `provideCloudinaryLoader`\n * - `provideImageKitLoader`\n * - `provideImgixLoader`\n *\n * If you use a different image provider, you can create a custom loader function as described\n * below.\n *\n * To use a **custom loader**: provide your loader function as a value for the `IMAGE_LOADER` DI\n * token.\n *\n * ```typescript\n * import {IMAGE_LOADER, ImageLoaderConfig} from '@angular/common';\n *\n * // Configure the loader using the `IMAGE_LOADER` token.\n * providers: [\n * {\n * provide: IMAGE_LOADER,\n * useValue: (config: ImageLoaderConfig) => {\n * return `https://example.com/${config.src}-${config.width}.jpg}`;\n * }\n * },\n * ],\n * ```\n *\n * Step 3: update `` tags in templates to use `ngSrc` instead of `src`.\n *\n * ```\n * \n * ```\n *\n * @publicApi\n */\nclass NgOptimizedImage {\n constructor() {\n this.imageLoader = inject(IMAGE_LOADER);\n this.config = processConfig(inject(ɵIMAGE_CONFIG));\n this.renderer = inject(Renderer2);\n this.imgElement = inject(ElementRef).nativeElement;\n this.injector = inject(Injector);\n this.isServer = isPlatformServer(inject(PLATFORM_ID));\n this.preloadLinkCreator = inject(PreloadLinkCreator);\n // a LCP image observer - should be injected only in the dev mode\n this.lcpObserver = ngDevMode ? this.injector.get(LCPImageObserver) : null;\n /**\n * Calculate the rewritten `src` once and store it.\n * This is needed to avoid repetitive calculations and make sure the directive cleanup in the\n * `ngOnDestroy` does not rely on the `IMAGE_LOADER` logic (which in turn can rely on some other\n * instance that might be already destroyed).\n */\n this._renderedSrc = null;\n /**\n * Indicates whether this image should have a high priority.\n */\n this.priority = false;\n /**\n * Disables automatic srcset generation for this image.\n */\n this.disableOptimizedSrcset = false;\n /**\n * Sets the image to \"fill mode\", which eliminates the height/width requirement and adds\n * styles such that the image fills its containing element.\n */\n this.fill = false;\n }\n /** @nodoc */\n ngOnInit() {\n ɵperformanceMarkFeature('NgOptimizedImage');\n if (ngDevMode) {\n const ngZone = this.injector.get(NgZone);\n assertNonEmptyInput(this, 'ngSrc', this.ngSrc);\n assertValidNgSrcset(this, this.ngSrcset);\n assertNoConflictingSrc(this);\n if (this.ngSrcset) {\n assertNoConflictingSrcset(this);\n }\n assertNotBase64Image(this);\n assertNotBlobUrl(this);\n if (this.fill) {\n assertEmptyWidthAndHeight(this);\n // This leaves the Angular zone to avoid triggering unnecessary change detection cycles when\n // `load` tasks are invoked on images.\n ngZone.runOutsideAngular(() => assertNonZeroRenderedHeight(this, this.imgElement, this.renderer));\n }\n else {\n assertNonEmptyWidthAndHeight(this);\n if (this.height !== undefined) {\n assertGreaterThanZero(this, this.height, 'height');\n }\n if (this.width !== undefined) {\n assertGreaterThanZero(this, this.width, 'width');\n }\n // Only check for distorted images when not in fill mode, where\n // images may be intentionally stretched, cropped or letterboxed.\n ngZone.runOutsideAngular(() => assertNoImageDistortion(this, this.imgElement, this.renderer));\n }\n assertValidLoadingInput(this);\n if (!this.ngSrcset) {\n assertNoComplexSizes(this);\n }\n assertValidPlaceholder(this, this.imageLoader);\n assertNotMissingBuiltInLoader(this.ngSrc, this.imageLoader);\n assertNoNgSrcsetWithoutLoader(this, this.imageLoader);\n assertNoLoaderParamsWithoutLoader(this, this.imageLoader);\n if (this.lcpObserver !== null) {\n const ngZone = this.injector.get(NgZone);\n ngZone.runOutsideAngular(() => {\n this.lcpObserver.registerImage(this.getRewrittenSrc(), this.ngSrc, this.priority);\n });\n }\n if (this.priority) {\n const checker = this.injector.get(PreconnectLinkChecker);\n checker.assertPreconnect(this.getRewrittenSrc(), this.ngSrc);\n }\n }\n if (this.placeholder) {\n this.removePlaceholderOnLoad(this.imgElement);\n }\n this.setHostAttributes();\n }\n setHostAttributes() {\n // Must set width/height explicitly in case they are bound (in which case they will\n // only be reflected and not found by the browser)\n if (this.fill) {\n this.sizes ||= '100vw';\n }\n else {\n this.setHostAttribute('width', this.width.toString());\n this.setHostAttribute('height', this.height.toString());\n }\n this.setHostAttribute('loading', this.getLoadingBehavior());\n this.setHostAttribute('fetchpriority', this.getFetchPriority());\n // The `data-ng-img` attribute flags an image as using the directive, to allow\n // for analysis of the directive's performance.\n this.setHostAttribute('ng-img', 'true');\n // The `src` and `srcset` attributes should be set last since other attributes\n // could affect the image's loading behavior.\n const rewrittenSrcset = this.updateSrcAndSrcset();\n if (this.sizes) {\n this.setHostAttribute('sizes', this.sizes);\n }\n if (this.isServer && this.priority) {\n this.preloadLinkCreator.createPreloadLinkTag(this.renderer, this.getRewrittenSrc(), rewrittenSrcset, this.sizes);\n }\n }\n /** @nodoc */\n ngOnChanges(changes) {\n if (ngDevMode) {\n assertNoPostInitInputChange(this, changes, [\n 'ngSrcset',\n 'width',\n 'height',\n 'priority',\n 'fill',\n 'loading',\n 'sizes',\n 'loaderParams',\n 'disableOptimizedSrcset',\n ]);\n }\n if (changes['ngSrc'] && !changes['ngSrc'].isFirstChange()) {\n const oldSrc = this._renderedSrc;\n this.updateSrcAndSrcset(true);\n const newSrc = this._renderedSrc;\n if (this.lcpObserver !== null && oldSrc && newSrc && oldSrc !== newSrc) {\n const ngZone = this.injector.get(NgZone);\n ngZone.runOutsideAngular(() => {\n this.lcpObserver?.updateImage(oldSrc, newSrc);\n });\n }\n }\n }\n callImageLoader(configWithoutCustomParams) {\n let augmentedConfig = configWithoutCustomParams;\n if (this.loaderParams) {\n augmentedConfig.loaderParams = this.loaderParams;\n }\n return this.imageLoader(augmentedConfig);\n }\n getLoadingBehavior() {\n if (!this.priority && this.loading !== undefined) {\n return this.loading;\n }\n return this.priority ? 'eager' : 'lazy';\n }\n getFetchPriority() {\n return this.priority ? 'high' : 'auto';\n }\n getRewrittenSrc() {\n // ImageLoaderConfig supports setting a width property. However, we're not setting width here\n // because if the developer uses rendered width instead of intrinsic width in the HTML width\n // attribute, the image requested may be too small for 2x+ screens.\n if (!this._renderedSrc) {\n const imgConfig = { src: this.ngSrc };\n // Cache calculated image src to reuse it later in the code.\n this._renderedSrc = this.callImageLoader(imgConfig);\n }\n return this._renderedSrc;\n }\n getRewrittenSrcset() {\n const widthSrcSet = VALID_WIDTH_DESCRIPTOR_SRCSET.test(this.ngSrcset);\n const finalSrcs = this.ngSrcset\n .split(',')\n .filter((src) => src !== '')\n .map((srcStr) => {\n srcStr = srcStr.trim();\n const width = widthSrcSet ? parseFloat(srcStr) : parseFloat(srcStr) * this.width;\n return `${this.callImageLoader({ src: this.ngSrc, width })} ${srcStr}`;\n });\n return finalSrcs.join(', ');\n }\n getAutomaticSrcset() {\n if (this.sizes) {\n return this.getResponsiveSrcset();\n }\n else {\n return this.getFixedSrcset();\n }\n }\n getResponsiveSrcset() {\n const { breakpoints } = this.config;\n let filteredBreakpoints = breakpoints;\n if (this.sizes?.trim() === '100vw') {\n // Since this is a full-screen-width image, our srcset only needs to include\n // breakpoints with full viewport widths.\n filteredBreakpoints = breakpoints.filter((bp) => bp >= VIEWPORT_BREAKPOINT_CUTOFF);\n }\n const finalSrcs = filteredBreakpoints.map((bp) => `${this.callImageLoader({ src: this.ngSrc, width: bp })} ${bp}w`);\n return finalSrcs.join(', ');\n }\n updateSrcAndSrcset(forceSrcRecalc = false) {\n if (forceSrcRecalc) {\n // Reset cached value, so that the followup `getRewrittenSrc()` call\n // will recalculate it and update the cache.\n this._renderedSrc = null;\n }\n const rewrittenSrc = this.getRewrittenSrc();\n this.setHostAttribute('src', rewrittenSrc);\n let rewrittenSrcset = undefined;\n if (this.ngSrcset) {\n rewrittenSrcset = this.getRewrittenSrcset();\n }\n else if (this.shouldGenerateAutomaticSrcset()) {\n rewrittenSrcset = this.getAutomaticSrcset();\n }\n if (rewrittenSrcset) {\n this.setHostAttribute('srcset', rewrittenSrcset);\n }\n return rewrittenSrcset;\n }\n getFixedSrcset() {\n const finalSrcs = DENSITY_SRCSET_MULTIPLIERS.map((multiplier) => `${this.callImageLoader({\n src: this.ngSrc,\n width: this.width * multiplier,\n })} ${multiplier}x`);\n return finalSrcs.join(', ');\n }\n shouldGenerateAutomaticSrcset() {\n let oversizedImage = false;\n if (!this.sizes) {\n oversizedImage =\n this.width > FIXED_SRCSET_WIDTH_LIMIT || this.height > FIXED_SRCSET_HEIGHT_LIMIT;\n }\n return (!this.disableOptimizedSrcset &&\n !this.srcset &&\n this.imageLoader !== noopImageLoader &&\n !oversizedImage);\n }\n /**\n * Returns an image url formatted for use with the CSS background-image property. Expects one of:\n * * A base64 encoded image, which is wrapped and passed through.\n * * A boolean. If true, calls the image loader to generate a small placeholder url.\n */\n generatePlaceholder(placeholderInput) {\n const { placeholderResolution } = this.config;\n if (placeholderInput === true) {\n return `url(${this.callImageLoader({\n src: this.ngSrc,\n width: placeholderResolution,\n isPlaceholder: true,\n })})`;\n }\n else if (typeof placeholderInput === 'string' && placeholderInput.startsWith('data:')) {\n return `url(${placeholderInput})`;\n }\n return null;\n }\n /**\n * Determines if blur should be applied, based on an optional boolean\n * property `blur` within the optional configuration object `placeholderConfig`.\n */\n shouldBlurPlaceholder(placeholderConfig) {\n if (!placeholderConfig || !placeholderConfig.hasOwnProperty('blur')) {\n return true;\n }\n return Boolean(placeholderConfig.blur);\n }\n removePlaceholderOnLoad(img) {\n const callback = () => {\n const changeDetectorRef = this.injector.get(ChangeDetectorRef);\n removeLoadListenerFn();\n removeErrorListenerFn();\n this.placeholder = false;\n changeDetectorRef.markForCheck();\n };\n const removeLoadListenerFn = this.renderer.listen(img, 'load', callback);\n const removeErrorListenerFn = this.renderer.listen(img, 'error', callback);\n }\n /** @nodoc */\n ngOnDestroy() {\n if (ngDevMode) {\n if (!this.priority && this._renderedSrc !== null && this.lcpObserver !== null) {\n this.lcpObserver.unregisterImage(this._renderedSrc);\n }\n }\n }\n setHostAttribute(name, value) {\n this.renderer.setAttribute(this.imgElement, name, value);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgOptimizedImage, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }\n static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: \"16.1.0\", version: \"18.0.6\", type: NgOptimizedImage, isStandalone: true, selector: \"img[ngSrc]\", inputs: { ngSrc: [\"ngSrc\", \"ngSrc\", unwrapSafeUrl], ngSrcset: \"ngSrcset\", sizes: \"sizes\", width: [\"width\", \"width\", numberAttribute], height: [\"height\", \"height\", numberAttribute], loading: \"loading\", priority: [\"priority\", \"priority\", booleanAttribute], loaderParams: \"loaderParams\", disableOptimizedSrcset: [\"disableOptimizedSrcset\", \"disableOptimizedSrcset\", booleanAttribute], fill: [\"fill\", \"fill\", booleanAttribute], placeholder: [\"placeholder\", \"placeholder\", booleanOrDataUrlAttribute], placeholderConfig: \"placeholderConfig\", src: \"src\", srcset: \"srcset\" }, host: { properties: { \"style.position\": \"fill ? \\\"absolute\\\" : null\", \"style.width\": \"fill ? \\\"100%\\\" : null\", \"style.height\": \"fill ? \\\"100%\\\" : null\", \"style.inset\": \"fill ? \\\"0\\\" : null\", \"style.background-size\": \"placeholder ? \\\"cover\\\" : null\", \"style.background-position\": \"placeholder ? \\\"50% 50%\\\" : null\", \"style.background-repeat\": \"placeholder ? \\\"no-repeat\\\" : null\", \"style.background-image\": \"placeholder ? generatePlaceholder(placeholder) : null\", \"style.filter\": \"placeholder && shouldBlurPlaceholder(placeholderConfig) ? \\\"blur(15px)\\\" : null\" } }, usesOnChanges: true, ngImport: i0 }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: NgOptimizedImage, decorators: [{\n type: Directive,\n args: [{\n standalone: true,\n selector: 'img[ngSrc]',\n host: {\n '[style.position]': 'fill ? \"absolute\" : null',\n '[style.width]': 'fill ? \"100%\" : null',\n '[style.height]': 'fill ? \"100%\" : null',\n '[style.inset]': 'fill ? \"0\" : null',\n '[style.background-size]': 'placeholder ? \"cover\" : null',\n '[style.background-position]': 'placeholder ? \"50% 50%\" : null',\n '[style.background-repeat]': 'placeholder ? \"no-repeat\" : null',\n '[style.background-image]': 'placeholder ? generatePlaceholder(placeholder) : null',\n '[style.filter]': `placeholder && shouldBlurPlaceholder(placeholderConfig) ? \"blur(${PLACEHOLDER_BLUR_AMOUNT}px)\" : null`,\n },\n }]\n }], propDecorators: { ngSrc: [{\n type: Input,\n args: [{ required: true, transform: unwrapSafeUrl }]\n }], ngSrcset: [{\n type: Input\n }], sizes: [{\n type: Input\n }], width: [{\n type: Input,\n args: [{ transform: numberAttribute }]\n }], height: [{\n type: Input,\n args: [{ transform: numberAttribute }]\n }], loading: [{\n type: Input\n }], priority: [{\n type: Input,\n args: [{ transform: booleanAttribute }]\n }], loaderParams: [{\n type: Input\n }], disableOptimizedSrcset: [{\n type: Input,\n args: [{ transform: booleanAttribute }]\n }], fill: [{\n type: Input,\n args: [{ transform: booleanAttribute }]\n }], placeholder: [{\n type: Input,\n args: [{ transform: booleanOrDataUrlAttribute }]\n }], placeholderConfig: [{\n type: Input\n }], src: [{\n type: Input\n }], srcset: [{\n type: Input\n }] } });\n/***** Helpers *****/\n/**\n * Sorts provided config breakpoints and uses defaults.\n */\nfunction processConfig(config) {\n let sortedBreakpoints = {};\n if (config.breakpoints) {\n sortedBreakpoints.breakpoints = config.breakpoints.sort((a, b) => a - b);\n }\n return Object.assign({}, ɵIMAGE_CONFIG_DEFAULTS, config, sortedBreakpoints);\n}\n/***** Assert functions *****/\n/**\n * Verifies that there is no `src` set on a host element.\n */\nfunction assertNoConflictingSrc(dir) {\n if (dir.src) {\n throw new ɵRuntimeError(2950 /* RuntimeErrorCode.UNEXPECTED_SRC_ATTR */, `${imgDirectiveDetails(dir.ngSrc)} both \\`src\\` and \\`ngSrc\\` have been set. ` +\n `Supplying both of these attributes breaks lazy loading. ` +\n `The NgOptimizedImage directive sets \\`src\\` itself based on the value of \\`ngSrc\\`. ` +\n `To fix this, please remove the \\`src\\` attribute.`);\n }\n}\n/**\n * Verifies that there is no `srcset` set on a host element.\n */\nfunction assertNoConflictingSrcset(dir) {\n if (dir.srcset) {\n throw new ɵRuntimeError(2951 /* RuntimeErrorCode.UNEXPECTED_SRCSET_ATTR */, `${imgDirectiveDetails(dir.ngSrc)} both \\`srcset\\` and \\`ngSrcset\\` have been set. ` +\n `Supplying both of these attributes breaks lazy loading. ` +\n `The NgOptimizedImage directive sets \\`srcset\\` itself based on the value of ` +\n `\\`ngSrcset\\`. To fix this, please remove the \\`srcset\\` attribute.`);\n }\n}\n/**\n * Verifies that the `ngSrc` is not a Base64-encoded image.\n */\nfunction assertNotBase64Image(dir) {\n let ngSrc = dir.ngSrc.trim();\n if (ngSrc.startsWith('data:')) {\n if (ngSrc.length > BASE64_IMG_MAX_LENGTH_IN_ERROR) {\n ngSrc = ngSrc.substring(0, BASE64_IMG_MAX_LENGTH_IN_ERROR) + '...';\n }\n throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.ngSrc, false)} \\`ngSrc\\` is a Base64-encoded string ` +\n `(${ngSrc}). NgOptimizedImage does not support Base64-encoded strings. ` +\n `To fix this, disable the NgOptimizedImage directive for this element ` +\n `by removing \\`ngSrc\\` and using a standard \\`src\\` attribute instead.`);\n }\n}\n/**\n * Verifies that the 'sizes' only includes responsive values.\n */\nfunction assertNoComplexSizes(dir) {\n let sizes = dir.sizes;\n if (sizes?.match(/((\\)|,)\\s|^)\\d+px/)) {\n throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.ngSrc, false)} \\`sizes\\` was set to a string including ` +\n `pixel values. For automatic \\`srcset\\` generation, \\`sizes\\` must only include responsive ` +\n `values, such as \\`sizes=\"50vw\"\\` or \\`sizes=\"(min-width: 768px) 50vw, 100vw\"\\`. ` +\n `To fix this, modify the \\`sizes\\` attribute, or provide your own \\`ngSrcset\\` value directly.`);\n }\n}\nfunction assertValidPlaceholder(dir, imageLoader) {\n assertNoPlaceholderConfigWithoutPlaceholder(dir);\n assertNoRelativePlaceholderWithoutLoader(dir, imageLoader);\n assertNoOversizedDataUrl(dir);\n}\n/**\n * Verifies that placeholderConfig isn't being used without placeholder\n */\nfunction assertNoPlaceholderConfigWithoutPlaceholder(dir) {\n if (dir.placeholderConfig && !dir.placeholder) {\n throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.ngSrc, false)} \\`placeholderConfig\\` options were provided for an ` +\n `image that does not use the \\`placeholder\\` attribute, and will have no effect.`);\n }\n}\n/**\n * Warns if a relative URL placeholder is specified, but no loader is present to provide the small\n * image.\n */\nfunction assertNoRelativePlaceholderWithoutLoader(dir, imageLoader) {\n if (dir.placeholder === true && imageLoader === noopImageLoader) {\n throw new ɵRuntimeError(2963 /* RuntimeErrorCode.MISSING_NECESSARY_LOADER */, `${imgDirectiveDetails(dir.ngSrc)} the \\`placeholder\\` attribute is set to true but ` +\n `no image loader is configured (i.e. the default one is being used), ` +\n `which would result in the same image being used for the primary image and its placeholder. ` +\n `To fix this, provide a loader or remove the \\`placeholder\\` attribute from the image.`);\n }\n}\n/**\n * Warns or throws an error if an oversized dataURL placeholder is provided.\n */\nfunction assertNoOversizedDataUrl(dir) {\n if (dir.placeholder &&\n typeof dir.placeholder === 'string' &&\n dir.placeholder.startsWith('data:')) {\n if (dir.placeholder.length > DATA_URL_ERROR_LIMIT) {\n throw new ɵRuntimeError(2965 /* RuntimeErrorCode.OVERSIZED_PLACEHOLDER */, `${imgDirectiveDetails(dir.ngSrc)} the \\`placeholder\\` attribute is set to a data URL which is longer ` +\n `than ${DATA_URL_ERROR_LIMIT} characters. This is strongly discouraged, as large inline placeholders ` +\n `directly increase the bundle size of Angular and hurt page load performance. To fix this, generate ` +\n `a smaller data URL placeholder.`);\n }\n if (dir.placeholder.length > DATA_URL_WARN_LIMIT) {\n console.warn(ɵformatRuntimeError(2965 /* RuntimeErrorCode.OVERSIZED_PLACEHOLDER */, `${imgDirectiveDetails(dir.ngSrc)} the \\`placeholder\\` attribute is set to a data URL which is longer ` +\n `than ${DATA_URL_WARN_LIMIT} characters. This is discouraged, as large inline placeholders ` +\n `directly increase the bundle size of Angular and hurt page load performance. For better loading performance, ` +\n `generate a smaller data URL placeholder.`));\n }\n }\n}\n/**\n * Verifies that the `ngSrc` is not a Blob URL.\n */\nfunction assertNotBlobUrl(dir) {\n const ngSrc = dir.ngSrc.trim();\n if (ngSrc.startsWith('blob:')) {\n throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.ngSrc)} \\`ngSrc\\` was set to a blob URL (${ngSrc}). ` +\n `Blob URLs are not supported by the NgOptimizedImage directive. ` +\n `To fix this, disable the NgOptimizedImage directive for this element ` +\n `by removing \\`ngSrc\\` and using a regular \\`src\\` attribute instead.`);\n }\n}\n/**\n * Verifies that the input is set to a non-empty string.\n */\nfunction assertNonEmptyInput(dir, name, value) {\n const isString = typeof value === 'string';\n const isEmptyString = isString && value.trim() === '';\n if (!isString || isEmptyString) {\n throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.ngSrc)} \\`${name}\\` has an invalid value ` +\n `(\\`${value}\\`). To fix this, change the value to a non-empty string.`);\n }\n}\n/**\n * Verifies that the `ngSrcset` is in a valid format, e.g. \"100w, 200w\" or \"1x, 2x\".\n */\nfunction assertValidNgSrcset(dir, value) {\n if (value == null)\n return;\n assertNonEmptyInput(dir, 'ngSrcset', value);\n const stringVal = value;\n const isValidWidthDescriptor = VALID_WIDTH_DESCRIPTOR_SRCSET.test(stringVal);\n const isValidDensityDescriptor = VALID_DENSITY_DESCRIPTOR_SRCSET.test(stringVal);\n if (isValidDensityDescriptor) {\n assertUnderDensityCap(dir, stringVal);\n }\n const isValidSrcset = isValidWidthDescriptor || isValidDensityDescriptor;\n if (!isValidSrcset) {\n throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.ngSrc)} \\`ngSrcset\\` has an invalid value (\\`${value}\\`). ` +\n `To fix this, supply \\`ngSrcset\\` using a comma-separated list of one or more width ` +\n `descriptors (e.g. \"100w, 200w\") or density descriptors (e.g. \"1x, 2x\").`);\n }\n}\nfunction assertUnderDensityCap(dir, value) {\n const underDensityCap = value\n .split(',')\n .every((num) => num === '' || parseFloat(num) <= ABSOLUTE_SRCSET_DENSITY_CAP);\n if (!underDensityCap) {\n throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.ngSrc)} the \\`ngSrcset\\` contains an unsupported image density:` +\n `\\`${value}\\`. NgOptimizedImage generally recommends a max image density of ` +\n `${RECOMMENDED_SRCSET_DENSITY_CAP}x but supports image densities up to ` +\n `${ABSOLUTE_SRCSET_DENSITY_CAP}x. The human eye cannot distinguish between image densities ` +\n `greater than ${RECOMMENDED_SRCSET_DENSITY_CAP}x - which makes them unnecessary for ` +\n `most use cases. Images that will be pinch-zoomed are typically the primary use case for ` +\n `${ABSOLUTE_SRCSET_DENSITY_CAP}x images. Please remove the high density descriptor and try again.`);\n }\n}\n/**\n * Creates a `RuntimeError` instance to represent a situation when an input is set after\n * the directive has initialized.\n */\nfunction postInitInputChangeError(dir, inputName) {\n let reason;\n if (inputName === 'width' || inputName === 'height') {\n reason =\n `Changing \\`${inputName}\\` may result in different attribute value ` +\n `applied to the underlying image element and cause layout shifts on a page.`;\n }\n else {\n reason =\n `Changing the \\`${inputName}\\` would have no effect on the underlying ` +\n `image element, because the resource loading has already occurred.`;\n }\n return new ɵRuntimeError(2953 /* RuntimeErrorCode.UNEXPECTED_INPUT_CHANGE */, `${imgDirectiveDetails(dir.ngSrc)} \\`${inputName}\\` was updated after initialization. ` +\n `The NgOptimizedImage directive will not react to this input change. ${reason} ` +\n `To fix this, either switch \\`${inputName}\\` to a static value ` +\n `or wrap the image element in an *ngIf that is gated on the necessary value.`);\n}\n/**\n * Verify that none of the listed inputs has changed.\n */\nfunction assertNoPostInitInputChange(dir, changes, inputs) {\n inputs.forEach((input) => {\n const isUpdated = changes.hasOwnProperty(input);\n if (isUpdated && !changes[input].isFirstChange()) {\n if (input === 'ngSrc') {\n // When the `ngSrc` input changes, we detect that only in the\n // `ngOnChanges` hook, thus the `ngSrc` is already set. We use\n // `ngSrc` in the error message, so we use a previous value, but\n // not the updated one in it.\n dir = { ngSrc: changes[input].previousValue };\n }\n throw postInitInputChangeError(dir, input);\n }\n });\n}\n/**\n * Verifies that a specified input is a number greater than 0.\n */\nfunction assertGreaterThanZero(dir, inputValue, inputName) {\n const validNumber = typeof inputValue === 'number' && inputValue > 0;\n const validString = typeof inputValue === 'string' && /^\\d+$/.test(inputValue.trim()) && parseInt(inputValue) > 0;\n if (!validNumber && !validString) {\n throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.ngSrc)} \\`${inputName}\\` has an invalid value. ` +\n `To fix this, provide \\`${inputName}\\` as a number greater than 0.`);\n }\n}\n/**\n * Verifies that the rendered image is not visually distorted. Effectively this is checking:\n * - Whether the \"width\" and \"height\" attributes reflect the actual dimensions of the image.\n * - Whether image styling is \"correct\" (see below for a longer explanation).\n */\nfunction assertNoImageDistortion(dir, img, renderer) {\n const removeLoadListenerFn = renderer.listen(img, 'load', () => {\n removeLoadListenerFn();\n removeErrorListenerFn();\n const computedStyle = window.getComputedStyle(img);\n let renderedWidth = parseFloat(computedStyle.getPropertyValue('width'));\n let renderedHeight = parseFloat(computedStyle.getPropertyValue('height'));\n const boxSizing = computedStyle.getPropertyValue('box-sizing');\n if (boxSizing === 'border-box') {\n const paddingTop = computedStyle.getPropertyValue('padding-top');\n const paddingRight = computedStyle.getPropertyValue('padding-right');\n const paddingBottom = computedStyle.getPropertyValue('padding-bottom');\n const paddingLeft = computedStyle.getPropertyValue('padding-left');\n renderedWidth -= parseFloat(paddingRight) + parseFloat(paddingLeft);\n renderedHeight -= parseFloat(paddingTop) + parseFloat(paddingBottom);\n }\n const renderedAspectRatio = renderedWidth / renderedHeight;\n const nonZeroRenderedDimensions = renderedWidth !== 0 && renderedHeight !== 0;\n const intrinsicWidth = img.naturalWidth;\n const intrinsicHeight = img.naturalHeight;\n const intrinsicAspectRatio = intrinsicWidth / intrinsicHeight;\n const suppliedWidth = dir.width;\n const suppliedHeight = dir.height;\n const suppliedAspectRatio = suppliedWidth / suppliedHeight;\n // Tolerance is used to account for the impact of subpixel rendering.\n // Due to subpixel rendering, the rendered, intrinsic, and supplied\n // aspect ratios of a correctly configured image may not exactly match.\n // For example, a `width=4030 height=3020` image might have a rendered\n // size of \"1062w, 796.48h\". (An aspect ratio of 1.334... vs. 1.333...)\n const inaccurateDimensions = Math.abs(suppliedAspectRatio - intrinsicAspectRatio) > ASPECT_RATIO_TOLERANCE;\n const stylingDistortion = nonZeroRenderedDimensions &&\n Math.abs(intrinsicAspectRatio - renderedAspectRatio) > ASPECT_RATIO_TOLERANCE;\n if (inaccurateDimensions) {\n console.warn(ɵformatRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.ngSrc)} the aspect ratio of the image does not match ` +\n `the aspect ratio indicated by the width and height attributes. ` +\n `\\nIntrinsic image size: ${intrinsicWidth}w x ${intrinsicHeight}h ` +\n `(aspect-ratio: ${round(intrinsicAspectRatio)}). \\nSupplied width and height attributes: ` +\n `${suppliedWidth}w x ${suppliedHeight}h (aspect-ratio: ${round(suppliedAspectRatio)}). ` +\n `\\nTo fix this, update the width and height attributes.`));\n }\n else if (stylingDistortion) {\n console.warn(ɵformatRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.ngSrc)} the aspect ratio of the rendered image ` +\n `does not match the image's intrinsic aspect ratio. ` +\n `\\nIntrinsic image size: ${intrinsicWidth}w x ${intrinsicHeight}h ` +\n `(aspect-ratio: ${round(intrinsicAspectRatio)}). \\nRendered image size: ` +\n `${renderedWidth}w x ${renderedHeight}h (aspect-ratio: ` +\n `${round(renderedAspectRatio)}). \\nThis issue can occur if \"width\" and \"height\" ` +\n `attributes are added to an image without updating the corresponding ` +\n `image styling. To fix this, adjust image styling. In most cases, ` +\n `adding \"height: auto\" or \"width: auto\" to the image styling will fix ` +\n `this issue.`));\n }\n else if (!dir.ngSrcset && nonZeroRenderedDimensions) {\n // If `ngSrcset` hasn't been set, sanity check the intrinsic size.\n const recommendedWidth = RECOMMENDED_SRCSET_DENSITY_CAP * renderedWidth;\n const recommendedHeight = RECOMMENDED_SRCSET_DENSITY_CAP * renderedHeight;\n const oversizedWidth = intrinsicWidth - recommendedWidth >= OVERSIZED_IMAGE_TOLERANCE;\n const oversizedHeight = intrinsicHeight - recommendedHeight >= OVERSIZED_IMAGE_TOLERANCE;\n if (oversizedWidth || oversizedHeight) {\n console.warn(ɵformatRuntimeError(2960 /* RuntimeErrorCode.OVERSIZED_IMAGE */, `${imgDirectiveDetails(dir.ngSrc)} the intrinsic image is significantly ` +\n `larger than necessary. ` +\n `\\nRendered image size: ${renderedWidth}w x ${renderedHeight}h. ` +\n `\\nIntrinsic image size: ${intrinsicWidth}w x ${intrinsicHeight}h. ` +\n `\\nRecommended intrinsic image size: ${recommendedWidth}w x ${recommendedHeight}h. ` +\n `\\nNote: Recommended intrinsic image size is calculated assuming a maximum DPR of ` +\n `${RECOMMENDED_SRCSET_DENSITY_CAP}. To improve loading time, resize the image ` +\n `or consider using the \"ngSrcset\" and \"sizes\" attributes.`));\n }\n }\n });\n // We only listen to the `error` event to remove the `load` event listener because it will not be\n // fired if the image fails to load. This is done to prevent memory leaks in development mode\n // because image elements aren't garbage-collected properly. It happens because zone.js stores the\n // event listener directly on the element and closures capture `dir`.\n const removeErrorListenerFn = renderer.listen(img, 'error', () => {\n removeLoadListenerFn();\n removeErrorListenerFn();\n });\n}\n/**\n * Verifies that a specified input is set.\n */\nfunction assertNonEmptyWidthAndHeight(dir) {\n let missingAttributes = [];\n if (dir.width === undefined)\n missingAttributes.push('width');\n if (dir.height === undefined)\n missingAttributes.push('height');\n if (missingAttributes.length > 0) {\n throw new ɵRuntimeError(2954 /* RuntimeErrorCode.REQUIRED_INPUT_MISSING */, `${imgDirectiveDetails(dir.ngSrc)} these required attributes ` +\n `are missing: ${missingAttributes.map((attr) => `\"${attr}\"`).join(', ')}. ` +\n `Including \"width\" and \"height\" attributes will prevent image-related layout shifts. ` +\n `To fix this, include \"width\" and \"height\" attributes on the image tag or turn on ` +\n `\"fill\" mode with the \\`fill\\` attribute.`);\n }\n}\n/**\n * Verifies that width and height are not set. Used in fill mode, where those attributes don't make\n * sense.\n */\nfunction assertEmptyWidthAndHeight(dir) {\n if (dir.width || dir.height) {\n throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.ngSrc)} the attributes \\`height\\` and/or \\`width\\` are present ` +\n `along with the \\`fill\\` attribute. Because \\`fill\\` mode causes an image to fill its containing ` +\n `element, the size attributes have no effect and should be removed.`);\n }\n}\n/**\n * Verifies that the rendered image has a nonzero height. If the image is in fill mode, provides\n * guidance that this can be caused by the containing element's CSS position property.\n */\nfunction assertNonZeroRenderedHeight(dir, img, renderer) {\n const removeLoadListenerFn = renderer.listen(img, 'load', () => {\n removeLoadListenerFn();\n removeErrorListenerFn();\n const renderedHeight = img.clientHeight;\n if (dir.fill && renderedHeight === 0) {\n console.warn(ɵformatRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.ngSrc)} the height of the fill-mode image is zero. ` +\n `This is likely because the containing element does not have the CSS 'position' ` +\n `property set to one of the following: \"relative\", \"fixed\", or \"absolute\". ` +\n `To fix this problem, make sure the container element has the CSS 'position' ` +\n `property defined and the height of the element is not zero.`));\n }\n });\n // See comments in the `assertNoImageDistortion`.\n const removeErrorListenerFn = renderer.listen(img, 'error', () => {\n removeLoadListenerFn();\n removeErrorListenerFn();\n });\n}\n/**\n * Verifies that the `loading` attribute is set to a valid input &\n * is not used on priority images.\n */\nfunction assertValidLoadingInput(dir) {\n if (dir.loading && dir.priority) {\n throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.ngSrc)} the \\`loading\\` attribute ` +\n `was used on an image that was marked \"priority\". ` +\n `Setting \\`loading\\` on priority images is not allowed ` +\n `because these images will always be eagerly loaded. ` +\n `To fix this, remove the “loading” attribute from the priority image.`);\n }\n const validInputs = ['auto', 'eager', 'lazy'];\n if (typeof dir.loading === 'string' && !validInputs.includes(dir.loading)) {\n throw new ɵRuntimeError(2952 /* RuntimeErrorCode.INVALID_INPUT */, `${imgDirectiveDetails(dir.ngSrc)} the \\`loading\\` attribute ` +\n `has an invalid value (\\`${dir.loading}\\`). ` +\n `To fix this, provide a valid value (\"lazy\", \"eager\", or \"auto\").`);\n }\n}\n/**\n * Warns if NOT using a loader (falling back to the generic loader) and\n * the image appears to be hosted on one of the image CDNs for which\n * we do have a built-in image loader. Suggests switching to the\n * built-in loader.\n *\n * @param ngSrc Value of the ngSrc attribute\n * @param imageLoader ImageLoader provided\n */\nfunction assertNotMissingBuiltInLoader(ngSrc, imageLoader) {\n if (imageLoader === noopImageLoader) {\n let builtInLoaderName = '';\n for (const loader of BUILT_IN_LOADERS) {\n if (loader.testUrl(ngSrc)) {\n builtInLoaderName = loader.name;\n break;\n }\n }\n if (builtInLoaderName) {\n console.warn(ɵformatRuntimeError(2962 /* RuntimeErrorCode.MISSING_BUILTIN_LOADER */, `NgOptimizedImage: It looks like your images may be hosted on the ` +\n `${builtInLoaderName} CDN, but your app is not using Angular's ` +\n `built-in loader for that CDN. We recommend switching to use ` +\n `the built-in by calling \\`provide${builtInLoaderName}Loader()\\` ` +\n `in your \\`providers\\` and passing it your instance's base URL. ` +\n `If you don't want to use the built-in loader, define a custom ` +\n `loader function using IMAGE_LOADER to silence this warning.`));\n }\n }\n}\n/**\n * Warns if ngSrcset is present and no loader is configured (i.e. the default one is being used).\n */\nfunction assertNoNgSrcsetWithoutLoader(dir, imageLoader) {\n if (dir.ngSrcset && imageLoader === noopImageLoader) {\n console.warn(ɵformatRuntimeError(2963 /* RuntimeErrorCode.MISSING_NECESSARY_LOADER */, `${imgDirectiveDetails(dir.ngSrc)} the \\`ngSrcset\\` attribute is present but ` +\n `no image loader is configured (i.e. the default one is being used), ` +\n `which would result in the same image being used for all configured sizes. ` +\n `To fix this, provide a loader or remove the \\`ngSrcset\\` attribute from the image.`));\n }\n}\n/**\n * Warns if loaderParams is present and no loader is configured (i.e. the default one is being\n * used).\n */\nfunction assertNoLoaderParamsWithoutLoader(dir, imageLoader) {\n if (dir.loaderParams && imageLoader === noopImageLoader) {\n console.warn(ɵformatRuntimeError(2963 /* RuntimeErrorCode.MISSING_NECESSARY_LOADER */, `${imgDirectiveDetails(dir.ngSrc)} the \\`loaderParams\\` attribute is present but ` +\n `no image loader is configured (i.e. the default one is being used), ` +\n `which means that the loaderParams data will not be consumed and will not affect the URL. ` +\n `To fix this, provide a custom loader or remove the \\`loaderParams\\` attribute from the image.`));\n }\n}\nfunction round(input) {\n return Number.isInteger(input) ? input : input.toFixed(2);\n}\n// Transform function to handle SafeValue input for ngSrc. This doesn't do any sanitization,\n// as that is not needed for img.src and img.srcset. This transform is purely for compatibility.\nfunction unwrapSafeUrl(value) {\n if (typeof value === 'string') {\n return value;\n }\n return ɵunwrapSafeValue(value);\n}\n// Transform function to handle inputs which may be booleans, strings, or string representations\n// of boolean values. Used for the placeholder attribute.\nfunction booleanOrDataUrlAttribute(value) {\n if (typeof value === 'string' && value.startsWith(`data:`)) {\n return value;\n }\n return booleanAttribute(value);\n}\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of the common package.\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\n// This file only reexports content of the `src` folder. Keep it that way.\n\n// This file is not used to build this module. It is only used during editing\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { APP_BASE_HREF, AsyncPipe, BrowserPlatformLocation, CommonModule, CurrencyPipe, DATE_PIPE_DEFAULT_OPTIONS, DATE_PIPE_DEFAULT_TIMEZONE, DOCUMENT, DatePipe, DecimalPipe, FormStyle, FormatWidth, HashLocationStrategy, I18nPluralPipe, I18nSelectPipe, IMAGE_LOADER, JsonPipe, KeyValuePipe, LOCATION_INITIALIZED, Location, LocationStrategy, LowerCasePipe, NgClass, NgComponentOutlet, NgForOf as NgFor, NgForOf, NgForOfContext, NgIf, NgIfContext, NgLocaleLocalization, NgLocalization, NgOptimizedImage, NgPlural, NgPluralCase, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgTemplateOutlet, NumberFormatStyle, NumberSymbol, PRECONNECT_CHECK_BLOCKLIST, PathLocationStrategy, PercentPipe, PlatformLocation, Plural, SlicePipe, TitleCasePipe, TranslationWidth, UpperCasePipe, VERSION, ViewportScroller, WeekDay, XhrFactory, formatCurrency, formatDate, formatNumber, formatPercent, getCurrencySymbol, getLocaleCurrencyCode, getLocaleCurrencyName, getLocaleCurrencySymbol, getLocaleDateFormat, getLocaleDateTimeFormat, getLocaleDayNames, getLocaleDayPeriods, getLocaleDirection, getLocaleEraNames, getLocaleExtraDayPeriodRules, getLocaleExtraDayPeriods, getLocaleFirstDayOfWeek, getLocaleId, getLocaleMonthNames, getLocaleNumberFormat, getLocaleNumberSymbol, getLocalePluralCase, getLocaleTimeFormat, getLocaleWeekEndRange, getNumberOfCurrencyDigits, isPlatformBrowser, isPlatformServer, provideCloudflareLoader, provideCloudinaryLoader, provideImageKitLoader, provideImgixLoader, provideNetlifyLoader, registerLocaleData, DomAdapter as ɵDomAdapter, NullViewportScroller as ɵNullViewportScroller, PLATFORM_BROWSER_ID as ɵPLATFORM_BROWSER_ID, PLATFORM_SERVER_ID as ɵPLATFORM_SERVER_ID, PlatformNavigation as ɵPlatformNavigation, getDOM as ɵgetDOM, normalizeQueryParams as ɵnormalizeQueryParams, parseCookieValue as ɵparseCookieValue, setRootDomAdapter as ɵsetRootDomAdapter };\n","/**\n * @license Angular v18.0.6\n * (c) 2010-2024 Google LLC. https://angular.io/\n * License: MIT\n */\n\nimport * as i0 from '@angular/core';\nimport { Injectable, inject, NgZone, runInInjectionContext, InjectionToken, ɵPendingTasks, PLATFORM_ID, ɵConsole, ɵformatRuntimeError, Inject, ɵRuntimeError, makeEnvironmentProviders, NgModule, TransferState, makeStateKey, ɵperformanceMarkFeature, APP_BOOTSTRAP_LISTENER, ApplicationRef, ɵwhenStable, ɵtruncateMiddle } from '@angular/core';\nimport { of, Observable, from } from 'rxjs';\nimport { concatMap, filter, map, finalize, switchMap, tap } from 'rxjs/operators';\nimport * as i1 from '@angular/common';\nimport { isPlatformServer, DOCUMENT, ɵparseCookieValue } from '@angular/common';\n\n/**\n * Transforms an `HttpRequest` into a stream of `HttpEvent`s, one of which will likely be a\n * `HttpResponse`.\n *\n * `HttpHandler` is injectable. When injected, the handler instance dispatches requests to the\n * first interceptor in the chain, which dispatches to the second, etc, eventually reaching the\n * `HttpBackend`.\n *\n * In an `HttpInterceptor`, the `HttpHandler` parameter is the next interceptor in the chain.\n *\n * @publicApi\n */\nclass HttpHandler {\n}\n/**\n * A final `HttpHandler` which will dispatch the request via browser HTTP APIs to a backend.\n *\n * Interceptors sit between the `HttpClient` interface and the `HttpBackend`.\n *\n * When injected, `HttpBackend` dispatches requests directly to the backend, without going\n * through the interceptor chain.\n *\n * @publicApi\n */\nclass HttpBackend {\n}\n\n/**\n * Represents the header configuration options for an HTTP request.\n * Instances are immutable. Modifying methods return a cloned\n * instance with the change. The original object is never changed.\n *\n * @publicApi\n */\nclass HttpHeaders {\n /** Constructs a new HTTP header object with the given values.*/\n constructor(headers) {\n /**\n * Internal map of lowercased header names to the normalized\n * form of the name (the form seen first).\n */\n this.normalizedNames = new Map();\n /**\n * Queued updates to be materialized the next initialization.\n */\n this.lazyUpdate = null;\n if (!headers) {\n this.headers = new Map();\n }\n else if (typeof headers === 'string') {\n this.lazyInit = () => {\n this.headers = new Map();\n headers.split('\\n').forEach((line) => {\n const index = line.indexOf(':');\n if (index > 0) {\n const name = line.slice(0, index);\n const key = name.toLowerCase();\n const value = line.slice(index + 1).trim();\n this.maybeSetNormalizedName(name, key);\n if (this.headers.has(key)) {\n this.headers.get(key).push(value);\n }\n else {\n this.headers.set(key, [value]);\n }\n }\n });\n };\n }\n else if (typeof Headers !== 'undefined' && headers instanceof Headers) {\n this.headers = new Map();\n headers.forEach((values, name) => {\n this.setHeaderEntries(name, values);\n });\n }\n else {\n this.lazyInit = () => {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n assertValidHeaders(headers);\n }\n this.headers = new Map();\n Object.entries(headers).forEach(([name, values]) => {\n this.setHeaderEntries(name, values);\n });\n };\n }\n }\n /**\n * Checks for existence of a given header.\n *\n * @param name The header name to check for existence.\n *\n * @returns True if the header exists, false otherwise.\n */\n has(name) {\n this.init();\n return this.headers.has(name.toLowerCase());\n }\n /**\n * Retrieves the first value of a given header.\n *\n * @param name The header name.\n *\n * @returns The value string if the header exists, null otherwise\n */\n get(name) {\n this.init();\n const values = this.headers.get(name.toLowerCase());\n return values && values.length > 0 ? values[0] : null;\n }\n /**\n * Retrieves the names of the headers.\n *\n * @returns A list of header names.\n */\n keys() {\n this.init();\n return Array.from(this.normalizedNames.values());\n }\n /**\n * Retrieves a list of values for a given header.\n *\n * @param name The header name from which to retrieve values.\n *\n * @returns A string of values if the header exists, null otherwise.\n */\n getAll(name) {\n this.init();\n return this.headers.get(name.toLowerCase()) || null;\n }\n /**\n * Appends a new value to the existing set of values for a header\n * and returns them in a clone of the original instance.\n *\n * @param name The header name for which to append the values.\n * @param value The value to append.\n *\n * @returns A clone of the HTTP headers object with the value appended to the given header.\n */\n append(name, value) {\n return this.clone({ name, value, op: 'a' });\n }\n /**\n * Sets or modifies a value for a given header in a clone of the original instance.\n * If the header already exists, its value is replaced with the given value\n * in the returned object.\n *\n * @param name The header name.\n * @param value The value or values to set or override for the given header.\n *\n * @returns A clone of the HTTP headers object with the newly set header value.\n */\n set(name, value) {\n return this.clone({ name, value, op: 's' });\n }\n /**\n * Deletes values for a given header in a clone of the original instance.\n *\n * @param name The header name.\n * @param value The value or values to delete for the given header.\n *\n * @returns A clone of the HTTP headers object with the given value deleted.\n */\n delete(name, value) {\n return this.clone({ name, value, op: 'd' });\n }\n maybeSetNormalizedName(name, lcName) {\n if (!this.normalizedNames.has(lcName)) {\n this.normalizedNames.set(lcName, name);\n }\n }\n init() {\n if (!!this.lazyInit) {\n if (this.lazyInit instanceof HttpHeaders) {\n this.copyFrom(this.lazyInit);\n }\n else {\n this.lazyInit();\n }\n this.lazyInit = null;\n if (!!this.lazyUpdate) {\n this.lazyUpdate.forEach((update) => this.applyUpdate(update));\n this.lazyUpdate = null;\n }\n }\n }\n copyFrom(other) {\n other.init();\n Array.from(other.headers.keys()).forEach((key) => {\n this.headers.set(key, other.headers.get(key));\n this.normalizedNames.set(key, other.normalizedNames.get(key));\n });\n }\n clone(update) {\n const clone = new HttpHeaders();\n clone.lazyInit = !!this.lazyInit && this.lazyInit instanceof HttpHeaders ? this.lazyInit : this;\n clone.lazyUpdate = (this.lazyUpdate || []).concat([update]);\n return clone;\n }\n applyUpdate(update) {\n const key = update.name.toLowerCase();\n switch (update.op) {\n case 'a':\n case 's':\n let value = update.value;\n if (typeof value === 'string') {\n value = [value];\n }\n if (value.length === 0) {\n return;\n }\n this.maybeSetNormalizedName(update.name, key);\n const base = (update.op === 'a' ? this.headers.get(key) : undefined) || [];\n base.push(...value);\n this.headers.set(key, base);\n break;\n case 'd':\n const toDelete = update.value;\n if (!toDelete) {\n this.headers.delete(key);\n this.normalizedNames.delete(key);\n }\n else {\n let existing = this.headers.get(key);\n if (!existing) {\n return;\n }\n existing = existing.filter((value) => toDelete.indexOf(value) === -1);\n if (existing.length === 0) {\n this.headers.delete(key);\n this.normalizedNames.delete(key);\n }\n else {\n this.headers.set(key, existing);\n }\n }\n break;\n }\n }\n setHeaderEntries(name, values) {\n const headerValues = (Array.isArray(values) ? values : [values]).map((value) => value.toString());\n const key = name.toLowerCase();\n this.headers.set(key, headerValues);\n this.maybeSetNormalizedName(name, key);\n }\n /**\n * @internal\n */\n forEach(fn) {\n this.init();\n Array.from(this.normalizedNames.keys()).forEach((key) => fn(this.normalizedNames.get(key), this.headers.get(key)));\n }\n}\n/**\n * Verifies that the headers object has the right shape: the values\n * must be either strings, numbers or arrays. Throws an error if an invalid\n * header value is present.\n */\nfunction assertValidHeaders(headers) {\n for (const [key, value] of Object.entries(headers)) {\n if (!(typeof value === 'string' || typeof value === 'number') && !Array.isArray(value)) {\n throw new Error(`Unexpected value of the \\`${key}\\` header provided. ` +\n `Expecting either a string, a number or an array, but got: \\`${value}\\`.`);\n }\n }\n}\n\n/**\n * Provides encoding and decoding of URL parameter and query-string values.\n *\n * Serializes and parses URL parameter keys and values to encode and decode them.\n * If you pass URL query parameters without encoding,\n * the query parameters can be misinterpreted at the receiving end.\n *\n *\n * @publicApi\n */\nclass HttpUrlEncodingCodec {\n /**\n * Encodes a key name for a URL parameter or query-string.\n * @param key The key name.\n * @returns The encoded key name.\n */\n encodeKey(key) {\n return standardEncoding(key);\n }\n /**\n * Encodes the value of a URL parameter or query-string.\n * @param value The value.\n * @returns The encoded value.\n */\n encodeValue(value) {\n return standardEncoding(value);\n }\n /**\n * Decodes an encoded URL parameter or query-string key.\n * @param key The encoded key name.\n * @returns The decoded key name.\n */\n decodeKey(key) {\n return decodeURIComponent(key);\n }\n /**\n * Decodes an encoded URL parameter or query-string value.\n * @param value The encoded value.\n * @returns The decoded value.\n */\n decodeValue(value) {\n return decodeURIComponent(value);\n }\n}\nfunction paramParser(rawParams, codec) {\n const map = new Map();\n if (rawParams.length > 0) {\n // The `window.location.search` can be used while creating an instance of the `HttpParams` class\n // (e.g. `new HttpParams({ fromString: window.location.search })`). The `window.location.search`\n // may start with the `?` char, so we strip it if it's present.\n const params = rawParams.replace(/^\\?/, '').split('&');\n params.forEach((param) => {\n const eqIdx = param.indexOf('=');\n const [key, val] = eqIdx == -1\n ? [codec.decodeKey(param), '']\n : [codec.decodeKey(param.slice(0, eqIdx)), codec.decodeValue(param.slice(eqIdx + 1))];\n const list = map.get(key) || [];\n list.push(val);\n map.set(key, list);\n });\n }\n return map;\n}\n/**\n * Encode input string with standard encodeURIComponent and then un-encode specific characters.\n */\nconst STANDARD_ENCODING_REGEX = /%(\\d[a-f0-9])/gi;\nconst STANDARD_ENCODING_REPLACEMENTS = {\n '40': '@',\n '3A': ':',\n '24': '$',\n '2C': ',',\n '3B': ';',\n '3D': '=',\n '3F': '?',\n '2F': '/',\n};\nfunction standardEncoding(v) {\n return encodeURIComponent(v).replace(STANDARD_ENCODING_REGEX, (s, t) => STANDARD_ENCODING_REPLACEMENTS[t] ?? s);\n}\nfunction valueToString(value) {\n return `${value}`;\n}\n/**\n * An HTTP request/response body that represents serialized parameters,\n * per the MIME type `application/x-www-form-urlencoded`.\n *\n * This class is immutable; all mutation operations return a new instance.\n *\n * @publicApi\n */\nclass HttpParams {\n constructor(options = {}) {\n this.updates = null;\n this.cloneFrom = null;\n this.encoder = options.encoder || new HttpUrlEncodingCodec();\n if (!!options.fromString) {\n if (!!options.fromObject) {\n throw new Error(`Cannot specify both fromString and fromObject.`);\n }\n this.map = paramParser(options.fromString, this.encoder);\n }\n else if (!!options.fromObject) {\n this.map = new Map();\n Object.keys(options.fromObject).forEach((key) => {\n const value = options.fromObject[key];\n // convert the values to strings\n const values = Array.isArray(value) ? value.map(valueToString) : [valueToString(value)];\n this.map.set(key, values);\n });\n }\n else {\n this.map = null;\n }\n }\n /**\n * Reports whether the body includes one or more values for a given parameter.\n * @param param The parameter name.\n * @returns True if the parameter has one or more values,\n * false if it has no value or is not present.\n */\n has(param) {\n this.init();\n return this.map.has(param);\n }\n /**\n * Retrieves the first value for a parameter.\n * @param param The parameter name.\n * @returns The first value of the given parameter,\n * or `null` if the parameter is not present.\n */\n get(param) {\n this.init();\n const res = this.map.get(param);\n return !!res ? res[0] : null;\n }\n /**\n * Retrieves all values for a parameter.\n * @param param The parameter name.\n * @returns All values in a string array,\n * or `null` if the parameter not present.\n */\n getAll(param) {\n this.init();\n return this.map.get(param) || null;\n }\n /**\n * Retrieves all the parameters for this body.\n * @returns The parameter names in a string array.\n */\n keys() {\n this.init();\n return Array.from(this.map.keys());\n }\n /**\n * Appends a new value to existing values for a parameter.\n * @param param The parameter name.\n * @param value The new value to add.\n * @return A new body with the appended value.\n */\n append(param, value) {\n return this.clone({ param, value, op: 'a' });\n }\n /**\n * Constructs a new body with appended values for the given parameter name.\n * @param params parameters and values\n * @return A new body with the new value.\n */\n appendAll(params) {\n const updates = [];\n Object.keys(params).forEach((param) => {\n const value = params[param];\n if (Array.isArray(value)) {\n value.forEach((_value) => {\n updates.push({ param, value: _value, op: 'a' });\n });\n }\n else {\n updates.push({ param, value: value, op: 'a' });\n }\n });\n return this.clone(updates);\n }\n /**\n * Replaces the value for a parameter.\n * @param param The parameter name.\n * @param value The new value.\n * @return A new body with the new value.\n */\n set(param, value) {\n return this.clone({ param, value, op: 's' });\n }\n /**\n * Removes a given value or all values from a parameter.\n * @param param The parameter name.\n * @param value The value to remove, if provided.\n * @return A new body with the given value removed, or with all values\n * removed if no value is specified.\n */\n delete(param, value) {\n return this.clone({ param, value, op: 'd' });\n }\n /**\n * Serializes the body to an encoded string, where key-value pairs (separated by `=`) are\n * separated by `&`s.\n */\n toString() {\n this.init();\n return (this.keys()\n .map((key) => {\n const eKey = this.encoder.encodeKey(key);\n // `a: ['1']` produces `'a=1'`\n // `b: []` produces `''`\n // `c: ['1', '2']` produces `'c=1&c=2'`\n return this.map.get(key)\n .map((value) => eKey + '=' + this.encoder.encodeValue(value))\n .join('&');\n })\n // filter out empty values because `b: []` produces `''`\n // which results in `a=1&&c=1&c=2` instead of `a=1&c=1&c=2` if we don't\n .filter((param) => param !== '')\n .join('&'));\n }\n clone(update) {\n const clone = new HttpParams({ encoder: this.encoder });\n clone.cloneFrom = this.cloneFrom || this;\n clone.updates = (this.updates || []).concat(update);\n return clone;\n }\n init() {\n if (this.map === null) {\n this.map = new Map();\n }\n if (this.cloneFrom !== null) {\n this.cloneFrom.init();\n this.cloneFrom.keys().forEach((key) => this.map.set(key, this.cloneFrom.map.get(key)));\n this.updates.forEach((update) => {\n switch (update.op) {\n case 'a':\n case 's':\n const base = (update.op === 'a' ? this.map.get(update.param) : undefined) || [];\n base.push(valueToString(update.value));\n this.map.set(update.param, base);\n break;\n case 'd':\n if (update.value !== undefined) {\n let base = this.map.get(update.param) || [];\n const idx = base.indexOf(valueToString(update.value));\n if (idx !== -1) {\n base.splice(idx, 1);\n }\n if (base.length > 0) {\n this.map.set(update.param, base);\n }\n else {\n this.map.delete(update.param);\n }\n }\n else {\n this.map.delete(update.param);\n break;\n }\n }\n });\n this.cloneFrom = this.updates = null;\n }\n }\n}\n\n/**\n * A token used to manipulate and access values stored in `HttpContext`.\n *\n * @publicApi\n */\nclass HttpContextToken {\n constructor(defaultValue) {\n this.defaultValue = defaultValue;\n }\n}\n/**\n * Http context stores arbitrary user defined values and ensures type safety without\n * actually knowing the types. It is backed by a `Map` and guarantees that keys do not clash.\n *\n * This context is mutable and is shared between cloned requests unless explicitly specified.\n *\n * @usageNotes\n *\n * ### Usage Example\n *\n * ```typescript\n * // inside cache.interceptors.ts\n * export const IS_CACHE_ENABLED = new HttpContextToken(() => false);\n *\n * export class CacheInterceptor implements HttpInterceptor {\n *\n * intercept(req: HttpRequest, delegate: HttpHandler): Observable> {\n * if (req.context.get(IS_CACHE_ENABLED) === true) {\n * return ...;\n * }\n * return delegate.handle(req);\n * }\n * }\n *\n * // inside a service\n *\n * this.httpClient.get('/api/weather', {\n * context: new HttpContext().set(IS_CACHE_ENABLED, true)\n * }).subscribe(...);\n * ```\n *\n * @publicApi\n */\nclass HttpContext {\n constructor() {\n this.map = new Map();\n }\n /**\n * Store a value in the context. If a value is already present it will be overwritten.\n *\n * @param token The reference to an instance of `HttpContextToken`.\n * @param value The value to store.\n *\n * @returns A reference to itself for easy chaining.\n */\n set(token, value) {\n this.map.set(token, value);\n return this;\n }\n /**\n * Retrieve the value associated with the given token.\n *\n * @param token The reference to an instance of `HttpContextToken`.\n *\n * @returns The stored value or default if one is defined.\n */\n get(token) {\n if (!this.map.has(token)) {\n this.map.set(token, token.defaultValue());\n }\n return this.map.get(token);\n }\n /**\n * Delete the value associated with the given token.\n *\n * @param token The reference to an instance of `HttpContextToken`.\n *\n * @returns A reference to itself for easy chaining.\n */\n delete(token) {\n this.map.delete(token);\n return this;\n }\n /**\n * Checks for existence of a given token.\n *\n * @param token The reference to an instance of `HttpContextToken`.\n *\n * @returns True if the token exists, false otherwise.\n */\n has(token) {\n return this.map.has(token);\n }\n /**\n * @returns a list of tokens currently stored in the context.\n */\n keys() {\n return this.map.keys();\n }\n}\n\n/**\n * Determine whether the given HTTP method may include a body.\n */\nfunction mightHaveBody(method) {\n switch (method) {\n case 'DELETE':\n case 'GET':\n case 'HEAD':\n case 'OPTIONS':\n case 'JSONP':\n return false;\n default:\n return true;\n }\n}\n/**\n * Safely assert whether the given value is an ArrayBuffer.\n *\n * In some execution environments ArrayBuffer is not defined.\n */\nfunction isArrayBuffer(value) {\n return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;\n}\n/**\n * Safely assert whether the given value is a Blob.\n *\n * In some execution environments Blob is not defined.\n */\nfunction isBlob(value) {\n return typeof Blob !== 'undefined' && value instanceof Blob;\n}\n/**\n * Safely assert whether the given value is a FormData instance.\n *\n * In some execution environments FormData is not defined.\n */\nfunction isFormData(value) {\n return typeof FormData !== 'undefined' && value instanceof FormData;\n}\n/**\n * Safely assert whether the given value is a URLSearchParams instance.\n *\n * In some execution environments URLSearchParams is not defined.\n */\nfunction isUrlSearchParams(value) {\n return typeof URLSearchParams !== 'undefined' && value instanceof URLSearchParams;\n}\n/**\n * An outgoing HTTP request with an optional typed body.\n *\n * `HttpRequest` represents an outgoing request, including URL, method,\n * headers, body, and other request configuration options. Instances should be\n * assumed to be immutable. To modify a `HttpRequest`, the `clone`\n * method should be used.\n *\n * @publicApi\n */\nclass HttpRequest {\n constructor(method, url, third, fourth) {\n this.url = url;\n /**\n * The request body, or `null` if one isn't set.\n *\n * Bodies are not enforced to be immutable, as they can include a reference to any\n * user-defined data type. However, interceptors should take care to preserve\n * idempotence by treating them as such.\n */\n this.body = null;\n /**\n * Whether this request should be made in a way that exposes progress events.\n *\n * Progress events are expensive (change detection runs on each event) and so\n * they should only be requested if the consumer intends to monitor them.\n *\n * Note: The `FetchBackend` doesn't support progress report on uploads.\n */\n this.reportProgress = false;\n /**\n * Whether this request should be sent with outgoing credentials (cookies).\n */\n this.withCredentials = false;\n /**\n * The expected response type of the server.\n *\n * This is used to parse the response appropriately before returning it to\n * the requestee.\n */\n this.responseType = 'json';\n this.method = method.toUpperCase();\n // Next, need to figure out which argument holds the HttpRequestInit\n // options, if any.\n let options;\n // Check whether a body argument is expected. The only valid way to omit\n // the body argument is to use a known no-body method like GET.\n if (mightHaveBody(this.method) || !!fourth) {\n // Body is the third argument, options are the fourth.\n this.body = third !== undefined ? third : null;\n options = fourth;\n }\n else {\n // No body required, options are the third argument. The body stays null.\n options = third;\n }\n // If options have been passed, interpret them.\n if (options) {\n // Normalize reportProgress and withCredentials.\n this.reportProgress = !!options.reportProgress;\n this.withCredentials = !!options.withCredentials;\n // Override default response type of 'json' if one is provided.\n if (!!options.responseType) {\n this.responseType = options.responseType;\n }\n // Override headers if they're provided.\n if (!!options.headers) {\n this.headers = options.headers;\n }\n if (!!options.context) {\n this.context = options.context;\n }\n if (!!options.params) {\n this.params = options.params;\n }\n // We do want to assign transferCache even if it's falsy (false is valid value)\n this.transferCache = options.transferCache;\n }\n // If no headers have been passed in, construct a new HttpHeaders instance.\n this.headers ??= new HttpHeaders();\n // If no context have been passed in, construct a new HttpContext instance.\n this.context ??= new HttpContext();\n // If no parameters have been passed in, construct a new HttpUrlEncodedParams instance.\n if (!this.params) {\n this.params = new HttpParams();\n this.urlWithParams = url;\n }\n else {\n // Encode the parameters to a string in preparation for inclusion in the URL.\n const params = this.params.toString();\n if (params.length === 0) {\n // No parameters, the visible URL is just the URL given at creation time.\n this.urlWithParams = url;\n }\n else {\n // Does the URL already have query parameters? Look for '?'.\n const qIdx = url.indexOf('?');\n // There are 3 cases to handle:\n // 1) No existing parameters -> append '?' followed by params.\n // 2) '?' exists and is followed by existing query string ->\n // append '&' followed by params.\n // 3) '?' exists at the end of the url -> append params directly.\n // This basically amounts to determining the character, if any, with\n // which to join the URL and parameters.\n const sep = qIdx === -1 ? '?' : qIdx < url.length - 1 ? '&' : '';\n this.urlWithParams = url + sep + params;\n }\n }\n }\n /**\n * Transform the free-form body into a serialized format suitable for\n * transmission to the server.\n */\n serializeBody() {\n // If no body is present, no need to serialize it.\n if (this.body === null) {\n return null;\n }\n // Check whether the body is already in a serialized form. If so,\n // it can just be returned directly.\n if (typeof this.body === 'string' ||\n isArrayBuffer(this.body) ||\n isBlob(this.body) ||\n isFormData(this.body) ||\n isUrlSearchParams(this.body)) {\n return this.body;\n }\n // Check whether the body is an instance of HttpUrlEncodedParams.\n if (this.body instanceof HttpParams) {\n return this.body.toString();\n }\n // Check whether the body is an object or array, and serialize with JSON if so.\n if (typeof this.body === 'object' ||\n typeof this.body === 'boolean' ||\n Array.isArray(this.body)) {\n return JSON.stringify(this.body);\n }\n // Fall back on toString() for everything else.\n return this.body.toString();\n }\n /**\n * Examine the body and attempt to infer an appropriate MIME type\n * for it.\n *\n * If no such type can be inferred, this method will return `null`.\n */\n detectContentTypeHeader() {\n // An empty body has no content type.\n if (this.body === null) {\n return null;\n }\n // FormData bodies rely on the browser's content type assignment.\n if (isFormData(this.body)) {\n return null;\n }\n // Blobs usually have their own content type. If it doesn't, then\n // no type can be inferred.\n if (isBlob(this.body)) {\n return this.body.type || null;\n }\n // Array buffers have unknown contents and thus no type can be inferred.\n if (isArrayBuffer(this.body)) {\n return null;\n }\n // Technically, strings could be a form of JSON data, but it's safe enough\n // to assume they're plain strings.\n if (typeof this.body === 'string') {\n return 'text/plain';\n }\n // `HttpUrlEncodedParams` has its own content-type.\n if (this.body instanceof HttpParams) {\n return 'application/x-www-form-urlencoded;charset=UTF-8';\n }\n // Arrays, objects, boolean and numbers will be encoded as JSON.\n if (typeof this.body === 'object' ||\n typeof this.body === 'number' ||\n typeof this.body === 'boolean') {\n return 'application/json';\n }\n // No type could be inferred.\n return null;\n }\n clone(update = {}) {\n // For method, url, and responseType, take the current value unless\n // it is overridden in the update hash.\n const method = update.method || this.method;\n const url = update.url || this.url;\n const responseType = update.responseType || this.responseType;\n // Carefully handle the transferCache to differentiate between\n // `false` and `undefined` in the update args.\n const transferCache = update.transferCache ?? this.transferCache;\n // The body is somewhat special - a `null` value in update.body means\n // whatever current body is present is being overridden with an empty\n // body, whereas an `undefined` value in update.body implies no\n // override.\n const body = update.body !== undefined ? update.body : this.body;\n // Carefully handle the boolean options to differentiate between\n // `false` and `undefined` in the update args.\n const withCredentials = update.withCredentials ?? this.withCredentials;\n const reportProgress = update.reportProgress ?? this.reportProgress;\n // Headers and params may be appended to if `setHeaders` or\n // `setParams` are used.\n let headers = update.headers || this.headers;\n let params = update.params || this.params;\n // Pass on context if needed\n const context = update.context ?? this.context;\n // Check whether the caller has asked to add headers.\n if (update.setHeaders !== undefined) {\n // Set every requested header.\n headers = Object.keys(update.setHeaders).reduce((headers, name) => headers.set(name, update.setHeaders[name]), headers);\n }\n // Check whether the caller has asked to set params.\n if (update.setParams) {\n // Set every requested param.\n params = Object.keys(update.setParams).reduce((params, param) => params.set(param, update.setParams[param]), params);\n }\n // Finally, construct the new HttpRequest using the pieces from above.\n return new HttpRequest(method, url, body, {\n params,\n headers,\n context,\n reportProgress,\n responseType,\n withCredentials,\n transferCache,\n });\n }\n}\n\n/**\n * Type enumeration for the different kinds of `HttpEvent`.\n *\n * @publicApi\n */\nvar HttpEventType;\n(function (HttpEventType) {\n /**\n * The request was sent out over the wire.\n */\n HttpEventType[HttpEventType[\"Sent\"] = 0] = \"Sent\";\n /**\n * An upload progress event was received.\n *\n * Note: The `FetchBackend` doesn't support progress report on uploads.\n */\n HttpEventType[HttpEventType[\"UploadProgress\"] = 1] = \"UploadProgress\";\n /**\n * The response status code and headers were received.\n */\n HttpEventType[HttpEventType[\"ResponseHeader\"] = 2] = \"ResponseHeader\";\n /**\n * A download progress event was received.\n */\n HttpEventType[HttpEventType[\"DownloadProgress\"] = 3] = \"DownloadProgress\";\n /**\n * The full response including the body was received.\n */\n HttpEventType[HttpEventType[\"Response\"] = 4] = \"Response\";\n /**\n * A custom event from an interceptor or a backend.\n */\n HttpEventType[HttpEventType[\"User\"] = 5] = \"User\";\n})(HttpEventType || (HttpEventType = {}));\n/**\n * Base class for both `HttpResponse` and `HttpHeaderResponse`.\n *\n * @publicApi\n */\nclass HttpResponseBase {\n /**\n * Super-constructor for all responses.\n *\n * The single parameter accepted is an initialization hash. Any properties\n * of the response passed there will override the default values.\n */\n constructor(init, defaultStatus = 200, defaultStatusText = 'OK') {\n // If the hash has values passed, use them to initialize the response.\n // Otherwise use the default values.\n this.headers = init.headers || new HttpHeaders();\n this.status = init.status !== undefined ? init.status : defaultStatus;\n this.statusText = init.statusText || defaultStatusText;\n this.url = init.url || null;\n // Cache the ok value to avoid defining a getter.\n this.ok = this.status >= 200 && this.status < 300;\n }\n}\n/**\n * A partial HTTP response which only includes the status and header data,\n * but no response body.\n *\n * `HttpHeaderResponse` is a `HttpEvent` available on the response\n * event stream, only when progress events are requested.\n *\n * @publicApi\n */\nclass HttpHeaderResponse extends HttpResponseBase {\n /**\n * Create a new `HttpHeaderResponse` with the given parameters.\n */\n constructor(init = {}) {\n super(init);\n this.type = HttpEventType.ResponseHeader;\n }\n /**\n * Copy this `HttpHeaderResponse`, overriding its contents with the\n * given parameter hash.\n */\n clone(update = {}) {\n // Perform a straightforward initialization of the new HttpHeaderResponse,\n // overriding the current parameters with new ones if given.\n return new HttpHeaderResponse({\n headers: update.headers || this.headers,\n status: update.status !== undefined ? update.status : this.status,\n statusText: update.statusText || this.statusText,\n url: update.url || this.url || undefined,\n });\n }\n}\n/**\n * A full HTTP response, including a typed response body (which may be `null`\n * if one was not returned).\n *\n * `HttpResponse` is a `HttpEvent` available on the response event\n * stream.\n *\n * @publicApi\n */\nclass HttpResponse extends HttpResponseBase {\n /**\n * Construct a new `HttpResponse`.\n */\n constructor(init = {}) {\n super(init);\n this.type = HttpEventType.Response;\n this.body = init.body !== undefined ? init.body : null;\n }\n clone(update = {}) {\n return new HttpResponse({\n body: update.body !== undefined ? update.body : this.body,\n headers: update.headers || this.headers,\n status: update.status !== undefined ? update.status : this.status,\n statusText: update.statusText || this.statusText,\n url: update.url || this.url || undefined,\n });\n }\n}\n/**\n * A response that represents an error or failure, either from a\n * non-successful HTTP status, an error while executing the request,\n * or some other failure which occurred during the parsing of the response.\n *\n * Any error returned on the `Observable` response stream will be\n * wrapped in an `HttpErrorResponse` to provide additional context about\n * the state of the HTTP layer when the error occurred. The error property\n * will contain either a wrapped Error object or the error response returned\n * from the server.\n *\n * @publicApi\n */\nclass HttpErrorResponse extends HttpResponseBase {\n constructor(init) {\n // Initialize with a default status of 0 / Unknown Error.\n super(init, 0, 'Unknown Error');\n this.name = 'HttpErrorResponse';\n /**\n * Errors are never okay, even when the status code is in the 2xx success range.\n */\n this.ok = false;\n // If the response was successful, then this was a parse error. Otherwise, it was\n // a protocol-level failure of some sort. Either the request failed in transit\n // or the server returned an unsuccessful status code.\n if (this.status >= 200 && this.status < 300) {\n this.message = `Http failure during parsing for ${init.url || '(unknown url)'}`;\n }\n else {\n this.message = `Http failure response for ${init.url || '(unknown url)'}: ${init.status} ${init.statusText}`;\n }\n this.error = init.error || null;\n }\n}\n/**\n * We use these constant to prevent pulling the whole HttpStatusCode enum\n * Those are the only ones referenced directly by the framework\n */\nconst HTTP_STATUS_CODE_OK = 200;\nconst HTTP_STATUS_CODE_NO_CONTENT = 204;\n/**\n * Http status codes.\n * As per https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml\n * @publicApi\n */\nvar HttpStatusCode;\n(function (HttpStatusCode) {\n HttpStatusCode[HttpStatusCode[\"Continue\"] = 100] = \"Continue\";\n HttpStatusCode[HttpStatusCode[\"SwitchingProtocols\"] = 101] = \"SwitchingProtocols\";\n HttpStatusCode[HttpStatusCode[\"Processing\"] = 102] = \"Processing\";\n HttpStatusCode[HttpStatusCode[\"EarlyHints\"] = 103] = \"EarlyHints\";\n HttpStatusCode[HttpStatusCode[\"Ok\"] = 200] = \"Ok\";\n HttpStatusCode[HttpStatusCode[\"Created\"] = 201] = \"Created\";\n HttpStatusCode[HttpStatusCode[\"Accepted\"] = 202] = \"Accepted\";\n HttpStatusCode[HttpStatusCode[\"NonAuthoritativeInformation\"] = 203] = \"NonAuthoritativeInformation\";\n HttpStatusCode[HttpStatusCode[\"NoContent\"] = 204] = \"NoContent\";\n HttpStatusCode[HttpStatusCode[\"ResetContent\"] = 205] = \"ResetContent\";\n HttpStatusCode[HttpStatusCode[\"PartialContent\"] = 206] = \"PartialContent\";\n HttpStatusCode[HttpStatusCode[\"MultiStatus\"] = 207] = \"MultiStatus\";\n HttpStatusCode[HttpStatusCode[\"AlreadyReported\"] = 208] = \"AlreadyReported\";\n HttpStatusCode[HttpStatusCode[\"ImUsed\"] = 226] = \"ImUsed\";\n HttpStatusCode[HttpStatusCode[\"MultipleChoices\"] = 300] = \"MultipleChoices\";\n HttpStatusCode[HttpStatusCode[\"MovedPermanently\"] = 301] = \"MovedPermanently\";\n HttpStatusCode[HttpStatusCode[\"Found\"] = 302] = \"Found\";\n HttpStatusCode[HttpStatusCode[\"SeeOther\"] = 303] = \"SeeOther\";\n HttpStatusCode[HttpStatusCode[\"NotModified\"] = 304] = \"NotModified\";\n HttpStatusCode[HttpStatusCode[\"UseProxy\"] = 305] = \"UseProxy\";\n HttpStatusCode[HttpStatusCode[\"Unused\"] = 306] = \"Unused\";\n HttpStatusCode[HttpStatusCode[\"TemporaryRedirect\"] = 307] = \"TemporaryRedirect\";\n HttpStatusCode[HttpStatusCode[\"PermanentRedirect\"] = 308] = \"PermanentRedirect\";\n HttpStatusCode[HttpStatusCode[\"BadRequest\"] = 400] = \"BadRequest\";\n HttpStatusCode[HttpStatusCode[\"Unauthorized\"] = 401] = \"Unauthorized\";\n HttpStatusCode[HttpStatusCode[\"PaymentRequired\"] = 402] = \"PaymentRequired\";\n HttpStatusCode[HttpStatusCode[\"Forbidden\"] = 403] = \"Forbidden\";\n HttpStatusCode[HttpStatusCode[\"NotFound\"] = 404] = \"NotFound\";\n HttpStatusCode[HttpStatusCode[\"MethodNotAllowed\"] = 405] = \"MethodNotAllowed\";\n HttpStatusCode[HttpStatusCode[\"NotAcceptable\"] = 406] = \"NotAcceptable\";\n HttpStatusCode[HttpStatusCode[\"ProxyAuthenticationRequired\"] = 407] = \"ProxyAuthenticationRequired\";\n HttpStatusCode[HttpStatusCode[\"RequestTimeout\"] = 408] = \"RequestTimeout\";\n HttpStatusCode[HttpStatusCode[\"Conflict\"] = 409] = \"Conflict\";\n HttpStatusCode[HttpStatusCode[\"Gone\"] = 410] = \"Gone\";\n HttpStatusCode[HttpStatusCode[\"LengthRequired\"] = 411] = \"LengthRequired\";\n HttpStatusCode[HttpStatusCode[\"PreconditionFailed\"] = 412] = \"PreconditionFailed\";\n HttpStatusCode[HttpStatusCode[\"PayloadTooLarge\"] = 413] = \"PayloadTooLarge\";\n HttpStatusCode[HttpStatusCode[\"UriTooLong\"] = 414] = \"UriTooLong\";\n HttpStatusCode[HttpStatusCode[\"UnsupportedMediaType\"] = 415] = \"UnsupportedMediaType\";\n HttpStatusCode[HttpStatusCode[\"RangeNotSatisfiable\"] = 416] = \"RangeNotSatisfiable\";\n HttpStatusCode[HttpStatusCode[\"ExpectationFailed\"] = 417] = \"ExpectationFailed\";\n HttpStatusCode[HttpStatusCode[\"ImATeapot\"] = 418] = \"ImATeapot\";\n HttpStatusCode[HttpStatusCode[\"MisdirectedRequest\"] = 421] = \"MisdirectedRequest\";\n HttpStatusCode[HttpStatusCode[\"UnprocessableEntity\"] = 422] = \"UnprocessableEntity\";\n HttpStatusCode[HttpStatusCode[\"Locked\"] = 423] = \"Locked\";\n HttpStatusCode[HttpStatusCode[\"FailedDependency\"] = 424] = \"FailedDependency\";\n HttpStatusCode[HttpStatusCode[\"TooEarly\"] = 425] = \"TooEarly\";\n HttpStatusCode[HttpStatusCode[\"UpgradeRequired\"] = 426] = \"UpgradeRequired\";\n HttpStatusCode[HttpStatusCode[\"PreconditionRequired\"] = 428] = \"PreconditionRequired\";\n HttpStatusCode[HttpStatusCode[\"TooManyRequests\"] = 429] = \"TooManyRequests\";\n HttpStatusCode[HttpStatusCode[\"RequestHeaderFieldsTooLarge\"] = 431] = \"RequestHeaderFieldsTooLarge\";\n HttpStatusCode[HttpStatusCode[\"UnavailableForLegalReasons\"] = 451] = \"UnavailableForLegalReasons\";\n HttpStatusCode[HttpStatusCode[\"InternalServerError\"] = 500] = \"InternalServerError\";\n HttpStatusCode[HttpStatusCode[\"NotImplemented\"] = 501] = \"NotImplemented\";\n HttpStatusCode[HttpStatusCode[\"BadGateway\"] = 502] = \"BadGateway\";\n HttpStatusCode[HttpStatusCode[\"ServiceUnavailable\"] = 503] = \"ServiceUnavailable\";\n HttpStatusCode[HttpStatusCode[\"GatewayTimeout\"] = 504] = \"GatewayTimeout\";\n HttpStatusCode[HttpStatusCode[\"HttpVersionNotSupported\"] = 505] = \"HttpVersionNotSupported\";\n HttpStatusCode[HttpStatusCode[\"VariantAlsoNegotiates\"] = 506] = \"VariantAlsoNegotiates\";\n HttpStatusCode[HttpStatusCode[\"InsufficientStorage\"] = 507] = \"InsufficientStorage\";\n HttpStatusCode[HttpStatusCode[\"LoopDetected\"] = 508] = \"LoopDetected\";\n HttpStatusCode[HttpStatusCode[\"NotExtended\"] = 510] = \"NotExtended\";\n HttpStatusCode[HttpStatusCode[\"NetworkAuthenticationRequired\"] = 511] = \"NetworkAuthenticationRequired\";\n})(HttpStatusCode || (HttpStatusCode = {}));\n\n/**\n * Constructs an instance of `HttpRequestOptions` from a source `HttpMethodOptions` and\n * the given `body`. This function clones the object and adds the body.\n *\n * Note that the `responseType` *options* value is a String that identifies the\n * single data type of the response.\n * A single overload version of the method handles each response type.\n * The value of `responseType` cannot be a union, as the combined signature could imply.\n *\n */\nfunction addBody(options, body) {\n return {\n body,\n headers: options.headers,\n context: options.context,\n observe: options.observe,\n params: options.params,\n reportProgress: options.reportProgress,\n responseType: options.responseType,\n withCredentials: options.withCredentials,\n transferCache: options.transferCache,\n };\n}\n/**\n * Performs HTTP requests.\n * This service is available as an injectable class, with methods to perform HTTP requests.\n * Each request method has multiple signatures, and the return type varies based on\n * the signature that is called (mainly the values of `observe` and `responseType`).\n *\n * Note that the `responseType` *options* value is a String that identifies the\n * single data type of the response.\n * A single overload version of the method handles each response type.\n * The value of `responseType` cannot be a union, as the combined signature could imply.\n\n * TODO(adev): review\n * @usageNotes\n *\n * ### HTTP Request Example\n *\n * ```\n * // GET heroes whose name contains search term\n * searchHeroes(term: string): observable{\n *\n * const params = new HttpParams({fromString: 'name=term'});\n * return this.httpClient.request('GET', this.heroesUrl, {responseType:'json', params});\n * }\n * ```\n *\n * Alternatively, the parameter string can be used without invoking HttpParams\n * by directly joining to the URL.\n * ```\n * this.httpClient.request('GET', this.heroesUrl + '?' + 'name=term', {responseType:'json'});\n * ```\n *\n *\n * ### JSONP Example\n * ```\n * requestJsonp(url, callback = 'callback') {\n * return this.httpClient.jsonp(this.heroesURL, callback);\n * }\n * ```\n *\n * ### PATCH Example\n * ```\n * // PATCH one of the heroes' name\n * patchHero (id: number, heroName: string): Observable<{}> {\n * const url = `${this.heroesUrl}/${id}`; // PATCH api/heroes/42\n * return this.httpClient.patch(url, {name: heroName}, httpOptions)\n * .pipe(catchError(this.handleError('patchHero')));\n * }\n * ```\n *\n * @see [HTTP Guide](guide/http)\n * @see [HTTP Request](api/common/http/HttpRequest)\n *\n * @publicApi\n */\nclass HttpClient {\n constructor(handler) {\n this.handler = handler;\n }\n /**\n * Constructs an observable for a generic HTTP request that, when subscribed,\n * fires the request through the chain of registered interceptors and on to the\n * server.\n *\n * You can pass an `HttpRequest` directly as the only parameter. In this case,\n * the call returns an observable of the raw `HttpEvent` stream.\n *\n * Alternatively you can pass an HTTP method as the first parameter,\n * a URL string as the second, and an options hash containing the request body as the third.\n * See `addBody()`. In this case, the specified `responseType` and `observe` options determine the\n * type of returned observable.\n * * The `responseType` value determines how a successful response body is parsed.\n * * If `responseType` is the default `json`, you can pass a type interface for the resulting\n * object as a type parameter to the call.\n *\n * The `observe` value determines the return type, according to what you are interested in\n * observing.\n * * An `observe` value of events returns an observable of the raw `HttpEvent` stream, including\n * progress events by default.\n * * An `observe` value of response returns an observable of `HttpResponse`,\n * where the `T` parameter depends on the `responseType` and any optionally provided type\n * parameter.\n * * An `observe` value of body returns an observable of `` with the same `T` body type.\n *\n */\n request(first, url, options = {}) {\n let req;\n // First, check whether the primary argument is an instance of `HttpRequest`.\n if (first instanceof HttpRequest) {\n // It is. The other arguments must be undefined (per the signatures) and can be\n // ignored.\n req = first;\n }\n else {\n // It's a string, so it represents a URL. Construct a request based on it,\n // and incorporate the remaining arguments (assuming `GET` unless a method is\n // provided.\n // Figure out the headers.\n let headers = undefined;\n if (options.headers instanceof HttpHeaders) {\n headers = options.headers;\n }\n else {\n headers = new HttpHeaders(options.headers);\n }\n // Sort out parameters.\n let params = undefined;\n if (!!options.params) {\n if (options.params instanceof HttpParams) {\n params = options.params;\n }\n else {\n params = new HttpParams({ fromObject: options.params });\n }\n }\n // Construct the request.\n req = new HttpRequest(first, url, options.body !== undefined ? options.body : null, {\n headers,\n context: options.context,\n params,\n reportProgress: options.reportProgress,\n // By default, JSON is assumed to be returned for all calls.\n responseType: options.responseType || 'json',\n withCredentials: options.withCredentials,\n transferCache: options.transferCache,\n });\n }\n // Start with an Observable.of() the initial request, and run the handler (which\n // includes all interceptors) inside a concatMap(). This way, the handler runs\n // inside an Observable chain, which causes interceptors to be re-run on every\n // subscription (this also makes retries re-run the handler, including interceptors).\n const events$ = of(req).pipe(concatMap((req) => this.handler.handle(req)));\n // If coming via the API signature which accepts a previously constructed HttpRequest,\n // the only option is to get the event stream. Otherwise, return the event stream if\n // that is what was requested.\n if (first instanceof HttpRequest || options.observe === 'events') {\n return events$;\n }\n // The requested stream contains either the full response or the body. In either\n // case, the first step is to filter the event stream to extract a stream of\n // responses(s).\n const res$ = (events$.pipe(filter((event) => event instanceof HttpResponse)));\n // Decide which stream to return.\n switch (options.observe || 'body') {\n case 'body':\n // The requested stream is the body. Map the response stream to the response\n // body. This could be done more simply, but a misbehaving interceptor might\n // transform the response body into a different format and ignore the requested\n // responseType. Guard against this by validating that the response is of the\n // requested type.\n switch (req.responseType) {\n case 'arraybuffer':\n return res$.pipe(map((res) => {\n // Validate that the body is an ArrayBuffer.\n if (res.body !== null && !(res.body instanceof ArrayBuffer)) {\n throw new Error('Response is not an ArrayBuffer.');\n }\n return res.body;\n }));\n case 'blob':\n return res$.pipe(map((res) => {\n // Validate that the body is a Blob.\n if (res.body !== null && !(res.body instanceof Blob)) {\n throw new Error('Response is not a Blob.');\n }\n return res.body;\n }));\n case 'text':\n return res$.pipe(map((res) => {\n // Validate that the body is a string.\n if (res.body !== null && typeof res.body !== 'string') {\n throw new Error('Response is not a string.');\n }\n return res.body;\n }));\n case 'json':\n default:\n // No validation needed for JSON responses, as they can be of any type.\n return res$.pipe(map((res) => res.body));\n }\n case 'response':\n // The response stream was requested directly, so return it.\n return res$;\n default:\n // Guard against new future observe types being added.\n throw new Error(`Unreachable: unhandled observe type ${options.observe}}`);\n }\n }\n /**\n * Constructs an observable that, when subscribed, causes the configured\n * `DELETE` request to execute on the server. See the individual overloads for\n * details on the return type.\n *\n * @param url The endpoint URL.\n * @param options The HTTP options to send with the request.\n *\n */\n delete(url, options = {}) {\n return this.request('DELETE', url, options);\n }\n /**\n * Constructs an observable that, when subscribed, causes the configured\n * `GET` request to execute on the server. See the individual overloads for\n * details on the return type.\n */\n get(url, options = {}) {\n return this.request('GET', url, options);\n }\n /**\n * Constructs an observable that, when subscribed, causes the configured\n * `HEAD` request to execute on the server. The `HEAD` method returns\n * meta information about the resource without transferring the\n * resource itself. See the individual overloads for\n * details on the return type.\n */\n head(url, options = {}) {\n return this.request('HEAD', url, options);\n }\n /**\n * Constructs an `Observable` that, when subscribed, causes a request with the special method\n * `JSONP` to be dispatched via the interceptor pipeline.\n * The [JSONP pattern](https://en.wikipedia.org/wiki/JSONP) works around limitations of certain\n * API endpoints that don't support newer,\n * and preferable [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) protocol.\n * JSONP treats the endpoint API as a JavaScript file and tricks the browser to process the\n * requests even if the API endpoint is not located on the same domain (origin) as the client-side\n * application making the request.\n * The endpoint API must support JSONP callback for JSONP requests to work.\n * The resource API returns the JSON response wrapped in a callback function.\n * You can pass the callback function name as one of the query parameters.\n * Note that JSONP requests can only be used with `GET` requests.\n *\n * @param url The resource URL.\n * @param callbackParam The callback function name.\n *\n */\n jsonp(url, callbackParam) {\n return this.request('JSONP', url, {\n params: new HttpParams().append(callbackParam, 'JSONP_CALLBACK'),\n observe: 'body',\n responseType: 'json',\n });\n }\n /**\n * Constructs an `Observable` that, when subscribed, causes the configured\n * `OPTIONS` request to execute on the server. This method allows the client\n * to determine the supported HTTP methods and other capabilities of an endpoint,\n * without implying a resource action. See the individual overloads for\n * details on the return type.\n */\n options(url, options = {}) {\n return this.request('OPTIONS', url, options);\n }\n /**\n * Constructs an observable that, when subscribed, causes the configured\n * `PATCH` request to execute on the server. See the individual overloads for\n * details on the return type.\n */\n patch(url, body, options = {}) {\n return this.request('PATCH', url, addBody(options, body));\n }\n /**\n * Constructs an observable that, when subscribed, causes the configured\n * `POST` request to execute on the server. The server responds with the location of\n * the replaced resource. See the individual overloads for\n * details on the return type.\n */\n post(url, body, options = {}) {\n return this.request('POST', url, addBody(options, body));\n }\n /**\n * Constructs an observable that, when subscribed, causes the configured\n * `PUT` request to execute on the server. The `PUT` method replaces an existing resource\n * with a new set of values.\n * See the individual overloads for details on the return type.\n */\n put(url, body, options = {}) {\n return this.request('PUT', url, addBody(options, body));\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: HttpClient, deps: [{ token: HttpHandler }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: HttpClient }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: HttpClient, decorators: [{\n type: Injectable\n }], ctorParameters: () => [{ type: HttpHandler }] });\n\nconst XSSI_PREFIX$1 = /^\\)\\]\\}',?\\n/;\nconst REQUEST_URL_HEADER = `X-Request-URL`;\n/**\n * Determine an appropriate URL for the response, by checking either\n * response url or the X-Request-URL header.\n */\nfunction getResponseUrl$1(response) {\n if (response.url) {\n return response.url;\n }\n // stored as lowercase in the map\n const xRequestUrl = REQUEST_URL_HEADER.toLocaleLowerCase();\n return response.headers.get(xRequestUrl);\n}\n/**\n * Uses `fetch` to send requests to a backend server.\n *\n * This `FetchBackend` requires the support of the\n * [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) which is available on all\n * supported browsers and on Node.js v18 or later.\n *\n * @see {@link HttpHandler}\n *\n * @publicApi\n */\nclass FetchBackend {\n constructor() {\n // We need to bind the native fetch to its context or it will throw an \"illegal invocation\"\n this.fetchImpl = inject(FetchFactory, { optional: true })?.fetch ?? fetch.bind(globalThis);\n this.ngZone = inject(NgZone);\n }\n handle(request) {\n return new Observable((observer) => {\n const aborter = new AbortController();\n this.doRequest(request, aborter.signal, observer).then(noop, (error) => observer.error(new HttpErrorResponse({ error })));\n return () => aborter.abort();\n });\n }\n async doRequest(request, signal, observer) {\n const init = this.createRequestInit(request);\n let response;\n try {\n const fetchPromise = this.fetchImpl(request.urlWithParams, { signal, ...init });\n // Make sure Zone.js doesn't trigger false-positive unhandled promise\n // error in case the Promise is rejected synchronously. See function\n // description for additional information.\n silenceSuperfluousUnhandledPromiseRejection(fetchPromise);\n // Send the `Sent` event before awaiting the response.\n observer.next({ type: HttpEventType.Sent });\n response = await fetchPromise;\n }\n catch (error) {\n observer.error(new HttpErrorResponse({\n error,\n status: error.status ?? 0,\n statusText: error.statusText,\n url: request.urlWithParams,\n headers: error.headers,\n }));\n return;\n }\n const headers = new HttpHeaders(response.headers);\n const statusText = response.statusText;\n const url = getResponseUrl$1(response) ?? request.urlWithParams;\n let status = response.status;\n let body = null;\n if (request.reportProgress) {\n observer.next(new HttpHeaderResponse({ headers, status, statusText, url }));\n }\n if (response.body) {\n // Read Progress\n const contentLength = response.headers.get('content-length');\n const chunks = [];\n const reader = response.body.getReader();\n let receivedLength = 0;\n let decoder;\n let partialText;\n // We have to check whether the Zone is defined in the global scope because this may be called\n // when the zone is nooped.\n const reqZone = typeof Zone !== 'undefined' && Zone.current;\n // Perform response processing outside of Angular zone to\n // ensure no excessive change detection runs are executed\n // Here calling the async ReadableStreamDefaultReader.read() is responsible for triggering CD\n await this.ngZone.runOutsideAngular(async () => {\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n chunks.push(value);\n receivedLength += value.length;\n if (request.reportProgress) {\n partialText =\n request.responseType === 'text'\n ? (partialText ?? '') +\n (decoder ??= new TextDecoder()).decode(value, { stream: true })\n : undefined;\n const reportProgress = () => observer.next({\n type: HttpEventType.DownloadProgress,\n total: contentLength ? +contentLength : undefined,\n loaded: receivedLength,\n partialText,\n });\n reqZone ? reqZone.run(reportProgress) : reportProgress();\n }\n }\n });\n // Combine all chunks.\n const chunksAll = this.concatChunks(chunks, receivedLength);\n try {\n const contentType = response.headers.get('Content-Type') ?? '';\n body = this.parseBody(request, chunksAll, contentType);\n }\n catch (error) {\n // Body loading or parsing failed\n observer.error(new HttpErrorResponse({\n error,\n headers: new HttpHeaders(response.headers),\n status: response.status,\n statusText: response.statusText,\n url: getResponseUrl$1(response) ?? request.urlWithParams,\n }));\n return;\n }\n }\n // Same behavior as the XhrBackend\n if (status === 0) {\n status = body ? HTTP_STATUS_CODE_OK : 0;\n }\n // ok determines whether the response will be transmitted on the event or\n // error channel. Unsuccessful status codes (not 2xx) will always be errors,\n // but a successful status code can still result in an error if the user\n // asked for JSON data and the body cannot be parsed as such.\n const ok = status >= 200 && status < 300;\n if (ok) {\n observer.next(new HttpResponse({\n body,\n headers,\n status,\n statusText,\n url,\n }));\n // The full body has been received and delivered, no further events\n // are possible. This request is complete.\n observer.complete();\n }\n else {\n observer.error(new HttpErrorResponse({\n error: body,\n headers,\n status,\n statusText,\n url,\n }));\n }\n }\n parseBody(request, binContent, contentType) {\n switch (request.responseType) {\n case 'json':\n // stripping the XSSI when present\n const text = new TextDecoder().decode(binContent).replace(XSSI_PREFIX$1, '');\n return text === '' ? null : JSON.parse(text);\n case 'text':\n return new TextDecoder().decode(binContent);\n case 'blob':\n return new Blob([binContent], { type: contentType });\n case 'arraybuffer':\n return binContent.buffer;\n }\n }\n createRequestInit(req) {\n // We could share some of this logic with the XhrBackend\n const headers = {};\n const credentials = req.withCredentials ? 'include' : undefined;\n // Setting all the requested headers.\n req.headers.forEach((name, values) => (headers[name] = values.join(',')));\n // Add an Accept header if one isn't present already.\n headers['Accept'] ??= 'application/json, text/plain, */*';\n // Auto-detect the Content-Type header if one isn't present already.\n if (!headers['Content-Type']) {\n const detectedType = req.detectContentTypeHeader();\n // Sometimes Content-Type detection fails.\n if (detectedType !== null) {\n headers['Content-Type'] = detectedType;\n }\n }\n return {\n body: req.serializeBody(),\n method: req.method,\n headers,\n credentials,\n };\n }\n concatChunks(chunks, totalLength) {\n const chunksAll = new Uint8Array(totalLength);\n let position = 0;\n for (const chunk of chunks) {\n chunksAll.set(chunk, position);\n position += chunk.length;\n }\n return chunksAll;\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: FetchBackend, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: FetchBackend }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: FetchBackend, decorators: [{\n type: Injectable\n }] });\n/**\n * Abstract class to provide a mocked implementation of `fetch()`\n */\nclass FetchFactory {\n}\nfunction noop() { }\n/**\n * Zone.js treats a rejected promise that has not yet been awaited\n * as an unhandled error. This function adds a noop `.then` to make\n * sure that Zone.js doesn't throw an error if the Promise is rejected\n * synchronously.\n */\nfunction silenceSuperfluousUnhandledPromiseRejection(promise) {\n promise.then(noop, noop);\n}\n\nfunction interceptorChainEndFn(req, finalHandlerFn) {\n return finalHandlerFn(req);\n}\n/**\n * Constructs a `ChainedInterceptorFn` which adapts a legacy `HttpInterceptor` to the\n * `ChainedInterceptorFn` interface.\n */\nfunction adaptLegacyInterceptorToChain(chainTailFn, interceptor) {\n return (initialRequest, finalHandlerFn) => interceptor.intercept(initialRequest, {\n handle: (downstreamRequest) => chainTailFn(downstreamRequest, finalHandlerFn),\n });\n}\n/**\n * Constructs a `ChainedInterceptorFn` which wraps and invokes a functional interceptor in the given\n * injector.\n */\nfunction chainedInterceptorFn(chainTailFn, interceptorFn, injector) {\n return (initialRequest, finalHandlerFn) => runInInjectionContext(injector, () => interceptorFn(initialRequest, (downstreamRequest) => chainTailFn(downstreamRequest, finalHandlerFn)));\n}\n/**\n * A multi-provider token that represents the array of registered\n * `HttpInterceptor` objects.\n *\n * @publicApi\n */\nconst HTTP_INTERCEPTORS = new InjectionToken(ngDevMode ? 'HTTP_INTERCEPTORS' : '');\n/**\n * A multi-provided token of `HttpInterceptorFn`s.\n */\nconst HTTP_INTERCEPTOR_FNS = new InjectionToken(ngDevMode ? 'HTTP_INTERCEPTOR_FNS' : '');\n/**\n * A multi-provided token of `HttpInterceptorFn`s that are only set in root.\n */\nconst HTTP_ROOT_INTERCEPTOR_FNS = new InjectionToken(ngDevMode ? 'HTTP_ROOT_INTERCEPTOR_FNS' : '');\n// TODO(atscott): We need a larger discussion about stability and what should contribute to stability.\n// Should the whole interceptor chain contribute to stability or just the backend request #55075?\n// Should HttpClient contribute to stability automatically at all?\nconst REQUESTS_CONTRIBUTE_TO_STABILITY = new InjectionToken(ngDevMode ? 'REQUESTS_CONTRIBUTE_TO_STABILITY' : '', { providedIn: 'root', factory: () => true });\n/**\n * Creates an `HttpInterceptorFn` which lazily initializes an interceptor chain from the legacy\n * class-based interceptors and runs the request through it.\n */\nfunction legacyInterceptorFnFactory() {\n let chain = null;\n return (req, handler) => {\n if (chain === null) {\n const interceptors = inject(HTTP_INTERCEPTORS, { optional: true }) ?? [];\n // Note: interceptors are wrapped right-to-left so that final execution order is\n // left-to-right. That is, if `interceptors` is the array `[a, b, c]`, we want to\n // produce a chain that is conceptually `c(b(a(end)))`, which we build from the inside\n // out.\n chain = interceptors.reduceRight(adaptLegacyInterceptorToChain, interceptorChainEndFn);\n }\n const pendingTasks = inject(ɵPendingTasks);\n const contributeToStability = inject(REQUESTS_CONTRIBUTE_TO_STABILITY);\n if (contributeToStability) {\n const taskId = pendingTasks.add();\n return chain(req, handler).pipe(finalize(() => pendingTasks.remove(taskId)));\n }\n else {\n return chain(req, handler);\n }\n };\n}\nlet fetchBackendWarningDisplayed = false;\n/** Internal function to reset the flag in tests */\nfunction resetFetchBackendWarningFlag() {\n fetchBackendWarningDisplayed = false;\n}\nclass HttpInterceptorHandler extends HttpHandler {\n constructor(backend, injector) {\n super();\n this.backend = backend;\n this.injector = injector;\n this.chain = null;\n this.pendingTasks = inject(ɵPendingTasks);\n this.contributeToStability = inject(REQUESTS_CONTRIBUTE_TO_STABILITY);\n // We strongly recommend using fetch backend for HTTP calls when SSR is used\n // for an application. The logic below checks if that's the case and produces\n // a warning otherwise.\n if ((typeof ngDevMode === 'undefined' || ngDevMode) && !fetchBackendWarningDisplayed) {\n const isServer = isPlatformServer(injector.get(PLATFORM_ID));\n if (isServer && !(this.backend instanceof FetchBackend)) {\n fetchBackendWarningDisplayed = true;\n injector\n .get(ɵConsole)\n .warn(ɵformatRuntimeError(2801 /* RuntimeErrorCode.NOT_USING_FETCH_BACKEND_IN_SSR */, 'Angular detected that `HttpClient` is not configured ' +\n \"to use `fetch` APIs. It's strongly recommended to \" +\n 'enable `fetch` for applications that use Server-Side Rendering ' +\n 'for better performance and compatibility. ' +\n 'To enable `fetch`, add the `withFetch()` to the `provideHttpClient()` ' +\n 'call at the root of the application.'));\n }\n }\n }\n handle(initialRequest) {\n if (this.chain === null) {\n const dedupedInterceptorFns = Array.from(new Set([\n ...this.injector.get(HTTP_INTERCEPTOR_FNS),\n ...this.injector.get(HTTP_ROOT_INTERCEPTOR_FNS, []),\n ]));\n // Note: interceptors are wrapped right-to-left so that final execution order is\n // left-to-right. That is, if `dedupedInterceptorFns` is the array `[a, b, c]`, we want to\n // produce a chain that is conceptually `c(b(a(end)))`, which we build from the inside\n // out.\n this.chain = dedupedInterceptorFns.reduceRight((nextSequencedFn, interceptorFn) => chainedInterceptorFn(nextSequencedFn, interceptorFn, this.injector), interceptorChainEndFn);\n }\n if (this.contributeToStability) {\n const taskId = this.pendingTasks.add();\n return this.chain(initialRequest, (downstreamRequest) => this.backend.handle(downstreamRequest)).pipe(finalize(() => this.pendingTasks.remove(taskId)));\n }\n else {\n return this.chain(initialRequest, (downstreamRequest) => this.backend.handle(downstreamRequest));\n }\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: HttpInterceptorHandler, deps: [{ token: HttpBackend }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: HttpInterceptorHandler }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"18.0.6\", ngImport: i0, type: HttpInterceptorHandler, decorators: [{\n type: Injectable\n }], ctorParameters: () => [{ type: HttpBackend }, { type: i0.EnvironmentInjector }] });\n\n// Every request made through JSONP needs a callback name that's unique across the\n// whole page. Each request is assigned an id and the callback name is constructed\n// from that. The next id to be assigned is tracked in a global variable here that\n// is shared among all applications on the page.\nlet nextRequestId = 0;\n/**\n * When a pending