{"version":3,"file":"0.86965f2e.js","sources":["../../../../../../node_modules/@datadog/browser-core/esm/browser/runOnReadyState.js","../../../../../../node_modules/@datadog/browser-core/esm/tools/requestIdleCallback.js","../../../../../../node_modules/@datadog/browser-core/esm/tools/taskQueue.js","../../../../../../node_modules/@datadog/browser-core/esm/tools/matchOption.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/contexts/commonContext.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/vital/vitalCollection.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/browser/crypto.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/tracing/identifier.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/tracing/sampler.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/tracing/tracer.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/configuration/configuration.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/configuration/remoteConfiguration.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/plugins.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/boot/preStartRum.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/boot/rumPublicApi.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/browser/domMutationObservable.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/browser/windowOpenObservable.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/contexts/syntheticsContext.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/limitModification.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/assembly.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/contexts/internalContext.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/lifeCycle.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/contexts/viewHistory.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/resource/resourceUtils.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/requestCollection.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/discardNegativeDuration.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/trackEventCounts.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/browser/firstInputPolyfill.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/browser/performanceObservable.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/waitPageActivityEnd.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/browser/polyfills.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/browser/htmlDomUtils.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/privacy.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/action/getActionNameFromElement.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/getSelectorFromElement.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/action/clickChain.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/action/listenActionEvents.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/action/computeFrustration.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/action/interactionSelectorCache.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/action/trackClickActions.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/action/actionCollection.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/error/trackConsoleError.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/error/trackReportError.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/error/errorCollection.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/longTask/longTaskCollection.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/resource/matchRequestResourceEntry.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/tracing/getDocumentTraceId.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/browser/performanceUtils.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/resource/retrieveInitialDocumentResourceTiming.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/resource/resourceCollection.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/view/trackViewEventCounts.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackFirstContentfulPaint.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackFirstInput.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackNavigationTimings.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackLargestContentfulPaint.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackFirstHidden.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackInitialViewMetrics.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/interactionCountPolyfill.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackInteractionToNextPaint.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackLoadingTime.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/browser/scroll.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/browser/viewportObservable.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackScrollMetrics.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewMetrics/trackCommonViewMetrics.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/view/trackViews.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/view/viewCollection.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/rumSessionManager.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/transport/startRumBatch.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/transport/startRumEventBridge.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/contexts/urlContexts.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/browser/locationChangeObservable.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/contexts/featureFlagContext.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/startCustomerDataTelemetry.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/contexts/pageStateHistory.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/contexts/displayContext.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/browser/cookieObservable.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/contexts/ciVisibilityContext.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/longAnimationFrame/longAnimationFrameCollection.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/boot/startRum.js","../../../../../../node_modules/@datadog/browser-rum-core/esm/domain/getSessionReplayUrl.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/replayStats.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/serialization/serializationUtils.js","../../../../../../node_modules/@datadog/browser-rum/esm/types/sessionReplayConstants.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/serialization/serializeStyleSheets.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/serialization/serializeAttribute.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/serialization/serializeAttributes.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/serialization/serializeNode.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/serialization/serializeDocument.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/eventsUtils.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/viewports.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/assembly.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackMove.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackMouseInteraction.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackScroll.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackViewportResize.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackMediaInteraction.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackStyleSheet.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackFocus.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackFrustration.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackViewEnd.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackInput.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/mutationBatch.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/trackers/trackMutation.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/elementsScrollPositions.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/shadowRootsController.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/startFullSnapshots.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/recordIds.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/record/record.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/segmentCollection/buildReplayPayload.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/segmentCollection/segment.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/segmentCollection/segmentCollection.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/startRecordBridge.js","../../../../../../node_modules/@datadog/browser-rum/esm/boot/startRecording.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/deflate/deflateEncoder.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/deflate/deflateWorker.js","../../../../../../node_modules/@datadog/browser-rum/esm/boot/isBrowserSupported.js","../../../../../../node_modules/@datadog/browser-rum/esm/domain/getSessionReplayLink.js","../../../../../../node_modules/@datadog/browser-rum/esm/boot/postStartStrategy.js","../../../../../../node_modules/@datadog/browser-rum/esm/boot/preStartStrategy.js","../../../../../../node_modules/@datadog/browser-rum/esm/boot/recorderApi.js","../../../../../../node_modules/@datadog/browser-rum/esm/entries/main.js","../../../../../../src/lib/utilities/cookies.js","../../../../../../src/lib/utilities/datadog/browser-logs.js","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/molecules/Banner.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/molecules/Cards/MenuNavigationCard.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/organisms/GlobalFooter/FooterColumn.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/assets/logos/obamaFoundationIconFooter.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/assets/logos/obamaFoundationIconDarkMode.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/assets/logos/obamaPresidencialCenterDarkMode.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/assets/logos/obamaFoundationDarkMode.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/assets/logos/obamaFoundationScholars.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/assets/logos/MBKAlliance.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/assets/logos/leaders.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/assets/logos/futureSeriesCenter.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/assets/logos/futureSeries.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/assets/logos/democracyForumCenter.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/assets/logos/democracyForum.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/assets/logos/obamaPresidencialCenter.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/assets/logos/obamaFoundationIcon.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/assets/logos/obamaFoundation.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/atoms/Logo.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/organisms/GlobalFooter/GlobalFooter.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/organisms/GlobalNavigation/globalNavigationConstants.js","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/organisms/GlobalNavigation/GlobalNavigationSecondaryMenuLink.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/organisms/GlobalNavigation/GlobalNavigationSecondaryMenu.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/organisms/GlobalNavigation/GlobalNavigationDesktopContent.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/organisms/GlobalNavigation/GlobalNavigationDesktopBar.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/organisms/GlobalNavigation/GlobalNavigationAnimationWrapper.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/organisms/GlobalNavigation/GlobalNavigationDesktop.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/organisms/GlobalNavigation/GlobalNavigationMobileBar.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/organisms/GlobalNavigation/GlobalNavigationMobileLinkLabel.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/organisms/GlobalNavigation/GlobalNavigationMobileContent.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/organisms/GlobalNavigation/GlobalNavigationMobile.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/organisms/GlobalNavigation/GlobalNavigation.svelte","../../../../../../node_modules/@ObamaFoundation/of-design-system/dist/organisms/SearchPanel.svelte","../../../../../../src/lib/components/Banner.svelte","../../../../../../src/lib/components/GTM.svelte","../../../../../../src/lib/utilities/contentTypes/entry.js","../../../../../../node_modules/lodash.debounce/index.js","../../../../../../node_modules/algoliasearch/dist/algoliasearch-lite.umd.js","../../../../../../node_modules/instantsearch.js/es/lib/suit.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/noop.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/logger.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/getObjectType.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/checkRendering.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/escape-html.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/isPlainObject.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/escape-highlight.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/concatHighlightedParts.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/serializer.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/createSendEventForHits.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/isIndexWidget.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/setIndexHelperState.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/defer.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/documentation.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/find.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/findIndex.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/getAppIdAndApiKey.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/getHighlightedParts.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/getHighlightFromSiblings.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/getPropertyByPath.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/hits-absolute-position.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/hits-query-id.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/hydrateSearchClient.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/isEqual.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/uniq.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/mergeSearchParameters.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/render-args.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/resolveSearchParameters.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/reverseHighlightedParts.js","../../../../../../node_modules/instantsearch.js/es/lib/utils/safelyRunOnBrowser.js","../../../../../../node_modules/instantsearch.js/es/helpers/highlight.js","../../../../../../node_modules/instantsearch.js/es/helpers/reverseHighlight.js","../../../../../../node_modules/instantsearch.js/es/helpers/snippet.js","../../../../../../node_modules/instantsearch.js/es/helpers/reverseSnippet.js","../../../../../../node_modules/instantsearch.js/es/helpers/insights.js","../../../../../../node_modules/instantsearch.js/es/helpers/get-insights-anonymous-user-token.js","../../../../../../node_modules/instantsearch.js/es/lib/infiniteHitsCache/sessionStorage.js","../../../../../../node_modules/@algolia/events/events.js","../../../../../../node_modules/algoliasearch-helper/src/functions/inherits.js","../../../../../../node_modules/algoliasearch-helper/src/DerivedHelper/index.js","../../../../../../node_modules/algoliasearch-helper/src/functions/escapeFacetValue.js","../../../../../../node_modules/algoliasearch-helper/src/functions/merge.js","../../../../../../node_modules/algoliasearch-helper/src/functions/objectHasKeys.js","../../../../../../node_modules/algoliasearch-helper/src/functions/omit.js","../../../../../../node_modules/algoliasearch-helper/src/RecommendParameters/index.js","../../../../../../node_modules/algoliasearch-helper/src/requestBuilder.js","../../../../../../node_modules/algoliasearch-helper/src/functions/defaultsPure.js","../../../../../../node_modules/algoliasearch-helper/src/functions/find.js","../../../../../../node_modules/algoliasearch-helper/src/functions/intersection.js","../../../../../../node_modules/algoliasearch-helper/src/functions/valToNumber.js","../../../../../../node_modules/algoliasearch-helper/src/utils/isValidUserToken.js","../../../../../../node_modules/algoliasearch-helper/src/SearchParameters/RefinementList.js","../../../../../../node_modules/algoliasearch-helper/src/SearchParameters/index.js","../../../../../../node_modules/algoliasearch-helper/src/functions/compact.js","../../../../../../node_modules/algoliasearch-helper/src/functions/findIndex.js","../../../../../../node_modules/algoliasearch-helper/src/functions/formatSort.js","../../../../../../node_modules/algoliasearch-helper/src/functions/orderBy.js","../../../../../../node_modules/algoliasearch-helper/src/SearchResults/generate-hierarchical-tree.js","../../../../../../node_modules/algoliasearch-helper/src/SearchResults/index.js","../../../../../../node_modules/algoliasearch-helper/src/version.js","../../../../../../node_modules/algoliasearch-helper/src/algoliasearch.helper.js","../../../../../../node_modules/algoliasearch-helper/index.js","../../../../../../node_modules/instantsearch.js/es/middlewares/createInsightsMiddleware.js","../../../../../../node_modules/instantsearch.js/es/middlewares/createMetadataMiddleware.js","../../../../../../node_modules/instantsearch.js/node_modules/qs/lib/formats.js","../../../../../../node_modules/instantsearch.js/node_modules/qs/lib/utils.js","../../../../../../node_modules/instantsearch.js/node_modules/qs/lib/stringify.js","../../../../../../node_modules/instantsearch.js/node_modules/qs/lib/parse.js","../../../../../../node_modules/instantsearch.js/node_modules/qs/lib/index.js","../../../../../../node_modules/instantsearch.js/es/lib/routers/history.js","../../../../../../node_modules/instantsearch.js/es/lib/stateMappings/simple.js","../../../../../../node_modules/instantsearch.js/es/middlewares/createRouterMiddleware.js","../../../../../../node_modules/instantsearch.js/es/widgets/index/index.js","../../../../../../node_modules/instantsearch.js/es/lib/formatNumber.js","../../../../../../node_modules/instantsearch.js/es/lib/createHelpers.js","../../../../../../node_modules/instantsearch.js/es/lib/version.js","../../../../../../node_modules/instantsearch.js/es/lib/InstantSearch.js","../../../../../../node_modules/instantsearch.js/es/index.js","../../../../../../node_modules/search-insights/dist/search-insights-browser.cjs.min.js","../../../../../../node_modules/search-insights/index-browser.cjs.js","../../../../../../node_modules/instantsearch.js/es/connectors/hits/connectHits.js","../../../../../../node_modules/instantsearch.js/es/connectors/search-box/connectSearchBox.js","../../../../../../node_modules/instantsearch.js/es/connectors/configure/connectConfigure.js","../../../../../../node_modules/instantsearch.js/es/connectors/autocomplete/connectAutocomplete.js","../../../../../../src/lib/components/WithAlgolia.svelte","../../../../../../src/lib/components/SearchPanel.svelte","../../../../../../src/lib/components/SearchIconButton.svelte","../../../../../../src/lib/components/Header.svelte","../../../../../../src/lib/components/Footer.svelte","../../../../../../src/lib/components/FundraiseUpRedirects.svelte","../../../../../../src/lib/components/VWO.svelte","../../../../../../src/lib/components/WithBanner.svelte","../../../../../../src/lib/components/OneTrust.svelte","../../../../../../src/routes/+layout.svelte"],"sourcesContent":["import { noop } from '../tools/utils/functionUtils';\nimport { addEventListener } from './addEventListener';\nexport function runOnReadyState(configuration, expectedReadyState, callback) {\n if (document.readyState === expectedReadyState || document.readyState === 'complete') {\n callback();\n return { stop: noop };\n }\n var eventName = expectedReadyState === 'complete' ? \"load\" /* DOM_EVENT.LOAD */ : \"DOMContentLoaded\" /* DOM_EVENT.DOM_CONTENT_LOADED */;\n return addEventListener(configuration, window, eventName, callback, { once: true });\n}\n//# sourceMappingURL=runOnReadyState.js.map","import { setTimeout, clearTimeout } from './timer';\nimport { monitor } from './monitor';\nimport { dateNow } from './utils/timeUtils';\n/**\n * 'requestIdleCallback' with a shim.\n */\nexport function requestIdleCallback(callback, opts) {\n // Note: check both 'requestIdleCallback' and 'cancelIdleCallback' existence because some polyfills only implement 'requestIdleCallback'.\n if (window.requestIdleCallback && window.cancelIdleCallback) {\n var id_1 = window.requestIdleCallback(monitor(callback), opts);\n return function () { return window.cancelIdleCallback(id_1); };\n }\n return requestIdleCallbackShim(callback);\n}\nexport var MAX_TASK_TIME = 50;\n/*\n * Shim from https://developer.chrome.com/blog/using-requestidlecallback#checking_for_requestidlecallback\n * Note: there is no simple way to support the \"timeout\" option, so we ignore it.\n */\nexport function requestIdleCallbackShim(callback) {\n var start = dateNow();\n var timeoutId = setTimeout(function () {\n callback({\n didTimeout: false,\n timeRemaining: function () { return Math.max(0, MAX_TASK_TIME - (dateNow() - start)); },\n });\n }, 0);\n return function () { return clearTimeout(timeoutId); };\n}\n//# sourceMappingURL=requestIdleCallback.js.map","import { ONE_SECOND } from './utils/timeUtils';\nimport { requestIdleCallback } from './requestIdleCallback';\n/**\n * Maximum delay before starting to execute tasks in the queue. We don't want to wait too long\n * before running tasks, as it might hurt reliability (ex: if the user navigates away, we might lose\n * the opportunity to send some data). We also don't want to run tasks too often, as it might hurt\n * performance.\n */\nvar IDLE_CALLBACK_TIMEOUT = ONE_SECOND;\n/**\n * Maximum amount of time allocated to running tasks when a timeout (`IDLE_CALLBACK_TIMEOUT`) is\n * reached. We should not run tasks for too long as it will hurt performance, but we should still\n * run some tasks to avoid postponing them forever.\n *\n * Rational: Running tasks for 30ms every second (IDLE_CALLBACK_TIMEOUT) should be acceptable.\n */\nexport var MAX_EXECUTION_TIME_ON_TIMEOUT = 30;\nexport function createTaskQueue() {\n var pendingTasks = [];\n function run(deadline) {\n var executionTimeRemaining;\n if (deadline.didTimeout) {\n var start_1 = performance.now();\n executionTimeRemaining = function () { return MAX_EXECUTION_TIME_ON_TIMEOUT - (performance.now() - start_1); };\n }\n else {\n executionTimeRemaining = deadline.timeRemaining.bind(deadline);\n }\n while (executionTimeRemaining() > 0 && pendingTasks.length) {\n pendingTasks.shift()();\n }\n if (pendingTasks.length) {\n scheduleNextRun();\n }\n }\n function scheduleNextRun() {\n requestIdleCallback(run, { timeout: IDLE_CALLBACK_TIMEOUT });\n }\n return {\n push: function (task) {\n if (pendingTasks.push(task) === 1) {\n scheduleNextRun();\n }\n },\n };\n}\n//# sourceMappingURL=taskQueue.js.map","import { startsWith } from './utils/polyfills';\nimport { display } from './display';\nimport { getType } from './utils/typeUtils';\nexport function isMatchOption(item) {\n var itemType = getType(item);\n return itemType === 'string' || itemType === 'function' || item instanceof RegExp;\n}\n/**\n * Returns true if value can be matched by at least one of the provided MatchOptions.\n * When comparing strings, setting useStartsWith to true will compare the value with the start of\n * the option, instead of requiring an exact match.\n */\nexport function matchList(list, value, useStartsWith) {\n if (useStartsWith === void 0) { useStartsWith = false; }\n return list.some(function (item) {\n try {\n if (typeof item === 'function') {\n return item(value);\n }\n else if (item instanceof RegExp) {\n return item.test(value);\n }\n else if (typeof item === 'string') {\n return useStartsWith ? startsWith(value, item) : item === value;\n }\n }\n catch (e) {\n display.error(e);\n }\n return false;\n });\n}\n//# sourceMappingURL=matchOption.js.map","export function buildCommonContext(globalContextManager, userContextManager, recorderApi) {\n return {\n context: globalContextManager.getContext(),\n user: userContextManager.getContext(),\n hasReplay: recorderApi.isRecording() ? true : undefined,\n };\n}\n//# sourceMappingURL=commonContext.js.map","import { clocksNow, combine, elapsed, generateUUID, toServerDuration } from '@datadog/browser-core';\nexport function createCustomVitalsState() {\n var vitalsByName = new Map();\n var vitalsByReference = new WeakMap();\n return { vitalsByName: vitalsByName, vitalsByReference: vitalsByReference };\n}\nexport function startVitalCollection(lifeCycle, pageStateHistory, customVitalsState) {\n function isValid(vital) {\n return !pageStateHistory.wasInPageStateDuringPeriod(\"frozen\" /* PageState.FROZEN */, vital.startClocks.relative, vital.duration);\n }\n function addDurationVital(vital) {\n if (isValid(vital)) {\n lifeCycle.notify(11 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processVital(vital, true));\n }\n }\n return {\n addDurationVital: addDurationVital,\n startDurationVital: function (name, options) {\n if (options === void 0) { options = {}; }\n return startDurationVital(customVitalsState, name, options);\n },\n stopDurationVital: function (nameOrRef, options) {\n if (options === void 0) { options = {}; }\n stopDurationVital(addDurationVital, customVitalsState, nameOrRef, options);\n },\n };\n}\nexport function startDurationVital(_a, name, options) {\n var vitalsByName = _a.vitalsByName, vitalsByReference = _a.vitalsByReference;\n if (options === void 0) { options = {}; }\n var vital = {\n name: name,\n startClocks: clocksNow(),\n context: options.context,\n description: options.description,\n };\n // To avoid leaking implementation details of the vital, we return a reference to it.\n var reference = { __dd_vital_reference: true };\n vitalsByName.set(name, vital);\n // To avoid memory leaks caused by the creation of numerous references (e.g., from improper useEffect implementations), we use a WeakMap.\n vitalsByReference.set(reference, vital);\n return reference;\n}\nexport function stopDurationVital(stopCallback, _a, nameOrRef, options) {\n var vitalsByName = _a.vitalsByName, vitalsByReference = _a.vitalsByReference;\n if (options === void 0) { options = {}; }\n var vitalStart = typeof nameOrRef === 'string' ? vitalsByName.get(nameOrRef) : vitalsByReference.get(nameOrRef);\n if (!vitalStart) {\n return;\n }\n stopCallback(buildDurationVital(vitalStart, vitalStart.startClocks, options, clocksNow()));\n if (typeof nameOrRef === 'string') {\n vitalsByName.delete(nameOrRef);\n }\n else {\n vitalsByReference.delete(nameOrRef);\n }\n}\nfunction buildDurationVital(vitalStart, startClocks, stopOptions, stopClocks) {\n var _a;\n return {\n name: vitalStart.name,\n type: \"duration\" /* VitalType.DURATION */,\n startClocks: startClocks,\n duration: elapsed(startClocks.timeStamp, stopClocks.timeStamp),\n context: combine(vitalStart.context, stopOptions.context),\n description: (_a = stopOptions.description) !== null && _a !== void 0 ? _a : vitalStart.description,\n };\n}\nfunction processVital(vital, valueComputedBySdk) {\n var rawRumEvent = {\n date: vital.startClocks.timeStamp,\n vital: {\n id: generateUUID(),\n type: vital.type,\n name: vital.name,\n duration: toServerDuration(vital.duration),\n description: vital.description,\n },\n type: \"vital\" /* RumEventType.VITAL */,\n };\n if (valueComputedBySdk) {\n rawRumEvent._dd = {\n vital: {\n computed_value: true,\n },\n };\n }\n return {\n rawRumEvent: rawRumEvent,\n startTime: vital.startClocks.relative,\n customerContext: vital.context,\n domainContext: {},\n };\n}\n//# sourceMappingURL=vitalCollection.js.map","export function getCrypto() {\n // TODO: remove msCrypto when IE11 support is dropped\n return window.crypto || window.msCrypto;\n}\n//# sourceMappingURL=crypto.js.map","import { ExperimentalFeature, isExperimentalFeatureEnabled } from '@datadog/browser-core';\nimport { getCrypto } from '../../browser/crypto';\nexport function createTraceIdentifier() {\n return createIdentifier(64);\n}\nexport function createSpanIdentifier() {\n return createIdentifier(63);\n}\nvar createIdentifierImplementationCache;\nfunction createIdentifier(bits) {\n if (!createIdentifierImplementationCache) {\n createIdentifierImplementationCache =\n isExperimentalFeatureEnabled(ExperimentalFeature.CONSISTENT_TRACE_SAMPLING) && areBigIntIdentifiersSupported()\n ? createIdentifierUsingBigInt\n : createIdentifierUsingUint32Array;\n }\n return createIdentifierImplementationCache(bits);\n}\nexport function areBigIntIdentifiersSupported() {\n try {\n crypto.getRandomValues(new BigUint64Array(1));\n return true;\n }\n catch (_a) {\n return false;\n }\n}\nfunction createIdentifierUsingBigInt(bits) {\n var id = crypto.getRandomValues(new BigUint64Array(1))[0];\n if (bits === 63) {\n // eslint-disable-next-line no-bitwise\n id >>= BigInt('1');\n }\n return id;\n}\n// TODO: remove this when all browser we support have BigInt support\nfunction createIdentifierUsingUint32Array(bits) {\n var buffer = getCrypto().getRandomValues(new Uint32Array(2));\n if (bits === 63) {\n // eslint-disable-next-line no-bitwise\n buffer[buffer.length - 1] >>>= 1; // force 63-bit\n }\n return {\n toString: function (radix) {\n if (radix === void 0) { radix = 10; }\n var high = buffer[1];\n var low = buffer[0];\n var str = '';\n do {\n var mod = (high % radix) * 4294967296 + low;\n high = Math.floor(high / radix);\n low = Math.floor(mod / radix);\n str = (mod % radix).toString(radix) + str;\n } while (high || low);\n return str;\n },\n };\n}\nexport function toPaddedHexadecimalString(id) {\n var traceId = id.toString(16);\n // TODO: replace with String.prototype.padStart when we drop IE11 support\n return Array(17 - traceId.length).join('0') + traceId;\n}\n//# sourceMappingURL=identifier.js.map","import { performDraw } from '@datadog/browser-core';\nexport function isTraceSampled(identifier, sampleRate) {\n // Shortcuts for common cases. This is not strictly necessary, but it makes the code faster for\n // customers willing to ingest all traces.\n if (sampleRate === 100) {\n return true;\n }\n if (sampleRate === 0) {\n return false;\n }\n // For simplicity, we don't use consistent sampling for browser that don't support BigInt\n // TODO: remove this when all browser we support have BigInt support\n if (typeof identifier !== 'bigint') {\n return performDraw(sampleRate);\n }\n // Offer consistent sampling for the same trace id across different environments. The rule is:\n //\n // (identifier * knuthFactor) % 2^64 < sampleRate * 2^64\n //\n // Because JavaScript numbers are 64-bit floats, we can't represent 64-bit integers, and the\n // modulo would be incorrect. Thus, we are using BigInts here.\n //\n // Implementation in other languages:\n // * Go https://github.com/DataDog/dd-trace-go/blob/ec6fbb1f2d517b7b8e69961052adf7136f3af773/ddtrace/tracer/sampler.go#L86-L91\n // * Python https://github.com/DataDog/dd-trace-py/blob/0cee2f066fb6e79aa15947c1514c0f406dea47c5/ddtrace/sampling_rule.py#L197\n // * Ruby https://github.com/DataDog/dd-trace-rb/blob/1a6e255cdcb7e7e22235ea5955f90f6dfa91045d/lib/datadog/tracing/sampling/rate_sampler.rb#L42\n // * C++ https://github.com/DataDog/dd-trace-cpp/blob/159629edc438ae45f2bb318eb7bd51abd05e94b5/src/datadog/trace_sampler.cpp#L58\n // * Java https://github.com/DataDog/dd-trace-java/blob/896dd6b380533216e0bdee59614606c8272d313e/dd-trace-core/src/main/java/datadog/trace/common/sampling/DeterministicSampler.java#L48\n //\n // Note: All implementations have slight variations. Some of them use '<=' instead of '<', and\n // use `sampleRate * 2^64 - 1` instead of `sampleRate * 2^64`. The following implementation\n // should adhere to the spec and is a bit simpler than using a 2^64-1 limit as there are less\n // BigInt arithmetic to write. In practice this does not matter, as we are using floating point\n // numbers in the end, and Number(2n**64n-1n) === Number(2n**64n).\n var knuthFactor = BigInt('1111111111111111111');\n var twoPow64 = BigInt('0x10000000000000000'); // 2n ** 64n\n var hash = (identifier * knuthFactor) % twoPow64;\n return Number(hash) <= (sampleRate / 100) * Number(twoPow64);\n}\n//# sourceMappingURL=sampler.js.map","import { objectEntries, shallowClone, assign, find, getType, isMatchOption, matchList, TraceContextInjection, } from '@datadog/browser-core';\nimport { getCrypto } from '../../browser/crypto';\nimport { createSpanIdentifier, createTraceIdentifier, toPaddedHexadecimalString } from './identifier';\nimport { isTraceSampled } from './sampler';\nexport function isTracingOption(item) {\n var expectedItem = item;\n return (getType(expectedItem) === 'object' &&\n isMatchOption(expectedItem.match) &&\n Array.isArray(expectedItem.propagatorTypes));\n}\n/**\n * Clear tracing information to avoid incomplete traces. Ideally, we should do it when the\n * request did not reach the server, but the browser does not expose this. So, we clear tracing\n * information if the request ended with status 0 without being aborted by the application.\n *\n * Reasoning:\n *\n * * Applications are usually aborting requests after a bit of time, for example when the user is\n * typing (autocompletion) or navigating away (in a SPA). With a performant device and good\n * network conditions, the request is likely to reach the server before being canceled.\n *\n * * Requests aborted otherwise (ex: lack of internet, CORS issue, blocked by a privacy extension)\n * are likely to finish quickly and without reaching the server.\n *\n * Of course, it might not be the case every time, but it should limit having incomplete traces a\n * bit.\n * */\nexport function clearTracingIfNeeded(context) {\n if (context.status === 0 && !context.isAborted) {\n context.traceId = undefined;\n context.spanId = undefined;\n context.traceSampled = undefined;\n }\n}\nexport function startTracer(configuration, sessionManager) {\n return {\n clearTracingIfNeeded: clearTracingIfNeeded,\n traceFetch: function (context) {\n return injectHeadersIfTracingAllowed(configuration, context, sessionManager, function (tracingHeaders) {\n var _a;\n if (context.input instanceof Request && !((_a = context.init) === null || _a === void 0 ? void 0 : _a.headers)) {\n context.input = new Request(context.input);\n Object.keys(tracingHeaders).forEach(function (key) {\n ;\n context.input.headers.append(key, tracingHeaders[key]);\n });\n }\n else {\n context.init = shallowClone(context.init);\n var headers_1 = [];\n if (context.init.headers instanceof Headers) {\n context.init.headers.forEach(function (value, key) {\n headers_1.push([key, value]);\n });\n }\n else if (Array.isArray(context.init.headers)) {\n context.init.headers.forEach(function (header) {\n headers_1.push(header);\n });\n }\n else if (context.init.headers) {\n Object.keys(context.init.headers).forEach(function (key) {\n headers_1.push([key, context.init.headers[key]]);\n });\n }\n context.init.headers = headers_1.concat(objectEntries(tracingHeaders));\n }\n });\n },\n traceXhr: function (context, xhr) {\n return injectHeadersIfTracingAllowed(configuration, context, sessionManager, function (tracingHeaders) {\n Object.keys(tracingHeaders).forEach(function (name) {\n xhr.setRequestHeader(name, tracingHeaders[name]);\n });\n });\n },\n };\n}\nfunction injectHeadersIfTracingAllowed(configuration, context, sessionManager, inject) {\n if (!isTracingSupported() || !sessionManager.findTrackedSession()) {\n return;\n }\n var tracingOption = find(configuration.allowedTracingUrls, function (tracingOption) {\n return matchList([tracingOption.match], context.url, true);\n });\n if (!tracingOption) {\n return;\n }\n var traceId = createTraceIdentifier();\n context.traceSampled = isTraceSampled(traceId, configuration.traceSampleRate);\n var shouldInjectHeaders = context.traceSampled || configuration.traceContextInjection === TraceContextInjection.ALL;\n if (!shouldInjectHeaders) {\n return;\n }\n context.traceId = traceId;\n context.spanId = createSpanIdentifier();\n inject(makeTracingHeaders(context.traceId, context.spanId, context.traceSampled, tracingOption.propagatorTypes));\n}\nexport function isTracingSupported() {\n return getCrypto() !== undefined;\n}\n/**\n * When trace is not sampled, set priority to '0' instead of not adding the tracing headers\n * to prepare the implementation for sampling delegation.\n */\nfunction makeTracingHeaders(traceId, spanId, traceSampled, propagatorTypes) {\n var tracingHeaders = {};\n propagatorTypes.forEach(function (propagatorType) {\n switch (propagatorType) {\n case 'datadog': {\n assign(tracingHeaders, {\n 'x-datadog-origin': 'rum',\n 'x-datadog-parent-id': spanId.toString(),\n 'x-datadog-sampling-priority': traceSampled ? '1' : '0',\n 'x-datadog-trace-id': traceId.toString(),\n });\n break;\n }\n // https://www.w3.org/TR/trace-context/\n case 'tracecontext': {\n assign(tracingHeaders, {\n traceparent: \"00-0000000000000000\".concat(toPaddedHexadecimalString(traceId), \"-\").concat(toPaddedHexadecimalString(spanId), \"-0\").concat(traceSampled ? '1' : '0'),\n });\n break;\n }\n // https://github.com/openzipkin/b3-propagation\n case 'b3': {\n assign(tracingHeaders, {\n b3: \"\".concat(toPaddedHexadecimalString(traceId), \"-\").concat(toPaddedHexadecimalString(spanId), \"-\").concat(traceSampled ? '1' : '0'),\n });\n break;\n }\n case 'b3multi': {\n assign(tracingHeaders, {\n 'X-B3-TraceId': toPaddedHexadecimalString(traceId),\n 'X-B3-SpanId': toPaddedHexadecimalString(spanId),\n 'X-B3-Sampled': traceSampled ? '1' : '0',\n });\n break;\n }\n }\n });\n return tracingHeaders;\n}\n//# sourceMappingURL=tracer.js.map","import { getType, arrayFrom, isMatchOption, serializeConfiguration, assign, DefaultPrivacyLevel, TraceContextInjection, display, objectHasValue, validateAndBuildConfiguration, isSampleRate, isNumber, } from '@datadog/browser-core';\nimport { isTracingOption } from '../tracing/tracer';\nexport var DEFAULT_PROPAGATOR_TYPES = ['tracecontext', 'datadog'];\nexport function validateAndBuildRumConfiguration(initConfiguration) {\n var _a, _b, _c;\n if (!initConfiguration.applicationId) {\n display.error('Application ID is not configured, no RUM data will be collected.');\n return;\n }\n if (!isSampleRate(initConfiguration.sessionReplaySampleRate, 'Session Replay') ||\n !isSampleRate(initConfiguration.traceSampleRate, 'Trace')) {\n return;\n }\n if (initConfiguration.excludedActivityUrls !== undefined && !Array.isArray(initConfiguration.excludedActivityUrls)) {\n display.error('Excluded Activity Urls should be an array');\n return;\n }\n var allowedTracingUrls = validateAndBuildTracingOptions(initConfiguration);\n if (!allowedTracingUrls) {\n return;\n }\n var baseConfiguration = validateAndBuildConfiguration(initConfiguration);\n if (!baseConfiguration) {\n return;\n }\n var sessionReplaySampleRate = (_a = initConfiguration.sessionReplaySampleRate) !== null && _a !== void 0 ? _a : 0;\n return assign({\n applicationId: initConfiguration.applicationId,\n version: initConfiguration.version || undefined,\n actionNameAttribute: initConfiguration.actionNameAttribute,\n sessionReplaySampleRate: sessionReplaySampleRate,\n startSessionReplayRecordingManually: initConfiguration.startSessionReplayRecordingManually !== undefined\n ? !!initConfiguration.startSessionReplayRecordingManually\n : sessionReplaySampleRate === 0,\n traceSampleRate: (_b = initConfiguration.traceSampleRate) !== null && _b !== void 0 ? _b : 100,\n rulePsr: isNumber(initConfiguration.traceSampleRate) ? initConfiguration.traceSampleRate / 100 : undefined,\n allowedTracingUrls: allowedTracingUrls,\n excludedActivityUrls: (_c = initConfiguration.excludedActivityUrls) !== null && _c !== void 0 ? _c : [],\n workerUrl: initConfiguration.workerUrl,\n compressIntakeRequests: !!initConfiguration.compressIntakeRequests,\n trackUserInteractions: !!initConfiguration.trackUserInteractions,\n trackViewsManually: !!initConfiguration.trackViewsManually,\n trackResources: !!initConfiguration.trackResources,\n trackLongTasks: !!initConfiguration.trackLongTasks,\n subdomain: initConfiguration.subdomain,\n defaultPrivacyLevel: objectHasValue(DefaultPrivacyLevel, initConfiguration.defaultPrivacyLevel)\n ? initConfiguration.defaultPrivacyLevel\n : DefaultPrivacyLevel.MASK,\n enablePrivacyForActionName: !!initConfiguration.enablePrivacyForActionName,\n customerDataTelemetrySampleRate: 1,\n traceContextInjection: objectHasValue(TraceContextInjection, initConfiguration.traceContextInjection)\n ? initConfiguration.traceContextInjection\n : TraceContextInjection.ALL,\n plugins: initConfiguration.plugins || [],\n }, baseConfiguration);\n}\n/**\n * Validates allowedTracingUrls and converts match options to tracing options\n */\nfunction validateAndBuildTracingOptions(initConfiguration) {\n if (initConfiguration.allowedTracingUrls === undefined) {\n return [];\n }\n if (!Array.isArray(initConfiguration.allowedTracingUrls)) {\n display.error('Allowed Tracing URLs should be an array');\n return;\n }\n if (initConfiguration.allowedTracingUrls.length !== 0 && initConfiguration.service === undefined) {\n display.error('Service needs to be configured when tracing is enabled');\n return;\n }\n // Convert from (MatchOption | TracingOption) to TracingOption, remove unknown properties\n var tracingOptions = [];\n initConfiguration.allowedTracingUrls.forEach(function (option) {\n if (isMatchOption(option)) {\n tracingOptions.push({ match: option, propagatorTypes: DEFAULT_PROPAGATOR_TYPES });\n }\n else if (isTracingOption(option)) {\n tracingOptions.push(option);\n }\n else {\n display.warn('Allowed Tracing Urls parameters should be a string, RegExp, function, or an object. Ignoring parameter', option);\n }\n });\n return tracingOptions;\n}\n/**\n * Combines the selected tracing propagators from the different options in allowedTracingUrls\n */\nfunction getSelectedTracingPropagators(configuration) {\n var usedTracingPropagators = new Set();\n if (Array.isArray(configuration.allowedTracingUrls) && configuration.allowedTracingUrls.length > 0) {\n configuration.allowedTracingUrls.forEach(function (option) {\n if (isMatchOption(option)) {\n DEFAULT_PROPAGATOR_TYPES.forEach(function (propagatorType) { return usedTracingPropagators.add(propagatorType); });\n }\n else if (getType(option) === 'object' && Array.isArray(option.propagatorTypes)) {\n // Ensure we have an array, as we cannot rely on types yet (configuration is provided by users)\n option.propagatorTypes.forEach(function (propagatorType) { return usedTracingPropagators.add(propagatorType); });\n }\n });\n }\n return arrayFrom(usedTracingPropagators);\n}\nexport function serializeRumConfiguration(configuration) {\n var _a;\n var baseSerializedConfiguration = serializeConfiguration(configuration);\n return assign({\n session_replay_sample_rate: configuration.sessionReplaySampleRate,\n start_session_replay_recording_manually: configuration.startSessionReplayRecordingManually,\n trace_sample_rate: configuration.traceSampleRate,\n trace_context_injection: configuration.traceContextInjection,\n action_name_attribute: configuration.actionNameAttribute,\n use_allowed_tracing_urls: Array.isArray(configuration.allowedTracingUrls) && configuration.allowedTracingUrls.length > 0,\n selected_tracing_propagators: getSelectedTracingPropagators(configuration),\n default_privacy_level: configuration.defaultPrivacyLevel,\n enable_privacy_for_action_name: configuration.enablePrivacyForActionName,\n use_excluded_activity_urls: Array.isArray(configuration.excludedActivityUrls) && configuration.excludedActivityUrls.length > 0,\n use_worker_url: !!configuration.workerUrl,\n compress_intake_requests: configuration.compressIntakeRequests,\n track_views_manually: configuration.trackViewsManually,\n track_user_interactions: configuration.trackUserInteractions,\n track_resources: configuration.trackResources,\n track_long_task: configuration.trackLongTasks,\n plugins: (_a = configuration.plugins) === null || _a === void 0 ? void 0 : _a.map(function (plugin) { var _a; return assign({ name: plugin.name }, (_a = plugin.getConfigurationTelemetry) === null || _a === void 0 ? void 0 : _a.call(plugin)); }),\n }, baseSerializedConfiguration);\n}\n//# sourceMappingURL=configuration.js.map","import { display, addEventListener, assign } from '@datadog/browser-core';\nexport var REMOTE_CONFIGURATION_URL = 'https://d3uc069fcn7uxw.cloudfront.net/configuration';\nexport function fetchAndApplyRemoteConfiguration(initConfiguration, callback) {\n fetchRemoteConfiguration(initConfiguration, function (remoteInitConfiguration) {\n callback(applyRemoteConfiguration(initConfiguration, remoteInitConfiguration));\n });\n}\nexport function applyRemoteConfiguration(initConfiguration, remoteInitConfiguration) {\n return assign({}, initConfiguration, remoteInitConfiguration);\n}\nexport function fetchRemoteConfiguration(configuration, callback) {\n var xhr = new XMLHttpRequest();\n addEventListener(configuration, xhr, 'load', function () {\n if (xhr.status === 200) {\n callback(JSON.parse(xhr.responseText));\n }\n else {\n displayRemoteConfigurationFetchingError();\n }\n });\n addEventListener(configuration, xhr, 'error', function () {\n displayRemoteConfigurationFetchingError();\n });\n xhr.open('GET', \"\".concat(REMOTE_CONFIGURATION_URL, \"/\").concat(encodeURIComponent(configuration.remoteConfigurationId), \".json\"));\n xhr.send();\n}\nfunction displayRemoteConfigurationFetchingError() {\n display.error('Error fetching the remote configuration.');\n}\n//# sourceMappingURL=remoteConfiguration.js.map","export function callPluginsMethod(plugins, methodName, parameter) {\n if (!plugins) {\n return;\n }\n for (var _i = 0, plugins_1 = plugins; _i < plugins_1.length; _i++) {\n var plugin = plugins_1[_i];\n var method = plugin[methodName];\n if (method) {\n method(parameter);\n }\n }\n}\n//# sourceMappingURL=plugins.js.map","import { createBoundedBuffer, display, canUseEventBridge, displayAlreadyInitializedError, willSyntheticsInjectRum, noop, timeStampNow, clocksNow, assign, getEventBridge, ExperimentalFeature, isExperimentalFeatureEnabled, initFeatureFlags, addTelemetryConfiguration, initFetchObservable, } from '@datadog/browser-core';\nimport { validateAndBuildRumConfiguration, } from '../domain/configuration';\nimport { startDurationVital, stopDurationVital } from '../domain/vital/vitalCollection';\nimport { fetchAndApplyRemoteConfiguration, serializeRumConfiguration } from '../domain/configuration';\nimport { callPluginsMethod } from '../domain/plugins';\nexport function createPreStartStrategy(_a, getCommonContext, trackingConsentState, customVitalsState, doStartRum) {\n var ignoreInitIfSyntheticsWillInjectRum = _a.ignoreInitIfSyntheticsWillInjectRum, startDeflateWorker = _a.startDeflateWorker;\n var bufferApiCalls = createBoundedBuffer();\n var firstStartViewCall;\n var deflateWorker;\n var cachedInitConfiguration;\n var cachedConfiguration;\n var trackingConsentStateSubscription = trackingConsentState.observable.subscribe(tryStartRum);\n function tryStartRum() {\n if (!cachedInitConfiguration || !cachedConfiguration || !trackingConsentState.isGranted()) {\n return;\n }\n trackingConsentStateSubscription.unsubscribe();\n var initialViewOptions;\n if (cachedConfiguration.trackViewsManually) {\n if (!firstStartViewCall) {\n return;\n }\n // An initial view is always created when starting RUM.\n // When tracking views automatically, any startView call before RUM start creates an extra\n // view.\n // When tracking views manually, we use the ViewOptions from the first startView call as the\n // initial view options, and we remove the actual startView call so we don't create an extra\n // view.\n bufferApiCalls.remove(firstStartViewCall.callback);\n initialViewOptions = firstStartViewCall.options;\n }\n var startRumResult = doStartRum(cachedConfiguration, deflateWorker, initialViewOptions);\n bufferApiCalls.drain(startRumResult);\n }\n function doInit(initConfiguration) {\n var eventBridgeAvailable = canUseEventBridge();\n if (eventBridgeAvailable) {\n initConfiguration = overrideInitConfigurationForBridge(initConfiguration);\n }\n // Update the exposed initConfiguration to reflect the bridge and remote configuration overrides\n cachedInitConfiguration = initConfiguration;\n addTelemetryConfiguration(serializeRumConfiguration(initConfiguration));\n if (cachedConfiguration) {\n displayAlreadyInitializedError('DD_RUM', initConfiguration);\n return;\n }\n var configuration = validateAndBuildRumConfiguration(initConfiguration);\n if (!configuration) {\n return;\n }\n if (!eventBridgeAvailable && !configuration.sessionStoreStrategyType) {\n display.warn('No storage available for session. We will not send any data.');\n return;\n }\n if (configuration.compressIntakeRequests && !eventBridgeAvailable && startDeflateWorker) {\n deflateWorker = startDeflateWorker(configuration, 'Datadog RUM', \n // Worker initialization can fail asynchronously, especially in Firefox where even CSP\n // issues are reported asynchronously. For now, the SDK will continue its execution even if\n // data won't be sent to Datadog. We could improve this behavior in the future.\n noop);\n if (!deflateWorker) {\n // `startDeflateWorker` should have logged an error message explaining the issue\n return;\n }\n }\n cachedConfiguration = configuration;\n // Instrumuent fetch to track network requests\n // This is needed in case the consent is not granted and some cutsomer\n // library (Apollo Client) is storing uninstrumented fetch to be used later\n // The subscrption is needed so that the instrumentation process is completed\n initFetchObservable().subscribe(noop);\n trackingConsentState.tryToInit(configuration.trackingConsent);\n tryStartRum();\n }\n var addDurationVital = function (vital) {\n bufferApiCalls.add(function (startRumResult) { return startRumResult.addDurationVital(vital); });\n };\n return {\n init: function (initConfiguration, publicApi) {\n if (!initConfiguration) {\n display.error('Missing configuration');\n return;\n }\n // Set the experimental feature flags as early as possible, so we can use them in most places\n initFeatureFlags(initConfiguration.enableExperimentalFeatures);\n // Expose the initial configuration regardless of initialization success.\n cachedInitConfiguration = initConfiguration;\n // If we are in a Synthetics test configured to automatically inject a RUM instance, we want\n // to completely discard the customer application RUM instance by ignoring their init() call.\n // But, we should not ignore the init() call from the Synthetics-injected RUM instance, so the\n // internal `ignoreInitIfSyntheticsWillInjectRum` option is here to bypass this condition.\n if (ignoreInitIfSyntheticsWillInjectRum && willSyntheticsInjectRum()) {\n return;\n }\n callPluginsMethod(initConfiguration.plugins, 'onInit', { initConfiguration: initConfiguration, publicApi: publicApi });\n if (initConfiguration.remoteConfigurationId &&\n isExperimentalFeatureEnabled(ExperimentalFeature.REMOTE_CONFIGURATION)) {\n fetchAndApplyRemoteConfiguration(initConfiguration, doInit);\n }\n else {\n doInit(initConfiguration);\n }\n },\n get initConfiguration() {\n return cachedInitConfiguration;\n },\n getInternalContext: noop,\n stopSession: noop,\n addTiming: function (name, time) {\n if (time === void 0) { time = timeStampNow(); }\n bufferApiCalls.add(function (startRumResult) { return startRumResult.addTiming(name, time); });\n },\n startView: function (options, startClocks) {\n if (startClocks === void 0) { startClocks = clocksNow(); }\n var callback = function (startRumResult) {\n startRumResult.startView(options, startClocks);\n };\n bufferApiCalls.add(callback);\n if (!firstStartViewCall) {\n firstStartViewCall = { options: options, callback: callback };\n tryStartRum();\n }\n },\n setViewName: function (name) {\n bufferApiCalls.add(function (startRumResult) { return startRumResult.setViewName(name); });\n },\n setViewContext: function (context) {\n bufferApiCalls.add(function (startRumResult) { return startRumResult.setViewContext(context); });\n },\n setViewContextProperty: function (key, value) {\n bufferApiCalls.add(function (startRumResult) { return startRumResult.setViewContextProperty(key, value); });\n },\n addAction: function (action, commonContext) {\n if (commonContext === void 0) { commonContext = getCommonContext(); }\n bufferApiCalls.add(function (startRumResult) { return startRumResult.addAction(action, commonContext); });\n },\n addError: function (providedError, commonContext) {\n if (commonContext === void 0) { commonContext = getCommonContext(); }\n bufferApiCalls.add(function (startRumResult) { return startRumResult.addError(providedError, commonContext); });\n },\n addFeatureFlagEvaluation: function (key, value) {\n bufferApiCalls.add(function (startRumResult) { return startRumResult.addFeatureFlagEvaluation(key, value); });\n },\n startDurationVital: function (name, options) {\n return startDurationVital(customVitalsState, name, options);\n },\n stopDurationVital: function (name, options) {\n stopDurationVital(addDurationVital, customVitalsState, name, options);\n },\n addDurationVital: addDurationVital,\n };\n}\nfunction overrideInitConfigurationForBridge(initConfiguration) {\n var _a, _b;\n return assign({}, initConfiguration, {\n applicationId: '00000000-aaaa-0000-aaaa-000000000000',\n clientToken: 'empty',\n sessionSampleRate: 100,\n defaultPrivacyLevel: (_a = initConfiguration.defaultPrivacyLevel) !== null && _a !== void 0 ? _a : (_b = getEventBridge()) === null || _b === void 0 ? void 0 : _b.getPrivacyLevel(),\n });\n}\n//# sourceMappingURL=preStartRum.js.map","import { addTelemetryUsage, assign, createContextManager, deepClone, makePublicApi, monitor, clocksNow, callMonitored, createHandlingStack, checkUser, sanitizeUser, sanitize, createIdentityEncoder, createCustomerDataTrackerManager, storeContextManager, displayAlreadyInitializedError, createTrackingConsentState, timeStampToClocks, } from '@datadog/browser-core';\nimport { buildCommonContext } from '../domain/contexts/commonContext';\nimport { createCustomVitalsState } from '../domain/vital/vitalCollection';\nimport { createPreStartStrategy } from './preStartRum';\nvar RUM_STORAGE_KEY = 'rum';\nexport function makeRumPublicApi(startRumImpl, recorderApi, options) {\n if (options === void 0) { options = {}; }\n var customerDataTrackerManager = createCustomerDataTrackerManager(0 /* CustomerDataCompressionStatus.Unknown */);\n var globalContextManager = createContextManager(customerDataTrackerManager.getOrCreateTracker(2 /* CustomerDataType.GlobalContext */));\n var userContextManager = createContextManager(customerDataTrackerManager.getOrCreateTracker(1 /* CustomerDataType.User */));\n var trackingConsentState = createTrackingConsentState();\n var customVitalsState = createCustomVitalsState();\n function getCommonContext() {\n return buildCommonContext(globalContextManager, userContextManager, recorderApi);\n }\n var strategy = createPreStartStrategy(options, getCommonContext, trackingConsentState, customVitalsState, function (configuration, deflateWorker, initialViewOptions) {\n if (configuration.storeContextsAcrossPages) {\n storeContextManager(configuration, globalContextManager, RUM_STORAGE_KEY, 2 /* CustomerDataType.GlobalContext */);\n storeContextManager(configuration, userContextManager, RUM_STORAGE_KEY, 1 /* CustomerDataType.User */);\n }\n customerDataTrackerManager.setCompressionStatus(deflateWorker ? 1 /* CustomerDataCompressionStatus.Enabled */ : 2 /* CustomerDataCompressionStatus.Disabled */);\n var startRumResult = startRumImpl(configuration, recorderApi, customerDataTrackerManager, getCommonContext, initialViewOptions, deflateWorker && options.createDeflateEncoder\n ? function (streamId) { return options.createDeflateEncoder(configuration, deflateWorker, streamId); }\n : createIdentityEncoder, trackingConsentState, customVitalsState);\n recorderApi.onRumStart(startRumResult.lifeCycle, configuration, startRumResult.session, startRumResult.viewHistory, deflateWorker);\n strategy = createPostStartStrategy(strategy, startRumResult);\n return startRumResult;\n });\n var startView = monitor(function (options) {\n var sanitizedOptions = typeof options === 'object' ? options : { name: options };\n if (sanitizedOptions.context) {\n customerDataTrackerManager.getOrCreateTracker(3 /* CustomerDataType.View */).updateCustomerData(sanitizedOptions.context);\n }\n strategy.startView(sanitizedOptions);\n addTelemetryUsage({ feature: 'start-view' });\n });\n var rumPublicApi = makePublicApi({\n init: monitor(function (initConfiguration) {\n strategy.init(initConfiguration, rumPublicApi);\n }),\n setTrackingConsent: monitor(function (trackingConsent) {\n trackingConsentState.update(trackingConsent);\n addTelemetryUsage({ feature: 'set-tracking-consent', tracking_consent: trackingConsent });\n }),\n setViewName: monitor(function (name) {\n strategy.setViewName(name);\n }),\n setViewContext: monitor(function (context) {\n strategy.setViewContext(context);\n }),\n setViewContextProperty: monitor(function (key, value) {\n strategy.setViewContextProperty(key, value);\n }),\n setGlobalContext: monitor(function (context) {\n globalContextManager.setContext(context);\n addTelemetryUsage({ feature: 'set-global-context' });\n }),\n getGlobalContext: monitor(function () { return globalContextManager.getContext(); }),\n setGlobalContextProperty: monitor(function (key, value) {\n globalContextManager.setContextProperty(key, value);\n addTelemetryUsage({ feature: 'set-global-context' });\n }),\n removeGlobalContextProperty: monitor(function (key) { return globalContextManager.removeContextProperty(key); }),\n clearGlobalContext: monitor(function () { return globalContextManager.clearContext(); }),\n getInternalContext: monitor(function (startTime) { return strategy.getInternalContext(startTime); }),\n getInitConfiguration: monitor(function () { return deepClone(strategy.initConfiguration); }),\n addAction: function (name, context) {\n var handlingStack = createHandlingStack();\n callMonitored(function () {\n strategy.addAction({\n name: sanitize(name),\n context: sanitize(context),\n startClocks: clocksNow(),\n type: \"custom\" /* ActionType.CUSTOM */,\n handlingStack: handlingStack,\n });\n addTelemetryUsage({ feature: 'add-action' });\n });\n },\n addError: function (error, context) {\n var handlingStack = createHandlingStack();\n callMonitored(function () {\n strategy.addError({\n error: error, // Do not sanitize error here, it is needed unserialized by computeRawError()\n handlingStack: handlingStack,\n context: sanitize(context),\n startClocks: clocksNow(),\n });\n addTelemetryUsage({ feature: 'add-error' });\n });\n },\n addTiming: monitor(function (name, time) {\n // TODO: next major decide to drop relative time support or update its behaviour\n strategy.addTiming(sanitize(name), time);\n }),\n setUser: monitor(function (newUser) {\n if (checkUser(newUser)) {\n userContextManager.setContext(sanitizeUser(newUser));\n }\n addTelemetryUsage({ feature: 'set-user' });\n }),\n getUser: monitor(function () { return userContextManager.getContext(); }),\n setUserProperty: monitor(function (key, property) {\n var _a;\n var sanitizedProperty = sanitizeUser((_a = {}, _a[key] = property, _a))[key];\n userContextManager.setContextProperty(key, sanitizedProperty);\n addTelemetryUsage({ feature: 'set-user' });\n }),\n removeUserProperty: monitor(function (key) { return userContextManager.removeContextProperty(key); }),\n clearUser: monitor(function () { return userContextManager.clearContext(); }),\n startView: startView,\n stopSession: monitor(function () {\n strategy.stopSession();\n addTelemetryUsage({ feature: 'stop-session' });\n }),\n addFeatureFlagEvaluation: monitor(function (key, value) {\n strategy.addFeatureFlagEvaluation(sanitize(key), sanitize(value));\n addTelemetryUsage({ feature: 'add-feature-flag-evaluation' });\n }),\n getSessionReplayLink: monitor(function () { return recorderApi.getSessionReplayLink(); }),\n startSessionReplayRecording: monitor(function (options) {\n recorderApi.start(options);\n addTelemetryUsage({ feature: 'start-session-replay-recording', force: options && options.force });\n }),\n stopSessionReplayRecording: monitor(function () { return recorderApi.stop(); }),\n addDurationVital: monitor(function (name, options) {\n addTelemetryUsage({ feature: 'add-duration-vital' });\n strategy.addDurationVital({\n name: sanitize(name),\n type: \"duration\" /* VitalType.DURATION */,\n startClocks: timeStampToClocks(options.startTime),\n duration: options.duration,\n context: sanitize(options && options.context),\n description: sanitize(options && options.description),\n });\n }),\n startDurationVital: monitor(function (name, options) {\n addTelemetryUsage({ feature: 'start-duration-vital' });\n return strategy.startDurationVital(sanitize(name), {\n context: sanitize(options && options.context),\n description: sanitize(options && options.description),\n });\n }),\n stopDurationVital: monitor(function (nameOrRef, options) {\n addTelemetryUsage({ feature: 'stop-duration-vital' });\n strategy.stopDurationVital(typeof nameOrRef === 'string' ? sanitize(nameOrRef) : nameOrRef, {\n context: sanitize(options && options.context),\n description: sanitize(options && options.description),\n });\n }),\n });\n return rumPublicApi;\n}\nfunction createPostStartStrategy(preStartStrategy, startRumResult) {\n return assign({\n init: function (initConfiguration) {\n displayAlreadyInitializedError('DD_RUM', initConfiguration);\n },\n initConfiguration: preStartStrategy.initConfiguration,\n }, startRumResult);\n}\n//# sourceMappingURL=rumPublicApi.js.map","import { monitor, noop, Observable, getZoneJsOriginalValue } from '@datadog/browser-core';\nexport function createDOMMutationObservable() {\n var MutationObserver = getMutationObserverConstructor();\n return new Observable(function (observable) {\n if (!MutationObserver) {\n return;\n }\n var observer = new MutationObserver(monitor(function () { return observable.notify(); }));\n observer.observe(document, {\n attributes: true,\n characterData: true,\n childList: true,\n subtree: true,\n });\n return function () { return observer.disconnect(); };\n });\n}\nexport function getMutationObserverConstructor() {\n var constructor;\n var browserWindow = window;\n // Angular uses Zone.js to provide a context persisting across async tasks. Zone.js replaces the\n // global MutationObserver constructor with a patched version to support the context propagation.\n // There is an ongoing issue[1][2] with this setup when using a MutationObserver within a Angular\n // component: on some occasions, the callback is being called in an infinite loop, causing the\n // page to freeze (even if the callback is completely empty).\n //\n // To work around this issue, we try to get the original MutationObserver constructor stored by\n // Zone.js.\n //\n // [1] https://github.com/angular/angular/issues/26948\n // [2] https://github.com/angular/angular/issues/31712\n if (browserWindow.Zone) {\n // Zone.js 0.8.6+ is storing original class constructors into the browser 'window' object[3].\n //\n // [3] https://github.com/angular/angular/blob/6375fa79875c0fe7b815efc45940a6e6f5c9c9eb/packages/zone.js/lib/common/utils.ts#L288\n constructor = getZoneJsOriginalValue(browserWindow, 'MutationObserver');\n if (browserWindow.MutationObserver && constructor === browserWindow.MutationObserver) {\n // Anterior Zone.js versions (used in Angular 2) does not expose the original MutationObserver\n // in the 'window' object. Luckily, the patched MutationObserver class is storing an original\n // instance in its properties[4]. Let's get the original MutationObserver constructor from\n // there.\n //\n // [4] https://github.com/angular/zone.js/blob/v0.8.5/lib/common/utils.ts#L412\n var patchedInstance = new browserWindow.MutationObserver(noop);\n var originalInstance = getZoneJsOriginalValue(patchedInstance, 'originalInstance');\n constructor = originalInstance && originalInstance.constructor;\n }\n }\n if (!constructor) {\n constructor = browserWindow.MutationObserver;\n }\n return constructor;\n}\n//# sourceMappingURL=domMutationObservable.js.map","import { instrumentMethod, Observable } from '@datadog/browser-core';\nexport function createWindowOpenObservable() {\n var observable = new Observable();\n var stop = instrumentMethod(window, 'open', function () { return observable.notify(); }).stop;\n return { observable: observable, stop: stop };\n}\n//# sourceMappingURL=windowOpenObservable.js.map","import { getSyntheticsResultId, getSyntheticsTestId, willSyntheticsInjectRum } from '@datadog/browser-core';\nexport function getSyntheticsContext() {\n var testId = getSyntheticsTestId();\n var resultId = getSyntheticsResultId();\n if (testId && resultId) {\n return {\n test_id: testId,\n result_id: resultId,\n injected: willSyntheticsInjectRum(),\n };\n }\n}\n//# sourceMappingURL=syntheticsContext.js.map","import { sanitize, deepClone, getType, objectEntries } from '@datadog/browser-core';\n/**\n * Current limitation:\n * - field path do not support array, 'a.b.c' only\n */\nexport function limitModification(object, modifiableFieldPaths, modifier) {\n var clone = deepClone(object);\n var result = modifier(clone);\n objectEntries(modifiableFieldPaths).forEach(function (_a) {\n var fieldPath = _a[0], fieldType = _a[1];\n var newValue = get(clone, fieldPath);\n var newType = getType(newValue);\n if (newType === fieldType) {\n set(object, fieldPath, sanitize(newValue));\n }\n else if (fieldType === 'object' && (newType === 'undefined' || newType === 'null')) {\n set(object, fieldPath, {});\n }\n });\n return result;\n}\nfunction get(object, path) {\n var current = object;\n for (var _i = 0, _a = path.split('.'); _i < _a.length; _i++) {\n var field = _a[_i];\n if (!isValidObjectContaining(current, field)) {\n return;\n }\n current = current[field];\n }\n return current;\n}\nfunction set(object, path, value) {\n var current = object;\n var fields = path.split('.');\n for (var i = 0; i < fields.length; i += 1) {\n var field = fields[i];\n if (!isValidObject(current)) {\n return;\n }\n if (i !== fields.length - 1) {\n current = current[field];\n }\n else {\n current[field] = value;\n }\n }\n}\nfunction isValidObject(object) {\n return getType(object) === 'object';\n}\nfunction isValidObjectContaining(object, field) {\n return isValidObject(object) && Object.prototype.hasOwnProperty.call(object, field);\n}\n//# sourceMappingURL=limitModification.js.map","import { combine, isEmptyObject, timeStampNow, currentDrift, display, createEventRateLimiter, canUseEventBridge, assign, round, isExperimentalFeatureEnabled, ExperimentalFeature, getConnectivity, } from '@datadog/browser-core';\nimport { getSyntheticsContext } from './contexts/syntheticsContext';\nimport { limitModification } from './limitModification';\nvar VIEW_MODIFIABLE_FIELD_PATHS = {\n 'view.name': 'string',\n 'view.url': 'string',\n 'view.referrer': 'string',\n};\nvar USER_CUSTOMIZABLE_FIELD_PATHS = {\n context: 'object',\n};\nvar ROOT_MODIFIABLE_FIELD_PATHS = {\n service: 'string',\n version: 'string',\n};\nvar modifiableFieldPathsByEvent;\nexport function startRumAssembly(configuration, lifeCycle, sessionManager, viewHistory, urlContexts, actionContexts, displayContext, ciVisibilityContext, getCommonContext, reportError) {\n var _a, _b;\n modifiableFieldPathsByEvent = (_a = {},\n _a[\"view\" /* RumEventType.VIEW */] = assign({}, USER_CUSTOMIZABLE_FIELD_PATHS, VIEW_MODIFIABLE_FIELD_PATHS),\n _a[\"error\" /* RumEventType.ERROR */] = assign({\n 'error.message': 'string',\n 'error.stack': 'string',\n 'error.resource.url': 'string',\n 'error.fingerprint': 'string',\n }, USER_CUSTOMIZABLE_FIELD_PATHS, VIEW_MODIFIABLE_FIELD_PATHS, ROOT_MODIFIABLE_FIELD_PATHS),\n _a[\"resource\" /* RumEventType.RESOURCE */] = assign({\n 'resource.url': 'string',\n }, isExperimentalFeatureEnabled(ExperimentalFeature.WRITABLE_RESOURCE_GRAPHQL)\n ? {\n 'resource.graphql': 'object',\n }\n : {}, USER_CUSTOMIZABLE_FIELD_PATHS, VIEW_MODIFIABLE_FIELD_PATHS, ROOT_MODIFIABLE_FIELD_PATHS),\n _a[\"action\" /* RumEventType.ACTION */] = assign({\n 'action.target.name': 'string',\n }, USER_CUSTOMIZABLE_FIELD_PATHS, VIEW_MODIFIABLE_FIELD_PATHS, ROOT_MODIFIABLE_FIELD_PATHS),\n _a[\"long_task\" /* RumEventType.LONG_TASK */] = assign({}, USER_CUSTOMIZABLE_FIELD_PATHS, VIEW_MODIFIABLE_FIELD_PATHS),\n _a[\"vital\" /* RumEventType.VITAL */] = assign({}, USER_CUSTOMIZABLE_FIELD_PATHS, VIEW_MODIFIABLE_FIELD_PATHS),\n _a);\n var eventRateLimiters = (_b = {},\n _b[\"error\" /* RumEventType.ERROR */] = createEventRateLimiter(\"error\" /* RumEventType.ERROR */, configuration.eventRateLimiterThreshold, reportError),\n _b[\"action\" /* RumEventType.ACTION */] = createEventRateLimiter(\"action\" /* RumEventType.ACTION */, configuration.eventRateLimiterThreshold, reportError),\n _b[\"vital\" /* RumEventType.VITAL */] = createEventRateLimiter(\"vital\" /* RumEventType.VITAL */, configuration.eventRateLimiterThreshold, reportError),\n _b);\n var syntheticsContext = getSyntheticsContext();\n lifeCycle.subscribe(11 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, function (_a) {\n var startTime = _a.startTime, rawRumEvent = _a.rawRumEvent, domainContext = _a.domainContext, savedCommonContext = _a.savedCommonContext, customerContext = _a.customerContext;\n var viewHistoryEntry = viewHistory.findView(startTime);\n var urlContext = urlContexts.findUrl(startTime);\n var session = sessionManager.findTrackedSession(startTime);\n if (session && viewHistoryEntry && urlContext) {\n var commonContext = savedCommonContext || getCommonContext();\n var actionId = actionContexts.findActionId(startTime);\n var rumContext = {\n _dd: {\n format_version: 2,\n drift: currentDrift(),\n configuration: {\n session_sample_rate: round(configuration.sessionSampleRate, 3),\n session_replay_sample_rate: round(configuration.sessionReplaySampleRate, 3),\n },\n browser_sdk_version: canUseEventBridge() ? \"5.35.0\" : undefined,\n },\n application: {\n id: configuration.applicationId,\n },\n date: timeStampNow(),\n service: viewHistoryEntry.service || configuration.service,\n version: viewHistoryEntry.version || configuration.version,\n source: 'browser',\n session: {\n id: session.id,\n type: syntheticsContext\n ? \"synthetics\" /* SessionType.SYNTHETICS */\n : ciVisibilityContext.get()\n ? \"ci_test\" /* SessionType.CI_TEST */\n : \"user\" /* SessionType.USER */,\n },\n view: {\n id: viewHistoryEntry.id,\n name: viewHistoryEntry.name,\n url: urlContext.url,\n referrer: urlContext.referrer,\n },\n action: needToAssembleWithAction(rawRumEvent) && actionId ? { id: actionId } : undefined,\n synthetics: syntheticsContext,\n ci_test: ciVisibilityContext.get(),\n display: displayContext.get(),\n connectivity: getConnectivity(),\n };\n var serverRumEvent = combine(rumContext, rawRumEvent);\n serverRumEvent.context = combine(commonContext.context, viewHistoryEntry.context, customerContext);\n if (!('has_replay' in serverRumEvent.session)) {\n ;\n serverRumEvent.session.has_replay = commonContext.hasReplay;\n }\n if (serverRumEvent.type === 'view') {\n ;\n serverRumEvent.session.sampled_for_replay =\n session.sessionReplay === 1 /* SessionReplayState.SAMPLED */;\n }\n if (\n // TODO: remove ff and should always add anonymous user id\n isExperimentalFeatureEnabled(ExperimentalFeature.ANONYMOUS_USER_TRACKING) &&\n !commonContext.user.anonymous_id) {\n commonContext.user.anonymous_id = session.anonymousId;\n }\n if (!isEmptyObject(commonContext.user)) {\n ;\n serverRumEvent.usr = commonContext.user;\n }\n if (shouldSend(serverRumEvent, configuration.beforeSend, domainContext, eventRateLimiters)) {\n if (isEmptyObject(serverRumEvent.context)) {\n delete serverRumEvent.context;\n }\n lifeCycle.notify(12 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, serverRumEvent);\n }\n }\n });\n}\nfunction shouldSend(event, beforeSend, domainContext, eventRateLimiters) {\n var _a;\n if (beforeSend) {\n var result = limitModification(event, modifiableFieldPathsByEvent[event.type], function (event) {\n return beforeSend(event, domainContext);\n });\n if (result === false && event.type !== \"view\" /* RumEventType.VIEW */) {\n return false;\n }\n if (result === false) {\n display.warn(\"Can't dismiss view events using beforeSend!\");\n }\n }\n var rateLimitReached = (_a = eventRateLimiters[event.type]) === null || _a === void 0 ? void 0 : _a.isLimitReached();\n return !rateLimitReached;\n}\nfunction needToAssembleWithAction(event) {\n return [\"error\" /* RumEventType.ERROR */, \"resource\" /* RumEventType.RESOURCE */, \"long_task\" /* RumEventType.LONG_TASK */].indexOf(event.type) !== -1;\n}\n//# sourceMappingURL=assembly.js.map","/**\n * Internal context keep returning v1 format\n * to not break compatibility with logs data format\n */\nexport function startInternalContext(applicationId, sessionManager, viewHistory, actionContexts, urlContexts) {\n return {\n get: function (startTime) {\n var viewContext = viewHistory.findView(startTime);\n var urlContext = urlContexts.findUrl(startTime);\n var session = sessionManager.findTrackedSession(startTime);\n if (session && viewContext && urlContext) {\n var actionId = actionContexts.findActionId(startTime);\n return {\n application_id: applicationId,\n session_id: session.id,\n user_action: actionId ? { id: actionId } : undefined,\n view: { id: viewContext.id, name: viewContext.name, referrer: urlContext.referrer, url: urlContext.url },\n };\n }\n },\n };\n}\n//# sourceMappingURL=internalContext.js.map","import { AbstractLifeCycle } from '@datadog/browser-core';\nexport var LifeCycle = (AbstractLifeCycle);\n//# sourceMappingURL=lifeCycle.js.map","import { SESSION_TIME_OUT_DELAY, createValueHistory } from '@datadog/browser-core';\nexport var VIEW_CONTEXT_TIME_OUT_DELAY = SESSION_TIME_OUT_DELAY;\nexport function startViewHistory(lifeCycle) {\n var viewValueHistory = createValueHistory({ expireDelay: VIEW_CONTEXT_TIME_OUT_DELAY });\n lifeCycle.subscribe(1 /* LifeCycleEventType.BEFORE_VIEW_CREATED */, function (view) {\n viewValueHistory.add(buildViewHistoryEntry(view), view.startClocks.relative);\n });\n lifeCycle.subscribe(5 /* LifeCycleEventType.AFTER_VIEW_ENDED */, function (_a) {\n var endClocks = _a.endClocks;\n viewValueHistory.closeActive(endClocks.relative);\n });\n lifeCycle.subscribe(3 /* LifeCycleEventType.VIEW_UPDATED */, function (viewUpdate) {\n var currentView = viewValueHistory.find(viewUpdate.startClocks.relative);\n if (currentView && viewUpdate.name) {\n currentView.name = viewUpdate.name;\n }\n if (currentView && viewUpdate.context) {\n currentView.context = viewUpdate.context;\n }\n });\n lifeCycle.subscribe(9 /* LifeCycleEventType.SESSION_RENEWED */, function () {\n viewValueHistory.reset();\n });\n function buildViewHistoryEntry(view) {\n return {\n service: view.service,\n version: view.version,\n context: view.context,\n id: view.id,\n name: view.name,\n startClocks: view.startClocks,\n };\n }\n return {\n findView: function (startTime) { return viewValueHistory.find(startTime); },\n stop: function () {\n viewValueHistory.stop();\n },\n };\n}\n//# sourceMappingURL=viewHistory.js.map","import { addTelemetryDebug, elapsed, getPathName, includes, isValidUrl, toServerDuration, isIntakeUrl, } from '@datadog/browser-core';\nexport var FAKE_INITIAL_DOCUMENT = 'initial_document';\nvar RESOURCE_TYPES = [\n [\"document\" /* ResourceType.DOCUMENT */, function (initiatorType) { return FAKE_INITIAL_DOCUMENT === initiatorType; }],\n [\"xhr\" /* ResourceType.XHR */, function (initiatorType) { return 'xmlhttprequest' === initiatorType; }],\n [\"fetch\" /* ResourceType.FETCH */, function (initiatorType) { return 'fetch' === initiatorType; }],\n [\"beacon\" /* ResourceType.BEACON */, function (initiatorType) { return 'beacon' === initiatorType; }],\n [\"css\" /* ResourceType.CSS */, function (_, path) { return /\\.css$/i.test(path); }],\n [\"js\" /* ResourceType.JS */, function (_, path) { return /\\.js$/i.test(path); }],\n [\n \"image\" /* ResourceType.IMAGE */,\n function (initiatorType, path) {\n return includes(['image', 'img', 'icon'], initiatorType) || /\\.(gif|jpg|jpeg|tiff|png|svg|ico)$/i.exec(path) !== null;\n },\n ],\n [\"font\" /* ResourceType.FONT */, function (_, path) { return /\\.(woff|eot|woff2|ttf)$/i.exec(path) !== null; }],\n [\n \"media\" /* ResourceType.MEDIA */,\n function (initiatorType, path) {\n return includes(['audio', 'video'], initiatorType) || /\\.(mp3|mp4)$/i.exec(path) !== null;\n },\n ],\n];\nexport function computeResourceEntryType(entry) {\n var url = entry.name;\n if (!isValidUrl(url)) {\n addTelemetryDebug(\"Failed to construct URL for \\\"\".concat(entry.name, \"\\\"\"));\n return \"other\" /* ResourceType.OTHER */;\n }\n var path = getPathName(url);\n for (var _i = 0, RESOURCE_TYPES_1 = RESOURCE_TYPES; _i < RESOURCE_TYPES_1.length; _i++) {\n var _a = RESOURCE_TYPES_1[_i], type = _a[0], isType = _a[1];\n if (isType(entry.initiatorType, path)) {\n return type;\n }\n }\n return \"other\" /* ResourceType.OTHER */;\n}\nfunction areInOrder() {\n var numbers = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n numbers[_i] = arguments[_i];\n }\n for (var i = 1; i < numbers.length; i += 1) {\n if (numbers[i - 1] > numbers[i]) {\n return false;\n }\n }\n return true;\n}\nexport function isResourceEntryRequestType(entry) {\n return entry.initiatorType === 'xmlhttprequest' || entry.initiatorType === 'fetch';\n}\nexport function computeResourceEntryDuration(entry) {\n var duration = entry.duration, startTime = entry.startTime, responseEnd = entry.responseEnd;\n // Safari duration is always 0 on timings blocked by cross origin policies.\n if (duration === 0 && startTime < responseEnd) {\n return toServerDuration(elapsed(startTime, responseEnd));\n }\n return toServerDuration(duration);\n}\nexport function computeResourceEntryDetails(entry) {\n if (!hasValidResourceEntryTimings(entry)) {\n return undefined;\n }\n var startTime = entry.startTime, fetchStart = entry.fetchStart, workerStart = entry.workerStart, redirectStart = entry.redirectStart, redirectEnd = entry.redirectEnd, domainLookupStart = entry.domainLookupStart, domainLookupEnd = entry.domainLookupEnd, connectStart = entry.connectStart, secureConnectionStart = entry.secureConnectionStart, connectEnd = entry.connectEnd, requestStart = entry.requestStart, responseStart = entry.responseStart, responseEnd = entry.responseEnd;\n var details = {\n download: formatTiming(startTime, responseStart, responseEnd),\n first_byte: formatTiming(startTime, requestStart, responseStart),\n };\n // Make sure a worker processing time is recorded\n if (0 < workerStart && workerStart < fetchStart) {\n details.worker = formatTiming(startTime, workerStart, fetchStart);\n }\n // Make sure a connection occurred\n if (fetchStart < connectEnd) {\n details.connect = formatTiming(startTime, connectStart, connectEnd);\n // Make sure a secure connection occurred\n if (connectStart <= secureConnectionStart && secureConnectionStart <= connectEnd) {\n details.ssl = formatTiming(startTime, secureConnectionStart, connectEnd);\n }\n }\n // Make sure a domain lookup occurred\n if (fetchStart < domainLookupEnd) {\n details.dns = formatTiming(startTime, domainLookupStart, domainLookupEnd);\n }\n // Make sure a redirection occurred\n if (startTime < redirectEnd) {\n details.redirect = formatTiming(startTime, redirectStart, redirectEnd);\n }\n return details;\n}\n/**\n * Entries with negative duration are unexpected and should be dismissed. The intake will ignore RUM\n * Resource events with negative durations anyway.\n * Since Chromium 128, more entries have unexpected negative durations, see\n * https://issues.chromium.org/issues/363031537\n */\nexport function hasValidResourceEntryDuration(entry) {\n return entry.duration >= 0;\n}\nexport function hasValidResourceEntryTimings(entry) {\n // Ensure timings are in the right order. On top of filtering out potential invalid\n // RumPerformanceResourceTiming, it will ignore entries from requests where timings cannot be\n // collected, for example cross origin requests without a \"Timing-Allow-Origin\" header allowing\n // it.\n var areCommonTimingsInOrder = areInOrder(entry.startTime, entry.fetchStart, entry.domainLookupStart, entry.domainLookupEnd, entry.connectStart, entry.connectEnd, entry.requestStart, entry.responseStart, entry.responseEnd);\n var areRedirectionTimingsInOrder = hasRedirection(entry)\n ? areInOrder(entry.startTime, entry.redirectStart, entry.redirectEnd, entry.fetchStart)\n : true;\n return areCommonTimingsInOrder && areRedirectionTimingsInOrder;\n}\nfunction hasRedirection(entry) {\n return entry.redirectEnd > entry.startTime;\n}\nfunction formatTiming(origin, start, end) {\n if (origin <= start && start <= end) {\n return {\n duration: toServerDuration(elapsed(start, end)),\n start: toServerDuration(elapsed(origin, start)),\n };\n }\n}\n/**\n * The 'nextHopProtocol' is an empty string for cross-origin resources without CORS headers,\n * meaning the protocol is unknown, and we shouldn't report it.\n * https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/nextHopProtocol#cross-origin_resources\n */\nexport function computeResourceEntryProtocol(entry) {\n return entry.nextHopProtocol === '' ? undefined : entry.nextHopProtocol;\n}\n/**\n * Handles the 'deliveryType' property to distinguish between supported values ('cache', 'navigational-prefetch'),\n * undefined (unsupported in some browsers), and other cases ('other' for unknown or unrecognized values).\n * see: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/deliveryType\n */\nexport function computeResourceEntryDeliveryType(entry) {\n return entry.deliveryType === '' ? 'other' : entry.deliveryType;\n}\nexport function computeResourceEntrySize(entry) {\n // Make sure a request actually occurred\n if (entry.startTime < entry.responseStart) {\n var encodedBodySize = entry.encodedBodySize, decodedBodySize = entry.decodedBodySize, transferSize = entry.transferSize;\n return {\n size: decodedBodySize,\n encoded_body_size: encodedBodySize,\n decoded_body_size: decodedBodySize,\n transfer_size: transferSize,\n };\n }\n return {\n size: undefined,\n encoded_body_size: undefined,\n decoded_body_size: undefined,\n transfer_size: undefined,\n };\n}\nexport function isAllowedRequestUrl(url) {\n return url && !isIntakeUrl(url);\n}\nvar DATA_URL_REGEX = /data:(.+)?(;base64)?,/g;\nexport var MAX_ATTRIBUTE_VALUE_CHAR_LENGTH = 24000;\nexport function isLongDataUrl(url) {\n if (url.length <= MAX_ATTRIBUTE_VALUE_CHAR_LENGTH) {\n return false;\n }\n else if (url.substring(0, 5) === 'data:') {\n // Avoid String.match RangeError: Maximum call stack size exceeded\n url = url.substring(0, MAX_ATTRIBUTE_VALUE_CHAR_LENGTH);\n return true;\n }\n return false;\n}\nexport function sanitizeDataUrl(url) {\n return \"\".concat(url.match(DATA_URL_REGEX)[0], \"[...]\");\n}\n//# sourceMappingURL=resourceUtils.js.map","import { initFetchObservable, initXhrObservable, readBytesFromStream, elapsed, timeStampNow, tryToClone, } from '@datadog/browser-core';\nimport { isAllowedRequestUrl } from './resource/resourceUtils';\nimport { startTracer } from './tracing/tracer';\nvar nextRequestIndex = 1;\nexport function startRequestCollection(lifeCycle, configuration, sessionManager) {\n var tracer = startTracer(configuration, sessionManager);\n trackXhr(lifeCycle, configuration, tracer);\n trackFetch(lifeCycle, tracer);\n}\nexport function trackXhr(lifeCycle, configuration, tracer) {\n var subscription = initXhrObservable(configuration).subscribe(function (rawContext) {\n var context = rawContext;\n if (!isAllowedRequestUrl(context.url)) {\n return;\n }\n switch (context.state) {\n case 'start':\n tracer.traceXhr(context, context.xhr);\n context.requestIndex = getNextRequestIndex();\n lifeCycle.notify(6 /* LifeCycleEventType.REQUEST_STARTED */, {\n requestIndex: context.requestIndex,\n url: context.url,\n });\n break;\n case 'complete':\n tracer.clearTracingIfNeeded(context);\n lifeCycle.notify(7 /* LifeCycleEventType.REQUEST_COMPLETED */, {\n duration: context.duration,\n method: context.method,\n requestIndex: context.requestIndex,\n spanId: context.spanId,\n startClocks: context.startClocks,\n status: context.status,\n traceId: context.traceId,\n traceSampled: context.traceSampled,\n type: \"xhr\" /* RequestType.XHR */,\n url: context.url,\n xhr: context.xhr,\n isAborted: context.isAborted,\n handlingStack: context.handlingStack,\n });\n break;\n }\n });\n return { stop: function () { return subscription.unsubscribe(); } };\n}\nexport function trackFetch(lifeCycle, tracer) {\n var subscription = initFetchObservable().subscribe(function (rawContext) {\n var context = rawContext;\n if (!isAllowedRequestUrl(context.url)) {\n return;\n }\n switch (context.state) {\n case 'start':\n tracer.traceFetch(context);\n context.requestIndex = getNextRequestIndex();\n lifeCycle.notify(6 /* LifeCycleEventType.REQUEST_STARTED */, {\n requestIndex: context.requestIndex,\n url: context.url,\n });\n break;\n case 'resolve':\n waitForResponseToComplete(context, function (duration) {\n tracer.clearTracingIfNeeded(context);\n lifeCycle.notify(7 /* LifeCycleEventType.REQUEST_COMPLETED */, {\n duration: duration,\n method: context.method,\n requestIndex: context.requestIndex,\n responseType: context.responseType,\n spanId: context.spanId,\n startClocks: context.startClocks,\n status: context.status,\n traceId: context.traceId,\n traceSampled: context.traceSampled,\n type: \"fetch\" /* RequestType.FETCH */,\n url: context.url,\n response: context.response,\n init: context.init,\n input: context.input,\n isAborted: context.isAborted,\n handlingStack: context.handlingStack,\n });\n });\n break;\n }\n });\n return { stop: function () { return subscription.unsubscribe(); } };\n}\nfunction getNextRequestIndex() {\n var result = nextRequestIndex;\n nextRequestIndex += 1;\n return result;\n}\nfunction waitForResponseToComplete(context, callback) {\n var clonedResponse = context.response && tryToClone(context.response);\n if (!clonedResponse || !clonedResponse.body) {\n // do not try to wait for the response if the clone failed, fetch error or null body\n callback(elapsed(context.startClocks.timeStamp, timeStampNow()));\n }\n else {\n readBytesFromStream(clonedResponse.body, function () {\n callback(elapsed(context.startClocks.timeStamp, timeStampNow()));\n }, {\n bytesLimit: Number.POSITIVE_INFINITY,\n collectStreamBody: false,\n });\n }\n}\n//# sourceMappingURL=requestCollection.js.map","import { isNumber } from '@datadog/browser-core';\nexport function discardNegativeDuration(duration) {\n return isNumber(duration) && duration < 0 ? undefined : duration;\n}\n//# sourceMappingURL=discardNegativeDuration.js.map","import { noop } from '@datadog/browser-core';\nexport function trackEventCounts(_a) {\n var lifeCycle = _a.lifeCycle, isChildEvent = _a.isChildEvent, _b = _a.onChange, callback = _b === void 0 ? noop : _b;\n var eventCounts = {\n errorCount: 0,\n longTaskCount: 0,\n resourceCount: 0,\n actionCount: 0,\n frustrationCount: 0,\n };\n var subscription = lifeCycle.subscribe(12 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, function (event) {\n var _a;\n if (event.type === 'view' || event.type === 'vital' || !isChildEvent(event)) {\n return;\n }\n switch (event.type) {\n case \"error\" /* RumEventType.ERROR */:\n eventCounts.errorCount += 1;\n callback();\n break;\n case \"action\" /* RumEventType.ACTION */:\n eventCounts.actionCount += 1;\n if (event.action.frustration) {\n eventCounts.frustrationCount += event.action.frustration.type.length;\n }\n callback();\n break;\n case \"long_task\" /* RumEventType.LONG_TASK */:\n eventCounts.longTaskCount += 1;\n callback();\n break;\n case \"resource\" /* RumEventType.RESOURCE */:\n if (!((_a = event._dd) === null || _a === void 0 ? void 0 : _a.discarded)) {\n eventCounts.resourceCount += 1;\n callback();\n }\n break;\n }\n });\n return {\n stop: function () {\n subscription.unsubscribe();\n },\n eventCounts: eventCounts,\n };\n}\n//# sourceMappingURL=trackEventCounts.js.map","import { addEventListeners, dateNow, relativeNow } from '@datadog/browser-core';\n/**\n * first-input timing entry polyfill based on\n * https://github.com/GoogleChrome/web-vitals/blob/master/src/lib/polyfills/firstInputPolyfill.ts\n */\nexport function retrieveFirstInputTiming(configuration, callback) {\n var startTimeStamp = dateNow();\n var timingSent = false;\n var removeEventListeners = addEventListeners(configuration, window, [\"click\" /* DOM_EVENT.CLICK */, \"mousedown\" /* DOM_EVENT.MOUSE_DOWN */, \"keydown\" /* DOM_EVENT.KEY_DOWN */, \"touchstart\" /* DOM_EVENT.TOUCH_START */, \"pointerdown\" /* DOM_EVENT.POINTER_DOWN */], function (evt) {\n // Only count cancelable events, which should trigger behavior important to the user.\n if (!evt.cancelable) {\n return;\n }\n // This timing will be used to compute the \"first Input delay\", which is the delta between\n // when the system received the event (e.g. evt.timeStamp) and when it could run the callback\n // (e.g. performance.now()).\n var timing = {\n entryType: 'first-input',\n processingStart: relativeNow(),\n processingEnd: relativeNow(),\n startTime: evt.timeStamp,\n duration: 0, // arbitrary value to avoid nullable duration and simplify INP logic\n name: '',\n cancelable: false,\n target: null,\n toJSON: function () { return ({}); },\n };\n if (evt.type === \"pointerdown\" /* DOM_EVENT.POINTER_DOWN */) {\n sendTimingIfPointerIsNotCancelled(configuration, timing);\n }\n else {\n sendTiming(timing);\n }\n }, { passive: true, capture: true }).stop;\n return { stop: removeEventListeners };\n /**\n * Pointer events are a special case, because they can trigger main or compositor thread behavior.\n * We differentiate these cases based on whether or not we see a pointercancel event, which are\n * fired when we scroll. If we're scrolling we don't need to report input delay since FID excludes\n * scrolling and pinch/zooming.\n */\n function sendTimingIfPointerIsNotCancelled(configuration, timing) {\n addEventListeners(configuration, window, [\"pointerup\" /* DOM_EVENT.POINTER_UP */, \"pointercancel\" /* DOM_EVENT.POINTER_CANCEL */], function (event) {\n if (event.type === \"pointerup\" /* DOM_EVENT.POINTER_UP */) {\n sendTiming(timing);\n }\n }, { once: true });\n }\n function sendTiming(timing) {\n if (!timingSent) {\n timingSent = true;\n removeEventListeners();\n // In some cases the recorded delay is clearly wrong, e.g. it's negative or it's larger than\n // the time between now and when the page was loaded.\n // - https://github.com/GoogleChromeLabs/first-input-delay/issues/4\n // - https://github.com/GoogleChromeLabs/first-input-delay/issues/6\n // - https://github.com/GoogleChromeLabs/first-input-delay/issues/7\n var delay = timing.processingStart - timing.startTime;\n if (delay >= 0 && delay < dateNow() - startTimeStamp) {\n callback(timing);\n }\n }\n }\n}\n//# sourceMappingURL=firstInputPolyfill.js.map","import { addEventListener, Observable, setTimeout, clearTimeout, monitor, includes } from '@datadog/browser-core';\nimport { hasValidResourceEntryDuration, isAllowedRequestUrl } from '../domain/resource/resourceUtils';\nimport { retrieveFirstInputTiming } from './firstInputPolyfill';\n// We want to use a real enum (i.e. not a const enum) here, to be able to check whether an arbitrary\n// string is an expected performance entry\n// eslint-disable-next-line no-restricted-syntax\nexport var RumPerformanceEntryType;\n(function (RumPerformanceEntryType) {\n RumPerformanceEntryType[\"EVENT\"] = \"event\";\n RumPerformanceEntryType[\"FIRST_INPUT\"] = \"first-input\";\n RumPerformanceEntryType[\"LARGEST_CONTENTFUL_PAINT\"] = \"largest-contentful-paint\";\n RumPerformanceEntryType[\"LAYOUT_SHIFT\"] = \"layout-shift\";\n RumPerformanceEntryType[\"LONG_TASK\"] = \"longtask\";\n RumPerformanceEntryType[\"LONG_ANIMATION_FRAME\"] = \"long-animation-frame\";\n RumPerformanceEntryType[\"NAVIGATION\"] = \"navigation\";\n RumPerformanceEntryType[\"PAINT\"] = \"paint\";\n RumPerformanceEntryType[\"RESOURCE\"] = \"resource\";\n})(RumPerformanceEntryType || (RumPerformanceEntryType = {}));\nexport function createPerformanceObservable(configuration, options) {\n return new Observable(function (observable) {\n if (!window.PerformanceObserver) {\n return;\n }\n var handlePerformanceEntries = function (entries) {\n var rumPerformanceEntries = filterRumPerformanceEntries(entries);\n if (rumPerformanceEntries.length > 0) {\n observable.notify(rumPerformanceEntries);\n }\n };\n var timeoutId;\n var isObserverInitializing = true;\n var observer = new PerformanceObserver(monitor(function (entries) {\n // In Safari the performance observer callback is synchronous.\n // Because the buffered performance entry list can be quite large we delay the computation to prevent the SDK from blocking the main thread on init\n if (isObserverInitializing) {\n timeoutId = setTimeout(function () { return handlePerformanceEntries(entries.getEntries()); });\n }\n else {\n handlePerformanceEntries(entries.getEntries());\n }\n }));\n try {\n observer.observe(options);\n }\n catch (_a) {\n // Some old browser versions (<= chrome 74 ) don't support the PerformanceObserver type and buffered options\n // In these cases, fallback to getEntriesByType and PerformanceObserver with entryTypes\n // TODO: remove this fallback in the next major version\n var fallbackSupportedEntryTypes = [\n RumPerformanceEntryType.RESOURCE,\n RumPerformanceEntryType.NAVIGATION,\n RumPerformanceEntryType.LONG_TASK,\n RumPerformanceEntryType.PAINT,\n ];\n if (includes(fallbackSupportedEntryTypes, options.type)) {\n if (options.buffered) {\n timeoutId = setTimeout(function () { return handlePerformanceEntries(performance.getEntriesByType(options.type)); });\n }\n try {\n observer.observe({ entryTypes: [options.type] });\n }\n catch (_b) {\n // Old versions of Safari are throwing \"entryTypes contained only unsupported types\"\n // errors when observing only unsupported entry types.\n //\n // We could use `supportPerformanceTimingEvent` to make sure we don't invoke\n // `observer.observe` with an unsupported entry type, but Safari 11 and 12 don't support\n // `Performance.supportedEntryTypes`, so doing so would lose support for these versions\n // even if they do support the entry type.\n return;\n }\n }\n }\n isObserverInitializing = false;\n manageResourceTimingBufferFull(configuration);\n var stopFirstInputTiming;\n if (!supportPerformanceTimingEvent(RumPerformanceEntryType.FIRST_INPUT) &&\n options.type === RumPerformanceEntryType.FIRST_INPUT) {\n ;\n (stopFirstInputTiming = retrieveFirstInputTiming(configuration, function (timing) {\n handlePerformanceEntries([timing]);\n }).stop);\n }\n return function () {\n observer.disconnect();\n if (stopFirstInputTiming) {\n stopFirstInputTiming();\n }\n clearTimeout(timeoutId);\n };\n });\n}\nvar resourceTimingBufferFullListener;\nfunction manageResourceTimingBufferFull(configuration) {\n if (!resourceTimingBufferFullListener && supportPerformanceObject() && 'addEventListener' in performance) {\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1559377\n resourceTimingBufferFullListener = addEventListener(configuration, performance, 'resourcetimingbufferfull', function () {\n performance.clearResourceTimings();\n });\n }\n return function () {\n resourceTimingBufferFullListener === null || resourceTimingBufferFullListener === void 0 ? void 0 : resourceTimingBufferFullListener.stop();\n };\n}\nfunction supportPerformanceObject() {\n return window.performance !== undefined && 'getEntries' in performance;\n}\nexport function supportPerformanceTimingEvent(entryType) {\n return (window.PerformanceObserver &&\n PerformanceObserver.supportedEntryTypes !== undefined &&\n PerformanceObserver.supportedEntryTypes.includes(entryType));\n}\nfunction filterRumPerformanceEntries(entries) {\n return entries.filter(function (entry) { return !isForbiddenResource(entry); });\n}\nfunction isForbiddenResource(entry) {\n return (entry.entryType === RumPerformanceEntryType.RESOURCE &&\n (!isAllowedRequestUrl(entry.name) || !hasValidResourceEntryDuration(entry)));\n}\n//# sourceMappingURL=performanceObservable.js.map","import { matchList, monitor, Observable, timeStampNow, setTimeout, clearTimeout } from '@datadog/browser-core';\nimport { createPerformanceObservable, RumPerformanceEntryType } from '../browser/performanceObservable';\n// Delay to wait for a page activity to validate the tracking process\nexport var PAGE_ACTIVITY_VALIDATION_DELAY = 100;\n// Delay to wait after a page activity to end the tracking process\nexport var PAGE_ACTIVITY_END_DELAY = 100;\n/**\n * Wait for the page activity end\n *\n * Detection lifecycle:\n * ```\n * Wait page activity end\n * .-------------------'--------------------.\n * v v\n * [Wait for a page activity ] [Wait for a maximum duration]\n * [timeout: VALIDATION_DELAY] [ timeout: maxDuration ]\n * / \\ |\n * v v |\n * [No page activity] [Page activity] |\n * | |,----------------------. |\n * v v | |\n * (Discard) [Wait for a page activity] | |\n * [ timeout: END_DELAY ] | |\n * / \\ | |\n * v v | |\n * [No page activity] [Page activity] | |\n * | | | |\n * | '------------' |\n * '-----------. ,--------------------'\n * v\n * (End)\n * ```\n *\n * Note: by assuming that maxDuration is greater than VALIDATION_DELAY, we are sure that if the\n * process is still alive after maxDuration, it has been validated.\n */\nexport function waitPageActivityEnd(lifeCycle, domMutationObservable, windowOpenObservable, configuration, pageActivityEndCallback, maxDuration) {\n var pageActivityObservable = createPageActivityObservable(lifeCycle, domMutationObservable, windowOpenObservable, configuration);\n return doWaitPageActivityEnd(pageActivityObservable, pageActivityEndCallback, maxDuration);\n}\nexport function doWaitPageActivityEnd(pageActivityObservable, pageActivityEndCallback, maxDuration) {\n var pageActivityEndTimeoutId;\n var hasCompleted = false;\n var validationTimeoutId = setTimeout(monitor(function () { return complete({ hadActivity: false }); }), PAGE_ACTIVITY_VALIDATION_DELAY);\n var maxDurationTimeoutId = maxDuration !== undefined\n ? setTimeout(monitor(function () { return complete({ hadActivity: true, end: timeStampNow() }); }), maxDuration)\n : undefined;\n var pageActivitySubscription = pageActivityObservable.subscribe(function (_a) {\n var isBusy = _a.isBusy;\n clearTimeout(validationTimeoutId);\n clearTimeout(pageActivityEndTimeoutId);\n var lastChangeTime = timeStampNow();\n if (!isBusy) {\n pageActivityEndTimeoutId = setTimeout(monitor(function () { return complete({ hadActivity: true, end: lastChangeTime }); }), PAGE_ACTIVITY_END_DELAY);\n }\n });\n var stop = function () {\n hasCompleted = true;\n clearTimeout(validationTimeoutId);\n clearTimeout(pageActivityEndTimeoutId);\n clearTimeout(maxDurationTimeoutId);\n pageActivitySubscription.unsubscribe();\n };\n function complete(event) {\n if (hasCompleted) {\n return;\n }\n stop();\n pageActivityEndCallback(event);\n }\n return { stop: stop };\n}\nexport function createPageActivityObservable(lifeCycle, domMutationObservable, windowOpenObservable, configuration) {\n return new Observable(function (observable) {\n var subscriptions = [];\n var firstRequestIndex;\n var pendingRequestsCount = 0;\n subscriptions.push(domMutationObservable.subscribe(notifyPageActivity), windowOpenObservable.subscribe(notifyPageActivity), createPerformanceObservable(configuration, { type: RumPerformanceEntryType.RESOURCE }).subscribe(function (entries) {\n if (entries.some(function (entry) { return !isExcludedUrl(configuration, entry.name); })) {\n notifyPageActivity();\n }\n }), lifeCycle.subscribe(6 /* LifeCycleEventType.REQUEST_STARTED */, function (startEvent) {\n if (isExcludedUrl(configuration, startEvent.url)) {\n return;\n }\n if (firstRequestIndex === undefined) {\n firstRequestIndex = startEvent.requestIndex;\n }\n pendingRequestsCount += 1;\n notifyPageActivity();\n }), lifeCycle.subscribe(7 /* LifeCycleEventType.REQUEST_COMPLETED */, function (request) {\n if (isExcludedUrl(configuration, request.url) ||\n firstRequestIndex === undefined ||\n // If the request started before the tracking start, ignore it\n request.requestIndex < firstRequestIndex) {\n return;\n }\n pendingRequestsCount -= 1;\n notifyPageActivity();\n }));\n return function () {\n subscriptions.forEach(function (s) { return s.unsubscribe(); });\n };\n function notifyPageActivity() {\n observable.notify({ isBusy: pendingRequestsCount > 0 });\n }\n });\n}\nfunction isExcludedUrl(configuration, requestUrl) {\n return matchList(configuration.excludedActivityUrls, requestUrl);\n}\n//# sourceMappingURL=waitPageActivityEnd.js.map","// https://github.com/jquery/jquery/blob/a684e6ba836f7c553968d7d026ed7941e1a612d8/src/selector/escapeSelector.js\nexport function cssEscape(str) {\n if (window.CSS && window.CSS.escape) {\n return window.CSS.escape(str);\n }\n // eslint-disable-next-line no-control-regex\n return str.replace(/([\\0-\\x1f\\x7f]|^-?\\d)|^-$|[^\\x80-\\uFFFF\\w-]/g, function (ch, asCodePoint) {\n if (asCodePoint) {\n // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER\n if (ch === '\\0') {\n return '\\uFFFD';\n }\n // Control characters and (dependent upon position) numbers get escaped as code points\n return \"\".concat(ch.slice(0, -1), \"\\\\\").concat(ch.charCodeAt(ch.length - 1).toString(16), \" \");\n }\n // Other potentially-special ASCII characters get backslash-escaped\n return \"\\\\\".concat(ch);\n });\n}\nexport function elementMatches(element, selector) {\n if (element.matches) {\n return element.matches(selector);\n }\n // IE11 support\n if (element.msMatchesSelector) {\n return element.msMatchesSelector(selector);\n }\n return false;\n}\n/**\n * Return the parentElement of an node\n *\n * In cases where parentElement is not supported, such as in IE11 for SVG nodes, we fallback to parentNode\n */\nexport function getParentElement(node) {\n if (node.parentElement) {\n return node.parentElement;\n }\n while (node.parentNode) {\n if (node.parentNode.nodeType === Node.ELEMENT_NODE) {\n return node.parentNode;\n }\n node = node.parentNode;\n }\n return null;\n}\n/**\n * Return the classList of an element or an array of classes if classList is not supported\n *\n * In cases where classList is not supported, such as in IE11 for SVG and MathML elements,\n * we fallback to using element.getAttribute('class').\n * We opt for element.getAttribute('class') over element.className because className returns an SVGAnimatedString for SVG elements.\n */\nexport function getClassList(element) {\n if (element.classList) {\n return element.classList;\n }\n var classes = (element.getAttribute('class') || '').trim();\n return classes ? classes.split(/\\s+/) : [];\n}\n// ie11 supports WeakMap but not WeakSet\nvar PLACEHOLDER = 1;\n// eslint-disable-next-line no-restricted-syntax\nvar WeakSet = /** @class */ (function () {\n function WeakSet(initialValues) {\n var _this = this;\n this.map = new WeakMap();\n if (initialValues) {\n initialValues.forEach(function (value) { return _this.map.set(value, PLACEHOLDER); });\n }\n }\n WeakSet.prototype.add = function (value) {\n this.map.set(value, PLACEHOLDER);\n return this;\n };\n WeakSet.prototype.delete = function (value) {\n return this.map.delete(value);\n };\n WeakSet.prototype.has = function (value) {\n return this.map.has(value);\n };\n return WeakSet;\n}());\nexport { WeakSet };\n//# sourceMappingURL=polyfills.js.map","export function isTextNode(node) {\n return node.nodeType === Node.TEXT_NODE;\n}\nexport function isCommentNode(node) {\n return node.nodeType === Node.COMMENT_NODE;\n}\nexport function isElementNode(node) {\n return node.nodeType === Node.ELEMENT_NODE;\n}\nexport function isNodeShadowHost(node) {\n return isElementNode(node) && Boolean(node.shadowRoot);\n}\nexport function isNodeShadowRoot(node) {\n var shadowRoot = node;\n return !!shadowRoot.host && shadowRoot.nodeType === Node.DOCUMENT_FRAGMENT_NODE && isElementNode(shadowRoot.host);\n}\nexport function hasChildNodes(node) {\n return node.childNodes.length > 0 || isNodeShadowHost(node);\n}\nexport function forEachChildNodes(node, callback) {\n var child = node.firstChild;\n while (child) {\n callback(child);\n child = child.nextSibling;\n }\n if (isNodeShadowHost(node)) {\n callback(node.shadowRoot);\n }\n}\n/**\n * Return `host` in case if the current node is a shadow root otherwise will return the `parentNode`\n */\nexport function getParentNode(node) {\n return isNodeShadowRoot(node) ? node.host : node.parentNode;\n}\n//# sourceMappingURL=htmlDomUtils.js.map","import { DefaultPrivacyLevel } from '@datadog/browser-core';\nimport { isElementNode, getParentNode, isTextNode } from '../browser/htmlDomUtils';\nimport { elementMatches } from '../browser/polyfills';\nexport var NodePrivacyLevel = {\n IGNORE: 'ignore',\n HIDDEN: 'hidden',\n ALLOW: DefaultPrivacyLevel.ALLOW,\n MASK: DefaultPrivacyLevel.MASK,\n MASK_USER_INPUT: DefaultPrivacyLevel.MASK_USER_INPUT,\n};\nexport var PRIVACY_ATTR_NAME = 'data-dd-privacy';\n// Privacy Attrs\nexport var PRIVACY_ATTR_VALUE_ALLOW = 'allow';\nexport var PRIVACY_ATTR_VALUE_MASK = 'mask';\nexport var PRIVACY_ATTR_VALUE_MASK_USER_INPUT = 'mask-user-input';\nexport var PRIVACY_ATTR_VALUE_HIDDEN = 'hidden';\n// Privacy Classes - not all customers can set plain HTML attributes, so support classes too\nexport var PRIVACY_CLASS_PREFIX = 'dd-privacy-';\n// Private Replacement Templates\nexport var CENSORED_STRING_MARK = '***';\nexport var CENSORED_IMG_MARK = 'data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';\nexport var FORM_PRIVATE_TAG_NAMES = {\n INPUT: true,\n OUTPUT: true,\n TEXTAREA: true,\n SELECT: true,\n OPTION: true,\n DATALIST: true,\n OPTGROUP: true,\n};\nvar TEXT_MASKING_CHAR = 'x';\n/**\n * Get node privacy level by iterating over its ancestors. When the direct parent privacy level is\n * know, it is best to use something like:\n *\n * derivePrivacyLevelGivenParent(getNodeSelfPrivacyLevel(node), parentNodePrivacyLevel)\n */\nexport function getNodePrivacyLevel(node, defaultPrivacyLevel, cache) {\n if (cache && cache.has(node)) {\n return cache.get(node);\n }\n var parentNode = getParentNode(node);\n var parentNodePrivacyLevel = parentNode\n ? getNodePrivacyLevel(parentNode, defaultPrivacyLevel, cache)\n : defaultPrivacyLevel;\n var selfNodePrivacyLevel = getNodeSelfPrivacyLevel(node);\n var nodePrivacyLevel = reducePrivacyLevel(selfNodePrivacyLevel, parentNodePrivacyLevel);\n if (cache) {\n cache.set(node, nodePrivacyLevel);\n }\n return nodePrivacyLevel;\n}\n/**\n * Reduces the next privacy level based on self + parent privacy levels\n */\nexport function reducePrivacyLevel(childPrivacyLevel, parentNodePrivacyLevel) {\n switch (parentNodePrivacyLevel) {\n // These values cannot be overridden\n case NodePrivacyLevel.HIDDEN:\n case NodePrivacyLevel.IGNORE:\n return parentNodePrivacyLevel;\n }\n switch (childPrivacyLevel) {\n case NodePrivacyLevel.ALLOW:\n case NodePrivacyLevel.MASK:\n case NodePrivacyLevel.MASK_USER_INPUT:\n case NodePrivacyLevel.HIDDEN:\n case NodePrivacyLevel.IGNORE:\n return childPrivacyLevel;\n default:\n return parentNodePrivacyLevel;\n }\n}\n/**\n * Determines the node's own privacy level without checking for ancestors.\n */\nexport function getNodeSelfPrivacyLevel(node) {\n // Only Element types can have a privacy level set\n if (!isElementNode(node)) {\n return;\n }\n // Overrules for replay purpose\n if (node.tagName === 'BASE') {\n return NodePrivacyLevel.ALLOW;\n }\n // Overrules to enforce end-user protection\n if (node.tagName === 'INPUT') {\n var inputElement = node;\n if (inputElement.type === 'password' || inputElement.type === 'email' || inputElement.type === 'tel') {\n return NodePrivacyLevel.MASK;\n }\n if (inputElement.type === 'hidden') {\n return NodePrivacyLevel.MASK;\n }\n var autocomplete = inputElement.getAttribute('autocomplete');\n // Handle input[autocomplete=cc-number/cc-csc/cc-exp/cc-exp-month/cc-exp-year/new-password/current-password]\n if (autocomplete && (autocomplete.startsWith('cc-') || autocomplete.endsWith('-password'))) {\n return NodePrivacyLevel.MASK;\n }\n }\n // Check HTML privacy attributes and classes\n if (elementMatches(node, getPrivacySelector(NodePrivacyLevel.HIDDEN))) {\n return NodePrivacyLevel.HIDDEN;\n }\n if (elementMatches(node, getPrivacySelector(NodePrivacyLevel.MASK))) {\n return NodePrivacyLevel.MASK;\n }\n if (elementMatches(node, getPrivacySelector(NodePrivacyLevel.MASK_USER_INPUT))) {\n return NodePrivacyLevel.MASK_USER_INPUT;\n }\n if (elementMatches(node, getPrivacySelector(NodePrivacyLevel.ALLOW))) {\n return NodePrivacyLevel.ALLOW;\n }\n if (shouldIgnoreElement(node)) {\n return NodePrivacyLevel.IGNORE;\n }\n}\n/**\n * Helper aiming to unify `mask` and `mask-user-input` privacy levels:\n *\n * In the `mask` case, it is trivial: we should mask the element.\n *\n * In the `mask-user-input` case, we should mask the element only if it is a \"form\" element or the\n * direct parent is a form element for text nodes).\n *\n * Other `shouldMaskNode` cases are edge cases that should not matter too much (ex: should we mask a\n * node if it is ignored or hidden? it doesn't matter since it won't be serialized).\n */\nexport function shouldMaskNode(node, privacyLevel) {\n switch (privacyLevel) {\n case NodePrivacyLevel.MASK:\n case NodePrivacyLevel.HIDDEN:\n case NodePrivacyLevel.IGNORE:\n return true;\n case NodePrivacyLevel.MASK_USER_INPUT:\n return isTextNode(node) ? isFormElement(node.parentNode) : isFormElement(node);\n default:\n return false;\n }\n}\nfunction isFormElement(node) {\n if (!node || node.nodeType !== node.ELEMENT_NODE) {\n return false;\n }\n var element = node;\n if (element.tagName === 'INPUT') {\n switch (element.type) {\n case 'button':\n case 'color':\n case 'reset':\n case 'submit':\n return false;\n }\n }\n return !!FORM_PRIVATE_TAG_NAMES[element.tagName];\n}\n/**\n * Text censoring non-destructively maintains whitespace characters in order to preserve text shape\n * during replay.\n */\nexport var censorText = function (text) { return text.replace(/\\S/g, TEXT_MASKING_CHAR); };\nexport function getTextContent(textNode, ignoreWhiteSpace, parentNodePrivacyLevel) {\n var _a;\n // The parent node may not be a html element which has a tagName attribute.\n // So just let it be undefined which is ok in this use case.\n var parentTagName = (_a = textNode.parentElement) === null || _a === void 0 ? void 0 : _a.tagName;\n var textContent = textNode.textContent || '';\n if (ignoreWhiteSpace && !textContent.trim()) {\n return;\n }\n var nodePrivacyLevel = parentNodePrivacyLevel;\n var isScript = parentTagName === 'SCRIPT';\n if (isScript) {\n // For perf reasons, we don't record script (heuristic)\n textContent = CENSORED_STRING_MARK;\n }\n else if (nodePrivacyLevel === NodePrivacyLevel.HIDDEN) {\n // Should never occur, but just in case, we set to CENSORED_MARK.\n textContent = CENSORED_STRING_MARK;\n }\n else if (shouldMaskNode(textNode, nodePrivacyLevel)) {\n if (\n // Scrambling the child list breaks text nodes for DATALIST/SELECT/OPTGROUP\n parentTagName === 'DATALIST' ||\n parentTagName === 'SELECT' ||\n parentTagName === 'OPTGROUP') {\n if (!textContent.trim()) {\n return;\n }\n }\n else if (parentTagName === 'OPTION') {\n //