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A0BikB,EAAoBjkB,yBAC9CJ,UAAWA,EACXQ,UAAWA,EACXE,aAAcA,EACdD,QAASA,EACTJ,mBAAoB+4B,EAAgBr3B,IAE5C,C","sources":["file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/tracing/tracer.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/configuration.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/contexts/commonContext.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/boot/rumPublicApi.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/browser/domMutationObservable.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/rumEventsCollection/resource/resourceUtils.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/browser/htmlDomUtils.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/tracing/getDocumentTraceId.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/browser/performanceCollection.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/browser/viewportObservable.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/contexts/displayContext.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/assembly.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/contexts/syntheticsContext.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/contexts/ciTestContext.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/contexts/foregroundContexts.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/lifeCycle.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/contexts/viewContexts.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/requestCollection.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/trackEventCounts.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/waitPageActivityEnd.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/rumEventsCollection/action/clickChain.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/rumEventsCollection/action/getActionNameFromElement.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/rumEventsCollection/action/getSelectorFromElement.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/rumEventsCollection/action/listenActionEvents.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/rumEventsCollection/action/computeFrustration.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/rumEventsCollection/action/trackClickActions.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/rumEventsCollection/action/actionCollection.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/rumEventsCollection/view/trackFirstHidden.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/rumEventsCollection/error/errorCollection.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/rumEventsCollection/error/trackConsoleError.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/rumEventsCollection/error/trackReportError.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/rumEventsCollection/resource/matchRequestTiming.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/rumEventsCollection/resource/resourceCollection.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/rumEventsCollection/view/trackInitialViewTimings.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/rumEventsCollection/view/trackViewMetrics.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/rumEventsCollection/view/trackViewEventCounts.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/rumEventsCollection/view/trackViews.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/rumEventsCollection/view/viewCollection.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/rumSessionManager.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/transport/startRumBatch.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/contexts/urlContexts.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/browser/locationChangeObservable.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/contexts/featureFlagContext.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/startCustomerDataTelemetry.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/contexts/pageStateHistory.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/boot/startRum.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/transport/startRumEventBridge.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/rumEventsCollection/longTask/longTaskCollection.js","file:////home/runner/work/platform/platform/common/temp/node_modules/.pnpm/@datadog+browser-rum-core@4.34.3/node_modules/@datadog/browser-rum-core/esm/domain/contexts/internalContext.js"],"sourcesContent":["import { objectEntries, shallowClone, performDraw, isNumber, assign, find, getType, isMatchOption, matchList, } from '@datadog/browser-core';\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 context.traceId = new TraceIdentifier();\n context.spanId = new TraceIdentifier();\n context.traceSampled = !isNumber(configuration.traceSampleRate) || performDraw(configuration.traceSampleRate);\n inject(makeTracingHeaders(context.traceId, context.spanId, context.traceSampled, tracingOption.propagatorTypes));\n}\nexport function isTracingSupported() {\n return getCrypto() !== undefined;\n}\nfunction getCrypto() {\n return window.crypto || window.msCrypto;\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.toDecimalString(),\n 'x-datadog-sampling-priority': traceSampled ? '1' : '0',\n 'x-datadog-trace-id': traceId.toDecimalString(),\n });\n break;\n }\n // https://www.w3.org/TR/trace-context/\n case 'tracecontext': {\n assign(tracingHeaders, {\n traceparent: \"00-0000000000000000\".concat(traceId.toPaddedHexadecimalString(), \"-\").concat(spanId.toPaddedHexadecimalString(), \"-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(traceId.toPaddedHexadecimalString(), \"-\").concat(spanId.toPaddedHexadecimalString(), \"-\").concat(traceSampled ? '1' : '0'),\n });\n break;\n }\n case 'b3multi': {\n assign(tracingHeaders, {\n 'X-B3-TraceId': traceId.toPaddedHexadecimalString(),\n 'X-B3-SpanId': spanId.toPaddedHexadecimalString(),\n 'X-B3-Sampled': traceSampled ? '1' : '0',\n });\n break;\n }\n }\n });\n return tracingHeaders;\n}\n/* eslint-disable no-bitwise */\nvar TraceIdentifier = /** @class */ (function () {\n function TraceIdentifier() {\n this.buffer = new Uint8Array(8);\n getCrypto().getRandomValues(this.buffer);\n this.buffer[0] = this.buffer[0] & 0x7f; // force 63-bit\n }\n TraceIdentifier.prototype.toString = function (radix) {\n var high = this.readInt32(0);\n var low = this.readInt32(4);\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 * Format used everywhere except the trace intake\n */\n TraceIdentifier.prototype.toDecimalString = function () {\n return this.toString(10);\n };\n /**\n * Format used by OTel headers\n */\n TraceIdentifier.prototype.toPaddedHexadecimalString = function () {\n var traceId = this.toString(16);\n return Array(17 - traceId.length).join('0') + traceId;\n };\n TraceIdentifier.prototype.readInt32 = function (offset) {\n return (this.buffer[offset] * 16777216 +\n (this.buffer[offset + 1] << 16) +\n (this.buffer[offset + 2] << 8) +\n this.buffer[offset + 3]);\n };\n return TraceIdentifier;\n}());\nexport { TraceIdentifier };\n/* eslint-enable no-bitwise */\n//# sourceMappingURL=tracer.js.map","import { arrayFrom, getOrigin, isMatchOption, serializeConfiguration, assign, DefaultPrivacyLevel, display, isPercentage, objectHasValue, validateAndBuildConfiguration, } from '@datadog/browser-core';\nimport { isTracingOption } from './tracing/tracer';\nexport function validateAndBuildRumConfiguration(initConfiguration) {\n var _a, _b, _c, _d, _e, _f;\n if (!initConfiguration.applicationId) {\n display.error('Application ID is not configured, no RUM data will be collected.');\n return;\n }\n if (initConfiguration.sessionReplaySampleRate !== undefined &&\n !isPercentage(initConfiguration.sessionReplaySampleRate)) {\n display.error('Session Replay Sample Rate should be a number between 0 and 100');\n return;\n }\n // TODO remove fallback in next major\n var premiumSampleRate = (_a = initConfiguration.premiumSampleRate) !== null && _a !== void 0 ? _a : initConfiguration.replaySampleRate;\n if (premiumSampleRate !== undefined && initConfiguration.sessionReplaySampleRate !== undefined) {\n display.warn('Ignoring Premium Sample Rate because Session Replay Sample Rate is set');\n premiumSampleRate = undefined;\n }\n if (premiumSampleRate !== undefined && !isPercentage(premiumSampleRate)) {\n display.error('Premium Sample Rate should be a number between 0 and 100');\n return;\n }\n var traceSampleRate = (_b = initConfiguration.traceSampleRate) !== null && _b !== void 0 ? _b : initConfiguration.tracingSampleRate;\n if (traceSampleRate !== undefined && !isPercentage(traceSampleRate)) {\n display.error('Trace Sample Rate should be a number between 0 and 100');\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 trackUserInteractions = !!((_c = initConfiguration.trackUserInteractions) !== null && _c !== void 0 ? _c : initConfiguration.trackInteractions);\n var trackFrustrations = !!initConfiguration.trackFrustrations;\n return assign({\n applicationId: initConfiguration.applicationId,\n version: initConfiguration.version,\n actionNameAttribute: initConfiguration.actionNameAttribute,\n sessionReplaySampleRate: (_e = (_d = initConfiguration.sessionReplaySampleRate) !== null && _d !== void 0 ? _d : premiumSampleRate) !== null && _e !== void 0 ? _e : 100,\n oldPlansBehavior: initConfiguration.sessionReplaySampleRate === undefined,\n traceSampleRate: traceSampleRate,\n allowedTracingUrls: allowedTracingUrls,\n excludedActivityUrls: (_f = initConfiguration.excludedActivityUrls) !== null && _f !== void 0 ? _f : [],\n trackUserInteractions: trackUserInteractions || trackFrustrations,\n trackFrustrations: trackFrustrations,\n trackViewsManually: !!initConfiguration.trackViewsManually,\n trackResources: initConfiguration.trackResources,\n trackLongTasks: initConfiguration.trackLongTasks,\n defaultPrivacyLevel: objectHasValue(DefaultPrivacyLevel, initConfiguration.defaultPrivacyLevel)\n ? initConfiguration.defaultPrivacyLevel\n : DefaultPrivacyLevel.MASK_USER_INPUT,\n customerDataTelemetrySampleRate: 1,\n }, baseConfiguration);\n}\n/**\n * Handles allowedTracingUrls and processes legacy allowedTracingOrigins\n */\nfunction validateAndBuildTracingOptions(initConfiguration) {\n // Advise about parameters precedence.\n if (initConfiguration.allowedTracingUrls !== undefined && initConfiguration.allowedTracingOrigins !== undefined) {\n display.warn('Both allowedTracingUrls and allowedTracingOrigins (deprecated) have been defined. The parameter allowedTracingUrls will override allowedTracingOrigins.');\n }\n // Handle allowedTracingUrls first\n if (initConfiguration.allowedTracingUrls !== undefined) {\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_1 = [];\n initConfiguration.allowedTracingUrls.forEach(function (option) {\n if (isMatchOption(option)) {\n tracingOptions_1.push({ match: option, propagatorTypes: ['datadog'] });\n }\n else if (isTracingOption(option)) {\n tracingOptions_1.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_1;\n }\n // Handle conversion of allowedTracingOrigins to allowedTracingUrls\n if (initConfiguration.allowedTracingOrigins !== undefined) {\n if (!Array.isArray(initConfiguration.allowedTracingOrigins)) {\n display.error('Allowed Tracing Origins should be an array');\n return;\n }\n if (initConfiguration.allowedTracingOrigins.length !== 0 && initConfiguration.service === undefined) {\n display.error('Service needs to be configured when tracing is enabled');\n return;\n }\n var tracingOptions_2 = [];\n initConfiguration.allowedTracingOrigins.forEach(function (legacyMatchOption) {\n var tracingOption = convertLegacyMatchOptionToTracingOption(legacyMatchOption);\n if (tracingOption) {\n tracingOptions_2.push(tracingOption);\n }\n });\n return tracingOptions_2;\n }\n return [];\n}\n/**\n * Converts parameters from the deprecated allowedTracingOrigins\n * to allowedTracingUrls. Handles the change from origin to full URLs.\n */\nfunction convertLegacyMatchOptionToTracingOption(item) {\n var match;\n if (typeof item === 'string') {\n match = item;\n }\n else if (item instanceof RegExp) {\n match = function (url) { return item.test(getOrigin(url)); };\n }\n else if (typeof item === 'function') {\n match = function (url) { return item(getOrigin(url)); };\n }\n if (match === undefined) {\n display.warn('Allowed Tracing Origins parameters should be a string, RegExp or function. Ignoring parameter', item);\n return undefined;\n }\n return { match: match, propagatorTypes: ['datadog'] };\n}\n/**\n * Combines the selected tracing propagators from the different options in allowedTracingUrls,\n * and assumes 'datadog' has been selected when using allowedTracingOrigins\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 usedTracingPropagators.add('datadog');\n }\n else {\n option.propagatorTypes.forEach(function (propagatorType) { return usedTracingPropagators.add(propagatorType); });\n }\n });\n }\n if (Array.isArray(configuration.allowedTracingOrigins) && configuration.allowedTracingOrigins.length > 0) {\n usedTracingPropagators.add('datadog');\n }\n return arrayFrom(usedTracingPropagators);\n}\nexport function serializeRumConfiguration(configuration) {\n var _a, _b;\n var baseSerializedConfiguration = serializeConfiguration(configuration);\n return assign({\n premium_sample_rate: configuration.premiumSampleRate,\n replay_sample_rate: configuration.replaySampleRate,\n session_replay_sample_rate: configuration.sessionReplaySampleRate,\n trace_sample_rate: (_a = configuration.traceSampleRate) !== null && _a !== void 0 ? _a : configuration.tracingSampleRate,\n action_name_attribute: configuration.actionNameAttribute,\n use_allowed_tracing_origins: Array.isArray(configuration.allowedTracingOrigins) && configuration.allowedTracingOrigins.length > 0,\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 use_excluded_activity_urls: Array.isArray(configuration.allowedTracingOrigins) && configuration.allowedTracingOrigins.length > 0,\n track_frustrations: configuration.trackFrustrations,\n track_views_manually: configuration.trackViewsManually,\n track_user_interactions: (_b = configuration.trackUserInteractions) !== null && _b !== void 0 ? _b : configuration.trackInteractions,\n }, baseSerializedConfiguration);\n}\n//# sourceMappingURL=configuration.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 { isExperimentalFeatureEnabled, willSyntheticsInjectRum, assign, BoundedBuffer, buildCookieOptions, createContextManager, deepClone, makePublicApi, monitor, clocksNow, timeStampNow, display, callMonitored, createHandlingStack, canUseEventBridge, areCookiesAuthorized, checkUser, sanitizeUser, } from '@datadog/browser-core';\nimport { validateAndBuildRumConfiguration } from '../domain/configuration';\nimport { buildCommonContext } from '../domain/contexts/commonContext';\nexport function makeRumPublicApi(startRumImpl, recorderApi, _a) {\n var _b = _a === void 0 ? {} : _a, _c = _b.ignoreInitIfSyntheticsWillInjectRum, ignoreInitIfSyntheticsWillInjectRum = _c === void 0 ? true : _c;\n var isAlreadyInitialized = false;\n var globalContextManager = createContextManager();\n var userContextManager = createContextManager();\n var getInternalContextStrategy = function () { return undefined; };\n var getInitConfigurationStrategy = function () { return undefined; };\n var bufferApiCalls = new BoundedBuffer();\n var addTimingStrategy = function (name, time) {\n if (time === void 0) { time = timeStampNow(); }\n bufferApiCalls.add(function () { return addTimingStrategy(name, time); });\n };\n var startViewStrategy = function (options, startClocks) {\n if (startClocks === void 0) { startClocks = clocksNow(); }\n bufferApiCalls.add(function () { return startViewStrategy(options, startClocks); });\n };\n var addActionStrategy = function (action, commonContext) {\n if (commonContext === void 0) { commonContext = buildCommonContext(globalContextManager, userContextManager, recorderApi); }\n bufferApiCalls.add(function () { return addActionStrategy(action, commonContext); });\n };\n var addErrorStrategy = function (providedError, commonContext) {\n if (commonContext === void 0) { commonContext = buildCommonContext(globalContextManager, userContextManager, recorderApi); }\n bufferApiCalls.add(function () { return addErrorStrategy(providedError, commonContext); });\n };\n var addFeatureFlagEvaluationStrategy = function (key, value) {\n bufferApiCalls.add(function () { return addFeatureFlagEvaluationStrategy(key, value); });\n };\n function initRum(initConfiguration) {\n // This function should be available, regardless of initialization success.\n getInitConfigurationStrategy = function () { return deepClone(initConfiguration); };\n // If we are in a Synthetics test configured to automatically inject a RUM instance, we want to\n // completely discard the customer application RUM instance by ignoring their init() call. But,\n // 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 if (canUseEventBridge()) {\n initConfiguration = overrideInitConfigurationForBridge(initConfiguration);\n }\n else if (!canHandleSession(initConfiguration)) {\n return;\n }\n if (!canInitRum(initConfiguration)) {\n return;\n }\n var configuration = validateAndBuildRumConfiguration(initConfiguration);\n if (!configuration) {\n return;\n }\n if (isExperimentalFeatureEnabled('feature_flags')) {\n ;\n rumPublicApi.addFeatureFlagEvaluation = monitor(function (key, value) {\n addFeatureFlagEvaluationStrategy(key, value);\n });\n }\n if (!configuration.trackViewsManually) {\n doStartRum(initConfiguration, configuration);\n }\n else {\n // drain beforeInitCalls by buffering them until we start RUM\n // if we get a startView, drain re-buffered calls before continuing to drain beforeInitCalls\n // in order to ensure that calls are processed in order\n var beforeInitCalls = bufferApiCalls;\n bufferApiCalls = new BoundedBuffer();\n startViewStrategy = function (options) {\n doStartRum(initConfiguration, configuration, options);\n };\n beforeInitCalls.drain();\n }\n isAlreadyInitialized = true;\n }\n function doStartRum(initConfiguration, configuration, initialViewOptions) {\n var startRumResults = startRumImpl(initConfiguration, configuration, recorderApi, globalContextManager, userContextManager, initialViewOptions);\n (startViewStrategy = startRumResults.startView, addActionStrategy = startRumResults.addAction, addErrorStrategy = startRumResults.addError, addTimingStrategy = startRumResults.addTiming, addFeatureFlagEvaluationStrategy = startRumResults.addFeatureFlagEvaluation, getInternalContextStrategy = startRumResults.getInternalContext);\n bufferApiCalls.drain();\n recorderApi.onRumStart(startRumResults.lifeCycle, configuration, startRumResults.session, startRumResults.viewContexts);\n }\n var startView = monitor(function (options) {\n var sanitizedOptions = typeof options === 'object' ? options : { name: options };\n startViewStrategy(sanitizedOptions);\n });\n var rumPublicApi = makePublicApi({\n init: monitor(initRum),\n /** @deprecated: use setGlobalContextProperty instead */\n addRumGlobalContext: monitor(globalContextManager.add),\n setGlobalContextProperty: monitor(globalContextManager.setContextProperty),\n /** @deprecated: use removeGlobalContextProperty instead */\n removeRumGlobalContext: monitor(globalContextManager.remove),\n removeGlobalContextProperty: monitor(globalContextManager.removeContextProperty),\n /** @deprecated: use getGlobalContext instead */\n getRumGlobalContext: monitor(globalContextManager.get),\n getGlobalContext: monitor(globalContextManager.getContext),\n /** @deprecated: use setGlobalContext instead */\n setRumGlobalContext: monitor(globalContextManager.set),\n setGlobalContext: monitor(globalContextManager.setContext),\n clearGlobalContext: monitor(globalContextManager.clearContext),\n getInternalContext: monitor(function (startTime) { return getInternalContextStrategy(startTime); }),\n getInitConfiguration: monitor(function () { return getInitConfigurationStrategy(); }),\n addAction: monitor(function (name, context) {\n addActionStrategy({\n name: name,\n context: deepClone(context),\n startClocks: clocksNow(),\n type: \"custom\" /* CUSTOM */,\n });\n }),\n addError: function (error, context) {\n var handlingStack = createHandlingStack();\n callMonitored(function () {\n addErrorStrategy({\n error: error,\n handlingStack: handlingStack,\n context: deepClone(context),\n startClocks: clocksNow(),\n });\n });\n },\n addTiming: monitor(function (name, time) {\n addTimingStrategy(name, time);\n }),\n setUser: monitor(function (newUser) {\n if (checkUser(newUser)) {\n userContextManager.setContext(sanitizeUser(newUser));\n }\n }),\n getUser: monitor(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 }),\n removeUserProperty: monitor(userContextManager.removeContextProperty),\n /** @deprecated: renamed to clearUser */\n removeUser: monitor(userContextManager.clearContext),\n clearUser: monitor(userContextManager.clearContext),\n startView: startView,\n startSessionReplayRecording: monitor(recorderApi.start),\n stopSessionReplayRecording: monitor(recorderApi.stop),\n });\n return rumPublicApi;\n function canHandleSession(initConfiguration) {\n if (!areCookiesAuthorized(buildCookieOptions(initConfiguration))) {\n display.warn('Cookies are not authorized, we will not send any data.');\n return false;\n }\n if (isLocalFile()) {\n display.error('Execution is not allowed in the current context.');\n return false;\n }\n return true;\n }\n function canInitRum(initConfiguration) {\n if (isAlreadyInitialized) {\n if (!initConfiguration.silentMultipleInit) {\n display.error('DD_RUM is already initialized.');\n }\n return false;\n }\n return true;\n }\n function overrideInitConfigurationForBridge(initConfiguration) {\n return assign({}, initConfiguration, {\n applicationId: '00000000-aaaa-0000-aaaa-000000000000',\n clientToken: 'empty',\n sessionSampleRate: 100,\n });\n }\n function isLocalFile() {\n return window.location.protocol === 'file:';\n }\n}\n//# sourceMappingURL=rumPublicApi.js.map","import { monitor, noop, Observable, getZoneJsOriginalValue } from '@datadog/browser-core';\nexport function createDOMMutationObservable() {\n var MutationObserver = getMutationObserverConstructor();\n var observable = new Observable(function () {\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 return observable;\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 { assign, addTelemetryDebug, elapsed, getPathName, includes, isValidUrl, toServerDuration, } from '@datadog/browser-core';\nexport var FAKE_INITIAL_DOCUMENT = 'initial_document';\nvar RESOURCE_TYPES = [\n [\"document\" /* DOCUMENT */, function (initiatorType) { return FAKE_INITIAL_DOCUMENT === initiatorType; }],\n [\"xhr\" /* XHR */, function (initiatorType) { return 'xmlhttprequest' === initiatorType; }],\n [\"fetch\" /* FETCH */, function (initiatorType) { return 'fetch' === initiatorType; }],\n [\"beacon\" /* BEACON */, function (initiatorType) { return 'beacon' === initiatorType; }],\n [\"css\" /* CSS */, function (_, path) { return /\\.css$/i.test(path); }],\n [\"js\" /* JS */, function (_, path) { return /\\.js$/i.test(path); }],\n [\n \"image\" /* 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\" /* FONT */, function (_, path) { return /\\.(woff|eot|woff2|ttf)$/i.exec(path) !== null; }],\n [\n \"media\" /* MEDIA */,\n function (initiatorType, path) {\n return includes(['audio', 'video'], initiatorType) || /\\.(mp3|mp4)$/i.exec(path) !== null;\n },\n ],\n];\nexport function computeResourceKind(timing) {\n var url = timing.name;\n if (!isValidUrl(url)) {\n addTelemetryDebug(\"Failed to construct URL for \\\"\".concat(timing.name, \"\\\"\"));\n return \"other\" /* 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(timing.initiatorType, path)) {\n return type;\n }\n }\n return \"other\" /* 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 isRequestKind(timing) {\n return timing.initiatorType === 'xmlhttprequest' || timing.initiatorType === 'fetch';\n}\nexport function computePerformanceResourceDuration(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 computePerformanceResourceDetails(entry) {\n var validEntry = toValidEntry(entry);\n if (!validEntry) {\n return undefined;\n }\n var startTime = validEntry.startTime, fetchStart = validEntry.fetchStart, redirectStart = validEntry.redirectStart, redirectEnd = validEntry.redirectEnd, domainLookupStart = validEntry.domainLookupStart, domainLookupEnd = validEntry.domainLookupEnd, connectStart = validEntry.connectStart, secureConnectionStart = validEntry.secureConnectionStart, connectEnd = validEntry.connectEnd, requestStart = validEntry.requestStart, responseStart = validEntry.responseStart, responseEnd = validEntry.responseEnd;\n var details = {\n download: formatTiming(startTime, responseStart, responseEnd),\n first_byte: formatTiming(startTime, requestStart, responseStart),\n };\n // Make sure a connection occurred\n if (connectEnd !== fetchStart) {\n details.connect = formatTiming(startTime, connectStart, connectEnd);\n // Make sure a secure connection occurred\n if (areInOrder(connectStart, secureConnectionStart, connectEnd)) {\n details.ssl = formatTiming(startTime, secureConnectionStart, connectEnd);\n }\n }\n // Make sure a domain lookup occurred\n if (domainLookupEnd !== fetchStart) {\n details.dns = formatTiming(startTime, domainLookupStart, domainLookupEnd);\n }\n if (hasRedirection(entry)) {\n details.redirect = formatTiming(startTime, redirectStart, redirectEnd);\n }\n return details;\n}\nexport function toValidEntry(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 if (!areInOrder(entry.startTime, entry.fetchStart, entry.domainLookupStart, entry.domainLookupEnd, entry.connectStart, entry.connectEnd, entry.requestStart, entry.responseStart, entry.responseEnd)) {\n return undefined;\n }\n if (!hasRedirection(entry)) {\n return entry;\n }\n var redirectStart = entry.redirectStart, redirectEnd = entry.redirectEnd;\n // Firefox doesn't provide redirect timings on cross origin requests.\n // Provide a default for those.\n if (redirectStart < entry.startTime) {\n redirectStart = entry.startTime;\n }\n if (redirectEnd < entry.startTime) {\n redirectEnd = entry.fetchStart;\n }\n // Make sure redirect timings are in order\n if (!areInOrder(entry.startTime, redirectStart, redirectEnd, entry.fetchStart)) {\n return undefined;\n }\n return assign({}, entry, {\n redirectEnd: redirectEnd,\n redirectStart: redirectStart,\n });\n}\nfunction hasRedirection(entry) {\n // The only time fetchStart is different than startTime is if a redirection occurred.\n return entry.fetchStart !== entry.startTime;\n}\nfunction formatTiming(origin, start, end) {\n return {\n duration: toServerDuration(elapsed(start, end)),\n start: toServerDuration(elapsed(origin, start)),\n };\n}\nexport function computeSize(entry) {\n // Make sure a request actually occurred\n if (entry.startTime < entry.responseStart) {\n return entry.decodedBodySize;\n }\n return undefined;\n}\nexport function isAllowedRequestUrl(configuration, url) {\n return url && !configuration.isIntakeUrl(url);\n}\n//# sourceMappingURL=resourceUtils.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 getChildNodes(node) {\n return isNodeShadowHost(node) ? node.shadowRoot.childNodes : node.childNodes;\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 { dateNow, findCommaSeparatedValue, ONE_MINUTE } from '@datadog/browser-core';\nimport { isCommentNode, isTextNode } from '../../browser/htmlDomUtils';\nexport var INITIAL_DOCUMENT_OUTDATED_TRACE_ID_THRESHOLD = 2 * ONE_MINUTE;\nexport function getDocumentTraceId(document) {\n var data = getDocumentTraceDataFromMeta(document) || getDocumentTraceDataFromComment(document);\n if (!data || data.traceTime <= dateNow() - INITIAL_DOCUMENT_OUTDATED_TRACE_ID_THRESHOLD) {\n return undefined;\n }\n return data.traceId;\n}\nexport function getDocumentTraceDataFromMeta(document) {\n var traceIdMeta = document.querySelector('meta[name=dd-trace-id]');\n var traceTimeMeta = document.querySelector('meta[name=dd-trace-time]');\n return createDocumentTraceData(traceIdMeta && traceIdMeta.content, traceTimeMeta && traceTimeMeta.content);\n}\nexport function getDocumentTraceDataFromComment(document) {\n var comment = findTraceComment(document);\n if (!comment) {\n return undefined;\n }\n return createDocumentTraceData(findCommaSeparatedValue(comment, 'trace-id'), findCommaSeparatedValue(comment, 'trace-time'));\n}\nexport function createDocumentTraceData(traceId, rawTraceTime) {\n var traceTime = rawTraceTime && Number(rawTraceTime);\n if (!traceId || !traceTime) {\n return undefined;\n }\n return {\n traceId: traceId,\n traceTime: traceTime,\n };\n}\nexport function findTraceComment(document) {\n // 1. Try to find the comment as a direct child of the document\n // Note: TSLint advises to use a 'for of', but TS doesn't allow to use 'for of' if the iterated\n // value is not an array or string (here, a NodeList).\n for (var i = 0; i < document.childNodes.length; i += 1) {\n var comment = getTraceCommentFromNode(document.childNodes[i]);\n if (comment) {\n return comment;\n }\n }\n // 2. If the comment is placed after the tag, but have some space or new lines before or\n // after, the DOM parser will lift it (and the surrounding text) at the end of the tag.\n // Try to look for the comment at the end of the by by iterating over its child nodes in\n // reverse order, stopping if we come across a non-text node.\n if (document.body) {\n for (var i = document.body.childNodes.length - 1; i >= 0; i -= 1) {\n var node = document.body.childNodes[i];\n var comment = getTraceCommentFromNode(node);\n if (comment) {\n return comment;\n }\n if (!isTextNode(node)) {\n break;\n }\n }\n }\n}\nfunction getTraceCommentFromNode(node) {\n if (node && isCommentNode(node)) {\n var match = /^\\s*DATADOG;(.*?)\\s*$/.exec(node.data);\n if (match) {\n return match[1];\n }\n }\n}\n//# sourceMappingURL=getDocumentTraceId.js.map","import { dateNow, assign, addEventListeners, getRelativeTime, isNumber, monitor, setTimeout, relativeNow, runOnReadyState, } from '@datadog/browser-core';\nimport { FAKE_INITIAL_DOCUMENT, isAllowedRequestUrl } from '../domain/rumEventsCollection/resource/resourceUtils';\nimport { getDocumentTraceId } from '../domain/tracing/getDocumentTraceId';\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}\nexport function startPerformanceCollection(lifeCycle, configuration) {\n retrieveInitialDocumentResourceTiming(function (timing) {\n handleRumPerformanceEntries(lifeCycle, configuration, [timing]);\n });\n if (supportPerformanceObject()) {\n var performanceEntries_1 = performance.getEntries();\n // Because the performance entry list can be quite large\n // delay the computation to prevent the SDK from blocking the main thread on init\n setTimeout(function () { return handleRumPerformanceEntries(lifeCycle, configuration, performanceEntries_1); });\n }\n if (window.PerformanceObserver) {\n var handlePerformanceEntryList_1 = monitor(function (entries) {\n return handleRumPerformanceEntries(lifeCycle, configuration, entries.getEntries());\n });\n var mainEntries = ['resource', 'navigation', 'longtask', 'paint'];\n var experimentalEntries = ['largest-contentful-paint', 'first-input', 'layout-shift'];\n try {\n // Experimental entries are not retrieved by performance.getEntries()\n // use a single PerformanceObserver with buffered flag by type\n // to get values that could happen before SDK init\n experimentalEntries.forEach(function (type) {\n var observer = new PerformanceObserver(handlePerformanceEntryList_1);\n observer.observe({ type: type, buffered: true });\n });\n }\n catch (e) {\n // Some old browser versions (ex: chrome 67) don't support the PerformanceObserver type and buffered options\n // In these cases, fallback to PerformanceObserver with entryTypes\n mainEntries.push.apply(mainEntries, experimentalEntries);\n }\n var mainObserver = new PerformanceObserver(handlePerformanceEntryList_1);\n mainObserver.observe({ entryTypes: mainEntries });\n if (supportPerformanceObject() && 'addEventListener' in performance) {\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1559377\n performance.addEventListener('resourcetimingbufferfull', function () {\n performance.clearResourceTimings();\n });\n }\n }\n if (!supportPerformanceTimingEvent('navigation')) {\n retrieveNavigationTiming(function (timing) {\n handleRumPerformanceEntries(lifeCycle, configuration, [timing]);\n });\n }\n if (!supportPerformanceTimingEvent('first-input')) {\n retrieveFirstInputTiming(function (timing) {\n handleRumPerformanceEntries(lifeCycle, configuration, [timing]);\n });\n }\n}\nexport function retrieveInitialDocumentResourceTiming(callback) {\n runOnReadyState('interactive', function () {\n var timing;\n var forcedAttributes = {\n entryType: 'resource',\n initiatorType: FAKE_INITIAL_DOCUMENT,\n traceId: getDocumentTraceId(document),\n };\n if (supportPerformanceTimingEvent('navigation') && performance.getEntriesByType('navigation').length > 0) {\n var navigationEntry = performance.getEntriesByType('navigation')[0];\n timing = assign(navigationEntry.toJSON(), forcedAttributes);\n }\n else {\n var relativePerformanceTiming = computeRelativePerformanceTiming();\n timing = assign(relativePerformanceTiming, {\n decodedBodySize: 0,\n duration: relativePerformanceTiming.responseEnd,\n name: window.location.href,\n startTime: 0,\n }, forcedAttributes);\n }\n callback(timing);\n });\n}\nfunction retrieveNavigationTiming(callback) {\n function sendFakeTiming() {\n callback(assign(computeRelativePerformanceTiming(), {\n entryType: 'navigation',\n }));\n }\n runOnReadyState('complete', function () {\n // Send it a bit after the actual load event, so the \"loadEventEnd\" timing is accurate\n setTimeout(sendFakeTiming);\n });\n}\n/**\n * first-input timing entry polyfill based on\n * https://github.com/GoogleChrome/web-vitals/blob/master/src/lib/polyfills/firstInputPolyfill.ts\n */\nfunction retrieveFirstInputTiming(callback) {\n var startTimeStamp = dateNow();\n var timingSent = false;\n var removeEventListeners = addEventListeners(window, [\"click\" /* CLICK */, \"mousedown\" /* MOUSE_DOWN */, \"keydown\" /* KEY_DOWN */, \"touchstart\" /* TOUCH_START */, \"pointerdown\" /* 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 startTime: evt.timeStamp,\n };\n if (evt.type === \"pointerdown\" /* POINTER_DOWN */) {\n sendTimingIfPointerIsNotCancelled(timing);\n }\n else {\n sendTiming(timing);\n }\n }, { passive: true, capture: true }).stop;\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(timing) {\n addEventListeners(window, [\"pointerup\" /* POINTER_UP */, \"pointercancel\" /* POINTER_CANCEL */], function (event) {\n if (event.type === \"pointerup\" /* 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}\nfunction computeRelativePerformanceTiming() {\n var result = {};\n var timing = performance.timing;\n for (var key in timing) {\n if (isNumber(timing[key])) {\n var numberKey = key;\n var timingElement = timing[numberKey];\n result[numberKey] = timingElement === 0 ? 0 : getRelativeTime(timingElement);\n }\n }\n return result;\n}\nfunction handleRumPerformanceEntries(lifeCycle, configuration, entries) {\n var rumPerformanceEntries = entries.filter(function (entry) {\n return entry.entryType === 'resource' ||\n entry.entryType === 'navigation' ||\n entry.entryType === 'paint' ||\n entry.entryType === 'longtask' ||\n entry.entryType === 'largest-contentful-paint' ||\n entry.entryType === 'first-input' ||\n entry.entryType === 'layout-shift';\n });\n var rumAllowedPerformanceEntries = rumPerformanceEntries.filter(function (entry) { return !isIncompleteNavigation(entry) && !isForbiddenResource(configuration, entry); });\n if (rumAllowedPerformanceEntries.length) {\n lifeCycle.notify(0 /* PERFORMANCE_ENTRIES_COLLECTED */, rumAllowedPerformanceEntries);\n }\n}\nfunction isIncompleteNavigation(entry) {\n return entry.entryType === 'navigation' && entry.loadEventEnd <= 0;\n}\nfunction isForbiddenResource(configuration, entry) {\n return entry.entryType === 'resource' && !isAllowedRequestUrl(configuration, entry.name);\n}\n//# sourceMappingURL=performanceCollection.js.map","import { Observable, throttle, addEventListener } from '@datadog/browser-core';\nvar viewportObservable;\nexport function initViewportObservable() {\n if (!viewportObservable) {\n viewportObservable = createViewportObservable();\n }\n return viewportObservable;\n}\nexport function createViewportObservable() {\n var observable = new Observable(function () {\n var updateDimension = throttle(function () {\n observable.notify(getViewportDimension());\n }, 200).throttled;\n return addEventListener(window, \"resize\" /* RESIZE */, updateDimension, { capture: true, passive: true }).stop;\n });\n return observable;\n}\n// excludes the width and height of any rendered classic scrollbar that is fixed to the visual viewport\nexport function getViewportDimension() {\n var visual = window.visualViewport;\n if (visual) {\n return {\n width: Number(visual.width * visual.scale),\n height: Number(visual.height * visual.scale),\n };\n }\n return {\n width: Number(window.innerWidth || 0),\n height: Number(window.innerHeight || 0),\n };\n}\n//# sourceMappingURL=viewportObservable.js.map","import { isExperimentalFeatureEnabled } from '@datadog/browser-core';\nimport { getViewportDimension, initViewportObservable } from '../../browser/viewportObservable';\nvar viewport;\nvar stopListeners;\nexport function getDisplayContext() {\n if (!isExperimentalFeatureEnabled('clickmap')) {\n return;\n }\n if (!viewport) {\n viewport = getViewportDimension();\n stopListeners = initViewportObservable().subscribe(function (viewportDimension) {\n viewport = viewportDimension;\n }).unsubscribe;\n }\n return {\n viewport: viewport,\n };\n}\nexport function resetDisplayContext() {\n if (stopListeners) {\n stopListeners();\n }\n viewport = undefined;\n}\n//# sourceMappingURL=displayContext.js.map","import { combine, isEmptyObject, limitModification, timeStampNow, currentDrift, display, createEventRateLimiter, canUseEventBridge, } from '@datadog/browser-core';\nimport { getSyntheticsContext } from './contexts/syntheticsContext';\nimport { getCiTestContext } from './contexts/ciTestContext';\nimport { getDisplayContext } from './contexts/displayContext';\nvar VIEW_EVENTS_MODIFIABLE_FIELD_PATHS = [\n // Fields with sensitive data\n 'view.url',\n 'view.referrer',\n 'action.target.name',\n 'error.message',\n 'error.stack',\n 'error.resource.url',\n 'resource.url',\n];\nvar OTHER_EVENTS_MODIFIABLE_FIELD_PATHS = VIEW_EVENTS_MODIFIABLE_FIELD_PATHS.concat([\n // User-customizable field\n 'context',\n]);\nexport function startRumAssembly(configuration, lifeCycle, sessionManager, viewContexts, urlContexts, actionContexts, buildCommonContext, reportError) {\n var _a;\n var eventRateLimiters = (_a = {},\n _a[\"error\" /* ERROR */] = createEventRateLimiter(\"error\" /* ERROR */, configuration.eventRateLimiterThreshold, reportError),\n _a[\"action\" /* ACTION */] = createEventRateLimiter(\"action\" /* ACTION */, configuration.eventRateLimiterThreshold, reportError),\n _a);\n var syntheticsContext = getSyntheticsContext();\n var ciTestContext = getCiTestContext();\n lifeCycle.subscribe(10 /* 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 viewContext = viewContexts.findView(startTime);\n var urlContext = urlContexts.findUrl(startTime);\n // allow to send events if the session was tracked when they start\n // except for views which are continuously updated\n // TODO: stop sending view updates when session is expired\n var session = sessionManager.findTrackedSession(rawRumEvent.type !== \"view\" /* VIEW */ ? startTime : undefined);\n if (session && viewContext && urlContext) {\n var commonContext = savedCommonContext || buildCommonContext();\n var actionId = actionContexts.findActionId(startTime);\n var rumContext = {\n _dd: {\n format_version: 2,\n drift: currentDrift(),\n session: {\n plan: session.plan,\n },\n browser_sdk_version: canUseEventBridge() ? \"4.34.3\" : undefined,\n },\n application: {\n id: configuration.applicationId,\n },\n date: timeStampNow(),\n service: viewContext.service || configuration.service,\n version: viewContext.version || configuration.version,\n source: 'browser',\n session: {\n id: session.id,\n type: syntheticsContext ? \"synthetics\" /* SYNTHETICS */ : ciTestContext ? \"ci_test\" /* CI_TEST */ : \"user\" /* USER */,\n },\n view: {\n id: viewContext.id,\n name: viewContext.name,\n url: urlContext.url,\n referrer: urlContext.referrer,\n },\n action: needToAssembleWithAction(rawRumEvent) && actionId ? { id: actionId } : undefined,\n synthetics: syntheticsContext,\n ci_test: ciTestContext,\n display: getDisplayContext(),\n };\n var serverRumEvent = combine(rumContext, rawRumEvent);\n serverRumEvent.context = combine(commonContext.context, customerContext);\n if (!('has_replay' in serverRumEvent.session)) {\n ;\n serverRumEvent.session.has_replay = commonContext.hasReplay;\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(11 /* 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, event.type === \"view\" /* VIEW */ ? VIEW_EVENTS_MODIFIABLE_FIELD_PATHS : OTHER_EVENTS_MODIFIABLE_FIELD_PATHS, function (event) { return beforeSend(event, domainContext); });\n if (result === false && event.type !== \"view\" /* 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\" /* ERROR */, \"resource\" /* RESOURCE */, \"long_task\" /* LONG_TASK */].indexOf(event.type) !== -1;\n}\n//# sourceMappingURL=assembly.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","export function getCiTestContext() {\n var _a;\n var testExecutionId = (_a = window.Cypress) === null || _a === void 0 ? void 0 : _a.env('traceId');\n if (typeof testExecutionId === 'string') {\n return {\n test_execution_id: testExecutionId,\n };\n }\n}\n//# sourceMappingURL=ciTestContext.js.map","import { addDuration, addEventListener, elapsed, relativeNow, toServerDuration } from '@datadog/browser-core';\n// Arbitrary value to cap number of element mostly for backend & to save bandwidth\nexport var MAX_NUMBER_OF_SELECTABLE_FOREGROUND_PERIODS = 500;\n// Arbitrary value to cap number of element mostly for memory consumption in the browser\nexport var MAX_NUMBER_OF_STORED_FOREGROUND_PERIODS = 2500;\nvar foregroundPeriods = [];\nexport function startForegroundContexts() {\n if (document.hasFocus()) {\n addNewForegroundPeriod();\n }\n var stopForegroundTracking = trackFocus(addNewForegroundPeriod).stop;\n var stopBlurTracking = trackBlur(closeForegroundPeriod).stop;\n return {\n isInForegroundAt: isInForegroundAt,\n selectInForegroundPeriodsFor: selectInForegroundPeriodsFor,\n stop: function () {\n foregroundPeriods = [];\n stopForegroundTracking();\n stopBlurTracking();\n },\n };\n}\nexport function addNewForegroundPeriod() {\n if (foregroundPeriods.length > MAX_NUMBER_OF_STORED_FOREGROUND_PERIODS) {\n return;\n }\n var currentForegroundPeriod = foregroundPeriods[foregroundPeriods.length - 1];\n var now = relativeNow();\n if (currentForegroundPeriod !== undefined && currentForegroundPeriod.end === undefined) {\n return;\n }\n foregroundPeriods.push({\n start: now,\n });\n}\nexport function closeForegroundPeriod() {\n if (foregroundPeriods.length === 0) {\n return;\n }\n var currentForegroundPeriod = foregroundPeriods[foregroundPeriods.length - 1];\n var now = relativeNow();\n if (currentForegroundPeriod.end !== undefined) {\n return;\n }\n currentForegroundPeriod.end = now;\n}\nfunction trackFocus(onFocusChange) {\n return addEventListener(window, \"focus\" /* FOCUS */, function (event) {\n if (!event.isTrusted) {\n return;\n }\n onFocusChange();\n });\n}\nfunction trackBlur(onBlurChange) {\n return addEventListener(window, \"blur\" /* BLUR */, function (event) {\n if (!event.isTrusted) {\n return;\n }\n onBlurChange();\n });\n}\nfunction isInForegroundAt(startTime) {\n for (var i = foregroundPeriods.length - 1; i >= 0; i--) {\n var foregroundPeriod = foregroundPeriods[i];\n if (foregroundPeriod.end !== undefined && startTime > foregroundPeriod.end) {\n break;\n }\n if (startTime > foregroundPeriod.start &&\n (foregroundPeriod.end === undefined || startTime < foregroundPeriod.end)) {\n return true;\n }\n }\n return false;\n}\nfunction selectInForegroundPeriodsFor(eventStartTime, duration) {\n var eventEndTime = addDuration(eventStartTime, duration);\n var filteredForegroundPeriods = [];\n var earliestIndex = Math.max(0, foregroundPeriods.length - MAX_NUMBER_OF_SELECTABLE_FOREGROUND_PERIODS);\n for (var i = foregroundPeriods.length - 1; i >= earliestIndex; i--) {\n var foregroundPeriod = foregroundPeriods[i];\n if (foregroundPeriod.end !== undefined && eventStartTime > foregroundPeriod.end) {\n // event starts after the end of the current focus period\n // since the array is sorted, we can stop looking for foreground periods\n break;\n }\n if (eventEndTime < foregroundPeriod.start) {\n // event ends before the start of the current focus period\n // continue to previous one\n continue;\n }\n var startTime = eventStartTime > foregroundPeriod.start ? eventStartTime : foregroundPeriod.start;\n var startDuration = elapsed(eventStartTime, startTime);\n var endTime = foregroundPeriod.end === undefined || eventEndTime < foregroundPeriod.end ? eventEndTime : foregroundPeriod.end;\n var endDuration = elapsed(startTime, endTime);\n filteredForegroundPeriods.unshift({\n start: toServerDuration(startDuration),\n duration: toServerDuration(endDuration),\n });\n }\n return filteredForegroundPeriods;\n}\n//# sourceMappingURL=foregroundContexts.js.map","var LifeCycle = /** @class */ (function () {\n function LifeCycle() {\n this.callbacks = {};\n }\n LifeCycle.prototype.notify = function (eventType, data) {\n var eventCallbacks = this.callbacks[eventType];\n if (eventCallbacks) {\n eventCallbacks.forEach(function (callback) { return callback(data); });\n }\n };\n LifeCycle.prototype.subscribe = function (eventType, callback) {\n var _this = this;\n if (!this.callbacks[eventType]) {\n this.callbacks[eventType] = [];\n }\n this.callbacks[eventType].push(callback);\n return {\n unsubscribe: function () {\n _this.callbacks[eventType] = _this.callbacks[eventType].filter(function (other) { return callback !== other; });\n },\n };\n };\n return LifeCycle;\n}());\nexport { LifeCycle };\n//# sourceMappingURL=lifeCycle.js.map","import { SESSION_TIME_OUT_DELAY, ContextHistory } from '@datadog/browser-core';\nexport var VIEW_CONTEXT_TIME_OUT_DELAY = SESSION_TIME_OUT_DELAY;\nexport function startViewContexts(lifeCycle) {\n var viewContextHistory = new ContextHistory(VIEW_CONTEXT_TIME_OUT_DELAY);\n lifeCycle.subscribe(2 /* VIEW_CREATED */, function (view) {\n viewContextHistory.add(buildViewContext(view), view.startClocks.relative);\n });\n lifeCycle.subscribe(4 /* VIEW_ENDED */, function (_a) {\n var endClocks = _a.endClocks;\n viewContextHistory.closeActive(endClocks.relative);\n });\n lifeCycle.subscribe(8 /* SESSION_RENEWED */, function () {\n viewContextHistory.reset();\n });\n function buildViewContext(view) {\n return {\n service: view.service,\n version: view.version,\n id: view.id,\n name: view.name,\n };\n }\n return {\n findView: function (startTime) { return viewContextHistory.find(startTime); },\n stop: function () {\n viewContextHistory.stop();\n },\n };\n}\n//# sourceMappingURL=viewContexts.js.map","import { initFetchObservable, initXhrObservable, readBytesFromStream, elapsed, timeStampNow, tryToClone, } from '@datadog/browser-core';\nimport { isAllowedRequestUrl } from './rumEventsCollection/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, configuration, tracer);\n}\nexport function trackXhr(lifeCycle, configuration, tracer) {\n var subscription = initXhrObservable().subscribe(function (rawContext) {\n var context = rawContext;\n if (!isAllowedRequestUrl(configuration, 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(5 /* REQUEST_STARTED */, {\n requestIndex: context.requestIndex,\n url: context.url,\n });\n break;\n case 'complete':\n tracer.clearTracingIfNeeded(context);\n lifeCycle.notify(6 /* 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\" /* XHR */,\n url: context.url,\n xhr: context.xhr,\n });\n break;\n }\n });\n return { stop: function () { return subscription.unsubscribe(); } };\n}\nexport function trackFetch(lifeCycle, configuration, tracer) {\n var subscription = initFetchObservable().subscribe(function (rawContext) {\n var context = rawContext;\n if (!isAllowedRequestUrl(configuration, context.url)) {\n return;\n }\n switch (context.state) {\n case 'start':\n tracer.traceFetch(context);\n context.requestIndex = getNextRequestIndex();\n lifeCycle.notify(5 /* 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(6 /* 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\" /* FETCH */,\n url: context.url,\n response: context.response,\n init: context.init,\n input: context.input,\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 { 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(11 /* RUM_EVENT_COLLECTED */, function (event) {\n if (event.type === 'view' || !isChildEvent(event)) {\n return;\n }\n switch (event.type) {\n case \"error\" /* ERROR */:\n eventCounts.errorCount += 1;\n callback();\n break;\n case \"action\" /* 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\" /* LONG_TASK */:\n eventCounts.longTaskCount += 1;\n callback();\n break;\n case \"resource\" /* RESOURCE */:\n eventCounts.resourceCount += 1;\n callback();\n break;\n }\n });\n return {\n stop: function () {\n subscription.unsubscribe();\n },\n eventCounts: eventCounts,\n };\n}\n//# sourceMappingURL=trackEventCounts.js.map","import { instrumentMethodAndCallOriginal, matchList, monitor, Observable, timeStampNow, setTimeout, clearTimeout, } from '@datadog/browser-core';\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, configuration, pageActivityEndCallback, maxDuration) {\n var pageActivityObservable = createPageActivityObservable(lifeCycle, domMutationObservable, 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 &&\n setTimeout(monitor(function () { return complete({ hadActivity: true, end: timeStampNow() }); }), maxDuration);\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, configuration) {\n var observable = new Observable(function () {\n var subscriptions = [];\n var firstRequestIndex;\n var pendingRequestsCount = 0;\n subscriptions.push(domMutationObservable.subscribe(notifyPageActivity), lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {\n if (entries.some(function (entry) { return entry.entryType === 'resource' && !isExcludedUrl(configuration, entry.name); })) {\n notifyPageActivity();\n }\n }), lifeCycle.subscribe(5 /* 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(6 /* 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 var stopTrackingWindowOpen = trackWindowOpen(notifyPageActivity).stop;\n return function () {\n stopTrackingWindowOpen();\n subscriptions.forEach(function (s) { return s.unsubscribe(); });\n };\n function notifyPageActivity() {\n observable.notify({ isBusy: pendingRequestsCount > 0 });\n }\n });\n return observable;\n}\nfunction isExcludedUrl(configuration, requestUrl) {\n return matchList(configuration.excludedActivityUrls, requestUrl);\n}\nfunction trackWindowOpen(callback) {\n return instrumentMethodAndCallOriginal(window, 'open', { before: callback });\n}\n//# sourceMappingURL=waitPageActivityEnd.js.map","import { ONE_SECOND, clearTimeout, setTimeout } from '@datadog/browser-core';\nexport var MAX_DURATION_BETWEEN_CLICKS = ONE_SECOND;\nexport var MAX_DISTANCE_BETWEEN_CLICKS = 100;\nexport function createClickChain(firstClick, onFinalize) {\n var bufferedClicks = [];\n var status = 0 /* WaitingForMoreClicks */;\n var maxDurationBetweenClicksTimeout;\n appendClick(firstClick);\n function appendClick(click) {\n click.stopObservable.subscribe(tryFinalize);\n bufferedClicks.push(click);\n clearTimeout(maxDurationBetweenClicksTimeout);\n maxDurationBetweenClicksTimeout = setTimeout(dontAcceptMoreClick, MAX_DURATION_BETWEEN_CLICKS);\n }\n function tryFinalize() {\n if (status === 1 /* WaitingForClicksToStop */ && bufferedClicks.every(function (click) { return click.isStopped(); })) {\n status = 2 /* Finalized */;\n onFinalize(bufferedClicks);\n }\n }\n function dontAcceptMoreClick() {\n clearTimeout(maxDurationBetweenClicksTimeout);\n if (status === 0 /* WaitingForMoreClicks */) {\n status = 1 /* WaitingForClicksToStop */;\n tryFinalize();\n }\n }\n return {\n tryAppend: function (click) {\n if (status !== 0 /* WaitingForMoreClicks */) {\n return false;\n }\n if (bufferedClicks.length > 0 &&\n !areEventsSimilar(bufferedClicks[bufferedClicks.length - 1].event, click.event)) {\n dontAcceptMoreClick();\n return false;\n }\n appendClick(click);\n return true;\n },\n stop: function () {\n dontAcceptMoreClick();\n },\n };\n}\n/**\n * Checks whether two events are similar by comparing their target, position and timestamp\n */\nfunction areEventsSimilar(first, second) {\n return (first.target === second.target &&\n mouseEventDistance(first, second) <= MAX_DISTANCE_BETWEEN_CLICKS &&\n first.timeStamp - second.timeStamp <= MAX_DURATION_BETWEEN_CLICKS);\n}\nfunction mouseEventDistance(origin, other) {\n return Math.sqrt(Math.pow(origin.clientX - other.clientX, 2) + Math.pow(origin.clientY - other.clientY, 2));\n}\n//# sourceMappingURL=clickChain.js.map","import { safeTruncate, isIE, find } from '@datadog/browser-core';\n/**\n * Get the action name from the attribute 'data-dd-action-name' on the element or any of its parent.\n * It can also be retrieved from a user defined attribute.\n */\nexport var DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE = 'data-dd-action-name';\nexport function getActionNameFromElement(element, userProgrammaticAttribute) {\n // Proceed to get the action name in two steps:\n // * first, get the name programmatically, explicitly defined by the user.\n // * then, use strategies that are known to return good results. Those strategies will be used on\n // the element and a few parents, but it's likely that they won't succeed at all.\n // * if no name is found this way, use strategies returning less accurate names as a fallback.\n // Those are much likely to succeed.\n return (getActionNameFromElementProgrammatically(element, DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE) ||\n (userProgrammaticAttribute && getActionNameFromElementProgrammatically(element, userProgrammaticAttribute)) ||\n getActionNameFromElementForStrategies(element, userProgrammaticAttribute, priorityStrategies) ||\n getActionNameFromElementForStrategies(element, userProgrammaticAttribute, fallbackStrategies) ||\n '');\n}\nfunction getActionNameFromElementProgrammatically(targetElement, programmaticAttribute) {\n var elementWithAttribute;\n // We don't use getActionNameFromElementForStrategies here, because we want to consider all parents,\n // without limit. It is up to the user to declare a relevant naming strategy.\n // If available, use element.closest() to match get the attribute from the element or any of its\n // parent. Else fallback to a more traditional implementation.\n if (supportsElementClosest()) {\n elementWithAttribute = targetElement.closest(\"[\".concat(programmaticAttribute, \"]\"));\n }\n else {\n var element = targetElement;\n while (element) {\n if (element.hasAttribute(programmaticAttribute)) {\n elementWithAttribute = element;\n break;\n }\n element = element.parentElement;\n }\n }\n if (!elementWithAttribute) {\n return;\n }\n var name = elementWithAttribute.getAttribute(programmaticAttribute);\n return truncate(normalizeWhitespace(name.trim()));\n}\nvar priorityStrategies = [\n // associated LABEL text\n function (element, userProgrammaticAttribute) {\n // IE does not support element.labels, so we fallback to a CSS selector based on the element id\n // instead\n if (supportsLabelProperty()) {\n if ('labels' in element && element.labels && element.labels.length > 0) {\n return getTextualContent(element.labels[0], userProgrammaticAttribute);\n }\n }\n else if (element.id) {\n var label = element.ownerDocument &&\n find(element.ownerDocument.querySelectorAll('label'), function (label) { return label.htmlFor === element.id; });\n return label && getTextualContent(label, userProgrammaticAttribute);\n }\n },\n // INPUT button (and associated) value\n function (element) {\n if (element.nodeName === 'INPUT') {\n var input = element;\n var type = input.getAttribute('type');\n if (type === 'button' || type === 'submit' || type === 'reset') {\n return input.value;\n }\n }\n },\n // BUTTON, LABEL or button-like element text\n function (element, userProgrammaticAttribute) {\n if (element.nodeName === 'BUTTON' || element.nodeName === 'LABEL' || element.getAttribute('role') === 'button') {\n return getTextualContent(element, userProgrammaticAttribute);\n }\n },\n function (element) { return element.getAttribute('aria-label'); },\n // associated element text designated by the aria-labelledby attribute\n function (element, userProgrammaticAttribute) {\n var labelledByAttribute = element.getAttribute('aria-labelledby');\n if (labelledByAttribute) {\n return labelledByAttribute\n .split(/\\s+/)\n .map(function (id) { return getElementById(element, id); })\n .filter(function (label) { return Boolean(label); })\n .map(function (element) { return getTextualContent(element, userProgrammaticAttribute); })\n .join(' ');\n }\n },\n function (element) { return element.getAttribute('alt'); },\n function (element) { return element.getAttribute('name'); },\n function (element) { return element.getAttribute('title'); },\n function (element) { return element.getAttribute('placeholder'); },\n // SELECT first OPTION text\n function (element, userProgrammaticAttribute) {\n if ('options' in element && element.options.length > 0) {\n return getTextualContent(element.options[0], userProgrammaticAttribute);\n }\n },\n];\nvar fallbackStrategies = [\n function (element, userProgrammaticAttribute) { return getTextualContent(element, userProgrammaticAttribute); },\n];\n/**\n * Iterates over the target element and its parent, using the strategies list to get an action name.\n * Each strategies are applied on each element, stopping as soon as a non-empty value is returned.\n */\nvar MAX_PARENTS_TO_CONSIDER = 10;\nfunction getActionNameFromElementForStrategies(targetElement, userProgrammaticAttribute, strategies) {\n var element = targetElement;\n var recursionCounter = 0;\n while (recursionCounter <= MAX_PARENTS_TO_CONSIDER &&\n element &&\n element.nodeName !== 'BODY' &&\n element.nodeName !== 'HTML' &&\n element.nodeName !== 'HEAD') {\n for (var _i = 0, strategies_1 = strategies; _i < strategies_1.length; _i++) {\n var strategy = strategies_1[_i];\n var name_1 = strategy(element, userProgrammaticAttribute);\n if (typeof name_1 === 'string') {\n var trimmedName = name_1.trim();\n if (trimmedName) {\n return truncate(normalizeWhitespace(trimmedName));\n }\n }\n }\n // Consider a FORM as a contextual limit to get the action name. This is experimental and may\n // be reconsidered in the future.\n if (element.nodeName === 'FORM') {\n break;\n }\n element = element.parentElement;\n recursionCounter += 1;\n }\n}\nfunction normalizeWhitespace(s) {\n return s.replace(/\\s+/g, ' ');\n}\nfunction truncate(s) {\n return s.length > 100 ? \"\".concat(safeTruncate(s, 100), \" [...]\") : s;\n}\nfunction getElementById(refElement, id) {\n // Use the element ownerDocument here, because tests are executed in an iframe, so\n // document.getElementById won't work.\n return refElement.ownerDocument ? refElement.ownerDocument.getElementById(id) : null;\n}\nfunction getTextualContent(element, userProgrammaticAttribute) {\n if (element.isContentEditable) {\n return;\n }\n if ('innerText' in element) {\n var text_1 = element.innerText;\n var removeTextFromElements = function (query) {\n var list = element.querySelectorAll(query);\n for (var index = 0; index < list.length; index += 1) {\n var element_1 = list[index];\n if ('innerText' in element_1) {\n var textToReplace = element_1.innerText;\n if (textToReplace && textToReplace.trim().length > 0) {\n text_1 = text_1.replace(textToReplace, '');\n }\n }\n }\n };\n if (!supportsInnerTextScriptAndStyleRemoval()) {\n // remove the inner text of SCRIPT and STYLES from the result. This is a bit dirty, but should\n // be relatively fast and work in most cases.\n removeTextFromElements('script, style');\n }\n // remove the text of elements with programmatic attribute value\n removeTextFromElements(\"[\".concat(DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE, \"]\"));\n if (userProgrammaticAttribute) {\n removeTextFromElements(\"[\".concat(userProgrammaticAttribute, \"]\"));\n }\n return text_1;\n }\n return element.textContent;\n}\n/**\n * Returns true if element.innerText excludes the text from inline SCRIPT and STYLE element. This\n * should be the case everywhere except on Internet Explorer 10 and 11 (see [1])\n *\n * The innerText property relies on what is actually rendered to compute its output, so to check if\n * it actually excludes SCRIPT and STYLE content, a solution would be to create a style element, set\n * its content to '*', inject it in the document body, and check if the style element innerText\n * property returns '*'. Using a new `document` instance won't work as it is not rendered.\n *\n * This solution requires specific CSP rules (see [2]) to be set by the customer. We want to avoid\n * this, so instead we rely on browser detection. In case of false negative, the impact should be\n * low, since we rely on this result to remove the SCRIPT and STYLE innerText (which will be empty)\n * from a parent element innerText.\n *\n * [1]: https://web.archive.org/web/20210602165716/http://perfectionkills.com/the-poor-misunderstood-innerText/#diff-with-textContent\n * [2]: https://github.com/DataDog/browser-sdk/issues/1084\n */\nfunction supportsInnerTextScriptAndStyleRemoval() {\n return !isIE();\n}\n/**\n * Returns true if the browser supports the element.labels property. This should be the case\n * everywhere except on Internet Explorer.\n * Note: The result is computed lazily, because we don't want any DOM access when the SDK is\n * evaluated.\n */\nvar supportsLabelPropertyResult;\nfunction supportsLabelProperty() {\n if (supportsLabelPropertyResult === undefined) {\n supportsLabelPropertyResult = 'labels' in HTMLInputElement.prototype;\n }\n return supportsLabelPropertyResult;\n}\n/**\n * Returns true if the browser supports the element.closest method. This should be the case\n * everywhere except on Internet Explorer.\n * Note: The result is computed lazily, because we don't want any DOM access when the SDK is\n * evaluated.\n */\nvar supportsElementClosestResult;\nfunction supportsElementClosest() {\n if (supportsElementClosestResult === undefined) {\n supportsElementClosestResult = 'closest' in HTMLElement.prototype;\n }\n return supportsElementClosestResult;\n}\n//# sourceMappingURL=getActionNameFromElement.js.map","import { cssEscape } from '@datadog/browser-core';\nimport { DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE } from './getActionNameFromElement';\n/**\n * Stable attributes are attributes that are commonly used to identify parts of a UI (ex:\n * component). Those attribute values should not be generated randomly (hardcoded most of the time)\n * and stay the same across deploys. They are not necessarily unique across the document.\n */\nexport var STABLE_ATTRIBUTES = [\n DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE,\n // Common test attributes (list provided by google recorder)\n 'data-testid',\n 'data-test',\n 'data-qa',\n 'data-cy',\n 'data-test-id',\n 'data-qa-id',\n 'data-testing',\n // FullStory decorator attributes:\n 'data-component',\n 'data-element',\n 'data-source-file',\n];\n// Selectors to use if they target a single element on the whole document. Those selectors are\n// considered as \"stable\" and uniquely identify an element regardless of the page state. If we find\n// one, we should consider the selector \"complete\" and stop iterating over ancestors.\nvar GLOBALLY_UNIQUE_SELECTOR_GETTERS = [getStableAttributeSelector, getIDSelector];\n// Selectors to use if they target a single element among an element descendants. Those selectors\n// are more brittle than \"globally unique\" selectors and should be combined with ancestor selectors\n// to improve specificity.\nvar UNIQUE_AMONG_CHILDREN_SELECTOR_GETTERS = [\n getStableAttributeSelector,\n getClassSelector,\n getTagNameSelector,\n];\nexport function getSelectorFromElement(targetElement, actionNameAttribute) {\n var targetElementSelector = '';\n var element = targetElement;\n while (element && element.nodeName !== 'HTML') {\n var globallyUniqueSelector = findSelector(element, GLOBALLY_UNIQUE_SELECTOR_GETTERS, isSelectorUniqueGlobally, actionNameAttribute, targetElementSelector);\n if (globallyUniqueSelector) {\n return globallyUniqueSelector;\n }\n var uniqueSelectorAmongChildren = findSelector(element, UNIQUE_AMONG_CHILDREN_SELECTOR_GETTERS, isSelectorUniqueAmongSiblings, actionNameAttribute, targetElementSelector);\n targetElementSelector =\n uniqueSelectorAmongChildren || combineSelector(getPositionSelector(element), targetElementSelector);\n element = element.parentElement;\n }\n return targetElementSelector;\n}\nfunction isGeneratedValue(value) {\n // To compute the \"URL path group\", the backend replaces every URL path parts as a question mark\n // if it thinks the part is an identifier. The condition it uses is to checks whether a digit is\n // present.\n //\n // Here, we use the same strategy: if a the value contains a digit, we consider it generated. This\n // strategy might be a bit naive and fail in some cases, but there are many fallbacks to generate\n // CSS selectors so it should be fine most of the time. We might want to allow customers to\n // provide their own `isGeneratedValue` at some point.\n return /[0-9]/.test(value);\n}\nfunction getIDSelector(element) {\n if (element.id && !isGeneratedValue(element.id)) {\n return \"#\".concat(cssEscape(element.id));\n }\n}\nfunction getClassSelector(element) {\n if (element.tagName === 'BODY') {\n return;\n }\n if (element.classList.length > 0) {\n for (var i = 0; i < element.classList.length; i += 1) {\n var className = element.classList[i];\n if (isGeneratedValue(className)) {\n continue;\n }\n return \"\".concat(element.tagName, \".\").concat(cssEscape(className));\n }\n }\n}\nfunction getTagNameSelector(element) {\n return element.tagName;\n}\nfunction getStableAttributeSelector(element, actionNameAttribute) {\n if (actionNameAttribute) {\n var selector = getAttributeSelector(actionNameAttribute);\n if (selector) {\n return selector;\n }\n }\n for (var _i = 0, STABLE_ATTRIBUTES_1 = STABLE_ATTRIBUTES; _i < STABLE_ATTRIBUTES_1.length; _i++) {\n var attributeName = STABLE_ATTRIBUTES_1[_i];\n var selector = getAttributeSelector(attributeName);\n if (selector) {\n return selector;\n }\n }\n function getAttributeSelector(attributeName) {\n if (element.hasAttribute(attributeName)) {\n return \"\".concat(element.tagName, \"[\").concat(attributeName, \"=\\\"\").concat(cssEscape(element.getAttribute(attributeName)), \"\\\"]\");\n }\n }\n}\nfunction getPositionSelector(element) {\n var sibling = element.parentElement.firstElementChild;\n var elementIndex = 1;\n while (sibling && sibling !== element) {\n if (sibling.tagName === element.tagName) {\n elementIndex += 1;\n }\n sibling = sibling.nextElementSibling;\n }\n return \"\".concat(element.tagName, \":nth-of-type(\").concat(elementIndex, \")\");\n}\nfunction findSelector(element, selectorGetters, predicate, actionNameAttribute, childSelector) {\n for (var _i = 0, selectorGetters_1 = selectorGetters; _i < selectorGetters_1.length; _i++) {\n var selectorGetter = selectorGetters_1[_i];\n var elementSelector = selectorGetter(element, actionNameAttribute);\n if (!elementSelector) {\n continue;\n }\n var fullSelector = combineSelector(elementSelector, childSelector);\n if (predicate(element, fullSelector)) {\n return fullSelector;\n }\n }\n}\n/**\n * Check whether the selector is unique among the whole document.\n */\nfunction isSelectorUniqueGlobally(element, selector) {\n return element.ownerDocument.querySelectorAll(selector).length === 1;\n}\n/**\n * Check whether the selector is unique among the element siblings. In other words, it returns true\n * if \"ELEMENT_PARENT > SELECTOR\" returns a single element.\n *\n * The result will be less accurate on browsers that don't support :scope (i. e. IE): it will check\n * for any element matching the selector contained in the parent (in other words,\n * \"ELEMENT_PARENT SELECTOR\" returns a single element), regardless of whether the selector is a\n * direct descendent of the element parent. This should not impact results too much: if it\n * inaccurately returns false, we'll just fall back to another strategy.\n */\nfunction isSelectorUniqueAmongSiblings(element, selector) {\n return (element.parentElement.querySelectorAll(supportScopeSelector() ? combineSelector(':scope', selector) : selector)\n .length === 1);\n}\nfunction combineSelector(parent, child) {\n return child ? \"\".concat(parent, \">\").concat(child) : parent;\n}\nvar supportScopeSelectorCache;\nexport function supportScopeSelector() {\n if (supportScopeSelectorCache === undefined) {\n try {\n document.querySelector(':scope');\n supportScopeSelectorCache = true;\n }\n catch (_a) {\n supportScopeSelectorCache = false;\n }\n }\n return supportScopeSelectorCache;\n}\n//# sourceMappingURL=getSelectorFromElement.js.map","import { addEventListener } from '@datadog/browser-core';\nexport function listenActionEvents(_a) {\n var onPointerDown = _a.onPointerDown, onPointerUp = _a.onPointerUp;\n var selectionEmptyAtPointerDown;\n var userActivity = {\n selection: false,\n input: false,\n };\n var clickContext;\n var listeners = [\n addEventListener(window, \"pointerdown\" /* POINTER_DOWN */, function (event) {\n if (isValidPointerEvent(event)) {\n selectionEmptyAtPointerDown = isSelectionEmpty();\n userActivity = {\n selection: false,\n input: false,\n };\n clickContext = onPointerDown(event);\n }\n }, { capture: true }),\n addEventListener(window, \"selectionchange\" /* SELECTION_CHANGE */, function () {\n if (!selectionEmptyAtPointerDown || !isSelectionEmpty()) {\n userActivity.selection = true;\n }\n }, { capture: true }),\n addEventListener(window, \"pointerup\" /* POINTER_UP */, function (event) {\n if (isValidPointerEvent(event) && clickContext) {\n // Use a scoped variable to make sure the value is not changed by other clicks\n var localUserActivity_1 = userActivity;\n onPointerUp(clickContext, event, function () { return localUserActivity_1; });\n clickContext = undefined;\n }\n }, { capture: true }),\n addEventListener(window, \"input\" /* INPUT */, function () {\n userActivity.input = true;\n }, { capture: true }),\n ];\n return {\n stop: function () {\n listeners.forEach(function (listener) { return listener.stop(); });\n },\n };\n}\nfunction isSelectionEmpty() {\n var selection = window.getSelection();\n return !selection || selection.isCollapsed;\n}\nfunction isValidPointerEvent(event) {\n return (event.target instanceof Element &&\n // Only consider 'primary' pointer events for now. Multi-touch support could be implemented in\n // the future.\n event.isPrimary !== false);\n}\n//# sourceMappingURL=listenActionEvents.js.map","import { elementMatches, ONE_SECOND } from '@datadog/browser-core';\nvar MIN_CLICKS_PER_SECOND_TO_CONSIDER_RAGE = 3;\nexport function computeFrustration(clicks, rageClick) {\n if (isRage(clicks)) {\n rageClick.addFrustration(\"rage_click\" /* RAGE_CLICK */);\n if (clicks.some(isDead)) {\n rageClick.addFrustration(\"dead_click\" /* DEAD_CLICK */);\n }\n if (rageClick.hasError) {\n rageClick.addFrustration(\"error_click\" /* ERROR_CLICK */);\n }\n return { isRage: true };\n }\n var hasSelectionChanged = clicks.some(function (click) { return click.getUserActivity().selection; });\n clicks.forEach(function (click) {\n if (click.hasError) {\n click.addFrustration(\"error_click\" /* ERROR_CLICK */);\n }\n if (isDead(click) &&\n // Avoid considering clicks part of a double-click or triple-click selections as dead clicks\n !hasSelectionChanged) {\n click.addFrustration(\"dead_click\" /* DEAD_CLICK */);\n }\n });\n return { isRage: false };\n}\nexport function isRage(clicks) {\n if (clicks.some(function (click) { return click.getUserActivity().selection; })) {\n return false;\n }\n for (var i = 0; i < clicks.length - (MIN_CLICKS_PER_SECOND_TO_CONSIDER_RAGE - 1); i += 1) {\n if (clicks[i + MIN_CLICKS_PER_SECOND_TO_CONSIDER_RAGE - 1].event.timeStamp - clicks[i].event.timeStamp <=\n ONE_SECOND) {\n return true;\n }\n }\n return false;\n}\nvar DEAD_CLICK_EXCLUDE_SELECTOR = \n// inputs that don't trigger a meaningful event like \"input\" when clicked, including textual\n// inputs (using a negative selector is shorter here)\n'input:not([type=\"checkbox\"]):not([type=\"radio\"]):not([type=\"button\"]):not([type=\"submit\"]):not([type=\"reset\"]):not([type=\"range\"]),' +\n 'textarea,' +\n 'select,' +\n // contenteditable and their descendants don't always trigger meaningful changes when manipulated\n '[contenteditable],' +\n '[contenteditable] *,' +\n // canvas, as there is no good way to detect activity occurring on them\n 'canvas,' +\n // links that are interactive (have an href attribute) or any of their descendants, as they can\n // open a new tab or navigate to a hash without triggering a meaningful event\n 'a[href],' +\n 'a[href] *';\nexport function isDead(click) {\n if (click.hasPageActivity || click.getUserActivity().input) {\n return false;\n }\n return !elementMatches(click.event.target, DEAD_CLICK_EXCLUDE_SELECTOR);\n}\n//# sourceMappingURL=computeFrustration.js.map","import { includes, timeStampNow, isExperimentalFeatureEnabled, Observable, assign, getRelativeTime, ONE_MINUTE, ContextHistory, generateUUID, clocksNow, ONE_SECOND, elapsed, } from '@datadog/browser-core';\nimport { trackEventCounts } from '../../trackEventCounts';\nimport { PAGE_ACTIVITY_VALIDATION_DELAY, waitPageActivityEnd } from '../../waitPageActivityEnd';\nimport { createClickChain } from './clickChain';\nimport { getActionNameFromElement } from './getActionNameFromElement';\nimport { getSelectorFromElement } from './getSelectorFromElement';\nimport { listenActionEvents } from './listenActionEvents';\nimport { computeFrustration } from './computeFrustration';\n// Maximum duration for click actions\nexport var CLICK_ACTION_MAX_DURATION = 10 * ONE_SECOND;\nexport var ACTION_CONTEXT_TIME_OUT_DELAY = 5 * ONE_MINUTE; // arbitrary\nexport function trackClickActions(lifeCycle, domMutationObservable, configuration) {\n var history = new ContextHistory(ACTION_CONTEXT_TIME_OUT_DELAY);\n var stopObservable = new Observable();\n var currentClickChain;\n lifeCycle.subscribe(8 /* SESSION_RENEWED */, function () {\n history.reset();\n });\n lifeCycle.subscribe(4 /* VIEW_ENDED */, stopClickChain);\n var stopActionEventsListener = listenActionEvents({\n onPointerDown: function (pointerDownEvent) {\n return processPointerDown(configuration, lifeCycle, domMutationObservable, history, pointerDownEvent);\n },\n onPointerUp: function (_a, startEvent, getUserActivity) {\n var clickActionBase = _a.clickActionBase, hadActivityOnPointerDown = _a.hadActivityOnPointerDown;\n return startClickAction(configuration, lifeCycle, domMutationObservable, history, stopObservable, appendClickToClickChain, clickActionBase, startEvent, getUserActivity, hadActivityOnPointerDown);\n },\n }).stop;\n var actionContexts = {\n findActionId: function (startTime) {\n return configuration.trackFrustrations ? history.findAll(startTime) : history.find(startTime);\n },\n };\n return {\n stop: function () {\n stopClickChain();\n stopObservable.notify();\n stopActionEventsListener();\n },\n actionContexts: actionContexts,\n };\n function appendClickToClickChain(click) {\n if (!currentClickChain || !currentClickChain.tryAppend(click)) {\n var rageClick_1 = click.clone();\n currentClickChain = createClickChain(click, function (clicks) {\n finalizeClicks(clicks, rageClick_1);\n });\n }\n }\n function stopClickChain() {\n if (currentClickChain) {\n currentClickChain.stop();\n }\n }\n}\nfunction processPointerDown(configuration, lifeCycle, domMutationObservable, history, pointerDownEvent) {\n if (!configuration.trackFrustrations && history.find()) {\n // TODO: remove this in a future major version. To keep retrocompatibility, ignore any new\n // action if another one is already occurring.\n return;\n }\n var clickActionBase = computeClickActionBase(pointerDownEvent, configuration.actionNameAttribute);\n if (!configuration.trackFrustrations && !clickActionBase.name) {\n // TODO: remove this in a future major version. To keep retrocompatibility, ignore any action\n // with a blank name\n return;\n }\n var hadActivityOnPointerDown = false;\n waitPageActivityEnd(lifeCycle, domMutationObservable, configuration, function (pageActivityEndEvent) {\n hadActivityOnPointerDown = pageActivityEndEvent.hadActivity;\n }, \n // We don't care about the activity duration, we just want to know whether an activity did happen\n // within the \"validation delay\" or not. Limit the duration so the callback is called sooner.\n PAGE_ACTIVITY_VALIDATION_DELAY);\n return { clickActionBase: clickActionBase, hadActivityOnPointerDown: function () { return hadActivityOnPointerDown; } };\n}\nfunction startClickAction(configuration, lifeCycle, domMutationObservable, history, stopObservable, appendClickToClickChain, clickActionBase, startEvent, getUserActivity, hadActivityOnPointerDown) {\n var click = newClick(lifeCycle, history, getUserActivity, clickActionBase, startEvent);\n if (configuration.trackFrustrations) {\n appendClickToClickChain(click);\n }\n var stopWaitPageActivityEnd = waitPageActivityEnd(lifeCycle, domMutationObservable, configuration, function (pageActivityEndEvent) {\n if (pageActivityEndEvent.hadActivity && pageActivityEndEvent.end < click.startClocks.timeStamp) {\n // If the clock is looking weird, just discard the click\n click.discard();\n }\n else {\n if (pageActivityEndEvent.hadActivity) {\n click.stop(pageActivityEndEvent.end);\n }\n else if (hadActivityOnPointerDown()) {\n click.stop(\n // using the click start as activity end, so the click will have some activity but its\n // duration will be 0 (as the activity started before the click start)\n click.startClocks.timeStamp);\n }\n else {\n click.stop();\n }\n // Validate or discard the click only if we don't track frustrations. It'll be done when\n // the click chain is finalized.\n if (!configuration.trackFrustrations) {\n if (!pageActivityEndEvent.hadActivity) {\n // If we are not tracking frustrations, we should discard the click to keep backward\n // compatibility.\n click.discard();\n }\n else {\n click.validate();\n }\n }\n }\n }, CLICK_ACTION_MAX_DURATION).stop;\n var viewEndedSubscription = lifeCycle.subscribe(4 /* VIEW_ENDED */, function (_a) {\n var endClocks = _a.endClocks;\n click.stop(endClocks.timeStamp);\n });\n var stopSubscription = stopObservable.subscribe(function () {\n click.stop();\n });\n click.stopObservable.subscribe(function () {\n viewEndedSubscription.unsubscribe();\n stopWaitPageActivityEnd();\n stopSubscription.unsubscribe();\n });\n}\nfunction computeClickActionBase(event, actionNameAttribute) {\n var target;\n var position;\n if (isExperimentalFeatureEnabled('clickmap')) {\n var rect = event.target.getBoundingClientRect();\n target = {\n width: Math.round(rect.width),\n height: Math.round(rect.height),\n selector: getSelectorFromElement(event.target, actionNameAttribute),\n };\n position = {\n // Use clientX and Y because for SVG element offsetX and Y are relatives to the element\n x: Math.round(event.clientX - rect.left),\n y: Math.round(event.clientY - rect.top),\n };\n }\n return {\n type: \"click\" /* CLICK */,\n target: target,\n position: position,\n name: getActionNameFromElement(event.target, actionNameAttribute),\n };\n}\nfunction newClick(lifeCycle, history, getUserActivity, clickActionBase, startEvent) {\n var id = generateUUID();\n var startClocks = clocksNow();\n var historyEntry = history.add(id, startClocks.relative);\n var eventCountsSubscription = trackEventCounts({\n lifeCycle: lifeCycle,\n isChildEvent: function (event) {\n return event.action !== undefined &&\n (Array.isArray(event.action.id) ? includes(event.action.id, id) : event.action.id === id);\n },\n });\n var status = 0 /* ONGOING */;\n var activityEndTime;\n var frustrationTypes = [];\n var stopObservable = new Observable();\n function stop(newActivityEndTime) {\n if (status !== 0 /* ONGOING */) {\n return;\n }\n activityEndTime = newActivityEndTime;\n status = 1 /* STOPPED */;\n if (activityEndTime) {\n historyEntry.close(getRelativeTime(activityEndTime));\n }\n else {\n historyEntry.remove();\n }\n eventCountsSubscription.stop();\n stopObservable.notify();\n }\n return {\n event: startEvent,\n stop: stop,\n stopObservable: stopObservable,\n get hasError() {\n return eventCountsSubscription.eventCounts.errorCount > 0;\n },\n get hasPageActivity() {\n return activityEndTime !== undefined;\n },\n getUserActivity: getUserActivity,\n addFrustration: function (frustrationType) {\n frustrationTypes.push(frustrationType);\n },\n startClocks: startClocks,\n isStopped: function () { return status === 1 /* STOPPED */ || status === 2 /* FINALIZED */; },\n clone: function () { return newClick(lifeCycle, history, getUserActivity, clickActionBase, startEvent); },\n validate: function (domEvents) {\n stop();\n if (status !== 1 /* STOPPED */) {\n return;\n }\n var _a = eventCountsSubscription.eventCounts, resourceCount = _a.resourceCount, errorCount = _a.errorCount, longTaskCount = _a.longTaskCount;\n var clickAction = assign({\n type: \"click\" /* CLICK */,\n duration: activityEndTime && elapsed(startClocks.timeStamp, activityEndTime),\n startClocks: startClocks,\n id: id,\n frustrationTypes: frustrationTypes,\n counts: {\n resourceCount: resourceCount,\n errorCount: errorCount,\n longTaskCount: longTaskCount,\n },\n events: domEvents !== null && domEvents !== void 0 ? domEvents : [startEvent],\n event: startEvent,\n }, clickActionBase);\n lifeCycle.notify(1 /* AUTO_ACTION_COMPLETED */, clickAction);\n status = 2 /* FINALIZED */;\n },\n discard: function () {\n stop();\n status = 2 /* FINALIZED */;\n },\n };\n}\nexport function finalizeClicks(clicks, rageClick) {\n var isRage = computeFrustration(clicks, rageClick).isRage;\n if (isRage) {\n clicks.forEach(function (click) { return click.discard(); });\n rageClick.stop(timeStampNow());\n rageClick.validate(clicks.map(function (click) { return click.event; }));\n }\n else {\n rageClick.discard();\n clicks.forEach(function (click) { return click.validate(); });\n }\n}\n//# sourceMappingURL=trackClickActions.js.map","import { noop, assign, combine, toServerDuration, generateUUID } from '@datadog/browser-core';\nimport { trackClickActions } from './trackClickActions';\nexport function startActionCollection(lifeCycle, domMutationObservable, configuration, foregroundContexts) {\n lifeCycle.subscribe(1 /* AUTO_ACTION_COMPLETED */, function (action) {\n return lifeCycle.notify(10 /* RAW_RUM_EVENT_COLLECTED */, processAction(action, foregroundContexts));\n });\n var actionContexts = { findActionId: noop };\n if (configuration.trackUserInteractions) {\n actionContexts = trackClickActions(lifeCycle, domMutationObservable, configuration).actionContexts;\n }\n return {\n addAction: function (action, savedCommonContext) {\n lifeCycle.notify(10 /* RAW_RUM_EVENT_COLLECTED */, assign({\n savedCommonContext: savedCommonContext,\n }, processAction(action, foregroundContexts)));\n },\n actionContexts: actionContexts,\n };\n}\nfunction processAction(action, foregroundContexts) {\n var autoActionProperties = isAutoAction(action)\n ? {\n action: {\n id: action.id,\n loading_time: toServerDuration(action.duration),\n frustration: {\n type: action.frustrationTypes,\n },\n error: {\n count: action.counts.errorCount,\n },\n long_task: {\n count: action.counts.longTaskCount,\n },\n resource: {\n count: action.counts.resourceCount,\n },\n },\n _dd: {\n action: {\n target: action.target,\n position: action.position,\n },\n },\n }\n : undefined;\n var customerContext = !isAutoAction(action) ? action.context : undefined;\n var actionEvent = combine({\n action: {\n id: generateUUID(),\n target: {\n name: action.name,\n },\n type: action.type,\n },\n date: action.startClocks.timeStamp,\n type: \"action\" /* ACTION */,\n }, autoActionProperties);\n var inForeground = foregroundContexts.isInForegroundAt(action.startClocks.relative);\n if (inForeground !== undefined) {\n actionEvent.view = { in_foreground: inForeground };\n }\n return {\n customerContext: customerContext,\n rawRumEvent: actionEvent,\n startTime: action.startClocks.relative,\n domainContext: isAutoAction(action) ? { event: action.event, events: action.events } : {},\n };\n}\nfunction isAutoAction(action) {\n return action.type !== \"custom\" /* CUSTOM */;\n}\n//# sourceMappingURL=actionCollection.js.map","import { addEventListeners } from '@datadog/browser-core';\nvar trackFirstHiddenSingleton;\nvar stopListeners;\nexport function trackFirstHidden(eventTarget) {\n if (eventTarget === void 0) { eventTarget = window; }\n if (!trackFirstHiddenSingleton) {\n if (document.visibilityState === 'hidden') {\n trackFirstHiddenSingleton = {\n timeStamp: 0,\n };\n }\n else {\n trackFirstHiddenSingleton = {\n timeStamp: Infinity,\n };\n (stopListeners = addEventListeners(eventTarget, [\"pagehide\" /* PAGE_HIDE */, \"visibilitychange\" /* VISIBILITY_CHANGE */], function (event) {\n if (event.type === 'pagehide' || document.visibilityState === 'hidden') {\n trackFirstHiddenSingleton.timeStamp = event.timeStamp;\n stopListeners();\n }\n }, { capture: true }).stop);\n }\n }\n return trackFirstHiddenSingleton;\n}\nexport function resetFirstHidden() {\n if (stopListeners) {\n stopListeners();\n }\n trackFirstHiddenSingleton = undefined;\n}\n//# sourceMappingURL=trackFirstHidden.js.map","import { isEmptyObject, assign, ErrorSource, generateUUID, computeRawError, computeStackTrace, Observable, trackRuntimeError, } from '@datadog/browser-core';\nimport { trackConsoleError } from './trackConsoleError';\nimport { trackReportError } from './trackReportError';\nexport function startErrorCollection(lifeCycle, foregroundContexts, featureFlagContexts) {\n var errorObservable = new Observable();\n trackConsoleError(errorObservable);\n trackRuntimeError(errorObservable);\n trackReportError(errorObservable);\n errorObservable.subscribe(function (error) { return lifeCycle.notify(12 /* RAW_ERROR_COLLECTED */, { error: error }); });\n return doStartErrorCollection(lifeCycle, foregroundContexts, featureFlagContexts);\n}\nexport function doStartErrorCollection(lifeCycle, foregroundContexts, featureFlagContexts) {\n lifeCycle.subscribe(12 /* RAW_ERROR_COLLECTED */, function (_a) {\n var error = _a.error, customerContext = _a.customerContext, savedCommonContext = _a.savedCommonContext;\n lifeCycle.notify(10 /* RAW_RUM_EVENT_COLLECTED */, assign({\n customerContext: customerContext,\n savedCommonContext: savedCommonContext,\n }, processError(error, foregroundContexts, featureFlagContexts)));\n });\n return {\n addError: function (_a, savedCommonContext) {\n var error = _a.error, handlingStack = _a.handlingStack, startClocks = _a.startClocks, customerContext = _a.context;\n var stackTrace = error instanceof Error ? computeStackTrace(error) : undefined;\n var rawError = computeRawError({\n stackTrace: stackTrace,\n originalError: error,\n handlingStack: handlingStack,\n startClocks: startClocks,\n nonErrorPrefix: 'Provided',\n source: ErrorSource.CUSTOM,\n handling: \"handled\" /* HANDLED */,\n });\n lifeCycle.notify(12 /* RAW_ERROR_COLLECTED */, {\n customerContext: customerContext,\n savedCommonContext: savedCommonContext,\n error: rawError,\n });\n },\n };\n}\nfunction processError(error, foregroundContexts, featureFlagContexts) {\n var rawRumEvent = {\n date: error.startClocks.timeStamp,\n error: {\n id: generateUUID(),\n message: error.message,\n source: error.source,\n stack: error.stack,\n handling_stack: error.handlingStack,\n type: error.type,\n handling: error.handling,\n causes: error.causes,\n source_type: 'browser',\n },\n type: \"error\" /* ERROR */,\n };\n var inForeground = foregroundContexts.isInForegroundAt(error.startClocks.relative);\n if (inForeground) {\n rawRumEvent.view = { in_foreground: inForeground };\n }\n var featureFlagContext = featureFlagContexts.findFeatureFlagEvaluations(error.startClocks.relative);\n if (featureFlagContext && !isEmptyObject(featureFlagContext)) {\n rawRumEvent.feature_flags = featureFlagContext;\n }\n return {\n rawRumEvent: rawRumEvent,\n startTime: error.startClocks.relative,\n domainContext: {\n error: error.originalError,\n },\n };\n}\n//# sourceMappingURL=errorCollection.js.map","import { clocksNow, initConsoleObservable, ErrorSource, ConsoleApiName } from '@datadog/browser-core';\nexport function trackConsoleError(errorObservable) {\n var subscription = initConsoleObservable([ConsoleApiName.error]).subscribe(function (consoleError) {\n return errorObservable.notify({\n startClocks: clocksNow(),\n message: consoleError.message,\n stack: consoleError.stack,\n source: ErrorSource.CONSOLE,\n handling: \"handled\" /* HANDLED */,\n handlingStack: consoleError.handlingStack,\n });\n });\n return {\n stop: function () {\n subscription.unsubscribe();\n },\n };\n}\n//# sourceMappingURL=trackConsoleError.js.map","import { clocksNow, ErrorSource, initReportObservable, RawReportType } from '@datadog/browser-core';\nexport function trackReportError(errorObservable) {\n var subscription = initReportObservable([RawReportType.cspViolation, RawReportType.intervention]).subscribe(function (reportError) {\n return errorObservable.notify({\n startClocks: clocksNow(),\n message: reportError.message,\n stack: reportError.stack,\n type: reportError.subtype,\n source: ErrorSource.REPORT,\n handling: \"unhandled\" /* UNHANDLED */,\n });\n });\n return {\n stop: function () {\n subscription.unsubscribe();\n },\n };\n}\n//# sourceMappingURL=trackReportError.js.map","import { addDuration } from '@datadog/browser-core';\nimport { toValidEntry } from './resourceUtils';\n/**\n * Look for corresponding timing in resource timing buffer\n *\n * Observations:\n * - Timing (start, end) are nested inside the request (start, end)\n * - Some timing can be not exactly nested, being off by < 1 ms\n *\n * Strategy:\n * - from valid nested entries (with 1 ms error margin)\n * - if a single timing match, return the timing\n * - otherwise we can't decide, return undefined\n */\nexport function matchRequestTiming(request) {\n if (!performance || !('getEntriesByName' in performance)) {\n return;\n }\n var sameNameEntries = performance.getEntriesByName(request.url, 'resource');\n if (!sameNameEntries.length || !('toJSON' in sameNameEntries[0])) {\n return;\n }\n var candidates = sameNameEntries\n .map(function (entry) { return entry.toJSON(); })\n .filter(toValidEntry)\n .filter(function (entry) {\n return isBetween(entry, request.startClocks.relative, endTime({ startTime: request.startClocks.relative, duration: request.duration }));\n });\n if (candidates.length === 1) {\n return candidates[0];\n }\n return;\n}\nfunction endTime(timing) {\n return addDuration(timing.startTime, timing.duration);\n}\nfunction isBetween(timing, start, end) {\n var errorMargin = 1;\n return timing.startTime >= start - errorMargin && endTime(timing) <= addDuration(end, errorMargin);\n}\n//# sourceMappingURL=matchRequestTiming.js.map","import { combine, generateUUID, toServerDuration, relativeToClocks, assign, isNumber, isExperimentalFeatureEnabled, } from '@datadog/browser-core';\nimport { matchRequestTiming } from './matchRequestTiming';\nimport { computePerformanceResourceDetails, computePerformanceResourceDuration, computeResourceKind, computeSize, isRequestKind, } from './resourceUtils';\nexport function startResourceCollection(lifeCycle, configuration, sessionManager, pageStateHistory) {\n lifeCycle.subscribe(6 /* REQUEST_COMPLETED */, function (request) {\n lifeCycle.notify(10 /* RAW_RUM_EVENT_COLLECTED */, processRequest(request, configuration, sessionManager, pageStateHistory));\n });\n lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {\n for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\n var entry = entries_1[_i];\n if (entry.entryType === 'resource' && !isRequestKind(entry)) {\n lifeCycle.notify(10 /* RAW_RUM_EVENT_COLLECTED */, processResourceEntry(entry, configuration, sessionManager, pageStateHistory));\n }\n }\n });\n}\nfunction processRequest(request, configuration, sessionManager, pageStateHistory) {\n var _a;\n var type = request.type === \"xhr\" /* XHR */ ? \"xhr\" /* XHR */ : \"fetch\" /* FETCH */;\n var matchingTiming = matchRequestTiming(request);\n var startClocks = matchingTiming ? relativeToClocks(matchingTiming.startTime) : request.startClocks;\n var correspondingTimingOverrides = matchingTiming ? computePerformanceEntryMetrics(matchingTiming) : undefined;\n var tracingInfo = computeRequestTracingInfo(request, configuration);\n var indexingInfo = computeIndexingInfo(sessionManager, startClocks);\n var duration = toServerDuration(request.duration);\n var durationOverrideInfo = computeDurationOverrideInfo(duration, correspondingTimingOverrides === null || correspondingTimingOverrides === void 0 ? void 0 : correspondingTimingOverrides.resource.duration);\n var pageStateInfo = computePageStateInfo(pageStateHistory, startClocks, (_a = matchingTiming === null || matchingTiming === void 0 ? void 0 : matchingTiming.duration) !== null && _a !== void 0 ? _a : request.duration);\n var resourceEvent = combine({\n date: startClocks.timeStamp,\n resource: {\n id: generateUUID(),\n type: type,\n duration: duration,\n method: request.method,\n status_code: request.status,\n url: request.url,\n },\n type: \"resource\" /* RESOURCE */,\n }, tracingInfo, correspondingTimingOverrides, indexingInfo, durationOverrideInfo, pageStateInfo);\n return {\n startTime: startClocks.relative,\n rawRumEvent: resourceEvent,\n domainContext: {\n performanceEntry: matchingTiming && toPerformanceEntryRepresentation(matchingTiming),\n xhr: request.xhr,\n response: request.response,\n requestInput: request.input,\n requestInit: request.init,\n error: request.error,\n },\n };\n}\nfunction processResourceEntry(entry, configuration, sessionManager, pageStateHistory) {\n var type = computeResourceKind(entry);\n var entryMetrics = computePerformanceEntryMetrics(entry);\n var startClocks = relativeToClocks(entry.startTime);\n var tracingInfo = computeEntryTracingInfo(entry, configuration);\n var indexingInfo = computeIndexingInfo(sessionManager, startClocks);\n var pageStateInfo = computePageStateInfo(pageStateHistory, startClocks, entry.duration);\n var resourceEvent = combine({\n date: startClocks.timeStamp,\n resource: {\n id: generateUUID(),\n type: type,\n url: entry.name,\n },\n type: \"resource\" /* RESOURCE */,\n }, tracingInfo, entryMetrics, indexingInfo, pageStateInfo);\n return {\n startTime: startClocks.relative,\n rawRumEvent: resourceEvent,\n domainContext: {\n performanceEntry: toPerformanceEntryRepresentation(entry),\n },\n };\n}\nfunction computePerformanceEntryMetrics(timing) {\n return {\n resource: assign({\n duration: computePerformanceResourceDuration(timing),\n size: computeSize(timing),\n }, computePerformanceResourceDetails(timing)),\n };\n}\nfunction computeRequestTracingInfo(request, configuration) {\n var hasBeenTraced = request.traceSampled && request.traceId && request.spanId;\n if (!hasBeenTraced) {\n return undefined;\n }\n return {\n _dd: {\n span_id: request.spanId.toDecimalString(),\n trace_id: request.traceId.toDecimalString(),\n rule_psr: getRulePsr(configuration),\n },\n };\n}\nfunction computeEntryTracingInfo(entry, configuration) {\n var hasBeenTraced = entry.traceId;\n if (!hasBeenTraced) {\n return undefined;\n }\n return {\n _dd: {\n trace_id: entry.traceId,\n rule_psr: getRulePsr(configuration),\n },\n };\n}\nfunction computeDurationOverrideInfo(computedDuration, performanceEntryDuration) {\n if (!isExperimentalFeatureEnabled('resource_durations')) {\n return;\n }\n return {\n _dd: {\n computed_duration: computedDuration,\n performance_entry_duration: performanceEntryDuration,\n override_duration_diff: performanceEntryDuration ? computedDuration - performanceEntryDuration : undefined,\n },\n };\n}\n// TODO next major: use directly PerformanceEntry type in domain context\nfunction toPerformanceEntryRepresentation(entry) {\n return entry;\n}\n/**\n * @returns number between 0 and 1 which represents trace sample rate\n */\nfunction getRulePsr(configuration) {\n return isNumber(configuration.traceSampleRate) ? configuration.traceSampleRate / 100 : undefined;\n}\nfunction computeIndexingInfo(sessionManager, resourceStart) {\n var session = sessionManager.findTrackedSession(resourceStart.relative);\n return {\n _dd: {\n discarded: !session || !session.resourceAllowed,\n },\n };\n}\nfunction computePageStateInfo(pageStateHistory, startClocks, duration) {\n if (!isExperimentalFeatureEnabled('resource_page_states')) {\n return;\n }\n return {\n _dd: {\n page_states: pageStateHistory.findAll(startClocks.relative, duration),\n page_was_discarded: String(document.wasDiscarded),\n },\n };\n}\n//# sourceMappingURL=resourceCollection.js.map","import { assign, addEventListeners, elapsed, ONE_MINUTE, find, findLast, relativeNow, } from '@datadog/browser-core';\nimport { trackFirstHidden } from './trackFirstHidden';\n// Discard LCP and FCP timings above a certain delay to avoid incorrect data\n// It happens in some cases like sleep mode or some browser implementations\nexport var TIMING_MAXIMUM_DELAY = 10 * ONE_MINUTE;\nexport function trackInitialViewTimings(lifeCycle, callback) {\n var timings = {};\n function setTimings(newTimings) {\n assign(timings, newTimings);\n callback(timings);\n }\n var stopNavigationTracking = trackNavigationTimings(lifeCycle, setTimings).stop;\n var stopFCPTracking = trackFirstContentfulPaintTiming(lifeCycle, function (firstContentfulPaint) {\n return setTimings({ firstContentfulPaint: firstContentfulPaint });\n }).stop;\n var stopLCPTracking = trackLargestContentfulPaintTiming(lifeCycle, window, function (largestContentfulPaint) {\n setTimings({\n largestContentfulPaint: largestContentfulPaint,\n });\n }).stop;\n var stopFIDTracking = trackFirstInputTimings(lifeCycle, function (_a) {\n var firstInputDelay = _a.firstInputDelay, firstInputTime = _a.firstInputTime;\n setTimings({\n firstInputDelay: firstInputDelay,\n firstInputTime: firstInputTime,\n });\n }).stop;\n return {\n stop: function () {\n stopNavigationTracking();\n stopFCPTracking();\n stopLCPTracking();\n stopFIDTracking();\n },\n };\n}\nexport function trackNavigationTimings(lifeCycle, callback) {\n var stop = lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {\n for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\n var entry = entries_1[_i];\n if (entry.entryType === 'navigation') {\n callback({\n domComplete: entry.domComplete,\n domContentLoaded: entry.domContentLoadedEventEnd,\n domInteractive: entry.domInteractive,\n loadEvent: entry.loadEventEnd,\n // In some cases the value reported is negative or is larger\n // than the current page time. Ignore these cases:\n // https://github.com/GoogleChrome/web-vitals/issues/137\n // https://github.com/GoogleChrome/web-vitals/issues/162\n firstByte: entry.responseStart >= 0 && entry.responseStart <= relativeNow() ? entry.responseStart : undefined,\n });\n }\n }\n }).unsubscribe;\n return { stop: stop };\n}\nexport function trackFirstContentfulPaintTiming(lifeCycle, callback) {\n var firstHidden = trackFirstHidden();\n var stop = lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {\n var fcpEntry = find(entries, function (entry) {\n return entry.entryType === 'paint' &&\n entry.name === 'first-contentful-paint' &&\n entry.startTime < firstHidden.timeStamp &&\n entry.startTime < TIMING_MAXIMUM_DELAY;\n });\n if (fcpEntry) {\n callback(fcpEntry.startTime);\n }\n }).unsubscribe;\n return { stop: stop };\n}\n/**\n * Track the largest contentful paint (LCP) occurring during the initial View. This can yield\n * multiple values, only the most recent one should be used.\n * Documentation: https://web.dev/lcp/\n * Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/master/src/getLCP.ts\n */\nexport function trackLargestContentfulPaintTiming(lifeCycle, eventTarget, callback) {\n var firstHidden = trackFirstHidden();\n // Ignore entries that come after the first user interaction. According to the documentation, the\n // browser should not send largest-contentful-paint entries after a user interact with the page,\n // but the web-vitals reference implementation uses this as a safeguard.\n var firstInteractionTimestamp = Infinity;\n var stopEventListener = addEventListeners(eventTarget, [\"pointerdown\" /* POINTER_DOWN */, \"keydown\" /* KEY_DOWN */], function (event) {\n firstInteractionTimestamp = event.timeStamp;\n }, { capture: true, once: true }).stop;\n var unsubscribeLifeCycle = lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {\n var lcpEntry = findLast(entries, function (entry) {\n return entry.entryType === 'largest-contentful-paint' &&\n entry.startTime < firstInteractionTimestamp &&\n entry.startTime < firstHidden.timeStamp &&\n entry.startTime < TIMING_MAXIMUM_DELAY;\n });\n if (lcpEntry) {\n callback(lcpEntry.startTime);\n }\n }).unsubscribe;\n return {\n stop: function () {\n stopEventListener();\n unsubscribeLifeCycle();\n },\n };\n}\n/**\n * Track the first input occurring during the initial View to return:\n * - First Input Delay\n * - First Input Time\n * Callback is called at most one time.\n * Documentation: https://web.dev/fid/\n * Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/master/src/getFID.ts\n */\nexport function trackFirstInputTimings(lifeCycle, callback) {\n var firstHidden = trackFirstHidden();\n var stop = lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {\n var firstInputEntry = find(entries, function (entry) {\n return entry.entryType === 'first-input' && entry.startTime < firstHidden.timeStamp;\n });\n if (firstInputEntry) {\n var firstInputDelay = elapsed(firstInputEntry.startTime, firstInputEntry.processingStart);\n callback({\n // Ensure firstInputDelay to be positive, see\n // https://bugs.chromium.org/p/chromium/issues/detail?id=1185815\n firstInputDelay: firstInputDelay >= 0 ? firstInputDelay : 0,\n firstInputTime: firstInputEntry.startTime,\n });\n }\n }).unsubscribe;\n return {\n stop: stop,\n };\n}\n//# sourceMappingURL=trackInitialViewTimings.js.map","import { noop, round, ONE_SECOND, elapsed } from '@datadog/browser-core';\nimport { supportPerformanceTimingEvent } from '../../../browser/performanceCollection';\nimport { waitPageActivityEnd } from '../../waitPageActivityEnd';\nexport function trackViewMetrics(lifeCycle, domMutationObservable, configuration, scheduleViewUpdate, loadingType, viewStart) {\n var viewMetrics = {};\n var _a = trackLoadingTime(lifeCycle, domMutationObservable, configuration, loadingType, viewStart, function (newLoadingTime) {\n viewMetrics.loadingTime = newLoadingTime;\n scheduleViewUpdate();\n }), stopLoadingTimeTracking = _a.stop, setLoadEvent = _a.setLoadEvent;\n var stopCLSTracking;\n if (isLayoutShiftSupported()) {\n viewMetrics.cumulativeLayoutShift = 0;\n (stopCLSTracking = trackCumulativeLayoutShift(lifeCycle, function (cumulativeLayoutShift) {\n viewMetrics.cumulativeLayoutShift = cumulativeLayoutShift;\n scheduleViewUpdate();\n }).stop);\n }\n else {\n stopCLSTracking = noop;\n }\n return {\n stop: function () {\n stopLoadingTimeTracking();\n stopCLSTracking();\n },\n setLoadEvent: setLoadEvent,\n viewMetrics: viewMetrics,\n };\n}\nfunction trackLoadingTime(lifeCycle, domMutationObservable, configuration, loadType, viewStart, callback) {\n var isWaitingForLoadEvent = loadType === \"initial_load\" /* INITIAL_LOAD */;\n var isWaitingForActivityLoadingTime = true;\n var loadingTimeCandidates = [];\n function invokeCallbackIfAllCandidatesAreReceived() {\n if (!isWaitingForActivityLoadingTime && !isWaitingForLoadEvent && loadingTimeCandidates.length > 0) {\n callback(Math.max.apply(Math, loadingTimeCandidates));\n }\n }\n var stop = waitPageActivityEnd(lifeCycle, domMutationObservable, configuration, function (event) {\n if (isWaitingForActivityLoadingTime) {\n isWaitingForActivityLoadingTime = false;\n if (event.hadActivity) {\n loadingTimeCandidates.push(elapsed(viewStart.timeStamp, event.end));\n }\n invokeCallbackIfAllCandidatesAreReceived();\n }\n }).stop;\n return {\n stop: stop,\n setLoadEvent: function (loadEvent) {\n if (isWaitingForLoadEvent) {\n isWaitingForLoadEvent = false;\n loadingTimeCandidates.push(loadEvent);\n invokeCallbackIfAllCandidatesAreReceived();\n }\n },\n };\n}\n/**\n * Track the cumulative layout shifts (CLS).\n * Layout shifts are grouped into session windows.\n * The minimum gap between session windows is 1 second.\n * The maximum duration of a session window is 5 second.\n * The session window layout shift value is the sum of layout shifts inside it.\n * The CLS value is the max of session windows values.\n *\n * This yields a new value whenever the CLS value is updated (a higher session window value is computed).\n *\n * See isLayoutShiftSupported to check for browser support.\n *\n * Documentation:\n * https://web.dev/cls/\n * https://web.dev/evolving-cls/\n * Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/master/src/getCLS.ts\n */\nfunction trackCumulativeLayoutShift(lifeCycle, callback) {\n var maxClsValue = 0;\n var window = slidingSessionWindow();\n var stop = lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {\n for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\n var entry = entries_1[_i];\n if (entry.entryType === 'layout-shift' && !entry.hadRecentInput) {\n window.update(entry);\n if (window.value() > maxClsValue) {\n maxClsValue = window.value();\n callback(round(maxClsValue, 4));\n }\n }\n }\n }).unsubscribe;\n return {\n stop: stop,\n };\n}\nfunction slidingSessionWindow() {\n var value = 0;\n var startTime;\n var endTime;\n return {\n update: function (entry) {\n var shouldCreateNewWindow = startTime === undefined ||\n entry.startTime - endTime >= ONE_SECOND ||\n entry.startTime - startTime >= 5 * ONE_SECOND;\n if (shouldCreateNewWindow) {\n startTime = endTime = entry.startTime;\n value = entry.value;\n }\n else {\n value += entry.value;\n endTime = entry.startTime;\n }\n },\n value: function () { return value; },\n };\n}\n/**\n * Check whether `layout-shift` is supported by the browser.\n */\nfunction isLayoutShiftSupported() {\n return supportPerformanceTimingEvent('layout-shift');\n}\n//# sourceMappingURL=trackViewMetrics.js.map","import { ONE_MINUTE, setTimeout } from '@datadog/browser-core';\nimport { trackEventCounts } from '../../trackEventCounts';\n// Some events are not being counted as they transcend views. To reduce the occurrence;\n// an arbitrary delay is added for stopping event counting after the view ends.\n//\n// Ideally, we would not stop and keep counting events until the end of the session.\n// But this might have a small performance impact if there are many many views:\n// we would need to go through each event to see if the related view matches.\n// So let's have a fairly short delay to avoid impacting performances too much.\n//\n// In the future, we could have views stored in a data structure similar to ContextHistory. Whenever\n// a child event is collected, we could look into this history to find the matching view and\n// increase the associated and increase its counter. Having a centralized data structure for it\n// would allow us to look for views more efficiently.\n//\n// For now, having a small cleanup delay will already improve the situation in most cases.\nexport var KEEP_TRACKING_EVENT_COUNTS_AFTER_VIEW_DELAY = 5 * ONE_MINUTE;\nexport function trackViewEventCounts(lifeCycle, viewId, onChange) {\n var _a = trackEventCounts({\n lifeCycle: lifeCycle,\n isChildEvent: function (event) { return event.view.id === viewId; },\n onChange: onChange,\n }), stop = _a.stop, eventCounts = _a.eventCounts;\n return {\n scheduleStop: function () {\n setTimeout(stop, KEEP_TRACKING_EVENT_COUNTS_AFTER_VIEW_DELAY);\n },\n eventCounts: eventCounts,\n };\n}\n//# sourceMappingURL=trackViewEventCounts.js.map","import { PageExitReason, shallowClone, assign, elapsed, generateUUID, monitor, ONE_MINUTE, throttle, clocksNow, clocksOrigin, timeStampNow, display, looksLikeRelativeTime, } from '@datadog/browser-core';\nimport { trackInitialViewTimings } from './trackInitialViewTimings';\nimport { trackViewMetrics } from './trackViewMetrics';\nimport { trackViewEventCounts } from './trackViewEventCounts';\nexport var THROTTLE_VIEW_UPDATE_PERIOD = 3000;\nexport var SESSION_KEEP_ALIVE_INTERVAL = 5 * ONE_MINUTE;\nexport function trackViews(location, lifeCycle, domMutationObservable, configuration, locationChangeObservable, areViewsTrackedAutomatically, initialViewOptions) {\n var _a = trackInitialView(initialViewOptions), stopInitialViewTracking = _a.stop, initialView = _a.initialView;\n var currentView = initialView;\n var stopViewLifeCycle = startViewLifeCycle().stop;\n var locationChangeSubscription;\n if (areViewsTrackedAutomatically) {\n locationChangeSubscription = renewViewOnLocationChange(locationChangeObservable);\n }\n function trackInitialView(options) {\n var initialView = newView(lifeCycle, domMutationObservable, configuration, location, \"initial_load\" /* INITIAL_LOAD */, clocksOrigin(), options);\n var stop = trackInitialViewTimings(lifeCycle, function (timings) {\n initialView.updateTimings(timings);\n initialView.scheduleUpdate();\n }).stop;\n return { initialView: initialView, stop: stop };\n }\n function trackViewChange(startClocks, viewOptions) {\n return newView(lifeCycle, domMutationObservable, configuration, location, \"route_change\" /* ROUTE_CHANGE */, startClocks, viewOptions);\n }\n function startViewLifeCycle() {\n lifeCycle.subscribe(8 /* SESSION_RENEWED */, function () {\n // do not trigger view update to avoid wrong data\n currentView.end();\n // Renew view on session renewal\n currentView = trackViewChange(undefined, {\n name: currentView.name,\n service: currentView.service,\n version: currentView.version,\n });\n });\n // End the current view on page unload\n lifeCycle.subscribe(9 /* PAGE_EXITED */, function (pageExitEvent) {\n if (pageExitEvent.reason === PageExitReason.UNLOADING || pageExitEvent.reason === PageExitReason.PAGEHIDE) {\n currentView.end();\n currentView.triggerUpdate();\n }\n });\n // Session keep alive\n var keepAliveInterval = window.setInterval(monitor(function () {\n currentView.triggerUpdate();\n }), SESSION_KEEP_ALIVE_INTERVAL);\n return {\n stop: function () {\n clearInterval(keepAliveInterval);\n },\n };\n }\n function renewViewOnLocationChange(locationChangeObservable) {\n return locationChangeObservable.subscribe(function (_a) {\n var oldLocation = _a.oldLocation, newLocation = _a.newLocation;\n if (areDifferentLocation(oldLocation, newLocation)) {\n currentView.end();\n currentView.triggerUpdate();\n currentView = trackViewChange();\n return;\n }\n });\n }\n return {\n addTiming: function (name, time) {\n if (time === void 0) { time = timeStampNow(); }\n currentView.addTiming(name, time);\n currentView.scheduleUpdate();\n },\n startView: function (options, startClocks) {\n currentView.end(startClocks);\n currentView.triggerUpdate();\n currentView = trackViewChange(startClocks, options);\n },\n stop: function () {\n locationChangeSubscription === null || locationChangeSubscription === void 0 ? void 0 : locationChangeSubscription.unsubscribe();\n stopInitialViewTracking();\n stopViewLifeCycle();\n currentView.end();\n },\n };\n}\nfunction newView(lifeCycle, domMutationObservable, configuration, initialLocation, loadingType, startClocks, viewOptions) {\n if (startClocks === void 0) { startClocks = clocksNow(); }\n // Setup initial values\n var id = generateUUID();\n var timings = {};\n var customTimings = {};\n var documentVersion = 0;\n var endClocks;\n var location = shallowClone(initialLocation);\n var name;\n var service;\n var version;\n if (viewOptions) {\n name = viewOptions.name;\n service = viewOptions.service;\n version = viewOptions.version;\n }\n lifeCycle.notify(2 /* VIEW_CREATED */, {\n id: id,\n name: name,\n startClocks: startClocks,\n service: service,\n version: version,\n });\n // Update the view every time the measures are changing\n var _a = throttle(triggerViewUpdate, THROTTLE_VIEW_UPDATE_PERIOD, {\n leading: false,\n }), scheduleViewUpdate = _a.throttled, cancelScheduleViewUpdate = _a.cancel;\n var _b = trackViewMetrics(lifeCycle, domMutationObservable, configuration, scheduleViewUpdate, loadingType, startClocks), setLoadEvent = _b.setLoadEvent, stopViewMetricsTracking = _b.stop, viewMetrics = _b.viewMetrics;\n var _c = trackViewEventCounts(lifeCycle, id, scheduleViewUpdate), scheduleStopEventCountsTracking = _c.scheduleStop, eventCounts = _c.eventCounts;\n // Initial view update\n triggerViewUpdate();\n function triggerViewUpdate() {\n documentVersion += 1;\n var currentEnd = endClocks === undefined ? timeStampNow() : endClocks.timeStamp;\n lifeCycle.notify(3 /* VIEW_UPDATED */, assign({\n customTimings: customTimings,\n documentVersion: documentVersion,\n id: id,\n name: name,\n service: service,\n version: version,\n loadingType: loadingType,\n location: location,\n startClocks: startClocks,\n timings: timings,\n duration: elapsed(startClocks.timeStamp, currentEnd),\n isActive: endClocks === undefined,\n eventCounts: eventCounts,\n }, viewMetrics));\n }\n return {\n name: name,\n service: service,\n version: version,\n scheduleUpdate: scheduleViewUpdate,\n end: function (clocks) {\n if (clocks === void 0) { clocks = clocksNow(); }\n endClocks = clocks;\n lifeCycle.notify(4 /* VIEW_ENDED */, { endClocks: endClocks });\n stopViewMetricsTracking();\n scheduleStopEventCountsTracking();\n },\n triggerUpdate: function () {\n // cancel any pending view updates execution\n cancelScheduleViewUpdate();\n triggerViewUpdate();\n },\n updateTimings: function (newTimings) {\n timings = newTimings;\n if (newTimings.loadEvent !== undefined) {\n setLoadEvent(newTimings.loadEvent);\n }\n },\n addTiming: function (name, time) {\n var relativeTime = looksLikeRelativeTime(time) ? time : elapsed(startClocks.timeStamp, time);\n customTimings[sanitizeTiming(name)] = relativeTime;\n },\n };\n}\n/**\n * Timing name is used as facet path that must contain only letters, digits, or the characters - _ . @ $\n */\nfunction sanitizeTiming(name) {\n var sanitized = name.replace(/[^a-zA-Z0-9-_.@$]/g, '_');\n if (sanitized !== name) {\n display.warn(\"Invalid timing name: \".concat(name, \", sanitized to: \").concat(sanitized));\n }\n return sanitized;\n}\nfunction areDifferentLocation(currentLocation, otherLocation) {\n return (currentLocation.pathname !== otherLocation.pathname ||\n (!isHashAnAnchor(otherLocation.hash) &&\n getPathFromHash(otherLocation.hash) !== getPathFromHash(currentLocation.hash)));\n}\nfunction isHashAnAnchor(hash) {\n var correspondingId = hash.substr(1);\n return !!document.getElementById(correspondingId);\n}\nfunction getPathFromHash(hash) {\n var index = hash.indexOf('?');\n return index < 0 ? hash : hash.slice(0, index);\n}\n//# sourceMappingURL=trackViews.js.map","import { isEmptyObject, mapValues, toServerDuration, isNumber } from '@datadog/browser-core';\nimport { trackViews } from './trackViews';\nexport function startViewCollection(lifeCycle, configuration, location, domMutationObservable, locationChangeObservable, foregroundContexts, featureFlagContexts, recorderApi, initialViewOptions) {\n lifeCycle.subscribe(3 /* VIEW_UPDATED */, function (view) {\n return lifeCycle.notify(10 /* RAW_RUM_EVENT_COLLECTED */, processViewUpdate(view, foregroundContexts, featureFlagContexts, recorderApi));\n });\n return trackViews(location, lifeCycle, domMutationObservable, configuration, locationChangeObservable, !configuration.trackViewsManually, initialViewOptions);\n}\nfunction processViewUpdate(view, foregroundContexts, featureFlagContexts, recorderApi) {\n var replayStats = recorderApi.getReplayStats(view.id);\n var featureFlagContext = featureFlagContexts.findFeatureFlagEvaluations(view.startClocks.relative);\n var viewEvent = {\n _dd: {\n document_version: view.documentVersion,\n replay_stats: replayStats,\n },\n date: view.startClocks.timeStamp,\n type: \"view\" /* VIEW */,\n view: {\n action: {\n count: view.eventCounts.actionCount,\n },\n frustration: {\n count: view.eventCounts.frustrationCount,\n },\n cumulative_layout_shift: view.cumulativeLayoutShift,\n first_byte: toServerDuration(view.timings.firstByte),\n dom_complete: toServerDuration(view.timings.domComplete),\n dom_content_loaded: toServerDuration(view.timings.domContentLoaded),\n dom_interactive: toServerDuration(view.timings.domInteractive),\n error: {\n count: view.eventCounts.errorCount,\n },\n first_contentful_paint: toServerDuration(view.timings.firstContentfulPaint),\n first_input_delay: toServerDuration(view.timings.firstInputDelay),\n first_input_time: toServerDuration(view.timings.firstInputTime),\n is_active: view.isActive,\n name: view.name,\n largest_contentful_paint: toServerDuration(view.timings.largestContentfulPaint),\n load_event: toServerDuration(view.timings.loadEvent),\n loading_time: discardNegativeDuration(toServerDuration(view.loadingTime)),\n loading_type: view.loadingType,\n long_task: {\n count: view.eventCounts.longTaskCount,\n },\n resource: {\n count: view.eventCounts.resourceCount,\n },\n time_spent: toServerDuration(view.duration),\n in_foreground_periods: foregroundContexts.selectInForegroundPeriodsFor(view.startClocks.relative, view.duration),\n },\n feature_flags: featureFlagContext && !isEmptyObject(featureFlagContext) ? featureFlagContext : undefined,\n session: {\n has_replay: replayStats ? true : undefined,\n },\n };\n if (!isEmptyObject(view.customTimings)) {\n viewEvent.view.custom_timings = mapValues(view.customTimings, toServerDuration);\n }\n return {\n rawRumEvent: viewEvent,\n startTime: view.startClocks.relative,\n domainContext: {\n location: view.location,\n },\n };\n}\nfunction discardNegativeDuration(duration) {\n return isNumber(duration) && duration < 0 ? undefined : duration;\n}\n//# sourceMappingURL=viewCollection.js.map","import { performDraw, startSessionManager } from '@datadog/browser-core';\nexport var RUM_SESSION_KEY = 'rum';\nexport function startRumSessionManager(configuration, lifeCycle) {\n var sessionManager = startSessionManager(configuration.cookieOptions, RUM_SESSION_KEY, function (rawTrackingType) {\n return computeSessionState(configuration, rawTrackingType);\n });\n sessionManager.expireObservable.subscribe(function () {\n lifeCycle.notify(7 /* SESSION_EXPIRED */);\n });\n sessionManager.renewObservable.subscribe(function () {\n lifeCycle.notify(8 /* SESSION_RENEWED */);\n });\n return {\n findTrackedSession: function (startTime) {\n var session = sessionManager.findActiveSession(startTime);\n if (!session || !isTypeTracked(session.trackingType)) {\n return;\n }\n var plan = session.trackingType === \"1\" /* TRACKED_WITH_SESSION_REPLAY */\n ? 2 /* WITH_SESSION_REPLAY */\n : 1 /* WITHOUT_SESSION_REPLAY */;\n return {\n id: session.id,\n plan: plan,\n sessionReplayAllowed: plan === 2 /* WITH_SESSION_REPLAY */,\n longTaskAllowed: configuration.trackLongTasks !== undefined\n ? configuration.trackLongTasks\n : configuration.oldPlansBehavior && plan === 2 /* WITH_SESSION_REPLAY */,\n resourceAllowed: configuration.trackResources !== undefined\n ? configuration.trackResources\n : configuration.oldPlansBehavior && plan === 2 /* WITH_SESSION_REPLAY */,\n };\n },\n };\n}\n/**\n * Start a tracked replay session stub\n */\nexport function startRumSessionManagerStub() {\n var session = {\n id: '00000000-aaaa-0000-aaaa-000000000000',\n plan: 1 /* WITHOUT_SESSION_REPLAY */,\n sessionReplayAllowed: false,\n longTaskAllowed: true,\n resourceAllowed: true,\n };\n return {\n findTrackedSession: function () { return session; },\n };\n}\nfunction computeSessionState(configuration, rawTrackingType) {\n var trackingType;\n if (hasValidRumSession(rawTrackingType)) {\n trackingType = rawTrackingType;\n }\n else if (!performDraw(configuration.sessionSampleRate)) {\n trackingType = \"0\" /* NOT_TRACKED */;\n }\n else if (!performDraw(configuration.sessionReplaySampleRate)) {\n trackingType = \"2\" /* TRACKED_WITHOUT_SESSION_REPLAY */;\n }\n else {\n trackingType = \"1\" /* TRACKED_WITH_SESSION_REPLAY */;\n }\n return {\n trackingType: trackingType,\n isTracked: isTypeTracked(trackingType),\n };\n}\nfunction hasValidRumSession(trackingType) {\n return (trackingType === \"0\" /* NOT_TRACKED */ ||\n trackingType === \"1\" /* TRACKED_WITH_SESSION_REPLAY */ ||\n trackingType === \"2\" /* TRACKED_WITHOUT_SESSION_REPLAY */);\n}\nfunction isTypeTracked(rumSessionType) {\n return (rumSessionType === \"2\" /* TRACKED_WITHOUT_SESSION_REPLAY */ ||\n rumSessionType === \"1\" /* TRACKED_WITH_SESSION_REPLAY */);\n}\n//# sourceMappingURL=rumSessionManager.js.map","import { Batch, combine, createHttpRequest, isTelemetryReplicationAllowed } from '@datadog/browser-core';\nexport function startRumBatch(configuration, lifeCycle, telemetryEventObservable, reportError, pageExitObservable) {\n var batch = makeRumBatch(configuration, reportError, pageExitObservable);\n lifeCycle.subscribe(11 /* RUM_EVENT_COLLECTED */, function (serverRumEvent) {\n if (serverRumEvent.type === \"view\" /* VIEW */) {\n batch.upsert(serverRumEvent, serverRumEvent.view.id);\n }\n else {\n batch.add(serverRumEvent);\n }\n });\n telemetryEventObservable.subscribe(function (event) { return batch.add(event, isTelemetryReplicationAllowed(configuration)); });\n return batch;\n}\nfunction makeRumBatch(configuration, reportError, pageExitObservable) {\n var primaryBatch = createRumBatch(configuration.rumEndpointBuilder);\n var replicaBatch;\n var replica = configuration.replica;\n if (replica !== undefined) {\n replicaBatch = createRumBatch(replica.rumEndpointBuilder);\n }\n function createRumBatch(endpointBuilder) {\n return new Batch(createHttpRequest(endpointBuilder, configuration.batchBytesLimit, reportError), configuration.batchMessagesLimit, configuration.batchBytesLimit, configuration.messageBytesLimit, configuration.flushTimeout, pageExitObservable);\n }\n function withReplicaApplicationId(message) {\n return combine(message, { application: { id: replica.applicationId } });\n }\n return {\n flushObservable: primaryBatch.flushObservable,\n add: function (message, replicated) {\n if (replicated === void 0) { replicated = true; }\n primaryBatch.add(message);\n if (replicaBatch && replicated) {\n replicaBatch.add(withReplicaApplicationId(message));\n }\n },\n upsert: function (message, key) {\n primaryBatch.upsert(message, key);\n if (replicaBatch) {\n replicaBatch.upsert(withReplicaApplicationId(message), key);\n }\n },\n };\n}\n//# sourceMappingURL=startRumBatch.js.map","import { SESSION_TIME_OUT_DELAY, relativeNow, ContextHistory } from '@datadog/browser-core';\n/**\n * We want to attach to an event:\n * - the url corresponding to its start\n * - the referrer corresponding to the previous view url (or document referrer for initial view)\n */\nexport var URL_CONTEXT_TIME_OUT_DELAY = SESSION_TIME_OUT_DELAY;\nexport function startUrlContexts(lifeCycle, locationChangeObservable, location) {\n var urlContextHistory = new ContextHistory(URL_CONTEXT_TIME_OUT_DELAY);\n var previousViewUrl;\n lifeCycle.subscribe(4 /* VIEW_ENDED */, function (_a) {\n var endClocks = _a.endClocks;\n urlContextHistory.closeActive(endClocks.relative);\n });\n lifeCycle.subscribe(2 /* VIEW_CREATED */, function (_a) {\n var startClocks = _a.startClocks;\n var viewUrl = location.href;\n urlContextHistory.add(buildUrlContext({\n url: viewUrl,\n referrer: !previousViewUrl ? document.referrer : previousViewUrl,\n }), startClocks.relative);\n previousViewUrl = viewUrl;\n });\n var locationChangeSubscription = locationChangeObservable.subscribe(function (_a) {\n var newLocation = _a.newLocation;\n var current = urlContextHistory.find();\n if (current) {\n var changeTime = relativeNow();\n urlContextHistory.closeActive(changeTime);\n urlContextHistory.add(buildUrlContext({\n url: newLocation.href,\n referrer: current.referrer,\n }), changeTime);\n }\n });\n function buildUrlContext(_a) {\n var url = _a.url, referrer = _a.referrer;\n return {\n url: url,\n referrer: referrer,\n };\n }\n return {\n findUrl: function (startTime) { return urlContextHistory.find(startTime); },\n stop: function () {\n locationChangeSubscription.unsubscribe();\n urlContextHistory.stop();\n },\n };\n}\n//# sourceMappingURL=urlContexts.js.map","import { addEventListener, instrumentMethodAndCallOriginal, Observable, shallowClone, } from '@datadog/browser-core';\nexport function createLocationChangeObservable(location) {\n var currentLocation = shallowClone(location);\n var observable = new Observable(function () {\n var stopHistoryTracking = trackHistory(onLocationChange).stop;\n var stopHashTracking = trackHash(onLocationChange).stop;\n return function () {\n stopHistoryTracking();\n stopHashTracking();\n };\n });\n function onLocationChange() {\n if (currentLocation.href === location.href) {\n return;\n }\n var newLocation = shallowClone(location);\n observable.notify({\n newLocation: newLocation,\n oldLocation: currentLocation,\n });\n currentLocation = newLocation;\n }\n return observable;\n}\nfunction trackHistory(onHistoryChange) {\n var stopInstrumentingPushState = instrumentMethodAndCallOriginal(history, 'pushState', {\n after: onHistoryChange,\n }).stop;\n var stopInstrumentingReplaceState = instrumentMethodAndCallOriginal(history, 'replaceState', {\n after: onHistoryChange,\n }).stop;\n var removeListener = addEventListener(window, \"popstate\" /* POP_STATE */, onHistoryChange).stop;\n return {\n stop: function () {\n stopInstrumentingPushState();\n stopInstrumentingReplaceState();\n removeListener();\n },\n };\n}\nfunction trackHash(onHashChange) {\n return addEventListener(window, \"hashchange\" /* HASH_CHANGE */, onHashChange);\n}\n//# sourceMappingURL=locationChangeObservable.js.map","import { jsonStringify, computeBytesCount, deepClone, noop, isExperimentalFeatureEnabled, SESSION_TIME_OUT_DELAY, ContextHistory, } from '@datadog/browser-core';\nexport var FEATURE_FLAG_CONTEXT_TIME_OUT_DELAY = SESSION_TIME_OUT_DELAY;\n/**\n * Start feature flag contexts\n *\n * Feature flag contexts follow the life of views.\n * A new context is added when a view is created and ended when the view is ended\n *\n * Note: we choose not to add a new context at each evaluation to save memory\n */\nexport function startFeatureFlagContexts(lifeCycle, computeBytesCountImpl) {\n if (computeBytesCountImpl === void 0) { computeBytesCountImpl = computeBytesCount; }\n if (!isExperimentalFeatureEnabled('feature_flags')) {\n return {\n findFeatureFlagEvaluations: function () { return undefined; },\n getFeatureFlagBytesCount: function () { return 0; },\n addFeatureFlagEvaluation: noop,\n };\n }\n var featureFlagContexts = new ContextHistory(FEATURE_FLAG_CONTEXT_TIME_OUT_DELAY);\n var bytesCountCache;\n lifeCycle.subscribe(4 /* VIEW_ENDED */, function (_a) {\n var endClocks = _a.endClocks;\n featureFlagContexts.closeActive(endClocks.relative);\n });\n lifeCycle.subscribe(2 /* VIEW_CREATED */, function (_a) {\n var startClocks = _a.startClocks;\n featureFlagContexts.add({}, startClocks.relative);\n bytesCountCache = undefined;\n });\n return {\n findFeatureFlagEvaluations: function (startTime) { return featureFlagContexts.find(startTime); },\n getFeatureFlagBytesCount: function () {\n var currentContext = featureFlagContexts.find();\n if (!currentContext) {\n return 0;\n }\n if (bytesCountCache === undefined) {\n bytesCountCache = computeBytesCountImpl(jsonStringify(currentContext));\n }\n return bytesCountCache;\n },\n addFeatureFlagEvaluation: function (key, value) {\n var currentContext = featureFlagContexts.find();\n if (currentContext) {\n currentContext[key] = deepClone(value);\n bytesCountCache = undefined;\n }\n },\n };\n}\n//# sourceMappingURL=featureFlagContext.js.map","import { isEmptyObject, includes, performDraw, ONE_SECOND, addTelemetryDebug, monitor } from '@datadog/browser-core';\nexport var MEASURES_PERIOD_DURATION = 10 * ONE_SECOND;\nvar currentPeriodMeasures;\nvar currentBatchMeasures;\nvar batchHasRumEvent;\nexport function startCustomerDataTelemetry(configuration, telemetry, lifeCycle, globalContextManager, userContextManager, featureFlagContexts, batchFlushObservable) {\n var customerDataTelemetryEnabled = telemetry.enabled && performDraw(configuration.customerDataTelemetrySampleRate);\n if (!customerDataTelemetryEnabled) {\n return;\n }\n initCurrentPeriodMeasures();\n initCurrentBatchMeasures();\n // We measure the data of every view updates even if there could only be one per batch due to the upsert\n // It means that contexts bytes count sums can be higher than it really is\n lifeCycle.subscribe(11 /* RUM_EVENT_COLLECTED */, function (event) {\n batchHasRumEvent = true;\n updateMeasure(currentBatchMeasures.globalContextBytes, !isEmptyObject(globalContextManager.get()) ? globalContextManager.getBytesCount() : 0);\n updateMeasure(currentBatchMeasures.userContextBytes, !isEmptyObject(userContextManager.get()) ? userContextManager.getBytesCount() : 0);\n var featureFlagContext = featureFlagContexts.findFeatureFlagEvaluations();\n var hasFeatureFlagContext = includes([\"view\" /* VIEW */, \"error\" /* ERROR */], event.type) &&\n featureFlagContext &&\n !isEmptyObject(featureFlagContext);\n updateMeasure(currentBatchMeasures.featureFlagBytes, hasFeatureFlagContext ? featureFlagContexts.getFeatureFlagBytesCount() : 0);\n });\n batchFlushObservable.subscribe(function (_a) {\n var bufferBytesCount = _a.bufferBytesCount, bufferMessagesCount = _a.bufferMessagesCount;\n // Don't measure batch that only contains telemetry events to avoid batch sending loop\n // It could happen because after each batch we are adding a customer data measures telemetry event to the next one\n if (!batchHasRumEvent) {\n return;\n }\n currentPeriodMeasures.batchCount += 1;\n updateMeasure(currentPeriodMeasures.batchBytesCount, bufferBytesCount);\n updateMeasure(currentPeriodMeasures.batchMessagesCount, bufferMessagesCount);\n mergeMeasure(currentPeriodMeasures.globalContextBytes, currentBatchMeasures.globalContextBytes);\n mergeMeasure(currentPeriodMeasures.userContextBytes, currentBatchMeasures.userContextBytes);\n mergeMeasure(currentPeriodMeasures.featureFlagBytes, currentBatchMeasures.featureFlagBytes);\n initCurrentBatchMeasures();\n });\n setInterval(monitor(sendCurrentPeriodMeasures), MEASURES_PERIOD_DURATION);\n}\nfunction sendCurrentPeriodMeasures() {\n if (currentPeriodMeasures.batchCount === 0) {\n return;\n }\n addTelemetryDebug('Customer data measures', currentPeriodMeasures);\n initCurrentPeriodMeasures();\n}\nfunction createMeasure() {\n return { min: Infinity, max: 0, sum: 0 };\n}\nfunction updateMeasure(measure, value) {\n measure.sum += value;\n measure.min = Math.min(measure.min, value);\n measure.max = Math.max(measure.max, value);\n}\nfunction mergeMeasure(target, source) {\n target.sum += source.sum;\n target.min = Math.min(target.min, source.min);\n target.max = Math.max(target.max, source.max);\n}\nfunction initCurrentPeriodMeasures() {\n currentPeriodMeasures = {\n batchCount: 0,\n batchBytesCount: createMeasure(),\n batchMessagesCount: createMeasure(),\n globalContextBytes: createMeasure(),\n userContextBytes: createMeasure(),\n featureFlagBytes: createMeasure(),\n };\n}\nfunction initCurrentBatchMeasures() {\n batchHasRumEvent = false;\n currentBatchMeasures = {\n globalContextBytes: createMeasure(),\n userContextBytes: createMeasure(),\n featureFlagBytes: createMeasure(),\n };\n}\n//# sourceMappingURL=startCustomerDataTelemetry.js.map","import { addDuration, addEventListeners, relativeNow } from '@datadog/browser-core';\nexport var MAX_PAGE_STATE_ENTRIES = 500;\nvar pageStateEntries = [];\nvar currentPageState;\nexport function startPageStateHistory() {\n addPageState(getPageState());\n var stop = addEventListeners(window, [\n \"pageshow\" /* PAGE_SHOW */,\n \"focus\" /* FOCUS */,\n \"blur\" /* BLUR */,\n \"visibilitychange\" /* VISIBILITY_CHANGE */,\n \"resume\" /* RESUME */,\n \"freeze\" /* FREEZE */,\n \"pagehide\" /* PAGE_HIDE */,\n ], function (event) {\n // Only get events fired by the browser to avoid false currentPageState changes done with custom events\n // cf: developer extension auto flush: https://github.com/DataDog/browser-sdk/blob/2f72bf05a672794c9e33965351964382a94c72ba/developer-extension/src/panel/flushEvents.ts#L11-L12\n if (!event.isTrusted) {\n return;\n }\n if (event.type === \"freeze\" /* FREEZE */) {\n addPageState(\"frozen\" /* FROZEN */);\n }\n else if (event.type === \"pagehide\" /* PAGE_HIDE */) {\n addPageState(event.persisted ? \"frozen\" /* FROZEN */ : \"terminated\" /* TERMINATED */);\n }\n else {\n addPageState(getPageState());\n }\n }, { capture: true }).stop;\n return {\n findAll: function (startTime, duration) {\n var entries = [];\n var endTime = addDuration(startTime, duration);\n for (var i = pageStateEntries.length - 1; i >= 0; i--) {\n var stateStartTime = pageStateEntries[i].startTime;\n if (stateStartTime >= endTime) {\n continue;\n }\n entries.unshift(pageStateEntries[i]);\n if (stateStartTime < startTime) {\n break;\n }\n }\n return entries.length ? entries : undefined;\n },\n stop: stop,\n };\n}\nfunction getPageState() {\n if (document.visibilityState === 'hidden') {\n return \"hidden\" /* HIDDEN */;\n }\n if (document.hasFocus()) {\n return \"active\" /* ACTIVE */;\n }\n return \"passive\" /* PASSIVE */;\n}\nexport function addPageState(nextPageState, maxPageStateEntries) {\n if (maxPageStateEntries === void 0) { maxPageStateEntries = MAX_PAGE_STATE_ENTRIES; }\n if (nextPageState === currentPageState) {\n return;\n }\n currentPageState = nextPageState;\n if (pageStateEntries.length === maxPageStateEntries) {\n pageStateEntries.shift();\n }\n pageStateEntries.push({ state: currentPageState, startTime: relativeNow() });\n}\nexport function resetPageStates() {\n pageStateEntries = [];\n currentPageState = undefined;\n}\n//# sourceMappingURL=pageStateHistory.js.map","import { sendToExtension, createPageExitObservable, addTelemetryConfiguration, startTelemetry, canUseEventBridge, getEventBridge, } from '@datadog/browser-core';\nimport { createDOMMutationObservable } from '../browser/domMutationObservable';\nimport { startPerformanceCollection } from '../browser/performanceCollection';\nimport { startRumAssembly } from '../domain/assembly';\nimport { startForegroundContexts } from '../domain/contexts/foregroundContexts';\nimport { startInternalContext } from '../domain/contexts/internalContext';\nimport { LifeCycle } from '../domain/lifeCycle';\nimport { startViewContexts } from '../domain/contexts/viewContexts';\nimport { startRequestCollection } from '../domain/requestCollection';\nimport { startActionCollection } from '../domain/rumEventsCollection/action/actionCollection';\nimport { startErrorCollection } from '../domain/rumEventsCollection/error/errorCollection';\nimport { startLongTaskCollection } from '../domain/rumEventsCollection/longTask/longTaskCollection';\nimport { startResourceCollection } from '../domain/rumEventsCollection/resource/resourceCollection';\nimport { startViewCollection } from '../domain/rumEventsCollection/view/viewCollection';\nimport { startRumSessionManager, startRumSessionManagerStub } from '../domain/rumSessionManager';\nimport { startRumBatch } from '../transport/startRumBatch';\nimport { startRumEventBridge } from '../transport/startRumEventBridge';\nimport { startUrlContexts } from '../domain/contexts/urlContexts';\nimport { createLocationChangeObservable } from '../browser/locationChangeObservable';\nimport { serializeRumConfiguration } from '../domain/configuration';\nimport { startFeatureFlagContexts } from '../domain/contexts/featureFlagContext';\nimport { startCustomerDataTelemetry } from '../domain/startCustomerDataTelemetry';\nimport { startPageStateHistory } from '../domain/contexts/pageStateHistory';\nimport { buildCommonContext } from '../domain/contexts/commonContext';\nexport function startRum(initConfiguration, configuration, recorderApi, globalContextManager, userContextManager, initialViewOptions) {\n var lifeCycle = new LifeCycle();\n lifeCycle.subscribe(11 /* RUM_EVENT_COLLECTED */, function (event) { return sendToExtension('rum', event); });\n var telemetry = startRumTelemetry(configuration);\n telemetry.setContextProvider(function () {\n var _a, _b;\n return ({\n application: {\n id: configuration.applicationId,\n },\n session: {\n id: (_a = session.findTrackedSession()) === null || _a === void 0 ? void 0 : _a.id,\n },\n view: {\n id: (_b = viewContexts.findView()) === null || _b === void 0 ? void 0 : _b.id,\n },\n action: {\n id: actionContexts.findActionId(),\n },\n });\n });\n var reportError = function (error) {\n lifeCycle.notify(12 /* RAW_ERROR_COLLECTED */, { error: error });\n };\n var featureFlagContexts = startFeatureFlagContexts(lifeCycle);\n if (!canUseEventBridge()) {\n var pageExitObservable = createPageExitObservable();\n pageExitObservable.subscribe(function (event) {\n lifeCycle.notify(9 /* PAGE_EXITED */, event);\n });\n var batch = startRumBatch(configuration, lifeCycle, telemetry.observable, reportError, pageExitObservable);\n startCustomerDataTelemetry(configuration, telemetry, lifeCycle, globalContextManager, userContextManager, featureFlagContexts, batch.flushObservable);\n }\n else {\n startRumEventBridge(lifeCycle);\n }\n var session = !canUseEventBridge() ? startRumSessionManager(configuration, lifeCycle) : startRumSessionManagerStub();\n var domMutationObservable = createDOMMutationObservable();\n var locationChangeObservable = createLocationChangeObservable(location);\n var _a = startRumEventCollection(lifeCycle, configuration, location, session, locationChangeObservable, domMutationObservable, function () { return buildCommonContext(globalContextManager, userContextManager, recorderApi); }, reportError), viewContexts = _a.viewContexts, foregroundContexts = _a.foregroundContexts, urlContexts = _a.urlContexts, actionContexts = _a.actionContexts, addAction = _a.addAction;\n addTelemetryConfiguration(serializeRumConfiguration(initConfiguration));\n startLongTaskCollection(lifeCycle, session);\n var pageStateHistory = startPageStateHistory();\n startResourceCollection(lifeCycle, configuration, session, pageStateHistory);\n var _b = startViewCollection(lifeCycle, configuration, location, domMutationObservable, locationChangeObservable, foregroundContexts, featureFlagContexts, recorderApi, initialViewOptions), addTiming = _b.addTiming, startView = _b.startView;\n var addError = startErrorCollection(lifeCycle, foregroundContexts, featureFlagContexts).addError;\n startRequestCollection(lifeCycle, configuration, session);\n startPerformanceCollection(lifeCycle, configuration);\n var internalContext = startInternalContext(configuration.applicationId, session, viewContexts, actionContexts, urlContexts);\n return {\n addAction: addAction,\n addError: addError,\n addTiming: addTiming,\n addFeatureFlagEvaluation: featureFlagContexts.addFeatureFlagEvaluation,\n startView: startView,\n lifeCycle: lifeCycle,\n viewContexts: viewContexts,\n session: session,\n getInternalContext: internalContext.get,\n };\n}\nfunction startRumTelemetry(configuration) {\n var telemetry = startTelemetry(\"browser-rum-sdk\" /* RUM */, configuration);\n if (canUseEventBridge()) {\n var bridge_1 = getEventBridge();\n telemetry.observable.subscribe(function (event) { return bridge_1.send('internal_telemetry', event); });\n }\n return telemetry;\n}\nexport function startRumEventCollection(lifeCycle, configuration, location, sessionManager, locationChangeObservable, domMutationObservable, buildCommonContext, reportError) {\n var viewContexts = startViewContexts(lifeCycle);\n var urlContexts = startUrlContexts(lifeCycle, locationChangeObservable, location);\n var foregroundContexts = startForegroundContexts();\n var _a = startActionCollection(lifeCycle, domMutationObservable, configuration, foregroundContexts), addAction = _a.addAction, actionContexts = _a.actionContexts;\n startRumAssembly(configuration, lifeCycle, sessionManager, viewContexts, urlContexts, actionContexts, buildCommonContext, reportError);\n return {\n viewContexts: viewContexts,\n foregroundContexts: foregroundContexts,\n urlContexts: urlContexts,\n addAction: addAction,\n actionContexts: actionContexts,\n stop: function () {\n viewContexts.stop();\n foregroundContexts.stop();\n },\n };\n}\n//# sourceMappingURL=startRum.js.map","import { getEventBridge } from '@datadog/browser-core';\nexport function startRumEventBridge(lifeCycle) {\n var bridge = getEventBridge();\n lifeCycle.subscribe(11 /* RUM_EVENT_COLLECTED */, function (serverRumEvent) {\n bridge.send('rum', serverRumEvent);\n });\n}\n//# sourceMappingURL=startRumEventBridge.js.map","import { toServerDuration, relativeToClocks, generateUUID } from '@datadog/browser-core';\nexport function startLongTaskCollection(lifeCycle, sessionManager) {\n lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {\n for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\n var entry = entries_1[_i];\n if (entry.entryType !== 'longtask') {\n break;\n }\n var session = sessionManager.findTrackedSession(entry.startTime);\n if (!session || !session.longTaskAllowed) {\n break;\n }\n var startClocks = relativeToClocks(entry.startTime);\n var rawRumEvent = {\n date: startClocks.timeStamp,\n long_task: {\n id: generateUUID(),\n duration: toServerDuration(entry.duration),\n },\n type: \"long_task\" /* LONG_TASK */,\n _dd: {\n discarded: false,\n },\n };\n lifeCycle.notify(10 /* RAW_RUM_EVENT_COLLECTED */, {\n rawRumEvent: rawRumEvent,\n startTime: startClocks.relative,\n domainContext: { performanceEntry: entry.toJSON() },\n });\n }\n });\n}\n//# sourceMappingURL=longTaskCollection.js.map","/**\n * Internal context keep returning v1 format\n * to not break compatibility with logs data format\n */\nexport function startInternalContext(applicationId, sessionManager, viewContexts, actionContexts, urlContexts) {\n return {\n get: function (startTime) {\n var viewContext = viewContexts.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"],"names":["clearTracingIfNeeded","context","status","isAborted","traceId","undefined","spanId","traceSampled","injectHeadersIfTracingAllowed","configuration","sessionManager","inject","getCrypto","findTrackedSession","propagatorTypes","tracingHeaders","tracingOption","allowedTracingUrls","match","url","TraceIdentifier","traceSampleRate","forEach","propagatorType","toDecimalString","traceparent","concat","toPaddedHexadecimalString","b3","window","crypto","msCrypto","this","buffer","Uint8Array","getRandomValues","prototype","toString","radix","high","readInt32","low","str","mod","Math","floor","Array","length","join","offset","validateAndBuildRumConfiguration","initConfiguration","_a","_b","_c","_d","_e","_f","applicationId","sessionReplaySampleRate","premiumSampleRate","replaySampleRate","display","tracingSampleRate","excludedActivityUrls","isArray","allowedTracingOrigins","service","tracingOptions_1","option","expectedItem","push","tracingOptions_2","legacyMatchOption","item","RegExp","test","convertLegacyMatchOptionToTracingOption","validateAndBuildTracingOptions","baseConfiguration","trackUserInteractions","trackInteractions","trackFrustrations","version","actionNameAttribute","oldPlansBehavior","trackViewsManually","trackResources","trackLongTasks","defaultPrivacyLevel","customerDataTelemetrySampleRate","getSelectedTracingPropagators","usedTracingPropagators","Set","add","buildCommonContext","globalContextManager","userContextManager","recorderApi","getContext","user","hasReplay","isRecording","makeRumPublicApi","startRumImpl","ignoreInitIfSyntheticsWillInjectRum","isAlreadyInitialized","getInternalContextStrategy","getInitConfigurationStrategy","bufferApiCalls","addTimingStrategy","name","time","startViewStrategy","options","startClocks","addActionStrategy","action","commonContext","addErrorStrategy","providedError","addFeatureFlagEvaluationStrategy","key","value","doStartRum","initialViewOptions","startRumResults","startView","addAction","addError","addTiming","addFeatureFlagEvaluation","getInternalContext","drain","onRumStart","lifeCycle","session","viewContexts","monitor","rumPublicApi","init","clientToken","sessionSampleRate","overrideInitConfigurationForBridge","location","protocol","canHandleSession","silentMultipleInit","canInitRum","beforeInitCalls","addRumGlobalContext","setGlobalContextProperty","setContextProperty","removeRumGlobalContext","remove","removeGlobalContextProperty","removeContextProperty","getRumGlobalContext","get","getGlobalContext","setRumGlobalContext","set","setGlobalContext","setContext","clearGlobalContext","clearContext","startTime","getInitConfiguration","type","error","handlingStack","setUser","newUser","getUser","setUserProperty","property","sanitizedProperty","removeUserProperty","removeUser","clearUser","startSessionReplayRecording","start","stopSessionReplayRecording","stop","getMutationObserverConstructor","constructor","browserWindow","Zone","getZoneJsOriginalValue","MutationObserver","patchedInstance","originalInstance","FAKE_INITIAL_DOCUMENT","RESOURCE_TYPES","initiatorType","_","path","exec","areInOrder","numbers","_i","arguments","i","computePerformanceResourceDetails","entry","validEntry","toValidEntry","fetchStart","redirectStart","redirectEnd","domainLookupStart","domainLookupEnd","connectStart","secureConnectionStart","connectEnd","requestStart","responseStart","details","download","formatTiming","responseEnd","first_byte","connect","ssl","dns","hasRedirection","redirect","origin","end","duration","computeSize","decodedBodySize","isAllowedRequestUrl","isIntakeUrl","isTextNode","node","nodeType","Node","TEXT_NODE","isElementNode","ELEMENT_NODE","isNodeShadowHost","Boolean","shadowRoot","isNodeShadowRoot","host","DOCUMENT_FRAGMENT_NODE","getChildNodes","childNodes","getParentNode","parentNode","INITIAL_DOCUMENT_OUTDATED_TRACE_ID_THRESHOLD","getDocumentTraceId","document","data","traceIdMeta","querySelector","traceTimeMeta","createDocumentTraceData","content","getDocumentTraceDataFromMeta","comment","getTraceCommentFromNode","body","findTraceComment","getDocumentTraceDataFromComment","traceTime","rawTraceTime","Number","COMMENT_NODE","isCommentNode","supportPerformanceObject","performance","supportPerformanceTimingEvent","entryType","PerformanceObserver","supportedEntryTypes","includes","startPerformanceCollection","callback","timing","handleRumPerformanceEntries","runOnReadyState","forcedAttributes","getEntriesByType","navigationEntry","toJSON","relativePerformanceTiming","computeRelativePerformanceTiming","href","performanceEntries_1","getEntries","handlePerformanceEntryList_1","entries","mainEntries","experimentalEntries","observe","buffered","e","apply","entryTypes","addEventListener","clearResourceTimings","sendFakeTiming","retrieveNavigationTiming","startTimeStamp","timingSent","removeEventListeners","evt","cancelable","processingStart","timeStamp","sendTimingIfPointerIsNotCancelled","sendTiming","passive","capture","event","once","delay","retrieveFirstInputTiming","result","numberKey","timingElement","rumAllowedPerformanceEntries","filter","loadEventEnd","isIncompleteNavigation","isForbiddenResource","notify","viewportObservable","viewport","initViewportObservable","observable","updateDimension","getViewportDimension","throttled","visual","visualViewport","width","scale","height","innerWidth","innerHeight","getDisplayContext","subscribe","viewportDimension","unsubscribe","VIEW_EVENTS_MODIFIABLE_FIELD_PATHS","OTHER_EVENTS_MODIFIABLE_FIELD_PATHS","startRumAssembly","urlContexts","actionContexts","reportError","eventRateLimiters","createEventRateLimiter","eventRateLimiterThreshold","syntheticsContext","testId","resultId","test_id","result_id","injected","getSyntheticsContext","ciTestContext","testExecutionId","Cypress","env","test_execution_id","getCiTestContext","rawRumEvent","domainContext","savedCommonContext","customerContext","viewContext","findView","urlContext","findUrl","actionId","findActionId","rumContext","_dd","format_version","drift","plan","browser_sdk_version","application","id","date","source","view","referrer","indexOf","synthetics","ci_test","serverRumEvent","has_replay","usr","beforeSend","limitModification","rateLimitReached","isLimitReached","shouldSend","MAX_NUMBER_OF_SELECTABLE_FOREGROUND_PERIODS","MAX_NUMBER_OF_STORED_FOREGROUND_PERIODS","foregroundPeriods","startForegroundContexts","hasFocus","addNewForegroundPeriod","onFocusChange","onBlurChange","stopForegroundTracking","isTrusted","stopBlurTracking","closeForegroundPeriod","isInForegroundAt","selectInForegroundPeriodsFor","currentForegroundPeriod","now","foregroundPeriod","eventStartTime","eventEndTime","filteredForegroundPeriods","earliestIndex","max","startDuration","endTime","endDuration","unshift","LifeCycle","callbacks","eventType","eventCallbacks","_this","other","VIEW_CONTEXT_TIME_OUT_DELAY","nextRequestIndex","startRequestCollection","tracer","traceFetch","input","Request","headers","Object","keys","append","headers_1","Headers","header","traceXhr","xhr","setRequestHeader","startTracer","subscription","rawContext","state","requestIndex","getNextRequestIndex","method","trackXhr","clonedResponse","response","readBytesFromStream","bytesLimit","POSITIVE_INFINITY","collectStreamBody","waitForResponseToComplete","responseType","trackFetch","trackEventCounts","isChildEvent","onChange","eventCounts","errorCount","longTaskCount","resourceCount","actionCount","frustrationCount","frustration","PAGE_ACTIVITY_VALIDATION_DELAY","PAGE_ACTIVITY_END_DELAY","waitPageActivityEnd","domMutationObservable","pageActivityEndCallback","maxDuration","pageActivityObservable","firstRequestIndex","subscriptions","pendingRequestsCount","notifyPageActivity","some","isExcludedUrl","startEvent","request","stopTrackingWindowOpen","instrumentMethod","before","s","isBusy","createPageActivityObservable","pageActivityEndTimeoutId","hasCompleted","validationTimeoutId","complete","hadActivity","maxDurationTimeoutId","pageActivitySubscription","lastChangeTime","doWaitPageActivityEnd","requestUrl","MAX_DURATION_BETWEEN_CLICKS","MAX_DISTANCE_BETWEEN_CLICKS","createClickChain","firstClick","onFinalize","maxDurationBetweenClicksTimeout","bufferedClicks","appendClick","click","stopObservable","tryFinalize","dontAcceptMoreClick","every","isStopped","tryAppend","first","second","target","sqrt","pow","clientX","clientY","DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE","getActionNameFromElement","element","userProgrammaticAttribute","getActionNameFromElementProgrammatically","getActionNameFromElementForStrategies","priorityStrategies","fallbackStrategies","targetElement","programmaticAttribute","elementWithAttribute","supportsElementClosestResult","HTMLElement","supportsElementClosest","closest","hasAttribute","parentElement","truncate","normalizeWhitespace","getAttribute","trim","supportsLabelPropertyResult","HTMLInputElement","supportsLabelProperty","labels","getTextualContent","label","ownerDocument","querySelectorAll","htmlFor","nodeName","labelledByAttribute","split","map","refElement","getElementById","MAX_PARENTS_TO_CONSIDER","strategies","recursionCounter","strategies_1","name_1","strategy","trimmedName","replace","isContentEditable","text_1","innerText","removeTextFromElements","query","list","index","element_1","textToReplace","textContent","supportScopeSelectorCache","STABLE_ATTRIBUTES","GLOBALLY_UNIQUE_SELECTOR_GETTERS","getStableAttributeSelector","isGeneratedValue","UNIQUE_AMONG_CHILDREN_SELECTOR_GETTERS","tagName","classList","className","getSelectorFromElement","targetElementSelector","globallyUniqueSelector","findSelector","isSelectorUniqueGlobally","isSelectorUniqueAmongSiblings","combineSelector","getPositionSelector","selector","getAttributeSelector","STABLE_ATTRIBUTES_1","attributeName","sibling","firstElementChild","elementIndex","nextElementSibling","selectorGetters","predicate","childSelector","selectorGetters_1","elementSelector","selectorGetter","fullSelector","supportScopeSelector","parent","child","isSelectionEmpty","selection","getSelection","isCollapsed","isValidPointerEvent","Element","isPrimary","MIN_CLICKS_PER_SECOND_TO_CONSIDER_RAGE","computeFrustration","clicks","rageClick","getUserActivity","isRage","addFrustration","isDead","hasError","hasSelectionChanged","DEAD_CLICK_EXCLUDE_SELECTOR","hasPageActivity","CLICK_ACTION_MAX_DURATION","ACTION_CONTEXT_TIME_OUT_DELAY","trackClickActions","currentClickChain","history","reset","stopClickChain","selectionEmptyAtPointerDown","clickContext","onPointerDown","onPointerUp","userActivity","listeners","stopActionEventsListener","pointerDownEvent","find","clickActionBase","position","rect","getBoundingClientRect","round","x","left","y","top","computeClickActionBase","hadActivityOnPointerDown","pageActivityEndEvent","processPointerDown","appendClickToClickChain","newClick","stopWaitPageActivityEnd","discard","validate","viewEndedSubscription","endClocks","stopSubscription","startClickAction","localUserActivity_1","listener","findAll","rageClick_1","clone","finalizeClicks","activityEndTime","historyEntry","relative","eventCountsSubscription","frustrationTypes","newActivityEndTime","close","frustrationType","domEvents","clickAction","counts","events","processAction","foregroundContexts","autoActionProperties","isAutoAction","loading_time","count","long_task","resource","actionEvent","inForeground","in_foreground","trackFirstHiddenSingleton","startErrorCollection","featureFlagContexts","errorObservable","consoleError","message","stack","handling","trackConsoleError","trackRuntimeError","subtype","trackReportError","handling_stack","causes","source_type","featureFlagContext","findFeatureFlagEvaluations","feature_flags","originalError","processError","stackTrace","Error","computeStackTrace","rawError","nonErrorPrefix","doStartErrorCollection","matchRequestTiming","sameNameEntries","getEntriesByName","candidates","errorMargin","startResourceCollection","pageStateHistory","matchingTiming","correspondingTimingOverrides","computePerformanceEntryMetrics","tracingInfo","hasBeenTraced","span_id","trace_id","rule_psr","getRulePsr","computeRequestTracingInfo","indexingInfo","computeIndexingInfo","durationOverrideInfo","computedDuration","performanceEntryDuration","computed_duration","performance_entry_duration","override_duration_diff","computeDurationOverrideInfo","pageStateInfo","computePageStateInfo","resourceEvent","status_code","performanceEntry","requestInput","requestInit","processRequest","entries_1","processResourceEntry","RESOURCE_TYPES_1","isType","computeResourceKind","entryMetrics","computeEntryTracingInfo","size","resourceStart","discarded","resourceAllowed","page_states","page_was_discarded","String","wasDiscarded","trackFirstHidden","eventTarget","visibilityState","Infinity","TIMING_MAXIMUM_DELAY","trackInitialViewTimings","timings","setTimings","newTimings","stopNavigationTracking","domComplete","domContentLoaded","domContentLoadedEventEnd","domInteractive","loadEvent","firstByte","trackNavigationTimings","stopFCPTracking","firstHidden","fcpEntry","trackFirstContentfulPaintTiming","firstContentfulPaint","stopLCPTracking","firstInteractionTimestamp","stopEventListener","unsubscribeLifeCycle","lcpEntry","trackLargestContentfulPaintTiming","largestContentfulPaint","stopFIDTracking","firstInputEntry","firstInputDelay","firstInputTime","trackFirstInputTimings","trackViewMetrics","scheduleViewUpdate","loadingType","viewStart","stopCLSTracking","viewMetrics","loadType","isWaitingForLoadEvent","isWaitingForActivityLoadingTime","loadingTimeCandidates","invokeCallbackIfAllCandidatesAreReceived","setLoadEvent","trackLoadingTime","newLoadingTime","loadingTime","stopLoadingTimeTracking","cumulativeLayoutShift","maxClsValue","update","slidingSessionWindow","hadRecentInput","trackCumulativeLayoutShift","KEEP_TRACKING_EVENT_COUNTS_AFTER_VIEW_DELAY","THROTTLE_VIEW_UPDATE_PERIOD","SESSION_KEEP_ALIVE_INTERVAL","trackViews","locationChangeObservable","areViewsTrackedAutomatically","locationChangeSubscription","initialView","newView","updateTimings","scheduleUpdate","trackInitialView","stopInitialViewTracking","currentView","stopViewLifeCycle","trackViewChange","pageExitEvent","reason","triggerUpdate","keepAliveInterval","setInterval","clearInterval","startViewLifeCycle","viewOptions","currentLocation","otherLocation","hash","correspondingId","oldLocation","newLocation","pathname","substr","getPathFromHash","renewViewOnLocationChange","initialLocation","customTimings","documentVersion","triggerViewUpdate","leading","cancelScheduleViewUpdate","cancel","stopViewMetricsTracking","viewId","scheduleStop","trackViewEventCounts","scheduleStopEventCountsTracking","currentEnd","isActive","clocks","relativeTime","sanitized","sanitizeTiming","slice","startViewCollection","replayStats","getReplayStats","viewEvent","document_version","replay_stats","cumulative_layout_shift","dom_complete","dom_content_loaded","dom_interactive","first_contentful_paint","first_input_delay","first_input_time","is_active","largest_contentful_paint","load_event","discardNegativeDuration","loading_type","time_spent","in_foreground_periods","custom_timings","processViewUpdate","RUM_SESSION_KEY","startRumSessionManager","cookieOptions","rawTrackingType","trackingType","hasValidRumSession","isTracked","isTypeTracked","computeSessionState","expireObservable","renewObservable","findActiveSession","sessionReplayAllowed","longTaskAllowed","rumSessionType","makeRumBatch","pageExitObservable","replicaBatch","primaryBatch","createRumBatch","rumEndpointBuilder","replica","endpointBuilder","batchBytesLimit","batchMessagesLimit","messageBytesLimit","flushTimeout","withReplicaApplicationId","flushObservable","replicated","upsert","URL_CONTEXT_TIME_OUT_DELAY","createLocationChangeObservable","onHistoryChange","stopInstrumentingPushState","stopInstrumentingReplaceState","removeListener","onHashChange","stopHistoryTracking","onLocationChange","after","stopHashTracking","FEATURE_FLAG_CONTEXT_TIME_OUT_DELAY","currentPeriodMeasures","currentBatchMeasures","batchHasRumEvent","MEASURES_PERIOD_DURATION","sendCurrentPeriodMeasures","batchCount","initCurrentPeriodMeasures","updateMeasure","measure","sum","min","mergeMeasure","batchBytesCount","batchMessagesCount","globalContextBytes","userContextBytes","featureFlagBytes","initCurrentBatchMeasures","currentPageState","MAX_PAGE_STATE_ENTRIES","pageStateEntries","getPageState","addPageState","nextPageState","maxPageStateEntries","shift","startRum","sendToExtension","telemetry","bridge_1","send","startRumTelemetry","setContextProvider","computeBytesCountImpl","getFeatureFlagBytesCount","bytesCountCache","closeActive","currentContext","startFeatureFlagContexts","bridge","startRumEventBridge","batch","telemetryEventObservable","startRumBatch","batchFlushObservable","enabled","getBytesCount","hasFeatureFlagContext","bufferBytesCount","bufferMessagesCount","startCustomerDataTelemetry","startRumSessionManagerStub","observer","attributes","characterData","childList","subtree","disconnect","viewContextHistory","buildViewContext","startViewContexts","previousViewUrl","urlContextHistory","viewUrl","buildUrlContext","current","changeTime","startUrlContexts","startActionCollection","startRumEventCollection","baseSerializedConfiguration","premium_sample_rate","replay_sample_rate","session_replay_sample_rate","trace_sample_rate","action_name_attribute","use_allowed_tracing_origins","use_allowed_tracing_urls","selected_tracing_propagators","default_privacy_level","use_excluded_activity_urls","track_frustrations","track_views_manually","track_user_interactions","serializeRumConfiguration","startLongTaskCollection","stateStartTime","persisted","internalContext","application_id","session_id","user_action","startInternalContext"],"sourceRoot":""}