{"version":3,"sources":["node_modules/@angular/animations/fesm2022/browser.mjs","node_modules/@angular/platform-browser/fesm2022/animations.mjs","node_modules/@sentry/utils/esm/is.js","node_modules/@sentry/utils/esm/string.js","node_modules/@sentry/utils/esm/aggregate-errors.js","node_modules/@sentry/utils/esm/worldwide.js","node_modules/@sentry/utils/esm/browser.js","node_modules/@sentry/utils/esm/debug-build.js","node_modules/@sentry/utils/esm/logger.js","node_modules/@sentry/utils/esm/dsn.js","node_modules/@sentry/utils/esm/error.js","node_modules/@sentry/utils/esm/object.js","node_modules/@sentry/utils/esm/stacktrace.js","node_modules/@sentry/utils/esm/instrument/_handlers.js","node_modules/@sentry/utils/esm/instrument/console.js","node_modules/@sentry/utils/esm/misc.js","node_modules/@sentry/utils/esm/instrument/dom.js","node_modules/@sentry/utils/esm/supports.js","node_modules/@sentry/utils/esm/instrument/fetch.js","node_modules/@sentry/utils/esm/instrument/globalError.js","node_modules/@sentry/utils/esm/instrument/globalUnhandledRejection.js","node_modules/@sentry/utils/esm/vendor/supportsHistory.js","node_modules/@sentry/utils/esm/instrument/history.js","node_modules/@sentry/utils/esm/instrument/xhr.js","node_modules/@sentry/utils/esm/env.js","node_modules/@sentry/utils/esm/memo.js","node_modules/@sentry/utils/esm/normalize.js","node_modules/@sentry/utils/esm/syncpromise.js","node_modules/@sentry/utils/esm/promisebuffer.js","node_modules/@sentry/utils/esm/url.js","node_modules/@sentry/utils/esm/severity.js","node_modules/@sentry/utils/esm/time.js","node_modules/@sentry/utils/esm/envelope.js","node_modules/@sentry/utils/esm/clientreport.js","node_modules/@sentry/utils/esm/ratelimit.js","node_modules/@sentry/utils/esm/eventbuilder.js","node_modules/@sentry/core/esm/debug-build.js","node_modules/@sentry/core/esm/constants.js","node_modules/@sentry/core/esm/eventProcessors.js","node_modules/@sentry/core/esm/session.js","node_modules/@sentry/core/esm/utils/spanUtils.js","node_modules/@sentry/core/esm/utils/prepareEvent.js","node_modules/@sentry/core/esm/exports.js","node_modules/@sentry/core/esm/utils/getRootSpan.js","node_modules/@sentry/core/esm/tracing/dynamicSamplingContext.js","node_modules/@sentry/core/esm/utils/applyScopeDataToEvent.js","node_modules/@sentry/core/esm/scope.js","node_modules/@sentry/core/esm/version.js","node_modules/@sentry/core/esm/hub.js","node_modules/@sentry/core/esm/semanticAttributes.js","node_modules/@sentry/core/esm/envelope.js","node_modules/@sentry/core/esm/api.js","node_modules/@sentry/core/esm/integration.js","node_modules/@sentry/core/esm/metrics/utils.js","node_modules/@sentry/core/esm/metrics/envelope.js","node_modules/@sentry/core/esm/baseclient.js","node_modules/@sentry/core/esm/sdk.js","node_modules/@sentry/core/esm/transports/base.js","node_modules/@sentry/core/esm/integrations/inboundfilters.js","node_modules/@sentry/core/esm/integrations/functiontostring.js","node_modules/@sentry/core/esm/integrations/linkederrors.js","node_modules/@sentry/core/esm/integrations/index.js","node_modules/@sentry/core/esm/index.js","node_modules/@sentry/browser/esm/helpers.js","node_modules/@sentry/browser/esm/debug-build.js","node_modules/@sentry/browser/esm/eventbuilder.js","node_modules/@sentry/browser/esm/userfeedback.js","node_modules/@sentry/browser/esm/client.js","node_modules/@sentry/browser/esm/transports/utils.js","node_modules/@sentry/browser/esm/transports/fetch.js","node_modules/@sentry/browser/esm/transports/xhr.js","node_modules/@sentry/browser/esm/stack-parsers.js","node_modules/@sentry/browser/esm/integrations/globalhandlers.js","node_modules/@sentry/browser/esm/integrations/trycatch.js","node_modules/@sentry/browser/esm/integrations/breadcrumbs.js","node_modules/@sentry/browser/esm/integrations/linkederrors.js","node_modules/@sentry/browser/esm/integrations/httpcontext.js","node_modules/@sentry/browser/esm/integrations/dedupe.js","node_modules/@sentry/browser/esm/sdk.js","node_modules/@sentry/browser/esm/integrations/index.js","node_modules/@sentry/browser/esm/index.js","node_modules/@sentry/angular-ivy/fesm2015/sentry-angular-ivy.js","node_modules/angulartics2/fesm2020/angulartics2.mjs","libs/shared/ui/alert/src/lib/alert.component.ts","libs/shared/ui/alert/src/lib/alert.component.html","libs/shared/ui/alert/src/lib/alert.module.ts","libs/shared/ui/checkbox/src/lib/checkbox.component.ts","libs/shared/ui/checkbox/src/lib/checkbox.component.html","libs/shared/ui/checkbox/src/lib/checkbox.module.ts","libs/shared/ui/modal/src/lib/modal-config.service.ts","libs/shared/ui/modal/src/lib/classes/base-modal/base-modal.ts","libs/shared/util/click-outside/src/lib/click-outside.directive.ts","libs/shared/util/click-outside/src/lib/click-outside.module.ts","libs/shared/util/utils/src/lib/trigger.class.ts","libs/shared/util/utils/src/lib/triggers.ts","libs/shared/util/utils/src/lib/decorators.ts","libs/shared/util/utils/src/lib/facade/browser.ts","libs/shared/util/utils/src/lib/utils.class.ts","libs/shared/util/utils/src/lib/warn-once.ts","libs/shared/util/component-loader/src/lib/content-ref.class.ts","libs/shared/util/component-loader/src/lib/component-loader.class.ts","libs/shared/util/positioning/src/lib/models/index.ts","libs/shared/util/positioning/src/lib/utils/getStyleComputedProperty.ts","libs/shared/util/positioning/src/lib/utils/getOffsetParent.ts","libs/shared/util/positioning/src/lib/utils/getRoot.ts","libs/shared/util/positioning/src/lib/utils/isOffsetContainer.ts","libs/shared/util/positioning/src/lib/utils/findCommonOffsetParent.ts","libs/shared/util/positioning/src/lib/utils/getFixedPositionOffsetParent.ts","libs/shared/util/positioning/src/lib/utils/getBordersSize.ts","libs/shared/util/positioning/src/lib/utils/getClientRect.ts","libs/shared/util/positioning/src/lib/utils/getWindowSizes.ts","libs/shared/util/positioning/src/lib/utils/isNumeric.ts","libs/shared/util/positioning/src/lib/utils/getBoundingClientRect.ts","libs/shared/util/positioning/src/lib/utils/getParentNode.ts","libs/shared/util/positioning/src/lib/utils/getScrollParent.ts","libs/shared/util/positioning/src/lib/utils/getScroll.ts","libs/shared/util/positioning/src/lib/utils/includeScroll.ts","libs/shared/util/positioning/src/lib/utils/getOffsetRectRelativeToArbitraryNode.ts","libs/shared/util/positioning/src/lib/utils/getViewportOffsetRectRelativeToArtbitraryNode.ts","libs/shared/util/positioning/src/lib/utils/isFixed.ts","libs/shared/util/positioning/src/lib/utils/getBoundaries.ts","libs/shared/util/positioning/src/lib/utils/computeAutoPlacement.ts","libs/shared/util/positioning/src/lib/utils/getOffsets.ts","libs/shared/util/positioning/src/lib/utils/getOppositePlacement.ts","libs/shared/util/positioning/src/lib/utils/getOppositeVariation.ts","libs/shared/util/positioning/src/lib/utils/getOuterSizes.ts","libs/shared/util/positioning/src/lib/utils/getReferenceOffsets.ts","libs/shared/util/positioning/src/lib/utils/getTargetOffsets.ts","libs/shared/util/positioning/src/lib/utils/isModifierEnabled.ts","libs/shared/util/positioning/src/lib/utils/checkMargin.ts","libs/shared/util/positioning/src/lib/utils/updateContainerClass.ts","libs/shared/util/positioning/src/lib/utils/setStyles.ts","libs/shared/util/positioning/src/lib/modifiers/arrow.ts","libs/shared/util/positioning/src/lib/modifiers/flip.ts","libs/shared/util/positioning/src/lib/modifiers/initData.ts","libs/shared/util/positioning/src/lib/modifiers/preventOverflow.ts","libs/shared/util/positioning/src/lib/modifiers/shift.ts","libs/shared/util/positioning/src/lib/ng-positioning.ts","libs/shared/util/positioning/src/lib/positioning.service.ts","libs/shared/util/component-loader/src/lib/component-loader.factory.ts","libs/shared/util/focus-trap/src/lib/boolean-property.ts","libs/shared/util/focus-trap/src/lib/platform.ts","libs/shared/util/focus-trap/src/lib/interactivity-checker.ts","libs/shared/util/focus-trap/src/lib/focus-trap.ts","libs/shared/util/focus-trap/src/lib/focus-trap-manager.ts","libs/shared/util/focus-trap/src/lib/focus-trap.module.ts","libs/shared/ui/modal/src/lib/components/modal-backdrop/modal-backdrop.component.ts","libs/shared/ui/modal/src/lib/components/modal-body/modal-body.component.ts","libs/shared/ui/modal/src/lib/components/modal-body/modal-body.component.html","libs/shared/util/key/src/lib/key.enum.ts","libs/shared/ui/modal/src/lib/models/modal-dismiss-reason.enum.ts","libs/shared/ui/modal/src/lib/components/modal-container/modal-container.component.ts","libs/shared/ui/modal/src/lib/components/modal-footer/modal-footer.component.ts","libs/shared/ui/modal/src/lib/components/modal-footer/modal-footer.component.html","libs/shared/ui/modal/src/lib/components/modal-header/modal-header.component.ts","libs/shared/ui/modal/src/lib/components/modal-header/modal-header.component.html","libs/shared/ui/modal/src/lib/services/modal-ref.service.ts","libs/shared/ui/modal/src/lib/components/modal-internal/modal-internal.component.ts","libs/shared/ui/modal/src/lib/components/modal-internal/modal-internal.component.html","libs/shared/ui/modal/src/lib/services/modal-internal.service.ts","libs/shared/ui/modal/src/lib/services/modal.service.ts","libs/shared/ui/modal/src/lib/modal.module.ts","libs/shared/ui/select/src/lib/select.component.ts","libs/shared/ui/select/src/lib/select.component.html","libs/shared/ui/select/src/lib/select.module.ts","libs/shared/ui/tooltip/src/lib/tooltip.service.ts","libs/shared/ui/tooltip/src/lib/tooltip-container.component.ts","libs/shared/ui/tooltip/src/lib/tooltip.directive.ts","libs/shared/ui/tooltip/src/lib/tooltip.module.ts","apps/shop/src/app/app-resolver.service.ts","apps/shop/src/app/catalog/catalog-category/catalog-category.service.ts","apps/shop/src/app/catalog/catalog-category/catalog-category.component.ts","apps/shop/src/app/catalog/catalog-category/catalog-category.component.html","apps/shop/src/app/catalog/catalog-checkout-information/catalog-checkout-information.service.ts","apps/shop/src/app/catalog/catalog-product/catalog-product.service.ts","apps/shop/src/app/catalog/catalog-checkout-cart/catalog-checkout-cart.component.ts","apps/shop/src/app/catalog/catalog-checkout-cart/catalog-checkout-cart.component.html","apps/shop/src/app/catalog/catalog-checkout-information/catalog-checkout-information.component.ts","apps/shop/src/app/catalog/catalog-checkout-information/catalog-checkout-information.component.html","apps/shop/src/app/catalog/shared/services/catalog-last-viewed.service.ts","apps/shop/src/app/catalog/catalog-product/catalog-product.component.ts","apps/shop/src/app/catalog/catalog-product/catalog-product.component.html","apps/shop/src/app/catalog/catalog.routes.ts","apps/shop/src/app/app-routing.module.ts","apps/shop/src/app/components/newsletter/newsletter.component.ts","apps/shop/src/app/components/newsletter/newsletter.component.html","apps/shop/src/app/components/catalog-cart/catalog-cart.component.ts","apps/shop/src/app/components/catalog-cart/catalog-cart.component.html","apps/shop/src/app/app.component.ts","apps/shop/src/app/app.component.html","apps/shop/src/app/catalog/shared/services/catalog-compare.service.ts","apps/shop/src/app/catalog/shared/services/catalog-wishlist.service.ts","apps/shop/src/app/core/services/environment/environment.model.ts","apps/shop/src/app/core/services/environment/environment.service.ts","apps/shop/src/app/core/services/interceptor/interceptor.service.ts","node_modules/@angular/common/locales/nl.mjs","apps/shop/src/app/core/core.module.ts","apps/shop/src/app/app.module.ts","apps/shop/src/environments/environment.prod.ts","apps/shop/src/main.ts"],"sourcesContent":["/**\n * @license Angular v17.0.8\n * (c) 2010-2022 Google LLC. https://angular.io/\n * License: MIT\n */\n\nimport { ɵAnimationGroupPlayer, NoopAnimationPlayer, AUTO_STYLE, ɵPRE_STYLE, sequence, style } from '@angular/animations';\nimport * as i0 from '@angular/core';\nimport { ɵRuntimeError, Injectable } from '@angular/core';\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 && `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 && '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 && `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 && `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 && `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 && `\\`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 && `The animation trigger \"${name}\" has failed to build due to the following errors:\\n - ${errors.map(err => err.message).join('\\n - ')}`);\n}\nfunction animationFailed(errors) {\n return new ɵRuntimeError(3502 /* RuntimeErrorCode.ANIMATION_FAILED */, ngDevMode && `Unable to animate due to the following errors:${LINE_START}${errors.map(err => err.message).join(LINE_START)}`);\n}\nfunction registerFailed(errors) {\n return new ɵRuntimeError(3503 /* RuntimeErrorCode.REGISTRATION_FAILED */, ngDevMode && `Unable to build the animation due to the following errors: ${errors.map(err => err.message).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 && `Unable to create the animation due to the following errors:${errors.map(err => err.message).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 && `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 && `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 && `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 && `Unable to process animations due to the following failed trigger transitions\\n ${errors.map(err => err.message).join('\\n')}`);\n}\nfunction triggerParsingFailed(name, errors) {\n return new ɵRuntimeError(3403 /* RuntimeErrorCode.TRIGGER_PARSING_FAILED */, ngDevMode && `Animation parsing for the ${name} trigger have failed:${LINE_START}${errors.map(err => err.message).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 = /*#__PURE__*/new Set(['-moz-outline-radius', '-moz-outline-radius-bottomleft', '-moz-outline-radius-bottomright', '-moz-outline-radius-topleft', '-moz-outline-radius-topright', '-ms-grid-columns', '-ms-grid-rows', '-webkit-line-clamp', '-webkit-text-fill-color', '-webkit-text-stroke', '-webkit-text-stroke-color', 'accent-color', 'all', 'backdrop-filter', 'background', 'background-color', 'background-position', 'background-size', 'block-size', 'border', 'border-block-end', 'border-block-end-color', 'border-block-end-width', 'border-block-start', 'border-block-start-color', 'border-block-start-width', 'border-bottom', 'border-bottom-color', 'border-bottom-left-radius', 'border-bottom-right-radius', 'border-bottom-width', 'border-color', 'border-end-end-radius', 'border-end-start-radius', 'border-image-outset', 'border-image-slice', 'border-image-width', 'border-inline-end', 'border-inline-end-color', 'border-inline-end-width', 'border-inline-start', 'border-inline-start-color', 'border-inline-start-width', 'border-left', 'border-left-color', 'border-left-width', 'border-radius', 'border-right', 'border-right-color', 'border-right-width', 'border-start-end-radius', 'border-start-start-radius', 'border-top', 'border-top-color', 'border-top-left-radius', 'border-top-right-radius', 'border-top-width', 'border-width', 'bottom', 'box-shadow', 'caret-color', 'clip', 'clip-path', 'color', 'column-count', 'column-gap', 'column-rule', 'column-rule-color', 'column-rule-width', 'column-width', 'columns', 'filter', 'flex', 'flex-basis', 'flex-grow', 'flex-shrink', 'font', 'font-size', 'font-size-adjust', 'font-stretch', 'font-variation-settings', 'font-weight', 'gap', 'grid-column-gap', 'grid-gap', 'grid-row-gap', 'grid-template-columns', 'grid-template-rows', 'height', 'inline-size', 'input-security', 'inset', 'inset-block', 'inset-block-end', 'inset-block-start', 'inset-inline', 'inset-inline-end', 'inset-inline-start', 'left', 'letter-spacing', 'line-clamp', 'line-height', 'margin', 'margin-block-end', 'margin-block-start', 'margin-bottom', 'margin-inline-end', 'margin-inline-start', 'margin-left', 'margin-right', 'margin-top', 'mask', 'mask-border', 'mask-position', 'mask-size', 'max-block-size', 'max-height', 'max-inline-size', 'max-lines', 'max-width', 'min-block-size', 'min-height', 'min-inline-size', 'min-width', 'object-position', 'offset', 'offset-anchor', 'offset-distance', 'offset-path', 'offset-position', 'offset-rotate', 'opacity', 'order', 'outline', 'outline-color', 'outline-offset', 'outline-width', 'padding', 'padding-block-end', 'padding-block-start', 'padding-bottom', 'padding-inline-end', 'padding-inline-start', 'padding-left', 'padding-right', 'padding-top', 'perspective', 'perspective-origin', 'right', 'rotate', 'row-gap', 'scale', 'scroll-margin', 'scroll-margin-block', 'scroll-margin-block-end', 'scroll-margin-block-start', 'scroll-margin-bottom', 'scroll-margin-inline', 'scroll-margin-inline-end', 'scroll-margin-inline-start', 'scroll-margin-left', 'scroll-margin-right', 'scroll-margin-top', 'scroll-padding', 'scroll-padding-block', 'scroll-padding-block-end', 'scroll-padding-block-start', 'scroll-padding-bottom', 'scroll-padding-inline', 'scroll-padding-inline-end', 'scroll-padding-inline-start', 'scroll-padding-left', 'scroll-padding-right', 'scroll-padding-top', 'scroll-snap-coordinate', 'scroll-snap-destination', 'scrollbar-color', 'shape-image-threshold', 'shape-margin', 'shape-outside', 'tab-size', 'text-decoration', 'text-decoration-color', 'text-decoration-thickness', 'text-emphasis', 'text-emphasis-color', 'text-indent', 'text-shadow', 'text-underline-offset', 'top', 'transform', 'transform-origin', 'translate', 'vertical-align', 'visibility', 'width', 'word-spacing', 'z-index', 'zoom']);\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 {\n element,\n triggerName,\n fromState,\n toState,\n phaseName,\n totalTime,\n disabled: !!disabled\n };\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}\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 */\nlet NoopAnimationDriver = /*#__PURE__*/(() => {\n class NoopAnimationDriver {\n /**\n * @returns Whether `prop` is a valid CSS property\n */\n validateStyleProperty(prop) {\n return validateStyleProperty(prop);\n }\n /**\n * @deprecated unused\n */\n matchesElement(_element, _selector) {\n // This method is deprecated and no longer in use so we return false.\n return false;\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 {\n this.ɵfac = function NoopAnimationDriver_Factory(t) {\n return new (t || NoopAnimationDriver)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: NoopAnimationDriver,\n factory: NoopAnimationDriver.ɵfac\n });\n }\n }\n return NoopAnimationDriver;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * @publicApi\n */\nlet AnimationDriver = /*#__PURE__*/(() => {\n class AnimationDriver {\n /**\n * @deprecated Use the NoopAnimationDriver class.\n */\n static {\n this.NOOP = /* @__PURE__ */new NoopAnimationDriver();\n }\n }\n return AnimationDriver;\n})();\nclass AnimationStyleNormalizer {}\nclass NoopAnimationStyleNormalizer {\n normalizePropertyName(propertyName, errors) {\n return propertyName;\n }\n normalizeStyleValue(userProvidedProperty, normalizedProperty, value, errors) {\n return value;\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') return value;\n const matches = value.match(/^(-?[\\.\\d]+)(m?s)/);\n if (!matches || matches.length < 2) 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:\n // ms or something else\n return value;\n }\n}\nfunction resolveTiming(timings, errors, allowNegativeValues) {\n return timings.hasOwnProperty('duration') ? timings : 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 {\n duration: 0,\n delay: 0,\n easing: ''\n };\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 } 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 {\n duration,\n delay,\n easing\n };\n}\nfunction copyObj(obj, destination = {}) {\n Object.keys(obj).forEach(prop => {\n destination[prop] = obj[prop];\n });\n return destination;\n}\nfunction convertToMap(obj) {\n const styleMap = new Map();\n Object.keys(obj).forEach(prop => {\n const val = obj[prop];\n styleMap.set(prop, val);\n });\n return styleMap;\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 => convertToMap(kf));\n}\nfunction normalizeStyles(styles) {\n const normalizedStyles = new Map();\n if (Array.isArray(styles)) {\n styles.forEach(data => copyStyles(data, normalizedStyles));\n } else {\n copyStyles(styles, normalizedStyles);\n }\n return normalizedStyles;\n}\nfunction copyStyles(styles, destination = new Map(), backfill) {\n if (backfill) {\n for (let [prop, val] of backfill) {\n destination.set(prop, val);\n }\n }\n for (let [prop, val] of styles) {\n destination.set(prop, val);\n }\n return destination;\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) 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 = /*#__PURE__*/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.toString();\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}\nfunction iteratorToArray(iterator) {\n const arr = [];\n let item = iterator.next();\n while (!item.done) {\n arr.push(item.value);\n item = iterator.next();\n }\n return arr;\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 7 /* AnimationMetadataType.Trigger */:\n return visitor.visitTrigger(node, context);\n case 0 /* AnimationMetadataType.State */:\n return visitor.visitState(node, context);\n case 1 /* AnimationMetadataType.Transition */:\n return visitor.visitTransition(node, context);\n case 2 /* AnimationMetadataType.Sequence */:\n return visitor.visitSequence(node, context);\n case 3 /* AnimationMetadataType.Group */:\n return visitor.visitGroup(node, context);\n case 4 /* AnimationMetadataType.Animate */:\n return visitor.visitAnimate(node, context);\n case 5 /* AnimationMetadataType.Keyframes */:\n return visitor.visitKeyframes(node, context);\n case 6 /* AnimationMetadataType.Style */:\n return visitor.visitStyle(node, context);\n case 8 /* AnimationMetadataType.Reference */:\n return visitor.visitReference(node, context);\n case 9 /* AnimationMetadataType.AnimateChild */:\n return visitor.visitAnimateChild(node, context);\n case 10 /* AnimationMetadataType.AnimateRef */:\n return visitor.visitAnimateRef(node, context);\n case 11 /* AnimationMetadataType.Query */:\n return visitor.visitQuery(node, context);\n case 12 /* 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}\nconst DIMENSIONAL_PROP_SET = /*#__PURE__*/new Set(['width', 'height', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight', 'left', 'top', 'bottom', 'right', 'fontSize', 'outlineWidth', 'outlineOffset', 'paddingTop', 'paddingLeft', 'paddingBottom', 'paddingRight', 'marginTop', 'marginLeft', 'marginBottom', 'marginRight', 'borderRadius', 'borderWidth', 'borderTopWidth', 'borderLeftWidth', 'borderRightWidth', 'borderBottomWidth', 'textIndent', 'perspective']);\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 } 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}\nfunction createListOfWarnings(warnings) {\n const LINE_START = '\\n - ';\n return `${LINE_START}${warnings.filter(Boolean).map(warning => warning).join(LINE_START)}`;\n}\nfunction warnValidation(warnings) {\n (typeof ngDevMode === 'undefined' || ngDevMode) && console.warn(`animation validation warnings:${createListOfWarnings(warnings)}`);\n}\nfunction warnTriggerBuild(name, warnings) {\n (typeof ngDevMode === 'undefined' || ngDevMode) && console.warn(`The animation trigger \"${name}\" has built with the following warnings:${createListOfWarnings(warnings)}`);\n}\nfunction warnRegister(warnings) {\n (typeof ngDevMode === 'undefined' || ngDevMode) && console.warn(`Animation built with the following warnings:${createListOfWarnings(warnings)}`);\n}\nfunction triggerParsingWarnings(name, warnings) {\n (typeof ngDevMode === 'undefined' || ngDevMode) && 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}\nconst ANY_STATE = '*';\nfunction parseTransitionExpr(transitionValue, errors) {\n const expressions = [];\n if (typeof transitionValue == 'string') {\n transitionValue.split(/\\s*,\\s*/).forEach(str => parseInnerTransitionStr(str, expressions, errors));\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 = /*#__PURE__*/new Set(['true', '1']);\nconst FALSE_BOOLEAN_VALUES = /*#__PURE__*/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}\nconst SELF_TOKEN = ':self';\nconst SELF_TOKEN_REGEX = /*#__PURE__*/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, [...context.unsupportedCSSPropertiesFound.keys()]);\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 == 0 /* AnimationMetadataType.State */) {\n const stateDef = def;\n const name = stateDef.name;\n name.toString().split(/\\s*,\\s*/).forEach(n => {\n stateDef.name = n;\n states.push(this.visitState(stateDef, context));\n });\n stateDef.name = name;\n } else if (def.type == 1 /* AnimationMetadataType.Transition */) {\n const transition = this.visitTransition(def, context);\n queryCount += transition.queryCount;\n depCount += transition.depCount;\n transitions.push(transition);\n } else {\n context.errors.push(invalidDefinition());\n }\n });\n return {\n type: 7 /* 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 const missingSubsArr = iteratorToArray(missingSubs.values());\n context.errors.push(invalidState(metadata.name, missingSubsArr));\n }\n }\n return {\n type: 0 /* AnimationMetadataType.State */,\n name: metadata.name,\n style: styleAst,\n options: astParams ? {\n params: astParams\n } : 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: 1 /* 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: 2 /* 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: 3 /* 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 ? metadata.styles : style({});\n if (styleMetadata.type == 5 /* AnimationMetadataType.Keyframes */) {\n styleAst = this.visitKeyframes(styleMetadata, context);\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: 4 /* 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 } else {\n context.errors.push(invalidStyleValue(styleTuple));\n }\n } else {\n styles.push(convertToMap(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: 6 /* 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') 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 && startTime >= collectedEntry.startTime && 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, {\n startTime,\n endTime\n });\n }\n if (context.options) {\n validateStyleParams(value, context.options, context.errors);\n }\n });\n });\n }\n visitKeyframes(metadata, context) {\n const ast = {\n type: 5 /* AnimationMetadataType.Keyframes */,\n styles: [],\n options: null\n };\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 } 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: 8 /* 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: 9 /* AnimationMetadataType.AnimateChild */,\n options: normalizeAnimationOptions(metadata.options)\n };\n }\n visitAnimateRef(metadata, context) {\n return {\n type: 10 /* 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 ? parentSelector + ' ' + selector : 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: 11 /* 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,\n delay: 0,\n easing: 'full'\n } : resolveTiming(metadata.timings, context.errors, true);\n return {\n type: 12 /* 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) ? true : 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.replace(/@\\*/g, NG_TRIGGER_SELECTOR).replace(/@\\w+/g, match => NG_TRIGGER_SELECTOR + '-' + match.slice(1)).replace(/:animating/g, NG_ANIMATING_SELECTOR);\n return [selector, hasAmpersand];\n}\nfunction normalizeParams(obj) {\n return obj ? copyObj(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') 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 } 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 = copyObj(options);\n if (options['params']) {\n options['params'] = normalizeParams(options['params']);\n }\n } else {\n options = {};\n }\n return options;\n}\nfunction makeTimingAst(duration, delay, easing) {\n return {\n duration,\n delay,\n 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}\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}\nconst ONE_FRAME_IN_MILLISECONDS = 1;\nconst ENTER_TOKEN = ':enter';\nconst ENTER_TOKEN_REGEX = /*#__PURE__*/new RegExp(ENTER_TOKEN, 'g');\nconst LEAVE_TOKEN = ':leave';\nconst LEAVE_TOKEN_REGEX = /*#__PURE__*/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. The `copyStyles` method in util.ts\n * handles propagating that backfill map to the styles object.\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 ? timelines.map(timeline => timeline.buildKeyframes()) : [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' ? animationDelay : 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 == 6 /* 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 ? interpolateParams(strValue, context.params, context.errors) : strValue;\n return resolveTiming(timingValue, context.errors);\n } else {\n return {\n duration: ast.duration,\n delay: ast.delay,\n easing: ast.easing\n };\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 == 5 /* AnimationMetadataType.Keyframes */) {\n this.visitKeyframes(style, context);\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 } 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 && (context.previousNode.type === 6 /* AnimationMetadataType.Style */ || 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 = 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) 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 = limit < 0 ? elements.slice(elements.length + limit, elements.length) : 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 } 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, {\n time: this.currentTime,\n value\n });\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) 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 = copyStyles(keyframe, new Map(), this._backFill);\n finalKeyframe.forEach((value, prop) => {\n if (value === ɵPRE_STYLE) {\n preStyleProps.add(prop);\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.size ? iteratorToArray(preStyleProps.values()) : [];\n const postProps = postStyleProps.size ? iteratorToArray(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 = {\n duration: timings.duration,\n delay: timings.delay,\n easing: timings.easing\n };\n }\n containsAnimation() {\n return this.keyframes.length > 1;\n }\n buildKeyframes() {\n let keyframes = this.keyframes;\n let {\n delay,\n duration,\n easing\n } = 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 = copyStyles(keyframes[0]);\n newFirstKeyframe.set('offset', 0);\n newKeyframes.push(newFirstKeyframe);\n const oldFirstKeyframe = copyStyles(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 delay=1000, duration=1000, keyframes = 0 .5 1\n turns into\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 = copyStyles(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 = allProperties || allStyles.keys();\n for (let prop of allProperties) {\n styles.set(prop, AUTO_STYLE);\n }\n } else {\n copyStyles(token, styles);\n }\n });\n return styles;\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}\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 ? [] : 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 const queriedElementsList = iteratorToArray(queriedElements.values());\n return createTransitionInstruction(element, this._triggerName, currentState, nextState, isRemoval, currentStateStyles, nextStateStyles, timelines, queriedElementsList, 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 const invalidNonAnimatableProps = new Set();\n timelines.forEach(({\n keyframes\n }) => {\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 } 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` + ' not animatable properties: ' + Array.from(invalidNonAnimatableProps).join(', ') + '\\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 = copyObj(defaults);\n for (const key in userParams) {\n if (userParams.hasOwnProperty(key) && userParams[key] != null) {\n result[key] = userParams[key];\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 = copyObj(this.defaultParams);\n Object.keys(params).forEach(key => {\n const value = params[key];\n if (value !== null) {\n combinedParams[key] = value;\n }\n });\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}\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 = {\n type: 2 /* AnimationMetadataType.Sequence */,\n steps: [],\n options: null\n };\n const transition = {\n type: 1 /* 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 } else if (stateMap.has(key2)) {\n stateMap.set(key1, stateMap.get(key2));\n }\n}\nconst EMPTY_INSTRUCTION_MAP = /*#__PURE__*/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 } 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 } 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}\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 const options = copyObj(input);\n delete options['value'];\n this.options = options;\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 = /*#__PURE__*/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 = {\n name,\n phase,\n callback\n };\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 } 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 } 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) 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]) return;\n const namespaces = this._engine.fetchNamespacesByElement(elm);\n if (namespaces.size) {\n namespaces.forEach(ns => ns.triggerLeaveAnimation(elm, context, false, true));\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)) 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)) 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 ? engine.playersByQueriedElement.get(element) : [];\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 } 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 } 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) 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 } 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 } 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 } 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) 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)) 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 } 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 } 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 } 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) 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 } 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 } 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 && (this.totalQueuedPlayers || this.collectedLeaveElements.length)) {\n const cleanupFns = [];\n try {\n players = this._flushAnimations(cleanupFns, microtaskId);\n } finally {\n for (let i = 0; i < cleanupFns.length; i++) {\n cleanupFns[i]();\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 } 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.query(element, STAR_SELECTOR, true).forEach(elm => mergedLeaveNodes.add(elm));\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 && 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 = {\n instruction,\n player,\n element\n };\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 {\n element,\n player,\n instruction\n } = 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 } 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 } 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 } 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) 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 } 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 } 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) return;\n if (!isRemovalAnimation && player.triggerName != triggerName) return;\n players.push(player);\n });\n }\n }\n if (namespaceId || triggerName) {\n players = players.filter(player => {\n if (namespaceId && namespaceId != player.namespaceId) return false;\n if (triggerName && triggerName != player.triggerName) 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 ? undefined : namespaceId;\n const targetTriggerName = instruction.isRemovalTransition ? undefined : 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) 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) 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) 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) return NULL_NODE;\n let root = localRootMap.get(node);\n if (root) return root;\n const parent = node.parentNode;\n if (rootMap.has(parent)) {\n // ngIf inside @trigger\n root = parent;\n } else if (nodeSet.has(parent)) {\n // ngIf inside ngIf\n root = NULL_NODE;\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 } 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) 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]) return false;\n }\n return true;\n}\nfunction replacePostStylesAsPre(element, allPreStyleElements, allPostStyleElements) {\n const postEntry = allPostStyleElements.get(element);\n if (!postEntry) return false;\n let preEntry = allPreStyleElements.get(element);\n if (preEntry) {\n postEntry.forEach(data => preEntry.add(data));\n } else {\n allPreStyleElements.set(element, postEntry);\n }\n allPostStyleElements.delete(element);\n return true;\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 } 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 } 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 */\nlet SpecialCasedStyles = /*#__PURE__*/(() => {\n class SpecialCasedStyles {\n static {\n this.initialStylesByElement = /* @__PURE__ */new WeakMap();\n }\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\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\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 }\n return SpecialCasedStyles;\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}\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) 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 } 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}\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 matchesElement(_element, _selector) {\n // This method is deprecated and no longer in use so we return false.\n return false;\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 window.getComputedStyle(element)[prop];\n }\n animate(element, keyframes, duration, delay, easing, previousPlayers = []) {\n const fill = delay == 0 ? 'both' : 'forwards';\n const playerOptions = {\n duration,\n delay,\n fill\n };\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 => copyStyles(styles));\n _keyframes = balancePreviousStylesIntoKeyframes(element, _keyframes, previousStyles);\n const specialStyles = packageNonAnimatableStyles(element, _keyframes);\n return new WebAnimationsPlayer(element, _keyframes, playerOptions, specialStyles);\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}\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) ? normalizeStyles(startingStyles) : startingStyles;\n const dest = Array.isArray(destinationStyles) ? normalizeStyles(destinationStyles) : 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}\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\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 } 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 } else {\n this.engine.process(this.namespaceId, el, name.slice(1), value);\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}\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 } 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 v17.0.8\n * (c) 2010-2022 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 } 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';\nlet InjectableAnimationEngine = /*#__PURE__*/(() => {\n class 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, appRef) {\n super(doc, driver, normalizer);\n }\n ngOnDestroy() {\n this.flush();\n }\n static {\n this.ɵfac = function InjectableAnimationEngine_Factory(t) {\n return new (t || InjectableAnimationEngine)(i0.ɵɵinject(DOCUMENT), i0.ɵɵinject(i1.AnimationDriver), i0.ɵɵinject(i1.ɵAnimationStyleNormalizer), i0.ɵɵinject(i0.ApplicationRef));\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: InjectableAnimationEngine,\n factory: InjectableAnimationEngine.ɵfac\n });\n }\n }\n return InjectableAnimationEngine;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\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,\n useFactory: instantiateDefaultStyleNormalizer\n}, {\n provide: ɵAnimationEngine,\n useClass: InjectableAnimationEngine\n}, {\n provide: RendererFactory2,\n useFactory: instantiateRendererFactory,\n deps: [ɵDomRendererFactory2, ɵAnimationEngine, NgZone]\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,\n useFactory: () => new ɵWebAnimationsDriver()\n}, {\n provide: ANIMATION_MODULE_TYPE,\n useValue: 'BrowserAnimations'\n}, ...SHARED_ANIMATION_PROVIDERS];\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,\n useClass: NoopAnimationDriver\n}, {\n provide: ANIMATION_MODULE_TYPE,\n useValue: 'NoopAnimations'\n}, ...SHARED_ANIMATION_PROVIDERS];\n\n/**\n * Exports `BrowserModule` with additional [dependency-injection providers](guide/glossary#provider)\n * for use with animations. See [Animations](guide/animations).\n * @publicApi\n */\nlet BrowserAnimationsModule = /*#__PURE__*/(() => {\n class 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 ? BROWSER_NOOP_ANIMATIONS_PROVIDERS : BROWSER_ANIMATIONS_PROVIDERS\n };\n }\n static {\n this.ɵfac = function BrowserAnimationsModule_Factory(t) {\n return new (t || BrowserAnimationsModule)();\n };\n }\n static {\n this.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: BrowserAnimationsModule\n });\n }\n static {\n this.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({\n providers: BROWSER_ANIMATIONS_PROVIDERS,\n imports: [BrowserModule]\n });\n }\n }\n return BrowserAnimationsModule;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Returns the set of [dependency-injection providers](guide/glossary#provider)\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 // 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 */\nlet NoopAnimationsModule = /*#__PURE__*/(() => {\n class NoopAnimationsModule {\n static {\n this.ɵfac = function NoopAnimationsModule_Factory(t) {\n return new (t || NoopAnimationsModule)();\n };\n }\n static {\n this.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: NoopAnimationsModule\n });\n }\n static {\n this.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({\n providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS,\n imports: [BrowserModule]\n });\n }\n }\n return NoopAnimationsModule;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Returns the set of [dependency-injection providers](guide/glossary#provider)\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","// 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 typeof wat === 'object' && wat !== null && '__sentry_template_string__' in wat && '__sentry_template_values__' in wat;\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 is NaN\n * {@link isNaN}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nfunction isNaN(wat) {\n return typeof wat === 'number' && wat !== 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}\nexport { isDOMError, isDOMException, isElement, isError, isErrorEvent, isEvent, isInstanceOf, isNaN, isParameterizedString, isPlainObject, isPrimitive, isRegExp, isString, isSyntheticEvent, isThenable, isVueViewModel };\n","import { isVueViewModel, isString, isRegExp } from './is.js';\n\n/**\n * Truncates given string to the maximum characters count\n *\n * @param str An object that contains serializable values\n * @param max Maximum number of characters in truncated string (0 = unlimited)\n * @returns string Encoded\n */\nfunction truncate(str, max = 0) {\n if (typeof str !== 'string' || max === 0) {\n return str;\n }\n return str.length <= max ? str : `${str.slice(0, max)}...`;\n}\n\n/**\n * This is basically just `trim_line` from\n * https://github.com/getsentry/sentry/blob/master/src/sentry/lang/javascript/processor.py#L67\n *\n * @param str An object that contains serializable values\n * @param max Maximum number of characters in truncated string\n * @returns string Encoded\n */\nfunction snipLine(line, colno) {\n let newLine = line;\n const lineLength = newLine.length;\n if (lineLength <= 150) {\n return newLine;\n }\n if (colno > lineLength) {\n // eslint-disable-next-line no-param-reassign\n colno = lineLength;\n }\n let start = Math.max(colno - 60, 0);\n if (start < 5) {\n start = 0;\n }\n let end = Math.min(start + 140, lineLength);\n if (end > lineLength - 5) {\n end = lineLength;\n }\n if (end === lineLength) {\n start = Math.max(end - 140, 0);\n }\n newLine = newLine.slice(start, end);\n if (start > 0) {\n newLine = `'{snip} ${newLine}`;\n }\n if (end < lineLength) {\n newLine += ' {snip}';\n }\n return newLine;\n}\n\n/**\n * Join values in array\n * @param input array of values to be joined together\n * @param delimiter string to be placed in-between values\n * @returns Joined values\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction safeJoin(input, delimiter) {\n if (!Array.isArray(input)) {\n return '';\n }\n const output = [];\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < input.length; i++) {\n const value = input[i];\n try {\n // This is a hack to fix a Vue3-specific bug that causes an infinite loop of\n // console warnings. This happens when a Vue template is rendered with\n // an undeclared variable, which we try to stringify, ultimately causing\n // Vue to issue another warning which repeats indefinitely.\n // see: https://github.com/getsentry/sentry-javascript/pull/8981\n if (isVueViewModel(value)) {\n output.push('[VueViewModel]');\n } else {\n output.push(String(value));\n }\n } catch (e) {\n output.push('[value cannot be serialized]');\n }\n }\n return output.join(delimiter);\n}\n\n/**\n * Checks if the given value matches a regex or string\n *\n * @param value The string to test\n * @param pattern Either a regex or a string against which `value` will be matched\n * @param requireExactStringMatch If true, `value` must match `pattern` exactly. If false, `value` will match\n * `pattern` if it contains `pattern`. Only applies to string-type patterns.\n */\nfunction isMatchingPattern(value, pattern, requireExactStringMatch = false) {\n if (!isString(value)) {\n return false;\n }\n if (isRegExp(pattern)) {\n return pattern.test(value);\n }\n if (isString(pattern)) {\n return requireExactStringMatch ? value === pattern : value.includes(pattern);\n }\n return false;\n}\n\n/**\n * Test the given string against an array of strings and regexes. By default, string matching is done on a\n * substring-inclusion basis rather than a strict equality basis\n *\n * @param testString The string to test\n * @param patterns The patterns against which to test the string\n * @param requireExactStringMatch If true, `testString` must match one of the given string patterns exactly in order to\n * count. If false, `testString` will match a string pattern if it contains that pattern.\n * @returns\n */\nfunction stringMatchesSomePattern(testString, patterns = [], requireExactStringMatch = false) {\n return patterns.some(pattern => isMatchingPattern(testString, pattern, requireExactStringMatch));\n}\nexport { isMatchingPattern, safeJoin, snipLine, stringMatchesSomePattern, truncate };\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(exceptionFromErrorImplementation, parser, maxValueLimit = 250, key, limit, event, hint) {\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 = 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(aggregateExceptionsFromError(exceptionFromErrorImplementation, parser, limit, hint.originalException, key, event.exception.values, originalException, 0), maxValueLimit);\n }\n}\nfunction aggregateExceptionsFromError(exceptionFromErrorImplementation, parser, limit, error, key, prevExceptions, exception, exceptionId) {\n if (prevExceptions.length >= limit + 1) {\n return prevExceptions;\n }\n let newExceptions = [...prevExceptions];\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(exceptionFromErrorImplementation, parser, limit, error[key], key, [newException, ...newExceptions], newException, newExceptionId);\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(exceptionFromErrorImplementation, parser, limit, childError, key, [newException, ...newExceptions], newException, newExceptionId);\n }\n });\n }\n return newExceptions;\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 || {\n type: 'generic',\n handled: true\n };\n exception.mechanism = {\n ...exception.mechanism,\n is_exception_group: true,\n exception_id: exceptionId\n };\n}\nfunction applyExceptionGroupFieldsForChildException(exception, source, exceptionId, parentId) {\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 || {\n type: 'generic',\n 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}\nexport { applyAggregateErrorsToEvent };\n","/** Internal global with common properties and Sentry extensions */\n\n// The code below for 'isGlobalObj' and 'GLOBAL_OBJ' was copied from core-js before modification\n// https://github.com/zloirock/core-js/blob/1b944df55282cdc99c90db5f49eb0b6eda2cc0a3/packages/core-js/internals/global.js\n// core-js has the following licence:\n//\n// Copyright (c) 2014-2022 Denis Pushkarev\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n/** Returns 'obj' if it's the global object, otherwise returns undefined */\nfunction isGlobalObj(obj) {\n return obj && obj.Math == Math ? obj : undefined;\n}\n\n/** Get's the global object for the current JavaScript runtime */\nconst GLOBAL_OBJ = typeof globalThis == 'object' && isGlobalObj(globalThis) ||\n// eslint-disable-next-line no-restricted-globals\ntypeof window == 'object' && isGlobalObj(window) || typeof self == 'object' && isGlobalObj(self) || typeof global == 'object' && isGlobalObj(global) || function () {\n return this;\n}() || {};\n\n/**\n * @deprecated Use GLOBAL_OBJ instead or WINDOW from @sentry/browser. This will be removed in v8\n */\nfunction getGlobalObject() {\n return GLOBAL_OBJ;\n}\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 singleton = __SENTRY__[name] || (__SENTRY__[name] = creator());\n return singleton;\n}\nexport { GLOBAL_OBJ, getGlobalObject, getGlobalSingleton };\n","import { isString } from './is.js';\nimport { getGlobalObject } from './worldwide.js';\n\n// eslint-disable-next-line deprecation/deprecation\nconst WINDOW = getGlobalObject();\nconst DEFAULT_MAX_STRING_LENGTH = 80;\n\n/**\n * Given a child DOM element, returns a query-selector statement describing that\n * and its ancestors\n * e.g. [HTMLElement] => body > div > input#foo.btn[name=baz]\n * @returns generated DOM path\n */\nfunction htmlTreeAsString(elem, options = {}) {\n if (!elem) {\n return '';\n }\n\n // try/catch both:\n // - accessing event.target (see getsentry/raven-js#838, #768)\n // - `htmlTreeAsString` because it's complex, and just accessing the DOM incorrectly\n // - can throw an exception in some circumstances.\n try {\n let currentElem = elem;\n const MAX_TRAVERSE_HEIGHT = 5;\n const out = [];\n let height = 0;\n let len = 0;\n const separator = ' > ';\n const sepLength = separator.length;\n let nextStr;\n const keyAttrs = Array.isArray(options) ? options : options.keyAttrs;\n const maxStringLength = !Array.isArray(options) && options.maxStringLength || DEFAULT_MAX_STRING_LENGTH;\n while (currentElem && height++ < MAX_TRAVERSE_HEIGHT) {\n nextStr = _htmlElementAsString(currentElem, keyAttrs);\n // bail out if\n // - nextStr is the 'html' element\n // - the length of the string that would be created exceeds maxStringLength\n // (ignore this limit if we are on the first iteration)\n if (nextStr === 'html' || height > 1 && len + out.length * sepLength + nextStr.length >= maxStringLength) {\n break;\n }\n out.push(nextStr);\n len += nextStr.length;\n currentElem = currentElem.parentNode;\n }\n return out.reverse().join(separator);\n } catch (_oO) {\n return '';\n }\n}\n\n/**\n * Returns a simple, query-selector representation of a DOM element\n * e.g. [HTMLElement] => input#foo.btn[name=baz]\n * @returns generated DOM path\n */\nfunction _htmlElementAsString(el, keyAttrs) {\n const elem = el;\n const out = [];\n let className;\n let classes;\n let key;\n let attr;\n let i;\n if (!elem || !elem.tagName) {\n return '';\n }\n\n // @ts-expect-error WINDOW has HTMLElement\n if (WINDOW.HTMLElement) {\n // If using the component name annotation plugin, this value may be available on the DOM node\n if (elem instanceof HTMLElement && elem.dataset && elem.dataset['sentryComponent']) {\n return elem.dataset['sentryComponent'];\n }\n }\n out.push(elem.tagName.toLowerCase());\n\n // Pairs of attribute keys defined in `serializeAttribute` and their values on element.\n const keyAttrPairs = keyAttrs && keyAttrs.length ? keyAttrs.filter(keyAttr => elem.getAttribute(keyAttr)).map(keyAttr => [keyAttr, elem.getAttribute(keyAttr)]) : null;\n if (keyAttrPairs && keyAttrPairs.length) {\n keyAttrPairs.forEach(keyAttrPair => {\n out.push(`[${keyAttrPair[0]}=\"${keyAttrPair[1]}\"]`);\n });\n } else {\n if (elem.id) {\n out.push(`#${elem.id}`);\n }\n\n // eslint-disable-next-line prefer-const\n className = elem.className;\n if (className && isString(className)) {\n classes = className.split(/\\s+/);\n for (i = 0; i < classes.length; i++) {\n out.push(`.${classes[i]}`);\n }\n }\n }\n const allowedAttrs = ['aria-label', 'type', 'name', 'title', 'alt'];\n for (i = 0; i < allowedAttrs.length; i++) {\n key = allowedAttrs[i];\n attr = elem.getAttribute(key);\n if (attr) {\n out.push(`[${key}=\"${attr}\"]`);\n }\n }\n return out.join('');\n}\n\n/**\n * A safe form of location.href\n */\nfunction getLocationHref() {\n try {\n return WINDOW.document.location.href;\n } catch (oO) {\n return '';\n }\n}\n\n/**\n * Gets a DOM element by using document.querySelector.\n *\n * This wrapper will first check for the existance of the function before\n * actually calling it so that we don't have to take care of this check,\n * every time we want to access the DOM.\n *\n * Reason: DOM/querySelector is not available in all environments.\n *\n * We have to cast to any because utils can be consumed by a variety of environments,\n * and we don't want to break TS users. If you know what element will be selected by\n * `document.querySelector`, specify it as part of the generic call. For example,\n * `const element = getDomElement('selector');`\n *\n * @param selector the selector string passed on to document.querySelector\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction getDomElement(selector) {\n if (WINDOW.document && WINDOW.document.querySelector) {\n return WINDOW.document.querySelector(selector);\n }\n return null;\n}\n\n/**\n * Given a DOM element, traverses up the tree until it finds the first ancestor node\n * that has the `data-sentry-component` attribute. This attribute is added at build-time\n * by projects that have the component name annotation plugin installed.\n *\n * @returns a string representation of the component for the provided DOM element, or `null` if not found\n */\nfunction getComponentName(elem) {\n // @ts-expect-error WINDOW has HTMLElement\n if (!WINDOW.HTMLElement) {\n return null;\n }\n let currentElem = elem;\n const MAX_TRAVERSE_HEIGHT = 5;\n for (let i = 0; i < MAX_TRAVERSE_HEIGHT; i++) {\n if (!currentElem) {\n return null;\n }\n if (currentElem instanceof HTMLElement && currentElem.dataset['sentryComponent']) {\n return currentElem.dataset['sentryComponent'];\n }\n currentElem = currentElem.parentNode;\n }\n return null;\n}\nexport { getComponentName, getDomElement, getLocationHref, htmlTreeAsString };\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__;\nexport { DEBUG_BUILD };\n","import { DEBUG_BUILD } from './debug-build.js';\nimport { GLOBAL_OBJ } from './worldwide.js';\n\n/** Prefix for logging strings */\nconst PREFIX = 'Sentry Logger ';\nconst CONSOLE_LEVELS = ['debug', 'info', 'warn', 'error', 'log', 'assert', 'trace'];\n\n/** This may be mutated by the console instrumentation. */\nconst originalConsoleMethods = {};\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 const console = GLOBAL_OBJ.console;\n const wrappedFuncs = {};\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 try {\n return callback();\n } finally {\n // Revert restoration to wrapped state\n wrappedLevels.forEach(level => {\n console[level] = wrappedFuncs[level];\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 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 return logger;\n}\nconst logger = makeLogger();\nexport { CONSOLE_LEVELS, consoleSandbox, logger, originalConsoleMethods };\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+))?\\/(.+)/;\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 {\n host,\n path,\n pass,\n port,\n projectId,\n protocol,\n publicKey\n } = dsn;\n return `${protocol}://${publicKey}${withPassword && pass ? `:${pass}` : ''}` + `@${host}${port ? `:${port}` : ''}/${path ? `${path}/` : path}${projectId}`;\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 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 const [protocol, publicKey, pass = '', host, port = '', lastPath] = match.slice(1);\n let path = '';\n let projectId = lastPath;\n const split = projectId.split('/');\n if (split.length > 1) {\n path = split.slice(0, -1).join('/');\n projectId = split.pop();\n }\n if (projectId) {\n const projectMatch = projectId.match(/^\\d+/);\n if (projectMatch) {\n projectId = projectMatch[0];\n }\n }\n return dsnFromComponents({\n host,\n pass,\n path,\n projectId,\n port,\n protocol: protocol,\n 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}\nfunction validateDsn(dsn) {\n if (!DEBUG_BUILD) {\n return true;\n }\n const {\n port,\n projectId,\n protocol\n } = dsn;\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 if (hasMissingRequiredComponent) {\n return false;\n }\n if (!projectId.match(/^\\d+$/)) {\n logger.error(`Invalid Sentry Dsn: Invalid projectId ${projectId}`);\n return false;\n }\n if (!isValidProtocol(protocol)) {\n logger.error(`Invalid Sentry Dsn: Invalid protocol ${protocol}`);\n return false;\n }\n if (port && isNaN(parseInt(port, 10))) {\n logger.error(`Invalid Sentry Dsn: Invalid port ${port}`);\n return false;\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}\nexport { dsnFromString, dsnToString, makeDsn };\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);\n 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}\nexport { SentryError };\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 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 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).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(object[key])}`).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(value) {\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 type: value.type,\n target: serializeEventTarget(value.target),\n currentTarget: serializeEventTarget(value.currentTarget),\n ...getOwnProperties(value)\n };\n if (typeof CustomEvent !== 'undefined' && isInstanceOf(value, CustomEvent)) {\n newObj.detail = value.detail;\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 if (!keys.length) {\n return '[object has no keys]';\n }\n if (keys[0].length >= maxLength) {\n return truncate(keys[0], maxLength);\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 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}\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 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 for (const key of Object.keys(inputValue)) {\n if (typeof inputValue[key] !== 'undefined') {\n returnValue[key] = _dropUndefinedKeys(inputValue[key], memoizationMap);\n }\n }\n return returnValue;\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 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 inputValue.forEach(item => {\n returnValue.push(_dropUndefinedKeys(item, memoizationMap));\n });\n return returnValue;\n }\n return inputValue;\n}\nfunction isPojo(input) {\n if (!isPlainObject(input)) {\n return false;\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}\nexport { addNonEnumerableProperty, convertToPlainObject, dropUndefinedKeys, extractExceptionKeysForMessage, fill, getOriginalFunction, markFunctionWrapped, objectify, urlEncode };\n","import { node } from './node-stack-trace.js';\nexport { filenameIsInApp } from './node-stack-trace.js';\nconst STACKTRACE_FRAME_LIMIT = 50;\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 return (stack, skipFirst = 0) => {\n const frames = [];\n const lines = stack.split('\\n');\n for (let i = skipFirst; 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 for (const parser of sortedParsers) {\n const frame = parser(cleanedLine);\n if (frame) {\n frames.push(frame);\n break;\n }\n }\n if (frames.length >= STACKTRACE_FRAME_LIMIT) {\n break;\n }\n }\n return stripSentryFramesAndReverse(frames);\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 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(localStack[localStack.length - 1].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(localStack[localStack.length - 1].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(localStack[localStack.length - 1].function || '')) {\n localStack.pop();\n }\n }\n return localStack.slice(0, STACKTRACE_FRAME_LIMIT).map(frame => ({\n ...frame,\n filename: frame.filename || localStack[localStack.length - 1].filename,\n function: frame.function || '?'\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 * Node.js stack line parser\n *\n * This is in @sentry/utils so it can be used from the Electron SDK in the browser for when `nodeIntegration == true`.\n * This allows it to be used without referencing or importing any node specific code which causes bundlers to complain\n */\nfunction nodeStackLineParser(getModule) {\n return [90, node(getModule)];\n}\nexport { createStackParser, getFunctionName, nodeStackLineParser, 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 for (const handler of typeHandlers) {\n try {\n handler(data);\n } catch (e) {\n DEBUG_BUILD && logger.error(`Error while triggering instrumentation handler.\\nType: ${type}\\nName: ${getFunctionName(handler)}\\nError:`, e);\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}\nfunction instrumentConsole() {\n if (!('console' in GLOBAL_OBJ)) {\n return;\n }\n CONSOLE_LEVELS.forEach(function (level) {\n if (!(level in GLOBAL_OBJ.console)) {\n return;\n }\n fill(GLOBAL_OBJ.console, level, function (originalConsoleMethod) {\n originalConsoleMethods[level] = originalConsoleMethod;\n return function (...args) {\n const handlerData = {\n args,\n level\n };\n triggerHandlers('console', handlerData);\n const log = originalConsoleMethods[level];\n log && log.apply(GLOBAL_OBJ.console, args);\n };\n });\n });\n}\nexport { addConsoleInstrumentationHandler };\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 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 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}\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 {\n message,\n event_id: eventId\n } = event;\n if (message) {\n return message;\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 const defaultMechanism = {\n type: 'generic',\n handled: true\n };\n const currentMechanism = firstException.mechanism;\n firstException.mechanism = {\n ...defaultMechanism,\n ...currentMechanism,\n ...newMechanism\n };\n if (newMechanism && 'data' in newMechanism) {\n const mergedData = {\n ...(currentMechanism && currentMechanism.data),\n ...newMechanism.data\n };\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 = /^(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\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], 10);\n const minor = parseInt(match[2], 10);\n const patch = parseInt(match[3], 10);\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 const maxLines = lines.length;\n const sourceLine = Math.max(Math.min(maxLines - 1, frame.lineno - 1), 0);\n frame.pre_context = lines.slice(Math.max(0, sourceLine - linesOfContext), sourceLine).map(line => snipLine(line, 0));\n frame.context_line = snipLine(lines[Math.min(maxLines - 1, sourceLine)], frame.colno || 0);\n frame.post_context = lines.slice(Math.min(sourceLine + 1, maxLines), sourceLine + 1 + linesOfContext).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 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 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}\nexport { addContextToFrame, addExceptionMechanism, addExceptionTypeValue, arrayify, checkOrSetAlreadyCaught, getEventDescription, parseSemver, uuid4 };\n","import { uuid4 } from '../misc.js';\nimport { fill, addNonEnumerableProperty } from '../object.js';\nimport { GLOBAL_OBJ } from '../worldwide.js';\nimport { addHandler, maybeInstrument, triggerHandlers } from './_handlers.js';\nconst WINDOW = GLOBAL_OBJ;\nconst DEBOUNCE_DURATION = 1000;\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\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 fill(proto, 'addEventListener', function (originalAddEventListener) {\n return function (type, listener, options) {\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] || {\n 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 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 return originalAddEventListener.call(this, type, listener, options);\n };\n });\n fill(proto, 'removeEventListener', function (originalRemoveEventListener) {\n return function (type, listener, options) {\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 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 return originalRemoveEventListener.call(this, type, listener, options);\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 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 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 return true;\n}\n\n/**\n * Wraps addEventListener to capture UI breadcrumbs\n */\nfunction makeDOMEventHandler(handler, globalListener = false) {\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 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 if (target && !target._sentryId) {\n // Add UUID to event target so we can identify if\n addNonEnumerableProperty(target, '_sentryId', uuid4());\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 = {\n event,\n name,\n global: globalListener\n };\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}\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}\nexport { addClickKeypressInstrumentationHandler, instrumentDOM };\n","import { DEBUG_BUILD } from './debug-build.js';\nimport { logger } from './logger.js';\nimport { getGlobalObject } from './worldwide.js';\n\n// eslint-disable-next-line deprecation/deprecation\nconst WINDOW = getGlobalObject();\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 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 * isNativeFetch checks if the given function is a native implementation of fetch()\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction isNativeFetch(func) {\n return func && /^function fetch\\(\\)\\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 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 (isNativeFetch(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 = isNativeFetch(sandbox.contentWindow.fetch);\n }\n doc.head.removeChild(sandbox);\n } catch (err) {\n DEBUG_BUILD && logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', err);\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 try {\n new Request('_', {\n referrerPolicy: 'origin'\n });\n return true;\n } catch (e) {\n return false;\n }\n}\nexport { isNativeFetch, supportsDOMError, supportsDOMException, supportsErrorEvent, supportsFetch, supportsNativeFetch, supportsReferrerPolicy, supportsReportingObserver };\n","import { fill } from '../object.js';\nimport { supportsNativeFetch } from '../supports.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}\nfunction instrumentFetch() {\n if (!supportsNativeFetch()) {\n return;\n }\n fill(GLOBAL_OBJ, 'fetch', function (originalFetch) {\n return function (...args) {\n const {\n method,\n url\n } = parseFetchArgs(args);\n const handlerData = {\n args,\n fetchData: {\n method,\n url\n },\n startTimestamp: Date.now()\n };\n triggerHandlers('fetch', {\n ...handlerData\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return originalFetch.apply(GLOBAL_OBJ, args).then(response => {\n const finishedHandlerData = {\n ...handlerData,\n endTimestamp: Date.now(),\n response\n };\n triggerHandlers('fetch', finishedHandlerData);\n return response;\n }, error => {\n const erroredHandlerData = {\n ...handlerData,\n endTimestamp: Date.now(),\n error\n };\n triggerHandlers('fetch', erroredHandlerData);\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}\nfunction hasProp(obj, prop) {\n return !!obj && typeof obj === 'object' && !!obj[prop];\n}\nfunction getUrlFromResource(resource) {\n if (typeof resource === 'string') {\n return resource;\n }\n if (!resource) {\n return '';\n }\n if (hasProp(resource, 'url')) {\n return resource.url;\n }\n if (resource.toString) {\n return resource.toString();\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 {\n method: 'GET',\n url: ''\n };\n }\n if (fetchArgs.length === 2) {\n const [url, options] = fetchArgs;\n return {\n url: getUrlFromResource(url),\n method: hasProp(options, 'method') ? String(options.method).toUpperCase() : 'GET'\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}\nexport { addFetchInstrumentationHandler, parseFetchArgs };\n","import { GLOBAL_OBJ } from '../worldwide.js';\nimport { addHandler, maybeInstrument, triggerHandlers } from './_handlers.js';\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}\nfunction instrumentError() {\n _oldOnErrorHandler = GLOBAL_OBJ.onerror;\n GLOBAL_OBJ.onerror = function (msg, url, line, column, error) {\n const handlerData = {\n column,\n error,\n line,\n msg,\n url\n };\n triggerHandlers('error', handlerData);\n if (_oldOnErrorHandler && !_oldOnErrorHandler.__SENTRY_LOADER__) {\n // eslint-disable-next-line prefer-rest-params\n return _oldOnErrorHandler.apply(this, arguments);\n }\n return false;\n };\n GLOBAL_OBJ.onerror.__SENTRY_INSTRUMENTED__ = true;\n}\nexport { addGlobalErrorInstrumentationHandler };\n","import { GLOBAL_OBJ } from '../worldwide.js';\nimport { addHandler, maybeInstrument, triggerHandlers } from './_handlers.js';\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(handler) {\n const type = 'unhandledrejection';\n addHandler(type, handler);\n maybeInstrument(type, instrumentUnhandledRejection);\n}\nfunction instrumentUnhandledRejection() {\n _oldOnUnhandledRejectionHandler = GLOBAL_OBJ.onunhandledrejection;\n GLOBAL_OBJ.onunhandledrejection = function (e) {\n const handlerData = e;\n triggerHandlers('unhandledrejection', handlerData);\n if (_oldOnUnhandledRejectionHandler && !_oldOnUnhandledRejectionHandler.__SENTRY_LOADER__) {\n // eslint-disable-next-line prefer-rest-params\n return _oldOnUnhandledRejectionHandler.apply(this, arguments);\n }\n return true;\n };\n GLOBAL_OBJ.onunhandledrejection.__SENTRY_INSTRUMENTED__ = true;\n}\nexport { addGlobalUnhandledRejectionInstrumentationHandler };\n","import { getGlobalObject } from '../worldwide.js';\n\n// Based on https://github.com/angular/angular.js/pull/13945/files\n\n// eslint-disable-next-line deprecation/deprecation\nconst WINDOW = getGlobalObject();\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 chrome = WINDOW.chrome;\n const isChromePackagedApp = chrome && chrome.app && chrome.app.runtime;\n /* eslint-enable @typescript-eslint/no-unsafe-member-access */\n const hasHistoryApi = 'history' in WINDOW && !!WINDOW.history.pushState && !!WINDOW.history.replaceState;\n return !isChromePackagedApp && hasHistoryApi;\n}\nexport { supportsHistory };\n","import { fill } from '../object.js';\nimport '../debug-build.js';\nimport '../logger.js';\nimport { GLOBAL_OBJ } from '../worldwide.js';\nimport { supportsHistory } from '../vendor/supportsHistory.js';\nimport { addHandler, maybeInstrument, triggerHandlers } from './_handlers.js';\nconst WINDOW = GLOBAL_OBJ;\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}\nfunction instrumentHistory() {\n if (!supportsHistory()) {\n return;\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 = {\n from,\n to\n };\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 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 = {\n from,\n to\n };\n triggerHandlers('history', handlerData);\n }\n return originalHistoryFunction.apply(this, args);\n };\n }\n fill(WINDOW.history, 'pushState', historyReplacementFunction);\n fill(WINDOW.history, 'replaceState', historyReplacementFunction);\n}\nexport { addHistoryInstrumentationHandler };\n","import { isString } from '../is.js';\nimport { fill } from '../object.js';\nimport { GLOBAL_OBJ } from '../worldwide.js';\nimport { addHandler, maybeInstrument, triggerHandlers } from './_handlers.js';\nconst WINDOW = GLOBAL_OBJ;\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 // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (!WINDOW.XMLHttpRequest) {\n return;\n }\n const xhrproto = XMLHttpRequest.prototype;\n fill(xhrproto, 'open', function (originalOpen) {\n return function (...args) {\n const startTimestamp = Date.now();\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 if (!method || !url) {\n return originalOpen.apply(this, args);\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 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 if (!xhrInfo) {\n return;\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 const handlerData = {\n args: [method, url],\n endTimestamp: Date.now(),\n startTimestamp,\n xhr: this\n };\n triggerHandlers('xhr', handlerData);\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 const xhrInfo = this[SENTRY_XHR_DATA_KEY];\n if (xhrInfo && isString(header) && isString(value)) {\n xhrInfo.request_headers[header.toLowerCase()] = value;\n }\n return original.apply(this, setRequestHeaderArgs);\n };\n });\n return originalOpen.apply(this, args);\n };\n });\n fill(xhrproto, 'send', function (originalSend) {\n return function (...args) {\n const sentryXhrData = this[SENTRY_XHR_DATA_KEY];\n if (!sentryXhrData) {\n return originalSend.apply(this, args);\n }\n if (args[0] !== undefined) {\n sentryXhrData.body = args[0];\n }\n const handlerData = {\n args: [sentryXhrData.method, sentryXhrData.url],\n startTimestamp: Date.now(),\n xhr: this\n };\n triggerHandlers('xhr', handlerData);\n return originalSend.apply(this, args);\n };\n });\n}\nfunction parseUrl(url) {\n if (isString(url)) {\n return url;\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}\nexport { SENTRY_XHR_DATA_KEY, addXhrInstrumentationHandler, instrumentXHR };\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}\nexport { getSDKSource, isBrowserBundle };\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * Helper to decycle json objects\n */\nfunction memoBuilder() {\n const hasWeakSet = typeof WeakSet === 'function';\n const inner = hasWeakSet ? new WeakSet() : [];\n function memoize(obj) {\n if (hasWeakSet) {\n if (inner.has(obj)) {\n return true;\n }\n inner.add(obj);\n return false;\n }\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < inner.length; i++) {\n const value = inner[i];\n if (value === obj) {\n return true;\n }\n }\n inner.push(obj);\n return false;\n }\n function unmemoize(obj) {\n if (hasWeakSet) {\n inner.delete(obj);\n } else {\n for (let i = 0; i < inner.length; i++) {\n if (inner[i] === obj) {\n inner.splice(i, 1);\n break;\n }\n }\n }\n }\n return [memoize, unmemoize];\n}\nexport { memoBuilder };\n","import { isNaN, isVueViewModel, isSyntheticEvent } from './is.js';\nimport { memoBuilder } from './memo.js';\nimport { convertToPlainObject } from './object.js';\nimport { getFunctionName } from './stacktrace.js';\n\n/**\n * Recursively normalizes the given object.\n *\n * - Creates a copy to prevent original input mutation\n * - Skips non-enumerable properties\n * - When stringifying, calls `toJSON` if implemented\n * - Removes circular references\n * - Translates non-serializable values (`undefined`/`NaN`/functions) to serializable format\n * - Translates known global objects/classes to a string representations\n * - Takes care of `Error` object serialization\n * - Optionally limits depth of final output\n * - Optionally limits number of properties/elements included in any single object/array\n *\n * @param input The object to be normalized.\n * @param depth The max depth to which to normalize the object. (Anything deeper stringified whole.)\n * @param maxProperties The max number of elements or properties to be included in any single array or\n * object in the normallized output.\n * @returns A normalized version of the object, or `\"**non-serializable**\"` if any errors are thrown during normalization.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction normalize(input, depth = 100, maxProperties = +Infinity) {\n try {\n // since we're at the outermost level, we don't provide a key\n return visit('', input, depth, maxProperties);\n } catch (err) {\n return {\n ERROR: `**non-serializable** (${err})`\n };\n }\n}\n\n/** JSDoc */\nfunction normalizeToSize(\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nobject,\n// Default Node.js REPL depth\ndepth = 3,\n// 100kB, as 200kB is max payload size, so half sounds reasonable\nmaxSize = 100 * 1024) {\n const normalized = normalize(object, depth);\n if (jsonSize(normalized) > maxSize) {\n return normalizeToSize(object, depth - 1, maxSize);\n }\n return normalized;\n}\n\n/**\n * Visits a node to perform normalization on it\n *\n * @param key The key corresponding to the given node\n * @param value The node to be visited\n * @param depth Optional number indicating the maximum recursion depth\n * @param maxProperties Optional maximum number of properties/elements included in any single object/array\n * @param memo Optional Memo class handling decycling\n */\nfunction visit(key, value, depth = +Infinity, maxProperties = +Infinity, memo = memoBuilder()) {\n const [memoize, unmemoize] = memo;\n\n // Get the simple cases out of the way first\n if (value == null ||\n // this matches null and undefined -> eqeq not eqeqeq\n ['number', 'boolean', 'string'].includes(typeof value) && !isNaN(value)) {\n return value;\n }\n const stringified = stringifyValue(key, value);\n\n // Anything we could potentially dig into more (objects or arrays) will have come back as `\"[object XXXX]\"`.\n // Everything else will have already been serialized, so if we don't see that pattern, we're done.\n if (!stringified.startsWith('[object ')) {\n return stringified;\n }\n\n // From here on, we can assert that `value` is either an object or an array.\n\n // Do not normalize objects that we know have already been normalized. As a general rule, the\n // \"__sentry_skip_normalization__\" property should only be used sparingly and only should only be set on objects that\n // have already been normalized.\n if (value['__sentry_skip_normalization__']) {\n return value;\n }\n\n // We can set `__sentry_override_normalization_depth__` on an object to ensure that from there\n // We keep a certain amount of depth.\n // This should be used sparingly, e.g. we use it for the redux integration to ensure we get a certain amount of state.\n const remainingDepth = typeof value['__sentry_override_normalization_depth__'] === 'number' ? value['__sentry_override_normalization_depth__'] : depth;\n\n // We're also done if we've reached the max depth\n if (remainingDepth === 0) {\n // At this point we know `serialized` is a string of the form `\"[object XXXX]\"`. Clean it up so it's just `\"[XXXX]\"`.\n return stringified.replace('object ', '');\n }\n\n // If we've already visited this branch, bail out, as it's circular reference. If not, note that we're seeing it now.\n if (memoize(value)) {\n return '[Circular ~]';\n }\n\n // If the value has a `toJSON` method, we call it to extract more information\n const valueWithToJSON = value;\n if (valueWithToJSON && typeof valueWithToJSON.toJSON === 'function') {\n try {\n const jsonValue = valueWithToJSON.toJSON();\n // We need to normalize the return value of `.toJSON()` in case it has circular references\n return visit('', jsonValue, remainingDepth - 1, maxProperties, memo);\n } catch (err) {\n // pass (The built-in `toJSON` failed, but we can still try to do it ourselves)\n }\n }\n\n // At this point we know we either have an object or an array, we haven't seen it before, and we're going to recurse\n // because we haven't yet reached the max depth. Create an accumulator to hold the results of visiting each\n // property/entry, and keep track of the number of items we add to it.\n const normalized = Array.isArray(value) ? [] : {};\n let numAdded = 0;\n\n // Before we begin, convert`Error` and`Event` instances into plain objects, since some of each of their relevant\n // properties are non-enumerable and otherwise would get missed.\n const visitable = convertToPlainObject(value);\n for (const visitKey in visitable) {\n // Avoid iterating over fields in the prototype if they've somehow been exposed to enumeration.\n if (!Object.prototype.hasOwnProperty.call(visitable, visitKey)) {\n continue;\n }\n if (numAdded >= maxProperties) {\n normalized[visitKey] = '[MaxProperties ~]';\n break;\n }\n\n // Recursively visit all the child nodes\n const visitValue = visitable[visitKey];\n normalized[visitKey] = visit(visitKey, visitValue, remainingDepth - 1, maxProperties, memo);\n numAdded++;\n }\n\n // Once we've visited all the branches, remove the parent from memo storage\n unmemoize(value);\n\n // Return accumulated values\n return normalized;\n}\n\n/* eslint-disable complexity */\n/**\n * Stringify the given value. Handles various known special values and types.\n *\n * Not meant to be used on simple primitives which already have a string representation, as it will, for example, turn\n * the number 1231 into \"[Object Number]\", nor on `null`, as it will throw.\n *\n * @param value The value to stringify\n * @returns A stringified representation of the given value\n */\nfunction stringifyValue(key,\n// this type is a tiny bit of a cheat, since this function does handle NaN (which is technically a number), but for\n// our internal use, it'll do\nvalue) {\n try {\n if (key === 'domain' && value && typeof value === 'object' && value._events) {\n return '[Domain]';\n }\n if (key === 'domainEmitter') {\n return '[DomainEmitter]';\n }\n\n // It's safe to use `global`, `window`, and `document` here in this manner, as we are asserting using `typeof` first\n // which won't throw if they are not present.\n\n if (typeof global !== 'undefined' && value === global) {\n return '[Global]';\n }\n\n // eslint-disable-next-line no-restricted-globals\n if (typeof window !== 'undefined' && value === window) {\n return '[Window]';\n }\n\n // eslint-disable-next-line no-restricted-globals\n if (typeof document !== 'undefined' && value === document) {\n return '[Document]';\n }\n if (isVueViewModel(value)) {\n return '[VueViewModel]';\n }\n\n // React's SyntheticEvent thingy\n if (isSyntheticEvent(value)) {\n return '[SyntheticEvent]';\n }\n if (typeof value === 'number' && value !== value) {\n return '[NaN]';\n }\n if (typeof value === 'function') {\n return `[Function: ${getFunctionName(value)}]`;\n }\n if (typeof value === 'symbol') {\n return `[${String(value)}]`;\n }\n\n // stringified BigInts are indistinguishable from regular numbers, so we need to label them to avoid confusion\n if (typeof value === 'bigint') {\n return `[BigInt: ${String(value)}]`;\n }\n\n // Now that we've knocked out all the special cases and the primitives, all we have left are objects. Simply casting\n // them to strings means that instances of classes which haven't defined their `toStringTag` will just come out as\n // `\"[object Object]\"`. If we instead look at the constructor's name (which is the same as the name of the class),\n // we can make sure that only plain objects come out that way.\n const objName = getConstructorName(value);\n\n // Handle HTML Elements\n if (/^HTML(\\w*)Element$/.test(objName)) {\n return `[HTMLElement: ${objName}]`;\n }\n return `[object ${objName}]`;\n } catch (err) {\n return `**non-serializable** (${err})`;\n }\n}\n/* eslint-enable complexity */\n\nfunction getConstructorName(value) {\n const prototype = Object.getPrototypeOf(value);\n return prototype ? prototype.constructor.name : 'null prototype';\n}\n\n/** Calculates bytes size of input string */\nfunction utf8Length(value) {\n // eslint-disable-next-line no-bitwise\n return ~-encodeURI(value).split(/%..|./).length;\n}\n\n/** Calculates bytes size of input object */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction jsonSize(value) {\n return utf8Length(JSON.stringify(value));\n}\n\n/**\n * Normalizes URLs in exceptions and stacktraces to a base path so Sentry can fingerprint\n * across platforms and working directory.\n *\n * @param url The URL to be normalized.\n * @param basePath The application base path.\n * @returns The normalized URL.\n */\nfunction normalizeUrlToBase(url, basePath) {\n const escapedBase = basePath\n // Backslash to forward\n .replace(/\\\\/g, '/')\n // Escape RegExp special characters\n .replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&');\n let newUrl = url;\n try {\n newUrl = decodeURI(url);\n } catch (_Oo) {\n // Sometime this breaks\n }\n return newUrl.replace(/\\\\/g, '/').replace(/webpack:\\/?/g, '') // Remove intermediate base path\n // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor\n .replace(new RegExp(`(file://)?/*${escapedBase}/*`, 'ig'), 'app:///');\n}\nexport { normalize, normalizeToSize, normalizeUrlToBase, visit as walk };\n","import { isThenable } from './is.js';\n\n/* eslint-disable @typescript-eslint/explicit-function-return-type */\n\n/** SyncPromise internal states */\nvar States;\n(function (States) {\n /** Pending */\n const PENDING = 0;\n States[States[\"PENDING\"] = PENDING] = \"PENDING\";\n /** Resolved / OK */\n const RESOLVED = 1;\n States[States[\"RESOLVED\"] = RESOLVED] = \"RESOLVED\";\n /** Rejected / Error */\n const REJECTED = 2;\n States[States[\"REJECTED\"] = REJECTED] = \"REJECTED\";\n})(States || (States = {}));\n\n// Overloads so we can call resolvedSyncPromise without arguments and generic argument\n\n/**\n * Creates a resolved sync promise.\n *\n * @param value the value to resolve the promise with\n * @returns the resolved sync promise\n */\nfunction resolvedSyncPromise(value) {\n return new SyncPromise(resolve => {\n resolve(value);\n });\n}\n\n/**\n * Creates a rejected sync promise.\n *\n * @param value the value to reject the promise with\n * @returns the rejected sync promise\n */\nfunction rejectedSyncPromise(reason) {\n return new SyncPromise((_, reject) => {\n reject(reason);\n });\n}\n\n/**\n * Thenable class that behaves like a Promise and follows it's interface\n * but is not async internally\n */\nclass SyncPromise {\n constructor(executor) {\n SyncPromise.prototype.__init.call(this);\n SyncPromise.prototype.__init2.call(this);\n SyncPromise.prototype.__init3.call(this);\n SyncPromise.prototype.__init4.call(this);\n this._state = States.PENDING;\n this._handlers = [];\n try {\n executor(this._resolve, this._reject);\n } catch (e) {\n this._reject(e);\n }\n }\n\n /** JSDoc */\n then(onfulfilled, onrejected) {\n return new SyncPromise((resolve, reject) => {\n this._handlers.push([false, result => {\n if (!onfulfilled) {\n // TODO: ¯\\_(ツ)_/¯\n // TODO: FIXME\n resolve(result);\n } else {\n try {\n resolve(onfulfilled(result));\n } catch (e) {\n reject(e);\n }\n }\n }, reason => {\n if (!onrejected) {\n reject(reason);\n } else {\n try {\n resolve(onrejected(reason));\n } catch (e) {\n reject(e);\n }\n }\n }]);\n this._executeHandlers();\n });\n }\n\n /** JSDoc */\n catch(onrejected) {\n return this.then(val => val, onrejected);\n }\n\n /** JSDoc */\n finally(onfinally) {\n return new SyncPromise((resolve, reject) => {\n let val;\n let isRejected;\n return this.then(value => {\n isRejected = false;\n val = value;\n if (onfinally) {\n onfinally();\n }\n }, reason => {\n isRejected = true;\n val = reason;\n if (onfinally) {\n onfinally();\n }\n }).then(() => {\n if (isRejected) {\n reject(val);\n return;\n }\n resolve(val);\n });\n });\n }\n\n /** JSDoc */\n __init() {\n this._resolve = value => {\n this._setResult(States.RESOLVED, value);\n };\n }\n\n /** JSDoc */\n __init2() {\n this._reject = reason => {\n this._setResult(States.REJECTED, reason);\n };\n }\n\n /** JSDoc */\n __init3() {\n this._setResult = (state, value) => {\n if (this._state !== States.PENDING) {\n return;\n }\n if (isThenable(value)) {\n void value.then(this._resolve, this._reject);\n return;\n }\n this._state = state;\n this._value = value;\n this._executeHandlers();\n };\n }\n\n /** JSDoc */\n __init4() {\n this._executeHandlers = () => {\n if (this._state === States.PENDING) {\n return;\n }\n const cachedHandlers = this._handlers.slice();\n this._handlers = [];\n cachedHandlers.forEach(handler => {\n if (handler[0]) {\n return;\n }\n if (this._state === States.RESOLVED) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n handler[1](this._value);\n }\n if (this._state === States.REJECTED) {\n handler[2](this._value);\n }\n handler[0] = true;\n });\n };\n }\n}\nexport { SyncPromise, rejectedSyncPromise, resolvedSyncPromise };\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 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];\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.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, () => remove(task).then(null, () => {\n // We have to add another catch here because `remove()` starts a new promise chain.\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 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 return {\n $: buffer,\n add,\n drain\n };\n}\nexport { makePromiseBuffer };\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 const match = url.match(/^(([^:/?#]+):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$/);\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 // eslint-disable-next-line no-useless-escape\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 description\n * see: https://develop.sentry.dev/sdk/data-handling/#structuring-data\n */\nfunction getSanitizedUrlString(url) {\n const {\n protocol,\n host,\n path\n } = url;\n const filteredHost = host && 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)$/, '').replace(/(:443)$/, '') || '';\n return `${protocol ? `${protocol}://` : ''}${filteredHost}${path}`;\n}\nexport { getNumberOfUrlSegments, getSanitizedUrlString, parseUrl, stripUrlQueryAndFragment };\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 member of the deprecated {@link Severity} enum.\n *\n * @deprecated `severityFromString` is deprecated. Please use `severityLevelFromString` instead.\n *\n * @param level String representation of Severity\n * @returns Severity\n */\nfunction severityFromString(level) {\n return severityLevelFromString(level);\n}\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}\nexport { severityFromString, severityLevelFromString, validSeverityLevels };\n","import { GLOBAL_OBJ } from './worldwide.js';\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 {\n performance\n } = 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 * Re-exported with an old name for backwards-compatibility.\n * TODO (v8): Remove this\n *\n * @deprecated Use `timestampInSeconds` instead.\n */\nconst timestampWithMs = timestampInSeconds;\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 {\n performance\n } = GLOBAL_OBJ;\n if (!performance || !performance.now) {\n _browserPerformanceTimeOriginMode = 'none';\n return undefined;\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 ? Math.abs(performance.timeOrigin + performanceNow - dateNow) : 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 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})();\nexport { _browserPerformanceTimeOriginMode, browserPerformanceTimeOrigin, dateTimestampInSeconds, timestampInSeconds, timestampWithMs };\n","import { dsnToString } from './dsn.js';\nimport { normalize } from './normalize.js';\nimport { dropUndefinedKeys } from './object.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(envelope, callback) {\n const envelopeItems = envelope[1];\n for (const envelopeItem of envelopeItems) {\n const envelopeItemType = envelopeItem[0].type;\n const result = callback(envelopeItem, envelopeItemType);\n if (result) {\n return true;\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.\n */\nfunction encodeUTF8(input, textEncoder) {\n const utf8 = textEncoder || new TextEncoder();\n return utf8.encode(input);\n}\n\n/**\n * Serializes an envelope.\n */\nfunction serializeEnvelope(envelope, textEncoder) {\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 function append(next) {\n if (typeof parts === 'string') {\n parts = typeof next === 'string' ? parts + next : [encodeUTF8(parts, textEncoder), next];\n } else {\n parts.push(typeof next === 'string' ? encodeUTF8(next, textEncoder) : next);\n }\n }\n for (const item of items) {\n const [itemHeaders, payload] = item;\n append(`\\n${JSON.stringify(itemHeaders)}\\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 return typeof parts === 'string' ? parts : concatBuffers(parts);\n}\nfunction concatBuffers(buffers) {\n const totalLength = buffers.reduce((acc, buf) => acc + buf.length, 0);\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 return merged;\n}\n\n/**\n * Parses an envelope\n */\nfunction parseEnvelope(env, textEncoder, textDecoder) {\n let buffer = typeof env === 'string' ? textEncoder.encode(env) : env;\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 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 return JSON.parse(textDecoder.decode(readBinary(i)));\n }\n const envelopeHeader = readJson();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const items = [];\n while (buffer.length) {\n const itemHeader = readJson();\n const binaryLength = typeof itemHeader.length === 'number' ? itemHeader.length : undefined;\n items.push([itemHeader, binaryLength ? readBinary(binaryLength) : readJson()]);\n }\n return [envelopeHeader, items];\n}\n\n/**\n * Creates attachment envelope items\n */\nfunction createAttachmentEnvelopeItem(attachment, textEncoder) {\n const buffer = typeof attachment.data === 'string' ? encodeUTF8(attachment.data, textEncoder) : attachment.data;\n return [dropUndefinedKeys({\n type: 'attachment',\n length: buffer.length,\n filename: attachment.filename,\n content_type: attachment.contentType,\n attachment_type: attachment.attachmentType\n }), buffer];\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 replay_event: 'replay',\n replay_recording: 'replay',\n check_in: 'monitor',\n feedback: 'feedback',\n // TODO: This is a temporary workaround until we have a proper data category for metrics\n statsd: 'unknown'\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 from the metadata or an events */\nfunction getSdkMetadataForEnvelopeHeader(metadataOrEvent) {\n if (!metadataOrEvent || !metadataOrEvent.sdk) {\n return;\n }\n const {\n name,\n version\n } = metadataOrEvent.sdk;\n return {\n name,\n version\n };\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(event, sdkInfo, tunnel, dsn) {\n const dynamicSamplingContext = event.sdkProcessingMetadata && event.sdkProcessingMetadata.dynamicSamplingContext;\n return {\n event_id: event.event_id,\n sent_at: new Date().toISOString(),\n ...(sdkInfo && {\n sdk: sdkInfo\n }),\n ...(!!tunnel && dsn && {\n dsn: dsnToString(dsn)\n }),\n ...(dynamicSamplingContext && {\n trace: dropUndefinedKeys({\n ...dynamicSamplingContext\n })\n })\n };\n}\nexport { addItemToEnvelope, createAttachmentEnvelopeItem, createEnvelope, createEventEnvelopeHeaders, envelopeContainsItemType, envelopeItemTypeToDataCategory, forEachEnvelopeItem, getSdkMetadataForEnvelopeHeader, parseEnvelope, serializeEnvelope };\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(discarded_events, dsn, timestamp) {\n const clientReportItem = [{\n type: 'client_report'\n }, {\n timestamp: timestamp || dateTimestampInSeconds(),\n discarded_events\n }];\n return createEnvelope(dsn ? {\n dsn\n } : {}, [clientReportItem]);\n}\nexport { createClientReportEnvelope };\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 const headerDate = Date.parse(`${header}`);\n if (!isNaN(headerDate)) {\n return headerDate - now;\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, category) {\n return limits[category] || limits.all || 0;\n}\n\n/**\n * Checks if a category is rate limited\n */\nfunction isRateLimited(limits, category, now = Date.now()) {\n return disabledUntil(limits, category) > now;\n}\n\n/**\n * Update ratelimits from incoming headers.\n *\n * @return the updated RateLimits object.\n */\nfunction updateRateLimits(limits, {\n statusCode,\n headers\n}, now = Date.now()) {\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 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 */\n for (const limit of rateLimitHeader.trim().split(',')) {\n const [retryAfter, categories] = limit.split(':', 2);\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 updatedRateLimits[category] = now + delay;\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 return updatedRateLimits;\n}\nexport { DEFAULT_RETRY_AFTER, disabledUntil, isRateLimited, parseRetryAfterHeader, updateRateLimits };\n","import { isError, isPlainObject, isParameterizedString } from './is.js';\nimport { addExceptionTypeValue, addExceptionMechanism } from './misc.js';\nimport { normalizeToSize } from './normalize.js';\nimport { extractExceptionKeysForMessage } from './object.js';\n\n/**\n * Extracts stack frames from the error.stack string\n */\nfunction parseStackFrames(stackParser, error) {\n return stackParser(error.stack || '', 1);\n}\n\n/**\n * Extracts stack frames from the error and builds a Sentry Exception\n */\nfunction exceptionFromError(stackParser, error) {\n const exception = {\n type: error.name || error.constructor.name,\n value: error.message\n };\n const frames = parseStackFrames(stackParser, error);\n if (frames.length) {\n exception.stacktrace = {\n frames\n };\n }\n return exception;\n}\nfunction getMessageForObject(exception) {\n if ('name' in exception && typeof exception.name === 'string') {\n let message = `'${exception.name}' captured as exception`;\n if ('message' in exception && typeof exception.message === 'string') {\n message += ` with message '${exception.message}'`;\n }\n return message;\n } else if ('message' in exception && typeof exception.message === 'string') {\n return exception.message;\n } else {\n // This will allow us to group events based on top-level keys\n // which is much better than creating new group when any key/value change\n return `Object captured as exception with keys: ${extractExceptionKeysForMessage(exception)}`;\n }\n}\n\n/**\n * Builds and Event from a Exception\n *\n * TODO(v8): Remove getHub fallback\n * @hidden\n */\nfunction eventFromUnknownInput(getHubOrClient, stackParser, exception, hint) {\n const client = typeof getHubOrClient === 'function' ?\n // eslint-disable-next-line deprecation/deprecation\n getHubOrClient().getClient() : getHubOrClient;\n let ex = exception;\n const providedMechanism = hint && hint.data && hint.data.mechanism;\n const mechanism = providedMechanism || {\n handled: true,\n type: 'generic'\n };\n let extras;\n if (!isError(exception)) {\n if (isPlainObject(exception)) {\n const normalizeDepth = client && client.getOptions().normalizeDepth;\n extras = {\n ['__serialized__']: normalizeToSize(exception, normalizeDepth)\n };\n const message = getMessageForObject(exception);\n ex = hint && hint.syntheticException || new Error(message);\n ex.message = message;\n } else {\n // This handles when someone does: `throw \"something awesome\";`\n // We use synthesized Error here so we can extract a (rough) stack trace.\n ex = hint && hint.syntheticException || new Error(exception);\n ex.message = exception;\n }\n mechanism.synthetic = true;\n }\n const event = {\n exception: {\n values: [exceptionFromError(stackParser, ex)]\n }\n };\n if (extras) {\n event.extra = extras;\n }\n addExceptionTypeValue(event, undefined, undefined);\n addExceptionMechanism(event, mechanism);\n return {\n ...event,\n event_id: hint && hint.event_id\n };\n}\n\n/**\n * Builds and Event from a Message\n * @hidden\n */\nfunction eventFromMessage(stackParser, message,\n// eslint-disable-next-line deprecation/deprecation\nlevel = 'info', hint, attachStacktrace) {\n const event = {\n event_id: hint && hint.event_id,\n level\n };\n if (attachStacktrace && hint && hint.syntheticException) {\n const frames = parseStackFrames(stackParser, hint.syntheticException);\n if (frames.length) {\n event.exception = {\n values: [{\n value: message,\n stacktrace: {\n frames\n }\n }]\n };\n }\n }\n if (isParameterizedString(message)) {\n const {\n __sentry_template_string__,\n __sentry_template_values__\n } = message;\n event.logentry = {\n message: __sentry_template_string__,\n params: __sentry_template_values__\n };\n return event;\n }\n event.message = message;\n return event;\n}\nexport { eventFromMessage, eventFromUnknownInput, exceptionFromError, parseStackFrames };\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__;\nexport { DEBUG_BUILD };\n","const DEFAULT_ENVIRONMENT = 'production';\nexport { DEFAULT_ENVIRONMENT };\n","import { SyncPromise, logger, isThenable, getGlobalSingleton } from '@sentry/utils';\nimport { DEBUG_BUILD } from './debug-build.js';\n\n/**\n * Returns the global event processors.\n * @deprecated Global event processors will be removed in v8.\n */\nfunction getGlobalEventProcessors() {\n return getGlobalSingleton('globalEventProcessors', () => []);\n}\n\n/**\n * Add a EventProcessor to be kept globally.\n * @deprecated Use `addEventProcessor` instead. Global event processors will be removed in v8.\n */\nfunction addGlobalEventProcessor(callback) {\n // eslint-disable-next-line deprecation/deprecation\n getGlobalEventProcessors().push(callback);\n}\n\n/**\n * Process an array of event processors, returning the processed event (or `null` if the event was dropped).\n */\nfunction notifyEventProcessors(processors, event, hint, index = 0) {\n return new SyncPromise((resolve, reject) => {\n const processor = processors[index];\n if (event === null || typeof processor !== 'function') {\n resolve(event);\n } else {\n const result = processor({\n ...event\n }, hint);\n DEBUG_BUILD && processor.id && result === null && logger.log(`Event processor \"${processor.id}\" dropped event`);\n if (isThenable(result)) {\n void result.then(final => notifyEventProcessors(processors, final, hint, index + 1).then(resolve)).then(null, reject);\n } else {\n void notifyEventProcessors(processors, result, hint, index + 1).then(resolve).then(null, reject);\n }\n }\n });\n}\nexport { addGlobalEventProcessor, getGlobalEventProcessors, notifyEventProcessors };\n","import { timestampInSeconds, uuid4, dropUndefinedKeys } from '@sentry/utils';\n\n/**\n * Creates a new `Session` object by setting certain default parameters. If optional @param context\n * is passed, the passed properties are applied to the session object.\n *\n * @param context (optional) additional properties to be applied to the returned session object\n *\n * @returns a new `Session` object\n */\nfunction makeSession(context) {\n // Both timestamp and started are in seconds since the UNIX epoch.\n const startingTime = timestampInSeconds();\n const session = {\n sid: uuid4(),\n init: true,\n timestamp: startingTime,\n started: startingTime,\n duration: 0,\n status: 'ok',\n errors: 0,\n ignoreDuration: false,\n toJSON: () => sessionToJSON(session)\n };\n if (context) {\n updateSession(session, context);\n }\n return session;\n}\n\n/**\n * Updates a session object with the properties passed in the context.\n *\n * Note that this function mutates the passed object and returns void.\n * (Had to do this instead of returning a new and updated session because closing and sending a session\n * makes an update to the session after it was passed to the sending logic.\n * @see BaseClient.captureSession )\n *\n * @param session the `Session` to update\n * @param context the `SessionContext` holding the properties that should be updated in @param session\n */\n// eslint-disable-next-line complexity\nfunction updateSession(session, context = {}) {\n if (context.user) {\n if (!session.ipAddress && context.user.ip_address) {\n session.ipAddress = context.user.ip_address;\n }\n if (!session.did && !context.did) {\n session.did = context.user.id || context.user.email || context.user.username;\n }\n }\n session.timestamp = context.timestamp || timestampInSeconds();\n if (context.abnormal_mechanism) {\n session.abnormal_mechanism = context.abnormal_mechanism;\n }\n if (context.ignoreDuration) {\n session.ignoreDuration = context.ignoreDuration;\n }\n if (context.sid) {\n // Good enough uuid validation. — Kamil\n session.sid = context.sid.length === 32 ? context.sid : uuid4();\n }\n if (context.init !== undefined) {\n session.init = context.init;\n }\n if (!session.did && context.did) {\n session.did = `${context.did}`;\n }\n if (typeof context.started === 'number') {\n session.started = context.started;\n }\n if (session.ignoreDuration) {\n session.duration = undefined;\n } else if (typeof context.duration === 'number') {\n session.duration = context.duration;\n } else {\n const duration = session.timestamp - session.started;\n session.duration = duration >= 0 ? duration : 0;\n }\n if (context.release) {\n session.release = context.release;\n }\n if (context.environment) {\n session.environment = context.environment;\n }\n if (!session.ipAddress && context.ipAddress) {\n session.ipAddress = context.ipAddress;\n }\n if (!session.userAgent && context.userAgent) {\n session.userAgent = context.userAgent;\n }\n if (typeof context.errors === 'number') {\n session.errors = context.errors;\n }\n if (context.status) {\n session.status = context.status;\n }\n}\n\n/**\n * Closes a session by setting its status and updating the session object with it.\n * Internally calls `updateSession` to update the passed session object.\n *\n * Note that this function mutates the passed session (@see updateSession for explanation).\n *\n * @param session the `Session` object to be closed\n * @param status the `SessionStatus` with which the session was closed. If you don't pass a status,\n * this function will keep the previously set status, unless it was `'ok'` in which case\n * it is changed to `'exited'`.\n */\nfunction closeSession(session, status) {\n let context = {};\n if (status) {\n context = {\n status\n };\n } else if (session.status === 'ok') {\n context = {\n status: 'exited'\n };\n }\n updateSession(session, context);\n}\n\n/**\n * Serializes a passed session object to a JSON object with a slightly different structure.\n * This is necessary because the Sentry backend requires a slightly different schema of a session\n * than the one the JS SDKs use internally.\n *\n * @param session the session to be converted\n *\n * @returns a JSON object of the passed session\n */\nfunction sessionToJSON(session) {\n return dropUndefinedKeys({\n sid: `${session.sid}`,\n init: session.init,\n // Make sure that sec is converted to ms for date constructor\n started: new Date(session.started * 1000).toISOString(),\n timestamp: new Date(session.timestamp * 1000).toISOString(),\n status: session.status,\n errors: session.errors,\n did: typeof session.did === 'number' || typeof session.did === 'string' ? `${session.did}` : undefined,\n duration: session.duration,\n abnormal_mechanism: session.abnormal_mechanism,\n attrs: {\n release: session.release,\n environment: session.environment,\n ip_address: session.ipAddress,\n user_agent: session.userAgent\n }\n });\n}\nexport { closeSession, makeSession, updateSession };\n","import { generateSentryTraceHeader, dropUndefinedKeys, timestampInSeconds } from '@sentry/utils';\n\n// These are aligned with OpenTelemetry trace flags\nconst TRACE_FLAG_NONE = 0x0;\nconst TRACE_FLAG_SAMPLED = 0x1;\n\n/**\n * Convert a span to a trace context, which can be sent as the `trace` context in an event.\n */\nfunction spanToTraceContext(span) {\n const {\n spanId: span_id,\n traceId: trace_id\n } = span.spanContext();\n const {\n data,\n op,\n parent_span_id,\n status,\n tags,\n origin\n } = spanToJSON(span);\n return dropUndefinedKeys({\n data,\n op,\n parent_span_id,\n span_id,\n status,\n tags,\n trace_id,\n origin\n });\n}\n\n/**\n * Convert a Span to a Sentry trace header.\n */\nfunction spanToTraceHeader(span) {\n const {\n traceId,\n spanId\n } = span.spanContext();\n const sampled = spanIsSampled(span);\n return generateSentryTraceHeader(traceId, spanId, sampled);\n}\n\n/**\n * Convert a span time input intp a timestamp in seconds.\n */\nfunction spanTimeInputToSeconds(input) {\n if (typeof input === 'number') {\n return ensureTimestampInSeconds(input);\n }\n if (Array.isArray(input)) {\n // See {@link HrTime} for the array-based time format\n return input[0] + input[1] / 1e9;\n }\n if (input instanceof Date) {\n return ensureTimestampInSeconds(input.getTime());\n }\n return timestampInSeconds();\n}\n\n/**\n * Converts a timestamp to second, if it was in milliseconds, or keeps it as second.\n */\nfunction ensureTimestampInSeconds(timestamp) {\n const isMs = timestamp > 9999999999;\n return isMs ? timestamp / 1000 : timestamp;\n}\n\n/**\n * Convert a span to a JSON representation.\n * Note that all fields returned here are optional and need to be guarded against.\n *\n * Note: Because of this, we currently have a circular type dependency (which we opted out of in package.json).\n * This is not avoidable as we need `spanToJSON` in `spanUtils.ts`, which in turn is needed by `span.ts` for backwards compatibility.\n * And `spanToJSON` needs the Span class from `span.ts` to check here.\n * TODO v8: When we remove the deprecated stuff from `span.ts`, we can remove the circular dependency again.\n */\nfunction spanToJSON(span) {\n if (spanIsSpanClass(span)) {\n return span.getSpanJSON();\n }\n\n // Fallback: We also check for `.toJSON()` here...\n // eslint-disable-next-line deprecation/deprecation\n if (typeof span.toJSON === 'function') {\n // eslint-disable-next-line deprecation/deprecation\n return span.toJSON();\n }\n return {};\n}\n\n/**\n * Sadly, due to circular dependency checks we cannot actually import the Span class here and check for instanceof.\n * :( So instead we approximate this by checking if it has the `getSpanJSON` method.\n */\nfunction spanIsSpanClass(span) {\n return typeof span.getSpanJSON === 'function';\n}\n\n/**\n * Returns true if a span is sampled.\n * In most cases, you should just use `span.isRecording()` instead.\n * However, this has a slightly different semantic, as it also returns false if the span is finished.\n * So in the case where this distinction is important, use this method.\n */\nfunction spanIsSampled(span) {\n // We align our trace flags with the ones OpenTelemetry use\n // So we also check for sampled the same way they do.\n const {\n traceFlags\n } = span.spanContext();\n // eslint-disable-next-line no-bitwise\n return Boolean(traceFlags & TRACE_FLAG_SAMPLED);\n}\nexport { TRACE_FLAG_NONE, TRACE_FLAG_SAMPLED, spanIsSampled, spanTimeInputToSeconds, spanToJSON, spanToTraceContext, spanToTraceHeader };\n","import { uuid4, dateTimestampInSeconds, addExceptionMechanism, truncate, GLOBAL_OBJ, normalize } from '@sentry/utils';\nimport { DEFAULT_ENVIRONMENT } from '../constants.js';\nimport { getGlobalEventProcessors, notifyEventProcessors } from '../eventProcessors.js';\nimport { getGlobalScope, Scope } from '../scope.js';\nimport { mergeScopeData, applyScopeDataToEvent } from './applyScopeDataToEvent.js';\nimport { spanToJSON } from './spanUtils.js';\n\n/**\n * This type makes sure that we get either a CaptureContext, OR an EventHint.\n * It does not allow mixing them, which could lead to unexpected outcomes, e.g. this is disallowed:\n * { user: { id: '123' }, mechanism: { handled: false } }\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 * Note: This also triggers callbacks for `addGlobalEventProcessor`, but not `beforeSend`.\n *\n * @param event The original event.\n * @param hint May contain additional information about the original exception.\n * @param scope A scope containing event metadata.\n * @returns A new event with more information.\n * @hidden\n */\nfunction prepareEvent(options, event, hint, scope, client, isolationScope) {\n const {\n normalizeDepth = 3,\n normalizeMaxBreadth = 1000\n } = options;\n const prepared = {\n ...event,\n event_id: event.event_id || hint.event_id || uuid4(),\n timestamp: event.timestamp || dateTimestampInSeconds()\n };\n const integrations = hint.integrations || options.integrations.map(i => i.name);\n applyClientOptions(prepared, options);\n applyIntegrationsMetadata(prepared, integrations);\n\n // Only put debug IDs onto frames for error events.\n if (event.type === undefined) {\n applyDebugIds(prepared, options.stackParser);\n }\n\n // If we have scope given to us, use it as the base for further modifications.\n // This allows us to prevent unnecessary copying of data if `captureContext` is not provided.\n const finalScope = getFinalScope(scope, hint.captureContext);\n if (hint.mechanism) {\n addExceptionMechanism(prepared, hint.mechanism);\n }\n const clientEventProcessors = client && client.getEventProcessors ? client.getEventProcessors() : [];\n\n // This should be the last thing called, since we want that\n // {@link Hub.addEventProcessor} gets the finished prepared event.\n // Merge scope data together\n const data = getGlobalScope().getScopeData();\n if (isolationScope) {\n const isolationData = isolationScope.getScopeData();\n mergeScopeData(data, isolationData);\n }\n if (finalScope) {\n const finalScopeData = finalScope.getScopeData();\n mergeScopeData(data, finalScopeData);\n }\n const attachments = [...(hint.attachments || []), ...data.attachments];\n if (attachments.length) {\n hint.attachments = attachments;\n }\n applyScopeDataToEvent(prepared, data);\n\n // TODO (v8): Update this order to be: Global > Client > Scope\n const eventProcessors = [...clientEventProcessors,\n // eslint-disable-next-line deprecation/deprecation\n ...getGlobalEventProcessors(),\n // Run scope event processors _after_ all other processors\n ...data.eventProcessors];\n const result = notifyEventProcessors(eventProcessors, prepared, hint);\n return result.then(evt => {\n if (evt) {\n // We apply the debug_meta field only after all event processors have ran, so that if any event processors modified\n // file names (e.g.the RewriteFrames integration) the filename -> debug ID relationship isn't destroyed.\n // This should not cause any PII issues, since we're only moving data that is already on the event and not adding\n // any new data\n applyDebugMeta(evt);\n }\n if (typeof normalizeDepth === 'number' && normalizeDepth > 0) {\n return normalizeEvent(evt, normalizeDepth, normalizeMaxBreadth);\n }\n return evt;\n });\n}\n\n/**\n * Enhances event using the client configuration.\n * It takes care of all \"static\" values like environment, release and `dist`,\n * as well as truncating overly long values.\n * @param event event instance to be enhanced\n */\nfunction applyClientOptions(event, options) {\n const {\n environment,\n release,\n dist,\n maxValueLength = 250\n } = options;\n if (!('environment' in event)) {\n event.environment = 'environment' in options ? environment : DEFAULT_ENVIRONMENT;\n }\n if (event.release === undefined && release !== undefined) {\n event.release = release;\n }\n if (event.dist === undefined && dist !== undefined) {\n event.dist = dist;\n }\n if (event.message) {\n event.message = truncate(event.message, maxValueLength);\n }\n const exception = event.exception && event.exception.values && event.exception.values[0];\n if (exception && exception.value) {\n exception.value = truncate(exception.value, maxValueLength);\n }\n const request = event.request;\n if (request && request.url) {\n request.url = truncate(request.url, maxValueLength);\n }\n}\nconst debugIdStackParserCache = new WeakMap();\n\n/**\n * Puts debug IDs into the stack frames of an error event.\n */\nfunction applyDebugIds(event, stackParser) {\n const debugIdMap = GLOBAL_OBJ._sentryDebugIds;\n if (!debugIdMap) {\n return;\n }\n let debugIdStackFramesCache;\n const cachedDebugIdStackFrameCache = debugIdStackParserCache.get(stackParser);\n if (cachedDebugIdStackFrameCache) {\n debugIdStackFramesCache = cachedDebugIdStackFrameCache;\n } else {\n debugIdStackFramesCache = new Map();\n debugIdStackParserCache.set(stackParser, debugIdStackFramesCache);\n }\n\n // Build a map of filename -> debug_id\n const filenameDebugIdMap = Object.keys(debugIdMap).reduce((acc, debugIdStackTrace) => {\n let parsedStack;\n const cachedParsedStack = debugIdStackFramesCache.get(debugIdStackTrace);\n if (cachedParsedStack) {\n parsedStack = cachedParsedStack;\n } else {\n parsedStack = stackParser(debugIdStackTrace);\n debugIdStackFramesCache.set(debugIdStackTrace, parsedStack);\n }\n for (let i = parsedStack.length - 1; i >= 0; i--) {\n const stackFrame = parsedStack[i];\n if (stackFrame.filename) {\n acc[stackFrame.filename] = debugIdMap[debugIdStackTrace];\n break;\n }\n }\n return acc;\n }, {});\n try {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n event.exception.values.forEach(exception => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n exception.stacktrace.frames.forEach(frame => {\n if (frame.filename) {\n frame.debug_id = filenameDebugIdMap[frame.filename];\n }\n });\n });\n } catch (e) {\n // To save bundle size we're just try catching here instead of checking for the existence of all the different objects.\n }\n}\n\n/**\n * Moves debug IDs from the stack frames of an error event into the debug_meta field.\n */\nfunction applyDebugMeta(event) {\n // Extract debug IDs and filenames from the stack frames on the event.\n const filenameDebugIdMap = {};\n try {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n event.exception.values.forEach(exception => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n exception.stacktrace.frames.forEach(frame => {\n if (frame.debug_id) {\n if (frame.abs_path) {\n filenameDebugIdMap[frame.abs_path] = frame.debug_id;\n } else if (frame.filename) {\n filenameDebugIdMap[frame.filename] = frame.debug_id;\n }\n delete frame.debug_id;\n }\n });\n });\n } catch (e) {\n // To save bundle size we're just try catching here instead of checking for the existence of all the different objects.\n }\n if (Object.keys(filenameDebugIdMap).length === 0) {\n return;\n }\n\n // Fill debug_meta information\n event.debug_meta = event.debug_meta || {};\n event.debug_meta.images = event.debug_meta.images || [];\n const images = event.debug_meta.images;\n Object.keys(filenameDebugIdMap).forEach(filename => {\n images.push({\n type: 'sourcemap',\n code_file: filename,\n debug_id: filenameDebugIdMap[filename]\n });\n });\n}\n\n/**\n * This function adds all used integrations to the SDK info in the event.\n * @param event The event that will be filled with all integrations.\n */\nfunction applyIntegrationsMetadata(event, integrationNames) {\n if (integrationNames.length > 0) {\n event.sdk = event.sdk || {};\n event.sdk.integrations = [...(event.sdk.integrations || []), ...integrationNames];\n }\n}\n\n/**\n * Applies `normalize` function on necessary `Event` attributes to make them safe for serialization.\n * Normalized keys:\n * - `breadcrumbs.data`\n * - `user`\n * - `contexts`\n * - `extra`\n * @param event Event\n * @returns Normalized event\n */\nfunction normalizeEvent(event, depth, maxBreadth) {\n if (!event) {\n return null;\n }\n const normalized = {\n ...event,\n ...(event.breadcrumbs && {\n breadcrumbs: event.breadcrumbs.map(b => ({\n ...b,\n ...(b.data && {\n data: normalize(b.data, depth, maxBreadth)\n })\n }))\n }),\n ...(event.user && {\n user: normalize(event.user, depth, maxBreadth)\n }),\n ...(event.contexts && {\n contexts: normalize(event.contexts, depth, maxBreadth)\n }),\n ...(event.extra && {\n extra: normalize(event.extra, depth, maxBreadth)\n })\n };\n\n // event.contexts.trace stores information about a Transaction. Similarly,\n // event.spans[] stores information about child Spans. Given that a\n // Transaction is conceptually a Span, normalization should apply to both\n // Transactions and Spans consistently.\n // For now the decision is to skip normalization of Transactions and Spans,\n // so this block overwrites the normalized event to add back the original\n // Transaction information prior to normalization.\n if (event.contexts && event.contexts.trace && normalized.contexts) {\n normalized.contexts.trace = event.contexts.trace;\n\n // event.contexts.trace.data may contain circular/dangerous data so we need to normalize it\n if (event.contexts.trace.data) {\n normalized.contexts.trace.data = normalize(event.contexts.trace.data, depth, maxBreadth);\n }\n }\n\n // event.spans[].data may contain circular/dangerous data so we need to normalize it\n if (event.spans) {\n normalized.spans = event.spans.map(span => {\n const data = spanToJSON(span).data;\n if (data) {\n // This is a bit weird, as we generally have `Span` instances here, but to be safe we do not assume so\n // eslint-disable-next-line deprecation/deprecation\n span.data = normalize(data, depth, maxBreadth);\n }\n return span;\n });\n }\n return normalized;\n}\nfunction getFinalScope(scope, captureContext) {\n if (!captureContext) {\n return scope;\n }\n const finalScope = scope ? scope.clone() : new Scope();\n finalScope.update(captureContext);\n return finalScope;\n}\n\n/**\n * Parse either an `EventHint` directly, or convert a `CaptureContext` to an `EventHint`.\n * This is used to allow to update method signatures that used to accept a `CaptureContext` but should now accept an `EventHint`.\n */\nfunction parseEventHintOrCaptureContext(hint) {\n if (!hint) {\n return undefined;\n }\n\n // If you pass a Scope or `() => Scope` as CaptureContext, we just return this as captureContext\n if (hintIsScopeOrFunction(hint)) {\n return {\n captureContext: hint\n };\n }\n if (hintIsScopeContext(hint)) {\n return {\n captureContext: hint\n };\n }\n return hint;\n}\nfunction hintIsScopeOrFunction(hint) {\n return hint instanceof Scope || typeof hint === 'function';\n}\nconst captureContextKeys = ['user', 'level', 'extra', 'contexts', 'tags', 'fingerprint', 'requestSession', 'propagationContext'];\nfunction hintIsScopeContext(hint) {\n return Object.keys(hint).some(key => captureContextKeys.includes(key));\n}\nexport { applyDebugIds, applyDebugMeta, parseEventHintOrCaptureContext, prepareEvent };\n","import { logger, uuid4, timestampInSeconds, isThenable, GLOBAL_OBJ } from '@sentry/utils';\nimport { DEFAULT_ENVIRONMENT } from './constants.js';\nimport { DEBUG_BUILD } from './debug-build.js';\nimport { getCurrentHub, runWithAsyncContext, getIsolationScope } from './hub.js';\nimport { makeSession, updateSession, closeSession } from './session.js';\nimport { parseEventHintOrCaptureContext } from './utils/prepareEvent.js';\n\n/**\n * Captures an exception event and sends it to Sentry.\n *\n * @param exception The exception to capture.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured Sentry event.\n */\nfunction captureException(\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexception, hint) {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().captureException(exception, parseEventHintOrCaptureContext(hint));\n}\n\n/**\n * Captures a message event and sends it to Sentry.\n *\n * @param exception The exception to capture.\n * @param captureContext Define the level of the message or pass in additional data to attach to the message.\n * @returns the id of the captured message.\n */\nfunction captureMessage(message,\n// eslint-disable-next-line deprecation/deprecation\ncaptureContext) {\n // This is necessary to provide explicit scopes upgrade, without changing the original\n // arity of the `captureMessage(message, level)` method.\n const level = typeof captureContext === 'string' ? captureContext : undefined;\n const context = typeof captureContext !== 'string' ? {\n captureContext\n } : undefined;\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().captureMessage(message, level, context);\n}\n\n/**\n * Captures a manually created event and sends it to Sentry.\n *\n * @param exception The event to send to Sentry.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured event.\n */\nfunction captureEvent(event, hint) {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().captureEvent(event, hint);\n}\n\n/**\n * Callback to set context information onto the scope.\n * @param callback Callback function that receives Scope.\n *\n * @deprecated Use getCurrentScope() directly.\n */\nfunction configureScope(callback) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().configureScope(callback);\n}\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 *\n * @param breadcrumb The breadcrumb to record.\n */\nfunction addBreadcrumb(breadcrumb, hint) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().addBreadcrumb(breadcrumb, hint);\n}\n\n/**\n * Sets context data with the given name.\n * @param name of the context\n * @param context Any kind of data. This data will be normalized.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction setContext(name, context) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().setContext(name, context);\n}\n\n/**\n * Set an object that will be merged sent as extra data with the event.\n * @param extras Extras object to merge into current context.\n */\nfunction setExtras(extras) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().setExtras(extras);\n}\n\n/**\n * Set key:value that will be sent as extra data with the event.\n * @param key String of extra\n * @param extra Any kind of data. This data will be normalized.\n */\nfunction setExtra(key, extra) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().setExtra(key, extra);\n}\n\n/**\n * Set an object that will be merged sent as tags data with the event.\n * @param tags Tags context object to merge into current context.\n */\nfunction setTags(tags) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().setTags(tags);\n}\n\n/**\n * Set key:value that will be sent as tags data with the event.\n *\n * Can also be used to unset a tag, by passing `undefined`.\n *\n * @param key String key of tag\n * @param value Value of tag\n */\nfunction setTag(key, value) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().setTag(key, value);\n}\n\n/**\n * Updates user context information for future events.\n *\n * @param user User context object to be set in the current context. Pass `null` to unset the user.\n */\nfunction setUser(user) {\n // eslint-disable-next-line deprecation/deprecation\n getCurrentHub().setUser(user);\n}\n\n/**\n * Creates a new scope with and executes the given operation within.\n * The scope is automatically removed once the operation\n * finishes or throws.\n *\n * This is essentially a convenience function for:\n *\n * pushScope();\n * callback();\n * popScope();\n */\n\n/**\n * Either creates a new active scope, or sets the given scope as active scope in the given callback.\n */\nfunction withScope(...rest) {\n // eslint-disable-next-line deprecation/deprecation\n const hub = getCurrentHub();\n\n // If a scope is defined, we want to make this the active scope instead of the default one\n if (rest.length === 2) {\n const [scope, callback] = rest;\n if (!scope) {\n // eslint-disable-next-line deprecation/deprecation\n return hub.withScope(callback);\n }\n\n // eslint-disable-next-line deprecation/deprecation\n return hub.withScope(() => {\n // eslint-disable-next-line deprecation/deprecation\n hub.getStackTop().scope = scope;\n return callback(scope);\n });\n }\n\n // eslint-disable-next-line deprecation/deprecation\n return hub.withScope(rest[0]);\n}\n\n/**\n * Attempts to fork the current isolation scope and the current scope based on the current async context strategy. If no\n * async context strategy is set, the isolation scope and the current scope will not be forked (this is currently the\n * case, for example, in the browser).\n *\n * Usage of this function in environments without async context strategy is discouraged and may lead to unexpected behaviour.\n *\n * This function is intended for Sentry SDK and SDK integration development. It is not recommended to be used in \"normal\"\n * applications directly because it comes with pitfalls. Use at your own risk!\n *\n * @param callback The callback in which the passed isolation scope is active. (Note: In environments without async\n * context strategy, the currently active isolation scope may change within execution of the callback.)\n * @returns The same value that `callback` returns.\n */\nfunction withIsolationScope(callback) {\n return runWithAsyncContext(() => {\n return callback(getIsolationScope());\n });\n}\n\n/**\n * Forks the current scope and sets the provided span as active span in the context of the provided callback.\n *\n * @param span Spans started in the context of the provided callback will be children of this span.\n * @param callback Execution context in which the provided span will be active. Is passed the newly forked scope.\n * @returns the value returned from the provided callback function.\n */\nfunction withActiveSpan(span, callback) {\n return withScope(scope => {\n // eslint-disable-next-line deprecation/deprecation\n scope.setSpan(span);\n return callback(scope);\n });\n}\n\n/**\n * Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation.\n *\n * A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a\n * new child span within the transaction or any span, call the respective `.startChild()` method.\n *\n * Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded.\n *\n * The transaction must be finished with a call to its `.end()` method, at which point the transaction with all its\n * finished child spans will be sent to Sentry.\n *\n * NOTE: This function should only be used for *manual* instrumentation. Auto-instrumentation should call\n * `startTransaction` directly on the hub.\n *\n * @param context Properties of the new `Transaction`.\n * @param customSamplingContext Information given to the transaction sampling function (along with context-dependent\n * default values). See {@link Options.tracesSampler}.\n *\n * @returns The transaction which was just started\n *\n * @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.\n */\nfunction startTransaction(context, customSamplingContext) {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().startTransaction({\n ...context\n }, customSamplingContext);\n}\n\n/**\n * Create a cron monitor check in and send it to Sentry.\n *\n * @param checkIn An object that describes a check in.\n * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want\n * to create a monitor automatically when sending a check in.\n */\nfunction captureCheckIn(checkIn, upsertMonitorConfig) {\n const scope = getCurrentScope();\n const client = getClient();\n if (!client) {\n DEBUG_BUILD && logger.warn('Cannot capture check-in. No client defined.');\n } else if (!client.captureCheckIn) {\n DEBUG_BUILD && logger.warn('Cannot capture check-in. Client does not support sending check-ins.');\n } else {\n return client.captureCheckIn(checkIn, upsertMonitorConfig, scope);\n }\n return uuid4();\n}\n\n/**\n * Wraps a callback with a cron monitor check in. The check in will be sent to Sentry when the callback finishes.\n *\n * @param monitorSlug The distinct slug of the monitor.\n * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want\n * to create a monitor automatically when sending a check in.\n */\nfunction withMonitor(monitorSlug, callback, upsertMonitorConfig) {\n const checkInId = captureCheckIn({\n monitorSlug,\n status: 'in_progress'\n }, upsertMonitorConfig);\n const now = timestampInSeconds();\n function finishCheckIn(status) {\n captureCheckIn({\n monitorSlug,\n status,\n checkInId,\n duration: timestampInSeconds() - now\n });\n }\n let maybePromiseResult;\n try {\n maybePromiseResult = callback();\n } catch (e) {\n finishCheckIn('error');\n throw e;\n }\n if (isThenable(maybePromiseResult)) {\n Promise.resolve(maybePromiseResult).then(() => {\n finishCheckIn('ok');\n }, () => {\n finishCheckIn('error');\n });\n } else {\n finishCheckIn('ok');\n }\n return maybePromiseResult;\n}\n\n/**\n * Call `flush()` on the current client, if there is one. See {@link Client.flush}.\n *\n * @param timeout Maximum time in ms the client should wait to flush its event queue. Omitting this parameter will cause\n * the client to wait until all events are sent before resolving the promise.\n * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it\n * doesn't (or if there's no client defined).\n */\nasync function flush(timeout) {\n const client = getClient();\n if (client) {\n return client.flush(timeout);\n }\n DEBUG_BUILD && logger.warn('Cannot flush events. No client defined.');\n return Promise.resolve(false);\n}\n\n/**\n * Call `close()` on the current client, if there is one. See {@link Client.close}.\n *\n * @param timeout Maximum time in ms the client should wait to flush its event queue before shutting down. Omitting this\n * parameter will cause the client to wait until all events are sent before disabling itself.\n * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it\n * doesn't (or if there's no client defined).\n */\nasync function close(timeout) {\n const client = getClient();\n if (client) {\n return client.close(timeout);\n }\n DEBUG_BUILD && logger.warn('Cannot flush events and disable SDK. No client defined.');\n return Promise.resolve(false);\n}\n\n/**\n * This is the getter for lastEventId.\n *\n * @returns The last event id of a captured event.\n * @deprecated This function will be removed in the next major version of the Sentry SDK.\n */\nfunction lastEventId() {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().lastEventId();\n}\n\n/**\n * Get the currently active client.\n */\nfunction getClient() {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().getClient();\n}\n\n/**\n * Get the currently active scope.\n */\nfunction getCurrentScope() {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().getScope();\n}\n\n/**\n * Start a session on the current isolation scope.\n *\n * @param context (optional) additional properties to be applied to the returned session object\n *\n * @returns the new active session\n */\nfunction startSession(context) {\n const client = getClient();\n const isolationScope = getIsolationScope();\n const currentScope = getCurrentScope();\n const {\n release,\n environment = DEFAULT_ENVIRONMENT\n } = client && client.getOptions() || {};\n\n // Will fetch userAgent if called from browser sdk\n const {\n userAgent\n } = GLOBAL_OBJ.navigator || {};\n const session = makeSession({\n release,\n environment,\n user: currentScope.getUser() || isolationScope.getUser(),\n ...(userAgent && {\n userAgent\n }),\n ...context\n });\n\n // End existing session if there's one\n const currentSession = isolationScope.getSession();\n if (currentSession && currentSession.status === 'ok') {\n updateSession(currentSession, {\n status: 'exited'\n });\n }\n endSession();\n\n // Afterwards we set the new session on the scope\n isolationScope.setSession(session);\n\n // TODO (v8): Remove this and only use the isolation scope(?).\n // For v7 though, we can't \"soft-break\" people using getCurrentHub().getScope().setSession()\n currentScope.setSession(session);\n return session;\n}\n\n/**\n * End the session on the current isolation scope.\n */\nfunction endSession() {\n const isolationScope = getIsolationScope();\n const currentScope = getCurrentScope();\n const session = currentScope.getSession() || isolationScope.getSession();\n if (session) {\n closeSession(session);\n }\n _sendSessionUpdate();\n\n // the session is over; take it off of the scope\n isolationScope.setSession();\n\n // TODO (v8): Remove this and only use the isolation scope(?).\n // For v7 though, we can't \"soft-break\" people using getCurrentHub().getScope().setSession()\n currentScope.setSession();\n}\n\n/**\n * Sends the current Session on the scope\n */\nfunction _sendSessionUpdate() {\n const isolationScope = getIsolationScope();\n const currentScope = getCurrentScope();\n const client = getClient();\n // TODO (v8): Remove currentScope and only use the isolation scope(?).\n // For v7 though, we can't \"soft-break\" people using getCurrentHub().getScope().setSession()\n const session = currentScope.getSession() || isolationScope.getSession();\n if (session && client && client.captureSession) {\n client.captureSession(session);\n }\n}\n\n/**\n * Sends the current session on the scope to Sentry\n *\n * @param end If set the session will be marked as exited and removed from the scope.\n * Defaults to `false`.\n */\nfunction captureSession(end = false) {\n // both send the update and pull the session from the scope\n if (end) {\n endSession();\n return;\n }\n\n // only send the update\n _sendSessionUpdate();\n}\nexport { addBreadcrumb, captureCheckIn, captureEvent, captureException, captureMessage, captureSession, close, configureScope, endSession, flush, getClient, getCurrentScope, lastEventId, setContext, setExtra, setExtras, setTag, setTags, setUser, startSession, startTransaction, withActiveSpan, withIsolationScope, withMonitor, withScope };\n","/**\n * Returns the root span of a given span.\n *\n * As long as we use `Transaction`s internally, the returned root span\n * will be a `Transaction` but be aware that this might change in the future.\n *\n * If the given span has no root span or transaction, `undefined` is returned.\n */\nfunction getRootSpan(span) {\n // TODO (v8): Remove this check and just return span\n // eslint-disable-next-line deprecation/deprecation\n return span.transaction;\n}\nexport { getRootSpan };\n","import { dropUndefinedKeys } from '@sentry/utils';\nimport { DEFAULT_ENVIRONMENT } from '../constants.js';\nimport { getClient, getCurrentScope } from '../exports.js';\nimport { getRootSpan } from '../utils/getRootSpan.js';\nimport { spanToJSON, spanIsSampled } from '../utils/spanUtils.js';\n\n/**\n * Creates a dynamic sampling context from a client.\n *\n * Dispatches the `createDsc` lifecycle hook as a side effect.\n */\nfunction getDynamicSamplingContextFromClient(trace_id, client, scope) {\n const options = client.getOptions();\n const {\n publicKey: public_key\n } = client.getDsn() || {};\n // TODO(v8): Remove segment from User\n // eslint-disable-next-line deprecation/deprecation\n const {\n segment: user_segment\n } = scope && scope.getUser() || {};\n const dsc = dropUndefinedKeys({\n environment: options.environment || DEFAULT_ENVIRONMENT,\n release: options.release,\n user_segment,\n public_key,\n trace_id\n });\n client.emit && client.emit('createDsc', dsc);\n return dsc;\n}\n\n/**\n * A Span with a frozen dynamic sampling context.\n */\n\n/**\n * Creates a dynamic sampling context from a span (and client and scope)\n *\n * @param span the span from which a few values like the root span name and sample rate are extracted.\n *\n * @returns a dynamic sampling context\n */\nfunction getDynamicSamplingContextFromSpan(span) {\n const client = getClient();\n if (!client) {\n return {};\n }\n\n // passing emit=false here to only emit later once the DSC is actually populated\n const dsc = getDynamicSamplingContextFromClient(spanToJSON(span).trace_id || '', client, getCurrentScope());\n\n // TODO (v8): Remove v7FrozenDsc as a Transaction will no longer have _frozenDynamicSamplingContext\n const txn = getRootSpan(span);\n if (!txn) {\n return dsc;\n }\n\n // TODO (v8): Remove v7FrozenDsc as a Transaction will no longer have _frozenDynamicSamplingContext\n // For now we need to avoid breaking users who directly created a txn with a DSC, where this field is still set.\n // @see Transaction class constructor\n const v7FrozenDsc = txn && txn._frozenDynamicSamplingContext;\n if (v7FrozenDsc) {\n return v7FrozenDsc;\n }\n\n // TODO (v8): Replace txn.metadata with txn.attributes[]\n // We can't do this yet because attributes aren't always set yet.\n // eslint-disable-next-line deprecation/deprecation\n const {\n sampleRate: maybeSampleRate,\n source\n } = txn.metadata;\n if (maybeSampleRate != null) {\n dsc.sample_rate = `${maybeSampleRate}`;\n }\n\n // We don't want to have a transaction name in the DSC if the source is \"url\" because URLs might contain PII\n const jsonSpan = spanToJSON(txn);\n\n // after JSON conversion, txn.name becomes jsonSpan.description\n if (source && source !== 'url') {\n dsc.transaction = jsonSpan.description;\n }\n dsc.sampled = String(spanIsSampled(txn));\n client.emit && client.emit('createDsc', dsc);\n return dsc;\n}\nexport { getDynamicSamplingContextFromClient, getDynamicSamplingContextFromSpan };\n","import { dropUndefinedKeys, arrayify } from '@sentry/utils';\nimport { getDynamicSamplingContextFromSpan } from '../tracing/dynamicSamplingContext.js';\nimport { getRootSpan } from './getRootSpan.js';\nimport { spanToTraceContext, spanToJSON } from './spanUtils.js';\n\n/**\n * Applies data from the scope to the event and runs all event processors on it.\n */\nfunction applyScopeDataToEvent(event, data) {\n const {\n fingerprint,\n span,\n breadcrumbs,\n sdkProcessingMetadata,\n propagationContext\n } = data;\n\n // Apply general data\n applyDataToEvent(event, data);\n\n // We want to set the trace context for normal events only if there isn't already\n // a trace context on the event. There is a product feature in place where we link\n // errors with transaction and it relies on that.\n if (span) {\n applySpanToEvent(event, span);\n }\n applyFingerprintToEvent(event, fingerprint);\n applyBreadcrumbsToEvent(event, breadcrumbs);\n applySdkMetadataToEvent(event, sdkProcessingMetadata, propagationContext);\n}\n\n/** Merge data of two scopes together. */\nfunction mergeScopeData(data, mergeData) {\n const {\n extra,\n tags,\n user,\n contexts,\n level,\n sdkProcessingMetadata,\n breadcrumbs,\n fingerprint,\n eventProcessors,\n attachments,\n propagationContext,\n // eslint-disable-next-line deprecation/deprecation\n transactionName,\n span\n } = mergeData;\n mergeAndOverwriteScopeData(data, 'extra', extra);\n mergeAndOverwriteScopeData(data, 'tags', tags);\n mergeAndOverwriteScopeData(data, 'user', user);\n mergeAndOverwriteScopeData(data, 'contexts', contexts);\n mergeAndOverwriteScopeData(data, 'sdkProcessingMetadata', sdkProcessingMetadata);\n if (level) {\n data.level = level;\n }\n if (transactionName) {\n // eslint-disable-next-line deprecation/deprecation\n data.transactionName = transactionName;\n }\n if (span) {\n data.span = span;\n }\n if (breadcrumbs.length) {\n data.breadcrumbs = [...data.breadcrumbs, ...breadcrumbs];\n }\n if (fingerprint.length) {\n data.fingerprint = [...data.fingerprint, ...fingerprint];\n }\n if (eventProcessors.length) {\n data.eventProcessors = [...data.eventProcessors, ...eventProcessors];\n }\n if (attachments.length) {\n data.attachments = [...data.attachments, ...attachments];\n }\n data.propagationContext = {\n ...data.propagationContext,\n ...propagationContext\n };\n}\n\n/**\n * Merges certain scope data. Undefined values will overwrite any existing values.\n * Exported only for tests.\n */\nfunction mergeAndOverwriteScopeData(data, prop, mergeVal) {\n if (mergeVal && Object.keys(mergeVal).length) {\n // Clone object\n data[prop] = {\n ...data[prop]\n };\n for (const key in mergeVal) {\n if (Object.prototype.hasOwnProperty.call(mergeVal, key)) {\n data[prop][key] = mergeVal[key];\n }\n }\n }\n}\nfunction applyDataToEvent(event, data) {\n const {\n extra,\n tags,\n user,\n contexts,\n level,\n // eslint-disable-next-line deprecation/deprecation\n transactionName\n } = data;\n const cleanedExtra = dropUndefinedKeys(extra);\n if (cleanedExtra && Object.keys(cleanedExtra).length) {\n event.extra = {\n ...cleanedExtra,\n ...event.extra\n };\n }\n const cleanedTags = dropUndefinedKeys(tags);\n if (cleanedTags && Object.keys(cleanedTags).length) {\n event.tags = {\n ...cleanedTags,\n ...event.tags\n };\n }\n const cleanedUser = dropUndefinedKeys(user);\n if (cleanedUser && Object.keys(cleanedUser).length) {\n event.user = {\n ...cleanedUser,\n ...event.user\n };\n }\n const cleanedContexts = dropUndefinedKeys(contexts);\n if (cleanedContexts && Object.keys(cleanedContexts).length) {\n event.contexts = {\n ...cleanedContexts,\n ...event.contexts\n };\n }\n if (level) {\n event.level = level;\n }\n if (transactionName) {\n event.transaction = transactionName;\n }\n}\nfunction applyBreadcrumbsToEvent(event, breadcrumbs) {\n const mergedBreadcrumbs = [...(event.breadcrumbs || []), ...breadcrumbs];\n event.breadcrumbs = mergedBreadcrumbs.length ? mergedBreadcrumbs : undefined;\n}\nfunction applySdkMetadataToEvent(event, sdkProcessingMetadata, propagationContext) {\n event.sdkProcessingMetadata = {\n ...event.sdkProcessingMetadata,\n ...sdkProcessingMetadata,\n propagationContext: propagationContext\n };\n}\nfunction applySpanToEvent(event, span) {\n event.contexts = {\n trace: spanToTraceContext(span),\n ...event.contexts\n };\n const rootSpan = getRootSpan(span);\n if (rootSpan) {\n event.sdkProcessingMetadata = {\n dynamicSamplingContext: getDynamicSamplingContextFromSpan(span),\n ...event.sdkProcessingMetadata\n };\n const transactionName = spanToJSON(rootSpan).description;\n if (transactionName) {\n event.tags = {\n transaction: transactionName,\n ...event.tags\n };\n }\n }\n}\n\n/**\n * Applies fingerprint from the scope to the event if there's one,\n * uses message if there's one instead or get rid of empty fingerprint\n */\nfunction applyFingerprintToEvent(event, fingerprint) {\n // Make sure it's an array first and we actually have something in place\n event.fingerprint = event.fingerprint ? arrayify(event.fingerprint) : [];\n\n // If we have something on the scope, then merge it with event\n if (fingerprint) {\n event.fingerprint = event.fingerprint.concat(fingerprint);\n }\n\n // If we have no data at all, remove empty array default\n if (event.fingerprint && !event.fingerprint.length) {\n delete event.fingerprint;\n }\n}\nexport { applyScopeDataToEvent, mergeAndOverwriteScopeData, mergeScopeData };\n","import { isPlainObject, dateTimestampInSeconds, uuid4, logger } from '@sentry/utils';\nimport { getGlobalEventProcessors, notifyEventProcessors } from './eventProcessors.js';\nimport { updateSession } from './session.js';\nimport { applyScopeDataToEvent } from './utils/applyScopeDataToEvent.js';\n\n/**\n * Default value for maximum number of breadcrumbs added to an event.\n */\nconst DEFAULT_MAX_BREADCRUMBS = 100;\n\n/**\n * The global scope is kept in this module.\n * When accessing this via `getGlobalScope()` we'll make sure to set one if none is currently present.\n */\nlet globalScope;\n\n/**\n * Holds additional event information. {@link Scope.applyToEvent} will be\n * called by the client before an event will be sent.\n */\nclass Scope {\n /** Flag if notifying is happening. */\n\n /** Callback for client to receive scope changes. */\n\n /** Callback list that will be called after {@link applyToEvent}. */\n\n /** Array of breadcrumbs. */\n\n /** User */\n\n /** Tags */\n\n /** Extra */\n\n /** Contexts */\n\n /** Attachments */\n\n /** Propagation Context for distributed tracing */\n\n /**\n * A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get\n * sent to Sentry\n */\n\n /** Fingerprint */\n\n /** Severity */\n // eslint-disable-next-line deprecation/deprecation\n\n /**\n * Transaction Name\n */\n\n /** Span */\n\n /** Session */\n\n /** Request Mode Session Status */\n\n /** The client on this scope */\n\n // NOTE: Any field which gets added here should get added not only to the constructor but also to the `clone` method.\n\n constructor() {\n this._notifyingListeners = false;\n this._scopeListeners = [];\n this._eventProcessors = [];\n this._breadcrumbs = [];\n this._attachments = [];\n this._user = {};\n this._tags = {};\n this._extra = {};\n this._contexts = {};\n this._sdkProcessingMetadata = {};\n this._propagationContext = generatePropagationContext();\n }\n\n /**\n * Inherit values from the parent scope.\n * @deprecated Use `scope.clone()` and `new Scope()` instead.\n */\n static clone(scope) {\n return scope ? scope.clone() : new Scope();\n }\n\n /**\n * Clone this scope instance.\n */\n clone() {\n const newScope = new Scope();\n newScope._breadcrumbs = [...this._breadcrumbs];\n newScope._tags = {\n ...this._tags\n };\n newScope._extra = {\n ...this._extra\n };\n newScope._contexts = {\n ...this._contexts\n };\n newScope._user = this._user;\n newScope._level = this._level;\n newScope._span = this._span;\n newScope._session = this._session;\n newScope._transactionName = this._transactionName;\n newScope._fingerprint = this._fingerprint;\n newScope._eventProcessors = [...this._eventProcessors];\n newScope._requestSession = this._requestSession;\n newScope._attachments = [...this._attachments];\n newScope._sdkProcessingMetadata = {\n ...this._sdkProcessingMetadata\n };\n newScope._propagationContext = {\n ...this._propagationContext\n };\n newScope._client = this._client;\n return newScope;\n }\n\n /** Update the client on the scope. */\n setClient(client) {\n this._client = client;\n }\n\n /**\n * Get the client assigned to this scope.\n *\n * It is generally recommended to use the global function `Sentry.getClient()` instead, unless you know what you are doing.\n */\n getClient() {\n return this._client;\n }\n\n /**\n * Add internal on change listener. Used for sub SDKs that need to store the scope.\n * @hidden\n */\n addScopeListener(callback) {\n this._scopeListeners.push(callback);\n }\n\n /**\n * @inheritDoc\n */\n addEventProcessor(callback) {\n this._eventProcessors.push(callback);\n return this;\n }\n\n /**\n * @inheritDoc\n */\n setUser(user) {\n // If null is passed we want to unset everything, but still define keys,\n // so that later down in the pipeline any existing values are cleared.\n this._user = user || {\n email: undefined,\n id: undefined,\n ip_address: undefined,\n segment: undefined,\n username: undefined\n };\n if (this._session) {\n updateSession(this._session, {\n user\n });\n }\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n getUser() {\n return this._user;\n }\n\n /**\n * @inheritDoc\n */\n getRequestSession() {\n return this._requestSession;\n }\n\n /**\n * @inheritDoc\n */\n setRequestSession(requestSession) {\n this._requestSession = requestSession;\n return this;\n }\n\n /**\n * @inheritDoc\n */\n setTags(tags) {\n this._tags = {\n ...this._tags,\n ...tags\n };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n setTag(key, value) {\n this._tags = {\n ...this._tags,\n [key]: value\n };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n setExtras(extras) {\n this._extra = {\n ...this._extra,\n ...extras\n };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n setExtra(key, extra) {\n this._extra = {\n ...this._extra,\n [key]: extra\n };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n setFingerprint(fingerprint) {\n this._fingerprint = fingerprint;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n setLevel(\n // eslint-disable-next-line deprecation/deprecation\n level) {\n this._level = level;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets the transaction name on the scope for future events.\n * @deprecated Use extra or tags instead.\n */\n setTransactionName(name) {\n this._transactionName = name;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n setContext(key, context) {\n if (context === null) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this._contexts[key];\n } else {\n this._contexts[key] = context;\n }\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Sets the Span on the scope.\n * @param span Span\n * @deprecated Instead of setting a span on a scope, use `startSpan()`/`startSpanManual()` instead.\n */\n setSpan(span) {\n this._span = span;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * Returns the `Span` if there is one.\n * @deprecated Use `getActiveSpan()` instead.\n */\n getSpan() {\n return this._span;\n }\n\n /**\n * Returns the `Transaction` attached to the scope (if there is one).\n * @deprecated You should not rely on the transaction, but just use `startSpan()` APIs instead.\n */\n getTransaction() {\n // Often, this span (if it exists at all) will be a transaction, but it's not guaranteed to be. Regardless, it will\n // have a pointer to the currently-active transaction.\n const span = this._span;\n // Cannot replace with getRootSpan because getRootSpan returns a span, not a transaction\n // Also, this method will be removed anyway.\n // eslint-disable-next-line deprecation/deprecation\n return span && span.transaction;\n }\n\n /**\n * @inheritDoc\n */\n setSession(session) {\n if (!session) {\n delete this._session;\n } else {\n this._session = session;\n }\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n getSession() {\n return this._session;\n }\n\n /**\n * @inheritDoc\n */\n update(captureContext) {\n if (!captureContext) {\n return this;\n }\n if (typeof captureContext === 'function') {\n const updatedScope = captureContext(this);\n return updatedScope instanceof Scope ? updatedScope : this;\n }\n if (captureContext instanceof Scope) {\n this._tags = {\n ...this._tags,\n ...captureContext._tags\n };\n this._extra = {\n ...this._extra,\n ...captureContext._extra\n };\n this._contexts = {\n ...this._contexts,\n ...captureContext._contexts\n };\n if (captureContext._user && Object.keys(captureContext._user).length) {\n this._user = captureContext._user;\n }\n if (captureContext._level) {\n this._level = captureContext._level;\n }\n if (captureContext._fingerprint) {\n this._fingerprint = captureContext._fingerprint;\n }\n if (captureContext._requestSession) {\n this._requestSession = captureContext._requestSession;\n }\n if (captureContext._propagationContext) {\n this._propagationContext = captureContext._propagationContext;\n }\n } else if (isPlainObject(captureContext)) {\n // eslint-disable-next-line no-param-reassign\n captureContext = captureContext;\n this._tags = {\n ...this._tags,\n ...captureContext.tags\n };\n this._extra = {\n ...this._extra,\n ...captureContext.extra\n };\n this._contexts = {\n ...this._contexts,\n ...captureContext.contexts\n };\n if (captureContext.user) {\n this._user = captureContext.user;\n }\n if (captureContext.level) {\n this._level = captureContext.level;\n }\n if (captureContext.fingerprint) {\n this._fingerprint = captureContext.fingerprint;\n }\n if (captureContext.requestSession) {\n this._requestSession = captureContext.requestSession;\n }\n if (captureContext.propagationContext) {\n this._propagationContext = captureContext.propagationContext;\n }\n }\n return this;\n }\n\n /**\n * @inheritDoc\n */\n clear() {\n this._breadcrumbs = [];\n this._tags = {};\n this._extra = {};\n this._user = {};\n this._contexts = {};\n this._level = undefined;\n this._transactionName = undefined;\n this._fingerprint = undefined;\n this._requestSession = undefined;\n this._span = undefined;\n this._session = undefined;\n this._notifyScopeListeners();\n this._attachments = [];\n this._propagationContext = generatePropagationContext();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n addBreadcrumb(breadcrumb, maxBreadcrumbs) {\n const maxCrumbs = typeof maxBreadcrumbs === 'number' ? maxBreadcrumbs : DEFAULT_MAX_BREADCRUMBS;\n\n // No data has been changed, so don't notify scope listeners\n if (maxCrumbs <= 0) {\n return this;\n }\n const mergedBreadcrumb = {\n timestamp: dateTimestampInSeconds(),\n ...breadcrumb\n };\n const breadcrumbs = this._breadcrumbs;\n breadcrumbs.push(mergedBreadcrumb);\n this._breadcrumbs = breadcrumbs.length > maxCrumbs ? breadcrumbs.slice(-maxCrumbs) : breadcrumbs;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n getLastBreadcrumb() {\n return this._breadcrumbs[this._breadcrumbs.length - 1];\n }\n\n /**\n * @inheritDoc\n */\n clearBreadcrumbs() {\n this._breadcrumbs = [];\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n addAttachment(attachment) {\n this._attachments.push(attachment);\n return this;\n }\n\n /**\n * @inheritDoc\n * @deprecated Use `getScopeData()` instead.\n */\n getAttachments() {\n const data = this.getScopeData();\n return data.attachments;\n }\n\n /**\n * @inheritDoc\n */\n clearAttachments() {\n this._attachments = [];\n return this;\n }\n\n /** @inheritDoc */\n getScopeData() {\n const {\n _breadcrumbs,\n _attachments,\n _contexts,\n _tags,\n _extra,\n _user,\n _level,\n _fingerprint,\n _eventProcessors,\n _propagationContext,\n _sdkProcessingMetadata,\n _transactionName,\n _span\n } = this;\n return {\n breadcrumbs: _breadcrumbs,\n attachments: _attachments,\n contexts: _contexts,\n tags: _tags,\n extra: _extra,\n user: _user,\n level: _level,\n fingerprint: _fingerprint || [],\n eventProcessors: _eventProcessors,\n propagationContext: _propagationContext,\n sdkProcessingMetadata: _sdkProcessingMetadata,\n transactionName: _transactionName,\n span: _span\n };\n }\n\n /**\n * Applies data from the scope to the event and runs all event processors on it.\n *\n * @param event Event\n * @param hint Object containing additional information about the original exception, for use by the event processors.\n * @hidden\n * @deprecated Use `applyScopeDataToEvent()` directly\n */\n applyToEvent(event, hint = {}, additionalEventProcessors = []) {\n applyScopeDataToEvent(event, this.getScopeData());\n\n // TODO (v8): Update this order to be: Global > Client > Scope\n const eventProcessors = [...additionalEventProcessors,\n // eslint-disable-next-line deprecation/deprecation\n ...getGlobalEventProcessors(), ...this._eventProcessors];\n return notifyEventProcessors(eventProcessors, event, hint);\n }\n\n /**\n * Add data which will be accessible during event processing but won't get sent to Sentry\n */\n setSDKProcessingMetadata(newData) {\n this._sdkProcessingMetadata = {\n ...this._sdkProcessingMetadata,\n ...newData\n };\n return this;\n }\n\n /**\n * @inheritDoc\n */\n setPropagationContext(context) {\n this._propagationContext = context;\n return this;\n }\n\n /**\n * @inheritDoc\n */\n getPropagationContext() {\n return this._propagationContext;\n }\n\n /**\n * Capture an exception for this scope.\n *\n * @param exception The exception to capture.\n * @param hint Optinal additional data to attach to the Sentry event.\n * @returns the id of the captured Sentry event.\n */\n captureException(exception, hint) {\n const eventId = hint && hint.event_id ? hint.event_id : uuid4();\n if (!this._client) {\n logger.warn('No client configured on scope - will not capture exception!');\n return eventId;\n }\n const syntheticException = new Error('Sentry syntheticException');\n this._client.captureException(exception, {\n originalException: exception,\n syntheticException,\n ...hint,\n event_id: eventId\n }, this);\n return eventId;\n }\n\n /**\n * Capture a message for this scope.\n *\n * @param message The message to capture.\n * @param level An optional severity level to report the message with.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured message.\n */\n captureMessage(message, level, hint) {\n const eventId = hint && hint.event_id ? hint.event_id : uuid4();\n if (!this._client) {\n logger.warn('No client configured on scope - will not capture message!');\n return eventId;\n }\n const syntheticException = new Error(message);\n this._client.captureMessage(message, level, {\n originalException: message,\n syntheticException,\n ...hint,\n event_id: eventId\n }, this);\n return eventId;\n }\n\n /**\n * Captures a manually created event for this scope and sends it to Sentry.\n *\n * @param exception The event to capture.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured event.\n */\n captureEvent(event, hint) {\n const eventId = hint && hint.event_id ? hint.event_id : uuid4();\n if (!this._client) {\n logger.warn('No client configured on scope - will not capture event!');\n return eventId;\n }\n this._client.captureEvent(event, {\n ...hint,\n event_id: eventId\n }, this);\n return eventId;\n }\n\n /**\n * This will be called on every set call.\n */\n _notifyScopeListeners() {\n // We need this check for this._notifyingListeners to be able to work on scope during updates\n // If this check is not here we'll produce endless recursion when something is done with the scope\n // during the callback.\n if (!this._notifyingListeners) {\n this._notifyingListeners = true;\n this._scopeListeners.forEach(callback => {\n callback(this);\n });\n this._notifyingListeners = false;\n }\n }\n}\n\n/**\n * Get the global scope.\n * This scope is applied to _all_ events.\n */\nfunction getGlobalScope() {\n if (!globalScope) {\n globalScope = new Scope();\n }\n return globalScope;\n}\n\n/**\n * This is mainly needed for tests.\n * DO NOT USE this, as this is an internal API and subject to change.\n * @hidden\n */\nfunction setGlobalScope(scope) {\n globalScope = scope;\n}\nfunction generatePropagationContext() {\n return {\n traceId: uuid4(),\n spanId: uuid4().substring(16)\n };\n}\nexport { Scope, getGlobalScope, setGlobalScope };\n","const SDK_VERSION = '7.94.1';\nexport { SDK_VERSION };\n","import { isThenable, uuid4, dateTimestampInSeconds, consoleSandbox, logger, GLOBAL_OBJ, getGlobalSingleton } from '@sentry/utils';\nimport { DEFAULT_ENVIRONMENT } from './constants.js';\nimport { DEBUG_BUILD } from './debug-build.js';\nimport { Scope } from './scope.js';\nimport { closeSession, makeSession, updateSession } from './session.js';\nimport { SDK_VERSION } from './version.js';\n\n/**\n * API compatibility version of this hub.\n *\n * WARNING: This number should only be increased when the global interface\n * changes and new methods are introduced.\n *\n * @hidden\n */\nconst API_VERSION = parseFloat(SDK_VERSION);\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 * @inheritDoc\n */\nclass Hub {\n /** Is a {@link Layer}[] containing the client and scope */\n\n /** Contains the last event id of a captured event. */\n\n /**\n * Creates a new instance of the hub, will push one {@link Layer} into the\n * internal stack on creation.\n *\n * @param client bound to the hub.\n * @param scope bound to the hub.\n * @param version number, higher number means higher priority.\n */\n constructor(client, scope, isolationScope, _version = API_VERSION) {\n this._version = _version;\n let assignedScope;\n if (!scope) {\n assignedScope = new Scope();\n assignedScope.setClient(client);\n } else {\n assignedScope = scope;\n }\n let assignedIsolationScope;\n if (!isolationScope) {\n assignedIsolationScope = new Scope();\n assignedIsolationScope.setClient(client);\n } else {\n assignedIsolationScope = isolationScope;\n }\n this._stack = [{\n scope: assignedScope\n }];\n if (client) {\n // eslint-disable-next-line deprecation/deprecation\n this.bindClient(client);\n }\n this._isolationScope = assignedIsolationScope;\n }\n\n /**\n * Checks if this hub's version is older than the given version.\n *\n * @param version A version number to compare to.\n * @return True if the given version is newer; otherwise false.\n *\n * @deprecated This will be removed in v8.\n */\n isOlderThan(version) {\n return this._version < version;\n }\n\n /**\n * This binds the given client to the current scope.\n * @param client An SDK client (client) instance.\n *\n * @deprecated Use `initAndBind()` directly, or `setCurrentClient()` and/or `client.init()` instead.\n */\n bindClient(client) {\n // eslint-disable-next-line deprecation/deprecation\n const top = this.getStackTop();\n top.client = client;\n top.scope.setClient(client);\n // eslint-disable-next-line deprecation/deprecation\n if (client && client.setupIntegrations) {\n // eslint-disable-next-line deprecation/deprecation\n client.setupIntegrations();\n }\n }\n\n /**\n * @inheritDoc\n *\n * @deprecated Use `withScope` instead.\n */\n pushScope() {\n // We want to clone the content of prev scope\n // eslint-disable-next-line deprecation/deprecation\n const scope = this.getScope().clone();\n // eslint-disable-next-line deprecation/deprecation\n this.getStack().push({\n // eslint-disable-next-line deprecation/deprecation\n client: this.getClient(),\n scope\n });\n return scope;\n }\n\n /**\n * @inheritDoc\n *\n * @deprecated Use `withScope` instead.\n */\n popScope() {\n // eslint-disable-next-line deprecation/deprecation\n if (this.getStack().length <= 1) return false;\n // eslint-disable-next-line deprecation/deprecation\n return !!this.getStack().pop();\n }\n\n /**\n * @inheritDoc\n *\n * @deprecated Use `Sentry.withScope()` instead.\n */\n withScope(callback) {\n // eslint-disable-next-line deprecation/deprecation\n const scope = this.pushScope();\n let maybePromiseResult;\n try {\n maybePromiseResult = callback(scope);\n } catch (e) {\n // eslint-disable-next-line deprecation/deprecation\n this.popScope();\n throw e;\n }\n if (isThenable(maybePromiseResult)) {\n // @ts-expect-error - isThenable returns the wrong type\n return maybePromiseResult.then(res => {\n // eslint-disable-next-line deprecation/deprecation\n this.popScope();\n return res;\n }, e => {\n // eslint-disable-next-line deprecation/deprecation\n this.popScope();\n throw e;\n });\n }\n\n // eslint-disable-next-line deprecation/deprecation\n this.popScope();\n return maybePromiseResult;\n }\n\n /**\n * @inheritDoc\n *\n * @deprecated Use `Sentry.getClient()` instead.\n */\n getClient() {\n // eslint-disable-next-line deprecation/deprecation\n return this.getStackTop().client;\n }\n\n /**\n * Returns the scope of the top stack.\n *\n * @deprecated Use `Sentry.getCurrentScope()` instead.\n */\n getScope() {\n // eslint-disable-next-line deprecation/deprecation\n return this.getStackTop().scope;\n }\n\n /**\n * @deprecated Use `Sentry.getIsolationScope()` instead.\n */\n getIsolationScope() {\n return this._isolationScope;\n }\n\n /**\n * Returns the scope stack for domains or the process.\n * @deprecated This will be removed in v8.\n */\n getStack() {\n return this._stack;\n }\n\n /**\n * Returns the topmost scope layer in the order domain > local > process.\n * @deprecated This will be removed in v8.\n */\n getStackTop() {\n return this._stack[this._stack.length - 1];\n }\n\n /**\n * @inheritDoc\n *\n * @deprecated Use `Sentry.captureException()` instead.\n */\n captureException(exception, hint) {\n const eventId = this._lastEventId = hint && hint.event_id ? hint.event_id : uuid4();\n const syntheticException = new Error('Sentry syntheticException');\n // eslint-disable-next-line deprecation/deprecation\n this.getScope().captureException(exception, {\n originalException: exception,\n syntheticException,\n ...hint,\n event_id: eventId\n });\n return eventId;\n }\n\n /**\n * @inheritDoc\n *\n * @deprecated Use `Sentry.captureMessage()` instead.\n */\n captureMessage(message,\n // eslint-disable-next-line deprecation/deprecation\n level, hint) {\n const eventId = this._lastEventId = hint && hint.event_id ? hint.event_id : uuid4();\n const syntheticException = new Error(message);\n // eslint-disable-next-line deprecation/deprecation\n this.getScope().captureMessage(message, level, {\n originalException: message,\n syntheticException,\n ...hint,\n event_id: eventId\n });\n return eventId;\n }\n\n /**\n * @inheritDoc\n *\n * @deprecated Use `Sentry.captureEvent()` instead.\n */\n captureEvent(event, hint) {\n const eventId = hint && hint.event_id ? hint.event_id : uuid4();\n if (!event.type) {\n this._lastEventId = eventId;\n }\n // eslint-disable-next-line deprecation/deprecation\n this.getScope().captureEvent(event, {\n ...hint,\n event_id: eventId\n });\n return eventId;\n }\n\n /**\n * @inheritDoc\n *\n * @deprecated This will be removed in v8.\n */\n lastEventId() {\n return this._lastEventId;\n }\n\n /**\n * @inheritDoc\n *\n * @deprecated Use `Sentry.addBreadcrumb()` instead.\n */\n addBreadcrumb(breadcrumb, hint) {\n // eslint-disable-next-line deprecation/deprecation\n const {\n scope,\n client\n } = this.getStackTop();\n if (!client) return;\n const {\n beforeBreadcrumb = null,\n maxBreadcrumbs = DEFAULT_BREADCRUMBS\n } = client.getOptions && client.getOptions() || {};\n if (maxBreadcrumbs <= 0) return;\n const timestamp = dateTimestampInSeconds();\n const mergedBreadcrumb = {\n timestamp,\n ...breadcrumb\n };\n const finalBreadcrumb = beforeBreadcrumb ? consoleSandbox(() => beforeBreadcrumb(mergedBreadcrumb, hint)) : mergedBreadcrumb;\n if (finalBreadcrumb === null) return;\n if (client.emit) {\n client.emit('beforeAddBreadcrumb', finalBreadcrumb, hint);\n }\n\n // TODO(v8): I know this comment doesn't make much sense because the hub will be deprecated but I still wanted to\n // write it down. In theory, we would have to add the breadcrumbs to the isolation scope here, however, that would\n // duplicate all of the breadcrumbs. There was the possibility of adding breadcrumbs to both, the isolation scope\n // and the normal scope, and deduplicating it down the line in the event processing pipeline. However, that would\n // have been very fragile, because the breadcrumb objects would have needed to keep their identity all throughout\n // the event processing pipeline.\n // In the new implementation, the top level `Sentry.addBreadcrumb()` should ONLY write to the isolation scope.\n\n scope.addBreadcrumb(finalBreadcrumb, maxBreadcrumbs);\n }\n\n /**\n * @inheritDoc\n * @deprecated Use `Sentry.setUser()` instead.\n */\n setUser(user) {\n // TODO(v8): The top level `Sentry.setUser()` function should write ONLY to the isolation scope.\n // eslint-disable-next-line deprecation/deprecation\n this.getScope().setUser(user);\n // eslint-disable-next-line deprecation/deprecation\n this.getIsolationScope().setUser(user);\n }\n\n /**\n * @inheritDoc\n * @deprecated Use `Sentry.setTags()` instead.\n */\n setTags(tags) {\n // TODO(v8): The top level `Sentry.setTags()` function should write ONLY to the isolation scope.\n // eslint-disable-next-line deprecation/deprecation\n this.getScope().setTags(tags);\n // eslint-disable-next-line deprecation/deprecation\n this.getIsolationScope().setTags(tags);\n }\n\n /**\n * @inheritDoc\n * @deprecated Use `Sentry.setExtras()` instead.\n */\n setExtras(extras) {\n // TODO(v8): The top level `Sentry.setExtras()` function should write ONLY to the isolation scope.\n // eslint-disable-next-line deprecation/deprecation\n this.getScope().setExtras(extras);\n // eslint-disable-next-line deprecation/deprecation\n this.getIsolationScope().setExtras(extras);\n }\n\n /**\n * @inheritDoc\n * @deprecated Use `Sentry.setTag()` instead.\n */\n setTag(key, value) {\n // TODO(v8): The top level `Sentry.setTag()` function should write ONLY to the isolation scope.\n // eslint-disable-next-line deprecation/deprecation\n this.getScope().setTag(key, value);\n // eslint-disable-next-line deprecation/deprecation\n this.getIsolationScope().setTag(key, value);\n }\n\n /**\n * @inheritDoc\n * @deprecated Use `Sentry.setExtra()` instead.\n */\n setExtra(key, extra) {\n // TODO(v8): The top level `Sentry.setExtra()` function should write ONLY to the isolation scope.\n // eslint-disable-next-line deprecation/deprecation\n this.getScope().setExtra(key, extra);\n // eslint-disable-next-line deprecation/deprecation\n this.getIsolationScope().setExtra(key, extra);\n }\n\n /**\n * @inheritDoc\n * @deprecated Use `Sentry.setContext()` instead.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setContext(name, context) {\n // TODO(v8): The top level `Sentry.setContext()` function should write ONLY to the isolation scope.\n // eslint-disable-next-line deprecation/deprecation\n this.getScope().setContext(name, context);\n // eslint-disable-next-line deprecation/deprecation\n this.getIsolationScope().setContext(name, context);\n }\n\n /**\n * @inheritDoc\n *\n * @deprecated Use `getScope()` directly.\n */\n configureScope(callback) {\n // eslint-disable-next-line deprecation/deprecation\n const {\n scope,\n client\n } = this.getStackTop();\n if (client) {\n callback(scope);\n }\n }\n\n /**\n * @inheritDoc\n */\n run(callback) {\n // eslint-disable-next-line deprecation/deprecation\n const oldHub = makeMain(this);\n try {\n callback(this);\n } finally {\n // eslint-disable-next-line deprecation/deprecation\n makeMain(oldHub);\n }\n }\n\n /**\n * @inheritDoc\n * @deprecated Use `Sentry.getClient().getIntegrationByName()` instead.\n */\n getIntegration(integration) {\n // eslint-disable-next-line deprecation/deprecation\n const client = this.getClient();\n if (!client) return null;\n try {\n // eslint-disable-next-line deprecation/deprecation\n return client.getIntegration(integration);\n } catch (_oO) {\n DEBUG_BUILD && logger.warn(`Cannot retrieve integration ${integration.id} from the current Hub`);\n return null;\n }\n }\n\n /**\n * Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation.\n *\n * A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a\n * new child span within the transaction or any span, call the respective `.startChild()` method.\n *\n * Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded.\n *\n * The transaction must be finished with a call to its `.end()` method, at which point the transaction with all its\n * finished child spans will be sent to Sentry.\n *\n * @param context Properties of the new `Transaction`.\n * @param customSamplingContext Information given to the transaction sampling function (along with context-dependent\n * default values). See {@link Options.tracesSampler}.\n *\n * @returns The transaction which was just started\n *\n * @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.\n */\n startTransaction(context, customSamplingContext) {\n const result = this._callExtensionMethod('startTransaction', context, customSamplingContext);\n if (DEBUG_BUILD && !result) {\n // eslint-disable-next-line deprecation/deprecation\n const client = this.getClient();\n if (!client) {\n logger.warn(\"Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'\");\n } else {\n logger.warn(`Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':\nSentry.addTracingExtensions();\nSentry.init({...});\n`);\n }\n }\n return result;\n }\n\n /**\n * @inheritDoc\n * @deprecated Use `spanToTraceHeader()` instead.\n */\n traceHeaders() {\n return this._callExtensionMethod('traceHeaders');\n }\n\n /**\n * @inheritDoc\n *\n * @deprecated Use top level `captureSession` instead.\n */\n captureSession(endSession = false) {\n // both send the update and pull the session from the scope\n if (endSession) {\n // eslint-disable-next-line deprecation/deprecation\n return this.endSession();\n }\n\n // only send the update\n this._sendSessionUpdate();\n }\n\n /**\n * @inheritDoc\n * @deprecated Use top level `endSession` instead.\n */\n endSession() {\n // eslint-disable-next-line deprecation/deprecation\n const layer = this.getStackTop();\n const scope = layer.scope;\n const session = scope.getSession();\n if (session) {\n closeSession(session);\n }\n this._sendSessionUpdate();\n\n // the session is over; take it off of the scope\n scope.setSession();\n }\n\n /**\n * @inheritDoc\n * @deprecated Use top level `startSession` instead.\n */\n startSession(context) {\n // eslint-disable-next-line deprecation/deprecation\n const {\n scope,\n client\n } = this.getStackTop();\n const {\n release,\n environment = DEFAULT_ENVIRONMENT\n } = client && client.getOptions() || {};\n\n // Will fetch userAgent if called from browser sdk\n const {\n userAgent\n } = GLOBAL_OBJ.navigator || {};\n const session = makeSession({\n release,\n environment,\n user: scope.getUser(),\n ...(userAgent && {\n userAgent\n }),\n ...context\n });\n\n // End existing session if there's one\n const currentSession = scope.getSession && scope.getSession();\n if (currentSession && currentSession.status === 'ok') {\n updateSession(currentSession, {\n status: 'exited'\n });\n }\n // eslint-disable-next-line deprecation/deprecation\n this.endSession();\n\n // Afterwards we set the new session on the scope\n scope.setSession(session);\n return session;\n }\n\n /**\n * Returns if default PII should be sent to Sentry and propagated in ourgoing requests\n * when Tracing is used.\n *\n * @deprecated Use top-level `getClient().getOptions().sendDefaultPii` instead. This function\n * only unnecessarily increased API surface but only wrapped accessing the option.\n */\n shouldSendDefaultPii() {\n // eslint-disable-next-line deprecation/deprecation\n const client = this.getClient();\n const options = client && client.getOptions();\n return Boolean(options && options.sendDefaultPii);\n }\n\n /**\n * Sends the current Session on the scope\n */\n _sendSessionUpdate() {\n // eslint-disable-next-line deprecation/deprecation\n const {\n scope,\n client\n } = this.getStackTop();\n const session = scope.getSession();\n if (session && client && client.captureSession) {\n client.captureSession(session);\n }\n }\n\n /**\n * Calls global extension method and binding current instance to the function call\n */\n // @ts-expect-error Function lacks ending return statement and return type does not include 'undefined'. ts(2366)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n _callExtensionMethod(method, ...args) {\n const carrier = getMainCarrier();\n const sentry = carrier.__SENTRY__;\n if (sentry && sentry.extensions && typeof sentry.extensions[method] === 'function') {\n return sentry.extensions[method].apply(this, args);\n }\n DEBUG_BUILD && logger.warn(`Extension method ${method} couldn't be found, doing nothing.`);\n }\n}\n\n/**\n * Returns the global shim registry.\n *\n * FIXME: This function is problematic, because despite always returning a valid Carrier,\n * it has an optional `__SENTRY__` property, which then in turn requires us to always perform an unnecessary check\n * at the call-site. We always access the carrier through this function, so we can guarantee that `__SENTRY__` is there.\n **/\nfunction getMainCarrier() {\n GLOBAL_OBJ.__SENTRY__ = GLOBAL_OBJ.__SENTRY__ || {\n extensions: {},\n hub: undefined\n };\n return GLOBAL_OBJ;\n}\n\n/**\n * Replaces the current main hub with the passed one on the global object\n *\n * @returns The old replaced hub\n *\n * @deprecated Use `setCurrentClient()` instead.\n */\nfunction makeMain(hub) {\n const registry = getMainCarrier();\n const oldHub = getHubFromCarrier(registry);\n setHubOnCarrier(registry, hub);\n return oldHub;\n}\n\n/**\n * Returns the default hub instance.\n *\n * If a hub is already registered in the global carrier but this module\n * contains a more recent version, it replaces the registered version.\n * Otherwise, the currently registered hub will be returned.\n *\n * @deprecated Use the respective replacement method directly instead.\n */\nfunction getCurrentHub() {\n // Get main carrier (global for every environment)\n const registry = getMainCarrier();\n if (registry.__SENTRY__ && registry.__SENTRY__.acs) {\n const hub = registry.__SENTRY__.acs.getCurrentHub();\n if (hub) {\n return hub;\n }\n }\n\n // Return hub that lives on a global object\n return getGlobalHub(registry);\n}\n\n/**\n * Get the currently active isolation scope.\n * The isolation scope is active for the current exection context,\n * meaning that it will remain stable for the same Hub.\n */\nfunction getIsolationScope() {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentHub().getIsolationScope();\n}\nfunction getGlobalHub(registry = getMainCarrier()) {\n // If there's no hub, or its an old API, assign a new one\n\n if (!hasHubOnCarrier(registry) ||\n // eslint-disable-next-line deprecation/deprecation\n getHubFromCarrier(registry).isOlderThan(API_VERSION)) {\n setHubOnCarrier(registry, new Hub());\n }\n\n // Return hub that lives on a global object\n return getHubFromCarrier(registry);\n}\n\n/**\n * @private Private API with no semver guarantees!\n *\n * If the carrier does not contain a hub, a new hub is created with the global hub client and scope.\n */\nfunction ensureHubOnCarrier(carrier, parent = getGlobalHub()) {\n // If there's no hub on current domain, or it's an old API, assign a new one\n if (!hasHubOnCarrier(carrier) ||\n // eslint-disable-next-line deprecation/deprecation\n getHubFromCarrier(carrier).isOlderThan(API_VERSION)) {\n // eslint-disable-next-line deprecation/deprecation\n const client = parent.getClient();\n // eslint-disable-next-line deprecation/deprecation\n const scope = parent.getScope();\n // eslint-disable-next-line deprecation/deprecation\n const isolationScope = parent.getIsolationScope();\n setHubOnCarrier(carrier, new Hub(client, scope.clone(), isolationScope.clone()));\n }\n}\n\n/**\n * @private Private API with no semver guarantees!\n *\n * Sets the global async context strategy\n */\nfunction setAsyncContextStrategy(strategy) {\n // Get main carrier (global for every environment)\n const registry = getMainCarrier();\n registry.__SENTRY__ = registry.__SENTRY__ || {};\n registry.__SENTRY__.acs = strategy;\n}\n\n/**\n * Runs the supplied callback in its own async context. Async Context strategies are defined per SDK.\n *\n * @param callback The callback to run in its own async context\n * @param options Options to pass to the async context strategy\n * @returns The result of the callback\n */\nfunction runWithAsyncContext(callback, options = {}) {\n const registry = getMainCarrier();\n if (registry.__SENTRY__ && registry.__SENTRY__.acs) {\n return registry.__SENTRY__.acs.runWithAsyncContext(callback, options);\n }\n\n // if there was no strategy, fallback to just calling the callback\n return callback();\n}\n\n/**\n * This will tell whether a carrier has a hub on it or not\n * @param carrier object\n */\nfunction hasHubOnCarrier(carrier) {\n return !!(carrier && carrier.__SENTRY__ && carrier.__SENTRY__.hub);\n}\n\n/**\n * This will create a new {@link Hub} and add to the passed object on\n * __SENTRY__.hub.\n * @param carrier object\n * @hidden\n */\nfunction getHubFromCarrier(carrier) {\n return getGlobalSingleton('hub', () => new Hub(), carrier);\n}\n\n/**\n * This will set passed {@link Hub} on the passed object's __SENTRY__.hub attribute\n * @param carrier object\n * @param hub Hub\n * @returns A boolean indicating success or failure\n */\nfunction setHubOnCarrier(carrier, hub) {\n if (!carrier) return false;\n const __SENTRY__ = carrier.__SENTRY__ = carrier.__SENTRY__ || {};\n __SENTRY__.hub = hub;\n return true;\n}\nexport { API_VERSION, Hub, ensureHubOnCarrier, getCurrentHub, getHubFromCarrier, getIsolationScope, getMainCarrier, makeMain, runWithAsyncContext, setAsyncContextStrategy, setHubOnCarrier };\n","/**\n * Use this attribute to represent the source of a span.\n * Should be one of: custom, url, route, view, component, task, unknown\n *\n */\nconst SEMANTIC_ATTRIBUTE_SENTRY_SOURCE = 'sentry.source';\n\n/**\n * Use this attribute to represent the sample rate used for a span.\n */\nconst SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE = 'sentry.sample_rate';\n\n/**\n * Use this attribute to represent the operation of a span.\n */\nconst SEMANTIC_ATTRIBUTE_SENTRY_OP = 'sentry.op';\nexport { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE };\n","import { getSdkMetadataForEnvelopeHeader, dsnToString, createEnvelope, createEventEnvelopeHeaders } from '@sentry/utils';\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(session, dsn, metadata, tunnel) {\n const sdkInfo = getSdkMetadataForEnvelopeHeader(metadata);\n const envelopeHeaders = {\n sent_at: new Date().toISOString(),\n ...(sdkInfo && {\n sdk: sdkInfo\n }),\n ...(!!tunnel && dsn && {\n dsn: dsnToString(dsn)\n })\n };\n const envelopeItem = 'aggregates' in session ? [{\n type: 'sessions'\n }, session] : [{\n type: 'session'\n }, session.toJSON()];\n return createEnvelope(envelopeHeaders, [envelopeItem]);\n}\n\n/**\n * Create an Envelope from an event.\n */\nfunction createEventEnvelope(event, dsn, metadata, tunnel) {\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 enhanceEventWithSdkInfo(event, metadata && metadata.sdk);\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 const eventItem = [{\n type: eventType\n }, event];\n return createEnvelope(envelopeHeaders, [eventItem]);\n}\nexport { createEventEnvelope, createSessionEnvelope };\n","import { makeDsn, dsnToString, urlEncode } from '@sentry/utils';\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 && {\n sentry_client: `${sdkInfo.name}/${sdkInfo.version}`\n })\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,\n// TODO (v8): Remove `tunnelOrOptions` in favor of `options`, and use the substitute code below\n// options: ClientOptions = {} as ClientOptions,\ntunnelOrOptions = {}) {\n // TODO (v8): Use this code instead\n // const { tunnel, _metadata = {} } = options;\n // return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, _metadata.sdk)}`;\n\n const tunnel = typeof tunnelOrOptions === 'string' ? tunnelOrOptions : tunnelOrOptions.tunnel;\n const sdkInfo = typeof tunnelOrOptions === 'string' || !tunnelOrOptions._metadata ? undefined : tunnelOrOptions._metadata.sdk;\n return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, sdkInfo)}`;\n}\n\n/** Returns the url to the report dialog endpoint. */\nfunction getReportDialogEndpoint(dsnLike, dialogOptions) {\n const dsn = makeDsn(dsnLike);\n if (!dsn) {\n return '';\n }\n const endpoint = `${getBaseApiEndpoint(dsn)}embed/error-page/`;\n let encodedOptions = `dsn=${dsnToString(dsn)}`;\n for (const key in dialogOptions) {\n if (key === 'dsn') {\n continue;\n }\n if (key === 'onClose') {\n continue;\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 return `${endpoint}?${encodedOptions}`;\n}\nexport { getEnvelopeEndpointWithUrlEncodedAuth, getReportDialogEndpoint };\n","import { arrayify, logger } from '@sentry/utils';\nimport { DEBUG_BUILD } from './debug-build.js';\nimport { addGlobalEventProcessor } from './eventProcessors.js';\nimport { getClient } from './exports.js';\nimport { getCurrentHub } from './hub.js';\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 integrations.forEach(currentInstance => {\n const {\n name\n } = currentInstance;\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 integrationsByName[name] = currentInstance;\n });\n return Object.keys(integrationsByName).map(k => integrationsByName[k]);\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 let integrations;\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 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 = findIndex(finalIntegrations, integration => integration.name === 'Debug');\n if (debugIndex !== -1) {\n const [debugInstance] = finalIntegrations.splice(debugIndex, 1);\n finalIntegrations.push(debugInstance);\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 integrations.forEach(integration => {\n // guard against empty provided integrations\n if (integration) {\n setupIntegration(client, integration, integrationIndex);\n }\n });\n return integrationIndex;\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) {\n // eslint-disable-next-line deprecation/deprecation\n integration.setupOnce(addGlobalEventProcessor, getCurrentHub);\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 if (client.on && typeof integration.preprocessEvent === 'function') {\n const callback = integration.preprocessEvent.bind(integration);\n client.on('preprocessEvent', (event, hint) => callback(event, hint, client));\n }\n if (client.addEventProcessor && typeof integration.processEvent === 'function') {\n const callback = integration.processEvent.bind(integration);\n const processor = Object.assign((event, hint) => callback(event, hint, client), {\n id: integration.name\n });\n client.addEventProcessor(processor);\n }\n DEBUG_BUILD && logger.log(`Integration installed: ${integration.name}`);\n}\n\n/** Add an integration to the current hub's client. */\nfunction addIntegration(integration) {\n const client = getClient();\n if (!client || !client.addIntegration) {\n DEBUG_BUILD && logger.warn(`Cannot add integration \"${integration.name}\" because no SDK Client is available.`);\n return;\n }\n client.addIntegration(integration);\n}\n\n// Polyfill for Array.findIndex(), which is not supported in ES5\nfunction findIndex(arr, callback) {\n for (let i = 0; i < arr.length; i++) {\n if (callback(arr[i]) === true) {\n return i;\n }\n }\n return -1;\n}\n\n/**\n * Convert a new integration function to the legacy class syntax.\n * In v8, we can remove this and instead export the integration functions directly.\n *\n * @deprecated This will be removed in v8!\n */\nfunction convertIntegrationFnToClass(name, fn) {\n return Object.assign(function ConvertedIntegration(...args) {\n return fn(...args);\n }, {\n id: name\n });\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}\nexport { addIntegration, convertIntegrationFnToClass, defineIntegration, getIntegrationsToSetup, installedIntegrations, setupIntegration, setupIntegrations };\n","import { dropUndefinedKeys } from '@sentry/utils';\nimport { NAME_AND_TAG_KEY_NORMALIZATION_REGEX, TAG_VALUE_NORMALIZATION_REGEX } from './constants.js';\n\n/**\n * Generate bucket key from metric properties.\n */\nfunction getBucketKey(metricType, name, unit, tags) {\n const stringifiedTags = Object.entries(dropUndefinedKeys(tags)).sort((a, b) => a[0].localeCompare(b[0]));\n return `${metricType}${name}${unit}${stringifiedTags}`;\n}\n\n/* eslint-disable no-bitwise */\n/**\n * Simple hash function for strings.\n */\nfunction simpleHash(s) {\n let rv = 0;\n for (let i = 0; i < s.length; i++) {\n const c = s.charCodeAt(i);\n rv = (rv << 5) - rv + c;\n rv &= rv;\n }\n return rv >>> 0;\n}\n/* eslint-enable no-bitwise */\n\n/**\n * Serialize metrics buckets into a string based on statsd format.\n *\n * Example of format:\n * metric.name@second:1:1.2|d|#a:value,b:anothervalue|T12345677\n * Segments:\n * name: metric.name\n * unit: second\n * value: [1, 1.2]\n * type of metric: d (distribution)\n * tags: { a: value, b: anothervalue }\n * timestamp: 12345677\n */\nfunction serializeMetricBuckets(metricBucketItems) {\n let out = '';\n for (const item of metricBucketItems) {\n const tagEntries = Object.entries(item.tags);\n const maybeTags = tagEntries.length > 0 ? `|#${tagEntries.map(([key, value]) => `${key}:${value}`).join(',')}` : '';\n out += `${item.name}@${item.unit}:${item.metric}|${item.metricType}${maybeTags}|T${item.timestamp}\\n`;\n }\n return out;\n}\n\n/**\n * Sanitizes tags.\n */\nfunction sanitizeTags(unsanitizedTags) {\n const tags = {};\n for (const key in unsanitizedTags) {\n if (Object.prototype.hasOwnProperty.call(unsanitizedTags, key)) {\n const sanitizedKey = key.replace(NAME_AND_TAG_KEY_NORMALIZATION_REGEX, '_');\n tags[sanitizedKey] = String(unsanitizedTags[key]).replace(TAG_VALUE_NORMALIZATION_REGEX, '_');\n }\n }\n return tags;\n}\nexport { getBucketKey, sanitizeTags, serializeMetricBuckets, simpleHash };\n","import { dsnToString, createEnvelope } from '@sentry/utils';\nimport { serializeMetricBuckets } from './utils.js';\n\n/**\n * Create envelope from a metric aggregate.\n */\nfunction createMetricEnvelope(metricBucketItems, dsn, metadata, tunnel) {\n const headers = {\n sent_at: new Date().toISOString()\n };\n if (metadata && metadata.sdk) {\n headers.sdk = {\n name: metadata.sdk.name,\n version: metadata.sdk.version\n };\n }\n if (!!tunnel && dsn) {\n headers.dsn = dsnToString(dsn);\n }\n const item = createMetricEnvelopeItem(metricBucketItems);\n return createEnvelope(headers, [item]);\n}\nfunction createMetricEnvelopeItem(metricBucketItems) {\n const payload = serializeMetricBuckets(metricBucketItems);\n const metricHeaders = {\n type: 'statsd',\n length: payload.length\n };\n return [metricHeaders, payload];\n}\nexport { createMetricEnvelope };\n","import { makeDsn, logger, checkOrSetAlreadyCaught, isParameterizedString, isPrimitive, resolvedSyncPromise, addItemToEnvelope, createAttachmentEnvelopeItem, SyncPromise, rejectedSyncPromise, SentryError, isThenable, isPlainObject } from '@sentry/utils';\nimport { getEnvelopeEndpointWithUrlEncodedAuth } from './api.js';\nimport { DEBUG_BUILD } from './debug-build.js';\nimport { createEventEnvelope, createSessionEnvelope } from './envelope.js';\nimport { getClient } from './exports.js';\nimport { getIsolationScope } from './hub.js';\nimport { setupIntegration, setupIntegrations } from './integration.js';\nimport { createMetricEnvelope } from './metrics/envelope.js';\nimport { updateSession } from './session.js';\nimport { getDynamicSamplingContextFromClient } from './tracing/dynamicSamplingContext.js';\nimport { prepareEvent } from './utils/prepareEvent.js';\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 /**\n * A reference to a metrics aggregator\n *\n * @experimental Note this is alpha API. It may experience breaking changes in the future.\n */\n\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 /** Indicates whether this client's integrations have been set up. */\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._integrationsInitialized = false;\n this._numProcessing = 0;\n this._outcomes = {};\n this._hooks = {};\n this._eventProcessors = [];\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 if (this._dsn) {\n const url = getEnvelopeEndpointWithUrlEncodedAuth(this._dsn, options);\n this._transport = options.transport({\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, @typescript-eslint/explicit-module-boundary-types\n captureException(exception, hint, scope) {\n // ensure we haven't captured this very object before\n if (checkOrSetAlreadyCaught(exception)) {\n DEBUG_BUILD && logger.log(ALREADY_SEEN_ERROR);\n return;\n }\n let eventId = hint && hint.event_id;\n this._process(this.eventFromException(exception, hint).then(event => this._captureEvent(event, hint, scope)).then(result => {\n eventId = result;\n }));\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n captureMessage(message,\n // eslint-disable-next-line deprecation/deprecation\n level, hint, scope) {\n let eventId = hint && hint.event_id;\n const eventMessage = isParameterizedString(message) ? message : String(message);\n const promisedEvent = isPrimitive(message) ? this.eventFromMessage(eventMessage, level, hint) : this.eventFromException(message, hint);\n this._process(promisedEvent.then(event => this._captureEvent(event, hint, scope)).then(result => {\n eventId = result;\n }));\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n captureEvent(event, hint, scope) {\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;\n }\n let eventId = hint && hint.event_id;\n this._process(this._captureEvent(event, hint, scope).then(result => {\n eventId = result;\n }));\n return eventId;\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, {\n init: false\n });\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 if (this.metricsAggregator) {\n this.metricsAggregator.flush();\n }\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 if (this.metricsAggregator) {\n this.metricsAggregator.close();\n }\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 /**\n * This is an internal function to setup all integrations that should run on the client.\n * @deprecated Use `client.init()` instead.\n */\n setupIntegrations(forceInitialize) {\n if (forceInitialize && !this._integrationsInitialized || this._isEnabled() && !this._integrationsInitialized) {\n this._setupIntegrations();\n }\n }\n\n /** @inheritdoc */\n init() {\n if (this._isEnabled()) {\n this._setupIntegrations();\n }\n }\n\n /**\n * Gets an installed integration by its `id`.\n *\n * @returns The installed integration or `undefined` if no integration with that `id` was installed.\n * @deprecated Use `getIntegrationByName()` instead.\n */\n getIntegrationById(integrationId) {\n return this.getIntegrationByName(integrationId);\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 * Returns the client's instance of the given integration class, it any.\n * @deprecated Use `getIntegrationByName()` instead.\n */\n getIntegration(integration) {\n try {\n return this._integrations[integration.id] || null;\n } catch (_oO) {\n DEBUG_BUILD && logger.warn(`Cannot retrieve integration ${integration.id} from the current Client`);\n return null;\n }\n }\n\n /**\n * @inheritDoc\n */\n addIntegration(integration) {\n setupIntegration(this, integration, this._integrations);\n }\n\n /**\n * @inheritDoc\n */\n sendEvent(event, hint = {}) {\n this.emit('beforeSendEvent', event, hint);\n let env = createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel);\n for (const attachment of hint.attachments || []) {\n env = addItemToEnvelope(env, createAttachmentEnvelopeItem(attachment, this._options.transportOptions && this._options.transportOptions.textEncoder));\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 // The following works because undefined + 1 === NaN and NaN is falsy\n this._outcomes[key] = this._outcomes[key] + 1 || 1;\n }\n }\n\n /**\n * @inheritDoc\n */\n captureAggregateMetrics(metricBucketItems) {\n DEBUG_BUILD && logger.log(`Flushing aggregated metrics, number of metrics: ${metricBucketItems.length}`);\n const metricsEnvelope = createMetricEnvelope(metricBucketItems, 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(metricsEnvelope);\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 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\n /** @inheritdoc */\n\n /** @inheritdoc */\n emit(hook, ...rest) {\n if (this._hooks[hook]) {\n this._hooks[hook].forEach(callback => callback(...rest));\n }\n }\n\n /* eslint-enable @typescript-eslint/unified-signatures */\n\n /** Setup integrations for this client. */\n _setupIntegrations() {\n this._integrations = setupIntegrations(this, this._options.integrations);\n // TODO v8: We don't need this flag anymore\n this._integrationsInitialized = true;\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 if (exceptions) {\n errored = true;\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 if (shouldUpdateAndSend) {\n updateSession(session, {\n ...(crashed && {\n status: 'crashed'\n }),\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 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 scope A scope containing event metadata.\n * @returns A new event with more information.\n */\n _prepareEvent(event, hint, scope, isolationScope = getIsolationScope()) {\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 this.emit('preprocessEvent', event, hint);\n return prepareEvent(options, event, hint, scope, this, isolationScope).then(evt => {\n if (evt === null) {\n return evt;\n }\n\n // If a trace context is not set on the event, we use the propagationContext set on the event to\n // generate a trace context. If the propagationContext does not have a dynamic sampling context, we\n // also generate one for it.\n const {\n propagationContext\n } = evt.sdkProcessingMetadata || {};\n const trace = evt.contexts && evt.contexts.trace;\n if (!trace && propagationContext) {\n const {\n traceId: trace_id,\n spanId,\n parentSpanId,\n dsc\n } = propagationContext;\n evt.contexts = {\n trace: {\n trace_id,\n span_id: spanId,\n parent_span_id: parentSpanId\n },\n ...evt.contexts\n };\n const dynamicSamplingContext = dsc ? dsc : getDynamicSamplingContextFromClient(trace_id, this, scope);\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(finalEvent => {\n return finalEvent.event_id;\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 * 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 scope 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, scope) {\n const options = this.getOptions();\n const {\n sampleRate\n } = options;\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 if (isError && typeof sampleRate === 'number' && Math.random() > sampleRate) {\n this.recordDroppedEvent('sample_rate', 'error', event);\n return rejectedSyncPromise(new SentryError(`Discarding event because it's not included in the random sample (sampling rate = ${sampleRate})`, 'log'));\n }\n const dataCategory = eventType === 'replay_event' ? 'replay' : eventType;\n return this._prepareEvent(event, hint, scope).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 const isInternalException = hint.data && hint.data.__sentry__ === true;\n if (isInternalException) {\n return prepared;\n }\n const result = processBeforeSend(options, prepared, hint);\n return _validateBeforeSendResult(result, beforeSendLabel);\n }).then(processedEvent => {\n if (processedEvent === null) {\n this.recordDroppedEvent('before_send', dataCategory, event);\n throw new SentryError(`${beforeSendLabel} returned \\`null\\`, will not send event.`, 'log');\n }\n const session = scope && scope.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 this.sendEvent(processedEvent, hint);\n return processedEvent;\n }).then(null, reason => {\n if (reason instanceof SentryError) {\n throw reason;\n }\n this.captureException(reason, {\n data: {\n __sentry__: true\n },\n originalException: reason\n });\n throw new SentryError(`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 * Occupies the client with processing and event\n */\n _process(promise) {\n this._numProcessing++;\n void promise.then(value => {\n this._numProcessing--;\n return value;\n }, reason => {\n this._numProcessing--;\n return reason;\n });\n }\n\n /**\n * @inheritdoc\n */\n _sendEnvelope(envelope) {\n this.emit('beforeEnvelope', envelope);\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 });\n } else {\n DEBUG_BUILD && logger.error('Transport disabled');\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.keys(outcomes).map(key => {\n const [reason, category] = key.split(':');\n return {\n reason,\n category,\n quantity: outcomes[key]\n };\n });\n }\n\n /**\n * @inheritDoc\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\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(beforeSendResult, beforeSendLabel) {\n const invalidValueError = `${beforeSendLabel} must return \\`null\\` or a valid event.`;\n if (isThenable(beforeSendResult)) {\n return beforeSendResult.then(event => {\n if (!isPlainObject(event) && event !== null) {\n throw new SentryError(invalidValueError);\n }\n return event;\n }, e => {\n throw new SentryError(`${beforeSendLabel} rejected with ${e}`);\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(options, event, hint) {\n const {\n beforeSend,\n beforeSendTransaction\n } = options;\n if (isErrorEvent(event) && beforeSend) {\n return beforeSend(event, hint);\n }\n if (isTransactionEvent(event) && beforeSendTransaction) {\n return beforeSendTransaction(event, hint);\n }\n return event;\n}\nfunction isErrorEvent(event) {\n return event.type === undefined;\n}\nfunction isTransactionEvent(event) {\n return event.type === 'transaction';\n}\n\n/**\n * Add an event processor to the current client.\n * This event processor will run for all events processed by this client.\n */\nfunction addEventProcessor(callback) {\n const client = getClient();\n if (!client || !client.addEventProcessor) {\n return;\n }\n client.addEventProcessor(callback);\n}\nexport { BaseClient, addEventProcessor };\n","import { logger, consoleSandbox } from '@sentry/utils';\nimport { DEBUG_BUILD } from './debug-build.js';\nimport { getCurrentScope } from './exports.js';\nimport { getCurrentHub } from './hub.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(clientClass, options) {\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 const client = new clientClass(options);\n setCurrentClient(client);\n initializeClient(client);\n}\n\n/**\n * Make the given client the current client.\n */\nfunction setCurrentClient(client) {\n // eslint-disable-next-line deprecation/deprecation\n const hub = getCurrentHub();\n // eslint-disable-next-line deprecation/deprecation\n const top = hub.getStackTop();\n top.client = client;\n top.scope.setClient(client);\n}\n\n/**\n * Initialize the client for the current scope.\n * Make sure to call this after `setCurrentClient()`.\n */\nfunction initializeClient(client) {\n if (client.init) {\n client.init();\n // TODO v8: Remove this fallback\n // eslint-disable-next-line deprecation/deprecation\n } else if (client.setupIntegrations) {\n // eslint-disable-next-line deprecation/deprecation\n client.setupIntegrations();\n }\n}\nexport { initAndBind, setCurrentClient };\n","import { makePromiseBuffer, forEachEnvelopeItem, envelopeItemTypeToDataCategory, isRateLimited, resolvedSyncPromise, createEnvelope, SentryError, logger, serializeEnvelope, updateRateLimits } from '@sentry/utils';\nimport { DEBUG_BUILD } from '../debug-build.js';\nconst DEFAULT_TRANSPORT_BUFFER_SIZE = 30;\n\n/**\n * Creates an instance of a Sentry `Transport`\n *\n * @param options\n * @param makeRequest\n */\nfunction createTransport(options, makeRequest, buffer = makePromiseBuffer(options.bufferSize || DEFAULT_TRANSPORT_BUFFER_SIZE)) {\n let rateLimits = {};\n const flush = timeout => buffer.drain(timeout);\n function send(envelope) {\n const filteredEnvelopeItems = [];\n\n // Drop rate limited items from envelope\n forEachEnvelopeItem(envelope, (item, type) => {\n const envelopeItemDataCategory = envelopeItemTypeToDataCategory(type);\n if (isRateLimited(rateLimits, envelopeItemDataCategory)) {\n const event = getEventForEnvelopeItem(item, type);\n options.recordDroppedEvent('ratelimit_backoff', envelopeItemDataCategory, 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 const requestTask = () => makeRequest({\n body: serializeEnvelope(filteredEnvelope, options.textEncoder)\n }).then(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 rateLimits = updateRateLimits(rateLimits, response);\n return response;\n }, error => {\n recordEnvelopeLoss('network_error');\n throw error;\n });\n return buffer.add(requestTask).then(result => result, 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 // We use this to identifify if the transport is the base transport\n // TODO (v8): Remove this again as we'll no longer need it\n send.__sentry__baseTransport__ = true;\n return {\n send,\n flush\n };\n}\nfunction getEventForEnvelopeItem(item, type) {\n if (type !== 'event' && type !== 'transaction') {\n return undefined;\n }\n return Array.isArray(item) ? item[1] : undefined;\n}\nexport { DEFAULT_TRANSPORT_BUFFER_SIZE, createTransport };\n","import { logger, getEventDescription, stringMatchesSomePattern } from '@sentry/utils';\nimport { DEBUG_BUILD } from '../debug-build.js';\nimport { convertIntegrationFnToClass, 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 = [/^Script error\\.?$/, /^Javascript error: Script error\\.? on line 0$/];\nconst DEFAULT_IGNORE_TRANSACTIONS = [/^.*\\/healthcheck$/, /^.*\\/healthy$/, /^.*\\/live$/, /^.*\\/ready$/, /^.*\\/heartbeat$/, /^.*\\/health$/, /^.*\\/healthz$/];\n\n/** Options for the InboundFilters integration */\n\nconst INTEGRATION_NAME = 'InboundFilters';\nconst _inboundFiltersIntegration = (options = {}) => {\n return {\n name: INTEGRATION_NAME,\n // TODO v8: Remove this\n setupOnce() {},\n // eslint-disable-line @typescript-eslint/no-empty-function\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};\nconst inboundFiltersIntegration = defineIntegration(_inboundFiltersIntegration);\n\n/**\n * Inbound filters configurable by the user.\n * @deprecated Use `inboundFiltersIntegration()` instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nconst InboundFilters = convertIntegrationFnToClass(INTEGRATION_NAME, inboundFiltersIntegration);\nfunction _mergeOptions(internalOptions = {}, clientOptions = {}) {\n return {\n allowUrls: [...(internalOptions.allowUrls || []), ...(clientOptions.allowUrls || [])],\n denyUrls: [...(internalOptions.denyUrls || []), ...(clientOptions.denyUrls || [])],\n ignoreErrors: [...(internalOptions.ignoreErrors || []), ...(clientOptions.ignoreErrors || []), ...(internalOptions.disableErrorDefaults ? [] : DEFAULT_IGNORE_ERRORS)],\n ignoreTransactions: [...(internalOptions.ignoreTransactions || []), ...(clientOptions.ignoreTransactions || []), ...(internalOptions.disableTransactionDefaults ? [] : DEFAULT_IGNORE_TRANSACTIONS)],\n ignoreInternal: internalOptions.ignoreInternal !== undefined ? internalOptions.ignoreInternal : true\n };\n}\nfunction _shouldDropEvent(event, options) {\n if (options.ignoreInternal && _isSentryError(event)) {\n DEBUG_BUILD && 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 && logger.warn(`Event dropped due to being matched by \\`ignoreErrors\\` option.\\nEvent: ${getEventDescription(event)}`);\n return true;\n }\n if (_isIgnoredTransaction(event, options.ignoreTransactions)) {\n DEBUG_BUILD && logger.warn(`Event dropped due to being matched by \\`ignoreTransactions\\` option.\\nEvent: ${getEventDescription(event)}`);\n return true;\n }\n if (_isDeniedUrl(event, options.denyUrls)) {\n DEBUG_BUILD && logger.warn(`Event dropped due to being matched by \\`denyUrls\\` option.\\nEvent: ${getEventDescription(event)}.\\nUrl: ${_getEventFilterUrl(event)}`);\n return true;\n }\n if (!_isAllowedUrl(event, options.allowUrls)) {\n DEBUG_BUILD && logger.warn(`Event dropped due to not being matched by \\`allowUrls\\` option.\\nEvent: ${getEventDescription(event)}.\\nUrl: ${_getEventFilterUrl(event)}`);\n return true;\n }\n return false;\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 return _getPossibleEventMessages(event).some(message => stringMatchesSomePattern(message, ignoreErrors));\n}\nfunction _isIgnoredTransaction(event, ignoreTransactions) {\n if (event.type !== 'transaction' || !ignoreTransactions || !ignoreTransactions.length) {\n return false;\n }\n const name = event.transaction;\n return name ? stringMatchesSomePattern(name, ignoreTransactions) : false;\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}\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}\nfunction _getPossibleEventMessages(event) {\n const possibleMessages = [];\n if (event.message) {\n possibleMessages.push(event.message);\n }\n let lastException;\n try {\n // @ts-expect-error Try catching to save bundle size\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\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 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 if (DEBUG_BUILD && possibleMessages.length === 0) {\n logger.error(`Could not extract message for event ${getEventDescription(event)}`);\n }\n return possibleMessages;\n}\nfunction _isSentryError(event) {\n try {\n // @ts-expect-error can't be a sentry error if undefined\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return event.exception.values[0].type === 'SentryError';\n } catch (e) {\n // ignore\n }\n return false;\n}\nfunction _getLastValidUrl(frames = []) {\n for (let i = frames.length - 1; i >= 0; i--) {\n const frame = frames[i];\n if (frame && frame.filename !== '' && frame.filename !== '[native code]') {\n return frame.filename || null;\n }\n }\n return null;\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}\nexport { InboundFilters, inboundFiltersIntegration };\n","import { getOriginalFunction } from '@sentry/utils';\nimport { convertIntegrationFnToClass, defineIntegration } from '../integration.js';\nlet originalFunctionToString;\nconst INTEGRATION_NAME = 'FunctionToString';\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 context = getOriginalFunction(this) || this;\n return originalFunctionToString.apply(context, args);\n };\n } catch (e) {\n // ignore errors here, just don't patch this\n }\n }\n };\n};\nconst functionToStringIntegration = defineIntegration(_functionToStringIntegration);\n\n/**\n * Patch toString calls to return proper name for wrapped functions.\n * @deprecated Use `functionToStringIntegration()` instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nconst FunctionToString = convertIntegrationFnToClass(INTEGRATION_NAME, functionToStringIntegration);\nexport { FunctionToString, functionToStringIntegration };\n","import { applyAggregateErrorsToEvent, exceptionFromError } from '@sentry/utils';\nimport { convertIntegrationFnToClass, defineIntegration } from '../integration.js';\nconst DEFAULT_KEY = 'cause';\nconst DEFAULT_LIMIT = 5;\nconst INTEGRATION_NAME = 'LinkedErrors';\nconst _linkedErrorsIntegration = (options = {}) => {\n const limit = options.limit || DEFAULT_LIMIT;\n const key = options.key || DEFAULT_KEY;\n return {\n name: INTEGRATION_NAME,\n // TODO v8: Remove this\n setupOnce() {},\n // eslint-disable-line @typescript-eslint/no-empty-function\n preprocessEvent(event, hint, client) {\n const options = client.getOptions();\n applyAggregateErrorsToEvent(exceptionFromError, options.stackParser, options.maxValueLength, key, limit, event, hint);\n }\n };\n};\nconst linkedErrorsIntegration = defineIntegration(_linkedErrorsIntegration);\n\n/**\n * Adds SDK info to an event.\n * @deprecated Use `linkedErrorsIntegration()` instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nconst LinkedErrors = convertIntegrationFnToClass(INTEGRATION_NAME, linkedErrorsIntegration);\nexport { LinkedErrors, linkedErrorsIntegration };\n","export { FunctionToString } from './functiontostring.js';\nexport { InboundFilters } from './inboundfilters.js';\nexport { LinkedErrors } from './linkederrors.js';\n\n/* eslint-disable deprecation/deprecation */\n","export { addTracingExtensions, startIdleTransaction } from './tracing/hubextensions.js';\nexport { IdleTransaction, TRACING_DEFAULTS } from './tracing/idletransaction.js';\nexport { Span, spanStatusfromHttpCode } from './tracing/span.js';\nexport { Transaction } from './tracing/transaction.js';\nexport { extractTraceparentData, getActiveTransaction } from './tracing/utils.js';\nexport { SpanStatus } from './tracing/spanstatus.js';\nexport { continueTrace, getActiveSpan, startActiveSpan, startInactiveSpan, startSpan, startSpanManual, trace } from './tracing/trace.js';\nexport { getDynamicSamplingContextFromClient, getDynamicSamplingContextFromSpan } from './tracing/dynamicSamplingContext.js';\nexport { setMeasurement } from './tracing/measurement.js';\nexport { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from './semanticAttributes.js';\nexport { createEventEnvelope, createSessionEnvelope } from './envelope.js';\nexport { addBreadcrumb, captureCheckIn, captureEvent, captureException, captureMessage, captureSession, close, configureScope, endSession, flush, getClient, getCurrentScope, lastEventId, setContext, setExtra, setExtras, setTag, setTags, setUser, startSession, startTransaction, withActiveSpan, withIsolationScope, withMonitor, withScope } from './exports.js';\nexport { Hub, ensureHubOnCarrier, getCurrentHub, getHubFromCarrier, getIsolationScope, getMainCarrier, makeMain, runWithAsyncContext, setAsyncContextStrategy, setHubOnCarrier } from './hub.js';\nexport { closeSession, makeSession, updateSession } from './session.js';\nexport { SessionFlusher } from './sessionflusher.js';\nexport { Scope, getGlobalScope, setGlobalScope } from './scope.js';\nexport { addGlobalEventProcessor, notifyEventProcessors } from './eventProcessors.js';\nexport { getEnvelopeEndpointWithUrlEncodedAuth, getReportDialogEndpoint } from './api.js';\nexport { BaseClient, addEventProcessor } from './baseclient.js';\nexport { ServerRuntimeClient } from './server-runtime-client.js';\nexport { initAndBind, setCurrentClient } from './sdk.js';\nexport { createTransport } from './transports/base.js';\nexport { makeOfflineTransport } from './transports/offline.js';\nexport { makeMultiplexedTransport } from './transports/multiplexed.js';\nexport { SDK_VERSION } from './version.js';\nexport { addIntegration, convertIntegrationFnToClass, defineIntegration, getIntegrationsToSetup } from './integration.js';\nexport { applyScopeDataToEvent, mergeScopeData } from './utils/applyScopeDataToEvent.js';\nexport { prepareEvent } from './utils/prepareEvent.js';\nexport { createCheckInEnvelope } from './checkin.js';\nexport { hasTracingEnabled } from './utils/hasTracingEnabled.js';\nexport { isSentryRequestUrl } from './utils/isSentryRequestUrl.js';\nexport { handleCallbackErrors } from './utils/handleCallbackErrors.js';\nexport { spanIsSampled, spanToJSON, spanToTraceHeader } from './utils/spanUtils.js';\nexport { getRootSpan } from './utils/getRootSpan.js';\nexport { DEFAULT_ENVIRONMENT } from './constants.js';\nexport { ModuleMetadata, moduleMetadataIntegration } from './integrations/metadata.js';\nexport { RequestData, requestDataIntegration } from './integrations/requestdata.js';\nexport { InboundFilters, inboundFiltersIntegration } from './integrations/inboundfilters.js';\nexport { FunctionToString, functionToStringIntegration } from './integrations/functiontostring.js';\nexport { LinkedErrors, linkedErrorsIntegration } from './integrations/linkederrors.js';\nimport * as index from './integrations/index.js';\nexport { metrics } from './metrics/exports.js';\n\n/** @deprecated Import the integration function directly, e.g. `inboundFiltersIntegration()` instead of `new Integrations.InboundFilter(). */\nconst Integrations = index;\nexport { Integrations };\n","import { withScope, captureException } from '@sentry/core';\nimport { GLOBAL_OBJ, getOriginalFunction, markFunctionWrapped, addNonEnumerableProperty, addExceptionTypeValue, addExceptionMechanism } from '@sentry/utils';\nconst WINDOW = GLOBAL_OBJ;\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(fn, options = {}, 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 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 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 withScope(scope => {\n scope.addEventProcessor(event => {\n if (options.mechanism) {\n addExceptionTypeValue(event, undefined, undefined);\n addExceptionMechanism(event, options.mechanism);\n }\n event.extra = {\n ...event.extra,\n arguments: args\n };\n return event;\n });\n captureException(ex);\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 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 return sentryWrapped;\n}\n\n/**\n * All properties the report dialog supports\n *\n * @deprecated This type will be removed in the next major version of the Sentry SDK. `showReportDialog` will still be around, however the `eventId` option will now be required.\n */\n\nexport { WINDOW, ignoreNextOnError, shouldIgnoreOnError, wrap };\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__;\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 const exception = {\n type: ex && ex.name,\n value: extractMessage(ex)\n };\n if (frames.length) {\n exception.stacktrace = {\n frames\n };\n }\n if (exception.type === undefined && exception.value === '') {\n exception.value = 'Unrecoverable error caught';\n }\n return exception;\n}\n\n/**\n * @hidden\n */\nfunction eventFromPlainObject(stackParser, exception, syntheticException, isUnhandledRejection) {\n const client = getClient();\n const normalizeDepth = client && client.getOptions().normalizeDepth;\n const event = {\n exception: {\n values: [{\n type: isEvent(exception) ? exception.constructor.name : isUnhandledRejection ? 'UnhandledRejection' : 'Error',\n value: getNonErrorObjectExceptionValue(exception, {\n isUnhandledRejection\n })\n }]\n },\n extra: {\n __serialized__: normalizeToSize(exception, normalizeDepth)\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 event.exception.values[0].stacktrace = {\n frames\n };\n }\n }\n return event;\n}\n\n/**\n * @hidden\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(stackParser, ex) {\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 const popSize = getPopSize(ex);\n try {\n return stackParser(stacktrace, popSize);\n } catch (e) {\n // no-empty\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;\nfunction getPopSize(ex) {\n if (ex) {\n if (typeof ex.framesToPop === 'number') {\n return ex.framesToPop;\n }\n if (reactMinifiedRegexp.test(ex.message)) {\n return 1;\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(stackParser, exception, hint, attachStacktrace) {\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(stackParser, message,\n// eslint-disable-next-line deprecation/deprecation\nlevel = 'info', hint, attachStacktrace) {\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(stackParser, exception, syntheticException, attachStacktrace, isUnhandledRejection) {\n let event;\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 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 = {\n ...event.tags,\n '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 return event;\n}\n\n/**\n * @hidden\n */\nfunction eventFromString(stackParser, message, syntheticException, attachStacktrace) {\n const event = {};\n if (attachStacktrace && syntheticException) {\n const frames = parseStackFrames(stackParser, syntheticException);\n if (frames.length) {\n event.exception = {\n values: [{\n value: message,\n stacktrace: {\n frames\n }\n }]\n };\n }\n }\n if (isParameterizedString(message)) {\n const {\n __sentry_template_string__,\n __sentry_template_values__\n } = message;\n event.logentry = {\n message: __sentry_template_string__,\n params: __sentry_template_values__\n };\n return event;\n }\n event.message = message;\n return event;\n}\nfunction getNonErrorObjectExceptionValue(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 if (isEvent(exception)) {\n const className = getObjectClassName(exception);\n return `Event \\`${className}\\` (type=${exception.type}) captured as ${captureType}`;\n }\n return `Object captured as ${captureType} with keys: ${keys}`;\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}\nexport { eventFromError, eventFromException, eventFromMessage, eventFromPlainObject, eventFromString, eventFromUnknownInput, exceptionFromError, parseStackFrames };\n","import { dsnToString, createEnvelope } from '@sentry/utils';\n\n/**\n * Creates an envelope from a user feedback.\n */\nfunction createUserFeedbackEnvelope(feedback, {\n metadata,\n tunnel,\n dsn\n}) {\n const headers = {\n event_id: feedback.event_id,\n sent_at: new Date().toISOString(),\n ...(metadata && metadata.sdk && {\n sdk: {\n name: metadata.sdk.name,\n version: metadata.sdk.version\n }\n }),\n ...(!!tunnel && !!dsn && {\n dsn: dsnToString(dsn)\n })\n };\n const item = createUserFeedbackEnvelopeItem(feedback);\n return createEnvelope(headers, [item]);\n}\nfunction createUserFeedbackEnvelopeItem(feedback) {\n const feedbackHeaders = {\n type: 'user_report'\n };\n return [feedbackHeaders, feedback];\n}\nexport { createUserFeedbackEnvelope };\n","import { BaseClient, SDK_VERSION } 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 sdkSource = WINDOW.SENTRY_SDK_SOURCE || getSDKSource();\n options._metadata = options._metadata || {};\n options._metadata.sdk = options._metadata.sdk || {\n name: 'sentry.javascript.browser',\n packages: [{\n name: `${sdkSource}:@sentry/browser`,\n version: SDK_VERSION\n }],\n version: SDK_VERSION\n };\n super(options);\n if (options.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(message,\n // eslint-disable-next-line deprecation/deprecation\n level = 'info', hint) {\n return eventFromMessage(this._options.stackParser, message, level, hint, this._options.attachStacktrace);\n }\n\n /**\n * Sends user feedback to Sentry.\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 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 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 DEBUG_BUILD && logger.log('Sending outcomes:', outcomes);\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}\nexport { BrowserClient };\n","import { isNativeFetch, logger } from '@sentry/utils';\nimport { DEBUG_BUILD } from '../debug-build.js';\nimport { WINDOW } from '../helpers.js';\nlet cachedFetchImpl = undefined;\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 getNativeFetchImplementation() {\n if (cachedFetchImpl) {\n return cachedFetchImpl;\n }\n\n /* eslint-disable @typescript-eslint/unbound-method */\n\n // Fast path to avoid DOM I/O\n if (isNativeFetch(WINDOW.fetch)) {\n return cachedFetchImpl = WINDOW.fetch.bind(WINDOW);\n }\n const document = WINDOW.document;\n let fetchImpl = WINDOW.fetch;\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.fetch) {\n fetchImpl = contentWindow.fetch;\n }\n document.head.removeChild(sandbox);\n } catch (e) {\n DEBUG_BUILD && logger.warn('Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ', e);\n }\n }\n return cachedFetchImpl = fetchImpl.bind(WINDOW);\n /* eslint-enable @typescript-eslint/unbound-method */\n}\n\n/** Clears cached fetch impl */\nfunction clearCachedFetchImplementation() {\n cachedFetchImpl = undefined;\n}\nexport { clearCachedFetchImplementation, getNativeFetchImplementation };\n","import { createTransport } from '@sentry/core';\nimport { rejectedSyncPromise } from '@sentry/utils';\nimport { getNativeFetchImplementation, clearCachedFetchImplementation } from './utils.js';\n\n/**\n * Creates a Transport that uses the Fetch API to send events to Sentry.\n */\nfunction makeFetchTransport(options, nativeFetch = getNativeFetchImplementation()) {\n let pendingBodySize = 0;\n let pendingCount = 0;\n function makeRequest(request) {\n const requestSize = request.body.length;\n pendingBodySize += requestSize;\n pendingCount++;\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 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 clearCachedFetchImplementation();\n pendingBodySize -= requestSize;\n pendingCount--;\n return rejectedSyncPromise(e);\n }\n }\n return createTransport(options, makeRequest);\n}\nexport { makeFetchTransport };\n","import { createTransport } from '@sentry/core';\nimport { SyncPromise } from '@sentry/utils';\n\n/**\n * The DONE ready state for XmlHttpRequest\n *\n * Defining it here as a constant b/c XMLHttpRequest.DONE is not always defined\n * (e.g. during testing, it is `undefined`)\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/readyState}\n */\nconst XHR_READYSTATE_DONE = 4;\n\n/**\n * Creates a Transport that uses the XMLHttpRequest API to send events to Sentry.\n */\nfunction makeXHRTransport(options) {\n function makeRequest(request) {\n return new SyncPromise((resolve, reject) => {\n const xhr = new XMLHttpRequest();\n xhr.onerror = reject;\n xhr.onreadystatechange = () => {\n if (xhr.readyState === XHR_READYSTATE_DONE) {\n resolve({\n statusCode: xhr.status,\n headers: {\n 'x-sentry-rate-limits': xhr.getResponseHeader('X-Sentry-Rate-Limits'),\n 'retry-after': xhr.getResponseHeader('Retry-After')\n }\n });\n }\n };\n xhr.open('POST', options.url);\n for (const header in options.headers) {\n if (Object.prototype.hasOwnProperty.call(options.headers, header)) {\n xhr.setRequestHeader(header, options.headers[header]);\n }\n }\n xhr.send(request.body);\n });\n }\n return createTransport(options, makeRequest);\n}\nexport { makeXHRTransport };\n","import { createStackParser } from '@sentry/utils';\n\n// global reference to slice\nconst UNKNOWN_FUNCTION = '?';\nconst OPERA10_PRIORITY = 10;\nconst OPERA11_PRIORITY = 20;\nconst CHROME_PRIORITY = 30;\nconst WINJS_PRIORITY = 40;\nconst GECKO_PRIORITY = 50;\nfunction createFrame(filename, func, lineno, colno) {\n const frame = {\n filename,\n 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 if (colno !== undefined) {\n frame.colno = colno;\n }\n return frame;\n}\n\n// Chromium based browsers: Chrome, Brave, new Opera, new Edge\nconst chromeRegex = /^\\s*at (?:(.+?\\)(?: \\[.+\\])?|.*?) ?\\((?:address at )?)?(?:async )?((?:|[-a-z]+:|.*bundle|\\/)?.*?)(?::(\\d+))?(?::(\\d+))?\\)?\\s*$/i;\nconst chromeEvalRegex = /\\((\\S*)(?::(\\d+))(?::(\\d+))\\)/;\nconst chrome = line => {\n const parts = chromeRegex.exec(line);\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 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 return createFrame(filename, func, parts[3] ? +parts[3] : undefined, parts[4] ? +parts[4] : undefined);\n }\n return;\n};\nconst chromeStackLineParser = [CHROME_PRIORITY, chrome];\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 = /^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)?((?:[-a-z]+)?:\\/.*?|\\[native code\\]|[^@]*(?:bundle|\\d+\\.js)|\\/[\\w\\-. /=]+)(?::(\\d+))?(?::(\\d+))?\\s*$/i;\nconst geckoEvalRegex = /(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;\nconst gecko = line => {\n const parts = geckoREgex.exec(line);\n if (parts) {\n const isEval = parts[3] && parts[3].indexOf(' > eval') > -1;\n if (isEval) {\n const subMatch = geckoEvalRegex.exec(parts[3]);\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 return createFrame(filename, func, parts[4] ? +parts[4] : undefined, parts[5] ? +parts[5] : undefined);\n }\n return;\n};\nconst geckoStackLineParser = [GECKO_PRIORITY, gecko];\nconst winjsRegex = /^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:[-a-z]+):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;\nconst winjs = line => {\n const parts = winjsRegex.exec(line);\n return parts ? createFrame(parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : undefined) : undefined;\n};\nconst winjsStackLineParser = [WINJS_PRIORITY, winjs];\nconst opera10Regex = / line (\\d+).*script (?:in )?(\\S+)(?:: in function (\\S+))?$/i;\nconst opera10 = line => {\n const parts = opera10Regex.exec(line);\n return parts ? createFrame(parts[2], parts[3] || UNKNOWN_FUNCTION, +parts[1]) : undefined;\n};\nconst opera10StackLineParser = [OPERA10_PRIORITY, opera10];\nconst opera11Regex = / line (\\d+), column (\\d+)\\s*(?:in (?:]+)>|([^)]+))\\(.*\\))? in (.*):\\s*$/i;\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};\nconst opera11StackLineParser = [OPERA11_PRIORITY, opera11];\nconst defaultStackLineParsers = [chromeStackLineParser, geckoStackLineParser, winjsStackLineParser];\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 return isSafariExtension || isSafariWebExtension ? [func.indexOf('@') !== -1 ? func.split('@')[0] : UNKNOWN_FUNCTION, isSafariExtension ? `safari-extension:${filename}` : `safari-web-extension:${filename}`] : [func, filename];\n};\nexport { chromeStackLineParser, defaultStackLineParsers, defaultStackParser, geckoStackLineParser, opera10StackLineParser, opera11StackLineParser, winjsStackLineParser };\n","import { convertIntegrationFnToClass, getClient, captureEvent } from '@sentry/core';\nimport { addGlobalErrorInstrumentationHandler, isString, addGlobalUnhandledRejectionInstrumentationHandler, isPrimitive, isErrorEvent, getLocationHref, logger } from '@sentry/utils';\nimport { DEBUG_BUILD } from '../debug-build.js';\nimport { eventFromUnknownInput } from '../eventbuilder.js';\nimport { shouldIgnoreOnError } from '../helpers.js';\n\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n\nconst INTEGRATION_NAME = 'GlobalHandlers';\nconst globalHandlersIntegration = (options = {}) => {\n const _options = {\n onerror: true,\n onunhandledrejection: true,\n ...options\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\n/** Global handlers */\n// eslint-disable-next-line deprecation/deprecation\nconst GlobalHandlers = convertIntegrationFnToClass(INTEGRATION_NAME, globalHandlersIntegration);\nfunction _installGlobalOnErrorHandler(client) {\n addGlobalErrorInstrumentationHandler(data => {\n const {\n stackParser,\n attachStacktrace\n } = getOptions();\n if (getClient() !== client || shouldIgnoreOnError()) {\n return;\n }\n const {\n msg,\n url,\n line,\n column,\n error\n } = data;\n const event = error === undefined && isString(msg) ? _eventFromIncompleteOnError(msg, url, line, column) : _enhanceEventWithInitialFrame(eventFromUnknownInput(stackParser, error || msg, undefined, attachStacktrace, false), url, line, column);\n event.level = 'error';\n captureEvent(event, {\n originalException: error,\n mechanism: {\n handled: false,\n type: 'onerror'\n }\n });\n });\n}\nfunction _installGlobalOnUnhandledRejectionHandler(client) {\n addGlobalUnhandledRejectionInstrumentationHandler(e => {\n const {\n stackParser,\n attachStacktrace\n } = getOptions();\n if (getClient() !== client || shouldIgnoreOnError()) {\n return;\n }\n const error = _getUnhandledRejectionError(e);\n const event = isPrimitive(error) ? _eventFromRejectionWithPrimitive(error) : eventFromUnknownInput(stackParser, error, undefined, attachStacktrace, true);\n event.level = 'error';\n captureEvent(event, {\n originalException: error,\n mechanism: {\n handled: false,\n type: 'onunhandledrejection'\n }\n });\n });\n}\nfunction _getUnhandledRejectionError(error) {\n if (isPrimitive(error)) {\n return error;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const e = error;\n\n // dig the object of the rejection out of known event types\n try {\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 e) {\n return e.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 else if ('detail' in e && 'reason' in e.detail) {\n return e.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 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 * This function creates a stack from an old, error-less onerror handler.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _eventFromIncompleteOnError(msg, url, line, column) {\n const ERROR_TYPES_RE = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;\n\n // If 'message' is ErrorEvent, get real message from inside\n let message = isErrorEvent(msg) ? msg.message : msg;\n let name = 'Error';\n const groups = message.match(ERROR_TYPES_RE);\n if (groups) {\n name = groups[1];\n message = groups[2];\n }\n const event = {\n exception: {\n values: [{\n type: name,\n value: message\n }]\n }\n };\n return _enhanceEventWithInitialFrame(event, url, line, column);\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 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: '?',\n in_app: true,\n lineno\n });\n }\n return event;\n}\nfunction globalHandlerLog(type) {\n DEBUG_BUILD && logger.log(`Global Handler attached: ${type}`);\n}\nfunction getOptions() {\n const client = getClient();\n const options = client && client.getOptions() || {\n stackParser: () => [],\n attachStacktrace: false\n };\n return options;\n}\nexport { GlobalHandlers };\n","import { convertIntegrationFnToClass } from '@sentry/core';\nimport { fill, getFunctionName, getOriginalFunction } from '@sentry/utils';\nimport { WINDOW, wrap } from '../helpers.js';\nconst DEFAULT_EVENT_TARGET = ['EventTarget', 'Window', 'Node', 'ApplicationCache', 'AudioTrackList', 'BroadcastChannel', 'ChannelMergerNode', 'CryptoOperation', 'EventSource', 'FileReader', 'HTMLUnknownElement', 'IDBDatabase', 'IDBRequest', 'IDBTransaction', 'KeyOperation', 'MediaController', 'MessagePort', 'ModalWindow', 'Notification', 'SVGElementInstance', 'Screen', 'SharedWorker', 'TextTrack', 'TextTrackCue', 'TextTrackList', 'WebSocket', 'WebSocketWorker', 'Worker', 'XMLHttpRequest', 'XMLHttpRequestEventTarget', 'XMLHttpRequestUpload'];\nconst INTEGRATION_NAME = 'TryCatch';\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 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 if (_options.setInterval) {\n fill(WINDOW, 'setInterval', _wrapTimeFunction);\n }\n if (_options.requestAnimationFrame) {\n fill(WINDOW, 'requestAnimationFrame', _wrapRAF);\n }\n if (_options.XMLHttpRequest && 'XMLHttpRequest' in WINDOW) {\n fill(XMLHttpRequest.prototype, 'send', _wrapXHR);\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/** Wrap timer functions and event targets to catch errors and provide better meta data */\n// eslint-disable-next-line deprecation/deprecation\nconst TryCatch = convertIntegrationFnToClass(INTEGRATION_NAME, browserApiErrorsIntegration);\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: {\n function: getFunctionName(original)\n },\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, [wrap(callback, {\n mechanism: {\n data: {\n function: 'requestAnimationFrame',\n handler: getFunctionName(original)\n },\n handled: false,\n type: 'instrument'\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 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 TryCatch, 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 return originalSend.apply(this, args);\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 fill(proto, 'addEventListener', function (original) {\n return function (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n\n eventName, fn, options) {\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 return original.apply(this, [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 }), options]);\n };\n });\n fill(proto, 'removeEventListener', function (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, fn, options) {\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}\nexport { TryCatch };\n","import { convertIntegrationFnToClass, getClient, addBreadcrumb } from '@sentry/core';\nimport { addConsoleInstrumentationHandler, addClickKeypressInstrumentationHandler, addXhrInstrumentationHandler, addFetchInstrumentationHandler, addHistoryInstrumentationHandler, getEventDescription, logger, htmlTreeAsString, getComponentName, severityLevelFromString, safeJoin, SENTRY_XHR_DATA_KEY, parseUrl } from '@sentry/utils';\nimport { DEBUG_BUILD } from '../debug-build.js';\nimport { WINDOW } from '../helpers.js';\n\n/* eslint-disable max-lines */\n\n/** maxStringLength gets capped to prevent 100 breadcrumbs exceeding 1MB event payload size */\nconst MAX_ALLOWED_STRING_LENGTH = 1024;\nconst INTEGRATION_NAME = 'Breadcrumbs';\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 return {\n name: INTEGRATION_NAME,\n // TODO v8: Remove this\n setupOnce() {},\n // eslint-disable-line @typescript-eslint/no-empty-function\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 && client.on) {\n client.on('beforeSendEvent', _getSentryBreadcrumbHandler(client));\n }\n }\n };\n};\n\n/**\n * Default Breadcrumbs instrumentations\n */\n// eslint-disable-next-line deprecation/deprecation\nconst Breadcrumbs = convertIntegrationFnToClass(INTEGRATION_NAME, 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 addBreadcrumb({\n category: `sentry.${event.type === 'transaction' ? 'transaction' : 'event'}`,\n event_id: event.event_id,\n level: event.level,\n message: getEventDescription(event)\n }, {\n event\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(client, dom) {\n return function _innerDomBreadcrumb(handlerData) {\n if (getClient() !== client) {\n return;\n }\n let target;\n let componentName;\n let keyAttrs = typeof dom === 'object' ? dom.serializeAttribute : undefined;\n let maxStringLength = typeof dom === 'object' && typeof dom.maxStringLength === 'number' ? dom.maxStringLength : undefined;\n if (maxStringLength && maxStringLength > MAX_ALLOWED_STRING_LENGTH) {\n DEBUG_BUILD && logger.warn(`\\`dom.maxStringLength\\` cannot exceed ${MAX_ALLOWED_STRING_LENGTH}, but a value of ${maxStringLength} was configured. Sentry will use ${MAX_ALLOWED_STRING_LENGTH} instead.`);\n maxStringLength = MAX_ALLOWED_STRING_LENGTH;\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 target = htmlTreeAsString(element, {\n keyAttrs,\n maxStringLength\n });\n componentName = getComponentName(element);\n } catch (e) {\n target = '';\n }\n if (target.length === 0) {\n return;\n }\n const breadcrumb = {\n category: `ui.${handlerData.name}`,\n message: target\n };\n if (componentName) {\n breadcrumb.data = {\n '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 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 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 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 const {\n startTimestamp,\n endTimestamp\n } = handlerData;\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 const {\n method,\n url,\n status_code,\n body\n } = sentryXhrData;\n const data = {\n method,\n url,\n status_code\n };\n const hint = {\n xhr: handlerData.xhr,\n input: body,\n startTimestamp,\n endTimestamp\n };\n addBreadcrumb({\n category: 'xhr',\n data,\n type: 'http'\n }, hint);\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 const {\n startTimestamp,\n endTimestamp\n } = handlerData;\n\n // We only capture complete fetch requests\n if (!endTimestamp) {\n return;\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 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 addBreadcrumb({\n category: 'fetch',\n data,\n level: 'error',\n type: 'http'\n }, hint);\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 category: 'fetch',\n data,\n type: 'http'\n }, hint);\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 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 addBreadcrumb({\n category: 'navigation',\n data: {\n from,\n to\n }\n });\n };\n}\nfunction _isEvent(event) {\n return !!event && !!event.target;\n}\nexport { Breadcrumbs };\n","import { convertIntegrationFnToClass } from '@sentry/core';\nimport { applyAggregateErrorsToEvent } from '@sentry/utils';\nimport { exceptionFromError } from '../eventbuilder.js';\nconst DEFAULT_KEY = 'cause';\nconst DEFAULT_LIMIT = 5;\nconst INTEGRATION_NAME = 'LinkedErrors';\nconst linkedErrorsIntegration = (options = {}) => {\n const limit = options.limit || DEFAULT_LIMIT;\n const key = options.key || DEFAULT_KEY;\n return {\n name: INTEGRATION_NAME,\n // TODO v8: Remove this\n setupOnce() {},\n // eslint-disable-line @typescript-eslint/no-empty-function\n preprocessEvent(event, hint, client) {\n const options = client.getOptions();\n applyAggregateErrorsToEvent(\n // This differs from the LinkedErrors integration in core by using a different exceptionFromError function\n exceptionFromError, options.stackParser, options.maxValueLength, key, limit, event, hint);\n }\n };\n};\n\n/** Aggregrate linked errors in an event. */\n// eslint-disable-next-line deprecation/deprecation\nconst LinkedErrors = convertIntegrationFnToClass(INTEGRATION_NAME, linkedErrorsIntegration);\nexport { LinkedErrors };\n","import { convertIntegrationFnToClass } from '@sentry/core';\nimport { WINDOW } from '../helpers.js';\nconst INTEGRATION_NAME = 'HttpContext';\nconst httpContextIntegration = () => {\n return {\n name: INTEGRATION_NAME,\n // TODO v8: Remove this\n setupOnce() {},\n // eslint-disable-line @typescript-eslint/no-empty-function\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 {\n referrer\n } = WINDOW.document || {};\n const {\n userAgent\n } = WINDOW.navigator || {};\n const headers = {\n ...(event.request && event.request.headers),\n ...(referrer && {\n Referer: referrer\n }),\n ...(userAgent && {\n 'User-Agent': userAgent\n })\n };\n const request = {\n ...event.request,\n ...(url && {\n url\n }),\n headers\n };\n event.request = request;\n }\n };\n};\n\n/** HttpContext integration collects information about HTTP request headers */\n// eslint-disable-next-line deprecation/deprecation\nconst HttpContext = convertIntegrationFnToClass(INTEGRATION_NAME, httpContextIntegration);\nexport { HttpContext };\n","import { convertIntegrationFnToClass } from '@sentry/core';\nimport { logger } from '@sentry/utils';\nimport { DEBUG_BUILD } from '../debug-build.js';\nconst INTEGRATION_NAME = 'Dedupe';\nconst dedupeIntegration = () => {\n let previousEvent;\n return {\n name: INTEGRATION_NAME,\n // TODO v8: Remove this\n setupOnce() {},\n // eslint-disable-line @typescript-eslint/no-empty-function\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/** Deduplication filter */\n// eslint-disable-next-line deprecation/deprecation\nconst Dedupe = convertIntegrationFnToClass(INTEGRATION_NAME, dedupeIntegration);\nfunction _shouldDropEvent(currentEvent, previousEvent) {\n if (!previousEvent) {\n return false;\n }\n if (_isSameMessageEvent(currentEvent, previousEvent)) {\n return true;\n }\n if (_isSameExceptionEvent(currentEvent, previousEvent)) {\n return true;\n }\n return false;\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 if (currentMessage !== previousMessage) {\n return false;\n }\n if (!_isSameFingerprint(currentEvent, previousEvent)) {\n return false;\n }\n if (!_isSameStacktrace(currentEvent, previousEvent)) {\n return false;\n }\n return true;\n}\nfunction _isSameExceptionEvent(currentEvent, previousEvent) {\n const previousException = _getExceptionFromEvent(previousEvent);\n const currentException = _getExceptionFromEvent(currentEvent);\n if (!previousException || !currentException) {\n return false;\n }\n if (previousException.type !== currentException.type || previousException.value !== currentException.value) {\n return false;\n }\n if (!_isSameFingerprint(currentEvent, previousEvent)) {\n return false;\n }\n if (!_isSameStacktrace(currentEvent, previousEvent)) {\n return false;\n }\n return true;\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 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 const frameA = previousFrames[i];\n const frameB = currentFrames[i];\n if (frameA.filename !== frameB.filename || frameA.lineno !== frameB.lineno || frameA.colno !== frameB.colno || frameA.function !== frameB.function) {\n return false;\n }\n }\n return true;\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 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}\nfunction _getExceptionFromEvent(event) {\n return event.exception && event.exception.values && event.exception.values[0];\n}\nfunction _getFramesFromEvent(event) {\n const exception = event.exception;\n if (exception) {\n try {\n // @ts-expect-error Object could be undefined\n return exception.values[0].stacktrace.frames;\n } catch (_oO) {\n return undefined;\n }\n }\n return undefined;\n}\nexport { Dedupe };\n","import { InboundFilters, FunctionToString, getIntegrationsToSetup, initAndBind, getReportDialogEndpoint, getCurrentHub, startSession, captureSession, getClient } from '@sentry/core';\nimport { stackParserFromStackParserOptions, supportsFetch, logger, addHistoryInstrumentationHandler } from '@sentry/utils';\nimport { BrowserClient } from './client.js';\nimport { DEBUG_BUILD } from './debug-build.js';\nimport { WINDOW, wrap as wrap$1 } from './helpers.js';\nimport { GlobalHandlers } from './integrations/globalhandlers.js';\nimport { TryCatch } from './integrations/trycatch.js';\nimport { Breadcrumbs } from './integrations/breadcrumbs.js';\nimport { LinkedErrors } from './integrations/linkederrors.js';\nimport { HttpContext } from './integrations/httpcontext.js';\nimport { Dedupe } from './integrations/dedupe.js';\nimport { defaultStackParser } from './stack-parsers.js';\nimport { makeFetchTransport } from './transports/fetch.js';\nimport { makeXHRTransport } from './transports/xhr.js';\n\n/* eslint-disable deprecation/deprecation */\nconst defaultIntegrations = [new InboundFilters(), new FunctionToString(), new TryCatch(), new Breadcrumbs(), new GlobalHandlers(), new LinkedErrors(), new Dedupe(), new HttpContext()];\n/* eslint-enable deprecation/deprecation */\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 { configureScope } from '@sentry/browser';\n * configureScope((scope: Scope) => {\n * scope.setExtra({ battery: 0.7 });\n * scope.setTag({ user_mode: 'admin' });\n * scope.setUser({ id: '4711' });\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(options = {}) {\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = defaultIntegrations;\n }\n if (options.release === undefined) {\n // This allows build tooling to find-and-replace __SENTRY_RELEASE__ to inject a release value\n if (typeof __SENTRY_RELEASE__ === 'string') {\n options.release = __SENTRY_RELEASE__;\n }\n\n // This supports the variable that sentry-webpack-plugin injects\n if (WINDOW.SENTRY_RELEASE && WINDOW.SENTRY_RELEASE.id) {\n options.release = WINDOW.SENTRY_RELEASE.id;\n }\n }\n if (options.autoSessionTracking === undefined) {\n options.autoSessionTracking = true;\n }\n if (options.sendClientReports === undefined) {\n options.sendClientReports = true;\n }\n const clientOptions = {\n ...options,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations: getIntegrationsToSetup(options),\n transport: options.transport || (supportsFetch() ? makeFetchTransport : makeXHRTransport)\n };\n initAndBind(BrowserClient, clientOptions);\n if (options.autoSessionTracking) {\n startSessionTracking();\n }\n}\nconst showReportDialog = (\n// eslint-disable-next-line deprecation/deprecation\noptions = {},\n// eslint-disable-next-line deprecation/deprecation\nhub = getCurrentHub()) => {\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 // eslint-disable-next-line deprecation/deprecation\n const {\n client,\n scope\n } = hub.getStackTop();\n const dsn = options.dsn || client && client.getDsn();\n if (!dsn) {\n DEBUG_BUILD && logger.error('DSN not configured for showReportDialog call');\n return;\n }\n if (scope) {\n options.user = {\n ...scope.getUser(),\n ...options.user\n };\n }\n\n // TODO(v8): Remove this entire if statement. `eventId` will be a required option.\n // eslint-disable-next-line deprecation/deprecation\n if (!options.eventId) {\n // eslint-disable-next-line deprecation/deprecation\n options.eventId = hub.lastEventId();\n }\n const script = WINDOW.document.createElement('script');\n script.async = true;\n script.crossOrigin = 'anonymous';\n script.src = getReportDialogEndpoint(dsn, options);\n if (options.onLoad) {\n script.onload = options.onLoad;\n }\n const {\n onClose\n } = 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 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 * Wrap code within a try/catch block so the SDK is able to capture errors.\n *\n * @deprecated This function will be removed in v8.\n * It is not part of Sentry's official API and it's easily replaceable by using a try/catch block\n * and calling Sentry.captureException.\n *\n * @param fn A function to wrap.\n *\n * @returns The result of wrapped function call.\n */\n// TODO(v8): Remove this function\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction wrap(fn) {\n return wrap$1(fn)();\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({\n ignoreDuration: true\n });\n captureSession();\n\n // We want to create a session for every navigation as well\n addHistoryInstrumentationHandler(({\n from,\n to\n }) => {\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({\n ignoreDuration: true\n });\n captureSession();\n }\n });\n}\n\n/**\n * Captures user feedback and sends it to Sentry.\n */\nfunction captureUserFeedback(feedback) {\n const client = getClient();\n if (client) {\n client.captureUserFeedback(feedback);\n }\n}\nexport { captureUserFeedback, defaultIntegrations, forceLoad, init, onLoad, showReportDialog, wrap };\n","export { GlobalHandlers } from './globalhandlers.js';\nexport { TryCatch } from './trycatch.js';\nexport { Breadcrumbs } from './breadcrumbs.js';\nexport { LinkedErrors } from './linkederrors.js';\nexport { HttpContext } from './httpcontext.js';\nexport { Dedupe } from './dedupe.js';\n","import { Integrations } from '@sentry/core';\nexport { FunctionToString, Hub, InboundFilters, ModuleMetadata, SDK_VERSION, Scope, addBreadcrumb, addEventProcessor, addGlobalEventProcessor, addIntegration, addTracingExtensions, captureEvent, captureException, captureMessage, close, configureScope, continueTrace, createTransport, extractTraceparentData, flush, functionToStringIntegration, getActiveSpan, getActiveTransaction, getClient, getCurrentHub, getCurrentScope, getHubFromCarrier, inboundFiltersIntegration, lastEventId, makeMain, makeMultiplexedTransport, metrics, moduleMetadataIntegration, setContext, setCurrentClient, setExtra, setExtras, setMeasurement, setTag, setTags, setUser, spanStatusfromHttpCode, startInactiveSpan, startSpan, startSpanManual, startTransaction, trace, withIsolationScope, withScope } from '@sentry/core';\nimport { WINDOW } from './helpers.js';\nexport { WINDOW } from './helpers.js';\nexport { BrowserClient } from './client.js';\nexport { makeFetchTransport } from './transports/fetch.js';\nexport { makeXHRTransport } from './transports/xhr.js';\nexport { chromeStackLineParser, defaultStackLineParsers, defaultStackParser, geckoStackLineParser, opera10StackLineParser, opera11StackLineParser, winjsStackLineParser } from './stack-parsers.js';\nexport { eventFromException, eventFromMessage, exceptionFromError } from './eventbuilder.js';\nexport { createUserFeedbackEnvelope } from './userfeedback.js';\nexport { captureUserFeedback, defaultIntegrations, forceLoad, init, onLoad, showReportDialog, wrap } from './sdk.js';\nimport * as index from './integrations/index.js';\nexport { Replay } from '@sentry/replay';\nexport { ReplayCanvas } from '@sentry-internal/replay-canvas';\nexport { Feedback, sendFeedback } from '@sentry-internal/feedback';\nexport { BrowserTracing, defaultRequestInstrumentationOptions, instrumentOutgoingRequests } from '@sentry-internal/tracing';\nexport { makeBrowserOfflineTransport } from './transports/offline.js';\nexport { onProfilingStartRouteTransaction } from './profiling/hubextensions.js';\nexport { BrowserProfilingIntegration } from './profiling/integration.js';\nexport { GlobalHandlers } from './integrations/globalhandlers.js';\nexport { TryCatch } from './integrations/trycatch.js';\nexport { Breadcrumbs } from './integrations/breadcrumbs.js';\nexport { LinkedErrors } from './integrations/linkederrors.js';\nexport { HttpContext } from './integrations/httpcontext.js';\nexport { Dedupe } from './integrations/dedupe.js';\nlet windowIntegrations = {};\n\n// This block is needed to add compatibility with the integrations packages when used with a CDN\nif (WINDOW.Sentry && WINDOW.Sentry.Integrations) {\n windowIntegrations = WINDOW.Sentry.Integrations;\n}\nconst INTEGRATIONS = {\n ...windowIntegrations,\n // eslint-disable-next-line deprecation/deprecation\n ...Integrations,\n ...index\n};\nexport { INTEGRATIONS as Integrations };\n","import * as Sentry from '@sentry/browser';\nimport { defaultIntegrations, SDK_VERSION, init as init$1, setContext, WINDOW, getCurrentScope } from '@sentry/browser';\nexport * from '@sentry/browser';\nimport * as i0 from '@angular/core';\nimport { VERSION, Injectable, Inject, Directive, Input, NgModule } from '@angular/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 { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, spanToJSON } from '@sentry/core';\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 * Inits the Angular SDK\n */\nfunction init(options) {\n const opts = Object.assign({\n _metadata: {},\n // Filter out TryCatch integration as it interferes with our Angular `ErrorHandler`:\n // TryCatch would catch certain errors before they reach the `ErrorHandler` and thus provide a\n // lower fidelity error than what `SentryErrorHandler` (see errorhandler.ts) would provide.\n // see:\n // - https://github.com/getsentry/sentry-javascript/issues/5417#issuecomment-1453407097\n // - https://github.com/getsentry/sentry-javascript/issues/2744\n defaultIntegrations: defaultIntegrations.filter(integration => {\n return integration.name !== 'TryCatch';\n })\n }, options);\n opts._metadata.sdk = opts._metadata.sdk || {\n name: 'sentry.javascript.angular-ivy',\n packages: [{\n name: 'npm:@sentry/angular-ivy',\n version: SDK_VERSION\n }],\n version: SDK_VERSION\n };\n checkAndSetAngularVersion();\n init$1(opts);\n}\nfunction checkAndSetAngularVersion() {\n const ANGULAR_MINIMUM_VERSION = 12;\n const angularVersion = VERSION && VERSION.major ? parseInt(VERSION.major, 10) : undefined;\n if (angularVersion) {\n if (angularVersion < ANGULAR_MINIMUM_VERSION) {\n IS_DEBUG_BUILD && 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 Angular 10 or 11, please use `@sentry/angular` instead.\", 'Otherwise, please consider upgrading your Angular version.');\n }\n setContext('angular', {\n version: angularVersion\n });\n }\n}\n\n// There're 2 types of Angular applications:\n// 1) zone-full (by default)\n// 2) zone-less\n// The developer can avoid importing the `zone.js` package and tells Angular that\n// he is responsible for running the change detection by himself. This is done by\n// \"nooping\" the zone through `CompilerOptions` when bootstrapping the root module.\n// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\nconst isNgZoneEnabled = typeof Zone !== 'undefined' && !!Zone.current;\n/**\n * The function that does the same job as `NgZone.runOutsideAngular`.\n */\nfunction runOutsideAngular(callback) {\n // The `Zone.root.run` basically will run the `callback` in the most parent zone.\n // Any asynchronous API used inside the `callback` won't catch Angular's zone\n // since `Zone.current` will reference `Zone.root`.\n // The Angular's zone is forked from the `Zone.root`. In this case, `zone.js` won't\n // trigger change detection, and `ApplicationRef.tick()` will not be run.\n // Caretaker note: we're using `Zone.root` except `NgZone.runOutsideAngular` since this\n // will require injecting the `NgZone` facade. That will create a breaking change for\n // projects already using the `@sentry/angular`.\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 ? error.ngOriginalError : 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) && isString(candidate.message) && (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 */\nlet SentryErrorHandler = /*#__PURE__*/(() => {\n class SentryErrorHandler {\n constructor(options) {\n this._registeredAfterSendEventHandler = false;\n this._options = Object.assign({\n logErrors: true\n }, options);\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: {\n type: 'angular',\n handled: false\n }\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 && client.on && !this._registeredAfterSendEventHandler) {\n client.on('afterSendEvent', event => {\n if (!event.type) {\n // eslint-disable-next-line deprecation/deprecation\n Sentry.showReportDialog(Object.assign(Object.assign({}, this._options.dialogOptions), {\n 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 } else if (!client || !client.on) {\n Sentry.showReportDialog(Object.assign(Object.assign({}, this._options.dialogOptions), {\n 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 }\n SentryErrorHandler.ɵfac = function SentryErrorHandler_Factory(t) {\n return new (t || SentryErrorHandler)(i0.ɵɵinject('errorHandlerOptions'));\n };\n SentryErrorHandler.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: SentryErrorHandler,\n factory: SentryErrorHandler.ɵfac,\n providedIn: 'root'\n });\n return SentryErrorHandler;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Factory function that creates an instance of a preconfigured ErrorHandler provider.\n */\nfunction createErrorHandler(config) {\n return new SentryErrorHandler(config);\n}\nconst ANGULAR_ROUTING_OP = 'ui.angular.routing';\nconst ANGULAR_INIT_OP = 'ui.angular.init';\nconst ANGULAR_OP = 'ui.angular';\nlet instrumentationInitialized;\nlet stashedStartTransaction;\nlet stashedStartTransactionOnLocationChange;\n/**\n * Creates routing instrumentation for Angular Router.\n */\nfunction routingInstrumentation(customStartTransaction, startTransactionOnPageLoad = true, startTransactionOnLocationChange = true) {\n instrumentationInitialized = true;\n stashedStartTransaction = customStartTransaction;\n stashedStartTransactionOnLocationChange = startTransactionOnLocationChange;\n if (startTransactionOnPageLoad && WINDOW && WINDOW.location) {\n customStartTransaction({\n name: WINDOW.location.pathname,\n op: 'pageload',\n origin: 'auto.pageload.angular',\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url'\n }\n });\n }\n}\nconst instrumentAngularRouting = routingInstrumentation;\n/**\n * Grabs active transaction off scope.\n *\n * @deprecated You should not rely on the transaction, but just use `startSpan()` APIs instead.\n */\nfunction getActiveTransaction() {\n // eslint-disable-next-line deprecation/deprecation\n return getCurrentScope().getTransaction();\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 */\nlet TraceService = /*#__PURE__*/(() => {\n class 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 && logger.error('Angular integration has tracing enabled, but Tracing integration is not configured');\n return;\n }\n const strippedUrl = stripUrlQueryAndFragment(navigationEvent.url);\n // eslint-disable-next-line deprecation/deprecation\n let activeTransaction = getActiveTransaction();\n if (!activeTransaction && stashedStartTransactionOnLocationChange) {\n activeTransaction = stashedStartTransaction({\n name: strippedUrl,\n op: 'navigation',\n origin: 'auto.navigation.angular',\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url'\n }\n });\n }\n if (activeTransaction) {\n if (this._routingSpan) {\n this._routingSpan.end();\n }\n // eslint-disable-next-line deprecation/deprecation\n this._routingSpan = activeTransaction.startChild({\n description: `${navigationEvent.url}`,\n op: ANGULAR_ROUTING_OP,\n origin: 'auto.ui.angular',\n tags: Object.assign({\n 'routing.instrumentation': '@sentry/angular',\n url: strippedUrl\n }, navigationEvent.navigationTrigger && {\n navigationTrigger: navigationEvent.navigationTrigger\n })\n });\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 // eslint-disable-next-line deprecation/deprecation\n const transaction = getActiveTransaction();\n // TODO (v8 / #5416): revisit the source condition. Do we want to make the parameterized route the default?\n const attributes = transaction && spanToJSON(transaction).data || {};\n if (transaction && attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] === 'url') {\n transaction.updateName(route);\n transaction.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route');\n }\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._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 TraceService.ɵfac = function TraceService_Factory(t) {\n return new (t || TraceService)(i0.ɵɵinject(i1.Router));\n };\n TraceService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: TraceService,\n factory: TraceService.ɵfac,\n providedIn: 'root'\n });\n return TraceService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst UNKNOWN_COMPONENT = 'unknown';\n/**\n * A directive that can be used to capture initialization lifecycle of the whole component.\n */\nlet TraceDirective = /*#__PURE__*/(() => {\n class TraceDirective {\n /**\n * Implementation of OnInit lifecycle method\n * @inheritdoc\n */\n ngOnInit() {\n if (!this.componentName) {\n this.componentName = UNKNOWN_COMPONENT;\n }\n // eslint-disable-next-line deprecation/deprecation\n const activeTransaction = getActiveTransaction();\n if (activeTransaction) {\n // eslint-disable-next-line deprecation/deprecation\n this._tracingSpan = activeTransaction.startChild({\n description: `<${this.componentName}>`,\n op: ANGULAR_INIT_OP,\n 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 this._tracingSpan.end();\n }\n }\n }\n TraceDirective.ɵfac = function TraceDirective_Factory(t) {\n return new (t || TraceDirective)();\n };\n TraceDirective.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: TraceDirective,\n selectors: [[\"\", \"trace\", \"\"]],\n inputs: {\n componentName: [\"trace\", \"componentName\"]\n }\n });\n return TraceDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * A module serves as a single compilation unit for the `TraceDirective` and can be re-used by any other module.\n */\nlet TraceModule = /*#__PURE__*/(() => {\n class TraceModule {}\n TraceModule.ɵfac = function TraceModule_Factory(t) {\n return new (t || TraceModule)();\n };\n TraceModule.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: TraceModule\n });\n TraceModule.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({});\n return TraceModule;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Decorator function that can be used to capture initialization lifecycle of the whole component.\n */\nfunction TraceClassDecorator() {\n let tracingSpan;\n /* eslint-disable @typescript-eslint/no-unsafe-member-access */\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\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 // eslint-disable-next-line deprecation/deprecation\n const activeTransaction = getActiveTransaction();\n if (activeTransaction) {\n // eslint-disable-next-line deprecation/deprecation\n tracingSpan = activeTransaction.startChild({\n description: `<${target.name}>`,\n op: ANGULAR_INIT_OP,\n 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 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 TraceMethodDecorator() {\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @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 // eslint-disable-next-line deprecation/deprecation\n const activeTransaction = getActiveTransaction();\n if (activeTransaction) {\n // eslint-disable-next-line deprecation/deprecation\n activeTransaction.startChild({\n description: `<${target.constructor.name}>`,\n endTimestamp: now,\n op: `${ANGULAR_OP}.${String(propertyKey)}`,\n origin: 'auto.ui.angular.trace_method_decorator',\n startTimestamp: now\n });\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, TraceClassDecorator, TraceDirective, TraceMethodDecorator, TraceModule, TraceService, createErrorHandler, getActiveTransaction, init, instrumentAngularRouting, routingInstrumentation };\n","import * as i0 from '@angular/core';\nimport { InjectionToken, Injectable, Inject, Directive, Input, NgModule } from '@angular/core';\nimport { BehaviorSubject, ReplaySubject } from 'rxjs';\nimport { filter, map, delay } from 'rxjs/operators';\nimport * as i1 from '@angular/router';\nimport { NavigationEnd, NavigationStart, NavigationError } from '@angular/router';\nimport * as i2 from '@angular/common';\nimport * as i2$1 from '@angular/platform-browser';\nclass DefaultConfig {\n constructor() {\n this.pageTracking = {\n autoTrackVirtualPages: true,\n basePath: '',\n excludedRoutes: [],\n clearIds: false,\n clearHash: false,\n clearQueryParams: false,\n idsRegExp: /^\\d+$|^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/\n };\n this.developerMode = false;\n this.ga = {};\n this.appInsights = {};\n this.gtm = {};\n this.gst = {};\n }\n}\nconst ANGULARTICS2_TOKEN = new InjectionToken('ANGULARTICS2');\nclass RouterlessTracking {\n trackLocation(settings) {\n return new BehaviorSubject({\n url: '/'\n });\n }\n prepareExternalUrl(url) {\n return url;\n }\n}\nlet Angulartics2 = /*#__PURE__*/(() => {\n class Angulartics2 {\n constructor(tracker, setup) {\n this.tracker = tracker;\n this.pageTrack = new ReplaySubject(10);\n this.eventTrack = new ReplaySubject(10);\n this.exceptionTrack = new ReplaySubject(10);\n this.setAlias = new ReplaySubject(10);\n this.setUsername = new ReplaySubject(10);\n this.setUserProperties = new ReplaySubject(10);\n this.setUserPropertiesOnce = new ReplaySubject(10);\n this.setSuperProperties = new ReplaySubject(10);\n this.setSuperPropertiesOnce = new ReplaySubject(10);\n this.userTimings = new ReplaySubject(10);\n const defaultConfig = new DefaultConfig();\n this.settings = {\n ...defaultConfig,\n ...setup.settings\n };\n this.settings.pageTracking = {\n ...defaultConfig.pageTracking,\n ...setup.settings.pageTracking\n };\n this.tracker.trackLocation(this.settings).subscribe(event => this.trackUrlChange(event.url));\n }\n /** filters all events when developer mode is true */\n filterDeveloperMode() {\n return filter((value, index) => !this.settings.developerMode);\n }\n trackUrlChange(url) {\n if (this.settings.pageTracking.autoTrackVirtualPages && !this.matchesExcludedRoute(url)) {\n const clearedUrl = this.clearUrl(url);\n let path;\n if (this.settings.pageTracking.basePath.length) {\n path = this.settings.pageTracking.basePath + clearedUrl;\n } else {\n path = this.tracker.prepareExternalUrl(clearedUrl);\n }\n this.pageTrack.next({\n path\n });\n }\n }\n /**\n * Use string literals or regular expressions to exclude routes\n * from automatic pageview tracking.\n *\n * @param url location\n */\n matchesExcludedRoute(url) {\n for (const excludedRoute of this.settings.pageTracking.excludedRoutes) {\n const matchesRegex = excludedRoute instanceof RegExp && excludedRoute.test(url);\n if (matchesRegex || url.indexOf(excludedRoute) !== -1) {\n return true;\n }\n }\n return false;\n }\n /**\n * Removes id's from tracked route.\n * EX: `/project/12981/feature` becomes `/project/feature`\n *\n * @param url current page path\n */\n clearUrl(url) {\n if (this.settings.pageTracking.clearIds || this.settings.pageTracking.clearQueryParams || this.settings.pageTracking.clearHash) {\n return url.split('/').map(part => this.settings.pageTracking.clearQueryParams ? part.split('?')[0] : part).map(part => this.settings.pageTracking.clearHash ? part.split('#')[0] : part).filter(part => !this.settings.pageTracking.clearIds || !part.match(this.settings.pageTracking.idsRegExp)).join('/');\n }\n return url;\n }\n }\n Angulartics2.ɵfac = function Angulartics2_Factory(t) {\n return new (t || Angulartics2)(i0.ɵɵinject(RouterlessTracking), i0.ɵɵinject(ANGULARTICS2_TOKEN));\n };\n Angulartics2.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2,\n factory: Angulartics2.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Track Route changes for applications using Angular's\n * default router\n *\n * @link https://angular.io/api/router/Router\n */\nlet AngularRouterTracking = /*#__PURE__*/(() => {\n class AngularRouterTracking {\n constructor(router, location) {\n this.router = router;\n this.location = location;\n }\n trackLocation(settings) {\n return this.router.events.pipe(filter(e => e instanceof NavigationEnd), filter(() => !settings.developerMode), map(e => {\n return {\n url: e.urlAfterRedirects\n };\n }), delay(0));\n }\n prepareExternalUrl(url) {\n return this.location.prepareExternalUrl(url);\n }\n }\n AngularRouterTracking.ɵfac = function AngularRouterTracking_Factory(t) {\n return new (t || AngularRouterTracking)(i0.ɵɵinject(i1.Router), i0.ɵɵinject(i2.Location));\n };\n AngularRouterTracking.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: AngularRouterTracking,\n factory: AngularRouterTracking.ɵfac,\n providedIn: 'root'\n });\n return AngularRouterTracking;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Angulartics2On = /*#__PURE__*/(() => {\n class Angulartics2On {\n constructor(elRef, angulartics2, renderer) {\n this.elRef = elRef;\n this.angulartics2 = angulartics2;\n this.renderer = renderer;\n this.angularticsProperties = {};\n }\n ngAfterContentInit() {\n this.renderer.listen(this.elRef.nativeElement, this.angulartics2On || 'click', event => this.eventTrack(event));\n }\n eventTrack(event) {\n const action = this.angularticsAction; // || this.inferEventName();\n const properties = {\n ...this.angularticsProperties,\n eventType: event.type\n };\n if (this.angularticsCategory) {\n properties.category = this.angularticsCategory;\n }\n if (this.angularticsLabel) {\n properties.label = this.angularticsLabel;\n }\n if (this.angularticsValue) {\n properties.value = this.angularticsValue;\n }\n this.angulartics2.eventTrack.next({\n action,\n properties\n });\n }\n }\n Angulartics2On.ɵfac = function Angulartics2On_Factory(t) {\n return new (t || Angulartics2On)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(Angulartics2), i0.ɵɵdirectiveInject(i0.Renderer2));\n };\n Angulartics2On.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: Angulartics2On,\n selectors: [[\"\", \"angulartics2On\", \"\"]],\n inputs: {\n angulartics2On: \"angulartics2On\",\n angularticsAction: \"angularticsAction\",\n angularticsCategory: \"angularticsCategory\",\n angularticsLabel: \"angularticsLabel\",\n angularticsValue: \"angularticsValue\",\n angularticsProperties: \"angularticsProperties\"\n }\n });\n return Angulartics2On;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Angulartics2OnModule = /*#__PURE__*/(() => {\n class Angulartics2OnModule {}\n Angulartics2OnModule.ɵfac = function Angulartics2OnModule_Factory(t) {\n return new (t || Angulartics2OnModule)();\n };\n Angulartics2OnModule.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: Angulartics2OnModule\n });\n Angulartics2OnModule.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({});\n return Angulartics2OnModule;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Angulartics2Module = /*#__PURE__*/(() => {\n class Angulartics2Module {\n static forRoot(settings = {}) {\n return {\n ngModule: Angulartics2Module,\n providers: [{\n provide: ANGULARTICS2_TOKEN,\n useValue: {\n settings\n }\n }, {\n provide: RouterlessTracking,\n useClass: AngularRouterTracking\n }, Angulartics2]\n };\n }\n }\n Angulartics2Module.ɵfac = function Angulartics2Module_Factory(t) {\n return new (t || Angulartics2Module)();\n };\n Angulartics2Module.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: Angulartics2Module\n });\n Angulartics2Module.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({\n imports: [[Angulartics2OnModule]]\n });\n return Angulartics2Module;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Angulartics2RouterlessModule = /*#__PURE__*/(() => {\n class Angulartics2RouterlessModule {\n static forRoot(settings = {}) {\n return {\n ngModule: Angulartics2RouterlessModule,\n providers: [{\n provide: ANGULARTICS2_TOKEN,\n useValue: {\n settings\n }\n }, RouterlessTracking, Angulartics2]\n };\n }\n }\n Angulartics2RouterlessModule.ɵfac = function Angulartics2RouterlessModule_Factory(t) {\n return new (t || Angulartics2RouterlessModule)();\n };\n Angulartics2RouterlessModule.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: Angulartics2RouterlessModule\n });\n Angulartics2RouterlessModule.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({\n imports: [[Angulartics2OnModule]]\n });\n return Angulartics2RouterlessModule;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Angulartics2AdobeAnalytics = /*#__PURE__*/(() => {\n class Angulartics2AdobeAnalytics {\n constructor(angulartics2, location) {\n this.angulartics2 = angulartics2;\n this.location = location;\n this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));\n }\n startTracking() {\n this.angulartics2.pageTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.pageTrack(x.path));\n this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.eventTrack(x.action, x.properties));\n }\n pageTrack(path) {\n if (typeof s !== 'undefined' && s) {\n s.clearVars();\n s.t({\n pageName: path\n });\n }\n }\n /**\n * Track Event in Adobe Analytics\n *\n * @param action associated with the event\n * @param properties action detials\n *\n * @link https://marketing.adobe.com/resources/help/en_US/sc/implement/js_implementation.html\n */\n eventTrack(action, properties) {\n // TODO: make interface\n // @property {string} properties.category\n // @property {string} properties.label\n // @property {number} properties.value\n // @property {boolean} properties.noninteraction\n if (!properties) {\n properties = properties || {};\n }\n if (typeof s !== 'undefined' && s) {\n if (typeof properties === 'object') {\n this.setUserProperties(properties);\n }\n if (action) {\n // if linkName property is passed, use that; otherwise, the action is the linkName\n const linkName = properties['linkName'] ? properties['linkName'] : action;\n // note that 'this' should refer the link element, but we can't get that in this function. example:\n // \n // if disableDelay property is passed, use that to turn off/on the 500ms delay; otherwise, it uses this\n const disableDelay = !!properties['disableDelay'] ? true : this;\n // if action property is passed, use that; otherwise, the action remains unchanged\n if (properties['action']) {\n action = properties['action'];\n }\n this.setPageName();\n if (action.toUpperCase() === 'DOWNLOAD') {\n s.tl(disableDelay, 'd', linkName);\n } else if (action.toUpperCase() === 'EXIT') {\n s.tl(disableDelay, 'e', linkName);\n } else {\n s.tl(disableDelay, 'o', linkName);\n }\n }\n }\n }\n setPageName() {\n const path = this.location.path(true);\n const hashNdx = path.indexOf('#');\n if (hashNdx > 0 && hashNdx < path.length) {\n s.pageName = path.substring(hashNdx + 1);\n } else {\n s.pageName = path;\n }\n }\n setUserProperties(properties) {\n if (typeof s !== 'undefined' && s) {\n if (typeof properties === 'object') {\n for (const key in properties) {\n if (properties.hasOwnProperty(key)) {\n s[key] = properties[key];\n }\n }\n }\n }\n }\n }\n Angulartics2AdobeAnalytics.ɵfac = function Angulartics2AdobeAnalytics_Factory(t) {\n return new (t || Angulartics2AdobeAnalytics)(i0.ɵɵinject(Angulartics2), i0.ɵɵinject(i2.Location));\n };\n Angulartics2AdobeAnalytics.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2AdobeAnalytics,\n factory: Angulartics2AdobeAnalytics.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2AdobeAnalytics;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nclass AppInsightsDefaults {\n constructor() {\n this.userId = null;\n }\n}\nlet Angulartics2AppInsights = /*#__PURE__*/(() => {\n class Angulartics2AppInsights {\n constructor(angulartics2, title, router) {\n this.angulartics2 = angulartics2;\n this.title = title;\n this.router = router;\n this.loadStartTime = null;\n this.loadTime = null;\n this.metrics = null;\n this.dimensions = null;\n this.measurements = null;\n if (typeof appInsights === 'undefined') {\n console.warn('appInsights not found');\n }\n const defaults = new AppInsightsDefaults();\n // Set the default settings for this module\n this.angulartics2.settings.appInsights = {\n ...defaults,\n ...this.angulartics2.settings.appInsights\n };\n this.angulartics2.setUsername.subscribe(x => this.setUsername(x));\n this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));\n }\n startTracking() {\n this.angulartics2.pageTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.pageTrack(x.path));\n this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.eventTrack(x.action, x.properties));\n this.angulartics2.exceptionTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.exceptionTrack(x));\n this.router.events.pipe(this.angulartics2.filterDeveloperMode(), filter(event => event instanceof NavigationStart)).subscribe(event => this.startTimer());\n this.router.events.pipe(filter(event => event instanceof NavigationError || event instanceof NavigationEnd)).subscribe(error => this.stopTimer());\n }\n startTimer() {\n this.loadStartTime = Date.now();\n this.loadTime = null;\n }\n stopTimer() {\n this.loadTime = Date.now() - this.loadStartTime;\n this.loadStartTime = null;\n }\n /**\n * Page Track in Baidu Analytics\n *\n * @param path - Location 'path'\n *\n * @link https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md#trackpageview\n */\n pageTrack(path) {\n appInsights.trackPageView(this.title.getTitle(), path, this.dimensions, this.metrics, this.loadTime);\n }\n /**\n * Log a user action or other occurrence.\n *\n * @param name Name to identify this event in the portal.\n * @param properties Additional data used to filter events and metrics in the portal. Defaults to empty.\n *\n * @link https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md#trackevent\n */\n eventTrack(name, properties) {\n appInsights.trackEvent(name, properties, this.measurements);\n }\n /**\n * Exception Track Event in GA\n *\n * @param properties - Comprised of the mandatory fields 'appId' (string), 'appName' (string) and 'appVersion' (string) and\n * optional fields 'fatal' (boolean) and 'description' (string), error\n *\n * @link https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md#trackexception\n */\n exceptionTrack(properties) {\n const description = properties.event || properties.description || properties;\n appInsights.trackException(description);\n }\n /**\n * @link https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md#setauthenticatedusercontext\n */\n setUsername(userId) {\n this.angulartics2.settings.appInsights.userId = userId;\n appInsights.setAuthenticatedUserContext(userId);\n }\n setUserProperties(properties) {\n if (properties.userId) {\n this.angulartics2.settings.appInsights.userId = properties.userId;\n }\n if (properties.accountId) {\n appInsights.setAuthenticatedUserContext(this.angulartics2.settings.appInsights.userId, properties.accountId);\n } else {\n appInsights.setAuthenticatedUserContext(this.angulartics2.settings.appInsights.userId);\n }\n }\n }\n Angulartics2AppInsights.ɵfac = function Angulartics2AppInsights_Factory(t) {\n return new (t || Angulartics2AppInsights)(i0.ɵɵinject(Angulartics2), i0.ɵɵinject(i2$1.Title), i0.ɵɵinject(i1.Router));\n };\n Angulartics2AppInsights.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2AppInsights,\n factory: Angulartics2AppInsights.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2AppInsights;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Angulartics2BaiduAnalytics = /*#__PURE__*/(() => {\n class Angulartics2BaiduAnalytics {\n constructor(angulartics2) {\n this.angulartics2 = angulartics2;\n if (typeof _hmt === 'undefined') {\n _hmt = [];\n } else {\n _hmt.push(['_setAutoPageview', false]);\n }\n this.angulartics2.setUsername.subscribe(x => this.setUsername(x));\n this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));\n }\n startTracking() {\n this.angulartics2.pageTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.pageTrack(x.path));\n this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.eventTrack(x.action, x.properties));\n }\n /**\n * Page Track in Baidu Analytics\n *\n * @param path Required url 'path'\n *\n * @link http://tongji.baidu.com/open/api/more?p=ref_trackPageview\n */\n pageTrack(path) {\n if (typeof _hmt !== 'undefined' && _hmt) {\n _hmt.push(['_trackPageview', path]);\n }\n }\n /**\n * Track Event in Baidu Analytics\n *\n * @param action Name associated with the event\n * @param properties Comprised of:\n * - 'category' (string)\n * - 'opt_label' (string)\n * - 'opt_value' (string)\n *\n * @link http://tongji.baidu.com/open/api/more?p=ref_trackEvent\n */\n eventTrack(action, properties) {\n // baidu analytics requires category\n if (!properties || !properties.category) {\n properties = properties || {};\n properties.category = 'Event';\n properties.opt_label = 'default';\n properties.opt_value = 'default';\n }\n if (typeof _hmt !== 'undefined' && _hmt) {\n _hmt.push(['_trackEvent', properties.category, action, properties.opt_label, properties.opt_value]);\n }\n }\n setUsername(userId) {\n // set default custom variables name to 'identity' and 'value'\n _hmt.push(['_setCustomVar', 1, 'identity', userId]);\n }\n setUserProperties(properties) {\n _hmt.push(['_setCustomVar', 2, 'user', JSON.stringify(properties)]);\n }\n }\n Angulartics2BaiduAnalytics.ɵfac = function Angulartics2BaiduAnalytics_Factory(t) {\n return new (t || Angulartics2BaiduAnalytics)(i0.ɵɵinject(Angulartics2));\n };\n Angulartics2BaiduAnalytics.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2BaiduAnalytics,\n factory: Angulartics2BaiduAnalytics.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2BaiduAnalytics;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst facebookEventList = ['ViewContent', 'Search', 'AddToCart', 'AddToWishlist', 'InitiateCheckout', 'AddPaymentInfo', 'Purchase', 'Lead', 'CompleteRegistration'];\nlet Angulartics2Facebook = /*#__PURE__*/(() => {\n class Angulartics2Facebook {\n constructor(angulartics2) {\n this.angulartics2 = angulartics2;\n }\n startTracking() {\n this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.eventTrack(x.action, x.properties));\n }\n /**\n * Send interactions to the Pixel, i.e. for event tracking in Pixel\n *\n * @param action action associated with the event\n */\n eventTrack(action, properties = {}) {\n if (typeof fbq === 'undefined') {\n return;\n }\n if (facebookEventList.indexOf(action) === -1) {\n return fbq('trackCustom', action, properties);\n }\n return fbq('track', action, properties);\n }\n }\n Angulartics2Facebook.ɵfac = function Angulartics2Facebook_Factory(t) {\n return new (t || Angulartics2Facebook)(i0.ɵɵinject(Angulartics2));\n };\n Angulartics2Facebook.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2Facebook,\n factory: Angulartics2Facebook.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2Facebook;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nclass GoogleAnalyticsDefaults {\n constructor() {\n this.additionalAccountNames = [];\n this.userId = null;\n this.transport = '';\n this.anonymizeIp = false;\n }\n}\nlet Angulartics2GoogleAnalytics = /*#__PURE__*/(() => {\n class Angulartics2GoogleAnalytics {\n constructor(angulartics2) {\n this.angulartics2 = angulartics2;\n this.dimensionsAndMetrics = [];\n const defaults = new GoogleAnalyticsDefaults();\n // Set the default settings for this module\n this.angulartics2.settings.ga = {\n ...defaults,\n ...this.angulartics2.settings.ga\n };\n this.settings = this.angulartics2.settings.ga;\n this.angulartics2.setUsername.subscribe(x => this.setUsername(x));\n this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));\n }\n startTracking() {\n this.angulartics2.pageTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.pageTrack(x.path));\n this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.eventTrack(x.action, x.properties));\n this.angulartics2.exceptionTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.exceptionTrack(x));\n this.angulartics2.userTimings.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.userTimings(x));\n }\n pageTrack(path) {\n if (typeof _gaq !== 'undefined' && _gaq) {\n _gaq.push(['_trackPageview', path]);\n for (const accountName of this.angulartics2.settings.ga.additionalAccountNames) {\n _gaq.push([accountName + '._trackPageview', path]);\n }\n }\n if (typeof ga !== 'undefined' && ga) {\n if (this.angulartics2.settings.ga.userId) {\n ga('set', '&uid', this.angulartics2.settings.ga.userId);\n for (const accountName of this.angulartics2.settings.ga.additionalAccountNames) {\n ga(accountName + '.set', '&uid', this.angulartics2.settings.ga.userId);\n }\n }\n if (this.angulartics2.settings.ga.anonymizeIp) {\n ga('set', 'anonymizeIp', true);\n for (const accountName of this.angulartics2.settings.ga.additionalAccountNames) {\n ga(accountName + '.set', 'anonymizeIp', true);\n }\n }\n ga('send', 'pageview', path);\n for (const accountName of this.angulartics2.settings.ga.additionalAccountNames) {\n ga(accountName + '.send', 'pageview', path);\n }\n }\n }\n /**\n * Track Event in GA\n *\n * @param action Associated with the event\n * @param properties Comprised of:\n * - category (string) and optional\n * - label (string)\n * - value (integer)\n * - noninteraction (boolean)\n *\n * @link https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide#SettingUpEventTracking\n * @link https://developers.google.com/analytics/devguides/collection/analyticsjs/events\n */\n eventTrack(action, properties) {\n // Google Analytics requires an Event Category\n if (!properties || !properties.category) {\n properties = properties || {};\n properties.category = 'Event';\n }\n // GA requires that eventValue be an integer, see:\n // https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#eventValue\n // https://github.com/luisfarzati/angulartics/issues/81\n if (properties.value) {\n const parsed = parseInt(properties.value, 10);\n properties.value = isNaN(parsed) ? 0 : parsed;\n }\n if (typeof ga !== 'undefined') {\n const eventOptions = {\n eventCategory: properties.category,\n eventAction: action,\n eventLabel: properties.label,\n eventValue: properties.value,\n nonInteraction: properties.noninteraction,\n page: properties.page || location.hash.substring(1) || location.pathname,\n userId: this.angulartics2.settings.ga.userId,\n hitCallback: properties.hitCallback,\n ...(this.angulartics2.settings.ga.transport && {\n transport: this.angulartics2.settings.ga.transport\n })\n };\n // add custom dimensions and metrics\n this.setDimensionsAndMetrics(properties);\n ga('send', 'event', eventOptions);\n for (const accountName of this.angulartics2.settings.ga.additionalAccountNames) {\n ga(accountName + '.send', 'event', eventOptions);\n }\n } else if (typeof _gaq !== 'undefined') {\n _gaq.push(['_trackEvent', properties.category, action, properties.label, properties.value, properties.noninteraction]);\n }\n }\n /**\n * Exception Track Event in GA\n *\n * @param properties Comprised of the optional fields:\n * - fatal (string)\n * - description (string)\n *\n * @https://developers.google.com/analytics/devguides/collection/analyticsjs/exceptions\n *\n * @link https://developers.google.com/analytics/devguides/collection/analyticsjs/events\n */\n exceptionTrack(properties) {\n if (properties.fatal === undefined) {\n console.log('No \"fatal\" provided, sending with fatal=true');\n properties.fatal = true;\n }\n properties.exDescription = properties.description;\n const eventOptions = {\n exFatal: properties.fatal,\n exDescription: properties.description\n };\n ga('send', 'exception', eventOptions);\n for (const accountName of this.angulartics2.settings.ga.additionalAccountNames) {\n ga(accountName + '.send', 'exception', eventOptions);\n }\n }\n /**\n * User Timings Event in GA\n *\n * @param properties Comprised of the mandatory fields:\n * - timingCategory (string)\n * - timingVar (string)\n * - timingValue (number)\n * Properties can also have the optional fields:\n * - timingLabel (string)\n *\n * @link https://developers.google.com/analytics/devguides/collection/analyticsjs/user-timings\n */\n userTimings(properties) {\n if (!properties || !properties.timingCategory || !properties.timingVar || !properties.timingValue) {\n console.error('Properties timingCategory, timingVar, and timingValue are required to be set.');\n return;\n }\n if (typeof ga !== 'undefined') {\n ga('send', 'timing', properties);\n for (const accountName of this.angulartics2.settings.ga.additionalAccountNames) {\n ga(accountName + '.send', 'timing', properties);\n }\n }\n }\n setUsername(userId) {\n this.angulartics2.settings.ga.userId = userId;\n if (typeof ga === 'undefined') {\n return;\n }\n ga('set', 'userId', userId);\n }\n setUserProperties(properties) {\n this.setDimensionsAndMetrics(properties);\n }\n setDimensionsAndMetrics(properties) {\n if (typeof ga === 'undefined') {\n return;\n }\n // clean previously used dimensions and metrics that will not be overriden\n this.dimensionsAndMetrics.forEach(elem => {\n if (!properties.hasOwnProperty(elem)) {\n ga('set', elem, undefined);\n this.angulartics2.settings.ga.additionalAccountNames.forEach(accountName => {\n ga(`${accountName}.set`, elem, undefined);\n });\n }\n });\n this.dimensionsAndMetrics = [];\n // add custom dimensions and metrics\n Object.keys(properties).forEach(key => {\n if (key.lastIndexOf('dimension', 0) === 0 || key.lastIndexOf('metric', 0) === 0) {\n ga('set', key, properties[key]);\n this.angulartics2.settings.ga.additionalAccountNames.forEach(accountName => {\n ga(`${accountName}.set`, key, properties[key]);\n });\n this.dimensionsAndMetrics.push(key);\n }\n });\n }\n }\n Angulartics2GoogleAnalytics.ɵfac = function Angulartics2GoogleAnalytics_Factory(t) {\n return new (t || Angulartics2GoogleAnalytics)(i0.ɵɵinject(Angulartics2));\n };\n Angulartics2GoogleAnalytics.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2GoogleAnalytics,\n factory: Angulartics2GoogleAnalytics.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2GoogleAnalytics;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Angulartics2GoogleAnalyticsEnhancedEcommerce = /*#__PURE__*/(() => {\n class Angulartics2GoogleAnalyticsEnhancedEcommerce {\n /**\n * Add impression in GA enhanced ecommerce tracking\n * @link https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#measuring-activities\n */\n ecAddImpression(properties) {\n ga('ec:addImpression', properties);\n }\n /**\n * Add product in GA enhanced ecommerce tracking\n * @link https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce\n */\n ecAddProduct(product) {\n ga('ec:addProduct', product);\n }\n /**\n * Set action in GA enhanced ecommerce tracking\n * @link https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce\n */\n ecSetAction(action, properties) {\n ga('ec:setAction', action, properties);\n }\n }\n Angulartics2GoogleAnalyticsEnhancedEcommerce.ɵfac = function Angulartics2GoogleAnalyticsEnhancedEcommerce_Factory(t) {\n return new (t || Angulartics2GoogleAnalyticsEnhancedEcommerce)();\n };\n Angulartics2GoogleAnalyticsEnhancedEcommerce.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2GoogleAnalyticsEnhancedEcommerce,\n factory: Angulartics2GoogleAnalyticsEnhancedEcommerce.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2GoogleAnalyticsEnhancedEcommerce;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nclass GoogleTagManagerDefaults {\n constructor() {\n this.userId = null;\n }\n}\nlet Angulartics2GoogleTagManager = /*#__PURE__*/(() => {\n class Angulartics2GoogleTagManager {\n constructor(angulartics2) {\n this.angulartics2 = angulartics2;\n // The dataLayer needs to be initialized\n if (typeof dataLayer !== 'undefined' && dataLayer) {\n dataLayer = window.dataLayer = window.dataLayer || [];\n }\n const defaults = new GoogleTagManagerDefaults();\n // Set the default settings for this module\n this.angulartics2.settings.gtm = {\n ...defaults,\n ...this.angulartics2.settings.gtm\n };\n this.angulartics2.setUsername.subscribe(x => this.setUsername(x));\n }\n startTracking() {\n this.angulartics2.pageTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.pageTrack(x.path));\n this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.eventTrack(x.action, x.properties));\n this.angulartics2.exceptionTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.exceptionTrack(x));\n }\n pageTrack(path) {\n this.pushLayer({\n event: 'Page View',\n 'content-name': path,\n userId: this.angulartics2.settings.gtm.userId\n });\n }\n /**\n * Send Data Layer\n *\n * @layer data layer object\n */\n pushLayer(layer) {\n if (typeof dataLayer !== 'undefined' && dataLayer) {\n dataLayer.push(layer);\n }\n }\n /**\n * Send interactions to the dataLayer, i.e. for event tracking in Google Analytics\n *\n * @param action associated with the event\n */\n eventTrack(action, properties) {\n // TODO: make interface\n // @param {string} properties.category\n // @param {string} [properties.label]\n // @param {number} [properties.value]\n // @param {boolean} [properties.noninteraction]\n // Set a default GTM category\n properties = properties || {};\n this.pushLayer({\n event: properties.event || 'interaction',\n target: properties.category || 'Event',\n action,\n label: properties.label,\n value: properties.value,\n interactionType: properties.noninteraction,\n userId: this.angulartics2.settings.gtm.userId,\n ...properties.gtmCustom\n });\n }\n /**\n * Exception Track Event in GTM\n *\n */\n exceptionTrack(properties) {\n // TODO: make interface\n // @param {Object} properties\n // @param {string} properties.appId\n // @param {string} properties.appName\n // @param {string} properties.appVersion\n // @param {string} [properties.description]\n // @param {boolean} [properties.fatal]\n if (!properties || !properties.appId || !properties.appName || !properties.appVersion) {\n console.error('Must be setted appId, appName and appVersion.');\n return;\n }\n if (properties.fatal === undefined) {\n console.log('No \"fatal\" provided, sending with fatal=true');\n properties.exFatal = true;\n }\n properties.exDescription = properties.event ? properties.event.stack : properties.description;\n this.eventTrack(`Exception thrown for ${properties.appName} <${properties.appId}@${properties.appVersion}>`, {\n category: 'Exception',\n label: properties.exDescription\n });\n }\n /**\n * Set userId for use with Universal Analytics User ID feature\n *\n * @param userId used to identify user cross-device in Google Analytics\n */\n setUsername(userId) {\n this.angulartics2.settings.gtm.userId = userId;\n }\n }\n Angulartics2GoogleTagManager.ɵfac = function Angulartics2GoogleTagManager_Factory(t) {\n return new (t || Angulartics2GoogleTagManager)(i0.ɵɵinject(Angulartics2));\n };\n Angulartics2GoogleTagManager.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2GoogleTagManager,\n factory: Angulartics2GoogleTagManager.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2GoogleTagManager;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nclass GoogleGlobalSiteTagDefaults {\n constructor() {\n this.trackingIds = [];\n if (typeof ga !== 'undefined' && ga) {\n // See: https://developers.google.com/analytics/devguides/collection/analyticsjs/ga-object-methods-reference\n ga(() => {\n ga.getAll().forEach(tracker => {\n const id = tracker.get('trackingId');\n // If set both in forRoot and HTML page, we want to avoid duplicates\n if (id !== undefined && this.trackingIds.indexOf(id) === -1) {\n this.trackingIds.push(id);\n }\n });\n });\n }\n }\n}\nlet Angulartics2GoogleGlobalSiteTag = /*#__PURE__*/(() => {\n class Angulartics2GoogleGlobalSiteTag {\n constructor(angulartics2) {\n this.angulartics2 = angulartics2;\n this.dimensionsAndMetrics = {};\n const defaults = new GoogleGlobalSiteTagDefaults();\n // Set the default settings for this module\n this.angulartics2.settings.gst = {\n ...defaults,\n ...this.angulartics2.settings.gst\n };\n }\n startTracking() {\n this.angulartics2.pageTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.pageTrack(x.path));\n this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.eventTrack(x.action, x.properties));\n this.angulartics2.exceptionTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.exceptionTrack(x));\n this.angulartics2.userTimings.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.userTimings(this.convertTimings(x)));\n this.angulartics2.setUsername.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.setUsername(x));\n this.angulartics2.setUserProperties.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.setUserProperties(x));\n }\n /**\n * Manually track page view, see:\n *\n * https://developers.google.com/analytics/devguides/collection/gtagjs/single-page-applications#tracking_virtual_pageviews\n *\n * @param path relative url\n */\n pageTrack(path) {\n if (typeof gtag !== 'undefined' && gtag) {\n const params = {\n page_path: path,\n page_location: window.location.protocol + '//' + window.location.host + path,\n ...this.dimensionsAndMetrics\n };\n // Custom map must be reset with all config to stay valid.\n if (this.angulartics2.settings.gst.customMap) {\n params.custom_map = this.angulartics2.settings.gst.customMap;\n }\n if (this.angulartics2.settings.gst.userId) {\n params.user_id = this.angulartics2.settings.gst.userId;\n }\n if (this.angulartics2.settings.gst.anonymizeIp) {\n params.anonymize_ip = this.angulartics2.settings.gst.anonymizeIp;\n }\n for (const id of this.angulartics2.settings.gst.trackingIds) {\n gtag('config', id, params);\n }\n }\n }\n /**\n * Send interactions to gtag, i.e. for event tracking in Google Analytics. See:\n *\n * https://developers.google.com/analytics/devguides/collection/gtagjs/events\n *\n * @param action associated with the event\n */\n eventTrack(action, properties = {}) {\n this.eventTrackInternal(action, {\n event_category: properties.category || 'interaction',\n event_label: properties.label,\n value: properties.value,\n non_interaction: properties.noninteraction,\n ...properties.gstCustom\n });\n }\n /**\n * Exception Track Event in GST. See:\n *\n * https://developers.google.com/analytics/devguides/collection/gtagjs/exceptions\n *\n */\n exceptionTrack(properties) {\n // TODO: make interface\n // @param {Object} properties\n // @param {string} [properties.description]\n // @param {boolean} [properties.fatal]\n if (properties.fatal === undefined) {\n console.log('No \"fatal\" provided, sending with fatal=true');\n properties.fatal = true;\n }\n properties.exDescription = properties.event ? properties.event.stack : properties.description;\n this.eventTrack('exception', {\n gstCustom: {\n description: properties.exDescription,\n fatal: properties.fatal,\n ...properties.gstCustom\n }\n });\n }\n /**\n * User Timings Event in GST.\n *\n * @param properties Comprised of the mandatory fields:\n * - name (string)\n * - value (number - integer)\n * Properties can also have the optional fields:\n * - category (string)\n * - label (string)\n *\n * @link https://developers.google.com/analytics/devguides/collection/gtagjs/user-timings\n */\n userTimings(properties) {\n if (!properties) {\n console.error('User timings - \"properties\" parameter is required to be set.');\n return;\n }\n this.eventTrackInternal('timing_complete', {\n name: properties.name,\n value: properties.value,\n event_category: properties.category,\n event_label: properties.label\n });\n }\n convertTimings(properties) {\n return {\n name: properties.timingVar,\n value: properties.timingValue,\n category: properties.timingCategory,\n label: properties.timingLabel\n };\n }\n setUsername(userId) {\n this.angulartics2.settings.gst.userId = userId;\n if (typeof gtag !== 'undefined' && gtag) {\n gtag('set', {\n user_id: typeof userId === 'string' || !userId ? userId : userId.userId\n });\n }\n }\n setUserProperties(properties) {\n this.setDimensionsAndMetrics(properties);\n }\n setDimensionsAndMetrics(properties) {\n // We want the dimensions and metrics to accumulate, so we merge with previous value\n this.dimensionsAndMetrics = {\n ...this.dimensionsAndMetrics,\n ...properties\n };\n // Remove properties that are null or undefined\n Object.keys(this.dimensionsAndMetrics).forEach(key => {\n const val = this.dimensionsAndMetrics[key];\n if (val === undefined || val === null) {\n delete this.dimensionsAndMetrics[key];\n }\n });\n if (typeof gtag !== 'undefined' && gtag) {\n gtag('set', this.dimensionsAndMetrics);\n }\n }\n eventTrackInternal(action, properties = {}) {\n this.cleanProperties(properties);\n if (typeof gtag !== 'undefined' && gtag) {\n gtag('event', action, properties);\n }\n }\n cleanProperties(properties) {\n // GA requires that eventValue be an non-negative integer, see:\n // https://developers.google.com/analytics/devguides/collection/gtagjs/events\n if (properties.value) {\n const parsed = parseInt(properties.value, 10);\n properties.value = isNaN(parsed) ? 0 : parsed;\n }\n }\n }\n Angulartics2GoogleGlobalSiteTag.ɵfac = function Angulartics2GoogleGlobalSiteTag_Factory(t) {\n return new (t || Angulartics2GoogleGlobalSiteTag)(i0.ɵɵinject(Angulartics2));\n };\n Angulartics2GoogleGlobalSiteTag.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2GoogleGlobalSiteTag,\n factory: Angulartics2GoogleGlobalSiteTag.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2GoogleGlobalSiteTag;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Angulartics2Hubspot = /*#__PURE__*/(() => {\n class Angulartics2Hubspot {\n constructor(angulartics2) {\n this.angulartics2 = angulartics2;\n this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));\n }\n startTracking() {\n this.angulartics2.pageTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.pageTrack(x.path));\n this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.eventTrack(x.action, x.properties));\n }\n pageTrack(path) {\n if (typeof _hsq !== 'undefined') {\n _hsq.push(['setPath', path]);\n _hsq.push(['trackPageView']);\n }\n }\n eventTrack(action, properties) {\n if (typeof _hsq !== 'undefined') {\n _hsq.push(['trackEvent', properties]);\n }\n }\n setUserProperties(properties) {\n if (typeof _hsq !== 'undefined') {\n _hsq.push(['identify', properties]);\n }\n }\n }\n Angulartics2Hubspot.ɵfac = function Angulartics2Hubspot_Factory(t) {\n return new (t || Angulartics2Hubspot)(i0.ɵɵinject(Angulartics2));\n };\n Angulartics2Hubspot.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2Hubspot,\n factory: Angulartics2Hubspot.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2Hubspot;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Angulartics2Kissmetrics = /*#__PURE__*/(() => {\n class Angulartics2Kissmetrics {\n constructor(angulartics2) {\n this.angulartics2 = angulartics2;\n if (typeof _kmq === 'undefined') {\n _kmq = [];\n }\n this.angulartics2.setUsername.subscribe(x => this.setUsername(x));\n this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));\n }\n startTracking() {\n this.angulartics2.pageTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.pageTrack(x.path));\n this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.eventTrack(x.action, x.properties));\n }\n pageTrack(path) {\n _kmq.push(['record', 'Pageview', {\n Page: path\n }]);\n }\n eventTrack(action, properties) {\n _kmq.push(['record', action, properties]);\n }\n setUsername(userId) {\n _kmq.push(['identify', userId]);\n }\n setUserProperties(properties) {\n _kmq.push(['set', properties]);\n }\n }\n Angulartics2Kissmetrics.ɵfac = function Angulartics2Kissmetrics_Factory(t) {\n return new (t || Angulartics2Kissmetrics)(i0.ɵɵinject(Angulartics2));\n };\n Angulartics2Kissmetrics.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2Kissmetrics,\n factory: Angulartics2Kissmetrics.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2Kissmetrics;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Angulartics2LaunchByAdobe = /*#__PURE__*/(() => {\n class Angulartics2LaunchByAdobe {\n constructor(angulartics2) {\n this.angulartics2 = angulartics2;\n this.payload = {};\n if ('undefined' === typeof _satellite) {\n console.warn('Launch not found!');\n }\n this.angulartics2.setUsername.subscribe(x => this.setUsername(x));\n this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));\n }\n setUsername(userId) {\n if ('undefined' !== typeof userId && userId) {\n this.payload.userId = userId;\n }\n }\n setUserProperties(properties) {\n if ('undefined' !== typeof properties && properties) {\n this.payload.properties = properties;\n }\n }\n startTracking() {\n this.angulartics2.pageTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.pageTrack(x.path));\n this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.eventTrack(x.action, x.properties));\n }\n pageTrack(path) {\n this.payload = this.payload || {};\n this.payload.path = path;\n if ('undefined' !== typeof _satellite && _satellite) {\n _satellite.track('pageTrack', this.payload);\n }\n }\n /**\n * @param action associated with the event\n * @param properties associated with the event\n */\n eventTrack(action, properties) {\n properties = properties || {};\n // add properties to payload\n this.payload.action = action;\n this.payload.eventProperties = properties;\n if ('undefined' !== typeof _satellite && _satellite) {\n _satellite.track('eventTrack', this.payload);\n }\n }\n }\n Angulartics2LaunchByAdobe.ɵfac = function Angulartics2LaunchByAdobe_Factory(t) {\n return new (t || Angulartics2LaunchByAdobe)(i0.ɵɵinject(Angulartics2));\n };\n Angulartics2LaunchByAdobe.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2LaunchByAdobe,\n factory: Angulartics2LaunchByAdobe.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2LaunchByAdobe;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Angulartics2Mixpanel = /*#__PURE__*/(() => {\n class Angulartics2Mixpanel {\n constructor(angulartics2) {\n this.angulartics2 = angulartics2;\n this.angulartics2.setUsername.subscribe(x => this.setUsername(x));\n this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));\n this.angulartics2.setUserPropertiesOnce.subscribe(x => this.setUserPropertiesOnce(x));\n this.angulartics2.setSuperProperties.subscribe(x => this.setSuperProperties(x));\n this.angulartics2.setSuperPropertiesOnce.subscribe(x => this.setSuperPropertiesOnce(x));\n this.angulartics2.setAlias.subscribe(x => this.setAlias(x));\n }\n startTracking() {\n this.angulartics2.pageTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.pageTrack(x.path));\n this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.eventTrack(x.action, x.properties));\n }\n pageTrack(path) {\n try {\n mixpanel.track('Page Viewed', {\n page: path\n });\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n eventTrack(action, properties) {\n try {\n mixpanel.track(action, properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n setUsername(userId) {\n try {\n mixpanel.identify(userId);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n setUserProperties(properties) {\n try {\n mixpanel.people.set(properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n setUserPropertiesOnce(properties) {\n try {\n mixpanel.people.set_once(properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n setSuperProperties(properties) {\n try {\n mixpanel.register(properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n setSuperPropertiesOnce(properties) {\n try {\n mixpanel.register_once(properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n setAlias(alias) {\n try {\n mixpanel.alias(alias);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n }\n Angulartics2Mixpanel.ɵfac = function Angulartics2Mixpanel_Factory(t) {\n return new (t || Angulartics2Mixpanel)(i0.ɵɵinject(Angulartics2));\n };\n Angulartics2Mixpanel.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2Mixpanel,\n factory: Angulartics2Mixpanel.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2Mixpanel;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Angulartics2Pyze = /*#__PURE__*/(() => {\n class Angulartics2Pyze {\n constructor(angulartics2) {\n this.angulartics2 = angulartics2;\n this.angulartics2.setUsername.subscribe(x => this.setUserProfile(x));\n this.angulartics2.setUserProperties.subscribe(x => this.updateUserProfile(x));\n }\n startTracking() {\n this.angulartics2.pageTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.pageTrack(x.path));\n this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.eventTrack(x.action, x.properties));\n }\n pageTrack(path) {\n try {\n Pyze.postPageView('Page Viewed', {\n page: path\n });\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n eventTrack(action, properties) {\n try {\n PyzeEvents.postCustomEventWithAttributes(action, properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n setUserProfile(userId) {\n try {\n PyzeIdentity.setUserProfile(userId);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n updateUserProfile(properties) {\n try {\n PyzeIdentity.updateUserProfile({}, properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n }\n Angulartics2Pyze.ɵfac = function Angulartics2Pyze_Factory(t) {\n return new (t || Angulartics2Pyze)(i0.ɵɵinject(Angulartics2));\n };\n Angulartics2Pyze.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2Pyze,\n factory: Angulartics2Pyze.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2Pyze;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Angulartics2Matomo = /*#__PURE__*/(() => {\n class Angulartics2Matomo {\n constructor(angulartics2) {\n this.angulartics2 = angulartics2;\n if (typeof _paq === 'undefined') {\n console.warn('Matomo not found');\n }\n this.angulartics2.setUsername.subscribe(x => this.setUsername(x));\n this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));\n }\n startTracking() {\n this.angulartics2.pageTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.pageTrack(x.path));\n this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.eventTrack(x.action, x.properties));\n }\n pageTrack(path, title) {\n try {\n if (!window.location.origin) {\n window.location.origin = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '');\n }\n _paq.push(['setDocumentTitle', title || window.document.title]);\n _paq.push(['setCustomUrl', window.location.origin + path]);\n _paq.push(['trackPageView']);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n resetUser() {\n try {\n _paq.push(['appendToTrackingUrl', 'new_visit=1']); // (1) forces a new visit\n _paq.push(['deleteCookies']); // (2) deletes existing tracking cookies to start the new visit\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n /**\n * Track a basic event in Matomo, or send an ecommerce event.\n *\n * @param action A string corresponding to the type of event that needs to be tracked.\n * @param properties The properties that need to be logged with the event.\n */\n eventTrack(action, properties) {\n let params = [];\n switch (action) {\n /**\n * @description Sets the current page view as a product or category page view. When you call\n * setEcommerceView it must be followed by a call to trackPageView to record the product or\n * category page view.\n *\n * @link https://matomo.org/docs/ecommerce-analytics/#tracking-product-page-views-category-page-views-optional\n * @link https://developer.matomo.org/api-reference/tracking-javascript#ecommerce\n *\n * @property productSKU (required) SKU: Product unique identifier\n * @property productName (optional) Product name\n * @property categoryName (optional) Product category, or array of up to 5 categories\n * @property price (optional) Product Price as displayed on the page\n */\n case 'setEcommerceView':\n params = ['setEcommerceView', properties.productSKU, properties.productName, properties.categoryName, properties.price];\n break;\n /**\n * @description Adds a product into the ecommerce order. Must be called for each product in\n * the order.\n *\n * @link https://matomo.org/docs/ecommerce-analytics/#tracking-ecommerce-orders-items-purchased-required\n * @link https://developer.matomo.org/api-reference/tracking-javascript#ecommerce\n *\n * @property productSKU (required) SKU: Product unique identifier\n * @property productName (optional) Product name\n * @property categoryName (optional) Product category, or array of up to 5 categories\n * @property price (recommended) Product price\n * @property quantity (optional, default to 1) Product quantity\n */\n case 'addEcommerceItem':\n params = ['addEcommerceItem', properties.productSKU, properties.productName, properties.productCategory, properties.price, properties.quantity];\n break;\n /**\n * @description Tracks a shopping cart. Call this javascript function every time a user is\n * adding, updating or deleting a product from the cart.\n *\n * @link https://matomo.org/docs/ecommerce-analytics/#tracking-add-to-cart-items-added-to-the-cart-optional\n * @link https://developer.matomo.org/api-reference/tracking-javascript#ecommerce\n *\n * @property grandTotal (required) Cart amount\n */\n case 'trackEcommerceCartUpdate':\n params = ['trackEcommerceCartUpdate', properties.grandTotal];\n break;\n /**\n * @description Tracks an Ecommerce order, including any ecommerce item previously added to\n * the order. orderId and grandTotal (ie. revenue) are required parameters.\n *\n * @link https://matomo.org/docs/ecommerce-analytics/#tracking-ecommerce-orders-items-purchased-required\n * @link https://developer.matomo.org/api-reference/tracking-javascript#ecommerce\n *\n * @property orderId (required) Unique Order ID\n * @property grandTotal (required) Order Revenue grand total (includes tax, shipping, and subtracted discount)\n * @property subTotal (optional) Order sub total (excludes shipping)\n * @property tax (optional) Tax amount\n * @property shipping (optional) Shipping amount\n * @property discount (optional) Discount offered (set to false for unspecified parameter)\n */\n case 'trackEcommerceOrder':\n params = ['trackEcommerceOrder', properties.orderId, properties.grandTotal, properties.subTotal, properties.tax, properties.shipping, properties.discount];\n break;\n /**\n * @description To manually trigger an outlink\n *\n * @link https://matomo.org/docs/tracking-goals-web-analytics/\n * @link https://developer.matomo.org/guides/tracking-javascript-guide#tracking-a-click-as-an-outlink-via-css-or-javascript\n *\n * @property url (required) link url\n * @property linkType (optional) type of link\n */\n case 'trackLink':\n params = ['trackLink', properties.url, properties.linkType];\n break;\n /**\n * @description Tracks an Ecommerce goal\n *\n * @link https://matomo.org/docs/tracking-goals-web-analytics/\n * @link https://developer.matomo.org/guides/tracking-javascript-guide#manually-trigger-goal-conversions\n *\n * @property goalId (required) Unique Goal ID\n * @property value (optional) passed to goal tracking\n */\n case 'trackGoal':\n params = ['trackGoal', properties.goalId, properties.value];\n break;\n /**\n * @description Tracks a site search\n *\n * @link https://matomo.org/docs/site-search/\n * @link https://developer.matomo.org/guides/tracking-javascript-guide#internal-search-tracking\n *\n * @property keyword (required) Keyword searched for\n * @property category (optional) Search category\n * @property searchCount (optional) Number of results\n */\n case 'trackSiteSearch':\n params = ['trackSiteSearch', properties.keyword, properties.category, properties.searchCount];\n break;\n /**\n * @description Logs an event with an event category (Videos, Music, Games...), an event\n * action (Play, Pause, Duration, Add Playlist, Downloaded, Clicked...), and an optional\n * event name and optional numeric value.\n *\n * @link https://matomo.org/docs/event-tracking/\n * @link https://developer.matomo.org/api-reference/tracking-javascript#using-the-tracker-object\n *\n * @property category\n * @property action\n * @property name (optional, recommended)\n * @property value (optional)\n */\n default:\n // PAQ requires that eventValue be an integer, see: http://matomo.org/docs/event-tracking\n if (properties.value) {\n const parsed = parseInt(properties.value, 10);\n properties.value = isNaN(parsed) ? 0 : parsed;\n }\n params = ['trackEvent', properties.category, action, properties.name || properties.label, properties.value];\n }\n try {\n _paq.push(params);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n setUsername(userId) {\n try {\n _paq.push(['setUserId', userId]);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n /**\n * Sets custom dimensions if at least one property has the key \"dimension\",\n * e.g. dimension10. If there are custom dimensions, any other property is ignored.\n *\n * If there are no custom dimensions in the given properties object, the properties\n * object is saved as a custom variable.\n *\n * If in doubt, prefer custom dimensions.\n * @link https://matomo.org/docs/custom-variables/\n */\n setUserProperties(properties) {\n const dimensions = this.setCustomDimensions(properties);\n try {\n if (dimensions.length === 0) {\n _paq.push(['setCustomVariable', properties.index, properties.name, properties.value, properties.scope]);\n }\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n /**\n * If you created a custom variable and then decide to remove this variable from\n * a visit or page view, you can use deleteCustomVariable.\n *\n * @link https://developer.matomo.org/guides/tracking-javascript-guide#deleting-a-custom-variable\n */\n deletedUserProperties(properties) {\n try {\n _paq.push(['deleteCustomVariable', properties.index, properties.scope]);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n setCustomDimensions(properties) {\n const dimensionRegex = /dimension[1-9]\\d*/;\n const dimensions = Object.keys(properties).filter(key => dimensionRegex.exec(key));\n dimensions.forEach(dimension => {\n const number = Number(dimension.substr(9));\n _paq.push(['setCustomDimension', number, properties[dimension]]);\n });\n return dimensions;\n }\n }\n Angulartics2Matomo.ɵfac = function Angulartics2Matomo_Factory(t) {\n return new (t || Angulartics2Matomo)(i0.ɵɵinject(Angulartics2));\n };\n Angulartics2Matomo.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2Matomo,\n factory: Angulartics2Matomo.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2Matomo;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Angulartics2Segment = /*#__PURE__*/(() => {\n class Angulartics2Segment {\n constructor(angulartics2) {\n this.angulartics2 = angulartics2;\n this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));\n this.angulartics2.setUserPropertiesOnce.subscribe(x => this.setUserProperties(x));\n this.angulartics2.setAlias.subscribe(x => this.setAlias(x));\n }\n startTracking() {\n this.angulartics2.pageTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.pageTrack(x.path));\n this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.eventTrack(x.action, x.properties));\n }\n /**\n * https://segment.com/docs/libraries/analytics.js/#page\n *\n * analytics.page([category], [name], [properties], [options], [callback]);\n */\n pageTrack(path) {\n // TODO : Support optional parameters where the parameter order and type changes their meaning\n try {\n analytics.page(path);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n /**\n * https://segment.com/docs/libraries/analytics.js/#track\n *\n * analytics.track(event, [properties], [options], [callback]);\n */\n eventTrack(action, properties) {\n try {\n analytics.track(action, properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n /**\n * https://segment.com/docs/libraries/analytics.js/#identify\n *\n * analytics.identify([userId], [traits], [options], [callback]);\n */\n setUserProperties(properties) {\n try {\n if (properties.userId) {\n analytics.identify(properties.userId, properties);\n } else {\n analytics.identify(properties);\n }\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n /**\n * https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#reset--logout\n *\n * analytics.reset();\n */\n unsetUserProperties() {\n analytics.reset();\n }\n /**\n * https://segment.com/docs/libraries/analytics.js/#alias\n *\n * analytics.alias(userId, previousId, options, callback);\n */\n setAlias(alias) {\n try {\n analytics.alias(alias);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n }\n Angulartics2Segment.ɵfac = function Angulartics2Segment_Factory(t) {\n return new (t || Angulartics2Segment)(i0.ɵɵinject(Angulartics2));\n };\n Angulartics2Segment.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2Segment,\n factory: Angulartics2Segment.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2Segment;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Angulartics2Intercom = /*#__PURE__*/(() => {\n class Angulartics2Intercom {\n constructor(angulartics2) {\n this.angulartics2 = angulartics2;\n this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));\n this.angulartics2.setUserPropertiesOnce.subscribe(x => this.setUserProperties(x));\n }\n startTracking() {\n this.angulartics2.pageTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.pageTrack(x.path));\n this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.eventTrack(x.action, x.properties));\n }\n pageTrack(path) {\n try {\n this.eventTrack('Pageview', {\n url: path\n });\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n eventTrack(action, properties) {\n try {\n Intercom('trackEvent', action, properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n setUserProperties(properties) {\n try {\n if (properties.userId && !properties.user_id) {\n properties.user_id = properties.userId;\n }\n Intercom('boot', properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n }\n Angulartics2Intercom.ɵfac = function Angulartics2Intercom_Factory(t) {\n return new (t || Angulartics2Intercom)(i0.ɵɵinject(Angulartics2));\n };\n Angulartics2Intercom.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2Intercom,\n factory: Angulartics2Intercom.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2Intercom;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Angulartics2Woopra = /*#__PURE__*/(() => {\n class Angulartics2Woopra {\n constructor(angulartics2) {\n this.angulartics2 = angulartics2;\n if (typeof woopra === 'undefined') {\n console.warn('Woopra not found');\n }\n this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));\n }\n startTracking() {\n this.angulartics2.pageTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.pageTrack(x.path));\n this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.eventTrack(x.action, x.properties));\n }\n pageTrack(path) {\n try {\n woopra.track('pv', {\n url: path\n });\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n eventTrack(action, properties) {\n try {\n woopra.track(action, properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n setUserProperties(properties) {\n try {\n if (properties.email) {\n woopra.identify(properties);\n }\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n }\n Angulartics2Woopra.ɵfac = function Angulartics2Woopra_Factory(t) {\n return new (t || Angulartics2Woopra)(i0.ɵɵinject(Angulartics2));\n };\n Angulartics2Woopra.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2Woopra,\n factory: Angulartics2Woopra.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2Woopra;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Angulartics2Clicky = /*#__PURE__*/(() => {\n class Angulartics2Clicky {\n constructor(angulartics2, titleService) {\n this.angulartics2 = angulartics2;\n this.titleService = titleService;\n if (typeof clicky === 'undefined') {\n console.warn('Angulartics 2 Clicky Plugin: clicky global not found');\n }\n }\n startTracking() {\n this.angulartics2.pageTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.pageTrack(x.path));\n this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.eventOrGoalTrack(x.action, x.properties));\n }\n /**\n * Track Page in Clicky\n *\n * @param path location\n *\n * @link https://clicky.com/help/custom/manual#log\n */\n pageTrack(path) {\n const title = this.titleService.getTitle();\n clicky.log(path, title, 'pageview');\n }\n /**\n * Track Event Or Goal in Clicky\n *\n * @param action Action name\n * @param properties Definition of 'properties.goal' determines goal vs event tracking\n *\n * @link https://clicky.com/help/custom/manual#log\n * @link https://clicky.com/help/custom/manual#goal\n */\n eventOrGoalTrack(action, properties) {\n if (typeof properties.goal === 'undefined') {\n const title = properties.title || null;\n const type = properties.type != null ? this.validateType(properties.type) : null;\n clicky.log(action, title, type);\n } else {\n const goalId = properties.goal;\n const revenue = properties.revenue;\n clicky.goal(goalId, revenue, !!properties.noQueue);\n }\n }\n validateType(type) {\n const EventType = ['pageview', 'click', 'download', 'outbound'];\n return EventType.indexOf(type) > -1 ? type : 'pageview';\n }\n }\n Angulartics2Clicky.ɵfac = function Angulartics2Clicky_Factory(t) {\n return new (t || Angulartics2Clicky)(i0.ɵɵinject(Angulartics2), i0.ɵɵinject(i2$1.Title));\n };\n Angulartics2Clicky.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2Clicky,\n factory: Angulartics2Clicky.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2Clicky;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Angulartics2Amplitude = /*#__PURE__*/(() => {\n class Angulartics2Amplitude {\n constructor(angulartics2) {\n this.angulartics2 = angulartics2;\n this.angulartics2.setUsername.subscribe(x => this.setUsername(x));\n this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));\n this.angulartics2.setUserPropertiesOnce.subscribe(x => this.setUserProperties(x));\n }\n startTracking() {\n this.angulartics2.pageTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.pageTrack(x.path));\n this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.eventTrack(x.action, x.properties));\n }\n pageTrack(path) {\n try {\n this.eventTrack('Pageview', {\n url: path\n });\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n eventTrack(action, properties) {\n try {\n amplitude.getInstance().logEvent(action, properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n setUsername(userId) {\n try {\n amplitude.getInstance().setUserId(userId);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n setUserProperties(properties) {\n try {\n amplitude.getInstance().setUserProperties(properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n }\n Angulartics2Amplitude.ɵfac = function Angulartics2Amplitude_Factory(t) {\n return new (t || Angulartics2Amplitude)(i0.ɵɵinject(Angulartics2));\n };\n Angulartics2Amplitude.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2Amplitude,\n factory: Angulartics2Amplitude.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2Amplitude;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Angulartics2Splunk = /*#__PURE__*/(() => {\n class Angulartics2Splunk {\n constructor(angulartics2) {\n this.angulartics2 = angulartics2;\n if (typeof sp === 'undefined') {\n console.warn('Splunk not found');\n }\n }\n startTracking() {\n this.angulartics2.pageTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.pageTrack(x.path));\n this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.eventTrack(x.action, x.properties));\n }\n pageTrack(path) {\n try {\n sp.pageview(path);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n eventTrack(action, properties) {\n try {\n sp.track(action, properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n }\n Angulartics2Splunk.ɵfac = function Angulartics2Splunk_Factory(t) {\n return new (t || Angulartics2Splunk)(i0.ɵɵinject(Angulartics2));\n };\n Angulartics2Splunk.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2Splunk,\n factory: Angulartics2Splunk.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2Splunk;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Angulartics2IBMDigitalAnalytics = /*#__PURE__*/(() => {\n class Angulartics2IBMDigitalAnalytics {\n constructor(angulartics2) {\n this.angulartics2 = angulartics2;\n if (typeof window['cmCreatePageviewTag'] !== 'function') {\n console.warn('Angulartics 2 IBM Digital Analytics Plugin: eluminate.js is not loaded');\n }\n }\n startTracking() {\n this.angulartics2.pageTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.pageTrack(x.path));\n this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.eventTrack(x.action, x.properties));\n }\n /**\n * Track Page in IBM Digital Analytics\n *\n * @param path location\n *\n * @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_pageviewtag.html\n */\n pageTrack(path) {\n const cmCreatePageviewTag = window['cmCreatePageviewTag'];\n cmCreatePageviewTag(path, null, null, null);\n }\n /**\n * Track an event in IBM Digital Analytics\n *\n * @param action A string corresponding to the type of event that needs to be tracked.\n * @param properties The properties that need to be logged with the event.\n */\n eventTrack(action, properties = {}) {\n const cmDisplayShops = window['cmDisplayShops'];\n switch (action) {\n /**\n * @description The Product View tag captures information about vdigitalDataiews of product detail pages.\n * The Product View tag should be called on the lowest level detail page for products, which is typically\n * the Product Details page. You can view example Product View tags below.\n *\n * @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_prodviewtag.html\n */\n case 'cmCreateProductviewTag':\n const cmCreateProductviewTag = window['cmCreateProductviewTag'];\n cmCreateProductviewTag(properties.productId, properties.productName, properties.categoryId, properties.attrbute, properties.virtualCategory);\n break;\n /**\n * @description The Shop Action 5 tag captures data about selected products and which products are present in a shopping cart,\n * if any, when the cart is viewed.\n *\n * @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_shopact5tag.html\n */\n case 'cmCreateShopAction5Tag':\n const cmCreateShopAction5Tag = window['cmCreateShopAction5Tag'];\n cmCreateShopAction5Tag(properties.productId, properties.productName, properties.quantity, properties.unitPrice, properties.categoryId, properties.attrbute, properties.extraFields, properties.virtualCategory);\n cmDisplayShops();\n break;\n /**\n * @description The Shop Action 9 tag captures data about what products were purchased by a customer.\n * Like the Shop Action 5 tag, one tag should be sent for each product line item purchased. These tags should be sent\n * on the receipt or other completion page confirming a successful order.\n *\n * @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_shopact9tag.html\n */\n case 'cmCreateShopAction9Tag':\n const cmCreateShopAction9Tag = window['cmCreateShopAction9Tag'];\n cmCreateShopAction9Tag(properties.productId, properties.productName, properties.quantity, properties.unitPrice, properties.registrationId, properties.orderId, properties.orderSubtotal, properties.categoryId, properties.attrbute, properties.extraFields);\n cmDisplayShops();\n break;\n /**\n * @description The Order tag captures order header information such as Registration ID, order ID, order subtotal,\n * and shipping and handling. The Order tag should be sent on the receipt page confirming order completion.\n *\n * @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_ordertag.html\n */\n case 'cmCreateOrderTag':\n const cmCreateOrderTag = window['cmCreateOrderTag'];\n cmCreateOrderTag(properties.orderId, properties.orderSubtotal, properties.orderShipping, properties.registrationId, properties.registrantCity, properties.registrantState, properties.registrantPostalCode, properties.attrbute, properties.extraFields);\n break;\n /**\n * @description The Registration tag creates a Lifetime Visitor Experience Profile (LIVE Profile) by associating a single\n * common Registration ID with the IBM® Digital Analytics permanent cookie set in every browser visiting the tagged site.\n *\n * @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_registrationtag.html\n */\n case 'cmCreateRegistrationTag':\n const cmCreateRegistrationTag = window['cmCreateRegistrationTag'];\n cmCreateRegistrationTag(properties.registrationId, properties.registrantEmail, properties.registrantCity, properties.registrantState, properties.registrantPostalCode, properties.registrantCountry, properties.attrbute);\n break;\n /**\n * @description The Element tag is used to track intra-page content in IBM® Digital Analytics. Data collected by\n * the Element tag is used to populate values in the Element Categories and Top Viewed Elements reports.\n *\n * @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_elementtag.html\n */\n case 'cmCreateElementTag':\n const cmCreateElementTag = window['cmCreateElementTag'];\n cmCreateElementTag(properties.elementId, properties.elementCategory, properties.attrbute);\n break;\n /**\n * @description The Conversion Event tag is employed for tracking of general non-commerce conversion events.\n * The Conversion Event tag is used to populate values in the Conversion Events Reports and to create Key Segments.\n * This tag and the reports it populates enable analysis of a wide variety of site activities.\n *\n * @link https://www.ibm.com/support/knowledgecenter/SSPG9M/Implementation/impl_conversioneventtag.html\n */\n case 'cmCreateConversionEventTag':\n const cmCreateConversionEventTag = window['cmCreateConversionEventTag'];\n cmCreateConversionEventTag(properties.eventId, properties.actionType, properties.eventCategoryId, properties.points, properties.attrbute, properties.extraFields);\n break;\n default:\n console.warn('Unsupported Event Action');\n }\n }\n }\n Angulartics2IBMDigitalAnalytics.ɵfac = function Angulartics2IBMDigitalAnalytics_Factory(t) {\n return new (t || Angulartics2IBMDigitalAnalytics)(i0.ɵɵinject(Angulartics2));\n };\n Angulartics2IBMDigitalAnalytics.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2IBMDigitalAnalytics,\n factory: Angulartics2IBMDigitalAnalytics.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2IBMDigitalAnalytics;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Angulartics2GoSquared = /*#__PURE__*/(() => {\n class Angulartics2GoSquared {\n constructor(angulartics2) {\n this.angulartics2 = angulartics2;\n this.angulartics2.setUserProperties.subscribe(x => this.setUserProperties(x));\n this.angulartics2.setUserPropertiesOnce.subscribe(x => this.setUserProperties(x));\n }\n startTracking() {\n this.angulartics2.pageTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.pageTrack(x.path));\n this.angulartics2.eventTrack.pipe(this.angulartics2.filterDeveloperMode()).subscribe(x => this.eventTrack(x.action, x.properties));\n }\n pageTrack(path) {\n try {\n _gs('track', path);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n eventTrack(action, properties) {\n try {\n _gs('event', action, properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n setUserProperties(properties) {\n try {\n _gs('identify', properties);\n } catch (e) {\n if (!(e instanceof ReferenceError)) {\n throw e;\n }\n }\n }\n }\n Angulartics2GoSquared.ɵfac = function Angulartics2GoSquared_Factory(t) {\n return new (t || Angulartics2GoSquared)(i0.ɵɵinject(Angulartics2));\n };\n Angulartics2GoSquared.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Angulartics2GoSquared,\n factory: Angulartics2GoSquared.ɵfac,\n providedIn: 'root'\n });\n return Angulartics2GoSquared;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { ANGULARTICS2_TOKEN, AngularRouterTracking, Angulartics2, Angulartics2AdobeAnalytics, Angulartics2Amplitude, Angulartics2AppInsights, Angulartics2BaiduAnalytics, Angulartics2Clicky, Angulartics2Facebook, Angulartics2GoSquared, Angulartics2GoogleAnalytics, Angulartics2GoogleAnalyticsEnhancedEcommerce, Angulartics2GoogleGlobalSiteTag, Angulartics2GoogleTagManager, Angulartics2Hubspot, Angulartics2IBMDigitalAnalytics, Angulartics2Intercom, Angulartics2Kissmetrics, Angulartics2LaunchByAdobe, Angulartics2Matomo, Angulartics2Mixpanel, Angulartics2Module, Angulartics2On, Angulartics2OnModule, Angulartics2Pyze, Angulartics2RouterlessModule, Angulartics2Segment, Angulartics2Splunk, Angulartics2Woopra, AppInsightsDefaults, DefaultConfig, GoogleAnalyticsDefaults, GoogleGlobalSiteTagDefaults, GoogleTagManagerDefaults, RouterlessTracking };\n","import {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n Input,\n Output,\n} from '@angular/core';\n\nimport { Appearance } from '@shared/util-appearance';\n\n@Component({\n selector: 'shared-alert',\n templateUrl: './alert.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AlertComponent {\n @Input() appearance: Appearance = 'light';\n @Input() icon = false;\n @Input() content?: string;\n @Input() closable = false;\n @Input() autoCloses = false;\n @Output() closed: EventEmitter = new EventEmitter();\n\n onClose(event: Event): void {\n this.closed.emit(event);\n }\n}\n","\n
\n
\n @if (icon === true && appearance === 'success') {\n \n }\n @if (icon === true && appearance === 'danger') {\n \n }\n @if (icon === true && appearance === 'warning') {\n \n }\n @if (icon === true && appearance === 'info') {\n \n }\n
\n
\n
\n \n
\n @if (closable) {\n
\n
\n \n @if (closable) {\n \n }\n \n
\n
\n }\n
\n\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { IconComponent } from '@shared/ui-icon';\n\nimport { AlertComponent } from './alert.component';\n\n@NgModule({\n imports: [CommonModule, IconComponent],\n declarations: [AlertComponent],\n exports: [AlertComponent],\n})\nexport class AlertModule {}\n","import {\n ChangeDetectionStrategy,\n Component,\n Input,\n Optional,\n Self,\n} from '@angular/core';\nimport { ControlValueAccessor, FormControl, NgControl } from '@angular/forms';\nimport { noop } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { BaseComponent } from '@shared/util-base-component';\n\n@Component({\n selector: 'shared-checkbox',\n templateUrl: './checkbox.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class CheckboxComponent\n extends BaseComponent\n implements ControlValueAccessor\n{\n @Input() label?: string;\n @Input() help?: string;\n @Input() placeholder?: string;\n @Input() id?: string;\n @Input() name?: string;\n isDisabled = false;\n formControl = new FormControl('');\n private fnOnTouchedCallback: () => void = noop;\n private fnOnChangeCallback: (value: string) => void = noop;\n\n constructor(@Self() @Optional() public control: NgControl) {\n super();\n\n if (this.control) {\n this.control.valueAccessor = this;\n }\n\n this.formControl.valueChanges\n .pipe(takeUntil(this.ngUnsubscribe))\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n .subscribe((x: string) => {\n if (x !== this.control.value) {\n this.fnOnChangeCallback(x);\n }\n });\n }\n\n registerOnChange(fn: (value: string) => void): void {\n this.fnOnChangeCallback = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.fnOnTouchedCallback = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.isDisabled = isDisabled;\n }\n\n writeValue(value: string): void {\n this.formControl.patchValue(value, { emitEvent: false, onlySelf: true });\n }\n}\n","
\n
\n \n
\n
\n @if (label) {\n \n }\n \n @if (help) {\n

{{ help }}

\n }\n
\n
\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { ReactiveFormsModule } from '@angular/forms';\n\nimport { CheckboxComponent } from './checkbox.component';\n\n@NgModule({\n imports: [CommonModule, ReactiveFormsModule],\n declarations: [CheckboxComponent],\n exports: [CheckboxComponent],\n})\nexport class CheckboxModule {}\n","import { Injectable, InjectionToken } from '@angular/core';\n\nimport { ModalSize } from './models/modal-size.type';\n\n@Injectable()\nexport class ModalConfigService> {\n /**\n * Allow user to Id for the modal. Otherwise, a unique number will be given.\n */\n id?: number | string;\n /**\n * Includes a modal-backdrop element. Alternatively,\n * specify static for a backdrop which doesn't close the modal on click.\n */\n backdrop?: boolean | 'static';\n /**\n * Closes the modal when escape key is pressed.\n */\n keyboard?: boolean;\n\n focus?: boolean;\n /**\n * Ignore the backdrop click\n */\n ignoreBackdropClick?: boolean;\n /**\n * Modal data.\n */\n initialState?: Partial;\n\n /**\n * The initial size of the modals.\n */\n size?: ModalSize;\n}\n\nexport const modalConfigDefaults: ModalConfigService = {\n backdrop: true,\n keyboard: true,\n focus: true,\n ignoreBackdropClick: false,\n size: 'base',\n initialState: {},\n};\n\nexport const MODAL_CONFIG: InjectionToken =\n new InjectionToken('MODAL_CONFIG');\n","// noinspection JSUnusedGlobalSymbols\n\nimport { Subject } from 'rxjs';\n\nimport { BaseComponent } from '@shared/util-base-component';\n\nimport { ModalRefService } from '../../services/modal-ref.service';\n\nexport abstract class BaseModal extends BaseComponent {\n closed$: Subject = new Subject();\n\n modalData?: T;\n\n protected constructor(protected readonly bsModalRef: ModalRefService) {\n super();\n }\n\n onClose(val: unknown): void {\n this.closed$.next(val);\n this.bsModalRef.hide();\n }\n\n onHide(): void {\n this.closed$.next(null);\n this.bsModalRef.hide();\n }\n}\n","import {\n Directive,\n ElementRef,\n EventEmitter,\n HostListener,\n Output,\n} from '@angular/core';\n\n@Directive({\n selector: '[sharedClickOutside]',\n})\nexport class ClickOutsideDirective {\n @Output() sharedClickOutside = new EventEmitter();\n\n constructor(private elementRef: ElementRef) {}\n\n @HostListener('document:click', ['$event.target'])\n public onClick(target: unknown): void {\n const clickedInside = this.elementRef.nativeElement.contains(target);\n if (!clickedInside) {\n this.sharedClickOutside.emit();\n }\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { ClickOutsideDirective } from './click-outside.directive';\n\n@NgModule({\n imports: [CommonModule],\n declarations: [ClickOutsideDirective],\n exports: [ClickOutsideDirective],\n})\nexport class ClickOutsideModule {}\n","export class Trigger {\n open: string;\n close?: string;\n\n constructor(open: string, close?: string) {\n this.open = open;\n this.close = close || open;\n }\n\n isManual(): boolean {\n return this.open === 'manual' || this.close === 'manual';\n }\n}\n","/**\n * @copyright Valor Software\n * @copyright Angular ng-bootstrap team\n */\nimport { Renderer2 } from '@angular/core';\n\nimport { Trigger } from './trigger.class';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type BsEventCallback = (event?: any) => boolean | void;\n\nexport interface ListenOptions {\n target?: HTMLElement;\n targets?: HTMLElement[];\n triggers?: string;\n outsideClick?: boolean;\n outsideEsc?: boolean;\n show?: BsEventCallback;\n hide?: BsEventCallback;\n toggle?: BsEventCallback;\n}\n\nconst DEFAULT_ALIASES = {\n hover: ['mouseover', 'mouseout'],\n focus: ['focusin', 'focusout'],\n};\n\nexport function parseTriggers(\n triggers?: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n aliases: any = DEFAULT_ALIASES,\n): Trigger[] {\n const trimmedTriggers = (triggers || '').trim();\n\n if (trimmedTriggers.length === 0) {\n return [];\n }\n\n const parsedTriggers = trimmedTriggers\n .split(/\\s+/)\n .map((trigger: string) => trigger.split(':'))\n .map((triggerPair: string[]) => {\n const alias = aliases[triggerPair[0]] || triggerPair;\n\n return new Trigger(alias[0], alias[1]);\n });\n\n const manualTriggers = parsedTriggers.filter((triggerPair: Trigger) =>\n triggerPair.isManual(),\n );\n\n if (manualTriggers.length > 1) {\n throw new Error('Triggers parse error: only one manual trigger is allowed');\n }\n\n if (manualTriggers.length === 1 && parsedTriggers.length > 1) {\n throw new Error(\n \"Triggers parse error: manual trigger can't be mixed with other triggers\",\n );\n }\n\n return parsedTriggers;\n}\n\nexport function listenToTriggers(\n renderer: Renderer2,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n target: any,\n triggers: string,\n showFn: BsEventCallback,\n hideFn: BsEventCallback,\n toggleFn: BsEventCallback,\n): () => void {\n const parsedTriggers = parseTriggers(triggers);\n const listeners: Array<() => void> = [];\n\n if (parsedTriggers.length === 1 && parsedTriggers[0].isManual()) {\n return Function.prototype as () => void;\n }\n\n parsedTriggers.forEach((trigger: Trigger) => {\n if (trigger.open === trigger.close) {\n listeners.push(renderer.listen(target, trigger.open, toggleFn));\n\n return;\n }\n\n listeners.push(renderer.listen(target, trigger.open, showFn));\n if (trigger.close) {\n listeners.push(renderer.listen(target, trigger.close, hideFn));\n }\n });\n\n return () => {\n listeners.forEach((unsubscribeFn) => unsubscribeFn());\n };\n}\n\nexport function listenToTriggersV2(\n renderer: Renderer2,\n options: ListenOptions,\n): () => void {\n const parsedTriggers = parseTriggers(options.triggers);\n const target = options.target;\n // do nothing\n if (parsedTriggers.length === 1 && parsedTriggers[0].isManual()) {\n return Function.prototype as () => void;\n }\n\n // all listeners\n const listeners: Array<() => void> = [];\n\n // lazy listeners registration\n const _registerHide: Array<() => () => void> = [];\n const registerHide = (): void => {\n // add hide listeners to unregister array\n _registerHide.forEach((fn) => listeners.push(fn()));\n // register hide events only once\n _registerHide.length = 0;\n };\n\n // register open\\close\\toggle listeners\n parsedTriggers.forEach((trigger: Trigger) => {\n const useToggle = trigger.open === trigger.close;\n const showFn = useToggle ? options.toggle : options.show;\n\n if (!useToggle && trigger.close && options.hide) {\n const _hide = renderer.listen(target, trigger.close, options.hide);\n _registerHide.push(() => _hide);\n }\n\n if (showFn) {\n listeners.push(\n renderer.listen(target, trigger.open, () => showFn(registerHide)),\n );\n }\n });\n\n return () => {\n listeners.forEach((unsubscribeFn: () => void) => unsubscribeFn());\n };\n}\n\nexport function registerOutsideClick(\n renderer: Renderer2,\n options: ListenOptions,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): any {\n if (!options.outsideClick) {\n return Function.prototype;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return renderer.listen('document', 'click', (event: any) => {\n if (options.target && options.target.contains(event.target)) {\n return;\n }\n if (\n options.targets &&\n options.targets.some((target) => target.contains(event.target))\n ) {\n return;\n }\n\n if (options.hide) {\n options.hide();\n }\n });\n}\n\nexport function registerEscClick(\n renderer: Renderer2,\n options: ListenOptions,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): any {\n if (!options.outsideEsc) {\n return Function.prototype;\n }\n\n return renderer.listen('document', 'keyup.esc', (event) => {\n if (options.target && options.target.contains(event.target)) {\n return;\n }\n if (\n options.targets &&\n options.targets.some((target) => target.contains(event.target))\n ) {\n return;\n }\n\n if (options.hide) {\n options.hide();\n }\n });\n}\n","// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function OnChange(): any {\n const sufix = 'Change';\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function OnChangeHandler(target: any, propertyKey: string): void {\n const _key = ` __${propertyKey}Value`;\n Object.defineProperty(target, propertyKey, {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get(): any {\n return this[_key];\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n set(value: any): void {\n const prevValue = this[_key];\n this[_key] = value;\n if (prevValue !== value && this[propertyKey + sufix]) {\n this[propertyKey + sufix].emit(value);\n }\n },\n });\n };\n}\n","/**\n * @license\n * Copyright Google Inc. 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\n/**\n * JS version of browser APIs. This library can only run in the browser.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst win = (typeof window !== 'undefined' && window) || ({} as any);\n\nexport { win as window };\nexport const document = win.document;\nexport const location = win.location;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const gc = win.gc ? () => win.gc() : (): any => null;\nexport const performance = win.performance ? win.performance : null;\nexport const Event = win.Event;\nexport const MouseEvent = win.MouseEvent;\nexport const KeyboardEvent = win.KeyboardEvent;\nexport const EventTarget = win.EventTarget;\nexport const History = win.History;\nexport const Location = win.Location;\nexport const EventListener = win.EventListener;\n","import { window } from './facade/browser';\n\nexport class Utils {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n static reflow(element: any): void {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ((bs: any): void => bs)(element.offsetHeight);\n }\n\n // source: https://github.com/jquery/jquery/blob/master/src/css/var/getStyles.js\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n static getStyles(elem: any): any {\n // Support: IE <=11 only, Firefox <=30 (#15098, #14150)\n // IE throws on elements created in popups\n // FF meanwhile throws on frame elements through \"defaultView.getComputedStyle\"\n let view = elem.ownerDocument.defaultView;\n\n if (!view || !view.opener) {\n view = window;\n }\n\n return view.getComputedStyle(elem);\n }\n}\n","import { isDevMode } from '@angular/core';\nconst _messagesHash: { [key: string]: boolean } = {};\nconst _hideMsg = typeof console === 'undefined' || !('warn' in console);\n\nexport function warnOnce(msg: string): void {\n if (!isDevMode() || _hideMsg || msg in _messagesHash) {\n return;\n }\n\n _messagesHash[msg] = true;\n console.warn(msg);\n}\n","/**\n * @copyright Valor Software\n * @copyright Angular ng-bootstrap team\n */\n\nimport { ComponentRef, ViewRef } from '@angular/core';\n\nexport class ContentRef {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n nodes: any[];\n viewRef?: ViewRef;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n componentRef?: ComponentRef;\n\n constructor(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n nodes: any[],\n viewRef?: ViewRef,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n componentRef?: ComponentRef,\n ) {\n this.nodes = nodes;\n this.viewRef = viewRef;\n this.componentRef = componentRef;\n }\n}\n","// todo: add delay support\n// todo: merge events onShow, onShown, etc...\n// todo: add global positioning configuration?\nimport {\n ApplicationRef,\n ComponentFactory,\n ComponentFactoryResolver,\n ComponentRef,\n ElementRef,\n EmbeddedViewRef,\n EventEmitter,\n Injector,\n NgZone,\n Renderer2,\n StaticProvider,\n TemplateRef,\n Type,\n ViewContainerRef,\n} from '@angular/core';\nimport { Subscription } from 'rxjs';\n\nimport {\n PositioningOptions,\n PositioningService,\n} from '@shared/util-positioning';\nimport {\n listenToTriggersV2,\n registerEscClick,\n registerOutsideClick,\n} from '@shared/util-utils';\n\nimport { ContentRef } from './content-ref.class';\nimport { ListenOptions } from './listen-options.model';\n\nexport class ComponentLoader {\n onBeforeShow = new EventEmitter();\n onShown = new EventEmitter();\n onBeforeHide = new EventEmitter();\n onHidden = new EventEmitter();\n\n instance?: T;\n _componentRef?: ComponentRef;\n _inlineViewRef?: EmbeddedViewRef;\n\n private _providers: StaticProvider[] = [];\n private _componentFactory?: ComponentFactory;\n private _zoneSubscription?: Subscription;\n private _contentRef?: ContentRef;\n private _innerComponent?: ComponentRef;\n\n private _unregisterListenersFn?: () => void;\n private _isHiding = false;\n /**\n * Placement of a component. Accepts: \"top\", \"bottom\", \"left\", \"right\"\n */\n private attachment?: string;\n /**\n * A selector specifying the element the popover should be appended to.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private container: string | ElementRef | any;\n /**\n * A selector used if container element was not found\n */\n private containerDefaultSelector = 'body';\n /**\n * Specifies events that should trigger. Supports a space separated list of\n * event names.\n */\n private triggers?: string;\n private _listenOpts: ListenOptions = {};\n private _globalListener = Function.prototype;\n\n /**\n * Do not use this directly, it should be instanced via\n * `ComponentLoadFactory.attach`\n * @internal\n */\n public constructor(\n private _viewContainerRef: ViewContainerRef | undefined,\n private _renderer: Renderer2 | undefined,\n private _elementRef: ElementRef | undefined,\n private _injector: Injector,\n private _componentFactoryResolver: ComponentFactoryResolver,\n private _ngZone: NgZone,\n private _applicationRef: ApplicationRef,\n private _posService: PositioningService,\n ) {}\n\n get isShown(): boolean {\n if (this._isHiding) {\n return false;\n }\n\n return !!this._componentRef;\n }\n\n attach(compType: Type): ComponentLoader {\n this._componentFactory =\n this._componentFactoryResolver.resolveComponentFactory(compType);\n\n return this;\n }\n\n // todo: add behaviour: to target element, `body`, custom element\n to(container?: string | ElementRef): ComponentLoader {\n this.container = container || this.container;\n\n return this;\n }\n\n position(opts?: PositioningOptions): ComponentLoader {\n if (!opts) {\n return this;\n }\n\n this.attachment = opts.attachment || this.attachment;\n this._elementRef = (opts.target as ElementRef) || this._elementRef;\n\n return this;\n }\n\n provide(provider: StaticProvider): ComponentLoader {\n this._providers.push(provider);\n\n return this;\n }\n\n // todo: appendChild to element or document.querySelector(this.container)\n\n show(\n opts: {\n content?: string | TemplateRef;\n context?: unknown;\n initialState?: unknown;\n [key: string]: unknown;\n id?: number | string;\n } = {},\n ): ComponentRef | undefined {\n this._subscribePositioning();\n this._innerComponent = void 0;\n\n if (!this._componentRef) {\n this.onBeforeShow.emit();\n this._contentRef = this._getContentRef(\n opts.content,\n opts.context,\n opts.initialState,\n );\n\n const injector = Injector.create({\n providers: this._providers,\n parent: this._injector,\n });\n\n if (!this._componentFactory) {\n return;\n }\n\n this._componentRef = this._componentFactory.create(\n injector,\n this._contentRef.nodes,\n );\n\n this._applicationRef.attachView(this._componentRef.hostView);\n // this._componentRef = this._viewContainerRef\n // .createComponent(this._componentFactory, 0, injector, this._contentRef.nodes);\n this.instance = this._componentRef.instance;\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n Object.assign(this._componentRef.instance, opts);\n\n if (this.container instanceof ElementRef) {\n this.container.nativeElement.appendChild(\n this._componentRef.location.nativeElement,\n );\n }\n\n if (\n typeof this.container === 'string' &&\n typeof document !== 'undefined'\n ) {\n const selectedElement =\n document.querySelector(this.container) ||\n document.querySelector(this.containerDefaultSelector);\n\n if (!selectedElement) {\n return;\n }\n\n selectedElement.appendChild(this._componentRef.location.nativeElement);\n }\n\n if (\n !this.container &&\n this._elementRef &&\n this._elementRef.nativeElement.parentElement\n ) {\n this._elementRef.nativeElement.parentElement.appendChild(\n this._componentRef.location.nativeElement,\n );\n }\n\n // we need to manually invoke change detection since events registered\n // via\n // Renderer::listen() are not picked up by change detection with the\n // OnPush strategy\n if (this._contentRef.componentRef) {\n this._innerComponent = this._contentRef.componentRef.instance;\n this._contentRef.componentRef.changeDetectorRef.markForCheck();\n this._contentRef.componentRef.changeDetectorRef.detectChanges();\n }\n this._componentRef.changeDetectorRef.markForCheck();\n this._componentRef.changeDetectorRef.detectChanges();\n\n this.onShown.emit(\n opts.id !== undefined ? { id: opts.id } : this._componentRef.instance,\n );\n }\n\n this._registerOutsideClick();\n\n return this._componentRef;\n }\n\n hide(id?: number | string): ComponentLoader {\n if (!this._componentRef) {\n return this;\n }\n\n this._posService.deletePositionElement(this._componentRef.location);\n\n this.onBeforeHide.emit(this._componentRef.instance);\n\n const componentEl = this._componentRef.location.nativeElement;\n componentEl.parentNode.removeChild(componentEl);\n if (this._contentRef?.componentRef) {\n this._contentRef.componentRef.destroy();\n }\n\n if (this._viewContainerRef && this._contentRef?.viewRef) {\n this._viewContainerRef.remove(\n this._viewContainerRef.indexOf(this._contentRef.viewRef),\n );\n }\n if (this._contentRef?.viewRef) {\n this._contentRef.viewRef.destroy();\n }\n\n this._contentRef = void 0;\n this._componentRef = void 0;\n this._removeGlobalListener();\n\n this.onHidden.emit(id !== undefined ? { id } : null);\n\n return this;\n }\n\n toggle(): void {\n if (this.isShown) {\n this.hide();\n\n return;\n }\n\n this.show();\n }\n\n dispose(): void {\n if (this.isShown) {\n this.hide();\n }\n\n this._unsubscribePositioning();\n\n if (this._unregisterListenersFn) {\n this._unregisterListenersFn();\n }\n }\n\n listen(listenOpts: ListenOptions): ComponentLoader {\n this.triggers = listenOpts.triggers || this.triggers;\n this._listenOpts.outsideClick = listenOpts.outsideClick;\n this._listenOpts.outsideEsc = listenOpts.outsideEsc;\n listenOpts.target = listenOpts.target || this._elementRef?.nativeElement;\n\n const hide = (this._listenOpts.hide = () =>\n listenOpts.hide ? listenOpts.hide() : void this.hide());\n const show = (this._listenOpts.show = (registerHide) => {\n listenOpts.show ? listenOpts.show(registerHide) : this.show(registerHide);\n registerHide();\n });\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const toggle = (registerHide: any): void => {\n this.isShown ? hide() : show(registerHide);\n };\n\n if (this._renderer) {\n this._unregisterListenersFn = listenToTriggersV2(this._renderer, {\n target: listenOpts.target,\n triggers: listenOpts.triggers,\n show,\n hide,\n toggle,\n });\n }\n\n return this;\n }\n\n _removeGlobalListener(): void {\n if (this._globalListener) {\n this._globalListener();\n this._globalListener = Function.prototype;\n }\n }\n\n attachInline(\n vRef: ViewContainerRef | undefined,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n template: TemplateRef | undefined,\n ): ComponentLoader {\n if (vRef && template) {\n this._inlineViewRef = vRef.createEmbeddedView(template);\n }\n\n return this;\n }\n\n _registerOutsideClick(): void {\n if (!this._componentRef || !this._componentRef.location) {\n return;\n }\n // why: should run after first event bubble\n if (this._listenOpts.outsideClick) {\n const target = this._componentRef.location.nativeElement;\n setTimeout(() => {\n if (this._renderer && this._elementRef) {\n this._globalListener = registerOutsideClick(this._renderer, {\n targets: [target, this._elementRef.nativeElement],\n outsideClick: this._listenOpts.outsideClick,\n hide: () => this._listenOpts.hide && this._listenOpts.hide(),\n });\n }\n });\n }\n if (this._listenOpts.outsideEsc && this._renderer && this._elementRef) {\n const target = this._componentRef.location.nativeElement;\n this._globalListener = registerEscClick(this._renderer, {\n targets: [target, this._elementRef.nativeElement],\n outsideEsc: this._listenOpts.outsideEsc,\n hide: () => this._listenOpts.hide && this._listenOpts.hide(),\n });\n }\n }\n\n getInnerComponent(): ComponentRef | undefined {\n return this._innerComponent;\n }\n\n private _subscribePositioning(): void {\n if (this._zoneSubscription || !this.attachment) {\n return;\n }\n\n this.onShown.subscribe(() => {\n this._posService.position({\n element: this._componentRef?.location,\n target: this._elementRef,\n attachment: this.attachment,\n appendToBody: this.container === 'body',\n });\n });\n\n this._zoneSubscription = this._ngZone.onStable.subscribe(() => {\n if (!this._componentRef) {\n return;\n }\n\n this._posService.calcPosition();\n });\n }\n\n private _unsubscribePositioning(): void {\n if (!this._zoneSubscription) {\n return;\n }\n\n this._zoneSubscription.unsubscribe();\n this._zoneSubscription = void 0;\n }\n\n private _getContentRef(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n content: string | TemplateRef | any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n context?: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n initialState?: any,\n ): ContentRef {\n if (!content) {\n return new ContentRef([]);\n }\n\n if (content instanceof TemplateRef) {\n if (this._viewContainerRef) {\n const _viewRef = this._viewContainerRef.createEmbeddedView<\n TemplateRef\n >(content, context);\n _viewRef.markForCheck();\n\n return new ContentRef([_viewRef.rootNodes], _viewRef);\n }\n const viewRef = content.createEmbeddedView({});\n this._applicationRef.attachView(viewRef);\n\n return new ContentRef([viewRef.rootNodes], viewRef);\n }\n\n if (typeof content === 'function') {\n const contentCmptFactory =\n this._componentFactoryResolver.resolveComponentFactory(content);\n\n const modalContentInjector = Injector.create({\n providers: this._providers,\n parent: this._injector,\n });\n\n const componentRef = contentCmptFactory.create(modalContentInjector);\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n Object.assign(componentRef.instance, initialState);\n this._applicationRef.attachView(componentRef.hostView);\n\n return new ContentRef(\n [[componentRef.location.nativeElement]],\n componentRef.hostView,\n componentRef,\n );\n }\n\n const nodes = this._renderer\n ? [this._renderer.createText(`${content}`)]\n : [];\n return new ContentRef([nodes]);\n }\n}\n","/* eslint-disable @typescript-eslint/no-duplicate-enum-values */\nexport interface Offsets {\n width: number;\n height: number;\n bottom?: number;\n left?: number;\n right?: number;\n top?: number;\n marginTop?: number;\n marginLeft?: number;\n}\n\nexport interface Data {\n options: Options;\n instance: {\n target: HTMLElement;\n host: HTMLElement;\n arrow?: HTMLElement;\n };\n offsets: {\n target: Offsets;\n host: Offsets;\n arrow?: Record;\n };\n positionFixed: boolean;\n placement: string;\n placementAuto: boolean;\n}\n\nexport interface Options {\n placement?: string;\n modifiers: {\n flip?: {\n enabled: boolean;\n };\n preventOverflow?: {\n enabled: boolean;\n boundariesElement?: string;\n };\n };\n allowedPositions?: string[];\n}\n\nexport enum MapPlacementInToRL {\n top = 'top',\n bottom = 'bottom',\n left = 'left',\n right = 'right',\n auto = 'auto',\n end = 'right',\n start = 'left',\n 'top left' = 'top left',\n 'top right' = 'top right',\n 'right top' = 'right top',\n 'right bottom' = 'right bottom',\n 'bottom right' = 'bottom right',\n 'bottom left' = 'bottom left',\n 'left bottom' = 'left bottom',\n 'left top' = 'left top',\n 'top start' = 'top left',\n 'top end' = 'top right',\n 'end top' = 'right top',\n 'end bottom' = 'right bottom',\n 'bottom end' = 'bottom right',\n 'bottom start' = 'bottom left',\n 'start bottom' = 'start bottom',\n 'start top' = 'left top',\n}\n\nexport enum PlacementForBs5 {\n top = 'top',\n bottom = 'bottom',\n left = 'start',\n right = 'end',\n auto = 'auto',\n end = 'end',\n start = 'start',\n 'top left' = 'top start',\n 'top right' = 'top end',\n 'right top' = 'end top',\n 'right bottom' = 'end bottom',\n 'bottom right' = 'bottom end',\n 'bottom left' = 'bottom start',\n 'left bottom' = 'start bottom',\n 'left top' = 'start top',\n 'top start' = 'top start',\n 'top end' = 'top end',\n 'end top' = 'end top',\n 'end bottom' = 'end bottom',\n 'bottom end' = 'bottom end',\n 'bottom start' = 'bottom start',\n 'start bottom' = 'start bottom',\n 'start top' = 'start top',\n}\n\nexport type AvailbleBSPositions =\n | 'top'\n | 'bottom'\n | 'left'\n | 'right'\n | 'auto'\n | 'top left'\n | 'top right'\n | 'right top'\n | 'right bottom'\n | 'bottom right'\n | 'bottom left'\n | 'left bottom'\n | 'left top'\n | 'start'\n | 'end'\n | 'top start'\n | 'top end'\n | 'end top'\n | 'end bottom'\n | 'bottom end'\n | 'bottom start'\n | 'start bottom'\n | 'start top';\n","/**\n * Get CSS computed property of the given element\n */\nexport function getStyleComputedProperty(element: Element): CSSStyleDeclaration;\nexport function getStyleComputedProperty(\n element: Element,\n property?: string,\n): string | string[];\nexport function getStyleComputedProperty(\n element: Element,\n property?: string,\n): string | string[] | CSSStyleDeclaration {\n if (element.nodeType !== 1) {\n return [];\n }\n // NOTE: 1 DOM access here\n const window = element.ownerDocument.defaultView;\n const css = window?.getComputedStyle(element, null);\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return property ? css && css[property] : css;\n}\n","/**\n * Returns the offset parent of the given element\n */\nimport { getStyleComputedProperty } from './getStyleComputedProperty';\n\nexport function getOffsetParent(element: HTMLElement): HTMLElement {\n if (!element) {\n return document.documentElement;\n }\n\n const noOffsetParent = null;\n\n // NOTE: 1 DOM access here\n let offsetParent = element?.offsetParent;\n\n // Skip hidden elements which don't have an offsetParent\n let sibling: HTMLElement | undefined = void 0;\n\n while (\n offsetParent === noOffsetParent &&\n element.nextElementSibling &&\n sibling !== element.nextElementSibling\n ) {\n // todo: valorkin fix\n sibling = element.nextElementSibling as HTMLElement;\n offsetParent = sibling.offsetParent;\n }\n\n const nodeName = offsetParent && offsetParent.nodeName;\n\n if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {\n return sibling\n ? sibling.ownerDocument.documentElement\n : document.documentElement;\n }\n\n // .offsetParent will return the closest TH, TD or TABLE in case\n if (\n offsetParent &&\n ['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 &&\n getStyleComputedProperty(offsetParent, 'position') === 'static'\n ) {\n return getOffsetParent(offsetParent as HTMLElement);\n }\n\n return offsetParent as HTMLElement;\n}\n","/**\n * Finds the root node (document, shadowDOM root) of the given element\n */\nexport function getRoot(node: Node | ShadowRoot): Node | ShadowRoot {\n if (node.parentNode !== null) {\n return getRoot(node.parentNode);\n }\n\n return node;\n}\n","import { getOffsetParent } from './getOffsetParent';\n\n// todo: valorkin fix\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function isOffsetContainer(element: any): boolean {\n const { nodeName } = element;\n if (nodeName === 'BODY') {\n return false;\n }\n\n return (\n nodeName === 'HTML' ||\n getOffsetParent(element.firstElementChild) === element\n );\n}\n","/**\n * Finds the offset parent common to the two provided nodes\n */\nimport { getOffsetParent } from './getOffsetParent';\nimport { getRoot } from './getRoot';\nimport { isOffsetContainer } from './isOffsetContainer';\n\nexport function findCommonOffsetParent(\n element1: HTMLElement,\n element2: HTMLElement,\n): HTMLElement {\n // This check is needed to avoid errors in case one of the elements isn't defined for any reason\n if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {\n return document.documentElement;\n }\n\n // Here we make sure to give as \"start\" the element that comes first in the DOM\n const order =\n element1.compareDocumentPosition(element2) &\n Node.DOCUMENT_POSITION_FOLLOWING;\n\n const start = order ? element1 : element2;\n const end = order ? element2 : element1;\n\n // Get common ancestor container\n const range = document.createRange();\n range.setStart(start, 0);\n range.setEnd(end, 0);\n\n // todo: valorkin fix\n const commonAncestorContainer =\n range.commonAncestorContainer as unknown as HTMLElement;\n\n // Both nodes are inside #document\n if (\n (element1 !== commonAncestorContainer &&\n element2 !== commonAncestorContainer) ||\n start.contains(end)\n ) {\n if (isOffsetContainer(commonAncestorContainer)) {\n return commonAncestorContainer;\n }\n\n return getOffsetParent(commonAncestorContainer);\n }\n\n // one of the nodes is inside shadowDOM, find which one\n const element1root = getRoot(element1) as ShadowRoot;\n if (element1root.host) {\n return findCommonOffsetParent(element1root.host as HTMLElement, element2);\n } else {\n return findCommonOffsetParent(\n element1,\n (getRoot(element2) as ShadowRoot).host as HTMLElement,\n );\n }\n}\n","/**\n * Finds the first parent of an element that has a transformed property defined\n */\n\nimport { getStyleComputedProperty } from './getStyleComputedProperty';\n\nexport function getFixedPositionOffsetParent(\n element: HTMLElement,\n): HTMLElement {\n // This check is needed to avoid errors in case one of the elements isn't defined for any reason\n if (!element || !element.parentElement) {\n return document.documentElement;\n }\n\n let el = element.parentElement;\n\n while (\n el?.parentElement &&\n getStyleComputedProperty(el, 'transform') === 'none'\n ) {\n el = el.parentElement;\n }\n\n return el || document.documentElement;\n}\n","/**\n * Helper to detect borders of a given element\n */\n\nexport function getBordersSize(\n styles: CSSStyleDeclaration,\n axis: string,\n): number {\n const sideA = axis === 'x' ? 'Left' : 'Top';\n const sideB = sideA === 'Left' ? 'Right' : 'Bottom';\n\n return (\n parseFloat((styles as never)[`border${sideA}Width`]) +\n parseFloat((styles as never)[`border${sideB}Width`])\n );\n}\n","/**\n * Given element offsets, generate an output similar to getBoundingClientRect\n */\nimport { Offsets } from '../models';\n\nexport function getClientRect(offsets: Offsets): Offsets {\n return {\n ...offsets,\n right: (offsets.left || 0) + offsets.width,\n bottom: (offsets.top || 0) + offsets.height,\n };\n}\n","function getSize(axis: string, body: HTMLElement, html: HTMLElement): number {\n const _body = body as unknown as Record;\n const _html = html as never;\n\n return Math.max(\n _body[`offset${axis}`],\n _body[`scroll${axis}`],\n _html[`client${axis}`],\n _html[`offset${axis}`],\n _html[`scroll${axis}`],\n 0,\n );\n}\n\nexport function getWindowSizes(document: Document): {\n height: number;\n width: number;\n} {\n const body = document.body;\n const html = document.documentElement;\n\n return {\n height: getSize('Height', body, html),\n width: getSize('Width', body, html),\n };\n}\n","/**\n * Tells if a given input is a number\n */\nexport function isNumeric(n: string): boolean {\n return n !== '' && !isNaN(parseFloat(n)) && isFinite(Number(n));\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function isNumber(value?: any): value is number {\n return (\n typeof value === 'number' ||\n Object.prototype.toString.call(value) === '[object Number]'\n );\n}\n","/**\n * Get bounding client rect of given element\n */\nimport { Offsets } from '../models';\n\nimport { getBordersSize } from './getBordersSize';\nimport { getClientRect } from './getClientRect';\nimport { getStyleComputedProperty } from './getStyleComputedProperty';\nimport { getWindowSizes } from './getWindowSizes';\nimport { isNumber } from './isNumeric';\n\nexport function getBoundingClientRect(element: HTMLElement): Offsets {\n const rect: Offsets = element.getBoundingClientRect();\n\n if (\n !(\n rect &&\n isNumber(rect.top) &&\n isNumber(rect.left) &&\n isNumber(rect.bottom) &&\n isNumber(rect.right)\n )\n ) {\n return rect;\n }\n\n const result: Offsets = {\n left: rect.left,\n top: rect.top,\n width: rect.right - rect.left,\n height: rect.bottom - rect.top,\n };\n\n // subtract scrollbar size from sizes\n const sizes =\n element.nodeName === 'HTML'\n ? getWindowSizes(element.ownerDocument)\n : undefined;\n const width =\n sizes?.width ||\n element.clientWidth ||\n (isNumber(rect.right) &&\n isNumber(result.left) &&\n rect.right - result.left) ||\n 0;\n const height =\n sizes?.height ||\n element.clientHeight ||\n (isNumber(rect.bottom) &&\n isNumber(result.top) &&\n rect.bottom - result.top) ||\n 0;\n\n let horizScrollbar = element.offsetWidth - width;\n let vertScrollbar = element.offsetHeight - height;\n\n // if an hypothetical scrollbar is detected, we must be sure it's not a `border`\n // we make this check conditional for performance reasons\n if (horizScrollbar || vertScrollbar) {\n const styles = getStyleComputedProperty(element);\n horizScrollbar -= getBordersSize(styles, 'x');\n vertScrollbar -= getBordersSize(styles, 'y');\n\n result.width -= horizScrollbar;\n result.height -= vertScrollbar;\n }\n\n return getClientRect(result);\n}\n","/**\n * Returns the parentNode or the host of the element\n */\n// todo: valorkin fix\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getParentNode(element: any): any {\n if (element.nodeName === 'HTML') {\n return element;\n }\n\n return element.parentNode || element.host;\n}\n","/**\n * Returns the scrolling parent of the given element\n */\nimport { getParentNode } from './getParentNode';\nimport { getStyleComputedProperty } from './getStyleComputedProperty';\n\n// todo: valorkin fix\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function getScrollParent(element: any): any {\n // Return body, `getScroll` will take care to get the correct `scrollTop` from it\n if (!element) {\n return document.body;\n }\n\n switch (element.nodeName) {\n case 'HTML':\n case 'BODY':\n return element.ownerDocument.body;\n case '#document':\n return element.body;\n default:\n }\n\n // Firefox want us to check `-x` and `-y` variations as well\n const { overflow, overflowX, overflowY } = getStyleComputedProperty(element);\n if (\n /(auto|scroll|overlay)/.test(\n String(overflow) + String(overflowY) + String(overflowX),\n )\n ) {\n return element;\n }\n\n return getScrollParent(getParentNode(element));\n}\n","/**\n * Gets the scroll value of the given element in the given side (top and left)\n */\nexport function getScroll(element: HTMLElement, side = 'top'): number {\n const upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';\n const nodeName = element.nodeName;\n\n if (nodeName === 'BODY' || nodeName === 'HTML') {\n const html = element.ownerDocument.documentElement;\n const scrollingElement = element.ownerDocument.scrollingElement || html;\n\n return scrollingElement[upperSide];\n }\n\n return element[upperSide];\n}\n","/**\n * Sum or subtract the element scroll values (left and top) from a given rect object\n */\nimport { Offsets } from '../models';\n\nimport { getScroll } from './getScroll';\nimport { isNumber } from './isNumeric';\n\nexport function includeScroll(\n rect: Offsets,\n element: HTMLElement,\n subtract = false,\n): Offsets {\n const scrollTop = getScroll(element, 'top');\n const scrollLeft = getScroll(element, 'left');\n const modifier = subtract ? -1 : 1;\n if (isNumber(rect.top)) {\n rect.top += scrollTop * modifier;\n }\n if (isNumber(rect.bottom)) {\n rect.bottom += scrollTop * modifier;\n }\n\n if (isNumber(rect.left)) {\n rect.left += scrollLeft * modifier;\n }\n if (isNumber(rect.right)) {\n rect.right += scrollLeft * modifier;\n }\n\n return rect;\n}\n","import { Offsets } from '../models';\n\nimport { getBoundingClientRect } from './getBoundingClientRect';\nimport { getClientRect } from './getClientRect';\nimport { getScrollParent } from './getScrollParent';\nimport { getStyleComputedProperty } from './getStyleComputedProperty';\nimport { includeScroll } from './includeScroll';\nimport { isNumber } from './isNumeric';\n\nexport function getOffsetRectRelativeToArbitraryNode(\n children: HTMLElement,\n parent: HTMLElement,\n fixedPosition = false,\n): Offsets {\n const isHTML = parent.nodeName === 'HTML';\n const childrenRect = getBoundingClientRect(children);\n const parentRect = getBoundingClientRect(parent);\n const scrollParent = getScrollParent(children);\n\n const styles = getStyleComputedProperty(parent);\n const borderTopWidth = parseFloat(styles.borderTopWidth);\n const borderLeftWidth = parseFloat(styles.borderLeftWidth);\n\n // In cases where the parent is fixed, we must ignore negative scroll in offset calc\n if (fixedPosition && isHTML) {\n parentRect.top = Math.max(parentRect.top ?? 0, 0);\n parentRect.left = Math.max(parentRect.left ?? 0, 0);\n }\n\n let offsets: Offsets = getClientRect({\n top: (childrenRect.top ?? 0) - (parentRect.top ?? 0) - borderTopWidth,\n left: (childrenRect.left ?? 0) - (parentRect.left ?? 0) - borderLeftWidth,\n width: childrenRect.width,\n height: childrenRect.height,\n });\n\n offsets.marginTop = 0;\n offsets.marginLeft = 0;\n\n // Subtract margins of documentElement in case it's being used as parent\n // we do this only on HTML because it's the only element that behaves\n // differently when margins are applied to it. The margins are included in\n // the box of the documentElement, in the other cases not.\n if (isHTML) {\n const marginTop = parseFloat(styles.marginTop);\n const marginLeft = parseFloat(styles.marginLeft);\n\n if (isNumber(offsets.top)) {\n offsets.top -= borderTopWidth - marginTop;\n }\n if (isNumber(offsets.bottom)) {\n offsets.bottom -= borderTopWidth - marginTop;\n }\n if (isNumber(offsets.left)) {\n offsets.left -= borderLeftWidth - marginLeft;\n }\n if (isNumber(offsets.right)) {\n offsets.right -= borderLeftWidth - marginLeft;\n }\n\n // Attach marginTop and marginLeft because in some circumstances we may need them\n offsets.marginTop = marginTop;\n offsets.marginLeft = marginLeft;\n }\n\n if (\n !fixedPosition\n ? parent.contains(scrollParent)\n : parent === scrollParent && scrollParent.nodeName !== 'BODY'\n ) {\n offsets = includeScroll(offsets, parent);\n }\n\n return offsets;\n}\n","import { Offsets } from '../models';\n\nimport { getClientRect } from './getClientRect';\nimport { getOffsetRectRelativeToArbitraryNode } from './getOffsetRectRelativeToArbitraryNode';\nimport { getScroll } from './getScroll';\n\nexport function getViewportOffsetRectRelativeToArtbitraryNode(\n element: HTMLElement,\n excludeScroll = false,\n): Offsets {\n const html = element.ownerDocument.documentElement;\n const relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);\n const width = Math.max(html.clientWidth, window.innerWidth || 0);\n const height = Math.max(html.clientHeight, window.innerHeight || 0);\n\n const scrollTop = !excludeScroll ? getScroll(html) : 0;\n const scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;\n\n const offset = {\n top:\n scrollTop -\n Number(relativeOffset?.top) +\n Number(relativeOffset?.marginTop),\n left:\n scrollLeft -\n Number(relativeOffset?.left) +\n Number(relativeOffset?.marginLeft),\n width,\n height,\n };\n\n return getClientRect(offset);\n}\n","/**\n * Check if the given element is fixed or is inside a fixed parent\n */\nimport { getParentNode } from './getParentNode';\nimport { getStyleComputedProperty } from './getStyleComputedProperty';\n\nexport function isFixed(element: HTMLElement): boolean {\n const nodeName = element.nodeName;\n if (nodeName === 'BODY' || nodeName === 'HTML') {\n return false;\n }\n if (getStyleComputedProperty(element, 'position') === 'fixed') {\n return true;\n }\n\n return isFixed(getParentNode(element));\n}\n","/**\n * Computed the boundaries limits and return them\n */\nimport { Offsets } from '../models';\n\nimport { findCommonOffsetParent } from './findCommonOffsetParent';\nimport { getFixedPositionOffsetParent } from './getFixedPositionOffsetParent';\nimport { getOffsetRectRelativeToArbitraryNode } from './getOffsetRectRelativeToArbitraryNode';\nimport { getParentNode } from './getParentNode';\nimport { getScrollParent } from './getScrollParent';\nimport { getViewportOffsetRectRelativeToArtbitraryNode } from './getViewportOffsetRectRelativeToArtbitraryNode';\nimport { getWindowSizes } from './getWindowSizes';\nimport { isFixed } from './isFixed';\nimport { isNumber } from './isNumeric';\n\nexport function getBoundaries(\n target: HTMLElement,\n host: HTMLElement,\n padding = 0,\n boundariesElement: string,\n fixedPosition = false,\n): Partial {\n // NOTE: 1 DOM access here\n\n let boundaries: Partial = { top: 0, left: 0 };\n const offsetParent = fixedPosition\n ? getFixedPositionOffsetParent(target)\n : findCommonOffsetParent(target, host);\n\n // Handle viewport case\n if (boundariesElement === 'viewport') {\n boundaries = getViewportOffsetRectRelativeToArtbitraryNode(\n offsetParent,\n fixedPosition,\n );\n } else {\n // Handle other cases based on DOM element used as boundaries\n let boundariesNode;\n if (boundariesElement === 'scrollParent') {\n boundariesNode = getScrollParent(getParentNode(host));\n if (boundariesNode.nodeName === 'BODY') {\n boundariesNode = target.ownerDocument.documentElement;\n }\n } else if (boundariesElement === 'window') {\n boundariesNode = target.ownerDocument.documentElement;\n } else {\n boundariesNode = boundariesElement;\n }\n\n const offsets = getOffsetRectRelativeToArbitraryNode(\n boundariesNode,\n offsetParent,\n fixedPosition,\n );\n\n // In case of HTML, we need a different computation\n if (\n offsets &&\n boundariesNode.nodeName === 'HTML' &&\n !isFixed(offsetParent)\n ) {\n const { height, width } = getWindowSizes(target.ownerDocument);\n if (\n isNumber(boundaries.top) &&\n isNumber(offsets.top) &&\n isNumber(offsets.marginTop)\n ) {\n boundaries.top += offsets.top - offsets.marginTop;\n }\n if (isNumber(boundaries.top)) {\n boundaries.bottom = Number(height) + Number(offsets.top);\n }\n if (\n isNumber(boundaries.left) &&\n isNumber(offsets.left) &&\n isNumber(offsets.marginLeft)\n ) {\n boundaries.left += offsets.left - offsets.marginLeft;\n }\n if (isNumber(boundaries.top)) {\n boundaries.right = Number(width) + Number(offsets.left);\n }\n } else if (offsets) {\n // for all the other DOM elements, this one is good\n boundaries = offsets;\n }\n }\n\n // Add paddings\n if (isNumber(boundaries.left)) {\n boundaries.left += padding;\n }\n if (isNumber(boundaries.top)) {\n boundaries.top += padding;\n }\n if (isNumber(boundaries.right)) {\n boundaries.right -= padding;\n }\n if (isNumber(boundaries.bottom)) {\n boundaries.bottom -= padding;\n }\n\n return boundaries;\n}\n","/**\n * Utility used to transform the `auto` placement to the placement with more\n * available space.\n */\nimport { Offsets, PlacementForBs5 } from '../models';\n\nimport { getBoundaries } from './getBoundaries';\n\nfunction getArea({ width, height }: { width: number; height: number }): number {\n return width * height;\n}\n\nexport function computeAutoPlacement(\n placement: string,\n refRect: Offsets,\n target: HTMLElement,\n host: HTMLElement,\n allowedPositions = ['top', 'bottom', 'right', 'left'],\n boundariesElement = 'viewport',\n padding = 0,\n): string {\n if (placement.indexOf('auto') === -1) {\n return placement;\n }\n\n const boundaries = getBoundaries(target, host, padding, boundariesElement);\n\n type Rects = { top: Offsets; right: Offsets; bottom: Offsets; left: Offsets };\n const rects: Rects = {\n top: {\n width: boundaries.width ?? 0,\n height: refRect.top && boundaries.top ? refRect.top - boundaries.top : 0,\n },\n right: {\n width:\n boundaries.right && refRect.right\n ? boundaries.right - refRect.right\n : 0,\n height: boundaries.height ?? 0,\n },\n bottom: {\n width: boundaries.width ?? 0,\n height:\n boundaries.bottom && refRect.bottom\n ? boundaries.bottom - refRect.bottom\n : 0,\n },\n left: {\n width:\n refRect.left && boundaries.left ? refRect.left - boundaries.left : 0,\n height: boundaries.height ?? 0,\n },\n };\n\n const sortedAreas = Object.keys(rects)\n .map((key) => ({\n key,\n ...rects[key as keyof Rects],\n area: getArea(\n rects[key as keyof Rects] as { width: number; height: number },\n ),\n }))\n .sort((a, b) => b.area - a.area);\n\n let filteredAreas = sortedAreas.filter(({ width, height }) => {\n return width >= target.clientWidth && height >= target.clientHeight;\n });\n\n filteredAreas = filteredAreas.filter((position) => {\n return allowedPositions.some((allowedPosition: string) => {\n return allowedPosition === position.key;\n });\n });\n\n const computedPlacement: string =\n filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;\n\n const variation = placement.split(' ')[1];\n // for tooltip on auto position\n target.className = target.className.replace(\n /bs-tooltip-auto/g,\n `bs-tooltip-${\n PlacementForBs5[computedPlacement as keyof typeof PlacementForBs5]\n }`,\n );\n\n return computedPlacement + (variation ? `-${variation}` : '');\n}\n","import { Data, Offsets } from '../models';\n\nexport function getOffsets(data: Data): Offsets {\n return {\n width: data.offsets.target.width,\n height: data.offsets.target.height,\n left: Math.floor(data.offsets.target.left ?? 0),\n top: Math.round(data.offsets.target.top ?? 0),\n bottom: Math.round(data.offsets.target.bottom ?? 0),\n right: Math.floor(data.offsets.target.right ?? 0),\n };\n}\n","/**\n * Get the opposite placement of the given one\n */\nexport function getOppositePlacement(placement: string): string {\n const hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };\n\n return placement.replace(\n /left|right|bottom|top/g,\n (matched) => hash[matched as keyof typeof hash],\n );\n}\n","/**\n * Get the opposite placement variation of the given one\n */\nexport function getOppositeVariation(variation: string): string {\n if (variation === 'right') {\n return 'left';\n } else if (variation === 'left') {\n return 'right';\n }\n\n return variation;\n}\n","/**\n * Get the outer sizes of the given element (offset size + margins)\n */\nimport { Offsets } from '../models';\n\nconst parse = (value?: string, def = 0): number =>\n value ? parseFloat(value) : def;\n\nexport function getOuterSizes(element: HTMLElement): Offsets {\n const window = element.ownerDocument.defaultView;\n const styles = window?.getComputedStyle(element);\n const x = parse(styles?.marginTop) + parse(styles?.marginBottom);\n const y = parse(styles?.marginLeft) + parse(styles?.marginRight);\n\n return {\n width: Number(element.offsetWidth) + y,\n height: Number(element.offsetHeight) + x,\n };\n}\n","/**\n * Get offsets to the reference element\n */\nimport { Offsets } from '../models';\n\nimport { findCommonOffsetParent } from './findCommonOffsetParent';\nimport { getFixedPositionOffsetParent } from './getFixedPositionOffsetParent';\nimport { getOffsetRectRelativeToArbitraryNode } from './getOffsetRectRelativeToArbitraryNode';\n\nexport function getReferenceOffsets(\n target: HTMLElement,\n host: HTMLElement,\n fixedPosition?: boolean,\n): Offsets {\n const commonOffsetParent = fixedPosition\n ? getFixedPositionOffsetParent(target)\n : findCommonOffsetParent(target, host);\n\n return getOffsetRectRelativeToArbitraryNode(\n host,\n commonOffsetParent,\n fixedPosition,\n );\n}\n","/**\n * Get offsets to the target\n */\nimport { Offsets } from '../models';\n\nimport { getOppositePlacement } from './getOppositePlacement';\nimport { getOuterSizes } from './getOuterSizes';\n\nexport function getTargetOffsets(\n target: HTMLElement,\n hostOffsets: Offsets,\n position: string,\n): Offsets {\n const placement = position.split(' ')[0];\n // Get target node sizes\n const targetRect = getOuterSizes(target);\n\n // Add position, width and height to our offsets object\n const targetOffsets = {\n width: targetRect.width,\n height: targetRect.height,\n };\n\n // depending by the target placement we have to compute its offsets slightly differently\n const isHoriz = ['right', 'left'].indexOf(placement) !== -1;\n const mainSide = isHoriz ? 'top' : 'left';\n const secondarySide = isHoriz ? 'left' : 'top';\n const measurement = isHoriz ? 'height' : 'width';\n const secondaryMeasurement = !isHoriz ? 'height' : 'width';\n\n targetOffsets[mainSide as keyof typeof targetOffsets] =\n (hostOffsets[mainSide] ?? 0) +\n hostOffsets[measurement] / 2 -\n targetRect[measurement] / 2;\n\n targetOffsets[secondarySide as keyof typeof targetOffsets] =\n placement === secondarySide\n ? (hostOffsets[secondarySide] ?? 0) - targetRect[secondaryMeasurement]\n : hostOffsets[\n getOppositePlacement(secondarySide) as keyof typeof hostOffsets\n ] ?? 0;\n\n return targetOffsets;\n}\n","/**\n * Helper used to know if the given modifier is enabled.\n */\nimport { Options } from '../models';\n\nexport function isModifierEnabled(\n options: Options,\n modifierName: string,\n): boolean {\n return !!options.modifiers[modifierName as keyof typeof options.modifiers]\n ?.enabled;\n}\n","import { AvailbleBSPositions } from '../models';\n\nconst availablePositions = {\n top: ['top', 'top start', 'top end'],\n bottom: ['bottom', 'bottom start', 'bottom end'],\n start: ['start', 'start top', 'start bottom'],\n end: ['end', 'end top', 'end bottom'],\n};\n\nexport function checkPopoverMargin(\n placement: AvailbleBSPositions,\n checkPosition: 'top' | 'bottom' | 'start' | 'end',\n): boolean {\n return availablePositions[checkPosition].includes(placement);\n}\n\nexport function checkMargins(placement: AvailbleBSPositions): string {\n if (checkPopoverMargin(placement, 'end')) {\n return 'ms-2';\n }\n\n if (checkPopoverMargin(placement, 'start')) {\n return 'me-2';\n }\n\n if (checkPopoverMargin(placement, 'top')) {\n return 'mb-2';\n }\n\n if (checkPopoverMargin(placement, 'bottom')) {\n return 'mt-2';\n }\n\n return '';\n}\n","/**\n * Update class for the given popper\n */\nimport { Renderer2 } from '@angular/core';\n\nimport { Data, PlacementForBs5 } from '../models';\n\nimport { checkMargins } from './checkMargin';\n\nexport function updateContainerClass(data: Data, renderer?: Renderer2): void {\n const target = data.instance.target;\n\n let containerClass = target.className;\n\n const dataPlacement =\n PlacementForBs5[data.placement as keyof typeof PlacementForBs5];\n if (data.placementAuto) {\n containerClass = containerClass.replace(\n /bs-popover-auto/g,\n `bs-popover-${dataPlacement}`,\n );\n containerClass = containerClass.replace(/ms-2|me-2|mb-2|mt-2/g, '');\n containerClass = containerClass.replace(\n /bs-tooltip-auto/g,\n `bs-tooltip-${dataPlacement}`,\n );\n containerClass = containerClass.replace(/\\sauto/g, ` ${dataPlacement}`);\n\n if (containerClass.indexOf('popover') !== -1) {\n containerClass = containerClass + ' ' + checkMargins(dataPlacement);\n }\n\n if (\n containerClass.indexOf('popover') !== -1 &&\n containerClass.indexOf('popover-auto') === -1\n ) {\n containerClass += ' popover-auto';\n }\n\n if (\n containerClass.indexOf('tooltip') !== -1 &&\n containerClass.indexOf('tooltip-auto') === -1\n ) {\n containerClass += ' tooltip-auto';\n }\n }\n containerClass = containerClass.replace(\n /left|right|top|bottom|end|start/g,\n `${dataPlacement.split(' ')[0]}`,\n );\n\n if (renderer) {\n renderer.setAttribute(target, 'class', containerClass);\n\n return;\n }\n\n target.className = containerClass;\n}\n","/**\n * Set the style to the given popper\n */\nimport { Renderer2 } from '@angular/core';\n\nimport { isNumeric } from './isNumeric';\n\nexport function setStyles(\n element: HTMLElement | null,\n styles?: Record,\n renderer?: Renderer2,\n): void {\n if (!element || !styles) {\n return;\n }\n Object.keys(styles).forEach((prop) => {\n let unit = '';\n // add unit if the value is numeric and is one of the following\n if (\n ['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !==\n -1 &&\n isNumeric(styles[prop] as string)\n ) {\n unit = 'px';\n }\n\n if (renderer) {\n renderer.setStyle(element, prop, `${String(styles[prop])}${unit}`);\n\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (element.style as any)[prop] = String(styles[prop]) + unit;\n });\n}\n","import { Data } from '../models';\nimport {\n getClientRect,\n getOuterSizes,\n getStyleComputedProperty,\n} from '../utils';\n\nexport function arrow(data: Data): Data {\n let targetOffsets = data.offsets.target;\n // if arrowElement is a string, suppose it's a CSS selector\n const arrowElement: HTMLElement | null =\n data.instance.target.querySelector('.arrow');\n\n // if arrowElement is not found, don't run the modifier\n if (!arrowElement) {\n return data;\n }\n\n const isVertical =\n ['left', 'right'].indexOf(data.placement.split(' ')[0]) !== -1;\n\n const len = isVertical ? 'height' : 'width';\n const sideCapitalized = isVertical ? 'Top' : 'Left';\n const side = sideCapitalized.toLowerCase() as keyof typeof targetOffsets;\n const altSide = isVertical ? 'left' : 'top';\n const opSide = isVertical ? 'bottom' : 'right';\n const arrowElementSize = getOuterSizes(arrowElement)[len];\n const placementVariation = data.placement.split(' ')[1];\n\n // top/left side\n if (\n (data.offsets.host[opSide] ?? 0) - arrowElementSize <\n (targetOffsets[side] ?? 0)\n ) {\n targetOffsets[side] -=\n (targetOffsets[side] ?? 0) -\n ((data.offsets.host[opSide] ?? 0) - arrowElementSize);\n }\n // bottom/right side\n if (\n Number(data.offsets.host[side]) + Number(arrowElementSize) >\n (targetOffsets[opSide] ?? 0)\n ) {\n targetOffsets[side] +=\n Number(data.offsets.host[side]) +\n Number(arrowElementSize) -\n Number(targetOffsets[opSide]);\n }\n targetOffsets = getClientRect(targetOffsets);\n\n // Compute the sideValue using the updated target offsets\n // take target margin in account because we don't have this info available\n const css = getStyleComputedProperty(\n data.instance.target,\n ) as unknown as Record;\n const targetMarginSide = parseFloat(css[`margin${sideCapitalized}`]) || 0;\n const targetBorderSide =\n parseFloat(css[`border${sideCapitalized}Width`]) || 0;\n\n // compute center of the target\n let center: number;\n if (!placementVariation) {\n center =\n Number(data.offsets.host[side]) +\n Number(data.offsets.host[len] / 2 - arrowElementSize / 2);\n } else {\n const targetBorderRadius = parseFloat(css['borderRadius']) || 0;\n const targetSideArrowOffset = Number(\n targetMarginSide + targetBorderSide + targetBorderRadius,\n );\n center =\n side === placementVariation\n ? Number(data.offsets.host[side]) + targetSideArrowOffset\n : Number(data.offsets.host[side]) +\n Number(data.offsets.host[len] - targetSideArrowOffset);\n }\n\n let sideValue =\n center - (targetOffsets[side] ?? 0) - targetMarginSide - targetBorderSide;\n\n // prevent arrowElement from being placed not contiguously to its target\n sideValue = Math.max(\n Math.min(targetOffsets[len] - (arrowElementSize + 5), sideValue),\n 0,\n );\n data.offsets.arrow = {\n [side]: Math.round(sideValue),\n [altSide]: '', // make sure to unset any eventual altSide value from the DOM node\n };\n\n data.instance.arrow = arrowElement;\n\n return data;\n}\n","import { Data } from '../models';\nimport {\n computeAutoPlacement,\n getBoundaries,\n getClientRect,\n getOppositeVariation,\n getTargetOffsets,\n isModifierEnabled,\n} from '../utils';\n\nexport function flip(data: Data): Data {\n data.offsets.target = getClientRect(data.offsets.target);\n\n if (!isModifierEnabled(data.options, 'flip')) {\n data.offsets.target = {\n ...data.offsets.target,\n ...getTargetOffsets(\n data.instance.target,\n data.offsets.host,\n data.placement,\n ),\n };\n\n return data;\n }\n\n const boundaries = getBoundaries(\n data.instance.target,\n data.instance.host,\n 0, // padding\n 'viewport',\n false, // positionFixed\n );\n\n let placement = data.placement.split(' ')[0];\n let variation = data.placement.split(' ')[1] || '';\n\n const offsetsHost = data.offsets.host;\n const target = data.instance.target;\n const host = data.instance.host;\n\n const adaptivePosition = computeAutoPlacement(\n 'auto',\n offsetsHost,\n target,\n host,\n data.options.allowedPositions,\n );\n const flipOrder = [placement, adaptivePosition];\n\n flipOrder.forEach((step, index) => {\n if (placement !== step || flipOrder.length === index + 1) {\n return;\n }\n\n placement = data.placement.split(' ')[0];\n\n // using floor because the host offsets may contain decimals we are not going to consider here\n const overlapsRef =\n (placement === 'left' &&\n Math.floor(data.offsets.target.right ?? 0) >\n Math.floor(data.offsets.host.left ?? 0)) ||\n (placement === 'right' &&\n Math.floor(data.offsets.target.left ?? 0) <\n Math.floor(data.offsets.host.right ?? 0)) ||\n (placement === 'top' &&\n Math.floor(data.offsets.target.bottom ?? 0) >\n Math.floor(data.offsets.host.top ?? 0)) ||\n (placement === 'bottom' &&\n Math.floor(data.offsets.target.top ?? 0) <\n Math.floor(data.offsets.host.bottom ?? 0));\n\n const overflowsLeft =\n Math.floor(data.offsets.target.left ?? 0) <\n Math.floor(boundaries.left ?? 0);\n const overflowsRight =\n Math.floor(data.offsets.target.right ?? 0) >\n Math.floor(boundaries.right ?? 0);\n const overflowsTop =\n Math.floor(data.offsets.target.top ?? 0) <\n Math.floor(boundaries.top ?? 0);\n const overflowsBottom =\n Math.floor(data.offsets.target.bottom ?? 0) >\n Math.floor(boundaries.bottom ?? 0);\n\n const overflowsBoundaries =\n (placement === 'left' && overflowsLeft) ||\n (placement === 'right' && overflowsRight) ||\n (placement === 'top' && overflowsTop) ||\n (placement === 'bottom' && overflowsBottom);\n\n // flip the variation if required\n const isVertical = ['top', 'bottom'].indexOf(placement) !== -1;\n const flippedVariation =\n (isVertical && variation === 'left' && overflowsLeft) ||\n (isVertical && variation === 'right' && overflowsRight) ||\n (!isVertical && variation === 'left' && overflowsTop) ||\n (!isVertical && variation === 'right' && overflowsBottom);\n\n if (overlapsRef || overflowsBoundaries || flippedVariation) {\n if (overlapsRef || overflowsBoundaries) {\n placement = flipOrder[index + 1];\n }\n\n if (flippedVariation) {\n variation = getOppositeVariation(variation);\n }\n\n data.placement = placement + (variation ? ` ${variation}` : '');\n\n data.offsets.target = {\n ...data.offsets.target,\n ...getTargetOffsets(\n data.instance.target,\n data.offsets.host,\n data.placement,\n ),\n };\n }\n });\n\n return data;\n}\n","import { Data, Options } from '../models';\nimport {\n computeAutoPlacement,\n getReferenceOffsets,\n getTargetOffsets,\n} from '../utils';\n\nexport function initData(\n targetElement: HTMLElement | null,\n hostElement: HTMLElement | null,\n position: string,\n options?: Options,\n): Data | undefined {\n if (!targetElement || !hostElement) {\n return;\n }\n\n const hostElPosition = getReferenceOffsets(targetElement, hostElement);\n\n if (\n !position.match(/^(auto)*\\s*(left|right|top|bottom|start|end)*$/) &&\n !position.match(\n /^(left|right|top|bottom|start|end)*(?: (left|right|top|bottom|start|end))*$/,\n )\n ) {\n position = 'auto';\n }\n\n const placementAuto = !!position.match(/auto/g);\n\n // support old placements 'auto left|right|top|bottom'\n let placement = position.match(/auto\\s(left|right|top|bottom|start|end)/)\n ? position.split(' ')[1] || 'auto'\n : position;\n\n // Normalize placements that have identical main placement and variation (\"right right\" => \"right\").\n const matches = placement.match(\n /^(left|right|top|bottom|start|end)* ?(?!\\1)(left|right|top|bottom|start|end)?/,\n );\n if (matches) {\n placement = matches[1] + (matches[2] ? ` ${matches[2]}` : '');\n }\n\n // \"left right\", \"top bottom\" etc. placements also considered incorrect.\n if (\n ['left right', 'right left', 'top bottom', 'bottom top'].indexOf(\n placement,\n ) !== -1\n ) {\n placement = 'auto';\n }\n\n placement = computeAutoPlacement(\n placement,\n hostElPosition,\n targetElement,\n hostElement,\n options ? options.allowedPositions : undefined,\n );\n\n const targetOffset = getTargetOffsets(\n targetElement,\n hostElPosition,\n placement,\n );\n\n return {\n options: options || { modifiers: {} },\n instance: {\n target: targetElement,\n host: hostElement,\n arrow: void 0,\n },\n offsets: {\n target: targetOffset,\n host: hostElPosition,\n arrow: void 0,\n },\n positionFixed: false,\n placement,\n placementAuto,\n };\n}\n","import { Data, Offsets } from '../models';\nimport { getBoundaries, isModifierEnabled } from '../utils';\n\nexport function preventOverflow(data: Data): Data {\n if (!isModifierEnabled(data.options, 'preventOverflow')) {\n return data;\n }\n\n // NOTE: DOM access here\n // resets the target Offsets's position so that the document size can be calculated excluding\n // the size of the targetOffsets element itself\n const transformProp = 'transform';\n const targetStyles = data.instance.target.style; // assignment to help minification\n const { top, left, [transformProp]: transform } = targetStyles;\n targetStyles.top = '';\n targetStyles.left = '';\n targetStyles[transformProp] = '';\n\n const boundaries = getBoundaries(\n data.instance.target,\n data.instance.host,\n 0, // padding\n data.options.modifiers.preventOverflow?.boundariesElement || 'scrollParent',\n false, // positionFixed\n );\n\n // NOTE: DOM access here\n // restores the original style properties after the offsets have been computed\n targetStyles.top = top;\n targetStyles.left = left;\n targetStyles[transformProp] = transform;\n\n const order = ['left', 'right', 'top', 'bottom'];\n\n const check = {\n primary(placement: keyof Offsets) {\n let value = data.offsets.target[placement];\n // options.escapeWithReference\n if (\n (data.offsets.target[placement] ?? 0) < (boundaries[placement] ?? 0)\n ) {\n value = Math.max(\n data.offsets.target[placement] ?? 0,\n boundaries[placement] ?? 0,\n );\n }\n\n return { [placement]: value };\n },\n secondary(placement: keyof Offsets) {\n const mainSide = placement === 'right' ? 'left' : 'top';\n let value = data.offsets.target[mainSide];\n\n // escapeWithReference\n if (\n (data.offsets.target[placement] ?? 0) < (boundaries[placement] ?? 0) &&\n placement !== 'right'\n ) {\n value = Math.min(\n data.offsets.target[mainSide] ?? 0,\n (boundaries[placement] ?? 0) - data.offsets.target.height,\n );\n }\n\n if (\n (data.offsets.target[placement] ?? 0) > (boundaries[placement] ?? 0) &&\n placement === 'right'\n ) {\n value = Math.min(\n data.offsets.target[mainSide] ?? 0,\n (boundaries[placement] ?? 0) - data.offsets.target.width,\n );\n }\n\n return { [mainSide]: value };\n },\n };\n\n order.forEach((placement) => {\n const side =\n ['left', 'top', 'start'].indexOf(placement) !== -1\n ? check['primary']\n : check['secondary'];\n\n data.offsets.target = {\n ...data.offsets.target,\n ...side(placement as keyof Offsets),\n };\n });\n\n return data;\n}\n","import { Data } from '../models';\n\nexport function shift(data: Data): Data {\n const placement = data.placement;\n const basePlacement = placement.split(' ')[0];\n const shiftVariation = placement.split(' ')[1];\n\n if (shiftVariation) {\n const { host, target } = data.offsets;\n const isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;\n const side = isVertical ? 'left' : 'top';\n const measurement = isVertical ? 'width' : 'height';\n\n const shiftOffsets = {\n start: { [side]: host[side] },\n end: {\n [side]: (host[side] ?? 0) + host[measurement] - target[measurement],\n },\n };\n\n data.offsets.target = {\n ...target,\n ...{\n [side]:\n side === shiftVariation\n ? shiftOffsets.start[side]\n : shiftOffsets.end[side],\n },\n };\n }\n\n return data;\n}\n","/**\n * @copyright Valor Software\n * @copyright Federico Zivolo and contributors\n */\nimport { Renderer2 } from '@angular/core';\n\nimport { Data, MapPlacementInToRL, Offsets, Options } from './models';\nimport { arrow, flip, initData, preventOverflow, shift } from './modifiers';\nimport {\n getOffsets,\n getReferenceOffsets,\n setStyles,\n updateContainerClass,\n} from './utils';\n\nexport class Positioning {\n position(\n hostElement: HTMLElement,\n targetElement: HTMLElement /*, round = true*/,\n ): Offsets | undefined {\n return this.offset(hostElement, targetElement /*, false*/);\n }\n\n offset(\n hostElement: HTMLElement,\n targetElement: HTMLElement /*, round = true*/,\n ): Offsets | undefined {\n return getReferenceOffsets(targetElement, hostElement);\n }\n\n positionElements(\n hostElement: HTMLElement | null,\n targetElement: HTMLElement | null,\n position: string,\n appendToBody?: boolean,\n options?: Options,\n ): Data | undefined {\n const chainOfModifiers = [flip, shift, preventOverflow, arrow];\n const _position =\n MapPlacementInToRL[position as keyof typeof MapPlacementInToRL];\n const data = initData(targetElement, hostElement, _position, options);\n if (!data) {\n return;\n }\n\n return chainOfModifiers.reduce(\n (modifiedData, modifier) => modifier(modifiedData),\n data,\n );\n }\n}\n\nconst positionService = new Positioning();\n\nexport function positionElements(\n hostElement: HTMLElement | null,\n targetElement: HTMLElement | null,\n placement: string,\n appendToBody?: boolean,\n options?: Options,\n renderer?: Renderer2,\n): void {\n const data = positionService.positionElements(\n hostElement,\n targetElement,\n placement,\n appendToBody,\n options,\n );\n\n if (!data) {\n return;\n }\n\n const offsets = getOffsets(data);\n\n setStyles(\n targetElement,\n {\n 'will-change': 'transform',\n top: '0px',\n left: '0px',\n transform: `translate3d(${offsets.left}px, ${offsets.top}px, 0px)`,\n },\n renderer,\n );\n\n if (data.instance.arrow) {\n setStyles(data.instance.arrow, data.offsets.arrow, renderer);\n }\n\n updateContainerClass(data, renderer);\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n ElementRef,\n Inject,\n Injectable,\n NgZone,\n PLATFORM_ID,\n RendererFactory2,\n} from '@angular/core';\nimport {\n animationFrameScheduler,\n fromEvent,\n merge,\n Observable,\n of,\n Subject,\n} from 'rxjs';\n\nimport { Options } from './models';\nimport { positionElements } from './ng-positioning';\n\nexport interface PositioningOptions {\n /** The DOM element, ElementRef, or a selector string of an element which will be moved */\n element?: HTMLElement | ElementRef | string;\n\n /** The DOM element, ElementRef, or a selector string of an element which the element will be attached to */\n target?: HTMLElement | ElementRef | string;\n\n /**\n * A string of the form 'vert-attachment horiz-attachment' or 'placement'\n * - placement can be \"top\", \"bottom\", \"left\", \"right\"\n * not yet supported:\n * - vert-attachment can be any of 'top', 'middle', 'bottom'\n * - horiz-attachment can be any of 'left', 'center', 'right'\n */\n attachment?: string;\n\n /** A string similar to `attachment`. The one difference is that, if it's not provided,\n * `targetAttachment` will assume the mirror image of `attachment`.\n */\n targetAttachment?: string;\n\n /** A string of the form 'vert-offset horiz-offset'\n * - vert-offset and horiz-offset can be of the form \"20px\" or \"55%\"\n */\n offset?: string;\n\n /** A string similar to `offset`, but referring to the offset of the target */\n targetOffset?: string;\n\n /** If true component will be attached to body */\n appendToBody?: boolean;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class PositioningService {\n private options?: Options;\n private update$$ = new Subject();\n private positionElements = new Map();\n private triggerEvent$?: Observable;\n private isDisabled = false;\n\n constructor(\n ngZone: NgZone,\n rendererFactory: RendererFactory2,\n @Inject(PLATFORM_ID) platformId: number,\n ) {\n if (isPlatformBrowser(platformId)) {\n ngZone.runOutsideAngular(() => {\n this.triggerEvent$ = merge(\n fromEvent(window, 'scroll', { passive: true }),\n fromEvent(window, 'resize', { passive: true }),\n of(0, animationFrameScheduler),\n this.update$$,\n );\n\n this.triggerEvent$.subscribe(() => {\n if (this.isDisabled) {\n return;\n }\n\n this.positionElements\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .forEach((positionElement: any) => {\n positionElements(\n _getHtmlElement(positionElement.target),\n _getHtmlElement(positionElement.element),\n positionElement.attachment,\n positionElement.appendToBody,\n this.options,\n rendererFactory.createRenderer(null, null),\n );\n });\n });\n });\n }\n }\n\n get event$(): Observable | undefined {\n return this.triggerEvent$;\n }\n\n position(options: PositioningOptions): void {\n this.addPositionElement(options);\n }\n\n disable(): void {\n this.isDisabled = true;\n }\n\n enable(): void {\n this.isDisabled = false;\n }\n\n addPositionElement(options: PositioningOptions): void {\n this.positionElements.set(_getHtmlElement(options.element), options);\n }\n\n calcPosition(): void {\n this.update$$.next(null);\n }\n\n deletePositionElement(elRef: ElementRef): void {\n this.positionElements.delete(_getHtmlElement(elRef));\n }\n\n setOptions(options: Options): void {\n this.options = options;\n }\n}\n\nfunction _getHtmlElement(\n element?: HTMLElement | ElementRef | string,\n): HTMLElement | null {\n // it means that we got a selector\n if (typeof element === 'string') {\n return document.querySelector(element);\n }\n\n if (element instanceof ElementRef) {\n return element.nativeElement;\n }\n\n return element ?? null;\n}\n","import {\n ApplicationRef,\n ComponentFactoryResolver,\n ElementRef,\n Injectable,\n Injector,\n NgZone,\n Renderer2,\n ViewContainerRef,\n} from '@angular/core';\n\nimport { PositioningService } from '@shared/util-positioning';\n\nimport { ComponentLoader } from './component-loader.class';\n\n@Injectable({ providedIn: 'root' })\nexport class ComponentLoaderFactory {\n constructor(\n private _componentFactoryResolver: ComponentFactoryResolver,\n private _ngZone: NgZone,\n private _injector: Injector,\n private _posService: PositioningService,\n private _applicationRef: ApplicationRef,\n ) {}\n\n /**\n *\n * @param _elementRef\n * @param _viewContainerRef\n * @param _renderer\n */\n createLoader(\n _elementRef?: ElementRef,\n _viewContainerRef?: ViewContainerRef,\n _renderer?: Renderer2,\n ): ComponentLoader {\n return new ComponentLoader(\n _viewContainerRef,\n _renderer,\n _elementRef,\n this._injector,\n this._componentFactoryResolver,\n this._ngZone,\n this._applicationRef,\n this._posService,\n );\n }\n}\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\n/* eslint-disable */\n\n/**\n * Type describing the allowed values for a boolean input.\n * @docs-private\n */\nexport type BooleanInput = string | boolean | null | undefined;\n\n/** Coerces a data-bound value (typically a string) to a boolean. */\nexport function coerceBooleanProperty(value: any): boolean {\n return value != null && `${value}` !== 'false';\n}\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\n/* eslint-disable */\n\nimport { Inject, Injectable, PLATFORM_ID } 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: boolean;\n\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 =\n typeof Intl !== 'undefined' && (Intl as any).v8BreakIterator;\n} catch {\n hasV8BreakIterator = false;\n}\n\n/**\n * Service to detect the current platform by comparing the userAgent strings and\n * checking browser-specific global properties.\n */\n@Injectable({ providedIn: 'root' })\nexport class Platform {\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 isBrowser: boolean = this._platformId\n ? isPlatformBrowser(this._platformId)\n : typeof document === 'object' && !!document;\n\n /** Whether the current browser is Microsoft Edge. */\n EDGE: boolean = this.isBrowser && /(edge)/i.test(navigator.userAgent);\n\n /** Whether the current rendering engine is Microsoft Trident. */\n TRIDENT: boolean =\n this.isBrowser && /(msie|trident)/i.test(navigator.userAgent);\n\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 BLINK: boolean =\n this.isBrowser &&\n !!((window as any).chrome || hasV8BreakIterator) &&\n typeof CSS !== 'undefined' &&\n !this.EDGE &&\n !this.TRIDENT;\n\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 WEBKIT: boolean =\n this.isBrowser &&\n /AppleWebKit/i.test(navigator.userAgent) &&\n !this.BLINK &&\n !this.EDGE &&\n !this.TRIDENT;\n\n /** Whether the current platform is Apple iOS. */\n IOS: boolean =\n this.isBrowser &&\n /iPad|iPhone|iPod/.test(navigator.userAgent) &&\n !('MSStream' in window);\n\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 FIREFOX: boolean =\n this.isBrowser && /(firefox|minefield)/i.test(navigator.userAgent);\n\n /** Whether the current platform is Android. */\n // Trident on mobile adds the android platform to the userAgent to trick detections.\n ANDROID: boolean =\n this.isBrowser && /android/i.test(navigator.userAgent) && !this.TRIDENT;\n\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 SAFARI: boolean =\n this.isBrowser && /safari/i.test(navigator.userAgent) && this.WEBKIT;\n\n constructor(@Inject(PLATFORM_ID) private _platformId: Object) {}\n}\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\n/* eslint-disable */\n\nimport { Platform } from './platform';\nimport { Injectable } from '@angular/core';\n\n/**\n * Configuration for the isFocusable method.\n */\nexport class IsFocusableConfig {\n /**\n * Whether to count an element as focusable even if it is not currently visible.\n */\n ignoreVisibility: boolean = false;\n}\n\n// The InteractivityChecker leans heavily on the ally.js accessibility utilities.\n// Methods like `isTabbable` are only covering specific edge-cases for the browsers which are\n// supported.\n\n/**\n * Utility for checking the interactivity of an element, such as whether is is focusable or\n * tabbable.\n */\n@Injectable({ providedIn: 'root' })\nexport class InteractivityChecker {\n constructor(private _platform: Platform) {}\n\n /**\n * Gets whether an element is disabled.\n *\n * @param element Element to be checked.\n * @returns Whether the element is disabled.\n */\n isDisabled(element: HTMLElement): boolean {\n // This does not capture some cases, such as a non-form control with a disabled attribute or\n // a form control inside of a disabled form, but should capture the most common cases.\n return element.hasAttribute('disabled');\n }\n\n /**\n * Gets whether an element is visible for the purposes of interactivity.\n *\n * This will capture states like `display: none` and `visibility: hidden`, but not things like\n * being clipped by an `overflow: hidden` parent or being outside the viewport.\n *\n * @returns Whether the element is visible.\n */\n isVisible(element: HTMLElement): boolean {\n return (\n hasGeometry(element) && getComputedStyle(element).visibility === 'visible'\n );\n }\n\n /**\n * Gets whether an element can be reached via Tab key.\n * Assumes that the element has already been checked with isFocusable.\n *\n * @param element Element to be checked.\n * @returns Whether the element is tabbable.\n */\n isTabbable(element: HTMLElement): boolean {\n // Nothing is tabbable on the server 😎\n if (!this._platform.isBrowser) {\n return false;\n }\n\n const frameElement = getFrameElement(getWindow(element));\n\n if (frameElement) {\n // Frame elements inherit their tabindex onto all child elements.\n if (getTabIndexValue(frameElement) === -1) {\n return false;\n }\n\n // Browsers disable tabbing to an element inside of an invisible frame.\n if (!this.isVisible(frameElement)) {\n return false;\n }\n }\n\n let nodeName = element.nodeName.toLowerCase();\n let tabIndexValue = getTabIndexValue(element);\n\n if (element.hasAttribute('contenteditable')) {\n return tabIndexValue !== -1;\n }\n\n if (nodeName === 'iframe' || nodeName === 'object') {\n // The frame or object's content may be tabbable depending on the content, but it's\n // not possibly to reliably detect the content of the frames. We always consider such\n // elements as non-tabbable.\n return false;\n }\n\n // In iOS, the browser only considers some specific elements as tabbable.\n if (\n this._platform.WEBKIT &&\n this._platform.IOS &&\n !isPotentiallyTabbableIOS(element)\n ) {\n return false;\n }\n\n if (nodeName === 'audio') {\n // Audio elements without controls enabled are never tabbable, regardless\n // of the tabindex attribute explicitly being set.\n if (!element.hasAttribute('controls')) {\n return false;\n }\n // Audio elements with controls are by default tabbable unless the\n // tabindex attribute is set to `-1` explicitly.\n return tabIndexValue !== -1;\n }\n\n if (nodeName === 'video') {\n // For all video elements, if the tabindex attribute is set to `-1`, the video\n // is not tabbable. Note: We cannot rely on the default `HTMLElement.tabIndex`\n // property as that one is set to `-1` in Chrome, Edge and Safari v13.1. The\n // tabindex attribute is the source of truth here.\n if (tabIndexValue === -1) {\n return false;\n }\n // If the tabindex is explicitly set, and not `-1` (as per check before), the\n // video element is always tabbable (regardless of whether it has controls or not).\n if (tabIndexValue !== null) {\n return true;\n }\n // Otherwise (when no explicit tabindex is set), a video is only tabbable if it\n // has controls enabled. Firefox is special as videos are always tabbable regardless\n // of whether there are controls or not.\n return this._platform.FIREFOX || element.hasAttribute('controls');\n }\n\n return element.tabIndex >= 0;\n }\n\n /**\n * Gets whether an element can be focused by the user.\n *\n * @param element Element to be checked.\n * @param config The config object with options to customize this method's behavior\n * @returns Whether the element is focusable.\n */\n isFocusable(element: HTMLElement, config?: IsFocusableConfig): boolean {\n // Perform checks in order of left to most expensive.\n // Again, naive approach that does not capture many edge cases and browser quirks.\n return (\n isPotentiallyFocusable(element) &&\n !this.isDisabled(element) &&\n (config?.ignoreVisibility || this.isVisible(element))\n );\n }\n}\n\n/**\n * Returns the frame element from a window object. Since browsers like MS Edge throw errors if\n * the frameElement property is being accessed from a different host address, this property\n * should be accessed carefully.\n */\nfunction getFrameElement(window: Window) {\n try {\n return window.frameElement as HTMLElement;\n } catch {\n return null;\n }\n}\n\n/** Checks whether the specified element has any geometry / rectangles. */\nfunction hasGeometry(element: HTMLElement): boolean {\n // Use logic from jQuery to check for an invisible element.\n // See https://github.com/jquery/jquery/blob/master/src/css/hiddenVisibleSelectors.js#L12\n return !!(\n element.offsetWidth ||\n element.offsetHeight ||\n (typeof element.getClientRects === 'function' &&\n element.getClientRects().length)\n );\n}\n\n/** Gets whether an element's */\nfunction isNativeFormElement(element: Node) {\n let nodeName = element.nodeName.toLowerCase();\n return (\n nodeName === 'input' ||\n nodeName === 'select' ||\n nodeName === 'button' ||\n nodeName === 'textarea'\n );\n}\n\n/** Gets whether an element is an ``. */\nfunction isHiddenInput(element: HTMLElement): boolean {\n return isInputElement(element) && element.type == 'hidden';\n}\n\n/** Gets whether an element is an anchor that has an href attribute. */\nfunction isAnchorWithHref(element: HTMLElement): boolean {\n return isAnchorElement(element) && element.hasAttribute('href');\n}\n\n/** Gets whether an element is an input element. */\nfunction isInputElement(element: HTMLElement): element is HTMLInputElement {\n return element.nodeName.toLowerCase() == 'input';\n}\n\n/** Gets whether an element is an anchor element. */\nfunction isAnchorElement(element: HTMLElement): element is HTMLAnchorElement {\n return element.nodeName.toLowerCase() == 'a';\n}\n\n/** Gets whether an element has a valid tabindex. */\nfunction hasValidTabIndex(element: HTMLElement): boolean {\n if (!element.hasAttribute('tabindex') || element.tabIndex === undefined) {\n return false;\n }\n\n let tabIndex = element.getAttribute('tabindex');\n\n // IE11 parses tabindex=\"\" as the value \"-32768\"\n if (tabIndex == '-32768') {\n return false;\n }\n\n return !!(tabIndex && !isNaN(parseInt(tabIndex, 10)));\n}\n\n/**\n * Returns the parsed tabindex from the element attributes instead of returning the\n * evaluated tabindex from the browsers defaults.\n */\nfunction getTabIndexValue(element: HTMLElement): number | null {\n if (!hasValidTabIndex(element)) {\n return null;\n }\n\n // See browser issue in Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054\n const tabIndex = parseInt(element.getAttribute('tabindex') || '', 10);\n\n return isNaN(tabIndex) ? -1 : tabIndex;\n}\n\n/** Checks whether the specified element is potentially tabbable on iOS */\nfunction isPotentiallyTabbableIOS(element: HTMLElement): boolean {\n let nodeName = element.nodeName.toLowerCase();\n let inputType = nodeName === 'input' && (element as HTMLInputElement).type;\n\n return (\n inputType === 'text' ||\n inputType === 'password' ||\n nodeName === 'select' ||\n nodeName === 'textarea'\n );\n}\n\n/**\n * Gets whether an element is potentially focusable without taking current visible/disabled state\n * into account.\n */\nfunction isPotentiallyFocusable(element: HTMLElement): boolean {\n // Inputs are potentially focusable *unless* they're type=\"hidden\".\n if (isHiddenInput(element)) {\n return false;\n }\n\n return (\n isNativeFormElement(element) ||\n isAnchorWithHref(element) ||\n element.hasAttribute('contenteditable') ||\n hasValidTabIndex(element)\n );\n}\n\n/** Gets the parent window of a DOM node with regards of being inside of an iframe. */\nfunction getWindow(node: HTMLElement): Window {\n // ownerDocument is null if `node` itself *is* a document.\n return (node.ownerDocument && node.ownerDocument.defaultView) || window;\n}\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\n/* eslint-disable */\n\nimport { coerceBooleanProperty, BooleanInput } from './boolean-property';\nimport { DOCUMENT } from '@angular/common';\nimport {\n AfterContentInit,\n Directive,\n ElementRef,\n Inject,\n Injectable,\n Input,\n NgZone,\n OnDestroy,\n DoCheck,\n SimpleChanges,\n OnChanges,\n} from '@angular/core';\nimport { take } from 'rxjs/operators';\nimport { InteractivityChecker } from './interactivity-checker';\n\n/**\n * Class that allows for trapping focus within a DOM element.\n *\n * This class currently uses a relatively simple approach to focus trapping.\n * It assumes that the tab order is the same as DOM order, which is not necessarily true.\n * Things like `tabIndex > 0`, flex `order`, and shadow roots can cause the two to misalign.\n *\n * @deprecated Use `ConfigurableFocusTrap` instead.\n * @breaking-change for 11.0.0 Remove this class.\n */\nexport class FocusTrap {\n private _startAnchor?: HTMLElement | null;\n private _endAnchor?: HTMLElement | null;\n private _hasAttached = false;\n\n // Event listeners for the anchors. Need to be regular functions so that we can unbind them later.\n protected startAnchorListener = () => this.focusLastTabbableElement();\n protected endAnchorListener = () => this.focusFirstTabbableElement();\n\n /** Whether the focus trap is active. */\n get enabled(): boolean {\n return this._enabled;\n }\n\n set enabled(value: boolean) {\n this._enabled = value;\n\n if (this._startAnchor && this._endAnchor) {\n this._toggleAnchorTabIndex(value, this._startAnchor);\n this._toggleAnchorTabIndex(value, this._endAnchor);\n }\n }\n\n protected _enabled: boolean = true;\n\n constructor(\n readonly _element: HTMLElement,\n private _checker: InteractivityChecker,\n readonly _ngZone: NgZone,\n readonly _document: Document,\n deferAnchors = false,\n ) {\n if (!deferAnchors) {\n this.attachAnchors();\n }\n }\n\n /** Destroys the focus trap by cleaning up the anchors. */\n destroy() {\n const startAnchor = this._startAnchor;\n const endAnchor = this._endAnchor;\n\n if (startAnchor) {\n startAnchor.removeEventListener('focus', this.startAnchorListener);\n\n if (startAnchor.parentNode) {\n startAnchor.parentNode.removeChild(startAnchor);\n }\n }\n\n if (endAnchor) {\n endAnchor.removeEventListener('focus', this.endAnchorListener);\n\n if (endAnchor.parentNode) {\n endAnchor.parentNode.removeChild(endAnchor);\n }\n }\n\n this._startAnchor = this._endAnchor = null;\n this._hasAttached = false;\n }\n\n /**\n * Inserts the anchors into the DOM. This is usually done automatically\n * in the constructor, but can be deferred for cases like directives with `*ngIf`.\n * @returns Whether the focus trap managed to attach successfuly. This may not be the case\n * if the target element isn't currently in the DOM.\n */\n attachAnchors(): boolean {\n // If we're not on the browser, there can be no focus to trap.\n if (this._hasAttached) {\n return true;\n }\n\n this._ngZone.runOutsideAngular(() => {\n if (!this._startAnchor) {\n this._startAnchor = this._createAnchor();\n this._startAnchor!.addEventListener('focus', this.startAnchorListener);\n }\n\n if (!this._endAnchor) {\n this._endAnchor = this._createAnchor();\n this._endAnchor!.addEventListener('focus', this.endAnchorListener);\n }\n });\n\n if (this._element.parentNode) {\n this._element.parentNode.insertBefore(this._startAnchor!, this._element);\n this._element.parentNode.insertBefore(\n this._endAnchor!,\n this._element.nextSibling,\n );\n this._hasAttached = true;\n }\n\n return this._hasAttached;\n }\n\n /**\n * Waits for the zone to stabilize, then either focuses the first element that the\n * user specified, or the first tabbable element.\n * @returns Returns a promise that resolves with a boolean, depending\n * on whether focus was moved successfully.\n */\n focusInitialElementWhenReady(): Promise {\n return new Promise((resolve) => {\n this._executeOnStable(() => resolve(this.focusInitialElement()));\n });\n }\n\n /**\n * Waits for the zone to stabilize, then focuses\n * the first tabbable element within the focus trap region.\n * @returns Returns a promise that resolves with a boolean, depending\n * on whether focus was moved successfully.\n */\n focusFirstTabbableElementWhenReady(): Promise {\n return new Promise((resolve) => {\n this._executeOnStable(() => resolve(this.focusFirstTabbableElement()));\n });\n }\n\n /**\n * Waits for the zone to stabilize, then focuses\n * the last tabbable element within the focus trap region.\n * @returns Returns a promise that resolves with a boolean, depending\n * on whether focus was moved successfully.\n */\n focusLastTabbableElementWhenReady(): Promise {\n return new Promise((resolve) => {\n this._executeOnStable(() => resolve(this.focusLastTabbableElement()));\n });\n }\n\n /**\n * Get the specified boundary element of the trapped region.\n * @param bound The boundary to get (start or end of trapped region).\n * @returns The boundary element.\n */\n private _getRegionBoundary(bound: 'start' | 'end'): HTMLElement | null {\n // Contains the deprecated version of selector, for temporary backwards comparability.\n let markers = this._element.querySelectorAll(\n `[cdk-focus-region-${bound}], ` +\n `[cdkFocusRegion${bound}], ` +\n `[cdk-focus-${bound}]`,\n ) as NodeListOf;\n\n for (let i = 0; i < markers.length; i++) {\n // @breaking-change 8.0.0\n if (markers[i].hasAttribute(`cdk-focus-${bound}`)) {\n console.warn(\n `Found use of deprecated attribute 'cdk-focus-${bound}', ` +\n `use 'cdkFocusRegion${bound}' instead. The deprecated ` +\n `attribute will be removed in 8.0.0.`,\n markers[i],\n );\n } else if (markers[i].hasAttribute(`cdk-focus-region-${bound}`)) {\n console.warn(\n `Found use of deprecated attribute 'cdk-focus-region-${bound}', ` +\n `use 'cdkFocusRegion${bound}' instead. The deprecated attribute ` +\n `will be removed in 8.0.0.`,\n markers[i],\n );\n }\n }\n\n if (bound == 'start') {\n return markers.length\n ? markers[0]\n : this._getFirstTabbableElement(this._element);\n }\n return markers.length\n ? markers[markers.length - 1]\n : this._getLastTabbableElement(this._element);\n }\n\n /**\n * Focuses the element that should be focused when the focus trap is initialized.\n * @returns Whether focus was moved successfully.\n */\n focusInitialElement(): boolean {\n // Contains the deprecated version of selector, for temporary backwards comparability.\n const redirectToElement = this._element.querySelector(\n `[cdk-focus-initial], ` + `[cdkFocusInitial]`,\n ) as HTMLElement;\n\n if (redirectToElement) {\n // @breaking-change 8.0.0\n if (redirectToElement.hasAttribute(`cdk-focus-initial`)) {\n console.warn(\n `Found use of deprecated attribute 'cdk-focus-initial', ` +\n `use 'cdkFocusInitial' instead. The deprecated attribute ` +\n `will be removed in 8.0.0`,\n redirectToElement,\n );\n }\n\n // Warn the consumer if the element they've pointed to\n // isn't focusable, when not in production mode.\n\n if (!this._checker.isFocusable(redirectToElement)) {\n const focusableChild = this._getFirstTabbableElement(\n redirectToElement,\n ) as HTMLElement;\n focusableChild?.focus();\n return !!focusableChild;\n }\n\n redirectToElement.focus();\n return true;\n }\n\n return this.focusFirstTabbableElement();\n }\n\n /**\n * Focuses the first tabbable element within the focus trap region.\n * @returns Whether focus was moved successfully.\n */\n focusFirstTabbableElement(): boolean {\n const redirectToElement = this._getRegionBoundary('start');\n\n if (redirectToElement) {\n redirectToElement.focus();\n }\n\n return !!redirectToElement;\n }\n\n /**\n * Focuses the last tabbable element within the focus trap region.\n * @returns Whether focus was moved successfully.\n */\n focusLastTabbableElement(): boolean {\n const redirectToElement = this._getRegionBoundary('end');\n\n if (redirectToElement) {\n redirectToElement.focus();\n }\n\n return !!redirectToElement;\n }\n\n /**\n * Checks whether the focus trap has successfully been attached.\n */\n hasAttached(): boolean {\n return this._hasAttached;\n }\n\n /** Get the first tabbable element from a DOM subtree (inclusive). */\n private _getFirstTabbableElement(root: HTMLElement): HTMLElement | null {\n if (this._checker.isFocusable(root) && this._checker.isTabbable(root)) {\n return root;\n }\n\n // Iterate in DOM order. Note that IE doesn't have `children` for SVG so we fall\n // back to `childNodes` which includes text nodes, comments etc.\n let children = root.children || root.childNodes;\n\n for (let i = 0; i < children.length; i++) {\n let tabbableChild =\n children[i].nodeType === this._document.ELEMENT_NODE\n ? this._getFirstTabbableElement(children[i] as HTMLElement)\n : null;\n\n if (tabbableChild) {\n return tabbableChild;\n }\n }\n\n return null;\n }\n\n /** Get the last tabbable element from a DOM subtree (inclusive). */\n private _getLastTabbableElement(root: HTMLElement): HTMLElement | null {\n if (this._checker.isFocusable(root) && this._checker.isTabbable(root)) {\n return root;\n }\n\n // Iterate in reverse DOM order.\n let children = root.children || root.childNodes;\n\n for (let i = children.length - 1; i >= 0; i--) {\n let tabbableChild =\n children[i].nodeType === this._document.ELEMENT_NODE\n ? this._getLastTabbableElement(children[i] as HTMLElement)\n : null;\n\n if (tabbableChild) {\n return tabbableChild;\n }\n }\n\n return null;\n }\n\n /** Creates an anchor element. */\n private _createAnchor(): HTMLElement {\n const anchor = this._document.createElement('div');\n this._toggleAnchorTabIndex(this._enabled, anchor);\n anchor.classList.add('cdk-visually-hidden');\n anchor.classList.add('cdk-focus-trap-anchor');\n anchor.setAttribute('aria-hidden', 'true');\n return anchor;\n }\n\n /**\n * Toggles the `tabindex` of an anchor, based on the enabled state of the focus trap.\n * @param isEnabled Whether the focus trap is enabled.\n * @param anchor Anchor on which to toggle the tabindex.\n */\n private _toggleAnchorTabIndex(isEnabled: boolean, anchor: HTMLElement) {\n // Remove the tabindex completely, rather than setting it to -1, because if the\n // element has a tabindex, the user might still hit it when navigating with the arrow keys.\n isEnabled\n ? anchor.setAttribute('tabindex', '0')\n : anchor.removeAttribute('tabindex');\n }\n\n /**\n * Toggles the`tabindex` of both anchors to either trap Tab focus or allow it to escape.\n * @param enabled: Whether the anchors should trap Tab.\n */\n protected toggleAnchors(enabled: boolean) {\n if (this._startAnchor && this._endAnchor) {\n this._toggleAnchorTabIndex(enabled, this._startAnchor);\n this._toggleAnchorTabIndex(enabled, this._endAnchor);\n }\n }\n\n /** Executes a function when the zone is stable. */\n private _executeOnStable(fn: () => any): void {\n if (this._ngZone.isStable) {\n fn();\n } else {\n this._ngZone.onStable.pipe(take(1)).subscribe(fn);\n }\n }\n}\n\n/**\n * Factory that allows easy instantiation of focus traps.\n * @deprecated Use `ConfigurableFocusTrapFactory` instead.\n * @breaking-change for 11.0.0 Remove this class.\n */\n@Injectable({ providedIn: 'root' })\nexport class FocusTrapFactory {\n private _document: Document;\n\n constructor(\n private _checker: InteractivityChecker,\n private _ngZone: NgZone,\n @Inject(DOCUMENT) _document: any,\n ) {\n this._document = _document;\n }\n\n /**\n * Creates a focus-trapped region around the given element.\n * @param element The element around which focus will be trapped.\n * @param deferCaptureElements Defers the creation of focus-capturing elements to be done\n * manually by the user.\n * @returns The created focus trap instance.\n */\n create(\n element: HTMLElement,\n deferCaptureElements: boolean = false,\n ): FocusTrap {\n return new FocusTrap(\n element,\n this._checker,\n this._ngZone,\n this._document,\n deferCaptureElements,\n );\n }\n}\n\n/** Directive for trapping focus within a region. */\n@Directive({\n selector: '[focusTrap]',\n exportAs: 'focusTrap',\n})\nexport class FocusTrapDirective\n implements OnDestroy, AfterContentInit, OnChanges, DoCheck\n{\n private _document: Document;\n\n /** Underlying FocusTrap instance. */\n focusTrap: FocusTrap;\n\n /** Previously focused element to restore focus to upon destroy when using autoCapture. */\n private _previouslyFocusedElement: HTMLElement | null = null;\n\n /** Whether the focus trap is active. */\n @Input('cdkTrapFocus')\n get enabled(): boolean {\n return this.focusTrap.enabled;\n }\n\n set enabled(value: boolean) {\n this.focusTrap.enabled = coerceBooleanProperty(value);\n }\n\n /**\n * Whether the directive should automatically move focus into the trapped region upon\n * initialization and return focus to the previous activeElement upon destruction.\n */\n @Input('cdkTrapFocusAutoCapture')\n get autoCapture(): boolean {\n return this._autoCapture;\n }\n\n set autoCapture(value: boolean) {\n this._autoCapture = coerceBooleanProperty(value);\n }\n\n private _autoCapture = false;\n\n constructor(\n private _elementRef: ElementRef,\n private _focusTrapFactory: FocusTrapFactory,\n @Inject(DOCUMENT) _document: any,\n ) {\n this._document = _document;\n this.focusTrap = this._focusTrapFactory.create(\n this._elementRef.nativeElement,\n true,\n );\n }\n\n ngOnDestroy() {\n this.focusTrap.destroy();\n\n // If we stored a previously focused element when using autoCapture, return focus to that\n // element now that the trapped region is being destroyed.\n if (this._previouslyFocusedElement) {\n this._previouslyFocusedElement.focus();\n this._previouslyFocusedElement = null;\n }\n }\n\n ngAfterContentInit() {\n this.focusTrap.attachAnchors();\n\n if (this.autoCapture) {\n this._captureFocus();\n }\n }\n\n ngDoCheck() {\n if (!this.focusTrap.hasAttached()) {\n this.focusTrap.attachAnchors();\n }\n }\n\n ngOnChanges(changes: SimpleChanges) {\n const autoCaptureChange = changes['autoCapture'];\n\n if (\n autoCaptureChange &&\n !autoCaptureChange.firstChange &&\n this.autoCapture &&\n this.focusTrap.hasAttached()\n ) {\n this._captureFocus();\n }\n }\n\n private _captureFocus() {\n this._previouslyFocusedElement = this._document\n .activeElement as HTMLElement;\n this.focusTrap.focusInitialElementWhenReady();\n }\n\n static ngAcceptInputType_enabled: BooleanInput;\n static ngAcceptInputType_autoCapture: BooleanInput;\n}\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\n/* eslint-disable */\n\nimport { Injectable } from '@angular/core';\n\n/**\n * A FocusTrap managed by FocusTrapManager.\n * Implemented by ConfigurableFocusTrap to avoid circular dependency.\n */\nexport interface ManagedFocusTrap {\n _enable(): void;\n _disable(): void;\n focusInitialElementWhenReady(): Promise;\n}\n\n/** Injectable that ensures only the most recently enabled FocusTrap is active. */\n@Injectable({ providedIn: 'root' })\nexport class FocusTrapManager {\n // A stack of the FocusTraps on the page. Only the FocusTrap at the\n // top of the stack is active.\n private _focusTrapStack: ManagedFocusTrap[] = [];\n\n /**\n * Disables the FocusTrap at the top of the stack, and then pushes\n * the new FocusTrap onto the stack.\n */\n register(focusTrap: ManagedFocusTrap): void {\n // Dedupe focusTraps that register multiple times.\n this._focusTrapStack = this._focusTrapStack.filter(\n (ft) => ft !== focusTrap,\n );\n\n let stack = this._focusTrapStack;\n\n if (stack.length) {\n stack[stack.length - 1]._disable();\n }\n\n stack.push(focusTrap);\n focusTrap._enable();\n }\n\n /**\n * Removes the FocusTrap from the stack, and activates the\n * FocusTrap that is the new top of the stack.\n */\n deregister(focusTrap: ManagedFocusTrap): void {\n focusTrap._disable();\n\n const stack = this._focusTrapStack;\n\n const i = stack.indexOf(focusTrap);\n if (i !== -1) {\n stack.splice(i, 1);\n if (stack.length) {\n stack[stack.length - 1]._enable();\n }\n }\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { ModuleWithProviders, NgModule } from '@angular/core';\n\nimport { FocusTrapDirective } from './focus-trap';\nimport { FocusTrapManager } from './focus-trap-manager';\nimport { InteractivityChecker } from './interactivity-checker';\nimport { Platform } from './platform';\n\n@NgModule({\n imports: [CommonModule],\n declarations: [FocusTrapDirective],\n exports: [FocusTrapDirective],\n})\nexport class FocusTrapModule {\n static forRoot(): ModuleWithProviders {\n return {\n ngModule: FocusTrapModule,\n providers: [FocusTrapManager, Platform, InteractivityChecker],\n };\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n OnInit,\n Renderer2,\n} from '@angular/core';\n\nimport { Utils } from '@shared/util-utils';\n\n// TODO: Make generic library from this\n/** This component will be added as background layout for modals if enabled */\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'bs-modal-backdrop',\n template: ' ',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ModalBackdropComponent implements OnInit {\n element: ElementRef;\n renderer: Renderer2;\n\n constructor(element: ElementRef, renderer: Renderer2) {\n this.element = element;\n this.renderer = renderer;\n }\n\n protected _isShown = false;\n\n get isShown(): boolean {\n return this._isShown;\n }\n\n set isShown(value: boolean) {\n this._isShown = value;\n\n if (value) {\n this.renderer.addClass(this.element.nativeElement, `show`);\n } else {\n this.renderer.removeClass(this.element.nativeElement, `show`);\n }\n }\n\n ngOnInit(): void {\n this.renderer.addClass(this.element.nativeElement, `fade`);\n Utils.reflow(this.element.nativeElement);\n this.isShown = true;\n }\n}\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n selector: 'shared-modal-body',\n templateUrl: './modal-body.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ModalBodyComponent {}\n","
\n \n
\n","// noinspection JSUnusedGlobalSymbols\n\n/**\n * A const enum that includes all non-printable string values one can expect from $event.key.\n * For example, this enum includes values like \"CapsLock\", \"Backspace\", and \"AudioVolumeMute\",\n * but does not include values like \"a\", \"A\", \"#\", \"é\", or \"¿\".\n * Auto generated from MDN: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values#Speech_recognition_keys\n */\nexport enum Key {\n /** The user agent wasn't able to map the event's virtual keycode to a specific key value. This can happen due to hardware or software constraints, or because of constraints around the platform on which the user agent is running. */\n Unidentified = 'Unidentified',\n\n /** The Alt (Alternative) key. */\n Alt = 'Alt',\n\n /** The AltGr or AltGraph (Alternate Graphics) key. Enables the ISO Level 3 shift modifier (where Shift is the level 2 modifier). */\n AltGraph = 'AltGraph',\n\n /** The Caps Lock key. Toggles the capital character lock on and off for subsequent input. */\n CapsLock = 'CapsLock',\n\n /** The Control, Ctrl, or Ctl key. Allows typing control characters. */\n Control = 'Control',\n\n /** The Fn (Function modifier) key. Used to allow generating function key (F1-F15, for instance) characters on keyboards without a dedicated function key area. Often handled in hardware so that events aren't generated for this key. */\n Fn = 'Fn',\n\n /** The FnLock or F-Lock (Function Lock) key.Toggles the function key mode described by \"Fn\" on and off. Often handled in hardware so that events aren't generated for this key. */\n FnLock = 'FnLock',\n\n /** The Hyper key. */\n Hyper = 'Hyper',\n\n /** The Meta key. Allows issuing special command inputs. This is the Windows logo key, or the Command or ⌘ key on Mac keyboards. */\n Meta = 'Meta',\n\n /** The NumLock (Number Lock) key. Toggles the numeric keypad between number entry some other mode (often directional arrows). */\n NumLock = 'NumLock',\n\n /** The Scroll Lock key. Toggles beteen scrolling and cursor movement modes. */\n ScrollLock = 'ScrollLock',\n\n /** The Shift key. Modifies keystrokes to allow typing upper (or other) case letters, and to support typing punctuation and other special characters. */\n Shift = 'Shift',\n\n /** The Super key. */\n Super = 'Super',\n\n /** The Symbol modifier key (found on certain virtual keyboards). */\n Symbol = 'Symbol',\n\n /** The Symbol Lock key. */\n SymbolLock = 'SymbolLock',\n\n /** The Enter or ↵ key (sometimes labeled Return). */\n Enter = 'Enter',\n\n /** The Horizontal Tab key, Tab. */\n Tab = 'Tab',\n\n /** The down arrow key. */\n ArrowDown = 'ArrowDown',\n\n /** The left arrow key. */\n ArrowLeft = 'ArrowLeft',\n\n /** The right arrow key. */\n ArrowRight = 'ArrowRight',\n\n /** The up arrow key. */\n ArrowUp = 'ArrowUp',\n\n /** The End key. Moves to the end of content. */\n End = 'End',\n\n /** The Home key. Moves to the start of content. */\n Home = 'Home',\n\n /** The Page Down (or PgDn) key. Scrolls down or displays the next page of content. */\n PageDown = 'PageDown',\n\n /** The Page Up (or PgUp) key. Scrolls up or displays the previous page of content. */\n PageUp = 'PageUp',\n\n /** The Backspace key. This key is labeled Delete on Mac keyboards. */\n Backspace = 'Backspace',\n\n /** The Clear key. Removes the currently selected input. */\n Clear = 'Clear',\n\n /** The Copy key (on certain extended keyboards). */\n Copy = 'Copy',\n\n /** The Cursor Select key, CrSel. */\n CrSel = 'CrSel',\n\n /** The Cut key (on certain extended keyboards). */\n Cut = 'Cut',\n\n /** The Delete key, Del. */\n Delete = 'Delete',\n\n /** Erase to End of Field. Deletes all characters from the current cursor position to the end of the current field. */\n EraseEof = 'EraseEof',\n\n /** The ExSel (Extend Selection) key. */\n ExSel = 'ExSel',\n\n /** The Insert key, Ins. Toggles between inserting and overwriting text. */\n Insert = 'Insert',\n\n /** Paste from the clipboard. */\n Paste = 'Paste',\n\n /** Redo the last action. */\n Redo = 'Redo',\n\n /** Undo the last action. */\n Undo = 'Undo',\n\n /** The Accept, Commit, or OK key or button. Accepts the currently selected option or input method sequence conversion. */\n Accept = 'Accept',\n\n /** The Again key. Redoes or repeats a previous action. */\n Again = 'Again',\n\n /** The Attn (Attention) key. */\n Attn = 'Attn',\n\n /** The Cancel key. */\n Cancel = 'Cancel',\n\n /** Shows the context menu. Typically found between the Windows (or OS) key and the Control key on the right side of the keyboard. */\n ContextMenu = 'ContextMenu',\n\n /** The Esc (Escape) key. Typically used as an exit, cancel, or \"escape this operation\" button. Historically, the Escape character was used to signal the start of a special control sequence of characters called an \"escape sequence.\" */\n Escape = 'Escape',\n\n /** The Execute key. */\n Execute = 'Execute',\n\n /** The Find key. Opens an interface (typically a dialog box) for performing a find/search operation. */\n Find = 'Find',\n\n /** The Finish key. */\n Finish = 'Finish',\n\n /** The Help key. Opens or toggles the display of help information. */\n Help = 'Help',\n\n /**\n * The Pause key. Pauses the current application or state, if applicable.\n * This shouldn't be confused with the \"MediaPause\" key value, which is used for media controllers, rather than to control applications and processes.\n */\n Pause = 'Pause',\n\n /**\n * The Play key. Resumes a previously paused application, if applicable.\n * This shouldn't be confused with the \"MediaPlay\" key value, which is used for media controllers, rather than to control applications and processes.\n */\n Play = 'Play',\n\n /** The Props (Properties) key. */\n Props = 'Props',\n\n /** The Select key. */\n Select = 'Select',\n\n /** The ZoomIn key. */\n ZoomIn = 'ZoomIn',\n\n /** The ZoomOut key. */\n ZoomOut = 'ZoomOut',\n\n /** The Brightness Down key. Typically used to reduce the brightness of the display. */\n BrightnessDown = 'BrightnessDown',\n\n /** The Brightness Up key. Typically increases the brightness of the display. */\n BrightnessUp = 'BrightnessUp',\n\n /** The Eject key. Ejects removable media (or toggles an optical storage device tray open and closed). */\n Eject = 'Eject',\n\n /** The LogOff key. */\n LogOff = 'LogOff',\n\n /**\n * The Power button or key, to toggle power on and off.\n * Not all systems pass this key through to to the user agent.\n */\n Power = 'Power',\n\n /** The PowerOff or PowerDown key. Shuts off the system. */\n PowerOff = 'PowerOff',\n\n /** The PrintScreen or PrtScr key. Sometimes SnapShot. Captures the screen and prints it or saves it to disk. */\n PrintScreen = 'PrintScreen',\n\n /** The Hibernate key. This saves the state of the computer to disk and then shuts down; the computer can be returned to its previous state by restoring the saved state information. */\n Hibernate = 'Hibernate',\n\n /** The Standby key; also known as Suspend or Sleep. This turns off the display and puts the computer in a low power consumption mode, without completely powering off. */\n Standby = 'Standby',\n\n /** The WakeUp key; used to wake the computer from the hibernation or standby modes. */\n WakeUp = 'WakeUp',\n\n /** The All Candidates key, which starts multi-candidate mode, in which multiple candidates are displayed for the ongoing input. */\n AllCandidates = 'AllCandidates',\n\n /** The Alphanumeric key. */\n Alphanumeric = 'Alphanumeric',\n\n /** The Code Input key, which enables code input mode, which lets the user enter characters by typing their code points (their Unicode character numbers, typically). */\n CodeInput = 'CodeInput',\n\n /** The Compose key. */\n Compose = 'Compose',\n\n /** The Convert key, which instructs the IME to convert the current input method sequence into the resulting character. */\n Convert = 'Convert',\n\n /** A dead \"combining\" key; that is, a key which is used in tandem with other keys to generate accented and other modified characters. If pressed by itself, it doesn't generate a character. If you wish to identify which specific dead key was pressed (in cases where more than one exists), you can do so by examining the KeyboardEvent's associated compositionupdate event's data property. */\n Dead = 'Dead',\n\n /** The Final (Final Mode) key is used on some Asian keyboards to enter final mode when using IMEs. */\n FinalMode = 'FinalMode',\n\n /** Switches to the first character group on an ISO/IEC 9995 keyboard. Each key may have multiple groups of characters, each in its own column. Pressing this key instructs the device to interpret keypresses as coming from the first column on subsequent keystrokes. */\n GroupFirst = 'GroupFirst',\n\n /** Switches to the last character group on an ISO/IEC 9995 keyboard. */\n GroupLast = 'GroupLast',\n\n /** Switches to the next character group on an ISO/IEC 9995 keyboard. */\n GroupNext = 'GroupNext',\n\n /** Switches to the previous character group on an ISO/IEC 9995 keyboard. */\n GroupPrevious = 'GroupPrevious',\n\n /** The Mode Change key. Toggles or cycles among input modes of IMEs. */\n ModeChange = 'ModeChange',\n\n /** The Next Candidate function key. Selects the next possible match for the ongoing input. */\n NextCandidate = 'NextCandidate',\n\n /** The NonConvert (\"Don't convert\") key. This accepts the current input method sequence without running conversion when using an IME. */\n NonConvert = 'NonConvert',\n\n /** The Previous Candidate key. Selects the previous possible match for the ongoing input. */\n PreviousCandidate = 'PreviousCandidate',\n\n /** The Process key. Instructs the IME to process the conversion. */\n Process = 'Process',\n\n /** The Single Candidate key. Enables single candidate mode (as opposed to multi-candidate mode); in this mode, only one candidate is displayed at a time. */\n SingleCandidate = 'SingleCandidate',\n\n /** The Hangul (Korean character set) mode key, which toggles between Hangul and English entry modes. */\n HangulMode = 'HangulMode',\n\n /** Selects the Hanja mode, for converting Hangul characters to the more specific Hanja characters. */\n HanjaMode = 'HanjaMode',\n\n /** Selects the Junja mode, in which Korean is represented using single-byte Latin characters. */\n JunjaMode = 'JunjaMode',\n\n /** The Eisu key. This key's purpose is defined by the IME, but may be used to close the IME. */\n Eisu = 'Eisu',\n\n /** The Hankaku (half-width characters) key. */\n Hankaku = 'Hankaku',\n\n /** The Hiragana key; selects Kana characters mode. */\n Hiragana = 'Hiragana',\n\n /** Toggles between the Hiragana and Katakana writing systems. */\n HiraganaKatakana = 'HiraganaKatakana',\n\n /** The Kana Mode (Kana Lock) key. */\n KanaMode = 'KanaMode',\n\n /** The Kanji Mode key. Enables entering Japanese text using the ideographic characters of Chinese origin. */\n KanjiMode = 'KanjiMode',\n\n /** The Katakana key. */\n Katakana = 'Katakana',\n\n /** The Romaji key; selects the Roman character set. */\n Romaji = 'Romaji',\n\n /** The Zenkaku (full width) characters key. */\n Zenkaku = 'Zenkaku',\n\n /** The Zenkaku/Hankaku (full width/half width) toggle key. */\n ZenkakuHanaku = 'ZenkakuHanaku',\n\n /** The first general-purpose function key, F1. */\n F1 = 'F1',\n\n /** The F2 key. */\n F2 = 'F2',\n\n /** The F3 key. */\n F3 = 'F3',\n\n /** The F4 key. */\n F4 = 'F4',\n\n /** The F5 key. */\n F5 = 'F5',\n\n /** The F6 key. */\n F6 = 'F6',\n\n /** The F7 key. */\n F7 = 'F7',\n\n /** The F8 key. */\n F8 = 'F8',\n\n /** The F9 key. */\n F9 = 'F9',\n\n /** The F10 key. */\n F10 = 'F10',\n\n /** The F11 key. */\n F11 = 'F11',\n\n /** The F12 key. */\n F12 = 'F12',\n\n /** The F13 key. */\n F13 = 'F13',\n\n /** The F14 key. */\n F14 = 'F14',\n\n /** The F15 key. */\n F15 = 'F15',\n\n /** The F16 key. */\n F16 = 'F16',\n\n /** The F17 key. */\n F17 = 'F17',\n\n /** The F18 key. */\n F18 = 'F18',\n\n /** The F19 key. */\n F19 = 'F19',\n\n /** The F20 key. */\n F20 = 'F20',\n\n /** The first general-purpose virtual function key. */\n Soft1 = 'Soft1',\n\n /** The second general-purpose virtual function key. */\n Soft2 = 'Soft2',\n\n /** The third general-purpose virtual function key. */\n Soft3 = 'Soft3',\n\n /** The fourth general-purpose virtual function key. */\n Soft4 = 'Soft4',\n\n /** Presents a list of recently-used applications which lets the user change apps quickly. */\n AppSwitch = 'AppSwitch',\n\n /** The Call key; dials the number which has been entered. */\n Call = 'Call',\n\n /** The Camera key; activates the camera. */\n Camera = 'Camera',\n\n /** The Focus key; focuses the camera. */\n CameraFocus = 'CameraFocus',\n\n /** The End Call or Hang Up button. */\n EndCall = 'EndCall',\n\n /** The Back button. */\n GoBack = 'GoBack',\n\n /** The Home button, which takes the user to the phone's main screen (usually an application launcher). */\n GoHome = 'GoHome',\n\n /** The Headset Hook key. This is typically actually a button on the headset which is used to hang up calls and play or pause media. */\n HeadsetHook = 'HeadsetHook',\n\n /** The Redial button, which redials the last-called number. */\n LastNumberRedial = 'LastNumberRedial',\n\n /** The Notification key. */\n Notification = 'Notification',\n\n /** A button which cycles among the notification modes: silent, vibrate, ring, and so forth. */\n MannerMode = 'MannerMode',\n\n /** The Voice Dial key. Initiates voice dialing. */\n VoiceDial = 'VoiceDial',\n\n /** Switches to the previous channel. */\n ChannelDown = 'ChannelDown',\n\n /** Switches to the next channel. */\n ChannelUp = 'ChannelUp',\n\n /** Starts, continues, or increases the speed of fast forwarding the media. */\n MediaFastForward = 'MediaFastForward',\n\n /** Pauses the currently playing media. Some older applications use simply \"Pause\" but this is not correct. */\n MediaPause = 'MediaPause',\n\n /** Starts or continues playing media at normal speed, if not already doing so. Has no effect otherwise. */\n MediaPlay = 'MediaPlay',\n\n /** Toggles between playing and pausing the current media. */\n MediaPlayPause = 'MediaPlayPause',\n\n /** Starts or resumes recording media. */\n MediaRecord = 'MediaRecord',\n\n /** Starts, continues, or increases the speed of rewinding the media. */\n MediaRewind = 'MediaRewind',\n\n /** Stops the current media activity (such as playing, recording, pausing, forwarding, or rewinding). Has no effect if the media is currently stopped already. */\n MediaStop = 'MediaStop',\n\n /** Seeks to the next media or program track. */\n MediaTrackNext = 'MediaTrackNext',\n\n /** Seeks to the previous media or program track. */\n MediaTrackPrevious = 'MediaTrackPrevious',\n\n /** Adjusts audio balance toward the left. */\n AudioBalanceLeft = 'AudioBalanceLeft',\n\n /** Adjusts audio balance twoard the right. */\n AudioBalanceRight = 'AudioBalanceRight',\n\n /** Decreases the amount of bass. */\n AudioBassDown = 'AudioBassDown',\n\n /** Reduces bass boosting or cycles downward through bass boost modes or states. */\n AudioBassBoostDown = 'AudioBassBoostDown',\n\n /** Toggles bass boosting on and off. */\n AudioBassBoostToggle = 'AudioBassBoostToggle',\n\n /** Increases the amoung of bass boosting, or cycles upward through a set of bass boost modes or states. */\n AudioBassBoostUp = 'AudioBassBoostUp',\n\n /** Increases the amount of bass. */\n AudioBassUp = 'AudioBassUp',\n\n /** Adjusts the audio fader toward the front. */\n AudioFaderFront = 'AudioFaderFront',\n\n /** Adjustts the audio fader toward the rear. */\n AudioFaderRear = 'AudioFaderRear',\n\n /** Selects the next available surround sound mode. */\n AudioSurroundModeNext = 'AudioSurroundModeNext',\n\n /** Decreases the amount of treble. */\n AudioTrebleDown = 'AudioTrebleDown',\n\n /** Increases the amount of treble. */\n AudioTrebleUp = 'AudioTrebleUp',\n\n /** Decreases the audio volume. */\n AudioVolumeDown = 'AudioVolumeDown',\n\n /** Mutes the audio. */\n AudioVolumeMute = 'AudioVolumeMute',\n\n /** Increases the audio volume. */\n AudioVolumeUp = 'AudioVolumeUp',\n\n /** Toggles the microphone on and off. */\n MicrophoneToggle = 'MicrophoneToggle',\n\n /** Decreases the microphone's input volume. */\n MicrophoneVolumeDown = 'MicrophoneVolumeDown',\n\n /** Mutes the microphone input. */\n MicrophoneVolumeMute = 'MicrophoneVolumeMute',\n\n /** Increases the microphone's input volume. */\n MicrophoneVolumeUp = 'MicrophoneVolumeUp',\n\n /** Switches into TV viewing mode. */\n TV = 'TV',\n\n /** Toggles 3D TV mode on and off. */\n TV3DMode = 'TV3DMode',\n\n /** Toggles between antenna and cable inputs. */\n TVAntennaCable = 'TVAntennaCable',\n\n /** Toggles audio description mode on and off. */\n TVAudioDescription = 'TVAudioDescription',\n\n /** Decreases trhe audio description's mixing volume; reduces the volume of the audio descriptions relative to the program sound. */\n TVAudioDescriptionMixDown = 'TVAudioDescriptionMixDown',\n\n /** Increases the audio description's mixing volume; increases the volume of the audio descriptions relative to the program sound. */\n TVAudioDescriptionMixUp = 'TVAudioDescriptionMixUp',\n\n /** Displays or hides the media contents available for playback (this may be a channel guide showing the currently airing programs, or a list of media files to play). */\n TVContentsMenu = 'TVContentsMenu',\n\n /** Displays or hides the TV's data service menu. */\n TVDataService = 'TVDataService',\n\n /** Cycles the input mode on an external TV. */\n TVInput = 'TVInput',\n\n /** Switches to the input \"Component 1.\" */\n TVInputComponent1 = 'TVInputComponent1',\n\n /** Switches to the input \"Component 2.\" */\n TVInputComponent2 = 'TVInputComponent2',\n\n /** Switches to the input \"Composite 1.\" */\n TVInputComposite1 = 'TVInputComposite1',\n\n /** Switches to the input \"Composite 2.\" */\n TVInputComposite2 = 'TVInputComposite2',\n\n /** Switches to the input \"HDMI 1.\" */\n TVInputHDMI1 = 'TVInputHDMI1',\n\n /** Switches to the input \"HDMI 2.\" */\n TVInputHDMI2 = 'TVInputHDMI2',\n\n /** Switches to the input \"HDMI 3.\" */\n TVInputHDMI3 = 'TVInputHDMI3',\n\n /** Switches to the input \"HDMI 4.\" */\n TVInputHDMI4 = 'TVInputHDMI4',\n\n /** Switches to the input \"VGA 1.\" */\n TVInputVGA1 = 'TVInputVGA1',\n\n /** The Media Context menu key. */\n TVMediaContext = 'TVMediaContext',\n\n /** Toggle the TV's network connection on and off. */\n TVNetwork = 'TVNetwork',\n\n /** Put the TV into number entry mode. */\n TVNumberEntry = 'TVNumberEntry',\n\n /** The device's power button. */\n TVPower = 'TVPower',\n\n /** Radio button. */\n TVRadioService = 'TVRadioService',\n\n /** Satellite button. */\n TVSatellite = 'TVSatellite',\n\n /** Broadcast Satellite button. */\n TVSatelliteBS = 'TVSatelliteBS',\n\n /** Communication Satellite button. */\n TVSatelliteCS = 'TVSatelliteCS',\n\n /** Toggles among available satellites. */\n TVSatelliteToggle = 'TVSatelliteToggle',\n\n /** Selects analog terrestrial television service (analog cable or antenna reception). */\n TVTerrestrialAnalog = 'TVTerrestrialAnalog',\n\n /** Selects digital terrestrial television service (digital cable or antenna receiption). */\n TVTerrestrialDigital = 'TVTerrestrialDigital',\n\n /** Timer programming button. */\n TVTimer = 'TVTimer',\n\n /** Changes the input mode on an external audio/video receiver (AVR) unit. */\n AVRInput = 'AVRInput',\n\n /** Toggles the power on an external AVR unit. */\n AVRPower = 'AVRPower',\n\n /** General-purpose media function key, color-coded red; this has index 0 among the colored keys. */\n ColorF0Red = 'ColorF0Red',\n\n /** General-purpose media funciton key, color-coded green; this has index 1 among the colored keys. */\n ColorF1Green = 'ColorF1Green',\n\n /** General-purpose media funciton key, color-coded yellow; this has index 2 among the colored keys. */\n ColorF2Yellow = 'ColorF2Yellow',\n\n /** General-purpose media funciton key, color-coded blue; this has index 3 among the colored keys. */\n ColorF3Blue = 'ColorF3Blue',\n\n /** General-purpose media funciton key, color-coded grey; this has index 4 among the colored keys. */\n ColorF4Grey = 'ColorF4Grey',\n\n /** General-purpose media funciton key, color-coded brown; this has index 5 among the colored keys. */\n ColorF5Brown = 'ColorF5Brown',\n\n /** Toggles closed captioning on and off. */\n ClosedCaptionToggle = 'ClosedCaptionToggle',\n\n /** Adjusts the brightness of the device by toggling between two brightness levels or by cycling among multiple brightness levels. */\n Dimmer = 'Dimmer',\n\n /** Cycles among video sources. */\n DisplaySwap = 'DisplaySwap',\n\n /** Switches the input source to the Digital Video Recorder (DVR). */\n DVR = 'DVR',\n\n /** The Exit button, which exits the curreent application or menu. */\n Exit = 'Exit',\n\n /** Clears the program or content stored in the first favorites list slot. */\n FavoriteClear0 = 'FavoriteClear0',\n\n /** Clears the program or content stored in the second favorites list slot. */\n FavoriteClear1 = 'FavoriteClear1',\n\n /** Clears the program or content stored in the third favorites list slot. */\n FavoriteClear2 = 'FavoriteClear2',\n\n /** Clears the program or content stored in the fourth favorites list slot. */\n FavoriteClear3 = 'FavoriteClear3',\n\n /** Selects (recalls) the program or content stored in the first favorites list slot. */\n FavoriteRecall0 = 'FavoriteRecall0',\n\n /** Selects (recalls) the program or content stored in the second favorites list slot. */\n FavoriteRecall1 = 'FavoriteRecall1',\n\n /** Selects (recalls) the program or content stored in the third favorites list slot. */\n FavoriteRecall2 = 'FavoriteRecall2',\n\n /** Selects (recalls) the program or content stored in the fourth favorites list slot. */\n FavoriteRecall3 = 'FavoriteRecall3',\n\n /** Stores the current program or content into the first favorites list slot. */\n FavoriteStore0 = 'FavoriteStore0',\n\n /** Stores the current program or content into the second favorites list slot. */\n FavoriteStore1 = 'FavoriteStore1',\n\n /** Stores the current program or content into the third favorites list slot. */\n FavoriteStore2 = 'FavoriteStore2',\n\n /** Stores the current program or content into the fourth favorites list slot. */\n FavoriteStore3 = 'FavoriteStore3',\n\n /** Toggles the display of the program or content guide. */\n Guide = 'Guide',\n\n /** If the guide is currently displayed, this button tells the guide to display the next day's content. */\n GuideNextDay = 'GuideNextDay',\n\n /** If the guide is currently displayed, this button tells the guide to display the previous day's content. */\n GuidePreviousDay = 'GuidePreviousDay',\n\n /** Toggles the display of information about the currently selected content, program, or media. */\n Info = 'Info',\n\n /** Tellls the device to perform an instant replay (typically some form of jumping back a short amount of time then playing it again, possibly but not usually in slow motion). */\n InstantReplay = 'InstantReplay',\n\n /** Opens content liniked to the current program, if available and possible. */\n Link = 'Link',\n\n /** Lists the current program. */\n ListProgram = 'ListProgram',\n\n /** Toggles a display listing currently available live content or programs. */\n LiveContent = 'LiveContent',\n\n /** Locks or unlocks the currently selected content or pgoram. */\n Lock = 'Lock',\n\n /** Presents a list of media applications, such as photo viewers, audio and video players, and games. [1] */\n MediaApps = 'MediaApps',\n\n /** The Audio Track key. */\n MediaAudioTrack = 'MediaAudioTrack',\n\n /** Jumps back to the last-viewed content, program, or other media. */\n MediaLast = 'MediaLast',\n\n /** Skips backward to the previous content or program. */\n MediaSkipBackward = 'MediaSkipBackward',\n\n /** Skips forward to the next content or program. */\n MediaSkipForward = 'MediaSkipForward',\n\n /** Steps backward to the previous content or program. */\n MediaStepBackward = 'MediaStepBackward',\n\n /** Steps forward to the next content or program. */\n MediaStepForward = 'MediaStepForward',\n\n /** Top Menu button; opens the media's main menu, such as on a DVD or Blu-Ray disc. */\n MediaTopMenu = 'MediaTopMenu',\n\n /** Navigates into a submenu or option. */\n NavigateIn = 'NavigateIn',\n\n /** Navigates to the next item. */\n NavigateNext = 'NavigateNext',\n\n /** Navigates out of the current screen or menu. */\n NavigateOut = 'NavigateOut',\n\n /** Navigates to the previous item. */\n NavigatePrevious = 'NavigatePrevious',\n\n /** Cycles to the next channel in the favorites list. */\n NextFavoriteChannel = 'NextFavoriteChannel',\n\n /** Cycles to the next saved user profile, if this feature is supported and multiple profiles exist. */\n NextUserProfile = 'NextUserProfile',\n\n /** Opens the user interface for selecting on demand content or programs to watch. */\n OnDemand = 'OnDemand',\n\n /** Starts the process of pairing the remote with a device to be controlled. */\n Pairing = 'Pairing',\n\n /** A button to move the picture-in-picture view downward. */\n PinPDown = 'PinPDown',\n\n /** A button to control moving the picture-in-picture view. */\n PinPMove = 'PinPMove',\n\n /** Toggles display of th epicture-in-picture view on and off. */\n PinPToggle = 'PinPToggle',\n\n /** A button to move the picture-in-picture view upward. */\n PinPUp = 'PinPUp',\n\n /** Decreases the media playback rate. */\n PlaySpeedDown = 'PlaySpeedDown',\n\n /** Returns the media playback rate to normal. */\n PlaySpeedReset = 'PlaySpeedReset',\n\n /** Increases the media playback rate. */\n PlaySpeedUp = 'PlaySpeedUp',\n\n /** Toggles random media (also known as \"shuffle mode\") on and off. */\n RandomToggle = 'RandomToggle',\n\n /** A code sent when the remote control's battery is low. This doesn't actually correspond to a physical key at all. */\n RcLowBattery = 'RcLowBattery',\n\n /** Cycles among the available media recording speeds. */\n RecordSpeedNext = 'RecordSpeedNext',\n\n /** Toggles radio frequency (RF) input bypass mode on and off. RF bypass mode passes RF input directly to the RF output without any processing or filtering. */\n RfBypass = 'RfBypass',\n\n /** Toggles the channel scan mode on and off; this is a mode which flips through channels automatically until the user stops the scan. */\n ScanChannelsToggle = 'ScanChannelsToggle',\n\n /** Cycles through the available screen display modes. */\n ScreenModeNext = 'ScreenModeNext',\n\n /** Toggles display of the device's settings screen on and off. */\n Settings = 'Settings',\n\n /** Toggles split screen display mode on and off. */\n SplitScreenToggle = 'SplitScreenToggle',\n\n /** Cycles among input modes on an external set-top box (STB). */\n STBInput = 'STBInput',\n\n /** Toggles on and off an external STB. */\n STBPower = 'STBPower',\n\n /** Toggles the display of subtitles on and off if they're available. */\n Subtitle = 'Subtitle',\n\n /** Toggles display of teletext, if available. */\n Teletext = 'Teletext',\n\n /** Cycles through the available video modes. */\n VideoModeNext = 'VideoModeNext',\n\n /** Causes the device to identify itself in some fashion, such as by flashing a light, briefly changing the brightness of indicator lights, or emitting a tone. */\n Wink = 'Wink',\n\n /** Toggles between full-screen and scaled content display, or otherwise change the magnification level. */\n ZoomToggle = 'ZoomToggle',\n\n /** Presents a list of possible corrections for a word which was incorrectly identified. */\n SpeechCorrectionList = 'SpeechCorrectionList',\n\n /** Toggles between dictation mode and command/control mode. This lets the speech engine know whether to interpret spoken words as input text or as commands. */\n SpeechInputToggle = 'SpeechInputToggle',\n\n /** Closes the current document or message. Must not exit the application. */\n Close = 'Close',\n\n /** Creates a new document or message. */\n New = 'New',\n\n /** Opens an existing document or message. */\n Open = 'Open',\n\n /** Prints the current document or message. */\n Print = 'Print',\n\n /** Saves the current document or message. */\n Save = 'Save',\n\n /** Starts spell checking the current document. */\n SpellCheck = 'SpellCheck',\n\n /** Opens the user interface to forward a message. */\n MailForward = 'MailForward',\n\n /** Opens the user interface to reply to a message. */\n MailReply = 'MailReply',\n\n /** Sends the current message. */\n MailSend = 'MailSend',\n\n /** The Calculator key, often labeled with an icon such as . This is often used as a generic application launcher key (APPCOMMAND_LAUNCH_APP2). */\n LaunchCalculator = 'LaunchCalculator',\n\n /** The Calendar key, often labeled with an icon like . */\n LaunchCalendar = 'LaunchCalendar',\n\n /** The Contacts key. */\n LaunchContacts = 'LaunchContacts',\n\n /** The Mail key. This is often displayed as . */\n LaunchMail = 'LaunchMail',\n\n /** The Media Player key. */\n LaunchMediaPlayer = 'LaunchMediaPlayer',\n\n /** The Music Player key, often labeled with an icon such as . */\n LaunchMusicPlayer = 'LaunchMusicPlayer',\n\n /** The My Computer key on Windows keyboards. This is often used as a generic application launcher key (APPCOMMAND_LAUNCH_APP1). */\n LaunchMyComputer = 'LaunchMyComputer',\n\n /** The Phone key, to open the phone dialer application if one is present. */\n LaunchPhone = 'LaunchPhone',\n\n /** The Screen Saver key. */\n LaunchScreenSaver = 'LaunchScreenSaver',\n\n /** The Spreadsheet key. This key may be labeled with an icon such as or that of a specific spreadsheet application. */\n LaunchSpreadsheet = 'LaunchSpreadsheet',\n\n /** The Web Browser key. This key is frequently labeled with an icon such as or the icon of a specific browser, depending on the device manufacturer. */\n LaunchWebBrowser = 'LaunchWebBrowser',\n\n /** The WebCam key. Opens the webcam application. */\n LaunchWebCam = 'LaunchWebCam',\n\n /** The Word Processor key. This may be an icon of a specific word processor application, or a generic document icon. */\n LaunchWordProcessor = 'LaunchWordProcessor',\n\n /** The first generic application launcher button. */\n LaunchApplication1 = 'LaunchApplication1',\n\n /** The second generic application launcher button. */\n LaunchApplication2 = 'LaunchApplication2',\n\n /** The third generic application launcher button. */\n LaunchApplication3 = 'LaunchApplication3',\n\n /** The fourth generic application launcher button. */\n LaunchApplication4 = 'LaunchApplication4',\n\n /** The fifth generic application launcher button. */\n LaunchApplication5 = 'LaunchApplication5',\n\n /** The sixth generic application launcher button. */\n LaunchApplication6 = 'LaunchApplication6',\n\n /** The seventh generic application launcher button. */\n LaunchApplication7 = 'LaunchApplication7',\n\n /** The eighth generic application launcher button. */\n LaunchApplication8 = 'LaunchApplication8',\n\n /** The ninth generic application launcher button. */\n LaunchApplication9 = 'LaunchApplication9',\n\n /** The 10th generic application launcher button. */\n LaunchApplication10 = 'LaunchApplication10',\n\n /** The 11th generic application launcher button. */\n LaunchApplication11 = 'LaunchApplication11',\n\n /** The 12th generic application launcher button. */\n LaunchApplication12 = 'LaunchApplication12',\n\n /** The 13th generic application launcher button. */\n LaunchApplication13 = 'LaunchApplication13',\n\n /** The 14th generic application launcher button. */\n LaunchApplication14 = 'LaunchApplication14',\n\n /** The 15th generic application launcher button. */\n LaunchApplication15 = 'LaunchApplication15',\n\n /** The 16th generic application launcher button. */\n LaunchApplication16 = 'LaunchApplication16',\n\n /** Navigates to the previous content or page in the current Web view's history. */\n BrowserBack = 'BrowserBack',\n\n /** Opens the user's list of bookmarks/favorites. */\n BrowserFavorites = 'BrowserFavorites',\n\n /** Navigates to the next content or page in the current Web view's history. */\n BrowserForward = 'BrowserForward',\n\n /** Navigates to the user's preferred home page. */\n BrowserHome = 'BrowserHome',\n\n /** Refreshes the current page or contentl. */\n BrowserRefresh = 'BrowserRefresh',\n\n /** Activates the user's preferred search engine or the search interface within their browser. */\n BrowserSearch = 'BrowserSearch',\n\n /** Stops loading the currently displayed Web view or content. */\n BrowserStop = 'BrowserStop',\n\n /** The decimal point key (typically . or , depending on the region. In newer browsers, this value to simply be the character generated by the decimal key (one of those two characters). [1] */\n Decimal = 'Decimal',\n\n /** The 11 key found on certain media numeric keypads. */\n Key11 = 'Key11',\n\n /** The 12 key found on certain media numeric keypads. */\n Key12 = 'Key12',\n\n /** The numeric keypad's multiplication key, *. */\n Multiply = 'Multiply',\n\n /** The numeric keypad's addition key, +. */\n Add = 'Add',\n\n /** The numeric keypad's division key, /. */\n Divide = 'Divide',\n\n /** The numeric keypad's subtraction key, -. */\n Subtract = 'Subtract',\n\n /** The numeric keypad's places separator character (in the United States, this is a comma, but elsewhere it is frequently a period). */\n Separator = 'Separator',\n}\n","export enum ModalDismissReason {\n Backdrop = 'backdrop-click',\n Esc = 'esc',\n Back = 'browser-back-navigation-clicked',\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostListener,\n OnDestroy,\n OnInit,\n Renderer2,\n} from '@angular/core';\n\nimport { Key } from '@shared/util-key';\n\nimport { ModalConfigService } from '../../modal-config.service';\nimport { ModalDismissReason } from '../../models/modal-dismiss-reason.enum';\nimport { ModalInternalService } from '../../services/modal-internal.service';\n\n@Component({\n selector: 'shared-modal-container',\n template: `\n \n \n \n \n \n
\n \n
\n \n \n \n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ModalContainerComponent implements OnInit, OnDestroy {\n config: ModalConfigService;\n isShown = false;\n level?: number;\n bsModalService?: ModalInternalService;\n private isModalHiding = false;\n\n constructor(\n options: ModalConfigService,\n protected _element: ElementRef,\n private _renderer: Renderer2,\n ) {\n this.config = Object.assign({}, options);\n }\n\n ngOnInit(): void {\n this._renderer.addClass(this._element.nativeElement, 'fade');\n\n this._renderer.setStyle(this._element.nativeElement, 'display', 'block');\n setTimeout(() => {\n this.isShown = true;\n this._renderer.addClass(this._element.nativeElement, 'show');\n }, 0);\n if (document && document.body) {\n if (this.bsModalService && this.bsModalService.getModalsCount() === 1) {\n this.bsModalService.checkScrollbar();\n this.bsModalService.setScrollbar();\n }\n this._renderer.addClass(document.body, 'open');\n this._renderer.setStyle(document.body, 'overflow-y', 'hidden');\n }\n if (this._element.nativeElement) {\n this._element.nativeElement.focus();\n }\n }\n\n onOutsideClick(): void {\n if (this.config.ignoreBackdropClick === false) {\n this.bsModalService?.setDismissReason(ModalDismissReason.Backdrop);\n this.hide();\n }\n }\n\n @HostListener('window:popstate')\n onPopState(): void {\n this.bsModalService?.setDismissReason(ModalDismissReason.Back);\n this.hide();\n }\n\n @HostListener('window:keydown.esc', ['$event'])\n onEsc(event: KeyboardEvent): void {\n if (!this.isShown) {\n return;\n }\n\n if (event.key === Key.Escape) {\n event.preventDefault();\n }\n\n if (\n this.config.keyboard &&\n this.level === this.bsModalService?.getModalsCount()\n ) {\n this.bsModalService?.setDismissReason(ModalDismissReason.Esc);\n this.hide();\n }\n }\n\n ngOnDestroy(): void {\n if (this.isShown) {\n this._hide();\n }\n }\n\n hide(): void {\n if (this.isModalHiding || !this.isShown) {\n return;\n }\n this._hide();\n }\n\n private _hide(): void {\n this.isModalHiding = true;\n this._renderer.removeClass(this._element.nativeElement, 'show');\n setTimeout(() => {\n this.isShown = false;\n if (\n document &&\n document.body &&\n this.bsModalService?.getModalsCount() === 1\n ) {\n this._renderer.removeClass(document.body, 'open');\n this._renderer.setStyle(document.body, 'overflow-y', '');\n }\n this.bsModalService?.hide(this.config.id);\n this.isModalHiding = false;\n }, 0);\n }\n}\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n selector: 'shared-modal-footer',\n templateUrl: './modal-footer.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ModalFooterComponent {}\n","\n \n\n","import { ChangeDetectionStrategy, Component, Input } from '@angular/core';\n\n@Component({\n selector: 'shared-modal-header',\n templateUrl: './modal-header.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ModalHeaderComponent {\n @Input() title?: string;\n}\n","
\n @if (title) {\n \n }\n \n
\n","import { EventEmitter, Injectable } from '@angular/core';\n\n@Injectable()\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport class ModalRefService {\n /**\n * Event that is fired when the modal behind the ref starts hiding\n */\n onHide?: EventEmitter;\n /**\n * Event that is fired when the modal behind the ref finishes hiding\n */\n onHidden?: EventEmitter;\n /**\n * Allow user to ID for the modal. Otherwise, a unique number will be given\n */\n id?: number | string;\n\n /**\n * Reference to a component inside the modal. Null if modal's been created with TemplateRef\n */\n content?: T;\n\n /**\n * Hides the modal\n */\n hide: () => void = () => void 0;\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n OnInit,\n SecurityContext,\n} from '@angular/core';\nimport { DomSanitizer } from '@angular/platform-browser';\n\nimport { BaseModal } from '../../classes/base-modal/base-modal';\nimport { ModalRefService } from '../../services/modal-ref.service';\n\nimport { ModalInternalModel } from './modal-internal.model';\n\n@Component({\n selector: 'shared-modal-confirm',\n templateUrl: './modal-internal.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ModalInternalComponent\n extends BaseModal\n implements OnInit\n{\n safeHtml?: string | null;\n confirm?: boolean;\n\n constructor(\n public sanitizer: DomSanitizer,\n protected override readonly bsModalRef: ModalRefService,\n ) {\n super(bsModalRef);\n }\n\n ngOnInit(): void {\n if (this.modalData === undefined) {\n this.modalData = {};\n }\n\n if (this.modalData?.body) {\n this.safeHtml = this.sanitizer.sanitize(\n SecurityContext.HTML,\n this.modalData.body,\n );\n }\n\n if (this.modalData.title === undefined) this.modalData.title = 'Warning';\n if (this.modalData.body === undefined)\n this.modalData.body = 'Are you sure?';\n if (this.modalData.buttonCancel === undefined)\n this.modalData.buttonCancel = 'Cancel';\n if (this.modalData.buttonContinue === undefined)\n this.modalData.buttonContinue = 'Continue';\n }\n\n onContinue(): void {\n this.onClose(true);\n }\n\n onCancel(): void {\n this.onClose(false);\n }\n}\n","\n \n @if (modalData?.appearance === 'success') {\n \n }\n @if (modalData?.appearance === 'danger') {\n \n }\n @if (modalData?.appearance === 'warning') {\n \n }\n @if (modalData?.appearance === 'info') {\n \n }\n \n \n \n {{ modalData?.title }}\n \n
\n @if (safeHtml) {\n
\n }\n \n \n\n\n\n \n @if (confirm) {\n \n {{ modalData?.buttonCancel }}\n \n }\n \n {{ modalData?.buttonContinue }}\n \n \n\n","import {\n ComponentRef,\n EventEmitter,\n Inject,\n Injectable,\n Optional,\n Renderer2,\n RendererFactory2,\n TemplateRef,\n} from '@angular/core';\n\nimport {\n ComponentLoader,\n ComponentLoaderFactory,\n} from '@shared/util-component-loader';\n\nimport { ModalBackdropComponent } from '../components/modal-backdrop/modal-backdrop.component';\nimport { ModalContainerComponent } from '../components/modal-container/modal-container.component';\nimport {\n MODAL_CONFIG,\n modalConfigDefaults,\n ModalConfigService,\n} from '../modal-config.service';\nimport { ModalDismissReason } from '../models/modal-dismiss-reason.enum';\n\nimport { ModalRefService } from './modal-ref.service';\n\nlet currentId = 1;\n\n@Injectable()\nexport class ModalInternalService {\n config: ModalConfigService;\n\n onShow = new EventEmitter();\n onShown = new EventEmitter();\n onHide = new EventEmitter();\n onHidden = new EventEmitter();\n\n protected isBodyOverflowing = false;\n protected originalBodyPadding = 0;\n\n protected scrollbarWidth = 0;\n\n protected backdropRef?: ComponentRef;\n private _backdropLoader: ComponentLoader;\n private modalsCount = 0;\n private lastDismissReason?: string;\n\n private loaders: ComponentLoader[] = [];\n\n private _renderer: Renderer2;\n\n constructor(\n rendererFactory: RendererFactory2,\n private clf: ComponentLoaderFactory,\n @Optional()\n @Inject(MODAL_CONFIG)\n private modalDefaultOption: ModalConfigService,\n ) {\n this._backdropLoader = this.clf.createLoader();\n this._renderer = rendererFactory.createRenderer(null, null);\n this.config = modalDefaultOption\n ? Object.assign({}, modalConfigDefaults, modalDefaultOption)\n : modalConfigDefaults;\n }\n\n /** Shows a modal */\n show(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n content: string | TemplateRef | { new (...args: any[]): T },\n config?: ModalConfigService,\n ): ModalRefService {\n this.modalsCount++;\n this._createLoaders();\n\n // must be different per every show() call\n const id = config?.id || currentId++;\n this.config = this.modalDefaultOption\n ? Object.assign({}, modalConfigDefaults, this.modalDefaultOption, config)\n : Object.assign({}, modalConfigDefaults, config);\n this.config.id = id;\n this._showBackdrop();\n this.lastDismissReason = void 0;\n\n return this._showModal(content);\n }\n\n hide(id?: number | string): void {\n if (this.modalsCount === 1 || id == null) {\n this._hideBackdrop();\n this.resetScrollbar();\n }\n this.modalsCount =\n this.modalsCount >= 1 && id != null ? this.modalsCount - 1 : 0;\n setTimeout(() => {\n this._hideModal(id);\n this.removeLoaders(id);\n }, 0);\n }\n\n _showBackdrop(): void {\n const isBackdropEnabled =\n this.config.backdrop === true || this.config.backdrop === 'static';\n const isBackdropInDOM =\n !this.backdropRef || !this.backdropRef.instance.isShown;\n\n if (this.modalsCount === 1) {\n this.removeBackdrop();\n\n if (isBackdropEnabled && isBackdropInDOM) {\n this._backdropLoader\n .attach(ModalBackdropComponent)\n .to('body')\n .show({ isAnimated: true });\n this.backdropRef = this._backdropLoader._componentRef;\n }\n }\n }\n\n _hideBackdrop(): void {\n if (!this.backdropRef) {\n return;\n }\n this.backdropRef.instance.isShown = false;\n setTimeout(() => this.removeBackdrop(), 0);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n _showModal(content: any): ModalRefService {\n const modalLoader = this.loaders[this.loaders.length - 1];\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const bsModalRef = new ModalRefService();\n const modalContainerRef = modalLoader\n .provide({ provide: ModalConfigService, useValue: this.config })\n .provide({ provide: ModalRefService, useValue: bsModalRef })\n .attach(ModalContainerComponent)\n .to('body');\n bsModalRef.hide = () => modalContainerRef.instance?.hide();\n\n bsModalRef.onHidden = new EventEmitter();\n bsModalRef.onHide = new EventEmitter();\n\n this.copyEvent(modalLoader.onBeforeHide, bsModalRef.onHide);\n this.copyEvent(modalLoader.onHidden, bsModalRef.onHidden);\n // call 'show' method after assign setClass in bsModalRef.\n // it makes modal component's bsModalRef available to call setClass method\n modalContainerRef.show({\n content,\n initialState: this.config.initialState,\n bsModalService: this,\n id: this.config.id,\n });\n\n if (modalContainerRef.instance) {\n modalContainerRef.instance.level = this.getModalsCount();\n bsModalRef.content = modalLoader.getInnerComponent();\n bsModalRef.id = modalContainerRef.instance.config?.id;\n }\n\n return bsModalRef;\n }\n\n _hideModal(id?: number | string): void {\n if (id != null) {\n const indexToRemove = this.loaders.findIndex(\n (loader) => loader.instance?.config.id === id,\n );\n const modalLoader = this.loaders[indexToRemove];\n if (modalLoader) {\n modalLoader.hide(id);\n }\n } else {\n this.loaders.forEach(\n (loader: ComponentLoader) => {\n if (loader.instance) {\n loader.hide(loader.instance.config.id);\n }\n },\n );\n }\n }\n\n getModalsCount(): number {\n return this.modalsCount;\n }\n\n setDismissReason(reason: ModalDismissReason): void {\n this.lastDismissReason = reason;\n }\n\n removeBackdrop(): void {\n this._renderer.removeClass(document.body, 'open');\n this._renderer.setStyle(document.body, 'overflow-y', '');\n this._backdropLoader.hide();\n this.backdropRef = void 0;\n }\n\n /** Checks if the body is overflowing and sets scrollbar width */\n /** @internal */\n checkScrollbar(): void {\n this.isBodyOverflowing = document.body.clientWidth < window.innerWidth;\n this.scrollbarWidth = this.getScrollbarWidth();\n }\n\n setScrollbar(): void {\n if (!document) {\n return;\n }\n\n this.originalBodyPadding = parseInt(\n window\n .getComputedStyle(document.body)\n .getPropertyValue('padding-right') || '0',\n 10,\n );\n\n if (this.isBodyOverflowing) {\n document.body.style.paddingRight = `${\n this.originalBodyPadding + this.scrollbarWidth\n }px`;\n }\n }\n\n private resetScrollbar(): void {\n document.body.style.paddingRight = `${this.originalBodyPadding}px`;\n }\n\n // thx d.walsh\n private getScrollbarWidth(): number {\n const scrollDiv = this._renderer.createElement('div');\n this._renderer.addClass(scrollDiv, 'SCROLLBAR_MEASURER');\n this._renderer.appendChild(document.body, scrollDiv);\n const scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;\n this._renderer.removeChild(document.body, scrollDiv);\n\n return scrollbarWidth;\n }\n\n private _createLoaders(): void {\n const loader = this.clf.createLoader();\n this.copyEvent(loader.onBeforeShow, this.onShow);\n this.copyEvent(loader.onShown, this.onShown);\n this.copyEvent(loader.onBeforeHide, this.onHide);\n this.copyEvent(loader.onHidden, this.onHidden);\n this.loaders.push(loader);\n }\n\n private removeLoaders(id?: number | string): void {\n if (id != null) {\n const indexToRemove = this.loaders.findIndex(\n (loader) => loader.instance?.config.id === id,\n );\n if (indexToRemove >= 0) {\n this.loaders.splice(indexToRemove, 1);\n this.loaders.forEach(\n (loader: ComponentLoader, i: number) => {\n if (loader.instance) {\n loader.instance.level = i + 1;\n }\n },\n );\n }\n } else {\n this.loaders.splice(0, this.loaders.length);\n }\n }\n\n private copyEvent(\n from: EventEmitter,\n to: EventEmitter,\n ): void {\n from.subscribe((data) => {\n to.emit(this.lastDismissReason || data);\n });\n }\n}\n","import { ComponentType } from '@angular/cdk/overlay';\nimport { Injectable, TemplateRef } from '@angular/core';\n\nimport { BaseModal } from '../classes/base-modal/base-modal';\nimport { ModalInternalComponent } from '../components/modal-internal/modal-internal.component';\nimport { ModalInternalModel } from '../components/modal-internal/modal-internal.model';\nimport { ModalConfigService } from '../modal-config.service';\nimport { ModalSize } from '../models/modal-size.type';\n\nimport { ModalInternalService } from './modal-internal.service';\n\n@Injectable()\nexport class ModalService {\n constructor(private readonly bsModalService: ModalInternalService) {}\n\n confirm(\n modalData: ModalInternalModel,\n size: ModalSize = 'sm',\n ignoreBackdropClick = false,\n ): Promise {\n const modal = this.bsModalService.show(\n ModalInternalComponent,\n {\n initialState: {\n modalData,\n confirm: true,\n },\n ignoreBackdropClick: ignoreBackdropClick,\n backdrop: true,\n size,\n },\n );\n\n return new Promise((resolve) =>\n modal.content?.closed$.subscribe(resolve as never),\n );\n }\n\n single(\n modalData: ModalInternalModel,\n size: ModalSize = 'sm',\n ignoreBackdropClick = false,\n ): Promise {\n const modal = this.bsModalService.show(\n ModalInternalComponent,\n {\n initialState: {\n modalData,\n confirm: false,\n },\n ignoreBackdropClick: ignoreBackdropClick,\n backdrop: true,\n size,\n },\n );\n\n return new Promise((resolve) =>\n modal.content?.closed$.subscribe(resolve as never),\n );\n }\n\n show(\n component: ComponentType | TemplateRef,\n options?: ModalConfigService,\n data?: unknown,\n ): Promise {\n if (options) {\n if (options.initialState) {\n delete options.initialState;\n }\n }\n\n const modal = this.bsModalService.show(component, {\n initialState: { modalData: data },\n id: Math.random(),\n ...options,\n });\n\n return new Promise((resolve) => {\n (modal.content as BaseModal).closed$.subscribe(\n (result: unknown) => {\n resolve(result);\n },\n );\n });\n }\n\n closeAll(): void {\n for (let i = 1; i <= this.bsModalService.getModalsCount(); i++) {\n this.bsModalService.hide(i);\n }\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { ModuleWithProviders, NgModule } from '@angular/core';\n\nimport { ButtonModule } from '@shared/ui-button';\nimport { IconComponent } from '@shared/ui-icon';\nimport { ClickOutsideModule } from '@shared/util-click-outside';\nimport { ComponentLoaderFactory } from '@shared/util-component-loader';\nimport { FocusTrapModule } from '@shared/util-focus-trap';\nimport { PositioningService } from '@shared/util-positioning';\n\nimport { ModalBackdropComponent } from './components/modal-backdrop/modal-backdrop.component';\nimport { ModalBodyComponent } from './components/modal-body/modal-body.component';\nimport { ModalContainerComponent } from './components/modal-container/modal-container.component';\nimport { ModalFooterComponent } from './components/modal-footer/modal-footer.component';\nimport { ModalHeaderComponent } from './components/modal-header/modal-header.component';\nimport { ModalInternalComponent } from './components/modal-internal/modal-internal.component';\nimport { ModalInternalService } from './services/modal-internal.service';\nimport { ModalService } from './services/modal.service';\n\n@NgModule({\n imports: [\n FocusTrapModule,\n CommonModule,\n ButtonModule,\n IconComponent,\n ClickOutsideModule,\n ],\n declarations: [\n ModalBackdropComponent,\n ModalContainerComponent,\n ModalInternalComponent,\n ModalHeaderComponent,\n ModalBodyComponent,\n ModalFooterComponent,\n ],\n exports: [\n ModalBackdropComponent,\n ModalHeaderComponent,\n ModalBodyComponent,\n ModalFooterComponent,\n ],\n})\nexport class ModalModule {\n static forRoot(): ModuleWithProviders {\n return {\n ngModule: ModalModule,\n providers: [\n ModalInternalService,\n ModalService,\n ComponentLoaderFactory,\n PositioningService,\n ],\n };\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n Input,\n Optional,\n Self,\n} from '@angular/core';\nimport { ControlValueAccessor, FormControl, NgControl } from '@angular/forms';\nimport { noop } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { BaseComponent } from '@shared/util-base-component';\n\n@Component({\n selector: 'shared-select',\n templateUrl: './select.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SelectComponent\n extends BaseComponent\n implements ControlValueAccessor\n{\n @Input() dataSource?: Array<{ value: unknown; label: string }>;\n @Input() placeholder?: string;\n @Input() id?: string;\n @Input() name?: string;\n isDisabled = false;\n formControl = new FormControl('');\n private fnOnTouchedCallback: () => void = noop;\n private fnOnChangeCallback: (value: string) => void = noop;\n\n constructor(@Self() @Optional() public control: NgControl) {\n super();\n\n if (this.control) {\n this.control.valueAccessor = this;\n }\n\n this.formControl.valueChanges\n .pipe(takeUntil(this.ngUnsubscribe))\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n .subscribe((x: string) => {\n if (x !== this.control.value) {\n this.fnOnChangeCallback(x);\n }\n });\n }\n\n registerOnChange(fn: (value: string) => void): void {\n this.fnOnChangeCallback = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.fnOnTouchedCallback = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.isDisabled = isDisabled;\n }\n\n writeValue(value: string): void {\n this.formControl.patchValue(value, { emitEvent: false, onlySelf: true });\n }\n}\n","\n @for (item of dataSource; track item) {\n \n }\n\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { ReactiveFormsModule } from '@angular/forms';\n\nimport { SelectComponent } from './select.component';\n\n@NgModule({\n imports: [CommonModule, ReactiveFormsModule],\n declarations: [SelectComponent],\n exports: [SelectComponent],\n})\nexport class SelectModule {}\n","import { Injectable } from '@angular/core';\n\n/** Default values provider for tooltip */\n@Injectable({ providedIn: 'root' })\nexport class TooltipService {\n /** sets disable adaptive position */\n adaptivePosition = true;\n /** tooltip placement, supported positions: 'top', 'bottom', 'left', 'right' */\n placement = 'top';\n /** array of event names which triggers tooltip opening */\n triggers = 'hover focus';\n /** a selector specifying the element the tooltip should be appended to. */\n container?: string;\n /** delay before showing the tooltip */\n delay = 0;\n}\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n} from '@angular/core';\n\nimport { PlacementForBs5 } from '@shared/util-positioning';\n\nimport { TooltipService } from './tooltip.service';\n\n// \n//
\n// Copy to clipboard\n//
\n// \n// \n\n@Component({\n selector: 'shared-tooltip-container',\n changeDetection: ChangeDetectionStrategy.OnPush,\n // eslint-disable-next-line @angular-eslint/no-host-metadata-property\n host: {\n '[class]':\n '\"text-primary background-secondary show tooltip in tooltip-\" + placement + \" \" + \"bs-tooltip-\" + placement + \" \" + placement + \" \" + containerClass',\n '[attr.id]': 'this.id',\n role: 'tooltip',\n },\n styles: [\n `\n :host.tooltip {\n display: block;\n pointer-events: none;\n\n position: absolute;\n z-index: 1070;\n display: block;\n margin: 0;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Poppins,\n 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji',\n 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';\n font-style: normal;\n font-weight: 400;\n line-height: 1.5;\n text-align: left;\n top: -4px !important;\n text-align: start;\n text-decoration: none;\n text-shadow: none;\n text-transform: none;\n padding: 0.4rem 0;\n letter-spacing: normal;\n word-break: normal;\n word-spacing: normal;\n white-space: normal;\n line-break: auto;\n font-size: 0.875rem;\n word-wrap: break-word;\n opacity: 0;\n }\n\n :host.bs3.tooltip.top > .arrow {\n margin-left: -2px;\n }\n\n :host.bs3.tooltip.bottom {\n margin-top: 0px;\n }\n\n :host.tooltip.show {\n opacity: 0.9;\n }\n\n :host .tooltip-arrow {\n position: absolute;\n display: block;\n width: 0.8rem;\n height: 0.4rem;\n bottom: 0;\n }\n\n :host .tooltip-arrow::before {\n top: 0;\n border-width: 0.4rem 0.4rem 0;\n position: absolute;\n content: '';\n border-color: transparent;\n border-style: solid;\n }\n\n :host .tooltip-arrow::before {\n border-top-color: #000;\n }\n\n :host .tooltip-inner {\n max-width: 200px;\n padding: 0.25rem 0.5rem;\n color: #fff;\n text-align: center;\n background-color: #000;\n border-radius: 0.25rem;\n }\n\n :host.bs3.bs-tooltip-left,\n :host.bs3.bs-tooltip-right {\n margin: 0px;\n }\n\n :host.bs3.bs-tooltip-right .arrow,\n :host.bs3.bs-tooltip-left .arrow {\n margin: 0.3rem 0;\n }\n `,\n ],\n template: `\n
\n
\n \n
\n `,\n})\nexport class TooltipContainerComponent implements AfterViewInit {\n classMap?: { [key: string]: boolean };\n placement?: string;\n containerClass?: string;\n animation?: boolean;\n id?: string;\n\n constructor(config: TooltipService) {\n Object.assign(this, config);\n }\n\n ngAfterViewInit(): void {\n this.classMap = { in: false, fade: false };\n if (this.placement) {\n this.placement =\n PlacementForBs5[this.placement as keyof typeof PlacementForBs5];\n\n this.classMap[this.placement] = true;\n }\n this.classMap[`tooltip-${this.placement}`] = true;\n\n this.classMap['in'] = true;\n if (this.animation) {\n this.classMap['fade'] = true;\n }\n\n if (this.containerClass) {\n this.classMap[this.containerClass] = true;\n }\n }\n}\n","/* eslint-disable @angular-eslint/no-output-on-prefix */\nimport {\n Directive,\n ElementRef,\n EventEmitter,\n Input,\n OnDestroy,\n OnInit,\n Output,\n Renderer2,\n TemplateRef,\n ViewContainerRef,\n} from '@angular/core';\nimport { Subscription, timer } from 'rxjs';\n\nimport {\n ComponentLoader,\n ComponentLoaderFactory,\n} from '@shared/util-component-loader';\nimport {\n AvailbleBSPositions,\n PositioningService,\n} from '@shared/util-positioning';\nimport { OnChange, parseTriggers, Trigger, warnOnce } from '@shared/util-utils';\n\nimport { TooltipContainerComponent } from './tooltip-container.component';\nimport { TooltipService } from './tooltip.service';\n\nlet id = 0;\n\n@Directive({\n selector: '[sharedTooltip], [sharedTooltipHtml]',\n exportAs: 'shared-tooltip',\n})\nexport class TooltipDirective implements OnInit, OnDestroy {\n tooltipId = id++;\n\n /**\n * Content to be displayed as tooltip.\n */\n @OnChange()\n @Input()\n sharedTooltip?: string | TemplateRef;\n /** Fired when tooltip content changes */\n @Output()\n tooltipChange: EventEmitter> =\n new EventEmitter();\n\n /**\n * Placement of a tooltip. Accepts: \"top\", \"bottom\", \"left\", \"right\"\n */\n @Input() placement: AvailbleBSPositions = 'top';\n /**\n * Specifies events that should trigger. Supports a space separated list of\n * event names.\n */\n @Input() triggers = 'hover focus';\n /**\n * A selector specifying the element the tooltip should be appended to.\n */\n @Input() container?: string;\n /**\n * Css class for tooltip container\n */\n @Input() containerClass = '';\n @Input() boundariesElement?: 'viewport' | 'scrollParent' | 'window';\n /**\n * Allows to disable tooltip\n */\n @Input() isDisabled = false;\n /**\n * Delay before showing the tooltip\n */\n @Input() delay = 0;\n /**\n * Emits an event when the tooltip is shown\n */\n @Output() onShown: EventEmitter;\n /**\n * Emits an event when the tooltip is hidden\n */\n @Output() onHidden: EventEmitter;\n /** @deprecated - removed, will be added to configuration */\n @Input() tooltipAnimation = true;\n /** @deprecated */\n @Input() tooltipFadeDuration = 150;\n /** @deprecated */\n @Output()\n tooltipStateChanged: EventEmitter = new EventEmitter();\n protected _delayTimeoutId?: number;\n protected _tooltipCancelShowFn?: () => void;\n private _tooltip: ComponentLoader;\n private _delaySubscription?: Subscription;\n private _ariaDescribedby?: string;\n\n constructor(\n _viewContainerRef: ViewContainerRef,\n cis: ComponentLoaderFactory,\n config: TooltipService,\n private _elementRef: ElementRef,\n private _renderer: Renderer2,\n private _positionService: PositioningService,\n ) {\n this._tooltip = cis\n .createLoader(\n this._elementRef,\n _viewContainerRef,\n this._renderer,\n )\n .provide({ provide: TooltipService, useValue: config });\n\n Object.assign(this, config);\n this.onShown = this._tooltip.onShown;\n this.onHidden = this._tooltip.onHidden;\n }\n\n /**\n * Returns whether or not the tooltip is currently being shown\n */\n @Input()\n get isOpen(): boolean {\n return this._tooltip.isShown;\n }\n\n set isOpen(value: boolean) {\n if (value) {\n this.show();\n } else {\n this.hide();\n }\n }\n\n /** @deprecated - please use `tooltip` instead */\n // eslint-disable-next-line @angular-eslint/no-input-rename\n @Input('sharedTooltipHtml')\n set htmlContent(value: string | TemplateRef) {\n warnOnce('tooltipHtml was deprecated, please use `tooltip` instead');\n this.sharedTooltip = value;\n }\n\n get _isOpen(): boolean {\n warnOnce('tooltipIsOpen was deprecated, please use `isOpen` instead');\n\n return this.isOpen;\n }\n\n get _enable(): boolean {\n warnOnce('tooltipEnable was deprecated, please use `isDisabled` instead');\n\n return this.isDisabled;\n }\n\n get _appendToBody(): boolean {\n warnOnce(\n 'tooltipAppendToBody was deprecated, please use `container=\"body\"` instead',\n );\n\n return this.container === 'body';\n }\n\n ngOnInit(): void {\n this._tooltip.listen({\n triggers: this.triggers,\n show: () => this.show(),\n });\n this.tooltipChange.subscribe((value) => {\n if (!value) {\n this._tooltip.hide();\n }\n });\n\n this.onShown.subscribe(() => {\n this.setAriaDescribedBy();\n });\n\n this.onHidden.subscribe(() => {\n this.setAriaDescribedBy();\n });\n }\n\n setAriaDescribedBy(): void {\n this._ariaDescribedby = this.isOpen ? `tooltip-${this.tooltipId}` : void 0;\n\n if (this._ariaDescribedby) {\n this._renderer.setAttribute(\n this._elementRef.nativeElement,\n 'aria-describedby',\n this._ariaDescribedby,\n );\n } else {\n this._renderer.removeAttribute(\n this._elementRef.nativeElement,\n 'aria-describedby',\n );\n }\n }\n\n /**\n * Toggles an element’s tooltip. This is considered a “manual” triggering of\n * the tooltip.\n */\n toggle(): void {\n if (this.isOpen) {\n return this.hide();\n }\n\n this.show();\n }\n\n /**\n * Opens an element’s tooltip. This is considered a “manual” triggering of\n * the tooltip.\n */\n show(): void {\n this._positionService.setOptions({\n modifiers: {\n flip: {\n enabled: true,\n },\n preventOverflow: {\n enabled: true,\n boundariesElement: this.boundariesElement || 'scrollParent',\n },\n },\n });\n\n if (\n this.isOpen ||\n this.isDisabled ||\n this._delayTimeoutId ||\n !this.sharedTooltip\n ) {\n return;\n }\n\n const showTooltip = (): void => {\n if (this._delayTimeoutId) {\n this._delayTimeoutId = undefined;\n }\n\n this._tooltip\n .attach(TooltipContainerComponent)\n .to(this.container)\n .position({ attachment: this.placement })\n .show({\n content: this.sharedTooltip,\n placement: this.placement,\n containerClass: this.containerClass,\n id: `tooltip-${this.tooltipId}`,\n });\n };\n const cancelDelayedTooltipShowing = (): void => {\n if (this._tooltipCancelShowFn) {\n this._tooltipCancelShowFn();\n }\n };\n\n if (this.delay) {\n if (this._delaySubscription) {\n this._delaySubscription.unsubscribe();\n }\n\n this._delaySubscription = timer(this.delay).subscribe(() => {\n showTooltip();\n cancelDelayedTooltipShowing();\n });\n\n if (this.triggers) {\n parseTriggers(this.triggers).forEach((trigger: Trigger) => {\n if (!trigger.close) {\n return;\n }\n this._tooltipCancelShowFn = this._renderer.listen(\n this._elementRef.nativeElement,\n trigger.close,\n () => {\n this._delaySubscription?.unsubscribe();\n cancelDelayedTooltipShowing();\n },\n );\n });\n }\n } else {\n showTooltip();\n }\n }\n\n /**\n * Closes an element’s tooltip. This is considered a “manual” triggering of\n * the tooltip.\n */\n hide(): void {\n if (this._delayTimeoutId) {\n clearTimeout(this._delayTimeoutId);\n this._delayTimeoutId = undefined;\n }\n\n if (!this._tooltip.isShown) {\n return;\n }\n\n if (this._tooltip.instance?.classMap) {\n this._tooltip.instance.classMap['in'] = false;\n }\n\n setTimeout(() => {\n this._tooltip.hide();\n }, this.tooltipFadeDuration);\n }\n\n ngOnDestroy(): void {\n this._tooltip.dispose();\n this.tooltipChange.unsubscribe();\n if (this._delaySubscription) {\n this._delaySubscription.unsubscribe();\n }\n this.onShown.unsubscribe();\n this.onHidden.unsubscribe();\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { ModuleWithProviders, NgModule } from '@angular/core';\n\nimport { ComponentLoaderFactory } from '@shared/util-component-loader';\nimport { PositioningService } from '@shared/util-positioning';\n\nimport { TooltipContainerComponent } from './tooltip-container.component';\nimport { TooltipDirective } from './tooltip.directive';\n\n@NgModule({\n imports: [CommonModule],\n declarations: [TooltipDirective, TooltipContainerComponent],\n exports: [TooltipDirective],\n})\nexport class TooltipModule {\n static forRoot(): ModuleWithProviders {\n return {\n ngModule: TooltipModule,\n providers: [ComponentLoaderFactory, PositioningService],\n };\n }\n}\n","/* eslint-disable */\nimport { HttpClient } from '@angular/common/http';\nimport { EventEmitter, Injectable } from '@angular/core';\nimport { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';\nimport { Observable, Observer } from 'rxjs';\n\nimport { MetadataService } from './core/services/metadata/metadata.service';\n\n@Injectable()\nexport class AppResolverService {\n eventEmitter: EventEmitter = new EventEmitter();\n\n constructor(\n private http: HttpClient,\n private metadataService: MetadataService,\n ) {}\n\n /**\n * Resolves all the Data needed for Application Startup.\n *\n * @param {ActivatedRouteSnapshot} route\n * @param {RouterStateSnapshot} state\n * @returns {(Observable | Promise | any)}\n *\n * @memberOf AppResolverService\n */\n resolve(\n route: ActivatedRouteSnapshot,\n state: RouterStateSnapshot,\n ): Observable | Promise | any {\n return Observable.create((observer: Observer) => {\n // get and return true after setting\n this.http.get(`app`).subscribe((r: any) => {\n // Emits WebApp Data.\n this.eventEmitter.emit(r);\n\n // TODO: Get from API.\n const applicationUrl =\n window.location.protocol + '//' + window.location.host;\n\n this.metadataService.setGlobalMetadata({\n pageTitleSeparator: ' · ',\n applicationName: 'Thaibeautyshop.nl',\n applicationUrl: applicationUrl,\n defaults: {\n description: 'Make-up and skin care store.',\n 'og:image': `${applicationUrl}/assets/images/logo.png`,\n 'og:type': 'website',\n 'og:locale': 'nl_NL',\n 'og:locale:alternate': 'en_US,th_TH',\n },\n });\n\n observer.next(true);\n observer.complete();\n });\n });\n }\n}\n","/* eslint-disable */\nimport { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport { Page } from './../../core/models/page.model';\nimport { CatalogCategory } from './catalog-category-models';\n\n@Injectable()\nexport class CatalogCategoryService {\n private apiUrl = 'catalog/';\n\n constructor(private http: HttpClient) {}\n\n getByCategory(filter: any): Observable {\n return this.http.post(\n this.apiUrl + 'get-products-by-category',\n filter,\n );\n }\n\n getByBrand(url: string): Observable {\n const filter = {\n brands: [url],\n };\n\n return this.http.post(\n this.apiUrl + 'get-products-by-category',\n filter,\n );\n }\n\n getPageByBrand(url: string): Observable {\n return this.http.get('page/by-brand/' + url);\n }\n}\n","/* eslint-disable */\nimport { ChangeDetectorRef, Component, OnInit } from '@angular/core';\nimport { ActivatedRoute, Router } from '@angular/router';\n\nimport { Page } from './../../core/models/page.model';\nimport { MetadataService } from './../../core/services/metadata/metadata.service';\nimport { PageService } from './../../core/services/page/page.service';\nimport {\n CatalogCategory,\n CatalogCategoryProduct,\n} from './catalog-category-models';\nimport { CatalogCategoryService } from './catalog-category.service';\nimport { BreadcrumbDatasource } from '@shared/ui/breadcrumb';\n\n@Component({\n // tslint:disable-next-line:component-selector\n selector: 'shop-catalog-category',\n templateUrl: './catalog-category.component.html',\n // changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class CatalogCategoryComponent implements OnInit {\n products: Array = [];\n navigation: Array = [];\n page?: Page;\n breadcrumbDataSource?: BreadcrumbDatasource;\n isBrand = false;\n\n previousCategoryName?: string;\n private previousCategoryUrl?: string;\n\n constructor(\n private catalogCategoryService: CatalogCategoryService,\n private route: ActivatedRoute,\n private pageService: PageService,\n private metadataService: MetadataService,\n private router: Router,\n private cdr: ChangeDetectorRef,\n ) {}\n\n onPreviousCategory(): void {\n this.router.navigateByUrl(this.previousCategoryUrl as string);\n }\n\n onBreadcrumbNavigate(value: string) {\n this.router.navigateByUrl(value);\n }\n\n ngOnInit() {\n this.route.params.subscribe((params) => {\n if (params['category'] !== undefined) {\n this.isBrand = false;\n this.loadProductsByCategory(params['category']);\n this.loadPageByCategory(params['category']);\n } else {\n this.isBrand = true;\n this.loadProductsByBrand(params['brand']);\n this.loadPageByBrand(params['brand']);\n }\n });\n }\n\n /**\n * Load Products by Category Url.\n *\n * @private\n * @param {string} category\n *\n * @memberOf CatalogCategoryComponent\n */\n private loadProductsByCategory(category: string) {\n // TODO: Create Object for Filtering.\n let isSale = false;\n let isNew = false;\n\n if (category === 'sale') {\n isSale = true;\n // @ts-ignore\n category = null;\n }\n\n if (category === 'new') {\n isNew = true;\n // @ts-ignore\n category = null;\n }\n\n const object = {\n category: category,\n isSale: isSale,\n isNew: isNew,\n };\n\n this.catalogCategoryService\n .getByCategory(object)\n .subscribe((res: CatalogCategory) => {\n this.products = res.products;\n this.navigation = res.navigation;\n });\n }\n\n /**\n * Load Products by Brand Url.\n *\n * @private\n * @param {string} category\n *\n * @memberOf CatalogCategoryComponent\n */\n private loadProductsByBrand(brand: string) {\n this.catalogCategoryService\n .getByBrand(brand)\n .subscribe((res: CatalogCategory) => {\n this.products = res.products;\n this.navigation = res.navigation;\n });\n }\n\n /**\n * Load Title and Text.\n *\n * @private\n * @param {string} category\n *\n * @memberOf CatalogCategoryComponent\n */\n private loadPageByCategory(category: string) {\n this.pageService.get(category).subscribe((res: Page) => {\n this.page = res;\n\n this.breadcrumbDataSource = [\n {\n value: '/',\n },\n ];\n\n if (this.page.parent) {\n this.breadcrumbDataSource.push({\n value: '/category/' + this.page.parent.id,\n name: this.page.parent.name,\n });\n\n this.previousCategoryName = this.page.parent.name;\n this.previousCategoryUrl = '/category/' + this.page.parent.id;\n } else {\n this.previousCategoryName = undefined;\n this.previousCategoryUrl = undefined;\n }\n\n this.breadcrumbDataSource.push({\n name: this.page.name,\n });\n\n this.cdr.detectChanges();\n });\n }\n\n /**\n * Load Title and Text.\n *\n * @private\n * @param {string} category\n *\n * @memberOf CatalogCategoryComponent\n */\n private loadPageByBrand(brand: string) {\n this.catalogCategoryService.getPageByBrand(brand).subscribe((res: Page) => {\n this.page = res;\n this.metadataService.setTag('title', res.name);\n\n this.breadcrumbDataSource = [\n {\n value: '/',\n },\n {\n value: '/brands',\n name: 'Merken',\n },\n ];\n\n this.previousCategoryName = 'Merken';\n this.previousCategoryUrl = '/brands';\n\n this.breadcrumbDataSource.push({\n name: this.page.name,\n });\n\n this.cdr.detectChanges();\n });\n }\n}\n","
\n \n @if (previousCategoryName) {\n Toon alle {{ previousCategoryName }}\n \n }\n \n \n\n
\n
\n
\n

\n @if (previousCategoryName && !isBrand) {\n {{ previousCategoryName }}\n } @else {\n {{ page?.name }}\n }\n

\n @if (navigation.length > 0) {\n
\n
    \n @for (n of navigation; track n) {\n
  • \n {{ n.name }}\n \n
  • \n }\n
\n
\n }\n
\n
\n
\n\n
\n \n\n \n \n @for (product of products; track product) {\n \n \n }\n
\n \n\n @if (page) {\n
\n @if (page.content) {\n

\n }\n @if (page.image) {\n
\n \n
\n }\n
\n }\n \n
\n","/* eslint-disable */\nimport { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\n\nimport {\n Checkout,\n CheckoutCartProduct,\n} from './../shared/models/checkout.model';\n\n@Injectable()\nexport class CatalogCheckoutInformationService {\n constructor(private http: HttpClient) {}\n\n check(products: CheckoutCartProduct[]) {\n return this.http.post('checkout/check', products);\n }\n\n /**\n * Pay and get back a string for making the actual Payment.\n *\n * @param {Checkout} checkout\n * @returns\n *\n * @memberOf CatalogCheckoutInformationService\n */\n pay(checkout: Checkout) {\n return this.http.post('checkout/pay', checkout);\n }\n}\n","/* eslint-disable */\nimport { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\n\n@Injectable()\nexport class CatalogProductService {\n constructor(private http: HttpClient) {}\n\n /**\n * Get Product by Url.\n *\n * @param {string} url\n * @returns\n *\n * @memberOf CatalogProductService\n */\n get(url: string) {\n return this.http.get(`catalog/product/${url}`);\n }\n\n notifyProduct(url: string, mail: string) {\n return this.http.get(`catalog/product-notify/${url}/${mail}`);\n }\n}\n","/* eslint-disable */\nimport { Component, OnInit } from '@angular/core';\nimport { ActivatedRoute, Router } from '@angular/router';\n\nimport { LocalStorageService } from '../../core/services/local-storage/local-storage.service';\nimport { CatalogCheckoutInformationService } from '../catalog-checkout-information/catalog-checkout-information.service';\nimport { CatalogCheckoutService } from '../shared/services/catalog-checkout.service';\n\nimport { CheckoutCart } from './../shared/models/checkout.model';\nimport { ModalService } from '@shared/ui-modal';\nimport { BreadcrumbDatasource } from '@shared/ui/breadcrumb';\nimport { CatalogProduct } from '../catalog-product/catalog-product-models';\nimport { CatalogProductService } from '../catalog-product/catalog-product.service';\n\n@Component({\n // tslint:disable-next-line:component-selector\n selector: 'shop-catalog-checkout-cart',\n templateUrl: './catalog-checkout-cart.component.html',\n // changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class CatalogCheckoutCartComponent implements OnInit {\n // @ts-ignore\n cart: CheckoutCart;\n // @ts-ignore\n totalSum: number;\n // @ts-ignore\n shipment: number;\n stocks = Array;\n // @ts-ignore\n country: number;\n discountCode = '';\n // @ts-ignore\n discount: number;\n // @ts-ignore\n showDiscount: boolean;\n breadcrumbDataSource: BreadcrumbDatasource = [\n {\n value: '/',\n },\n {\n name: 'Winkelwagen',\n },\n ];\n\n constructor(\n private catalogCheckoutService: CatalogCheckoutService,\n private localStorageService: LocalStorageService,\n private router: Router,\n private catalogcheckoutInformationService: CatalogCheckoutInformationService,\n private readonly modalService: ModalService,\n private readonly route: ActivatedRoute,\n private readonly catalogProductService: CatalogProductService,\n ) {}\n\n /**\n * On Initialization.\n *\n * @memberOf CatalogCheckoutCartComponent\n */\n ngOnInit() {\n const productUrlToBeAdded =\n this.route.snapshot.queryParamMap.get('item_id');\n if (productUrlToBeAdded) {\n this.catalogProductService\n .get(productUrlToBeAdded)\n .subscribe((res: CatalogProduct) => {\n this.catalogCheckoutService.addProduct({\n url: res.url,\n image: res.images[0],\n name: res.name,\n sum: 1,\n price: res.price,\n // @ts-ignore\n salePrice: res.salePrice,\n deliveryTime: 1,\n // @ts-ignore\n stock: res.stock,\n brand: res.brand,\n });\n this.country = this.localStorageService.getShipmentCountry();\n this.cart = this.catalogCheckoutService.checkout.cart;\n this.getCheckoutSummary();\n });\n }\n\n this.country = this.localStorageService.getShipmentCountry();\n this.cart = this.catalogCheckoutService.checkout.cart;\n this.getCheckoutSummary();\n }\n\n onBreadcrumbNavigate(value: string) {\n this.router.navigateByUrl(value);\n }\n\n onRemove(index: number) {\n // this.cart.products.splice(index, 1);\n // this.catalogCheckoutService.checkout.cart = this.cart;\n\n this.modalService\n .confirm(\n {\n title: 'Verwijderen',\n body: 'Weet je zeker dat je het artikel uit je winkelwagen wilt verwijderen?',\n appearance: 'danger',\n buttonCancel: 'Annuleren',\n buttonContinue: 'Verwijderen',\n },\n 'sm',\n )\n .then((t) => {\n if (t) {\n this.catalogCheckoutService.removeProduct(index);\n this.getCheckoutSummary();\n }\n });\n }\n\n /**\n * Change the Sum of a Product.\n *\n * @param {number} index\n * @param {number} stock\n * @param {number} sum\n *\n * @memberOf CatalogCheckoutCartComponent\n */\n onChangeSum(index: number, stock: number, sum: number) {\n if (sum > stock) {\n sum = stock;\n }\n\n this.catalogCheckoutService.changeSumProduct(index, sum);\n this.getCheckoutSummary();\n }\n\n async onOrder() {\n if (this.cart.products.length === 0) {\n return;\n }\n\n const result = await this.catalogcheckoutInformationService\n .check(this.cart.products)\n .toPromise();\n if (result?.length === 0) {\n alert(\n 'De producten die u had in winkelwagen zijn niet meer beschikbaar. Onze excuses voor het ongemak.',\n );\n this.catalogCheckoutService.setProducts(result);\n this.getCheckoutSummary();\n return;\n }\n\n if (result !== undefined && result?.length !== this.cart.products.length) {\n this.catalogCheckoutService.setProducts(result);\n this.getCheckoutSummary();\n\n // tslint:disable-next-line:max-line-length\n alert(\n 'Er zijn diverse producten uitverkocht, deze zijn uit uw winkelwagen weg gehaald. Onze excuses voor het ongemak. De producten die nog wel beschikbaar zijn staan natuurlijk nog in uw winkelwagen.',\n );\n }\n\n if (\n result !== undefined &&\n result?.reduce((sum, current) => sum + current.sum, 0) !==\n this.cart.products.reduce((sum, current) => sum + current.sum, 0)\n ) {\n this.catalogCheckoutService.setProducts(result);\n this.getCheckoutSummary();\n\n // tslint:disable-next-line:max-line-length\n alert(\n 'Er zijn diverse producten uitverkocht, deze zijn uit uw winkelwagen weg gehaald. Onze excuses voor het ongemak. De producten die nog wel beschikbaar zijn staan natuurlijk nog in uw winkelwagen.',\n );\n }\n\n this.router.navigateByUrl('/checkout/information');\n }\n\n onApplyDiscountCode() {\n this.getCheckoutSummary();\n }\n\n private changeCountry(country: number) {\n if (+country === 0) {\n if (this.totalSum > 100) {\n this.shipment = 0;\n } else {\n this.shipment = 6.95;\n }\n } else {\n if (this.totalSum > 150) {\n this.shipment = 0;\n } else {\n this.shipment = 9.95;\n }\n }\n }\n\n /**\n * Get Checkout Summary.\n *\n * @private\n *\n * @memberOf CatalogCartComponent\n */\n private getCheckoutSummary() {\n this.totalSum = 0;\n\n this.cart.products.forEach((value) => {\n this.totalSum += value.price * value.sum;\n });\n\n if (this.totalSum > 100 && +this.country === 0) {\n this.shipment = 0;\n } else {\n this.changeCountry(this.country);\n }\n\n this.changeCountry(this.country);\n\n this.calculateDiscount();\n }\n\n private calculateDiscount() {\n // Exit function if no discount code is filled in.\n if (this.discountCode === '') {\n return;\n }\n\n // Check if Discount Code is valid.\n if (\n this.discountCode.toLowerCase() !== 'xmyn01' &&\n this.discountCode.toLowerCase() !== 'xmyn02' &&\n this.discountCode.toLowerCase() !== 'xmyn03'\n ) {\n alert('Geen geldige koringscode');\n } else {\n this.showDiscount = true;\n\n // Free shipment only in The Netherlands.\n if (this.discountCode.toLowerCase() === 'xmyn01') {\n this.discount = this.shipment;\n this.shipment = 0;\n }\n\n // 10% discount.\n if (this.discountCode.toLowerCase() === 'xmyn02') {\n this.discount = (this.totalSum / 100) * 10;\n this.totalSum = (this.totalSum / 100) * 90;\n }\n\n // 20% discount.\n if (this.discountCode.toLowerCase() === 'xmyn03') {\n this.discount = (this.totalSum / 100) * 20;\n this.totalSum = (this.totalSum / 100) * 80;\n }\n }\n }\n}\n","
\n \n \n \n\n @if (cart.products.length === 0) {\n

Er zitten geen producten in uw winkelwagen.

\n }\n @if (cart.products.length > 0) {\n \n
\n \n @for (product of cart.products; track product; let i = $index) {\n
  • \n \n \n \n
    \n \n
    \n
    \n

    \n \n {{ product.name }}\n \n

    \n
    \n
    \n

    \n {{ product.brand.name }}\n

    \n
    \n

    \n \n \n {{\n product.price | currency: 'EUR' : 'symbol' : '1.2-2'\n }}\n \n @if (product.salePrice !== null) {\n \n {{\n product.salePrice\n | currency: 'EUR' : 'symbol' : '1.2-2'\n }}\n \n }\n

    \n
    \n
    \n \n @for (stock of stocks(product.stock);\n track stock;\n let i = $index) {\n \n }\n \n
    \n \n Remove\n \n \n
    \n
    \n
    \n

    \n \n \n \n \n Direct geleverd\n

    \n \n
  • \n }\n \n
    \n \n
    \n
    \n

    \n Totaalprijs\n

    \n
    \n
    \n
    Subtotaal
    \n
    \n {{ totalSum | currency: 'EUR' : 'symbol' : '1.2-2' }}\n
    \n
    \n \n
    Verzending
    \n
    \n {{ shipment | currency: 'EUR' : 'symbol' : '1.2-2' }}\n
    \n
    \n \n
    \n Totaalprijs (inclusief btw)\n
    \n
    \n {{ totalSum + shipment | currency: 'EUR' : 'symbol' : '1.2-2' }}\n
    \n \n \n
    \n \n Bestellen\n \n
    \n \n \n

    Gratis verzending vanaf 100 euro in NL.

    \n
    \n

    \n * Gratis verzending vanaf 150 euro voor Duitsland, Frankrijk en\n België.\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\n\n\n\n\n\n\n","/* eslint-disable */\nimport { Component, OnInit } from '@angular/core';\nimport { FormBuilder, FormGroup, Validators } from '@angular/forms';\n\nimport { LocalStorageService } from '../../core/services/local-storage/local-storage.service';\n\nimport {\n Checkout,\n CheckoutCart,\n CheckoutInformation,\n CheckoutPayment,\n} from './../shared/models/checkout.model';\nimport { CatalogCheckoutService } from './../shared/services/catalog-checkout.service';\nimport { CatalogCheckoutInformationService } from './catalog-checkout-information.service';\n\n@Component({\n // tslint:disable-next-line:component-selector\n selector: 'shop-catalog-checkout-information',\n templateUrl: './catalog-checkout-information.component.html',\n // changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class CatalogCheckoutInformationComponent implements OnInit {\n // @ts-ignore\n cart: CheckoutCart;\n // @ts-ignore\n paymentMethods: Array;\n // @ts-ignore\n data: CheckoutInformation;\n // @ts-ignore\n totalSum: number;\n // @ts-ignore\n totalPaymentFee: number;\n // @ts-ignore\n shipment: number;\n // @ts-ignore\n submitted: boolean;\n // @ts-ignore\n form: FormGroup;\n isDisabled = false;\n countryDataSource: Array<{ value: number; label: string }> = [\n {\n value: 0,\n label: 'Nederland',\n },\n {\n value: 1,\n label: 'België',\n },\n {\n value: 2,\n label: 'Duitsland',\n },\n {\n value: 3,\n label: 'Frankrijk',\n },\n ];\n // \n // \n // \n // \n // @ts-ignore\n private country: number = 0;\n\n constructor(\n private catalogCheckoutService: CatalogCheckoutService,\n private catalogcheckoutInformationService: CatalogCheckoutInformationService,\n private localStorageService: LocalStorageService,\n private fb: FormBuilder,\n ) {}\n\n ngOnInit() {\n this.cart = this.catalogCheckoutService.checkout.cart;\n\n this.getCheckoutSummary();\n\n this.paymentMethods = [\n {\n name: 'iDEAL',\n image: '/assets/images/payment-methods/ideal.svg',\n description: 'Betaal gratis snel en eenvoudig via iDEAL.',\n value: 'ideal',\n },\n {\n name: 'Bancontact MisterCash',\n image: '/assets/images/payment-methods/mistercash.svg',\n description:\n 'Betaal gratis snel en eenvoudig via Bancontact MisterCash.',\n value: 'mistercash',\n },\n {\n name: 'SOFORT banking',\n image: '/assets/images/payment-methods/sofort.svg',\n value: 'sofort',\n surchargePercentage: 0.9,\n },\n {\n name: 'KBC/CBC',\n image: '/assets/images/payment-methods/kbc.svg',\n value: 'kbc',\n surchargePercentage: 0.9,\n },\n {\n name: 'Belfius',\n image: '/assets/images/payment-methods/belfius.svg',\n value: 'belfius',\n surchargePercentage: 0.9,\n },\n {\n name: 'EPS',\n image: '/assets/images/payment-methods/eps.svg',\n value: 'eps',\n surchargePercentage: 1.5,\n },\n {\n name: 'Overboeking',\n image: '/assets/images/payment-methods/sepa.svg',\n value: 'banktransfer',\n description: 'Handmatige overboeking.',\n },\n {\n name: 'Paypal',\n image: '/assets/images/payment-methods/paypal.svg',\n value: 'paypal',\n surchargePercentage: 3.9,\n },\n ];\n\n this.form = this.fb.group({\n businessOrder: [false, Validators.required],\n companyName: '',\n firstName: ['', Validators.required],\n lastName: ['', Validators.required],\n postalCode: ['', Validators.required],\n streetNr: ['', Validators.required],\n streetNrAddition: '',\n street: ['', Validators.required],\n place: ['', Validators.required],\n country: this.country,\n alternativeShipmentAddress: [false, Validators.required],\n attentionOf: '',\n alternativeAddressPostalCode: '',\n alternativeAddressStreetNr: '',\n alternativeAddressStreetNrAddition: '',\n alternativeAddressStreet: '',\n alternativeAddressPlace: '',\n alternativeAddressCountry: '',\n mail: ['', Validators.required],\n phone: '',\n newsletter: false,\n paymentMethod: 'ideal',\n });\n\n this.form.patchValue(\n this.localStorageService.getCheckout().information as any,\n );\n\n this.form.get('paymentMethod')?.valueChanges.subscribe((x) => {\n this.getCheckoutSummary();\n });\n }\n\n /**\n * On Pay Click.\n * @memberOf CatalogCheckoutInformationComponent\n */\n onPay() {\n this.submitted = true;\n\n if (this.form.valid) {\n this.isDisabled = true;\n\n const checkout: Checkout = {\n cart: this.catalogCheckoutService.checkout.cart,\n information: this.form.value,\n };\n this.localStorageService.setCheckout(checkout);\n this.catalogcheckoutInformationService.pay(checkout).subscribe(\n (res) => {\n window.location.href = res.url;\n },\n (err) => {\n alert(\n 'Er is iets niet goed gegaan, controleer je ingevulde gegevens of deze kloppen.',\n );\n this.isDisabled = false;\n },\n );\n }\n }\n\n onChangeCountry(data: number) {\n this.country = data;\n this.getCheckoutSummary();\n }\n\n /**\n * Get Checkout Summary.\n *\n * @private\n *\n * @memberOf CatalogCartComponent\n */\n getCheckoutSummary() {\n this.totalSum = 0;\n this.totalPaymentFee = 0;\n\n this.cart.products.forEach((value) => {\n this.totalSum += value.price * value.sum;\n });\n\n if (this.totalSum > 100 && +this.country === 0) {\n this.shipment = 0;\n } else {\n this.changeCountry(this.country);\n }\n\n this.changeCountry(this.country);\n\n // this.form.get('paymentMethod')\n }\n\n /**\n * Set the Payment Method value inside the 'Checkout Information' Model.\n *\n * @param {string} value\n *\n * @memberOf CatalogCheckoutInformationComponent\n */\n onSetPaymentMethod(value: string) {\n this.data.paymentMethod = value;\n }\n\n private changeCountry(country: number) {\n if (+country === 0) {\n if (this.totalSum > 100) {\n this.shipment = 0;\n } else {\n this.shipment = 6.95;\n }\n } else {\n if (this.totalSum > 150) {\n this.shipment = 0;\n } else {\n this.shipment = 9.95;\n }\n }\n\n const paymentMethod = this.form?.get('paymentMethod')?.value;\n switch (paymentMethod) {\n case 'ideal':\n case 'mistercash':\n this.totalPaymentFee = 0;\n break;\n case 'sofort':\n case 'kbc':\n case 'belfius':\n this.totalPaymentFee = ((this.totalSum + this.shipment) / 100) * 0.9;\n break;\n case 'eps':\n case 'giropay':\n this.totalPaymentFee = ((this.totalSum + this.shipment) / 100) * 1.5;\n break;\n case 'paypal':\n this.totalPaymentFee = ((this.totalSum + this.shipment) / 100) * 3.9;\n break;\n }\n }\n}\n","\n
    \n
    \n

    \n Je gegevens\n

    \n
    \n
    \n\n \n \n \n \n \n \n \n \n @for (product of cart.products; track product) {\n
  • \n \n
    \n
    \n

    {{ product.name }}

    \n

    \n \n {{ product.price | currency: 'EUR' : 'symbol' : '1.2-2' }}\n \n @if (product.salePrice !== null) {\n \n {{\n product.salePrice | currency: 'EUR' : 'symbol' : '1.2-2'\n }}\n \n }\n

    \n

    {{ product.brand.name }}

    \n

    Aantal: {{ product.sum }}

    \n
    \n
    \n
  • \n }\n\n \n \n\n \n
    \n
    \n
    Subtotaal
    \n
    \n {{ totalSum | currency: 'EUR' : 'symbol' : '1.2-2' }}\n
    \n
    \n
    \n
    Verzending
    \n
    \n {{ shipment | currency: 'EUR' : 'symbol' : '1.2-2' }}\n
    \n
    \n @if (totalPaymentFee > 0) {\n
    \n
    Betaaltoeslag
    \n
    \n {{ totalPaymentFee | currency: 'EUR' : 'symbol' : '1.2-2' }}\n
    \n
    \n }\n \n
    Totaal
    \n
    \n {{\n totalSum + shipment + totalPaymentFee\n | currency: 'EUR' : 'symbol' : '1.2-2'\n }}\n
    \n \n
    \n \n \n\n \n \n
    \n
    \n

    \n Je gegevens\n

    \n
    \n\n
    \n
    \n
    \n E-mailadres\n
    \n \n @if ((form.get('mail')?.dirty || submitted) &&\n form.get('mail')?.hasError('required')) {\n
    Verplicht
    \n }\n
    \n
    \n\n
    \n Voornaam\n
    \n \n @if ((form.get('firstName')?.dirty || submitted) &&\n form.get('firstName')?.hasError('required')) {\n
    Verplicht
    \n }\n
    \n
    \n\n
    \n
    \n\n
    \n
    \n\n
    \n
    \n\n
    \n Huisnummer\n
    \n \n @if ((form.get('streetNr')?.dirty || submitted) &&\n form.get('streetNr')?.hasError('required')) {\n
    Verplicht
    \n }\n
    \n
    \n\n
    \n
    \n\n
    \n
    \n\n
    \n Land\n
    \n \n
    \n
    \n\n
    \n
    \n\n
    \n
    \n \n
    \n
    \n
    \n\n \n Betalen\n \n\n

    \n \n \n \n \n Betaal via een beveiligde verbinding\n

    \n \n
    \n \n\n","/* eslint-disable */\nimport { Injectable } from '@angular/core';\n\nimport { LocalStorageService } from '../../../core/services/local-storage/local-storage.service';\nimport { CatalogCategoryProduct } from '../../catalog-category/catalog-category-models';\n\n@Injectable()\nexport class CatalogLastViewedService {\n lastViewed: Array = [];\n\n constructor(private localStorageService: LocalStorageService) {\n const savedLastViewed = this.localStorageService.getLastViewed();\n\n this.lastViewed = savedLastViewed !== null ? savedLastViewed : [];\n }\n\n add(product: CatalogCategoryProduct) {\n const exists = this.lastViewed.find(function (obj) {\n return obj.url === product.url;\n });\n if (exists === undefined) {\n if (this.lastViewed.length === 5) {\n this.lastViewed.shift();\n }\n\n this.lastViewed.push(product);\n }\n\n this.localStorageService.setLastViewed(this.lastViewed);\n }\n}\n","/* eslint-disable */\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n OnInit,\n} from '@angular/core';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { CatalogCategoryProduct } from '../catalog-category/catalog-category-models';\nimport { CatalogCheckoutService } from '../shared/services/catalog-checkout.service';\nimport { CatalogLastViewedService } from '../shared/services/catalog-last-viewed.service';\n\nimport { MetadataService } from './../../core/services/metadata/metadata.service';\nimport { CatalogProduct } from './catalog-product-models';\nimport { CatalogProductService } from './catalog-product.service';\nimport { BaseModal, ModalRefService, ModalService } from '@shared/ui-modal';\nimport { FormBuilder, Validators } from '@angular/forms';\nimport { ToastService } from '@shared/ui-toast';\nimport { BreadcrumbDatasource } from '@shared/ui/breadcrumb';\n\n@Component({\n selector: 'shop-catalog-product-notify-modal',\n template: `\n
    \n \n \n

    We sturen je een mail als we dit artikel weer op voorraad hebben.

    \n
    \n \n \n \n Geef mij een seintje\n \n \n \n \n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class CatalogProductNotifyModalComponent extends BaseModal {\n form = this.fb.group({\n mail: [null, Validators.required],\n });\n submitted?: boolean;\n\n constructor(\n public override bsModalRef: ModalRefService,\n private readonly fb: FormBuilder,\n private readonly catalogProductService: CatalogProductService,\n private toastService: ToastService,\n ) {\n super(bsModalRef);\n }\n\n onSubmit() {\n this.submitted = true;\n\n if (this.form.valid) {\n this.catalogProductService\n .notifyProduct(\n window.location.pathname.substring(\n window.location.pathname.lastIndexOf('/') + 1,\n ),\n this.form.value.mail as unknown as string,\n )\n .subscribe(() => {\n this.toastService.success(\n 'Succesvol aangemeld',\n 'Wij houden je op de hoogte',\n );\n this.onClose(true);\n });\n }\n }\n}\n\n@Component({\n templateUrl: './catalog-product.component.html',\n // changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class CatalogProductComponent implements OnInit, AfterViewInit {\n breadcrumbDataSource?: BreadcrumbDatasource;\n // @ts-ignore\n activeImageIndex = 0;\n // @ts-ignore\n product: any; //CatalogProduct;\n shortText?: string;\n // @ts-ignore\n stock: number;\n stocks = Array;\n // @ts-ignore\n sum: number;\n discount?: string;\n shareUrl = '';\n // @ts-ignore\n commentUrl;\n combination = '';\n // @ts-ignore\n deliveryTime: string;\n // @ts-ignore\n lastViewed: Array;\n url = ''; // ENVIRONMENT.url;\n openedSection = 'product';\n sumDataSource?: Array<{ value: number; label: string }>;\n previousCategoryName?: string;\n private previousCategoryUrl?: string;\n\n constructor(\n private catalogCheckoutService: CatalogCheckoutService,\n private catalogProductService: CatalogProductService,\n private route: ActivatedRoute,\n private router: Router,\n private metadataService: MetadataService,\n private catalogLastViewedService: CatalogLastViewedService,\n private readonly modalService: ModalService,\n private readonly cdr: ChangeDetectorRef,\n private readonly toastService: ToastService,\n ) {}\n\n onPreviousCategory(): void {\n this.router.navigateByUrl(this.previousCategoryUrl as string);\n }\n\n onBreadcrumbNavigate(value: string) {\n this.router.navigateByUrl(value);\n }\n\n ngOnInit() {\n // Scroll to top when you navigate to a new procuct and are already on a product page\n this.route.params.subscribe((e) => {\n window.scrollTo(0, 0);\n });\n\n this.commentUrl = window.location.href;\n\n this.lastViewed = Object.assign(\n [],\n this.catalogLastViewedService.lastViewed,\n );\n this.route.params.subscribe((params) => {\n this.catalogProductService\n .get(params['product'])\n .subscribe((res: CatalogProduct) => {\n /* tslint:disable */\n this.shareUrl = window.location.href;\n /* tslint:enable */\n\n this.product = res;\n this.shortText = this.truncateHtml(res.text);\n // @ts-ignore\n this.deliveryTime = this.getDeliveryTime(this.product.deliveryTime);\n\n if (this.product.salePrice) {\n const a = this.product.salePrice - this.product.price;\n const b = this.product.salePrice / a;\n const c = 100 / b;\n this.discount = c.toFixed(0);\n }\n\n this.catalogLastViewedService.add({\n name: this.product.name,\n brand: this.product.brand.name,\n image: this.product.images[0],\n imageHover: this.product.images[1],\n price: this.product.price,\n // @ts-ignore\n salePrice: this.product.salePrice,\n url: this.product.url,\n stock: this.product.stock,\n });\n\n if (!(res.combinations?.length > 0)) {\n // @ts-ignore\n this.stock = this.product.stock as Array;\n const sumDataSource: any[] = [];\n for (let i = 0; i < this.stock; i++) {\n sumDataSource?.push({\n value: i + 1,\n label: (i + 1).toString(),\n });\n }\n\n this.sumDataSource = sumDataSource;\n }\n\n this.metadataService.setTag('title', this.product.name);\n this.metadataService.setTag('og:type', 'product');\n // this.metadataService.setTag('og:image', todo);\n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n // \n\n // @ts-ignore\n if (res.stock > 0) {\n this.sum = 1;\n }\n\n this.breadcrumbDataSource = [\n {\n value: '/',\n },\n ...this.product.categories.map((m: any) => {\n return {\n value: '/category/' + m.id,\n name: m.name,\n };\n }),\n {\n name: this.product.name,\n },\n ];\n const lastCategory = this.product.categories.pop();\n this.previousCategoryName = lastCategory.name;\n this.previousCategoryUrl = '/category/' + lastCategory.id;\n\n this.cdr.detectChanges();\n });\n });\n }\n\n onNotify() {\n this.modalService\n .show(CatalogProductNotifyModalComponent, {\n size: 'sm',\n })\n .then((r) => console.log(r));\n }\n\n ngAfterViewInit() {\n (function (d, s, id) {\n let js = d.getElementsByTagName(s)[0];\n const fjs = d.getElementsByTagName(s)[0];\n js = d.createElement(s);\n js.id = id;\n js.src = '//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.4';\n\n if (d.getElementById(id)) {\n // if