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OAAO,wBAAW,iJACxB,UAAM,OAAO,yBAAY,0HACzB,UAAM,OAAO,yBAAY,sFACzB,UAAM,OAAO,yBAAY,yDACzB,UAAM,OAAO,yBAAY,yFACzB,IAAMha,EAAA,WAAO,yBAAY,EAAC,2EAC3B,EAEaia,GAAe,CAAG,EAElBC,GAAa,CACxB,cAAe,CAAC,EAAE,EAClB,wCAAyC,CAAC,EAAE,EAC5C,aAAc,CAAC,EAAE,EACjB,2BAA4B,CAAC,EAAE,CAAC,CAAC,CAAC,EAClC,6BAA8B,CAAC,EAAE,CAAC,CAAC,CAAC,EACpC,qBAAsB,CAAC,EAAE,EACzB,yDAA0D,CAAC,EAAE,CAAC,CAAC,CAAC,EAChE,0BAA2B,CAAC,EAAE,CAAC,CAAC,CAAC,EACjC,sCAAuC,CAAC,EAAE,CAAC,CAAC,CAAC,EAC7C,4BAA6B,CAAC,EAAE,CAAC,CAAC,CAAC,EACnC,OAAQ,CAAC,EAAE,EACX,yBAA0B,CAAC,EAAE,CAAC,CAAC,CAAC,CAC/B,EAEUC,GAAQ,CACpB,YAAaC,KAA6B,CAAC,CAAE,MAAAvnB,CAAK,IAAO,CAAE,QAAQ,MAAMA,CAAK,IAE9E,QAAU,IAAM,EACjB","names":["redefinePublicPath","warn","code","secondary","PREFIX","DEFAULT_KEY","DEFAULT_EXPIRES_MS","DEFAULT_INACTIVE_MS","SESSION_EVENTS","SESSION_EVENT_TYPES","MODE","FEATURE_NAMES","featurePriority","FEATURE_NAME","SR_EVENT_EMITTER_TYPES","AVG_COMPRESSION","RRWEB_EVENT_TYPES","CHECKOUT_MS","ABORT_REASONS","QUERY_PARAM_PADDING","TRIGGERS","now","isBrowserScope","isWorkerScope","globalScope","loadedAsDeferredBrowserScript","_a","initiallyHidden","initialLocation","isiOS","iOSBelow16","ffVersion","match","_b","supportsSendBeacon","originTime","uuidv4Template","getRandomValue","valueTable","tableIndex","generateUuid","crypto","randomValueTable","randomValueIndex","templateInput","generateRandomHexString","length","chars","i","generateSpanId","generateTraceId","AgentBase","agentIdentifier","__privateAdd","_callMethod","__publicField","name","attributes","__privateMethod","callMethod_fn","host","value","persist","error","customAttributes","callback","timeStamp","id","featureNames","message","options","parent","functionName","methodName","args","LOG_LEVELS","LOGGING_EVENT_EMITTER_CHANNEL","isValidSelector","selector","defaults","gosNREUM","gosNREUMInfo","nr","externallySupplied","gosNREUMLoaderConfig","gosNREUMInit","gosNREUMOriginals","setNREUMInitializedAgent","newAgentInstance","getNREUMInitializedAgent","addToNREUM","fnName","fn","gosCDN","getModeledObject","obj","model","output","target","key","e","err","nrMask","hiddenState","val","_cache","missingAgentIdError","getConfiguration","setConfiguration","agentInst","getConfigurationValue","path","parts","isEnabled","getEnabledFeatures","enabledFeatures","featureName","nrDefaults","isValid","info","getInfo","setInfo","VERSION","BUILD_ENV","DIST_METHOD","RRWEB_VERSION","harvestCount","readonly","getRuntime","setRuntime","has","getOrSet","prop","getVal","EventContext","contextId","bundleId","globalInstance","ee","old","debugId","handlers","bufferGroupMap","emitters","isolatedBacklog","emitter","addEventListener","removeEventListener","emit","getOrCreate","listeners","context","bufferEventsByGroup","abort","isBuffering","aborted","contextOrStore","type","force","bubble","ctx","handlersArray","len","bufferGroup","getBuffer","types","group","eventBuffer","_","handleEE","handle","defaultRegister","registerWithSpecificEmitter","handler","groupHandlers","list","registry","registerDrain","item","curateRegistry","deregisterDrain","drainGroup","checkCanDrainAll","drain","items","values","a","b","activateGroup","baseEE","bufferedEventsInGroup","emitEvent","eventType","handlerRegistrationList","registration","evt","sourceEE","eventListenerOpts","useCapture","abortSignal","windowAddEventListener","event","listener","capture","documentAddEventListener","checkState","onWindowLoad","cb","onDOMContentLoaded","SUPPORTABILITY_METRIC","CUSTOM_METRIC","SUPPORTABILITY_METRIC_CHANNEL","CUSTOM_METRIC_CHANNEL","apiMethods","asyncApiMethods","bufferLog","level","isValidLogLevel","logLevel","flag","inWrapper","createWrapperWithEmitter","always","wrapFn","inPlace","prefix","getContext","notWrappable","nrWrapper","copy","originalThis","result","report","safeEmit","methods","prependMethodPrefix","method","arr","store","prev","from","to","keys","wrapLogger","sharedEE","loggerFn","scopedEE","wfn","setTopLevelCallers","f","caller","returnVals","replayRunning","setAPI","forceDrain","runSoftNavOverSpa","apiInterface","instanceEE","tracerEE","isRunning","spaPrefix","apiCall","appendJsAttribute","apiName","addToBrowserStorage","currentInfo","persistAttribute","InteractionHandle","InteractionApiProto","contextStore","ixn","hasCb","notSpa","lazyLoad","__vitePreload","getLoaderConfig","setLoaderConfig","GLOBAL_EVENT_NAMESPACE","dispatchGlobalEvent","detail","sentIds","activatedFeatures","activateFeatures","flags","alreadySetOnce","configure","agent","opts","loaderType","init","loader_config","runtime","exposed","updatedInit","internalTrafficList","getFeatureDependencyNames","feature","FeatureBase","aggregator","canEnableSessionTracking","agentId","hasReplayPrerequisite","isPreloadAllowed","buildNRMetaNode","timestamp","timeKeeper","correctedTimestamp","debounce","func","timeout","leading","timer","single","called","InstrumentBase","auto","_shouldImportAgg","argsObjFromInstrument","loadedSuccessfully","resolve","importLater","session","setupAgentSession","shouldImportAgg_fn","lazyFeatureLoader","Aggregate","CONSTANTS.FEATURE_NAME","SharedContext","Aggregator","params","newMetrics","customParams","bucket","aggregateMetrics","metrics","oldMetrics","oldMetric","newMetric","updateMetric","mergeMetric","results","hasData","metric","updateCounterMetric","createMetricObject","Agent","PageViewEvent","instr","featuresToStart","InstrumentCtor","missingDependencies","featName","newrelic","_c","_d","subscribeToVisibilityChange","toHiddenOnly","handleVisibilityChange","getCircularReplacer","seen","stringify","UncaughtError","filename","lineno","colno","castError","canTrustError","castPromiseRejectionEvent","promiseRejectionEvent","castErrorEvent","errorEvent","_abort","_replayRunning","__privateGet","__privateSet","abort_fn","index","dataSize","data","wrapped","XHR","ADD_EVENT_LISTENER","REMOVE_EVENT_LISTENER","wrapEvents","findEventListenerProtoAndCb","wrapNode","originalListener","wrapHandleEvent","node","uniqueListener","object","rest","step","XHR_PROPS","wrapXhr","contextualEE","OrigXHR","MutationObserver","Promise","setImmediate","READY_STATE_CHANGE","pendingXhrs","newXHR","xhr","wrapXHR","getObject","wrapOnreadystatechange","enqueuePendingXhr","resolved","toggle","dummyNode","drainPendingXhrs","bodyPrefix","bodyMethods","Req","Res","proto","wrapFetch","wrapPromiseMethod","res","size","dtPayload","origPromiseFromFetch","parseUrl","url","parsedUrl","returnVal","DT","parsedOrigin","loaderConfig","accountId","trustKey","spanId","traceId","payload","appId","version","transactionId","parentType","sampled","priority","hasBtoa","allowed","dtConfig","dt","allowedOrigin","responseSizeFromXhr","lastSize","denyList","shouldCollectEvent","hasUndefinedHostname","parsed","domainMatchesPattern","comparePath","setDenyList","denyListConfig","firstSlash","pathname","hostname","pattern","domain","handlersLen","origRequest","origXHR","initiators","resource","addUrl","subscribeToEvents","onNewXhr","onOpenXhrStart","onOpenXhrEnd","onSendXhrStart","onXhrCbTime","onXhrLoadAdded","onXhrLoadRemoved","onXhrResolved","onAddEventListenerEnd","onRemoveEventListenerEnd","onFnEnd","onFetchBeforeStart","onFetchStart","onFnStart","onFetchDone","end","captureXhrData","added","time","onload","idString","addHeaders","clone","headersObj","fetchArguments","responseSize","header","HISTORY_FNS","wrapHistory","globalEE","BST_RESOURCE","RESOURCE","START","END","FN_START","FN_END","PUSH_STATE","MAX_NODES_PER_HARVEST","CONSTANTS","thisInstrumentEE","observer","entries","INTERACTION_EVENTS","MAX_TIMER_BUDGET","CB_START","INTERACTION_API","REMAINING","INTERACTION","SPA_NODE","JSONP_NODE","FETCH_START","FETCH_DONE","FETCH_BODY","JSONP_END","originalSetTimeout","BODY","CB_END","JS_TIME","FETCH","domInsertMethods","wrapJsonP","CALLBACK_REGEX","PARENT_REGEX","VALUE_REGEX","wrapElement","el","isScript","isValidElement","callbackName","extractCallbackName","discoverParent","validCallback","onLoad","onError","src","matches","discoverValue","longKey","remaining","wrapPromise","promiseEE","promiseWrapper","prevPromiseObj","wrap","WrappedPromise","executor","wrappedExecutor","newCustomPromiseInst","prevStaticFn","subPromises","finalized","sub","setNrId","origFnCallWithThis","overwrite","prevPromiseOrigThen","trigger","SET_TIMEOUT","SET_INTERVAL","CLEAR_TIMEOUT","DASH","TIMER_FNS","wrapTimer","interval","wrapMutation","OriginalObserver","depth","startHash","jsonpEE","timerEE","xhrEE","eventsEE","fetchEE","historyEE","mutationEE","startTimestamp","endTimestamp","trackURLChange","unusedArgs","hashChangedDuringCb","_canPreloadRecorder","_preloadStartRecording","_apiStartOrRestartReplay","_mode","_alreadyStarted","apiStartOrRestartReplay_fn","canPreloadRecorder_fn","preloadStartRecording_fn","Recorder","OBSERVED_EVENTS","OBSERVED_WINDOW_EVENTS","RAGE_CLICK_THRESHOLD_EVENTS","RAGE_CLICK_THRESHOLD_MS","agentInit","genericEventSourceConfigs","x","INTERACTION_TRIGGERS","API_TRIGGER_NAME","INTERACTION_TYPE","NODE_TYPE","INTERACTION_STATUS","UI_WAIT_INTERVAL","Instrument","oncePerFrame","domObserver","domChanges","processUserInteraction","BrowserAgent","InstrumentXhr","InstrumentPageViewEvent","InstrumentPageViewTiming","InstrumentSessionTrace","InstrumentMetrics","InstrumentErrors","InstrumentSpa","InstrumentSoftNav","InstrumentSessionReplay","InstrumentGenericEvents","InstrumentLogs","newrelicBrowserAgent","currentUser","track","telemetry","customProperties","setupNewRelic","applicationID","portalHostUrl","signedInUser","user","arrayBufferToBase64","buffer","bytes","string","encoder","sha256","text","textUint8","internalDomains","isInternalUser","email","localpart","setupPendo","apiKey","p","n","d","o","v","w","y","z","m","setupAppInsights","handleError","status","newRelicTrack","matchers","switch_value","dirty","create_if_block_1","insert_hydration","div","anchor","create_if_block","stores","$$props","page","constructors","components","form","data_0","data_1","data_2","afterUpdate","mounted","navigated","title","onMount","unsubscribe","$$invalidate","tick","$$value","nodes","server_loads","dictionary","hooks","client_hooks.handleError"],"sources":["../../../../../../node_modules/@newrelic/browser-agent/dist/esm/loaders/configure/public-path.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/util/console.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/session/constants.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/loaders/features/features.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/session_replay/constants.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/timing/now.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/constants/runtime.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/ids/unique-id.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/loaders/agent-base.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/logging/constants.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/dom/query-selector.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/window/nreum.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/config/configurable.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/config/init.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/loaders/features/enabled-features.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/config/info.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/constants/env.npm.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/config/runtime.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/util/get-or-set.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/event-emitter/event-context.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/ids/bundle-id.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/event-emitter/contextual-ee.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/event-emitter/handle.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/event-emitter/register-handler.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/drain/drain.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/event-listener/event-listener-opts.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/window/load.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/metrics/constants.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/loaders/api/api-methods.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/logging/shared/utils.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/wrap/wrap-function.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/wrap/wrap-logger.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/loaders/api/api.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/config/loader-config.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/dispatch/global-event.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/util/feature-flags.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/loaders/configure/configure.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/loaders/features/featureDependencies.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/utils/feature-base.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/utils/feature-gates.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/session_replay/shared/utils.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/util/invoke.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/utils/instrument-base.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/page_view_event/constants.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/page_view_event/instrument/index.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/context/shared-context.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/aggregate/aggregator.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/loaders/agent.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/window/page-visibility.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/page_view_timing/constants.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/page_view_timing/instrument/index.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/metrics/instrument/index.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/jserrors/constants.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/util/stringify.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/jserrors/shared/uncaught-error.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/jserrors/shared/cast-error.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/jserrors/instrument/index.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/ids/id.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/util/data-size.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/wrap/wrap-events.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/wrap/wrap-xhr.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/wrap/wrap-fetch.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/url/parse-url.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/ajax/instrument/distributed-tracing.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/ajax/instrument/response-size.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/ajax/constants.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/deny-list/deny-list.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/ajax/instrument/index.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/wrap/wrap-history.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/session_trace/constants.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/session_trace/instrument/index.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/spa/constants.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/wrap/wrap-jsonp.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/wrap/wrap-promise.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/wrap/wrap-timer.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/common/wrap/wrap-mutation.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/spa/instrument/index.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/session_replay/instrument/index.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/generic_events/constants.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/generic_events/instrument/index.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/logging/instrument/index.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/soft_navigations/constants.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/features/soft_navigations/instrument/index.js","../../../../../../node_modules/@newrelic/browser-agent/dist/esm/loaders/browser-agent.js","../../../../../../src/lib/helpers/newRelic.js","../../../../../../src/lib/helpers/pendo.js","../../../../../../src/hooks.client.js","../../../../../generated/client-optimized/matchers.js","../../../../../generated/root.svelte","../../../../../generated/client-optimized/app.js"],"sourcesContent":["export const redefinePublicPath = () => {\n // We don't support setting public path in webpack via NPM build.\n};","/* eslint no-console: [\"error\", { allow: [\"debug\"] }] */\n\n/**\n * A helper method to warn to the console with New Relic: decoration\n * @param {string} message The primary message to warn\n * @param {*} [secondary] Secondary data to include, usually an error or object\n * @returns\n */\nexport function warn(code, secondary) {\n if (typeof console.debug !== 'function') return;\n console.debug(\"New Relic Warning: https://github.com/newrelic/newrelic-browser-agent/blob/main/docs/warning-codes.md#\".concat(code), secondary);\n}","export const PREFIX = 'NRBA';\nexport const DEFAULT_KEY = 'SESSION';\nexport const DEFAULT_EXPIRES_MS = 14400000;\nexport const DEFAULT_INACTIVE_MS = 1800000;\nexport const SESSION_EVENTS = {\n STARTED: 'session-started',\n PAUSE: 'session-pause',\n RESET: 'session-reset',\n RESUME: 'session-resume',\n UPDATE: 'session-update'\n};\nexport const SESSION_EVENT_TYPES = {\n SAME_TAB: 'same-tab',\n CROSS_TAB: 'cross-tab'\n};\nexport const MODE = {\n OFF: 0,\n FULL: 1,\n ERROR: 2\n};","export const FEATURE_NAMES = {\n ajax: 'ajax',\n genericEvents: 'generic_events',\n jserrors: 'jserrors',\n logging: 'logging',\n metrics: 'metrics',\n /**\n * @deprecated This feature has been replaced by Generic Events. Use/Import `GenericEvents` instead. This wrapper will be removed in a future release\n */\n pageAction: 'page_action',\n pageViewEvent: 'page_view_event',\n pageViewTiming: 'page_view_timing',\n sessionReplay: 'session_replay',\n sessionTrace: 'session_trace',\n softNav: 'soft_navigations',\n spa: 'spa'\n};\n\n/**\n * The order in which features will be instrumented. This is the traditional order. It's unclear if the order of\n * wrapping events has any ramifications, so we are enforcing this order intentionally for now.\n */\nexport const featurePriority = {\n [FEATURE_NAMES.pageViewEvent]: 1,\n [FEATURE_NAMES.pageViewTiming]: 2,\n [FEATURE_NAMES.metrics]: 3,\n [FEATURE_NAMES.jserrors]: 4,\n [FEATURE_NAMES.spa]: 5,\n [FEATURE_NAMES.ajax]: 6,\n [FEATURE_NAMES.sessionTrace]: 7,\n [FEATURE_NAMES.softNav]: 8,\n [FEATURE_NAMES.sessionReplay]: 9,\n [FEATURE_NAMES.logging]: 10,\n [FEATURE_NAMES.genericEvents]: 11\n};","import { MODE } from '../../common/session/constants';\nimport { FEATURE_NAMES } from '../../loaders/features/features';\nexport const FEATURE_NAME = FEATURE_NAMES.sessionReplay;\nexport const SR_EVENT_EMITTER_TYPES = {\n RECORD: 'recordReplay',\n PAUSE: 'pauseReplay',\n REPLAY_RUNNING: 'replayRunning',\n ERROR_DURING_REPLAY: 'errorDuringReplay'\n};\nexport const AVG_COMPRESSION = 0.12;\nexport const RRWEB_EVENT_TYPES = {\n DomContentLoaded: 0,\n Load: 1,\n FullSnapshot: 2,\n IncrementalSnapshot: 3,\n Meta: 4,\n Custom: 5\n};\n/** Interval between forcing new full snapshots -- 15 seconds in error mode (x2), 5 minutes in full mode */\nexport const CHECKOUT_MS = {\n [MODE.ERROR]: 15000,\n [MODE.FULL]: 300000,\n [MODE.OFF]: 0\n};\nexport const ABORT_REASONS = {\n RESET: {\n message: 'Session was reset',\n sm: 'Reset'\n },\n IMPORT: {\n message: 'Recorder failed to import',\n sm: 'Import'\n },\n TOO_MANY: {\n message: '429: Too Many Requests',\n sm: 'Too-Many'\n },\n TOO_BIG: {\n message: 'Payload was too large',\n sm: 'Too-Big'\n },\n CROSS_TAB: {\n message: 'Session Entity was set to OFF on another tab',\n sm: 'Cross-Tab'\n },\n ENTITLEMENTS: {\n message: 'Session Replay is not allowed and will not be started',\n sm: 'Entitlement'\n }\n};\n/** Reserved room for query param attrs */\nexport const QUERY_PARAM_PADDING = 5000;\nexport const TRIGGERS = {\n API: 'api'\n};","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// This is our own layer around performance.now. It's not strictly necessary, but we keep it in case of future mod-ing of the value for refactor purpose.\nexport function now() {\n return Math.floor(performance.now());\n}","/**\n * @file Contains constants about the environment the agent is running\n * within. These values are derived at the time the agent is first loaded.\n * @copyright 2023 New Relic Corporation. All rights reserved.\n * @license Apache-2.0\n */\n\nimport { now } from '../timing/now';\n\n/**\n * Indicates if the agent is running within a normal browser window context.\n */\nexport const isBrowserScope = typeof window !== 'undefined' && !!window.document;\n\n/**\n * Indicates if the agent is running within a worker context.\n */\nexport const isWorkerScope = typeof WorkerGlobalScope !== 'undefined' && (typeof self !== 'undefined' && self instanceof WorkerGlobalScope && self.navigator instanceof WorkerNavigator || typeof globalThis !== 'undefined' && globalThis instanceof WorkerGlobalScope && globalThis.navigator instanceof WorkerNavigator);\nexport const globalScope = isBrowserScope ? window : typeof WorkerGlobalScope !== 'undefined' && (typeof self !== 'undefined' && self instanceof WorkerGlobalScope && self || typeof globalThis !== 'undefined' && globalThis instanceof WorkerGlobalScope && globalThis);\nexport const loadedAsDeferredBrowserScript = globalScope?.document?.readyState === 'complete';\nexport const initiallyHidden = Boolean(globalScope?.document?.visibilityState === 'hidden');\nexport const initialLocation = '' + globalScope?.location;\nexport const isiOS = /iPad|iPhone|iPod/.test(globalScope.navigator?.userAgent);\n\n/**\n * Shared Web Workers introduced in iOS 16.0+ and n/a in 15.6-\n *\n * It was discovered in Safari 14 (https://bugs.webkit.org/show_bug.cgi?id=225305) that the buffered flag in PerformanceObserver\n * did not work. This affects our onFCP metric in particular since web-vitals uses that flag to retrieve paint timing entries.\n * This was fixed in v16+.\n */\nexport const iOSBelow16 = isiOS && typeof SharedWorker === 'undefined';\nexport const ffVersion = (() => {\n const match = globalScope.navigator?.userAgent?.match(/Firefox[/\\s](\\d+\\.\\d+)/);\n if (Array.isArray(match) && match.length >= 2) {\n return +match[1];\n }\n return 0;\n})();\nexport const supportsSendBeacon = !!globalScope.navigator?.sendBeacon;\n\n/**\n * Represents the absolute timestamp in milliseconds that the page was loaded\n * according to the browser's local clock.\n * @type {number}\n */\nexport const originTime = Date.now() - now();","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { globalScope } from '../constants/runtime';\nconst uuidv4Template = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';\n\n/**\n * Creates a random single hexadecimal value from a provided random value\n * table and corresponding index. If a random value table is not provided,\n * Math.random will be used to generate the value.\n *\n * @param {Uint8Array} valueTable Random value table typically generated using\n * the built-in crypto engine.\n * @param {int} tableIndex The index of the value table to use for generating\n * the hexadecimal value.\n * @returns {int} single hexadecimal value in decimal format\n */\nfunction getRandomValue(valueTable, tableIndex) {\n if (valueTable) {\n /**\n * The value table could have any number value in the given index. Use\n * bitwise AND to ensure the value we generate is a valid hex value.\n * x & 15 will ensure the value converted to hex using `toString(16)`\n * falls within the range of 0 and 15 inclusively.\n */\n return valueTable[tableIndex] & 15;\n } else {\n return Math.random() * 16 | 0;\n }\n}\n\n/**\n * Generates a RFC compliant UUIDv4 using native browser crypto engine. If the browser\n * does not support the crypto engine, the function will fallback to insecure Math.random()\n * @returns {string} uuid version 4 string\n */\nexport function generateUuid() {\n const crypto = globalScope?.crypto || globalScope?.msCrypto;\n let randomValueTable;\n let randomValueIndex = 0;\n if (crypto && crypto.getRandomValues) {\n // For a UUID, we only need 30 characters since two characters are pre-defined\n // eslint-disable-next-line\n randomValueTable = crypto.getRandomValues(new Uint8Array(30));\n }\n return uuidv4Template.split('').map(templateInput => {\n if (templateInput === 'x') {\n return getRandomValue(randomValueTable, randomValueIndex++).toString(16);\n } else if (templateInput === 'y') {\n // this is the uuid variant per spec (8, 9, a, b)\n // % 4, then shift to get values 8-11\n return (getRandomValue() & 0x3 | 0x8).toString(16);\n } else {\n return templateInput;\n }\n }).join('');\n}\n\n/**\n * Generates a string of the given length containing only hexadecimal\n * value 0-9 and a-f.\n * @param {int} length length of the string to generate\n * @returns {string} generated hex string\n */\nexport function generateRandomHexString(length) {\n const crypto = globalScope?.crypto || globalScope?.msCrypto;\n let randomValueTable;\n let randomValueIndex = 0;\n if (crypto && crypto.getRandomValues) {\n // eslint-disable-next-line\n randomValueTable = crypto.getRandomValues(new Uint8Array(length));\n }\n const chars = [];\n for (var i = 0; i < length; i++) {\n chars.push(getRandomValue(randomValueTable, randomValueIndex++).toString(16));\n }\n return chars.join('');\n}\n\n/**\n * Generates a 16 character length hexadecimal string.\n * per DT-spec.\n * @see generateRandomHexString\n * @returns {string} generated hex string\n */\nexport function generateSpanId() {\n return generateRandomHexString(16);\n}\n\n/**\n * Generates a 32 character length hexadecimal string.\n * per DT-spec.\n * @see generateRandomHexString\n * @returns {string} generated hex string\n */\nexport function generateTraceId() {\n return generateRandomHexString(32);\n}","/* eslint-disable n/handle-callback-err */\n\nimport { warn } from '../common/util/console';\nimport { SR_EVENT_EMITTER_TYPES } from '../features/session_replay/constants';\nimport { generateRandomHexString } from '../common/ids/unique-id';\n\n/**\n * @typedef {import('./api/interaction-types').InteractionInstance} InteractionInstance\n */\n\nexport class AgentBase {\n agentIdentifier;\n constructor(agentIdentifier = generateRandomHexString(16)) {\n this.agentIdentifier = agentIdentifier;\n }\n\n /**\n * Tries to execute the api and generates a generic warning message with the api name injected if unsuccessful\n * @param {string} methodName\n * @param {...any} args\n */\n #callMethod(methodName, ...args) {\n if (typeof this.api?.[methodName] !== 'function') warn(35, methodName);else return this.api[methodName](...args);\n }\n\n /**\n * Reports a browser PageAction event along with a name and optional attributes.\n * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/addpageaction/}\n * @param {string} name Name or category of the action. Reported as the actionName attribute.\n * @param {object} [attributes] JSON object with one or more key/value pairs. For example: {key:\"value\"}. The key is reported as its own PageAction attribute with the specified values.\n */\n addPageAction(name, attributes) {\n return this.#callMethod('addPageAction', name, attributes);\n }\n\n /**\n * Groups page views to help URL structure or to capture the URL's routing information.\n * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/setpageviewname/}\n * @param {string} name The page name you want to use. Use alphanumeric characters.\n * @param {string} [host] Default is http://custom.transaction. Typically set host to your site's domain URI.\n */\n setPageViewName(name, host) {\n return this.#callMethod('setPageViewName', name, host);\n }\n\n /**\n * Adds a user-defined attribute name and value to subsequent events on the page.\n * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/setcustomattribute/}\n * @param {string} name Name of the attribute. Appears as column in the PageView event. It will also appear as a column in the PageAction event if you are using it.\n * @param {string|number|boolean|null} value Value of the attribute. Appears as the value in the named attribute column in the PageView event. It will appear as a column in the PageAction event if you are using it. Custom attribute values cannot be complex objects, only simple types such as Strings, Integers and Booleans. Passing a null value unsets any existing attribute of the same name.\n * @param {boolean} [persist] Default false. If set to true, the name-value pair will also be set into the browser's storage API. Then on the following instrumented pages that load within the same session, the pair will be re-applied as a custom attribute.\n */\n setCustomAttribute(name, value, persist) {\n return this.#callMethod('setCustomAttribute', name, value, persist);\n }\n\n /**\n * Identifies a browser error without disrupting your app's operations.\n * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/noticeerror/}\n * @param {Error|string} error Provide a meaningful error message that you can use when analyzing data on browser's JavaScript errors page.\n * @param {object} [customAttributes] An object containing name/value pairs representing custom attributes.\n */\n noticeError(error, customAttributes) {\n return this.#callMethod('noticeError', error, customAttributes);\n }\n\n /**\n * Adds a user-defined identifier string to subsequent events on the page.\n * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/setuserid/}\n * @param {string|null} value A string identifier for the end-user, useful for tying all browser events to specific users. The value parameter does not have to be unique. If IDs should be unique, the caller is responsible for that validation. Passing a null value unsets any existing user ID.\n */\n setUserId(value) {\n return this.#callMethod('setUserId', value);\n }\n\n /**\n * Adds a user-defined application version string to subsequent events on the page.\n * This decorates all payloads with an attribute of `application.version` which is queryable in NR1.\n * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/setapplicationversion/}\n * @param {string|null} value A string identifier for the application version, useful for\n * tying all browser events to a specific release tag. The value parameter does not\n * have to be unique. Passing a null value unsets any existing value.\n */\n setApplicationVersion(value) {\n return this.#callMethod('setApplicationVersion', value);\n }\n\n /**\n * Allows selective ignoring and grouping of known errors that the browser agent captures.\n * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/seterrorhandler/}\n * @param {(error: Error|string) => boolean | { group: string }} callback When an error occurs, the callback is called with the error object as a parameter. The callback will be called with each error, so it is not specific to one error.\n */\n setErrorHandler(callback) {\n return this.#callMethod('setErrorHandler', callback);\n }\n\n /**\n * Records an additional time point as \"finished\" in a session trace and adds a page action.\n * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/finished/}\n * @param {number} [timeStamp] Defaults to the current time of the call. If used, this marks the time that the page is \"finished\" according to your own criteria.\n */\n finished(timeStamp) {\n return this.#callMethod('finished', timeStamp);\n }\n\n /**\n * Adds a unique name and ID to identify releases with multiple JavaScript bundles on the same page.\n * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/addrelease/}\n * @param {string} name A short description of the component; for example, the name of a project, application, file, or library.\n * @param {string} id The ID or version of this release; for example, a version number, build number from your CI environment, GitHub SHA, GUID, or a hash of the contents.\n */\n addRelease(name, id) {\n return this.#callMethod('addRelease', name, id);\n }\n\n /**\n * Starts a set of agent features if not running in \"autoStart\" mode\n * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/start/}\n * @param {string|string[]} [featureNames] The name(s) of the features to start. If no name(s) are passed, all features will be started\n */\n start(featureNames) {\n return this.#callMethod('start', featureNames);\n }\n\n /**\n * Forces a replay to record. If a replay is already actively recording, this call will be ignored.\n * If a recording has not been started, a new one will be created. If a recording has been started, but is currently not recording, it will resume recording.\n * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/recordReplay/}\n */\n recordReplay() {\n return this.#callMethod(SR_EVENT_EMITTER_TYPES.RECORD);\n }\n\n /**\n * Forces an active replay to pause recording. If a replay is already actively recording, this call will cause the recording to pause.\n * If a recording is not currently recording, this call will be ignored. This API will pause both manual and automatic replays that are in progress.\n * The only way to resume recording after manually pausing a replay is to manually record again using the recordReplay() API.\n * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/pauseReplay/}\n */\n pauseReplay() {\n return this.#callMethod(SR_EVENT_EMITTER_TYPES.PAUSE);\n }\n\n /**\n * Adds a JavaScript object with a custom name, start time, etc. to an in-progress session trace.\n * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/addtotrace/}\n * @param {{name: string, start: number, end?: number, origin?: string, type?: string}} customAttributes Supply a JavaScript object with these required and optional name/value pairs:\n *\n * - Required name/value pairs: name, start\n * - Optional name/value pairs: end, origin, type\n * - Note: Does not apply to MicroAgent\n *\n * If you are sending the same event object to New Relic as a PageAction, omit the TYPE attribute. (type is a string to describe what type of event you are marking inside of a session trace.) If included, it will override the event type and cause the PageAction event to be sent incorrectly. Instead, use the name attribute for event information.\n */\n addToTrace(customAttributes) {\n return this.#callMethod('addToTrace', customAttributes);\n }\n\n /**\n * Gives SPA routes more accurate names than default names. Monitors specific routes rather than by default grouping.\n * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/setcurrentroutename/}\n * @param {string} name Current route name for the page.\n * - Note: Does not apply to MicroAgent\n */\n setCurrentRouteName(name) {\n return this.#callMethod('setCurrentRouteName', name);\n }\n\n /**\n * Returns a new API object that is bound to the current SPA interaction.\n * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/interaction/}\n * @returns {InteractionInstance} An API object that is bound to a specific BrowserInteraction event. Each time this method is called for the same BrowserInteraction, a new object is created, but it still references the same interaction.\n * - Note: Does not apply to MicroAgent\n */\n interaction() {\n return this.#callMethod('interaction');\n }\n\n /**\n * Capture a single log.\n * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/log/}\n * @param {string} message String to be captured as log message\n * @param {{customAttributes?: object, level?: 'ERROR'|'TRACE'|'DEBUG'|'INFO'|'WARN'}} [options] customAttributes defaults to `{}` if not assigned, level defaults to `info` if not assigned.\n */\n log(message, options) {\n return this.#callMethod('log', message, options);\n }\n\n /**\n * Wrap a logger function to capture a log each time the function is invoked with the message and arguments passed\n * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/wraplogger/}\n * @param {object} parent The parent object containing the logger method\n * @param {string} functionName The property name of the function in the parent object to be wrapped\n * @param {{customAttributes?: object, level?: 'ERROR'|'TRACE'|'DEBUG'|'INFO'|'WARN'}} [options] customAttributes defaults to `{}` if not assigned, level defaults to `info` if not assigned.\n */\n wrapLogger(parent, functionName, options) {\n return this.#callMethod('wrapLogger', parent, functionName, options);\n }\n}","import { FEATURE_NAMES } from '../../loaders/features/features';\nexport const LOG_LEVELS = {\n ERROR: 'ERROR',\n WARN: 'WARN',\n INFO: 'INFO',\n DEBUG: 'DEBUG',\n TRACE: 'TRACE'\n};\nexport const LOGGING_EVENT_EMITTER_CHANNEL = 'log';\nexport const FEATURE_NAME = FEATURE_NAMES.logging;","export const isValidSelector = selector => {\n if (!selector || typeof selector !== 'string') return false;\n try {\n document.createDocumentFragment().querySelector(selector);\n } catch {\n return false;\n }\n return true;\n};","import { globalScope } from '../constants/runtime';\nimport { now } from '../timing/now';\nexport const defaults = {\n beacon: 'bam.nr-data.net',\n errorBeacon: 'bam.nr-data.net'\n};\nexport function gosNREUM() {\n if (!globalScope.NREUM) {\n globalScope.NREUM = {};\n }\n if (typeof globalScope.newrelic === 'undefined') globalScope.newrelic = globalScope.NREUM;\n return globalScope.NREUM;\n}\nexport function gosNREUMInfo() {\n let nr = gosNREUM();\n const externallySupplied = nr.info || {};\n nr.info = {\n beacon: defaults.beacon,\n errorBeacon: defaults.errorBeacon,\n ...externallySupplied\n };\n return nr;\n}\nexport function gosNREUMLoaderConfig() {\n let nr = gosNREUM();\n const externallySupplied = nr.loader_config || {};\n nr.loader_config = {\n ...externallySupplied\n };\n return nr;\n}\nexport function gosNREUMInit() {\n let nr = gosNREUM();\n const externallySupplied = nr.init || {};\n nr.init = {\n ...externallySupplied\n };\n return nr;\n}\nexport function gosNREUMOriginals() {\n let nr = gosNREUM();\n if (!nr.o) {\n nr.o = {\n ST: globalScope.setTimeout,\n SI: globalScope.setImmediate,\n CT: globalScope.clearTimeout,\n XHR: globalScope.XMLHttpRequest,\n REQ: globalScope.Request,\n EV: globalScope.Event,\n PR: globalScope.Promise,\n MO: globalScope.MutationObserver,\n // this'll be undefined if not in a web window\n FETCH: globalScope.fetch,\n WS: globalScope.WebSocket\n };\n }\n return nr;\n}\nexport function setNREUMInitializedAgent(id, newAgentInstance) {\n let nr = gosNREUM();\n nr.initializedAgents ??= {};\n newAgentInstance.initializedAt = {\n ms: now(),\n date: new Date()\n };\n nr.initializedAgents[id] = newAgentInstance;\n}\n\n/**\n * Get the agent instance under the associated identifier on the global newrelic object.\n * @see setNREUMInitializedAgents\n * @returns Existing agent instance under newrelic.initializedAgent[id], or undefined if it does not exist.\n */\nexport function getNREUMInitializedAgent(id) {\n let nr = gosNREUM();\n return nr.initializedAgents?.[id];\n}\nexport function addToNREUM(fnName, fn) {\n let nr = gosNREUM();\n nr[fnName] = fn;\n}\nexport function NREUMinitialized() {\n const nr = gosNREUM();\n nr.initialized = true;\n}\nexport function gosCDN() {\n gosNREUMInfo();\n gosNREUMInit();\n gosNREUMOriginals();\n gosNREUMLoaderConfig();\n return gosNREUM();\n}","import { warn } from '../util/console';\nexport function getModeledObject(obj, model) {\n try {\n if (!obj || typeof obj !== 'object') return warn(3);\n if (!model || typeof model !== 'object') return warn(4);\n // allow getters and setters to pass from model to target\n const output = Object.create(Object.getPrototypeOf(model), Object.getOwnPropertyDescriptors(model));\n const target = Object.keys(output).length === 0 ? obj : output;\n for (let key in target) {\n if (obj[key] === undefined) continue;\n try {\n if (obj[key] === null) {\n output[key] = null;\n continue;\n }\n if (Array.isArray(obj[key]) && Array.isArray(model[key])) output[key] = Array.from(new Set([...obj[key], ...model[key]]));else if (typeof obj[key] === 'object' && typeof model[key] === 'object') output[key] = getModeledObject(obj[key], model[key]);else output[key] = obj[key];\n } catch (e) {\n warn(1, e);\n }\n }\n return output;\n } catch (err) {\n warn(2, err);\n }\n}","import { LOG_LEVELS } from '../../features/logging/constants';\nimport { isValidSelector } from '../dom/query-selector';\nimport { DEFAULT_EXPIRES_MS, DEFAULT_INACTIVE_MS } from '../session/constants';\nimport { warn } from '../util/console';\nimport { getNREUMInitializedAgent } from '../window/nreum';\nimport { getModeledObject } from './configurable';\nconst nrMask = '[data-nr-mask]';\nconst model = () => {\n const hiddenState = {\n mask_selector: '*',\n block_selector: '[data-nr-block]',\n mask_input_options: {\n color: false,\n date: false,\n 'datetime-local': false,\n email: false,\n month: false,\n number: false,\n range: false,\n search: false,\n tel: false,\n text: false,\n time: false,\n url: false,\n week: false,\n // unify textarea and select element with text input\n textarea: false,\n select: false,\n password: true // This will be enforced to always be true in the setter\n }\n };\n return {\n ajax: {\n deny_list: undefined,\n block_internal: true,\n enabled: true,\n harvestTimeSeconds: 10,\n autoStart: true\n },\n distributed_tracing: {\n enabled: undefined,\n exclude_newrelic_header: undefined,\n cors_use_newrelic_header: undefined,\n cors_use_tracecontext_headers: undefined,\n allowed_origins: undefined\n },\n feature_flags: [],\n generic_events: {\n enabled: true,\n harvestTimeSeconds: 30,\n autoStart: true\n },\n harvest: {\n tooManyRequestsDelay: 60\n },\n jserrors: {\n enabled: true,\n harvestTimeSeconds: 10,\n autoStart: true\n },\n logging: {\n enabled: true,\n harvestTimeSeconds: 10,\n autoStart: true,\n level: LOG_LEVELS.INFO\n },\n metrics: {\n enabled: true,\n autoStart: true\n },\n obfuscate: undefined,\n page_action: {\n enabled: true\n },\n user_actions: {\n enabled: true\n },\n page_view_event: {\n enabled: true,\n autoStart: true\n },\n page_view_timing: {\n enabled: true,\n harvestTimeSeconds: 30,\n autoStart: true\n },\n privacy: {\n cookies_enabled: true\n },\n // *cli - per discussion, default should be true\n proxy: {\n assets: undefined,\n // if this value is set, it will be used to overwrite the webpack asset path used to fetch assets\n beacon: undefined // likewise for the url to which we send analytics\n },\n session: {\n expiresMs: DEFAULT_EXPIRES_MS,\n inactiveMs: DEFAULT_INACTIVE_MS\n },\n session_replay: {\n // feature settings\n autoStart: true,\n enabled: false,\n harvestTimeSeconds: 60,\n preload: false,\n // if true, enables the agent to load rrweb immediately instead of waiting to do so after the window.load event\n sampling_rate: 10,\n // float from 0 - 100\n error_sampling_rate: 100,\n // float from 0 - 100\n collect_fonts: false,\n // serialize fonts for collection without public asset url, this is currently broken in RRWeb -- https://github.com/rrweb-io/rrweb/issues/1304. When fixed, revisit with test cases\n inline_images: false,\n // serialize images for collection without public asset url -- right now this is only useful for testing as it easily generates payloads too large to be harvested\n fix_stylesheets: true,\n // fetch missing stylesheet resources for inlining\n // recording config settings\n mask_all_inputs: true,\n // this has a getter/setter to facilitate validation of the selectors\n get mask_text_selector() {\n return hiddenState.mask_selector;\n },\n set mask_text_selector(val) {\n if (isValidSelector(val)) hiddenState.mask_selector = \"\".concat(val, \",\").concat(nrMask);else if (val === '' || val === null) hiddenState.mask_selector = nrMask;else warn(5, val);\n },\n // these properties only have getters because they are enforcable constants and should error if someone tries to override them\n get block_class() {\n return 'nr-block';\n },\n get ignore_class() {\n return 'nr-ignore';\n },\n get mask_text_class() {\n return 'nr-mask';\n },\n // props with a getter and setter are used to extend enforcable constants with customer input\n // we must preserve data-nr-block no matter what else the customer sets\n get block_selector() {\n return hiddenState.block_selector;\n },\n set block_selector(val) {\n if (isValidSelector(val)) hiddenState.block_selector += \",\".concat(val);else if (val !== '') warn(6, val);\n },\n // password: must always be present and true no matter what customer sets\n get mask_input_options() {\n return hiddenState.mask_input_options;\n },\n set mask_input_options(val) {\n if (val && typeof val === 'object') hiddenState.mask_input_options = {\n ...val,\n password: true\n };else warn(7, val);\n }\n },\n session_trace: {\n enabled: true,\n harvestTimeSeconds: 10,\n autoStart: true\n },\n soft_navigations: {\n enabled: true,\n harvestTimeSeconds: 10,\n autoStart: true\n },\n spa: {\n enabled: true,\n harvestTimeSeconds: 10,\n autoStart: true\n },\n ssl: undefined\n };\n};\nconst _cache = {};\nconst missingAgentIdError = 'All configuration objects require an agent identifier!';\nexport function getConfiguration(id) {\n if (!id) throw new Error(missingAgentIdError);\n if (!_cache[id]) throw new Error(\"Configuration for \".concat(id, \" was never set\"));\n return _cache[id];\n}\nexport function setConfiguration(id, obj) {\n if (!id) throw new Error(missingAgentIdError);\n _cache[id] = getModeledObject(obj, model());\n const agentInst = getNREUMInitializedAgent(id);\n if (agentInst) agentInst.init = _cache[id];\n}\nexport function getConfigurationValue(id, path) {\n if (!id) throw new Error(missingAgentIdError);\n var val = getConfiguration(id);\n if (val) {\n var parts = path.split('.');\n for (var i = 0; i < parts.length - 1; i++) {\n val = val[parts[i]];\n if (typeof val !== 'object') return;\n }\n val = val[parts[parts.length - 1]];\n }\n return val;\n}\n\n// TO DO: a setConfigurationValue equivalent may be nice so individual\n// properties can be tuned instead of reseting the whole model per call to `setConfiguration(agentIdentifier, {})`","import { FEATURE_NAMES } from './features';\nimport { getConfigurationValue } from '../../common/config/init';\nconst featureNames = Object.values(FEATURE_NAMES);\nfunction isEnabled(name, agentIdentifier) {\n return getConfigurationValue(agentIdentifier, \"\".concat(name, \".enabled\")) === true;\n}\nexport function getEnabledFeatures(agentIdentifier) {\n const enabledFeatures = {};\n featureNames.forEach(featureName => {\n enabledFeatures[featureName] = isEnabled(featureName, agentIdentifier);\n });\n return enabledFeatures;\n}","import { defaults as nrDefaults, getNREUMInitializedAgent } from '../window/nreum';\nimport { getModeledObject } from './configurable';\nconst model = {\n // preset defaults\n beacon: nrDefaults.beacon,\n errorBeacon: nrDefaults.errorBeacon,\n // others must be populated by user\n licenseKey: undefined,\n applicationID: undefined,\n sa: undefined,\n queueTime: undefined,\n applicationTime: undefined,\n ttGuid: undefined,\n user: undefined,\n account: undefined,\n product: undefined,\n extra: undefined,\n jsAttributes: {},\n userAttributes: undefined,\n atts: undefined,\n transactionName: undefined,\n tNamePlain: undefined\n};\nconst _cache = {};\nexport function isValid(id) {\n try {\n const info = getInfo(id);\n return !!info.licenseKey && !!info.errorBeacon && !!info.applicationID;\n } catch (err) {\n return false;\n }\n}\nexport function getInfo(id) {\n if (!id) throw new Error('All info objects require an agent identifier!');\n if (!_cache[id]) throw new Error(\"Info for \".concat(id, \" was never set\"));\n return _cache[id];\n}\nexport function setInfo(id, obj) {\n if (!id) throw new Error('All info objects require an agent identifier!');\n _cache[id] = getModeledObject(obj, model);\n const agentInst = getNREUMInitializedAgent(id);\n if (agentInst) agentInst.info = _cache[id];\n}","/**\n * @file This file exposes NPM build environment variables. These variables will\n * be overridden with babel.\n */\n\n/**\n * Exposes the version of the agent\n */\nexport const VERSION = \"1.268.0\";\n\n/**\n * Exposes the build type of the agent\n * Valid values are LOCAL, PROD, DEV\n */\nexport const BUILD_ENV = 'NPM';\n\n/**\n * Exposes the distribution method of the agent\n * Valid valuse are CDN, NPM\n */\nexport const DIST_METHOD = 'NPM';\n\n/**\n * Exposes the lib version of rrweb\n */\nexport const RRWEB_VERSION = \"2.0.0-alpha.12\";","import { getModeledObject } from './configurable';\nimport { getNREUMInitializedAgent } from '../window/nreum';\nimport { globalScope, originTime } from '../constants/runtime';\nimport { BUILD_ENV, DIST_METHOD, VERSION } from \"../constants/env.npm\";\n\n/**\n * Module level count of harvests. This property will auto-increment each time it is accessed.\n * @type {number}\n */\nlet harvestCount = 0;\nconst readonly = {\n buildEnv: BUILD_ENV,\n distMethod: DIST_METHOD,\n version: VERSION,\n originTime\n};\nconst model = {\n customTransaction: undefined,\n disabled: false,\n isolatedBacklog: false,\n loaderType: undefined,\n maxBytes: 30000,\n onerror: undefined,\n origin: '' + globalScope.location,\n ptid: undefined,\n releaseIds: {},\n /** Agent-specific metadata found in the RUM call response. ex. entityGuid */\n appMetadata: {},\n session: undefined,\n denyList: undefined,\n timeKeeper: undefined,\n obfuscator: undefined\n};\nconst _cache = {};\nexport function getRuntime(id) {\n if (!id) throw new Error('All runtime objects require an agent identifier!');\n if (!_cache[id]) throw new Error(\"Runtime for \".concat(id, \" was never set\"));\n return _cache[id];\n}\nexport function setRuntime(id, obj) {\n if (!id) throw new Error('All runtime objects require an agent identifier!');\n _cache[id] = {\n ...getModeledObject(obj, model),\n ...readonly\n };\n if (!Object.hasOwnProperty.call(_cache[id], 'harvestCount')) {\n // Harvest count needs to be added as a getter so the variable is updated each time it is accessed\n Object.defineProperty(_cache[id], 'harvestCount', {\n get: () => ++harvestCount\n });\n }\n const agentInst = getNREUMInitializedAgent(id);\n if (agentInst) agentInst.runtime = _cache[id];\n}","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nvar has = Object.prototype.hasOwnProperty;\n\n/**\n * Always returns the current value of obj[prop], even if it has to set it first. Sets properties as non-enumerable if possible.\n *\n * @param {Object} obj - The object to get or set the property on.\n * @param {string} prop - The name of the property.\n * @param {Function} getVal - A function that returns the value to be set if the property does not exist.\n * @returns {*} The value of the property in the object.\n */\nexport function getOrSet(obj, prop, getVal) {\n // If the value exists return it.\n if (has.call(obj, prop)) return obj[prop];\n var val = getVal();\n\n // Attempt to set the property so it's not enumerable\n if (Object.defineProperty && Object.keys) {\n try {\n Object.defineProperty(obj, prop, {\n value: val,\n // old IE inherits non-write-ability\n writable: true,\n enumerable: false\n });\n return val;\n } catch (e) {\n // Can't report internal errors,\n // because GOS is a dependency of the reporting mechanisms\n }\n }\n\n // fall back to setting normally\n obj[prop] = val;\n return val;\n}","export class EventContext {\n constructor(contextId) {\n this.contextId = contextId;\n }\n}","/**\n * @file Contains a unique identifier for the running agent bundle\n * when loaded.\n * @copyright 2023 New Relic Corporation. All rights reserved.\n * @license Apache-2.0\n */\n\nimport { generateUuid } from './unique-id';\n\n/**\n * Provides a unique id for the current agent bundle\n */\nexport const bundleId = generateUuid();","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { gosNREUM } from '../window/nreum';\nimport { getOrSet } from '../util/get-or-set';\nimport { getRuntime } from '../config/runtime';\nimport { EventContext } from './event-context';\nimport { bundleId } from '../ids/bundle-id';\n\n// create a unique id to store event context data for the current agent bundle\nconst contextId = \"nr@context:\".concat(bundleId);\n// create global emitter instance that can be shared among bundles\nconst globalInstance = ee(undefined, 'globalEE');\n\n// Only override the exposed event emitter if one has not already been exposed\nconst nr = gosNREUM();\nif (!nr.ee) {\n nr.ee = globalInstance;\n}\nexport { globalInstance as ee, contextId };\nfunction ee(old, debugId) {\n var handlers = {};\n var bufferGroupMap = {};\n var emitters = {};\n // In cases where multiple agents can run on a page, the event backlogs of feature event emitters must be isolated\n // to prevent event emitter context and buffers from \"bubbling up\" to other agents operating in the scope.\n // An example of this is our MicroAgent loader package, which sets this property to true to prevent overlap.\n var isolatedBacklog = false;\n try {\n // We only want to check the runtime configuration for `isolatedBacklog` if the event emitter belongs to a feature.\n // For feature event emitters, the debugId will be an agentIdentifier with a length of 16. In contrast, some of our\n // tests do not namespace the event emitter with an agentID and just use the parent (which has no ID).\n isolatedBacklog = debugId.length !== 16 ? false : getRuntime(debugId).isolatedBacklog;\n } catch (err) {\n // Do nothing for now.\n }\n var emitter = {\n on: addEventListener,\n addEventListener,\n removeEventListener,\n emit,\n get: getOrCreate,\n listeners,\n context,\n buffer: bufferEventsByGroup,\n abort,\n isBuffering,\n debugId,\n backlog: isolatedBacklog ? {} : old && typeof old.backlog === 'object' ? old.backlog : {},\n isolatedBacklog\n };\n function abort() {\n emitter._aborted = true;\n Object.keys(emitter.backlog).forEach(key => {\n delete emitter.backlog[key];\n });\n }\n Object.defineProperty(emitter, 'aborted', {\n get: () => {\n let aborted = emitter._aborted || false;\n if (aborted) return aborted;else if (old) {\n aborted = old.aborted;\n }\n return aborted;\n }\n });\n return emitter;\n function context(contextOrStore) {\n if (contextOrStore && contextOrStore instanceof EventContext) {\n return contextOrStore;\n } else if (contextOrStore) {\n return getOrSet(contextOrStore, contextId, () => new EventContext(contextId));\n } else {\n return new EventContext(contextId);\n }\n }\n function emit(type, args, contextOrStore, force, bubble) {\n if (bubble !== false) bubble = true;\n if (globalInstance.aborted && !force) {\n return;\n }\n if (old && bubble) old.emit(type, args, contextOrStore);\n var ctx = context(contextOrStore);\n var handlersArray = listeners(type);\n var len = handlersArray.length;\n\n // Apply each handler function in the order they were added\n // to the context with the arguments\n\n for (var i = 0; i < len; i++) handlersArray[i].apply(ctx, args);\n\n // Buffer after emitting for consistent ordering\n var bufferGroup = getBuffer()[bufferGroupMap[type]];\n if (bufferGroup) {\n bufferGroup.push([emitter, type, args, ctx]);\n }\n\n // Return the context so that the module that emitted can see what was done.\n return ctx;\n }\n function addEventListener(type, fn) {\n // Retrieve type from handlers, if it doesn't exist assign the default and retrieve it.\n handlers[type] = listeners(type).concat(fn);\n }\n function removeEventListener(type, fn) {\n var listeners = handlers[type];\n if (!listeners) return;\n for (var i = 0; i < listeners.length; i++) {\n if (listeners[i] === fn) {\n listeners.splice(i, 1);\n }\n }\n }\n function listeners(type) {\n return handlers[type] || [];\n }\n function getOrCreate(name) {\n return emitters[name] = emitters[name] || ee(emitter, name);\n }\n function bufferEventsByGroup(types, group) {\n const eventBuffer = getBuffer();\n group = group || 'feature';\n\n // do not buffer events if agent has been aborted\n if (emitter.aborted) return;\n Object.entries(types || {}).forEach(([_, type]) => {\n bufferGroupMap[type] = group;\n if (!(group in eventBuffer)) {\n eventBuffer[group] = [];\n }\n });\n }\n function isBuffering(type) {\n var bufferGroup = getBuffer()[bufferGroupMap[type]];\n return !!bufferGroup;\n }\n\n // buffer is associated with a base emitter, since there are two\n // (global and scoped to the current bundle), it is now part of the emitter\n function getBuffer() {\n return emitter.backlog;\n }\n}","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ee as globalInstance } from './contextual-ee';\nexport var handleEE = globalInstance.get('handle');\nexport function handle(type, args, ctx, group, ee) {\n if (ee) {\n ee.buffer([type], group);\n ee.emit(type, args, ctx);\n } else {\n handleEE.buffer([type], group);\n handleEE.emit(type, args, ctx);\n }\n}","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { handleEE } from './handle';\nexport { defaultRegister as registerHandler };\ndefaultRegister.on = registerWithSpecificEmitter;\nvar handlers = defaultRegister.handlers = {};\nexport function defaultRegister(type, handler, group, ee) {\n registerWithSpecificEmitter(ee || handleEE, handlers, type, handler, group);\n}\nfunction registerWithSpecificEmitter(ee, handlers, type, handler, group) {\n if (!group) group = 'feature';\n if (!ee) ee = handleEE;\n var groupHandlers = handlers[group] = handlers[group] || {};\n var list = groupHandlers[type] = groupHandlers[type] || [];\n list.push([ee, handler]);\n}","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ee } from '../event-emitter/contextual-ee';\nimport { registerHandler as defaultRegister } from '../event-emitter/register-handler';\nimport { featurePriority } from '../../loaders/features/features';\nimport { EventContext } from '../event-emitter/event-context';\nconst registry = {};\n\n/**\n * Adds an entry to the centralized drain registry specifying that a particular agent has events of a particular named\n * event-group \"bucket\" that should be drained at the time the agent drains all its buffered events. Buffered events\n * accumulate because instrumentation begins as soon as possible, before the agent has finished lazy-loading the code\n * responsible for aggregating and reporting captured data.\n * @param {string} agentIdentifier - A 16 character string uniquely identifying the agent.\n * @param {string} group - The named \"bucket\" for the events this feature will be bucketing for later collection.\n */\nexport function registerDrain(agentIdentifier, group) {\n // Here `item` captures the registered properties of a feature-group: whether it is ready for its buffered events\n // to be drained (`staged`) and the `priority` order in which it should be drained relative to other feature groups.\n const item = {\n staged: false,\n priority: featurePriority[group] || 0\n };\n curateRegistry(agentIdentifier);\n if (!registry[agentIdentifier].get(group)) registry[agentIdentifier].set(group, item);\n}\n\n/**\n * Removes an item from the registry and immediately re-checks if the registry is ready to \"drain all\"\n * @param {*} agentIdentifier - A 16 character string uniquely identifying the agent.\n * @param {*} group - The named \"bucket\" to be removed from the registry\n */\nexport function deregisterDrain(agentIdentifier, group) {\n if (!agentIdentifier || !registry[agentIdentifier]) return;\n if (registry[agentIdentifier].get(group)) registry[agentIdentifier].delete(group);\n drainGroup(agentIdentifier, group, false);\n if (registry[agentIdentifier].size) checkCanDrainAll(agentIdentifier);\n}\n\n/**\n * Registers the specified agent with the centralized event buffer registry if it is not already registered.\n * Agents without an identifier (as in the case of some tests) will be excluded from the registry.\n * @param {string} agentIdentifier - A 16 character string uniquely identifying an agent.\n */\nfunction curateRegistry(agentIdentifier) {\n if (!agentIdentifier) throw new Error('agentIdentifier required');\n if (!registry[agentIdentifier]) registry[agentIdentifier] = new Map();\n}\n\n/**\n * Drain buffered events out of the event emitter. Each feature should have its events bucketed by \"group\" and drain\n * its own named group explicitly, when ready.\n * @param {string} agentIdentifier - A unique 16 character ID corresponding to an instantiated agent.\n * @param {string} featureName - A named group into which the feature's buffered events are bucketed.\n * @param {boolean} force - Whether to force the drain to occur immediately, bypassing the registry and staging logic.\n */\nexport function drain(agentIdentifier = '', featureName = 'feature', force = false) {\n curateRegistry(agentIdentifier);\n // If the feature for the specified agent is not in the registry, that means the instrument file was bypassed.\n // This could happen in tests, or loaders that directly import the aggregator. In these cases it is safe to\n // drain the feature group immediately rather than waiting to drain all at once.\n if (!agentIdentifier || !registry[agentIdentifier].get(featureName) || force) return drainGroup(agentIdentifier, featureName);\n\n // When `drain` is called, this feature is ready to drain (staged).\n registry[agentIdentifier].get(featureName).staged = true;\n checkCanDrainAll(agentIdentifier);\n}\n\n/** Checks all items in the registry to see if they have been \"staged\". If ALL items are staged, it will drain all registry items (drainGroup). It not, nothing will happen */\nfunction checkCanDrainAll(agentIdentifier) {\n // Only when the event-groups for all features are ready to drain (staged) do we execute the drain. This has the effect\n // that the last feature to call drain triggers drain for all features.\n const items = Array.from(registry[agentIdentifier]);\n if (items.every(([key, values]) => values.staged)) {\n items.sort((a, b) => a[1].priority - b[1].priority);\n items.forEach(([group]) => {\n registry[agentIdentifier].delete(group);\n drainGroup(agentIdentifier, group);\n });\n }\n}\n\n/**\n * Drains all the buffered (backlog) events for a particular feature's event-group by emitting each event to each of\n * the subscribed handlers for the group.\n * @param {*} group - The name of a particular feature's event \"bucket\".\n */\nfunction drainGroup(agentIdentifier, group, activateGroup = true) {\n const baseEE = agentIdentifier ? ee.get(agentIdentifier) : ee;\n const handlers = defaultRegister.handlers; // other storage in registerHandler\n if (baseEE.aborted || !baseEE.backlog || !handlers) return;\n\n // Only activated features being drained should run queued listeners on buffered events. Deactivated features only need to release memory.\n if (activateGroup) {\n const bufferedEventsInGroup = baseEE.backlog[group];\n const groupHandlers = handlers[group]; // each group in the registerHandler storage\n if (groupHandlers) {\n // We don't cache the length of the buffer while looping because events might still be added while processing.\n for (let i = 0; bufferedEventsInGroup && i < bufferedEventsInGroup.length; ++i) {\n // eslint-disable-line no-unmodified-loop-condition\n emitEvent(bufferedEventsInGroup[i], groupHandlers);\n }\n Object.entries(groupHandlers).forEach(([eventType, handlerRegistrationList]) => {\n Object.values(handlerRegistrationList || {}).forEach(registration => {\n // registration *should* be an array of: [targetEE, eventHandler]\n // certain browser polyfills of .values and .entries pass the prototype methods into the callback,\n // which breaks this assumption and throws errors. So we make sure here that we only call .on() if its an actual NR EE\n if (registration[0]?.on && registration[0]?.context() instanceof EventContext) registration[0].on(eventType, registration[1]);\n });\n });\n }\n }\n if (!baseEE.isolatedBacklog) delete handlers[group];\n baseEE.backlog[group] = null;\n baseEE.emit('drain-' + group, []); // TODO: Code exists purely for a unit test and needs to be refined\n}\n\n/**\n * Processes the specified event using all relevant handler functions associated with a particular feature, based on\n * whether the the handler is meant to apply to events of this type. (Event type is a descriptive string set at the\n * time an event is originally created by instrumentation, as with calls to the `handle` method.)\n * @param {*} evt - A single event to be emitted to (processed by) eligible handler functions.\n * @param {*} groupHandlers - A set of handler functions associated with a particular feature's event-group.\n */\nfunction emitEvent(evt, groupHandlers) {\n var type = evt[1];\n Object.values(groupHandlers[type] || {}).forEach(registration => {\n var sourceEE = evt[0];\n var ee = registration[0];\n if (ee === sourceEE) {\n var handler = registration[1];\n var ctx = evt[3];\n var args = evt[2];\n handler.apply(ctx, args);\n }\n });\n}","export function eventListenerOpts(useCapture, abortSignal) {\n return {\n capture: useCapture,\n passive: false,\n signal: abortSignal\n };\n}\n\n/** Do not use this within the worker context. */\nexport function windowAddEventListener(event, listener, capture = false, abortSignal) {\n window.addEventListener(event, listener, eventListenerOpts(capture, abortSignal));\n}\n/** Do not use this within the worker context. */\nexport function documentAddEventListener(event, listener, capture = false, abortSignal) {\n document.addEventListener(event, listener, eventListenerOpts(capture, abortSignal));\n}","import { windowAddEventListener, documentAddEventListener } from '../event-listener/event-listener-opts';\nexport function checkState() {\n return typeof document === 'undefined' || document.readyState === 'complete';\n}\nexport function onWindowLoad(cb, useCapture) {\n if (checkState()) return cb();\n windowAddEventListener('load', cb, useCapture);\n}\nexport function onDOMContentLoaded(cb) {\n if (checkState()) return cb();\n documentAddEventListener('DOMContentLoaded', cb);\n}","// import { ADD_EVENT_LISTENER_TAG } from '../../common/wrap/wrap-websocket'\nimport { FEATURE_NAMES } from '../../loaders/features/features';\nexport const FEATURE_NAME = FEATURE_NAMES.metrics;\nexport const SUPPORTABILITY_METRIC = 'sm';\nexport const CUSTOM_METRIC = 'cm';\nexport const SUPPORTABILITY_METRIC_CHANNEL = 'storeSupportabilityMetrics';\nexport const CUSTOM_METRIC_CHANNEL = 'storeEventMetrics';\n\n// export const WATCHABLE_WEB_SOCKET_EVENTS = ['new', 'send', 'close', ADD_EVENT_LISTENER_TAG]","import { SR_EVENT_EMITTER_TYPES } from '../../features/session_replay/constants';\nexport const apiMethods = ['setErrorHandler', 'finished', 'addToTrace', 'addRelease', 'addPageAction', 'setCurrentRouteName', 'setPageViewName', 'setCustomAttribute', 'interaction', 'noticeError', 'setUserId', 'setApplicationVersion', 'start', SR_EVENT_EMITTER_TYPES.RECORD, SR_EVENT_EMITTER_TYPES.PAUSE, 'log', 'wrapLogger'];\nexport const asyncApiMethods = ['setErrorHandler', 'finished', 'addToTrace', 'addRelease'];","import { handle } from '../../../common/event-emitter/handle';\nimport { now } from '../../../common/timing/now';\nimport { FEATURE_NAMES } from '../../../loaders/features/features';\nimport { SUPPORTABILITY_METRIC_CHANNEL } from '../../metrics/constants';\nimport { LOGGING_EVENT_EMITTER_CHANNEL, LOG_LEVELS } from '../constants';\n\n/**\n * @param {ContextualEE} ee - The contextual ee tied to the instance\n * @param {string} message - the log message string\n * @param {{[key: string]: *}} customAttributes - The log's custom attributes if any\n * @param {enum} level - the log level enum\n */\nexport function bufferLog(ee, message, customAttributes = {}, level = LOG_LEVELS.INFO) {\n handle(SUPPORTABILITY_METRIC_CHANNEL, [\"API/logging/\".concat(level.toLowerCase(), \"/called\")], undefined, FEATURE_NAMES.metrics, ee);\n handle(LOGGING_EVENT_EMITTER_CHANNEL, [now(), message, customAttributes, level], undefined, FEATURE_NAMES.logging, ee);\n}\n\n/**\n * Checks if a supplied log level is acceptable for use in generating a log event\n * @param {string} level -- must be cast to uppercase before running this test\n * @returns {boolean}\n */\nexport function isValidLogLevel(level) {\n if (typeof level !== 'string') return false;\n return Object.values(LOG_LEVELS).some(logLevel => logLevel === level.toUpperCase().trim());\n}","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @file Provides helper functions for wrapping functions in various scenarios.\n */\n\nimport { ee } from '../event-emitter/contextual-ee';\nimport { bundleId } from '../ids/bundle-id';\nexport const flag = \"nr@original:\".concat(bundleId);\n\n/**\n * A convenience alias of `hasOwnProperty`.\n * @type {function}\n */\nvar has = Object.prototype.hasOwnProperty;\n\n/**\n * For tracking whether an event is already being emitted inside the wrapper.\n * @type {boolean}\n */\nvar inWrapper = false;\n\n// eslint-disable-next-line\nexport default createWrapperWithEmitter;\n\n/**\n * Wraps a function in order to emit events on start, end, and error.\n * @param {Object} [emitter] - The desired emitter for events emitted by the wrapper. Defaults to the global emitter.\n * @param {boolean} always - If `true`, emit events even if already emitting an event.\n * @returns {function} The wrapped function.\n */\nexport function createWrapperWithEmitter(emitter, always) {\n emitter || (emitter = ee);\n wrapFn.inPlace = inPlace;\n\n /**\n * A flag used to determine if a native function has already been wrapped.\n * As a property on a wrapped function, contains the original function.\n * @type {string}\n */\n wrapFn.flag = flag;\n return wrapFn;\n\n /**\n * Wraps a function with event emitting functionality.\n * @param {function} fn - The function to wrap.\n * @param {string} prefix - A prefix for the names of emitted events.\n * @param {function|object} getContext - The function or object that will serve as the 'this' context for handlers of events emitted by this wrapper.\n * @param {string} methodName - The name of the method being wrapped.\n * @param {boolean} bubble - If true, emitted events should also bubble up to the old emitter upon which the `emitter` in the current scope was based (if it defines one).\n * @returns {function} The wrapped function.\n */\n function wrapFn(fn, prefix, getContext, methodName, bubble) {\n // Unless fn is both wrappable and unwrapped, return it unchanged.\n if (notWrappable(fn)) return fn;\n if (!prefix) prefix = '';\n nrWrapper[flag] = fn;\n copy(fn, nrWrapper, emitter);\n return nrWrapper;\n\n /**\n * A wrapper function that emits events before and after calling the wrapped function.\n * Any arguments will be passed along to the original function.\n * @returns {any} The return value of the wrapped function.\n */\n function nrWrapper() {\n var args;\n var originalThis;\n var ctx;\n var result;\n try {\n originalThis = this;\n args = [...arguments];\n if (typeof getContext === 'function') {\n ctx = getContext(args, originalThis);\n } else {\n ctx = getContext || {};\n }\n } catch (e) {\n report([e, '', [args, originalThis, methodName], ctx], emitter);\n }\n\n // Warning: start events may mutate args!\n safeEmit(prefix + 'start', [args, originalThis, methodName], ctx, bubble);\n try {\n result = fn.apply(originalThis, args);\n return result;\n } catch (err) {\n safeEmit(prefix + 'err', [args, originalThis, err], ctx, bubble);\n\n // rethrow error so we don't effect execution by observing.\n throw err;\n } finally {\n // happens no matter what.\n safeEmit(prefix + 'end', [args, originalThis, result], ctx, bubble);\n }\n }\n }\n\n /**\n * Creates wrapper functions around each of an array of methods on a specified object.\n * @param {Object} obj The object to which the specified methods belong.\n * @param {string[]} methods An array of method names to be wrapped.\n * @param {string} [prefix=''] A prefix to add to the names of emitted events. If `-` is the first character, also\n * adds the method name before the prefix.\n * @param {function|object} [getContext] The function or object that will serve as the 'this' context for handlers\n * of events emitted by this wrapper.\n * @param {boolean} [bubble=false] If `true`, emitted events should also bubble up to the old emitter upon which\n * the `emitter` in the current scope was based (if it defines one).\n */\n function inPlace(obj, methods, prefix, getContext, bubble) {\n if (!prefix) prefix = '';\n\n // If prefix starts with '-' set this boolean to add the method name to the prefix before passing each one to wrap.\n const prependMethodPrefix = prefix.charAt(0) === '-';\n for (let i = 0; i < methods.length; i++) {\n const method = methods[i];\n const fn = obj[method];\n\n // Unless fn is both wrappable and unwrapped, bail so we don't add extra properties with undefined values.\n if (notWrappable(fn)) continue;\n obj[method] = wrapFn(fn, prependMethodPrefix ? method + prefix : prefix, getContext, method, bubble);\n }\n }\n\n /**\n * Emits an event using the `emit` method of the `emitter` object in the executing scope, but only if an event is not\n * already being emitted (except when the executing scope defines `always` as `true`).\n * @param {string} evt - The name of the event to be emitted.\n * @param {array} arr - An array of arguments to pass with the event.\n * @param {Object} store - The function or object that will serve as the 'this'\n * context when applying handler functions for this event.\n * @param {boolean} bubble - If `true`, emitted events should also\n * bubble up to the old emitter upon which the `emitter` in the\n * executing scope was based (if it defines one).\n */\n function safeEmit(evt, arr, store, bubble) {\n if (inWrapper && !always) return;\n var prev = inWrapper;\n inWrapper = true;\n try {\n emitter.emit(evt, arr, store, always, bubble);\n } catch (e) {\n report([e, evt, arr, store], emitter);\n }\n inWrapper = prev;\n }\n}\n\n/**\n * Emits an \"internal-error\" event. Used to report errors encountered when emitting events using `safeEmit`.\n * @param {array} args - Arguments to be passed to the \"internal-error\" event.\n * @param {Object} [emitter] - The (optional) desired event emitter. Defaults to the global event emitter.\n */\nfunction report(args, emitter) {\n emitter || (emitter = ee);\n try {\n emitter.emit('internal-error', args);\n } catch (err) {\n // do nothing\n }\n}\n\n/**\n * Copies properties from one object to another. Used for creating a wrapper function from an original function and for\n * copying an original function to a property of a wrapper function named by `flag` in the executing context.\n * @param {Object} from - The source function or object.\n * @param {Object} to - The destination function or object.\n * @param {Object} [emitter] - The (optional) desired event emitter if errors are encountered while copying.\n * Defaults to the global event emitter.\n * @returns {object} - The destination founction or object with copied properties.\n */\nfunction copy(from, to, emitter) {\n if (Object.defineProperty && Object.keys) {\n // Create accessors that proxy to actual function\n try {\n var keys = Object.keys(from);\n // eslint-disable-next-line\n keys.forEach(function (key) {\n Object.defineProperty(to, key, {\n get: function () {\n return from[key];\n },\n // eslint-disable-next-line\n set: function (val) {\n from[key] = val;\n return val;\n }\n });\n });\n return to;\n } catch (e) {\n report([e], emitter);\n }\n }\n // fall back to copying properties\n for (var i in from) {\n if (has.call(from, i)) {\n to[i] = from[i];\n }\n }\n return to;\n}\n\n/**\n * Determines whether a function is eligible to be wrapped in part based on whether it has already been wrapped.\n * @param {function} fn - The function in question.\n * @returns {boolean} Whether the passed function is ineligible to be wrapped.\n */\nfunction notWrappable(fn) {\n return !(fn && typeof fn === 'function' && fn.apply && !fn[flag]);\n}","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @file Wraps native timeout and interval methods for instrumentation.\n * This module is used by: jserrors, spa.\n */\n\nimport { ee as baseEE, contextId } from '../event-emitter/contextual-ee';\nimport { EventContext } from '../event-emitter/event-context';\nimport { warn } from '../util/console';\nimport { createWrapperWithEmitter as wfn } from './wrap-function';\n\n/**\n * Wraps a supplied function and adds emitter events under the `-wrap-logger-` prefix\n * @param {Object} sharedEE - The shared event emitter on which a new scoped event emitter will be based.\n * @param {Object} parent - The parent object housing the logger function\n * @param {string} loggerFn - The name of the function in the parent object to wrap\n * @returns {Object} Scoped event emitter with a debug ID of `logger`.\n */\n// eslint-disable-next-line\nexport function wrapLogger(sharedEE, parent, loggerFn, context) {\n if (!(typeof parent === 'object' && !!parent && typeof loggerFn === 'string' && !!loggerFn && typeof parent[loggerFn] === 'function')) return warn(29);\n const ee = scopedEE(sharedEE);\n const wrapFn = wfn(ee);\n\n /**\n * This section contains the context that will be shared across all invoked calls of the wrapped function,\n * which will be used to decorate the log data later at agg time\n */\n const ctx = new EventContext(contextId);\n ctx.level = context.level;\n ctx.customAttributes = context.customAttributes;\n\n /** observe calls to and emit events prefixed with `wrap-logger-` */\n wrapFn.inPlace(parent, [loggerFn], 'wrap-logger-', ctx);\n return ee;\n}\n\n/**\n * Returns an event emitter scoped specifically for the `logger` context. This scoping is a remnant from when all the\n * features shared the same group in the event, to isolate events between features. It will likely be revisited.\n * @param {Object} sharedEE - Optional event emitter on which to base the scoped emitter.\n * Uses `ee` on the global scope if undefined).\n * @returns {Object} Scoped event emitter with a debug ID of 'logger'.\n */\nexport function scopedEE(sharedEE) {\n return (sharedEE || baseEE).get('logger');\n}","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { FEATURE_NAMES } from '../features/features';\nimport { getInfo, setInfo } from '../../common/config/info';\nimport { getRuntime } from '../../common/config/runtime';\nimport { handle } from '../../common/event-emitter/handle';\nimport { ee } from '../../common/event-emitter/contextual-ee';\nimport { drain, registerDrain } from '../../common/drain/drain';\nimport { onWindowLoad } from '../../common/window/load';\nimport { isBrowserScope } from '../../common/constants/runtime';\nimport { warn } from '../../common/util/console';\nimport { SUPPORTABILITY_METRIC_CHANNEL } from '../../features/metrics/constants';\nimport { gosCDN } from '../../common/window/nreum';\nimport { apiMethods, asyncApiMethods } from './api-methods';\nimport { SR_EVENT_EMITTER_TYPES } from '../../features/session_replay/constants';\nimport { now } from '../../common/timing/now';\nimport { MODE } from '../../common/session/constants';\nimport { LOG_LEVELS } from '../../features/logging/constants';\nimport { bufferLog } from '../../features/logging/shared/utils';\nimport { wrapLogger } from '../../common/wrap/wrap-logger';\nexport function setTopLevelCallers() {\n const nr = gosCDN();\n apiMethods.forEach(f => {\n nr[f] = (...args) => caller(f, ...args);\n });\n function caller(fnName, ...args) {\n let returnVals = [];\n Object.values(nr.initializedAgents).forEach(val => {\n if (!val || !val.api) {\n warn(38, fnName);\n } else if (val.exposed && val.api[fnName]) {\n returnVals.push(val.api[fnName](...args));\n }\n });\n return returnVals.length > 1 ? returnVals : returnVals[0];\n }\n}\nconst replayRunning = {};\nexport function setAPI(agentIdentifier, forceDrain, runSoftNavOverSpa = false) {\n if (!forceDrain) registerDrain(agentIdentifier, 'api');\n const apiInterface = {};\n var instanceEE = ee.get(agentIdentifier);\n var tracerEE = instanceEE.get('tracer');\n replayRunning[agentIdentifier] = MODE.OFF;\n instanceEE.on(SR_EVENT_EMITTER_TYPES.REPLAY_RUNNING, isRunning => {\n replayRunning[agentIdentifier] = isRunning;\n });\n var prefix = 'api-';\n var spaPrefix = prefix + 'ixn-';\n apiInterface.log = function (message, {\n customAttributes = {},\n level = LOG_LEVELS.INFO\n } = {}) {\n handle(SUPPORTABILITY_METRIC_CHANNEL, ['API/log/called'], undefined, FEATURE_NAMES.metrics, instanceEE);\n bufferLog(instanceEE, message, customAttributes, level);\n };\n apiInterface.wrapLogger = (parent, functionName, {\n customAttributes = {},\n level = LOG_LEVELS.INFO\n } = {}) => {\n handle(SUPPORTABILITY_METRIC_CHANNEL, ['API/wrapLogger/called'], undefined, FEATURE_NAMES.metrics, instanceEE);\n wrapLogger(instanceEE, parent, functionName, {\n customAttributes,\n level\n });\n };\n\n // Setup stub functions that queue calls for later processing.\n asyncApiMethods.forEach(fnName => {\n apiInterface[fnName] = apiCall(prefix, fnName, true, 'api');\n });\n apiInterface.addPageAction = apiCall(prefix, 'addPageAction', true, FEATURE_NAMES.genericEvents);\n apiInterface.setPageViewName = function (name, host) {\n if (typeof name !== 'string') return;\n if (name.charAt(0) !== '/') name = '/' + name;\n getRuntime(agentIdentifier).customTransaction = (host || 'http://custom.transaction') + name;\n return apiCall(prefix, 'setPageViewName', true)();\n };\n\n /**\n * Attach the key-value attribute onto agent payloads. All browser events in NR will be affected.\n * @param {string} key\n * @param {string|number|boolean|null} value - null indicates the key should be removed or erased\n * @param {string} apiName\n * @param {boolean} addToBrowserStorage - whether this attribute should be stored in browser storage API and retrieved by the next agent context or initialization\n * @returns @see apiCall\n */\n function appendJsAttribute(key, value, apiName, addToBrowserStorage) {\n const currentInfo = getInfo(agentIdentifier);\n if (value === null) {\n delete currentInfo.jsAttributes[key];\n } else {\n setInfo(agentIdentifier, {\n ...currentInfo,\n jsAttributes: {\n ...currentInfo.jsAttributes,\n [key]: value\n }\n });\n }\n return apiCall(prefix, apiName, true, !!addToBrowserStorage || value === null ? 'session' : undefined)(key, value);\n }\n apiInterface.setCustomAttribute = function (name, value, persistAttribute = false) {\n if (typeof name !== 'string') {\n warn(39, typeof name);\n return;\n }\n if (!(['string', 'number', 'boolean'].includes(typeof value) || value === null)) {\n warn(40, typeof value);\n return;\n }\n return appendJsAttribute(name, value, 'setCustomAttribute', persistAttribute);\n };\n /**\n * Attach the 'enduser.id' attribute onto agent payloads. This may be used in NR queries to group all browser events by specific users.\n * @param {string} value - unique user identifier; a null user id suggests none should exist\n * @returns @see apiCall\n */\n apiInterface.setUserId = function (value) {\n if (!(typeof value === 'string' || value === null)) {\n warn(41, typeof value);\n return;\n }\n return appendJsAttribute('enduser.id', value, 'setUserId', true);\n };\n\n /**\n * Attach the 'applcation.version' attribute onto agent payloads. This may be used in NR queries to group all browser events by a specific customer-defined release.\n * @param {string|null} value - Application version -- if null, will \"unset\" the value\n * @returns @see apiCall\n */\n apiInterface.setApplicationVersion = function (value) {\n if (!(typeof value === 'string' || value === null)) {\n warn(42, typeof value);\n return;\n }\n return appendJsAttribute('application.version', value, 'setApplicationVersion', false);\n };\n apiInterface.start = () => {\n try {\n handle(SUPPORTABILITY_METRIC_CHANNEL, ['API/start/called'], undefined, FEATURE_NAMES.metrics, instanceEE);\n instanceEE.emit('manual-start-all');\n } catch (err) {\n warn(23, err);\n }\n };\n apiInterface[SR_EVENT_EMITTER_TYPES.RECORD] = function () {\n handle(SUPPORTABILITY_METRIC_CHANNEL, ['API/recordReplay/called'], undefined, FEATURE_NAMES.metrics, instanceEE);\n handle(SR_EVENT_EMITTER_TYPES.RECORD, [], undefined, FEATURE_NAMES.sessionReplay, instanceEE);\n };\n apiInterface[SR_EVENT_EMITTER_TYPES.PAUSE] = function () {\n handle(SUPPORTABILITY_METRIC_CHANNEL, ['API/pauseReplay/called'], undefined, FEATURE_NAMES.metrics, instanceEE);\n handle(SR_EVENT_EMITTER_TYPES.PAUSE, [], undefined, FEATURE_NAMES.sessionReplay, instanceEE);\n };\n apiInterface.interaction = function (options) {\n return new InteractionHandle().get(typeof options === 'object' ? options : {});\n };\n function InteractionHandle() {}\n const InteractionApiProto = InteractionHandle.prototype = {\n createTracer: function (name, cb) {\n var contextStore = {};\n var ixn = this;\n var hasCb = typeof cb === 'function';\n handle(SUPPORTABILITY_METRIC_CHANNEL, ['API/createTracer/called'], undefined, FEATURE_NAMES.metrics, instanceEE);\n // Soft navigations won't support Tracer nodes, but this fn should still work the same otherwise (e.g., run the orig cb).\n if (!runSoftNavOverSpa) handle(spaPrefix + 'tracer', [now(), name, contextStore], ixn, FEATURE_NAMES.spa, instanceEE);\n return function () {\n tracerEE.emit((hasCb ? '' : 'no-') + 'fn-start', [now(), ixn, hasCb], contextStore);\n if (hasCb) {\n try {\n return cb.apply(this, arguments);\n } catch (err) {\n const error = typeof err === 'string' ? new Error(err) : err;\n tracerEE.emit('fn-err', [arguments, this, error], contextStore);\n // the error came from outside the agent, so don't swallow\n throw error;\n } finally {\n tracerEE.emit('fn-end', [now()], contextStore);\n }\n }\n };\n }\n };\n ['actionText', 'setName', 'setAttribute', 'save', 'ignore', 'onEnd', 'getContext', 'end', 'get'].forEach(name => {\n InteractionApiProto[name] = apiCall(spaPrefix, name, undefined, runSoftNavOverSpa ? FEATURE_NAMES.softNav : FEATURE_NAMES.spa);\n });\n apiInterface.setCurrentRouteName = runSoftNavOverSpa ? apiCall(spaPrefix, 'routeName', undefined, FEATURE_NAMES.softNav) : apiCall(prefix, 'routeName', true, FEATURE_NAMES.spa);\n function apiCall(prefix, name, notSpa, bufferGroup) {\n return function () {\n handle(SUPPORTABILITY_METRIC_CHANNEL, ['API/' + name + '/called'], undefined, FEATURE_NAMES.metrics, instanceEE);\n if (bufferGroup) handle(prefix + name, [now(), ...arguments], notSpa ? null : this, bufferGroup, instanceEE); // no bufferGroup means only the SM is emitted\n return notSpa ? undefined : this; // returns the InteractionHandle which allows these methods to be chained\n };\n }\n apiInterface.noticeError = function (err, customAttributes) {\n if (typeof err === 'string') err = new Error(err);\n handle(SUPPORTABILITY_METRIC_CHANNEL, ['API/noticeError/called'], undefined, FEATURE_NAMES.metrics, instanceEE);\n handle('err', [err, now(), false, customAttributes, !!replayRunning[agentIdentifier]], undefined, FEATURE_NAMES.jserrors, instanceEE);\n };\n\n // theres no window.load event on non-browser scopes, lazy load immediately\n if (!isBrowserScope) lazyLoad();\n // try to stay out of the way of the window.load event, lazy load once that has finished.\n else onWindowLoad(() => lazyLoad(), true);\n function lazyLoad() {\n import(/* webpackChunkName: \"async-api\" */'./apiAsync').then(({\n setAPI\n }) => {\n setAPI(agentIdentifier);\n drain(agentIdentifier, 'api');\n }).catch(err => {\n warn(27, err);\n instanceEE.abort();\n });\n }\n return apiInterface;\n}","import { getNREUMInitializedAgent } from '../window/nreum';\nimport { getModeledObject } from './configurable';\nconst model = {\n accountID: undefined,\n trustKey: undefined,\n agentID: undefined,\n licenseKey: undefined,\n applicationID: undefined,\n xpid: undefined\n};\nconst _cache = {};\nexport function getLoaderConfig(id) {\n if (!id) throw new Error('All loader-config objects require an agent identifier!');\n if (!_cache[id]) throw new Error(\"LoaderConfig for \".concat(id, \" was never set\"));\n return _cache[id];\n}\nexport function setLoaderConfig(id, obj) {\n if (!id) throw new Error('All loader-config objects require an agent identifier!');\n _cache[id] = getModeledObject(obj, model);\n const agentInst = getNREUMInitializedAgent(id);\n if (agentInst) agentInst.loader_config = _cache[id];\n}","import { globalScope } from '../constants/runtime';\nconst GLOBAL_EVENT_NAMESPACE = 'newrelic';\nexport function dispatchGlobalEvent(detail = {}) {\n try {\n globalScope.dispatchEvent(new CustomEvent(GLOBAL_EVENT_NAMESPACE, {\n detail\n }));\n } catch (err) {\n // something happened... dispatchEvent or CustomEvent might not be supported\n // decide what to do about it here\n }\n}","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { ee } from '../event-emitter/contextual-ee';\nimport { dispatchGlobalEvent } from '../dispatch/global-event';\nconst sentIds = new Set();\n\n/** A map of feature flags and their values as provided by the rum call -- scoped by agent ID */\nexport const activatedFeatures = {};\n\n/**\n * Sets the activatedFeatures object, dispatches the global loaded event,\n * and emits the rumresp flag to features\n * @param {{[key:string]:number}} flags key-val pair of flag names and numeric\n * @param {string} agentIdentifier agent instance identifier\n * @returns {void}\n */\nexport function activateFeatures(flags, agentIdentifier) {\n const sharedEE = ee.get(agentIdentifier);\n activatedFeatures[agentIdentifier] ??= {};\n if (!(flags && typeof flags === 'object')) return;\n if (sentIds.has(agentIdentifier)) return;\n sharedEE.emit('rumresp', [flags]);\n activatedFeatures[agentIdentifier] = flags;\n sentIds.add(agentIdentifier);\n\n // let any window level subscribers know that the agent is running\n dispatchGlobalEvent({\n loaded: true\n });\n}","import { setAPI, setTopLevelCallers } from '../api/api';\nimport { addToNREUM, gosCDN } from '../../common/window/nreum';\nimport { setInfo } from '../../common/config/info';\nimport { getConfiguration, setConfiguration } from '../../common/config/init';\nimport { setLoaderConfig } from '../../common/config/loader-config';\nimport { setRuntime } from '../../common/config/runtime';\nimport { activatedFeatures } from '../../common/util/feature-flags';\nimport { isWorkerScope } from '../../common/constants/runtime';\nimport { redefinePublicPath } from './public-path';\nimport { ee } from '../../common/event-emitter/contextual-ee';\nlet alreadySetOnce = false; // the configure() function can run multiple times in agent lifecycle\n\n/**\n * Sets or re-sets the agent's configuration values from global settings. This also attach those as properties to the agent instance.\n */\nexport function configure(agent, opts = {}, loaderType, forceDrain) {\n // eslint-disable-next-line camelcase\n let {\n init,\n info,\n loader_config,\n runtime = {},\n exposed = true\n } = opts;\n runtime.loaderType = loaderType;\n const nr = gosCDN();\n if (!info) {\n init = nr.init;\n info = nr.info;\n // eslint-disable-next-line camelcase\n loader_config = nr.loader_config;\n }\n setConfiguration(agent.agentIdentifier, init || {});\n // eslint-disable-next-line camelcase\n setLoaderConfig(agent.agentIdentifier, loader_config || {});\n info.jsAttributes ??= {};\n if (isWorkerScope) {\n // add a default attr to all worker payloads\n info.jsAttributes.isWorker = true;\n }\n setInfo(agent.agentIdentifier, info);\n const updatedInit = getConfiguration(agent.agentIdentifier);\n const internalTrafficList = [info.beacon, info.errorBeacon];\n if (!alreadySetOnce) {\n if (updatedInit.proxy.assets) {\n redefinePublicPath(updatedInit.proxy.assets);\n internalTrafficList.push(updatedInit.proxy.assets);\n }\n if (updatedInit.proxy.beacon) internalTrafficList.push(updatedInit.proxy.beacon);\n setTopLevelCallers(); // no need to set global APIs on newrelic obj more than once\n addToNREUM('activatedFeatures', activatedFeatures);\n\n // Update if soft_navigations is allowed to run AND part of this agent build, used to override old spa functions.\n agent.runSoftNavOverSpa &&= updatedInit.soft_navigations.enabled === true && updatedInit.feature_flags.includes('soft_nav');\n }\n runtime.denyList = [...(updatedInit.ajax.deny_list || []), ...(updatedInit.ajax.block_internal ? internalTrafficList : [])];\n runtime.ptid = agent.agentIdentifier;\n setRuntime(agent.agentIdentifier, runtime);\n agent.ee = ee.get(agent.agentIdentifier);\n if (agent.api === undefined) agent.api = setAPI(agent.agentIdentifier, forceDrain, agent.runSoftNavOverSpa);\n if (agent.exposed === undefined) agent.exposed = exposed;\n alreadySetOnce = true;\n}","import { FEATURE_NAMES } from './features';\nexport function getFeatureDependencyNames(feature) {\n switch (feature) {\n case FEATURE_NAMES.ajax:\n return [FEATURE_NAMES.jserrors];\n case FEATURE_NAMES.sessionTrace:\n return [FEATURE_NAMES.ajax, FEATURE_NAMES.pageViewEvent];\n case FEATURE_NAMES.sessionReplay:\n return [FEATURE_NAMES.sessionTrace];\n case FEATURE_NAMES.pageViewTiming:\n return [FEATURE_NAMES.pageViewEvent];\n // this could change if we disconnect window load timings\n default:\n return [];\n }\n}","import { ee } from '../../common/event-emitter/contextual-ee';\nexport class FeatureBase {\n constructor(agentIdentifier, aggregator, featureName) {\n /** @type {string} */\n this.agentIdentifier = agentIdentifier;\n /** @type {import('../../common/aggregate/aggregator').Aggregator} */\n this.aggregator = aggregator;\n /** @type {import('../../common/event-emitter/contextual-ee').ee} */\n this.ee = ee.get(agentIdentifier);\n /** @type {string} */\n this.featureName = featureName;\n /**\n * Blocked can be used to prevent aggregation and harvest after inititalization time of the feature.\n * This can currently happen if RUM response setToken flag is 0, which is tied to ingest account entitlement info.\n * @type {boolean}\n */\n this.blocked = false;\n }\n}","import { getConfigurationValue } from '../../common/config/init';\nimport { isBrowserScope } from '../../common/constants/runtime';\n\n/**\n * Checks if session can be tracked, affects session entity and dependent features\n * @param {string} agentId\n * @returns {boolean}\n */\nexport const canEnableSessionTracking = agentId => {\n return isBrowserScope && getConfigurationValue(agentId, 'privacy.cookies_enabled') === true;\n};","import { gosNREUMOriginals } from '../../../common/window/nreum';\nimport { getConfigurationValue } from '../../../common/config/init';\nimport { canEnableSessionTracking } from '../../utils/feature-gates';\nimport { originTime } from '../../../common/constants/runtime';\nexport function hasReplayPrerequisite(agentId) {\n return !!gosNREUMOriginals().o.MO &&\n // Session Replay cannot work without Mutation Observer\n canEnableSessionTracking(agentId) &&\n // requires session tracking to be running (hence \"session\" replay...)\n getConfigurationValue(agentId, 'session_trace.enabled') === true; // Session Replay as of now is tightly coupled with Session Trace in the UI\n}\nexport function isPreloadAllowed(agentId) {\n return getConfigurationValue(agentId, 'session_replay.preload') === true && hasReplayPrerequisite(agentId);\n}\nexport function buildNRMetaNode(timestamp, timeKeeper) {\n const correctedTimestamp = timeKeeper.correctAbsoluteTimestamp(timestamp);\n return {\n originalTimestamp: timestamp,\n correctedTimestamp,\n timestampDiff: timestamp - correctedTimestamp,\n originTime,\n correctedOriginTime: timeKeeper.correctedOriginTime,\n originTimeDiff: Math.floor(originTime - timeKeeper.correctedOriginTime)\n };\n}","/**\n * Reduce the invocation of the supplied function so that it is only invoked\n * once within a given timeout.\n *\n * If `wait` is `0`, the function will be invoked during the next tick.\n * If `options.leading` is false or not provided, the function will be invoked\n * N milliseconds after the last invocation of the returned function where\n * N is the `timeout` value.\n * If `options.leading` is true, the function will be invoked immediately upon\n * the first invocation of the returned function and not again for N milliseconds\n * where N is the `timeout` value.\n * @param {function} func Function whose invocation should be limited so it is only invoked\n * once within a given timeout period.\n * @param {number} timeout Time in milliseconds that the function should only be invoked\n * once within.\n * @param {object} options Debounce options\n * @param {boolean} options.leading Forces the function to be invoked on the first\n * invocation of the returned function instead of N milliseconds after the last\n * invocation.\n * @returns {function} A wrapping function that will ensure the provided function\n * is invoked only once within the given timeout.\n */\nexport function debounce(func, timeout = 500, options = {}) {\n const leading = options?.leading || false;\n let timer;\n return (...args) => {\n if (leading && timer === undefined) {\n func.apply(this, args);\n timer = setTimeout(() => {\n timer = clearTimeout(timer);\n }, timeout);\n }\n if (!leading) {\n clearTimeout(timer);\n timer = setTimeout(() => {\n func.apply(this, args);\n }, timeout);\n }\n };\n}\n\n/**\n * Reduce the invocation of the supplied function so that it is only invoked\n * once.\n * @param {function} func Function whose invocation should be limited so it is only invoked\n * once.\n * @returns {function} A wrapping function that will ensure the provided function\n * is invoked only once.\n */\nexport function single(func) {\n let called = false;\n return (...args) => {\n if (!called) {\n called = true;\n func.apply(this, args);\n }\n };\n}","/**\n * @file Defines `InstrumentBase` to be used as the super of the Instrument classes implemented by each feature.\n * Inherits and executes the `checkConfiguration` method from [FeatureBase]{@link ./feature-base}, which also\n * exposes the `blocked` property.\n */\n\nimport { drain, registerDrain } from '../../common/drain/drain';\nimport { FeatureBase } from './feature-base';\nimport { onWindowLoad } from '../../common/window/load';\nimport { isBrowserScope } from '../../common/constants/runtime';\nimport { warn } from '../../common/util/console';\nimport { FEATURE_NAMES } from '../../loaders/features/features';\nimport { getConfigurationValue } from '../../common/config/init';\nimport { hasReplayPrerequisite } from '../session_replay/shared/utils';\nimport { canEnableSessionTracking } from './feature-gates';\nimport { single } from '../../common/util/invoke';\n\n/**\n * Base class for instrumenting a feature.\n * @extends FeatureBase\n */\nexport class InstrumentBase extends FeatureBase {\n /**\n * Instantiate InstrumentBase.\n * @param {string} agentIdentifier - The unique ID of the instantiated agent (relative to global scope).\n * @param {import('../../common/aggregate/aggregator').Aggregator} aggregator - The shared Aggregator that will handle batching and reporting of data.\n * @param {string} featureName - The name of the feature module (used to construct file path).\n * @param {boolean} [auto=true] - Determines whether the feature should automatically register to have the draining\n * of its pooled instrumentation data handled by the agent's centralized drain functionality, rather than draining\n * immediately. Primarily useful for fine-grained control in tests.\n */\n constructor(agentIdentifier, aggregator, featureName, auto = true) {\n super(agentIdentifier, aggregator, featureName);\n this.auto = auto;\n\n /** @type {Function | undefined} This should be set by any derived Instrument class if it has things to do when feature fails or is killed. */\n this.abortHandler = undefined;\n\n /**\n * @type {import('./aggregate-base').AggregateBase} Holds the reference to the feature's aggregate module counterpart, if and after it has been initialized. This may not be assigned until after page loads!\n * The only purpose of this for now is to expose it to the NREUM interface, as the feature's instrument instance is already exposed.\n */\n this.featAggregate = undefined;\n\n /**\n * @type {Promise} Assigned immediately after @see importAggregator runs. Serves as a signal for when the inner async fn finishes execution. Useful for features to await\n * one another if there are inter-features dependencies.\n * TODO: This is only used for the SPA feature component tests and should be refactored out.\n */\n this.onAggregateImported = undefined;\n\n /** used in conjunction with newrelic.start() to defer harvesting in features */\n if (getConfigurationValue(this.agentIdentifier, \"\".concat(this.featureName, \".autoStart\")) === false) this.auto = false;\n /** if the feature requires opt-in (!auto-start), it will get registered once the api has been called */\n if (this.auto) registerDrain(agentIdentifier, featureName);else {\n this.ee.on('manual-start-all', single(() => {\n // register the feature to drain only once the API has been called, it will drain when importAggregator finishes for all the features\n // called by the api in that cycle\n registerDrain(this.agentIdentifier, this.featureName);\n this.auto = true;\n this.importAggregator();\n }));\n }\n }\n\n /**\n * Lazy-load the latter part of the feature: its aggregator. This method is called by the first part of the feature\n * (the instrumentation) when instrumentation is complete.\n * @param {Object} [argsObjFromInstrument] - any values or references to pass down to aggregate\n * @returns void\n */\n importAggregator(argsObjFromInstrument = {}) {\n if (this.featAggregate || !this.auto) return;\n let loadedSuccessfully;\n this.onAggregateImported = new Promise(resolve => {\n loadedSuccessfully = resolve;\n });\n const importLater = async () => {\n let session;\n try {\n if (canEnableSessionTracking(this.agentIdentifier)) {\n // would require some setup before certain features start\n const {\n setupAgentSession\n } = await import(/* webpackChunkName: \"session-manager\" */'./agent-session');\n session = setupAgentSession(this.agentIdentifier);\n }\n } catch (e) {\n warn(20, e);\n this.ee.emit('internal-error', [e]);\n if (this.featureName === FEATURE_NAMES.sessionReplay) this.abortHandler?.(); // SR should stop recording if session DNE\n }\n\n /**\n * Note this try-catch differs from the one in Agent.run() in that it's placed later in a page's lifecycle and\n * it's only responsible for aborting its one specific feature, rather than all.\n */\n try {\n if (!this.#shouldImportAgg(this.featureName, session)) {\n drain(this.agentIdentifier, this.featureName);\n loadedSuccessfully(false); // aggregate module isn't loaded at all\n return;\n }\n const {\n lazyFeatureLoader\n } = await import(/* webpackChunkName: \"lazy-feature-loader\" */'./lazy-feature-loader');\n const {\n Aggregate\n } = await lazyFeatureLoader(this.featureName, 'aggregate');\n this.featAggregate = new Aggregate(this.agentIdentifier, this.aggregator, argsObjFromInstrument);\n loadedSuccessfully(true);\n } catch (e) {\n warn(34, e);\n this.abortHandler?.(); // undo any important alterations made to the page\n // not supported yet but nice to do: \"abort\" this agent's EE for this feature specifically\n drain(this.agentIdentifier, this.featureName, true);\n loadedSuccessfully(false);\n if (this.ee) this.ee.abort();\n }\n };\n\n // For regular web pages, we want to wait and lazy-load the aggregator only after all page resources are loaded.\n // Non-browser scopes (i.e. workers) have no `window.load` event, so the aggregator can be lazy-loaded immediately.\n if (!isBrowserScope) importLater();else onWindowLoad(() => importLater(), true);\n }\n\n /**\n * Make a determination if an aggregate class should even be imported\n * @param {string} featureName\n * @param {import('../../common/session/session-entity').SessionEntity} session\n * @returns\n */\n #shouldImportAgg(featureName, session) {\n switch (featureName) {\n case FEATURE_NAMES.sessionReplay:\n // the session manager must be initialized successfully for Replay & Trace features\n return hasReplayPrerequisite(this.agentIdentifier) && !!session;\n case FEATURE_NAMES.sessionTrace:\n return !!session;\n default:\n return true;\n }\n }\n}","import { FEATURE_NAMES } from '../../loaders/features/features';\nexport const FEATURE_NAME = FEATURE_NAMES.pageViewEvent;","import { InstrumentBase } from '../../utils/instrument-base';\nimport * as CONSTANTS from '../constants';\nexport class Instrument extends InstrumentBase {\n static featureName = CONSTANTS.FEATURE_NAME;\n constructor(agentIdentifier, aggregator, auto = true) {\n super(agentIdentifier, aggregator, CONSTANTS.FEATURE_NAME, auto);\n this.importAggregator();\n }\n}\nexport const PageViewEvent = Instrument;","import { warn } from '../util/console';\nconst model = {\n agentIdentifier: '',\n ee: undefined\n};\nexport class SharedContext {\n constructor(context) {\n try {\n if (typeof context !== 'object') return warn(8);\n this.sharedContext = {};\n Object.assign(this.sharedContext, model);\n Object.entries(context).forEach(([key, value]) => {\n if (Object.keys(model).includes(key)) this.sharedContext[key] = value;\n });\n } catch (err) {\n warn(9, err);\n }\n }\n}","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { SharedContext } from '../context/shared-context';\nexport class Aggregator extends SharedContext {\n constructor(parent) {\n super(parent);\n this.aggregatedData = {};\n }\n\n // Items with the same type and name get aggregated together\n // params are example data from the aggregated items\n // metrics are the numeric values to be aggregated\n\n store(type, name, params, newMetrics, customParams) {\n var bucket = this.getBucket(type, name, params, customParams);\n bucket.metrics = aggregateMetrics(newMetrics, bucket.metrics);\n return bucket;\n }\n merge(type, name, metrics, params, customParams) {\n var bucket = this.getBucket(type, name, params, customParams);\n if (!bucket.metrics) {\n bucket.metrics = metrics;\n return;\n }\n var oldMetrics = bucket.metrics;\n oldMetrics.count += metrics.count;\n\n // iterate through each new metric and merge\n Object.keys(metrics || {}).forEach(key => {\n // count is a special case handled above\n if (key === 'count') return;\n var oldMetric = oldMetrics[key];\n var newMetric = metrics[key];\n\n // handling the case where newMetric is a single-value first\n if (newMetric && !newMetric.c) {\n oldMetrics[key] = updateMetric(newMetric.t, oldMetric);\n } else {\n // newMetric is a metric object\n oldMetrics[key] = mergeMetric(newMetric, oldMetrics[key]);\n }\n });\n }\n storeMetric(type, name, params, value) {\n var bucket = this.getBucket(type, name, params);\n bucket.stats = updateMetric(value, bucket.stats);\n return bucket;\n }\n getBucket(type, name, params, customParams) {\n if (!this.aggregatedData[type]) this.aggregatedData[type] = {};\n var bucket = this.aggregatedData[type][name];\n if (!bucket) {\n bucket = this.aggregatedData[type][name] = {\n params: params || {}\n };\n if (customParams) {\n bucket.custom = customParams;\n }\n }\n return bucket;\n }\n get(type, name) {\n // if name is passed, get a single bucket\n if (name) return this.aggregatedData[type] && this.aggregatedData[type][name];\n // else, get all buckets of that type\n return this.aggregatedData[type];\n }\n\n // Like get, but for many types and it deletes the retrieved content from the aggregatedData\n take(types) {\n var results = {};\n var type = '';\n var hasData = false;\n for (var i = 0; i < types.length; i++) {\n type = types[i];\n results[type] = Object.values(this.aggregatedData[type] || {});\n if (results[type].length) hasData = true;\n delete this.aggregatedData[type];\n }\n return hasData ? results : null;\n }\n}\nfunction aggregateMetrics(newMetrics, oldMetrics) {\n if (!oldMetrics) oldMetrics = {\n count: 0\n };\n oldMetrics.count += 1;\n Object.entries(newMetrics || {}).forEach(([key, value]) => {\n oldMetrics[key] = updateMetric(value, oldMetrics[key]);\n });\n return oldMetrics;\n}\nfunction updateMetric(value, metric) {\n // when there is no value, then send only count\n if (value == null) {\n return updateCounterMetric(metric);\n }\n\n // When there is only one data point, the c (count), min, max, and sos (sum of squares) params are superfluous.\n if (!metric) return {\n t: value\n };\n\n // but on the second data point, we need to calculate the other values before aggregating in new values\n if (!metric.c) {\n metric = createMetricObject(metric.t);\n }\n\n // at this point, metric is always uncondensed\n metric.c += 1;\n metric.t += value;\n metric.sos += value * value;\n if (value > metric.max) metric.max = value;\n if (value < metric.min) metric.min = value;\n return metric;\n}\nfunction updateCounterMetric(metric) {\n if (!metric) {\n metric = {\n c: 1\n };\n } else {\n metric.c++;\n }\n return metric;\n}\nfunction mergeMetric(newMetric, oldMetric) {\n if (!oldMetric) return newMetric;\n if (!oldMetric.c) {\n // oldMetric is a single-value\n oldMetric = createMetricObject(oldMetric.t);\n }\n oldMetric.min = Math.min(newMetric.min, oldMetric.min);\n oldMetric.max = Math.max(newMetric.max, oldMetric.max);\n oldMetric.t += newMetric.t;\n oldMetric.sos += newMetric.sos;\n oldMetric.c += newMetric.c;\n return oldMetric;\n}\n\n// take a value and create a metric object\nfunction createMetricObject(value) {\n return {\n t: value,\n min: value,\n max: value,\n sos: value * value,\n c: 1\n };\n}","// important side effects\nimport './configure/public-path';\nimport './configure/nonce';\n// loader files\nimport { AgentBase } from './agent-base';\nimport { getEnabledFeatures } from './features/enabled-features';\nimport { configure } from './configure/configure';\nimport { getFeatureDependencyNames } from './features/featureDependencies';\nimport { featurePriority, FEATURE_NAMES } from './features/features';\n// required features\nimport { Instrument as PageViewEvent } from '../features/page_view_event/instrument';\n// common files\nimport { Aggregator } from '../common/aggregate/aggregator';\nimport { gosNREUM, setNREUMInitializedAgent } from '../common/window/nreum';\nimport { warn } from '../common/util/console';\nimport { globalScope } from '../common/constants/runtime';\n\n/**\n * A flexible class that may be used to compose an agent from a select subset of feature modules. In applications\n * sensitive to network load, this may result in smaller builds with slightly lower performance impact.\n */\nexport class Agent extends AgentBase {\n /**\n * @param {Object} options Options to initialize agent with\n * @param {string} [agentIdentifier] Optional identifier of agent\n */\n constructor(options, agentIdentifier) {\n super(agentIdentifier);\n if (!globalScope) {\n // We could not determine the runtime environment. Short-circuite the agent here\n // to avoid possible exceptions later that may cause issues with customer's application.\n warn(21);\n return;\n }\n this.sharedAggregator = new Aggregator({\n agentIdentifier: this.agentIdentifier\n });\n this.features = {};\n setNREUMInitializedAgent(this.agentIdentifier, this); // append this agent onto the global NREUM.initializedAgents\n\n this.desiredFeatures = new Set(options.features || []); // expected to be a list of static Instrument/InstrumentBase classes, see \"spa.js\" for example\n // For Now... ALL agents must make the rum call whether the page_view_event feature was enabled or not.\n // NR1 creates an index on the rum call, and if not seen for a few days, will remove the browser app!\n // Future work is being planned to evaluate removing this behavior from the backend, but for now we must ensure this call is made\n this.desiredFeatures.add(PageViewEvent);\n this.runSoftNavOverSpa = [...this.desiredFeatures].some(instr => instr.featureName === FEATURE_NAMES.softNav);\n configure(this, options, options.loaderType || 'agent'); // add api, exposed, and other config properties\n\n this.run();\n }\n get config() {\n return {\n info: this.info,\n init: this.init,\n loader_config: this.loader_config,\n runtime: this.runtime\n };\n }\n run() {\n // Attempt to initialize all the requested features (sequentially in prio order & synchronously), with any failure aborting the whole process.\n try {\n const enabledFeatures = getEnabledFeatures(this.agentIdentifier);\n const featuresToStart = [...this.desiredFeatures];\n featuresToStart.sort((a, b) => featurePriority[a.featureName] - featurePriority[b.featureName]);\n featuresToStart.forEach(InstrumentCtor => {\n if (!enabledFeatures[InstrumentCtor.featureName] && InstrumentCtor.featureName !== FEATURE_NAMES.pageViewEvent) return; // PVE is required to run even if it's marked disabled\n if (this.runSoftNavOverSpa && InstrumentCtor.featureName === FEATURE_NAMES.spa) return;\n if (!this.runSoftNavOverSpa && InstrumentCtor.featureName === FEATURE_NAMES.softNav) return;\n const dependencies = getFeatureDependencyNames(InstrumentCtor.featureName);\n const missingDependencies = dependencies.filter(featName => !(featName in this.features)); // any other feature(s) this depends on should've been initialized on prior iterations by priority order\n if (missingDependencies.length > 0) {\n warn(36, {\n targetFeature: InstrumentCtor.featureName,\n missingDependencies\n });\n }\n this.features[InstrumentCtor.featureName] = new InstrumentCtor(this.agentIdentifier, this.sharedAggregator);\n });\n } catch (err) {\n warn(22, err);\n for (const featName in this.features) {\n // this.features hold only features that have been instantiated\n this.features[featName].abortHandler?.();\n }\n const newrelic = gosNREUM();\n delete newrelic.initializedAgents[this.agentIdentifier]?.api; // prevent further calls to agent-specific APIs (see \"configure.js\")\n delete newrelic.initializedAgents[this.agentIdentifier]?.features; // GC mem used internally by features\n delete this.sharedAggregator;\n // Keep the initialized agent object with its configs for troubleshooting purposes.\n const thisEE = newrelic.ee.get(this.agentIdentifier);\n thisEE.abort(); // set flag and clear backlog\n return false;\n }\n }\n}","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { documentAddEventListener } from '../event-listener/event-listener-opts';\n\n/**\n * @param {function} cb - called when a visibility change occurs with the vis state at that time\n * @param {boolean} [toHiddenOnly=false] - only execute the 'cb' when the vis is changing to the hidden state; no arg is passed to 'cb' if used\n * @returns void\n */\nexport function subscribeToVisibilityChange(cb, toHiddenOnly = false, capture, abortSignal) {\n documentAddEventListener('visibilitychange', handleVisibilityChange, capture, abortSignal);\n function handleVisibilityChange() {\n if (toHiddenOnly) {\n // trigger cb on change to hidden state only\n if (document.visibilityState === 'hidden') cb();\n return;\n }\n cb(document.visibilityState);\n }\n}","import { FEATURE_NAMES } from '../../loaders/features/features';\nexport const FEATURE_NAME = FEATURE_NAMES.pageViewTiming;","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { handle } from '../../../common/event-emitter/handle';\nimport { subscribeToVisibilityChange } from '../../../common/window/page-visibility';\nimport { windowAddEventListener } from '../../../common/event-listener/event-listener-opts';\nimport { InstrumentBase } from '../../utils/instrument-base';\nimport { FEATURE_NAME } from '../constants';\nimport { isBrowserScope } from '../../../common/constants/runtime';\nimport { now } from '../../../common/timing/now';\nexport class Instrument extends InstrumentBase {\n static featureName = FEATURE_NAME;\n constructor(agentIdentifier, aggregator, auto = true) {\n super(agentIdentifier, aggregator, FEATURE_NAME, auto);\n if (!isBrowserScope) return; // CWV is irrelevant outside web context\n\n // While we try to replicate web-vital's visibilitywatcher logic in an effort to defer that library to post-pageload, this isn't perfect and doesn't consider prerendering.\n subscribeToVisibilityChange(() => handle('docHidden', [now()], undefined, FEATURE_NAME, this.ee), true);\n\n // Window fires its pagehide event (typically on navigation--this occurrence is a *subset* of vis change); don't defer this unless it's guarantee it cannot happen before load(?)\n windowAddEventListener('pagehide', () => handle('winPagehide', [now()], undefined, FEATURE_NAME, this.ee));\n this.importAggregator();\n }\n}\nexport const PageViewTiming = Instrument;","// import { handle } from '../../../common/event-emitter/handle'\n// import { WEBSOCKET_TAG, wrapWebSocket } from '../../../common/wrap/wrap-websocket'\nimport { InstrumentBase } from '../../utils/instrument-base';\nimport { FEATURE_NAME /*, WATCHABLE_WEB_SOCKET_EVENTS */ } from '../constants';\nexport class Instrument extends InstrumentBase {\n static featureName = FEATURE_NAME;\n constructor(agentIdentifier, aggregator, auto = true) {\n super(agentIdentifier, aggregator, FEATURE_NAME, auto);\n // wrapWebSocket(this.ee)\n\n // WATCHABLE_WEB_SOCKET_EVENTS.forEach((suffix) => {\n // this.ee.on(WEBSOCKET_TAG + suffix, (...args) => {\n // handle('buffered-' + WEBSOCKET_TAG + suffix, [...args], undefined, this.featureName, this.ee)\n // })\n // })\n\n this.importAggregator();\n }\n}\nexport const Metrics = Instrument;","import { FEATURE_NAMES } from '../../loaders/features/features';\nexport const FEATURE_NAME = FEATURE_NAMES.jserrors;","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { ee } from '../event-emitter/contextual-ee';\n\n/**\n * Returns a function for use as a replacer parameter in JSON.stringify() to handle circular references.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cyclic_object_value MDN - Cyclical object value}\n * @returns {Function} A function that filters out values it has seen before.\n */\nconst getCircularReplacer = () => {\n const seen = new WeakSet();\n return (key, value) => {\n if (typeof value === 'object' && value !== null) {\n if (seen.has(value)) {\n return;\n }\n seen.add(value);\n }\n return value;\n };\n};\n\n/**\n * The native JSON.stringify method augmented with a replacer function to handle circular references.\n * Circular references will be excluded from the JSON output rather than triggering errors.\n * @param {*} val - A value to be converted to a JSON string.\n * @returns {string} A JSON string representation of the value, with circular references handled.\n */\nexport function stringify(val) {\n try {\n return JSON.stringify(val, getCircularReplacer()) ?? '';\n } catch (e) {\n try {\n ee.emit('internal-error', [e]);\n } catch (err) {\n // do nothing\n }\n // return a string so that downstream users of the method do not throw errors\n return '';\n }\n}","import { stringify } from '../../../common/util/stringify';\n\n/**\n * Represents an uncaught non Error type error. This class does\n * not extend the Error class to prevent an invalid stack trace\n * from being created. Use this class to cast thrown errors that\n * do not use the Error class (strings, etc) to an object.\n */\nexport class UncaughtError {\n constructor(message, filename, lineno, colno, newrelic) {\n this.name = 'UncaughtError';\n this.message = typeof message === 'string' ? message : stringify(message);\n this.sourceURL = filename;\n this.line = lineno;\n this.column = colno;\n this.__newrelic = newrelic;\n }\n}","import { UncaughtError } from './uncaught-error';\n\n/**\n * Any value can be used with the `throw` keyword. This function ensures that the value is\n * either a proper Error instance or attempts to convert it to an UncaughtError instance.\n * @param {any} error The value thrown\n * @returns {Error|UncaughtError} The converted error instance\n */\nexport function castError(error) {\n /** Sometimes a browser can emit an error object with no stack */\n if (canTrustError(error)) {\n return error;\n }\n\n /**\n * The thrown value may contain a message property. If it does, try to treat the thrown\n * value as an Error-like object.\n */\n return new UncaughtError(error?.message !== undefined ? error.message : error, error?.filename || error?.sourceURL, error?.lineno || error?.line, error?.colno || error?.col, error?.__newrelic);\n}\n\n/**\n * Attempts to convert a PromiseRejectionEvent object to an Error object\n * @param {PromiseRejectionEvent} unhandledRejectionEvent The unhandled promise rejection event\n * @returns {Error} An Error object with the message as the casted reason\n */\nexport function castPromiseRejectionEvent(promiseRejectionEvent) {\n let prefix = 'Unhandled Promise Rejection';\n if (canTrustError(promiseRejectionEvent?.reason)) {\n try {\n promiseRejectionEvent.reason.message = prefix + ': ' + promiseRejectionEvent.reason.message;\n return castError(promiseRejectionEvent.reason);\n } catch (e) {\n return castError(promiseRejectionEvent.reason);\n }\n }\n if (typeof promiseRejectionEvent.reason === 'undefined') return castError(prefix);\n const error = castError(promiseRejectionEvent.reason);\n error.message = prefix + ': ' + error?.message;\n return error;\n}\n\n/**\n * Attempts to convert an ErrorEvent object to an Error object\n * @param {ErrorEvent} errorEvent The error event\n * @returns {Error|UncaughtError} The error event converted to an Error object\n */\nexport function castErrorEvent(errorEvent) {\n if (errorEvent.error instanceof SyntaxError && !/:\\d+$/.test(errorEvent.error.stack?.trim())) {\n const error = new UncaughtError(errorEvent.message, errorEvent.filename, errorEvent.lineno, errorEvent.colno, errorEvent.error.__newrelic);\n error.name = SyntaxError.name;\n return error;\n }\n if (canTrustError(errorEvent.error)) return errorEvent.error;\n return castError(errorEvent);\n}\nfunction canTrustError(error) {\n return error instanceof Error && !!error.stack;\n}","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { handle } from '../../../common/event-emitter/handle';\nimport { InstrumentBase } from '../../utils/instrument-base';\nimport { FEATURE_NAME } from '../constants';\nimport { globalScope } from '../../../common/constants/runtime';\nimport { eventListenerOpts } from '../../../common/event-listener/event-listener-opts';\nimport { now } from '../../../common/timing/now';\nimport { SR_EVENT_EMITTER_TYPES } from '../../session_replay/constants';\nimport { castError, castErrorEvent, castPromiseRejectionEvent } from '../shared/cast-error';\nexport class Instrument extends InstrumentBase {\n static featureName = FEATURE_NAME;\n #replayRunning = false;\n constructor(agentIdentifier, aggregator, auto = true) {\n super(agentIdentifier, aggregator, FEATURE_NAME, auto);\n try {\n // this try-catch can be removed when IE11 is completely unsupported & gone\n this.removeOnAbort = new AbortController();\n } catch (e) {}\n this.ee.on('internal-error', error => {\n if (!this.abortHandler) return;\n handle('ierr', [castError(error), now(), true, {}, this.#replayRunning], undefined, this.featureName, this.ee);\n });\n this.ee.on(SR_EVENT_EMITTER_TYPES.REPLAY_RUNNING, isRunning => {\n this.#replayRunning = isRunning;\n });\n globalScope.addEventListener('unhandledrejection', promiseRejectionEvent => {\n if (!this.abortHandler) return;\n handle('err', [castPromiseRejectionEvent(promiseRejectionEvent), now(), false, {\n unhandledPromiseRejection: 1\n }, this.#replayRunning], undefined, this.featureName, this.ee);\n }, eventListenerOpts(false, this.removeOnAbort?.signal));\n globalScope.addEventListener('error', errorEvent => {\n if (!this.abortHandler) return;\n handle('err', [castErrorEvent(errorEvent), now(), false, {}, this.#replayRunning], undefined, this.featureName, this.ee);\n }, eventListenerOpts(false, this.removeOnAbort?.signal));\n this.abortHandler = this.#abort; // we also use this as a flag to denote that the feature is active or on and handling errors\n this.importAggregator();\n }\n\n /** Restoration and resource release tasks to be done if JS error loader is being aborted. Unwind changes to globals. */\n #abort() {\n this.removeOnAbort?.abort();\n this.abortHandler = undefined; // weakly allow this abort op to run only once\n }\n}\nexport const JSErrors = Instrument;","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { getOrSet } from '../util/get-or-set';\nimport { globalScope } from '../constants/runtime';\n\n// Start assigning ids at 1 so 0 can always be used for Window or WorkerGlobalScope, without\n// actually setting it (which would create a global variable).\nlet index = 1;\nconst prop = 'nr@id';\n\n/**\n * Tags a specified object with an identifier if it does not already\n * have one. If the object is the global scope, zero will be returned\n * and the object will not be modified. If the object already contains\n * an identifier, it will be returned without modification. If the passed\n * value is not an object, function, or array, -1 will be returned without\n * modifying the passed value.\n * @param {object|function|array} obj Object to be tagged with an identifier\n * @returns {number} Identifier of the given object\n */\nexport function id(obj) {\n const type = typeof obj;\n // We can only tag objects, functions, and arrays with ids.\n // For all primitive values we instead return -1.\n if (!obj || !(type === 'object' || type === 'function')) return -1;\n if (obj === globalScope) return 0;\n return getOrSet(obj, prop, function () {\n return index++;\n });\n}","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { stringify } from './stringify';\n\n/**\n * Returns the size of the provided data. Designed for measuring XHR responses.\n *\n * @param {*} data - The data to be measured.\n * @returns {(number|undefined)} - The size of the data or undefined if size cannot be determined.\n */\nexport function dataSize(data) {\n if (typeof data === 'string' && data.length) return data.length;\n if (typeof data !== 'object') return undefined;\n // eslint-disable-next-line\n if (typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer && data.byteLength) return data.byteLength;\n if (typeof Blob !== 'undefined' && data instanceof Blob && data.size) return data.size;\n if (typeof FormData !== 'undefined' && data instanceof FormData) return undefined;\n try {\n return stringify(data).length;\n } catch (e) {\n return undefined;\n }\n}","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @file Wraps `addEventListener` and `removeEventListener` for instrumentation.\n * This module is used directly by: session_trace.\n * It is also called by -> wrapXhr <-, so see \"wrap-xhr.js\" for features that use this indirectly.\n */\nimport { ee as baseEE, contextId } from '../event-emitter/contextual-ee';\nimport { createWrapperWithEmitter as wfn } from './wrap-function';\nimport { getOrSet } from '../util/get-or-set';\nimport { globalScope, isBrowserScope } from '../constants/runtime';\nconst wrapped = {};\nconst XHR = globalScope.XMLHttpRequest;\nconst ADD_EVENT_LISTENER = 'addEventListener';\nconst REMOVE_EVENT_LISTENER = 'removeEventListener';\nconst flag = \"nr@wrapped:\".concat(contextId);\n\n/**\n * Wraps `addEventListener` and `removeEventListener` on: global scope; the prototype of `XMLHttpRequest`, and\n * `document` (if in a browser scope). Adds custom events in context of a new emitter scoped only to these methods.\n * @param {Object} sharedEE - The shared event emitter on which a new scoped\n * event emitter will be based.\n * @returns {Object} Scoped event emitter with a debug ID of `events`.\n */\nexport function wrapEvents(sharedEE) {\n var ee = scopedEE(sharedEE);\n\n // Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,\n // then we increment the count to track # of feats using this at runtime.\n if (wrapped[ee.debugId]++) return ee;\n wrapped[ee.debugId] = 1; // otherwise, first feature to wrap events\n var wrapFn = wfn(ee, true);\n\n // Guard against instrumenting environments w/o necessary features\n if ('getPrototypeOf' in Object) {\n if (isBrowserScope) findEventListenerProtoAndCb(document, wrapNode);\n findEventListenerProtoAndCb(globalScope, wrapNode);\n findEventListenerProtoAndCb(XHR.prototype, wrapNode);\n }\n ee.on(ADD_EVENT_LISTENER + '-start', function (args, target) {\n var originalListener = args[1];\n if (originalListener === null || typeof originalListener !== 'function' && typeof originalListener !== 'object') {\n return;\n }\n var wrapped = getOrSet(originalListener, flag, function () {\n var listener = {\n object: wrapHandleEvent,\n function: originalListener\n }[typeof originalListener];\n return listener ? wrapFn(listener, 'fn-', null, listener.name || 'anonymous') : originalListener;\n function wrapHandleEvent() {\n if (typeof originalListener.handleEvent !== 'function') return;\n return originalListener.handleEvent.apply(originalListener, arguments);\n }\n });\n this.wrapped = args[1] = wrapped;\n });\n ee.on(REMOVE_EVENT_LISTENER + '-start', function (args) {\n args[1] = this.wrapped || args[1];\n });\n function wrapNode(node) {\n wrapFn.inPlace(node, [ADD_EVENT_LISTENER, REMOVE_EVENT_LISTENER], '-', uniqueListener);\n }\n function uniqueListener(args, obj) {\n // Context for the listener is stored on itself.\n return args[1];\n }\n return ee;\n}\n/**\n * Find the base prototype of 'object' that has its own \"addEventListener\" property, and run some function on it.\n * @param {Object} object - the initial object to traverse prototype chain on\n * @param {Function} cb - the function to run on the ancestral object once found, accepts an object as a arg\n * @param {Array} rest - [optional] any additional arguments to pass to the cb\n */\nfunction findEventListenerProtoAndCb(object, cb, ...rest) {\n let step = object;\n while (typeof step === 'object' && !Object.prototype.hasOwnProperty.call(step, ADD_EVENT_LISTENER)) {\n step = Object.getPrototypeOf(step);\n }\n if (step) cb(step, ...rest);\n}\n\n/**\n * Returns an event emitter scoped specifically for the `events` context. This scoping is a remnant from when all the\n * features shared the same group in the event, to isolate events between features. It will likely be revisited.\n * @param {Object} sharedEE - Optional event emitter on which to base the scoped emitter.\n * Uses `ee` on the global scope if undefined).\n * @returns {Object} Scoped event emitter with a debug ID of 'events'.\n */\nexport function scopedEE(sharedEE) {\n return (sharedEE || baseEE).get('events');\n}","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @file Wraps AJAX (XHR) related methods for instrumentation.\n * This module is used by: ajax, jserrors, spa.\n */\n\nimport { wrapEvents } from './wrap-events';\nimport { ee as contextualEE } from '../event-emitter/contextual-ee';\nimport { eventListenerOpts } from '../event-listener/event-listener-opts';\nimport { createWrapperWithEmitter as wfn } from './wrap-function';\nimport { globalScope } from '../constants/runtime';\nimport { warn } from '../util/console';\nconst wrapped = {};\nconst XHR_PROPS = ['open', 'send']; // these are the specific funcs being wrapped on all XMLHttpRequests(.prototype)\n\n/**\n * Wraps the native XMLHttpRequest (XHR) object to emit custom events to its readystatechange event and an assortment\n * of handlers. Adds instrumentation in context of a new event emitter scoped only to XHR.\n * @param {Object} sharedEE - The shared event emitter on which a new scoped event emitter will be based.\n * @returns {Object} Scoped event emitter with a debug ID of `xhr`.\n */\n// eslint-disable-next-line\nexport function wrapXhr(sharedEE) {\n var baseEE = sharedEE || contextualEE;\n const ee = scopedEE(baseEE);\n\n // Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,\n // then we increment the count to track # of feats using this at runtime.\n if (wrapped[ee.debugId]++) return ee;\n wrapped[ee.debugId] = 1; // otherwise, first feature to wrap XHR\n\n wrapEvents(baseEE); // wrap-events patches XMLHttpRequest.prototype.addEventListener for us\n var wrapFn = wfn(ee);\n var OrigXHR = globalScope.XMLHttpRequest;\n var MutationObserver = globalScope.MutationObserver;\n var Promise = globalScope.Promise;\n var setImmediate = globalScope.setInterval;\n var READY_STATE_CHANGE = 'readystatechange';\n var handlers = ['onload', 'onerror', 'onabort', 'onloadstart', 'onloadend', 'onprogress', 'ontimeout'];\n var pendingXhrs = [];\n var XHR = globalScope.XMLHttpRequest = newXHR;\n function newXHR(opts) {\n const xhr = new OrigXHR(opts);\n const context = ee.context(xhr);\n try {\n ee.emit('new-xhr', [xhr], context);\n xhr.addEventListener(READY_STATE_CHANGE, wrapXHR(context), eventListenerOpts(false));\n } catch (e) {\n warn(15, e);\n try {\n ee.emit('internal-error', [e]);\n } catch (err) {\n // do nothing\n }\n }\n return xhr;\n }\n copy(OrigXHR, XHR);\n XHR.prototype = OrigXHR.prototype;\n wrapFn.inPlace(XHR.prototype, XHR_PROPS, '-xhr-', getObject);\n ee.on('send-xhr-start', function (args, xhr) {\n wrapOnreadystatechange(args, xhr);\n enqueuePendingXhr(xhr);\n });\n ee.on('open-xhr-start', wrapOnreadystatechange);\n function wrapOnreadystatechange(args, xhr) {\n wrapFn.inPlace(xhr, ['onreadystatechange'], 'fn-', getObject);\n }\n function wrapXHR(ctx) {\n return function () {\n var xhr = this;\n if (xhr.readyState > 3 && !ctx.resolved) {\n ctx.resolved = true;\n ee.emit('xhr-resolved', [], xhr);\n }\n wrapFn.inPlace(xhr, handlers, 'fn-', getObject);\n };\n }\n\n // Wrapping the onreadystatechange property of XHRs takes some special tricks.\n //\n // The issue is that the onreadystatechange property may be assigned *after*\n // send() is called against an XHR. This is of particular importance because\n // jQuery uses a single onreadystatechange handler to implement all of the XHR\n // callbacks thtat it provides, and it assigns that property after calling send.\n //\n // There are several 'obvious' approaches to wrapping the onreadystatechange\n // when it's assigned after send:\n //\n // 1. Try to wrap the onreadystatechange handler from a readystatechange\n // addEventListener callback (the addEventListener callback will fire before\n // the onreadystatechange callback).\n //\n // Caveat: this doesn't work in Chrome or Safari, and in fact will cause\n // the onreadystatechange handler to not be invoked at all during the\n // firing cycle in which it is wrapped, which may break applications :(\n //\n // 2. Use Object.defineProperty to create a setter for the onreadystatechange\n // property, and wrap from that setter.\n //\n // Caveat: onreadystatechange is not a configurable property in Safari or\n // older versions of the Android browser.\n //\n // 3. Schedule wrapping of the onreadystatechange property using a setTimeout\n // call issued just before the call to send.\n //\n // Caveat: sometimes, the onreadystatechange handler fires before the\n // setTimeout, meaning the wrapping happens too late.\n //\n // The setTimeout approach is closest to what we use here: we want to schedule\n // the wrapping of the onreadystatechange property when send is called, but\n // ensure that our wrapping happens before onreadystatechange has a chance to\n // fire.\n //\n // We achieve this using a hybrid approach:\n //\n // * In browsers that support MutationObserver, we use that to schedule wrapping\n // of onreadystatechange.\n //\n // * We have discovered that MutationObserver in IE causes a memory leak, so we\n // now will prefer setImmediate for IE, and use a resolved promise to schedule\n // the wrapping in Edge (and other browsers that support promises)\n //\n // * In older browsers that don't support MutationObserver, we rely on the fact\n // that the call to send is probably happening within a callback that we've\n // already wrapped, and use our existing fn-end event callback to wrap the\n // onreadystatechange at the end of the current callback.\n //\n\n if (MutationObserver) {\n var resolved = Promise && Promise.resolve();\n if (!setImmediate && !Promise) {\n var toggle = 1;\n var dummyNode = document.createTextNode(toggle);\n new MutationObserver(drainPendingXhrs).observe(dummyNode, {\n characterData: true\n });\n }\n } else {\n // this below case applies to web workers too\n baseEE.on('fn-end', function (args) {\n // We don't want to try to wrap onreadystatechange from within a\n // readystatechange callback.\n if (args[0] && args[0].type === READY_STATE_CHANGE) return;\n drainPendingXhrs();\n });\n }\n function enqueuePendingXhr(xhr) {\n pendingXhrs.push(xhr);\n if (MutationObserver) {\n if (resolved) {\n resolved.then(drainPendingXhrs);\n } else if (setImmediate) {\n setImmediate(drainPendingXhrs);\n } else {\n toggle = -toggle;\n dummyNode.data = toggle;\n }\n }\n }\n function drainPendingXhrs() {\n for (var i = 0; i < pendingXhrs.length; i++) {\n wrapOnreadystatechange([], pendingXhrs[i]);\n }\n if (pendingXhrs.length) pendingXhrs = [];\n }\n\n // Use the object these methods are on as their\n // context store for the event emitter\n function getObject(args, obj) {\n return obj;\n }\n function copy(from, to) {\n for (var i in from) {\n to[i] = from[i];\n }\n return to;\n }\n return ee;\n}\n\n/**\n * Returns an event emitter scoped specifically for the `xhr` context. This scoping is a remnant from when all the\n * features shared the same group in the event, to isolate events between features. It will likely be revisited.\n * @param {Object} sharedEE - Optional event emitter on which to base the scoped emitter.\n * Uses `ee` on the global scope if undefined).\n * @returns {Object} Scoped event emitter with a debug ID of 'xhr'.\n */\nexport function scopedEE(sharedEE) {\n return (sharedEE || contextualEE).get('xhr');\n}","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @file Wraps `fetch` and related methods for instrumentation.\n * This module is used by: ajax, spa.\n */\nimport { ee as baseEE, contextId } from '../event-emitter/contextual-ee';\nimport { globalScope } from '../constants/runtime';\nvar prefix = 'fetch-';\nvar bodyPrefix = prefix + 'body-';\nvar bodyMethods = ['arrayBuffer', 'blob', 'json', 'text', 'formData'];\nvar Req = globalScope.Request;\nvar Res = globalScope.Response;\nvar proto = 'prototype';\nconst wrapped = {};\n\n/**\n * Wraps the `fetch` method of the global scope for instrumentation. Also wraps the prototypes of the async methods\n * that parse Request and Response bodies to generate start and end events for each, in context of a new event\n * emitter scoped only to fetch and related methods.\n * @param {Object} sharedEE - The shared event emitter on which a new scoped\n * event emitter will be based.\n * @returns {Object} Scoped event emitter with a debug ID of `fetch`.\n */\nexport function wrapFetch(sharedEE) {\n const ee = scopedEE(sharedEE);\n if (!(Req && Res && globalScope.fetch)) {\n return ee;\n }\n\n // Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,\n // then we increment the count to track # of feats using this at runtime.\n if (wrapped[ee.debugId]++) return ee;\n wrapped[ee.debugId] = 1; // otherwise, first feature to wrap fetch\n\n bodyMethods.forEach(method => {\n wrapPromiseMethod(Req[proto], method, bodyPrefix);\n wrapPromiseMethod(Res[proto], method, bodyPrefix);\n });\n wrapPromiseMethod(globalScope, 'fetch', prefix);\n ee.on(prefix + 'end', function (err, res) {\n var ctx = this;\n if (res) {\n var size = res.headers.get('content-length');\n if (size !== null) {\n ctx.rxSize = size;\n }\n ee.emit(prefix + 'done', [null, res], ctx);\n } else {\n ee.emit(prefix + 'done', [err], ctx);\n }\n });\n\n /**\n * Wraps a Promise-returning function (referenced by `target[name]`) to emit custom events before and after\n * execution, each decorated with metadata (arguments, payloads, errors). Used to wrap the async body\n * parsing methods of Request and Response (e.g. `json`, `text`, `formData`).\n * @param {Object} target - The object having the method to be wrapped.\n * @param {string} name - The name of the method to wrap.\n * @param {string} prefix - Used to decorate event names with context.\n */\n function wrapPromiseMethod(target, name, prefix) {\n var fn = target[name];\n if (typeof fn === 'function') {\n target[name] = function () {\n var args = [...arguments];\n var ctx = {};\n // we are wrapping args in an array so we can preserve the reference\n ee.emit(prefix + 'before-start', [args], ctx);\n var dtPayload;\n if (ctx[contextId] && ctx[contextId].dt) dtPayload = ctx[contextId].dt;\n var origPromiseFromFetch = fn.apply(this, args);\n ee.emit(prefix + 'start', [args, dtPayload], origPromiseFromFetch);\n\n // Note we need to cast the returned (orig) Promise from native APIs into the current global Promise, which may or may not be our WrappedPromise.\n return origPromiseFromFetch.then(function (val) {\n ee.emit(prefix + 'end', [null, val], origPromiseFromFetch);\n return val;\n }, function (err) {\n ee.emit(prefix + 'end', [err], origPromiseFromFetch);\n throw err;\n });\n };\n }\n }\n return ee;\n}\n\n/**\n * Returns an event emitter scoped specifically for the `fetch` context. This scoping is a remnant from when all the\n * features shared the same group in the event, to isolate events between features. It will likely be revisited.\n * @param {Object} sharedEE - Optional event emitter on which to base the scoped emitter.\n * Uses `ee` on the global scope if undefined).\n * @returns {Object} Scoped event emitter with a debug ID of 'fetch'.\n */\nexport function scopedEE(sharedEE) {\n return (sharedEE || baseEE).get('fetch');\n}","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { globalScope } from '../constants/runtime';\nexport function parseUrl(url) {\n // Return if URL is a data URL, parseUrl assumes urls are http/https\n if ((url || '').indexOf('data:') === 0) {\n return {\n protocol: 'data'\n };\n }\n try {\n const parsedUrl = new URL(url, location.href);\n const returnVal = {\n port: parsedUrl.port,\n hostname: parsedUrl.hostname,\n pathname: parsedUrl.pathname,\n search: parsedUrl.search,\n protocol: parsedUrl.protocol.slice(0, parsedUrl.protocol.indexOf(':')),\n sameOrigin: parsedUrl.protocol === globalScope?.location?.protocol && parsedUrl.host === globalScope?.location?.host\n };\n if (!returnVal.port || returnVal.port === '') {\n if (parsedUrl.protocol === 'http:') returnVal.port = '80';\n if (parsedUrl.protocol === 'https:') returnVal.port = '443';\n }\n if (!returnVal.pathname || returnVal.pathname === '') {\n returnVal.pathname = '/';\n } else if (!returnVal.pathname.startsWith('/')) {\n returnVal.pathname = \"/\".concat(returnVal.pathname);\n }\n return returnVal;\n } catch (err) {\n return {};\n }\n}","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { getConfiguration, getConfigurationValue } from '../../../common/config/init';\nimport { getLoaderConfig } from '../../../common/config/loader-config';\nimport { generateSpanId, generateTraceId } from '../../../common/ids/unique-id';\nimport { parseUrl } from '../../../common/url/parse-url';\nimport { globalScope } from '../../../common/constants/runtime';\nimport { stringify } from '../../../common/util/stringify';\nexport class DT {\n constructor(agentIdentifier) {\n this.agentIdentifier = agentIdentifier;\n }\n generateTracePayload(parsedOrigin) {\n if (!this.shouldGenerateTrace(parsedOrigin)) {\n return null;\n }\n var loaderConfig = getLoaderConfig(this.agentIdentifier);\n if (!loaderConfig) {\n return null;\n }\n var accountId = (loaderConfig.accountID || '').toString() || null;\n var agentId = (loaderConfig.agentID || '').toString() || null;\n var trustKey = (loaderConfig.trustKey || '').toString() || null;\n if (!accountId || !agentId) {\n return null;\n }\n var spanId = generateSpanId();\n var traceId = generateTraceId();\n var timestamp = Date.now();\n var payload = {\n spanId,\n traceId,\n timestamp\n };\n if (parsedOrigin.sameOrigin || this.isAllowedOrigin(parsedOrigin) && this.useTraceContextHeadersForCors()) {\n payload.traceContextParentHeader = this.generateTraceContextParentHeader(spanId, traceId);\n payload.traceContextStateHeader = this.generateTraceContextStateHeader(spanId, timestamp, accountId, agentId, trustKey);\n }\n if (parsedOrigin.sameOrigin && !this.excludeNewrelicHeader() || !parsedOrigin.sameOrigin && this.isAllowedOrigin(parsedOrigin) && this.useNewrelicHeaderForCors()) {\n payload.newrelicHeader = this.generateTraceHeader(spanId, traceId, timestamp, accountId, agentId, trustKey);\n }\n return payload;\n }\n generateTraceContextParentHeader(spanId, traceId) {\n return '00-' + traceId + '-' + spanId + '-01';\n }\n generateTraceContextStateHeader(spanId, timestamp, accountId, appId, trustKey) {\n var version = 0;\n var transactionId = '';\n var parentType = 1;\n var sampled = '';\n var priority = '';\n return trustKey + '@nr=' + version + '-' + parentType + '-' + accountId + '-' + appId + '-' + spanId + '-' + transactionId + '-' + sampled + '-' + priority + '-' + timestamp;\n }\n generateTraceHeader(spanId, traceId, timestamp, accountId, appId, trustKey) {\n var hasBtoa = typeof globalScope?.btoa === 'function';\n if (!hasBtoa) {\n return null;\n }\n var payload = {\n v: [0, 1],\n d: {\n ty: 'Browser',\n ac: accountId,\n ap: appId,\n id: spanId,\n tr: traceId,\n ti: timestamp\n }\n };\n if (trustKey && accountId !== trustKey) {\n payload.d.tk = trustKey;\n }\n return btoa(stringify(payload));\n }\n\n // return true if DT is enabled and the origin is allowed, either by being\n // same-origin, or included in the allowed list\n shouldGenerateTrace(parsedOrigin) {\n return this.isDtEnabled() && this.isAllowedOrigin(parsedOrigin);\n }\n isAllowedOrigin(parsedOrigin) {\n var allowed = false;\n var dtConfig = {};\n var dt = getConfigurationValue(this.agentIdentifier, 'distributed_tracing');\n if (dt) {\n dtConfig = getConfiguration(this.agentIdentifier).distributed_tracing;\n }\n if (parsedOrigin.sameOrigin) {\n allowed = true;\n } else if (dtConfig.allowed_origins instanceof Array) {\n for (var i = 0; i < dtConfig.allowed_origins.length; i++) {\n var allowedOrigin = parseUrl(dtConfig.allowed_origins[i]);\n if (parsedOrigin.hostname === allowedOrigin.hostname && parsedOrigin.protocol === allowedOrigin.protocol && parsedOrigin.port === allowedOrigin.port) {\n allowed = true;\n break;\n }\n }\n }\n return allowed;\n }\n isDtEnabled() {\n var dt = getConfigurationValue(this.agentIdentifier, 'distributed_tracing');\n if (dt) {\n return !!dt.enabled;\n }\n return false;\n }\n\n // exclude the newrelic header for same-origin calls\n excludeNewrelicHeader() {\n var dt = getConfigurationValue(this.agentIdentifier, 'distributed_tracing');\n if (dt) {\n return !!dt.exclude_newrelic_header;\n }\n return false;\n }\n useNewrelicHeaderForCors() {\n var dt = getConfigurationValue(this.agentIdentifier, 'distributed_tracing');\n if (dt) {\n return dt.cors_use_newrelic_header !== false;\n }\n return false;\n }\n useTraceContextHeadersForCors() {\n var dt = getConfigurationValue(this.agentIdentifier, 'distributed_tracing');\n if (dt) {\n return !!dt.cors_use_tracecontext_headers;\n }\n return false;\n }\n}","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { dataSize } from '../../../common/util/data-size';\nexport function responseSizeFromXhr(xhr, lastSize) {\n var type = xhr.responseType;\n if (type === 'json' && lastSize !== null) return lastSize;\n // Caution! Chrome throws an error if you try to access xhr.responseText for binary data\n if (type === 'arraybuffer' || type === 'blob' || type === 'json') {\n return dataSize(xhr.response);\n } else if (type === 'text' || type === '' || type === undefined) {\n // empty string type defaults to 'text'\n return dataSize(xhr.responseText);\n } else {\n // e.g. ms-stream and document (we do not currently determine the size of Document objects)\n return undefined;\n }\n}","import { FEATURE_NAMES } from '../../loaders/features/features';\nexport const FEATURE_NAME = FEATURE_NAMES.ajax;","/** An array of filter objects {hostname, pathname} for identifying XHR events to be excluded from collection.\n * @see {@link https://docs.newrelic.com/docs/browser/new-relic-browser/configuration/filter-ajax-request-events/ Filter AjaxRequest events}\n * @type {Array.<{hostname: string, pathname: string}>}\n */\nvar denyList = [];\n\n/**\n * Evaluates whether an XHR event should be included for collection based on the {@link denyList|AjaxRequest deny list}.\n * @param {Object} params - object with properties of the XHR event\n * @returns {boolean} `true` if request does not match any entries of {@link denyList|deny list}; else `false`\n */\nexport function shouldCollectEvent(params) {\n if (!params || hasUndefinedHostname(params)) return false;\n if (denyList.length === 0) return true;\n for (var i = 0; i < denyList.length; i++) {\n var parsed = denyList[i];\n if (parsed.hostname === '*') {\n return false;\n }\n if (domainMatchesPattern(parsed.hostname, params.hostname) && comparePath(parsed.pathname, params.pathname)) {\n return false;\n }\n }\n return true;\n}\nexport function hasUndefinedHostname(params) {\n return params.hostname === undefined; // requests with an undefined hostname (e.g., data URLs) should not be collected.\n}\n\n/**\n * Initializes the {@link denyList|XHR deny list} by extracting hostname and pathname from an array of filter strings.\n * @param {string[]} denyListConfig - array of URL filters to identify XHR requests to be excluded from collection\n */\nexport function setDenyList(denyListConfig) {\n denyList = [];\n if (!denyListConfig || !denyListConfig.length) {\n return;\n }\n for (var i = 0; i < denyListConfig.length; i++) {\n let url = denyListConfig[i];\n if (!url) continue; // ignore bad values like undefined or empty strings\n\n if (url.indexOf('http://') === 0) {\n url = url.substring(7);\n } else if (url.indexOf('https://') === 0) {\n url = url.substring(8);\n }\n const firstSlash = url.indexOf('/');\n let host, pathname;\n if (firstSlash > 0) {\n host = url.substring(0, firstSlash);\n pathname = url.substring(firstSlash);\n } else {\n host = url;\n pathname = '';\n }\n let [hostname] = host.split(':');\n denyList.push({\n hostname,\n pathname\n });\n }\n}\n/**\n * Returns true if the right side of `domain` (end of string) matches `pattern`.\n * @param {string} pattern - a string to be matched against the end of `domain` string\n * @param {string} domain - a domain string with no protocol or path (e.g., app1.example.com)\n * @returns {boolean} `true` if domain matches pattern; else `false`\n */\nfunction domainMatchesPattern(pattern, domain) {\n if (pattern.length > domain.length) {\n return false;\n }\n return domain.indexOf(pattern) === domain.length - pattern.length;\n}\n\n/**\n * Returns true if a URL path matches a pattern string, disregarding leading slashes.\n * @param {string} pattern - a string to compare with path (e.g., api/v1)\n * @param {string} path - a string representing a URL path (e.g., /api/v1)\n * @returns {boolean} `true` if path and pattern are an exact string match (except for leading slashes); else `false`\n */\nfunction comparePath(pattern, path) {\n if (pattern.indexOf('/') === 0) {\n pattern = pattern.substring(1);\n }\n if (path.indexOf('/') === 0) {\n path = path.substring(1);\n }\n\n // No path in pattern means match all paths.\n if (pattern === '') {\n return true;\n }\n return pattern === path;\n}","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { gosNREUMOriginals } from '../../../common/window/nreum';\nimport { getLoaderConfig } from '../../../common/config/loader-config';\nimport { handle } from '../../../common/event-emitter/handle';\nimport { id } from '../../../common/ids/id';\nimport { ffVersion, globalScope, isBrowserScope } from '../../../common/constants/runtime';\nimport { dataSize } from '../../../common/util/data-size';\nimport { eventListenerOpts } from '../../../common/event-listener/event-listener-opts';\nimport { wrapXhr } from '../../../common/wrap/wrap-xhr';\nimport { wrapFetch } from '../../../common/wrap/wrap-fetch';\nimport { parseUrl } from '../../../common/url/parse-url';\nimport { DT } from './distributed-tracing';\nimport { responseSizeFromXhr } from './response-size';\nimport { InstrumentBase } from '../../utils/instrument-base';\nimport { FEATURE_NAME } from '../constants';\nimport { FEATURE_NAMES } from '../../../loaders/features/features';\nimport { SUPPORTABILITY_METRIC } from '../../metrics/constants';\nimport { now } from '../../../common/timing/now';\nimport { hasUndefinedHostname } from '../../../common/deny-list/deny-list';\nvar handlers = ['load', 'error', 'abort', 'timeout'];\nvar handlersLen = handlers.length;\nvar origRequest = gosNREUMOriginals().o.REQ;\nvar origXHR = gosNREUMOriginals().o.XHR;\nexport class Instrument extends InstrumentBase {\n static featureName = FEATURE_NAME;\n constructor(agentIdentifier, aggregator, auto = true) {\n super(agentIdentifier, aggregator, FEATURE_NAME, auto);\n this.dt = new DT(agentIdentifier);\n this.handler = (type, args, ctx, group) => handle(type, args, ctx, group, this.ee);\n\n // this is a best (but imperfect) effort at capturing AJAX calls that may have fired before the agent was instantiated\n // this could happen because the agent was \"improperly\" set up (ie, not at the top of the head) or\n // because it was deferred from loading in some way -- e.g. 'deferred' script loading tags or other lazy-loading techniques\n //\n // it is \"imperfect\" because we cannot capture the following with the API vs wrapping the events directly:\n // * requestBodySize - (txSize -- request body size)\n // * method - request type (GET, POST, etc)\n // * callbackDuration - (cbTime -- sum of resulting callback time)\n try {\n const initiators = {\n xmlhttprequest: 'xhr',\n fetch: 'fetch',\n beacon: 'beacon'\n };\n globalScope?.performance?.getEntriesByType('resource').forEach(resource => {\n if (resource.initiatorType in initiators && resource.responseStatus !== 0) {\n const params = {\n status: resource.responseStatus\n };\n const metrics = {\n rxSize: resource.transferSize,\n duration: Math.floor(resource.duration),\n cbTime: 0\n };\n addUrl(params, resource.name);\n this.handler('xhr', [params, metrics, resource.startTime, resource.responseEnd, initiators[resource.initiatorType]], undefined, FEATURE_NAMES.ajax);\n }\n });\n } catch (err) {\n // do nothing\n }\n wrapFetch(this.ee);\n wrapXhr(this.ee);\n subscribeToEvents(agentIdentifier, this.ee, this.handler, this.dt);\n this.importAggregator();\n }\n}\nfunction subscribeToEvents(agentIdentifier, ee, handler, dt) {\n ee.on('new-xhr', onNewXhr);\n ee.on('open-xhr-start', onOpenXhrStart);\n ee.on('open-xhr-end', onOpenXhrEnd);\n ee.on('send-xhr-start', onSendXhrStart);\n ee.on('xhr-cb-time', onXhrCbTime);\n ee.on('xhr-load-added', onXhrLoadAdded);\n ee.on('xhr-load-removed', onXhrLoadRemoved);\n ee.on('xhr-resolved', onXhrResolved);\n ee.on('addEventListener-end', onAddEventListenerEnd);\n ee.on('removeEventListener-end', onRemoveEventListenerEnd);\n ee.on('fn-end', onFnEnd);\n ee.on('fetch-before-start', onFetchBeforeStart);\n ee.on('fetch-start', onFetchStart);\n ee.on('fn-start', onFnStart);\n ee.on('fetch-done', onFetchDone);\n\n // Setup the context for each new xhr object\n function onNewXhr(xhr) {\n var ctx = this;\n ctx.totalCbs = 0;\n ctx.called = 0;\n ctx.cbTime = 0;\n ctx.end = end;\n ctx.ended = false;\n ctx.xhrGuids = {};\n ctx.lastSize = null;\n ctx.loadCaptureCalled = false;\n ctx.params = this.params || {};\n ctx.metrics = this.metrics || {};\n xhr.addEventListener('load', function (event) {\n captureXhrData(ctx, xhr);\n }, eventListenerOpts(false));\n\n // In Firefox (v34+), XHR ProgressEvents report pre-content-decoding sizes via\n // their 'loaded' property, rather than post-decoding sizes. We want\n // post-decoding sizes for consistency with browsers where that's all we have.\n // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1227674\n //\n // So we don't use ProgressEvents to measure XHR sizes for FF.\n if (ffVersion) return;\n xhr.addEventListener('progress', function (event) {\n ctx.lastSize = event.loaded;\n }, eventListenerOpts(false));\n }\n function onOpenXhrStart(args) {\n this.params = {\n method: args[0]\n };\n addUrl(this, args[1]);\n this.metrics = {};\n }\n function onOpenXhrEnd(args, xhr) {\n var loaderConfig = getLoaderConfig(agentIdentifier);\n if (loaderConfig.xpid && this.sameOrigin) {\n xhr.setRequestHeader('X-NewRelic-ID', loaderConfig.xpid);\n }\n var payload = dt.generateTracePayload(this.parsedOrigin);\n if (payload) {\n var added = false;\n if (payload.newrelicHeader) {\n xhr.setRequestHeader('newrelic', payload.newrelicHeader);\n added = true;\n }\n if (payload.traceContextParentHeader) {\n xhr.setRequestHeader('traceparent', payload.traceContextParentHeader);\n if (payload.traceContextStateHeader) {\n xhr.setRequestHeader('tracestate', payload.traceContextStateHeader);\n }\n added = true;\n }\n if (added) {\n this.dt = payload;\n }\n }\n }\n function onSendXhrStart(args, xhr) {\n var metrics = this.metrics;\n var data = args[0];\n var context = this;\n if (metrics && data) {\n var size = dataSize(data);\n if (size) metrics.txSize = size;\n }\n this.startTime = now();\n this.body = data;\n this.listener = function (evt) {\n try {\n if (evt.type === 'abort' && !context.loadCaptureCalled) {\n context.params.aborted = true;\n }\n if (evt.type !== 'load' || context.called === context.totalCbs && (context.onloadCalled || typeof xhr.onload !== 'function') && typeof context.end === 'function') context.end(xhr);\n } catch (e) {\n try {\n ee.emit('internal-error', [e]);\n } catch (err) {\n // do nothing\n }\n }\n };\n for (var i = 0; i < handlersLen; i++) {\n xhr.addEventListener(handlers[i], this.listener, eventListenerOpts(false));\n }\n }\n function onXhrCbTime(time, onload, xhr) {\n this.cbTime += time;\n if (onload) this.onloadCalled = true;else this.called += 1;\n if (this.called === this.totalCbs && (this.onloadCalled || typeof xhr.onload !== 'function') && typeof this.end === 'function') this.end(xhr);\n }\n function onXhrLoadAdded(cb, useCapture) {\n // Ignore if the same arguments are passed to addEventListener twice\n var idString = '' + id(cb) + !!useCapture;\n if (!this.xhrGuids || this.xhrGuids[idString]) return;\n this.xhrGuids[idString] = true;\n this.totalCbs += 1;\n }\n function onXhrLoadRemoved(cb, useCapture) {\n // Ignore if event listener didn't exist for this xhr object\n var idString = '' + id(cb) + !!useCapture;\n if (!this.xhrGuids || !this.xhrGuids[idString]) return;\n delete this.xhrGuids[idString];\n this.totalCbs -= 1;\n }\n function onXhrResolved() {\n this.endTime = now();\n }\n\n // Listen for load listeners to be added to xhr objects\n function onAddEventListenerEnd(args, xhr) {\n if (xhr instanceof origXHR && args[0] === 'load') ee.emit('xhr-load-added', [args[1], args[2]], xhr);\n }\n function onRemoveEventListenerEnd(args, xhr) {\n if (xhr instanceof origXHR && args[0] === 'load') ee.emit('xhr-load-removed', [args[1], args[2]], xhr);\n }\n\n // Listen for those load listeners to be called.\n function onFnStart(args, xhr, methodName) {\n if (xhr instanceof origXHR) {\n if (methodName === 'onload') this.onload = true;\n if ((args[0] && args[0].type) === 'load' || this.onload) this.xhrCbStart = now();\n }\n }\n function onFnEnd(args, xhr) {\n if (this.xhrCbStart) ee.emit('xhr-cb-time', [now() - this.xhrCbStart, this.onload, xhr], xhr);\n }\n\n // this event only handles DT\n function onFetchBeforeStart(args) {\n var opts = args[1] || {};\n var url;\n if (typeof args[0] === 'string') {\n // argument is USVString\n url = args[0];\n if (url.length === 0 && isBrowserScope) {\n url = '' + globalScope.location.href;\n }\n } else if (args[0] && args[0].url) {\n // argument is Request object\n url = args[0].url;\n } else if (globalScope?.URL && args[0] && args[0] instanceof URL) {\n // argument is URL object\n url = args[0].href;\n } else if (typeof args[0].toString === 'function') {\n url = args[0].toString();\n }\n if (typeof url !== 'string' || url.length === 0) {\n // Short-circuit DT since we could not determine the URL of the fetch call\n // this is very unlikely to happen\n return;\n }\n if (url) {\n this.parsedOrigin = parseUrl(url);\n this.sameOrigin = this.parsedOrigin.sameOrigin;\n }\n var payload = dt.generateTracePayload(this.parsedOrigin);\n if (!payload || !payload.newrelicHeader && !payload.traceContextParentHeader) {\n return;\n }\n if (args[0] && args[0].headers) {\n if (addHeaders(args[0].headers, payload)) {\n this.dt = payload;\n }\n } else {\n var clone = {};\n for (var key in opts) {\n clone[key] = opts[key];\n }\n clone.headers = new Headers(opts.headers || {});\n if (addHeaders(clone.headers, payload)) {\n this.dt = payload;\n }\n if (args.length > 1) {\n args[1] = clone;\n } else {\n args.push(clone);\n }\n }\n function addHeaders(headersObj, payload) {\n var added = false;\n if (payload.newrelicHeader) {\n headersObj.set('newrelic', payload.newrelicHeader);\n added = true;\n }\n if (payload.traceContextParentHeader) {\n headersObj.set('traceparent', payload.traceContextParentHeader);\n if (payload.traceContextStateHeader) {\n headersObj.set('tracestate', payload.traceContextStateHeader);\n }\n added = true;\n }\n return added;\n }\n }\n function onFetchStart(fetchArguments, dtPayload) {\n this.params = {};\n this.metrics = {};\n this.startTime = now();\n this.dt = dtPayload;\n if (fetchArguments.length >= 1) this.target = fetchArguments[0];\n if (fetchArguments.length >= 2) this.opts = fetchArguments[1];\n var opts = this.opts || {};\n var target = this.target;\n var url;\n if (typeof target === 'string') {\n url = target;\n } else if (typeof target === 'object' && target instanceof origRequest) {\n url = target.url;\n } else if (globalScope?.URL && typeof target === 'object' && target instanceof URL) {\n url = target.href;\n }\n addUrl(this, url);\n var method = ('' + (target && target instanceof origRequest && target.method || opts.method || 'GET')).toUpperCase();\n this.params.method = method;\n this.body = opts.body;\n this.txSize = dataSize(opts.body) || 0;\n }\n\n // we capture failed call as status 0, the actual error is ignored\n // eslint-disable-next-line handle-callback-err\n function onFetchDone(_, res) {\n this.endTime = now();\n if (!this.params) this.params = {};\n if (hasUndefinedHostname(this.params)) return; // don't bother with fetch to url with no hostname\n\n this.params.status = res ? res.status : 0;\n\n // convert rxSize to a number\n let responseSize;\n if (typeof this.rxSize === 'string' && this.rxSize.length > 0) {\n responseSize = +this.rxSize;\n }\n const metrics = {\n txSize: this.txSize,\n rxSize: responseSize,\n duration: now() - this.startTime\n };\n handler('xhr', [this.params, metrics, this.startTime, this.endTime, 'fetch'], this, FEATURE_NAMES.ajax);\n }\n\n // Create report for XHR request that has finished\n function end(xhr) {\n const params = this.params;\n const metrics = this.metrics;\n if (this.ended) return;\n this.ended = true;\n for (let i = 0; i < handlersLen; i++) {\n xhr.removeEventListener(handlers[i], this.listener, false);\n }\n if (params.aborted) return;\n if (hasUndefinedHostname(params)) return; // don't bother with XHR of url with no hostname\n\n metrics.duration = now() - this.startTime;\n if (!this.loadCazptureCalled && xhr.readyState === 4) {\n captureXhrData(this, xhr);\n } else if (params.status == null) {\n params.status = 0;\n }\n\n // Always send cbTime, even if no noticeable time was taken.\n metrics.cbTime = this.cbTime;\n handler('xhr', [params, metrics, this.startTime, this.endTime, 'xhr'], this, FEATURE_NAMES.ajax);\n }\n function captureXhrData(ctx, xhr) {\n ctx.params.status = xhr.status;\n var size = responseSizeFromXhr(xhr, ctx.lastSize);\n if (size) ctx.metrics.rxSize = size;\n if (ctx.sameOrigin) {\n var header = xhr.getResponseHeader('X-NewRelic-App-Data');\n if (header) {\n handle(SUPPORTABILITY_METRIC, ['Ajax/CrossApplicationTracing/Header/Seen'], undefined, FEATURE_NAMES.metrics, ee);\n ctx.params.cat = header.split(', ').pop();\n }\n }\n ctx.loadCaptureCalled = true;\n }\n}\nfunction addUrl(ctx, url) {\n var parsed = parseUrl(url);\n var params = ctx.params || ctx;\n params.hostname = parsed.hostname;\n params.port = parsed.port;\n params.protocol = parsed.protocol;\n params.host = parsed.hostname + ':' + parsed.port;\n params.pathname = parsed.pathname;\n ctx.parsedOrigin = parsed;\n ctx.sameOrigin = parsed.sameOrigin;\n}\nexport const Ajax = Instrument;","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @file Wraps `pushState` and `replaceState` methods of `window.history` object for instrumentation.\n * This module is used by: session_trace, spa.\n */\nimport { ee as globalEE } from '../event-emitter/contextual-ee';\nimport { createWrapperWithEmitter as wfn } from './wrap-function';\nimport { isBrowserScope } from '../constants/runtime';\nconst wrapped = {};\nconst HISTORY_FNS = ['pushState', 'replaceState'];\n\n/**\n * Wraps the `pushState` and `replaceState` methods of `window.history` and returns a corresponding event emitter\n * scoped to the history object.\n * @param {Object} sharedEE - The shared event emitter on which a new scoped event emitter will be based.\n * @returns {Object} Scoped event emitter with a debug ID of `history`.\n */\nexport function wrapHistory(sharedEE) {\n const ee = scopedEE(sharedEE);\n\n // Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,\n // then we increment the count to track # of feats using this at runtime. History API is only\n // available in browser DOM context.\n if (!isBrowserScope || wrapped[ee.debugId]++) return ee;\n wrapped[ee.debugId] = 1; // otherwise, first feature to wrap history\n\n var wrapFn = wfn(ee);\n /*\n * For objects that will be instantiated more than once, we wrap the object's prototype methods. The history object\n * is instantiated only once, so we can wrap its methods directly--and we must wrap the history methods directly as\n * long as [Chromium issue 783382](https://bugs.chromium.org/p/chromium/issues/detail?id=783382) remains unresolved.\n */\n wrapFn.inPlace(window.history, HISTORY_FNS, '-');\n return ee;\n}\n\n/**\n * Returns an event emitter scoped specifically for the `history` context. This scoping is a remnant from when all the\n * features shared the same group in the event, to isolate events between features. It will likely be revisited.\n * @param {Object} sharedEE - Optional event emitter on which to base the scoped emitter.\n * Uses `ee` on the global scope if undefined).\n * @returns {Object} Scoped event emitter with a debug ID of 'history'.\n */\nexport function scopedEE(sharedEE) {\n return (sharedEE || globalEE).get('history');\n}","import { FEATURE_NAMES } from '../../loaders/features/features';\nexport const FEATURE_NAME = FEATURE_NAMES.sessionTrace;\nexport const BST_RESOURCE = 'bstResource';\nexport const RESOURCE = 'resource';\nexport const START = '-start';\nexport const END = '-end';\nexport const FN_START = 'fn' + START;\nexport const FN_END = 'fn' + END;\nexport const PUSH_STATE = 'pushState';\nexport const MAX_NODES_PER_HARVEST = 1000;","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { handle } from '../../../common/event-emitter/handle';\nimport { wrapHistory } from '../../../common/wrap/wrap-history';\nimport { wrapEvents } from '../../../common/wrap/wrap-events';\nimport { InstrumentBase } from '../../utils/instrument-base';\nimport * as CONSTANTS from '../constants';\nimport { FEATURE_NAMES } from '../../../loaders/features/features';\nimport { deregisterDrain } from '../../../common/drain/drain';\nimport { canEnableSessionTracking } from '../../utils/feature-gates';\nimport { now } from '../../../common/timing/now';\nconst {\n BST_RESOURCE,\n RESOURCE,\n START,\n END,\n FEATURE_NAME,\n FN_END,\n FN_START,\n PUSH_STATE\n} = CONSTANTS;\nexport class Instrument extends InstrumentBase {\n static featureName = FEATURE_NAME;\n constructor(agentIdentifier, aggregator, auto = true) {\n super(agentIdentifier, aggregator, FEATURE_NAME, auto);\n const canTrackSession = canEnableSessionTracking(this.agentIdentifier);\n if (!canTrackSession) {\n deregisterDrain(this.agentIdentifier, this.featureName);\n return;\n }\n const thisInstrumentEE = this.ee;\n wrapHistory(thisInstrumentEE);\n this.eventsEE = wrapEvents(thisInstrumentEE);\n this.eventsEE.on(FN_START, function (args, target) {\n this.bstStart = now();\n });\n this.eventsEE.on(FN_END, function (args, target) {\n // ISSUE: when target is XMLHttpRequest, nr@context should have params so we can calculate event origin\n // When ajax is disabled, this may fail without making ajax a dependency of session_trace\n handle('bst', [args[0], target, this.bstStart, now()], undefined, FEATURE_NAMES.sessionTrace, thisInstrumentEE);\n });\n thisInstrumentEE.on(PUSH_STATE + START, function (args) {\n this.time = now();\n this.startPath = location.pathname + location.hash;\n });\n thisInstrumentEE.on(PUSH_STATE + END, function (args) {\n handle('bstHist', [location.pathname + location.hash, this.startPath, this.time], undefined, FEATURE_NAMES.sessionTrace, thisInstrumentEE);\n });\n let observer;\n try {\n // Capture initial resources and watch for future ones. Don't defer this given there's a default cap on the number of buffered entries.\n observer = new PerformanceObserver(list => {\n // eslint-disable-line no-undef\n const entries = list.getEntries();\n handle(BST_RESOURCE, [entries], undefined, FEATURE_NAMES.sessionTrace, thisInstrumentEE);\n });\n observer.observe({\n type: RESOURCE,\n buffered: true\n });\n } catch (e) {\n // Per NEWRELIC-8525, we don't have a fallback for capturing resources for older versions that don't support PO at this time.\n }\n this.importAggregator({\n resourceObserver: observer\n });\n }\n}\nexport const SessionTrace = Instrument;","import { gosNREUMOriginals } from '../../common/window/nreum';\nimport { FEATURE_NAMES } from '../../loaders/features/features';\nexport const FEATURE_NAME = FEATURE_NAMES.spa;\nexport const INTERACTION_EVENTS = ['click', 'submit', 'keypress', 'keydown', 'keyup', 'change'];\nexport const MAX_TIMER_BUDGET = 999;\nexport const FN_START = 'fn-start';\nexport const FN_END = 'fn-end';\nexport const CB_START = 'cb-start';\nexport const INTERACTION_API = 'api-ixn-';\nexport const REMAINING = 'remaining';\nexport const INTERACTION = 'interaction';\nexport const SPA_NODE = 'spaNode';\nexport const JSONP_NODE = 'jsonpNode';\nexport const FETCH_START = 'fetch-start';\nexport const FETCH_DONE = 'fetch-done';\nexport const FETCH_BODY = 'fetch-body-';\nexport const JSONP_END = 'jsonp-end';\nexport const originalSetTimeout = gosNREUMOriginals().o.ST;\nexport const START = '-start';\nexport const END = '-end';\nexport const BODY = '-body';\nexport const CB_END = 'cb' + END;\nexport const JS_TIME = 'jsTime';\nexport const FETCH = 'fetch';","/*\n * Copyright 2020 New Relic Corporation. All rights reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @file Wraps DOM insertion methods which in turn wrap JSONP functions that show up in the DOM.\n * This module is used by: spa.\n */\n\nimport { eventListenerOpts } from '../event-listener/event-listener-opts';\nimport { ee as baseEE } from '../event-emitter/contextual-ee';\nimport { createWrapperWithEmitter as wfn } from './wrap-function';\nimport { isBrowserScope } from '../constants/runtime';\nconst wrapped = {};\nconst domInsertMethods = ['appendChild', 'insertBefore', 'replaceChild'];\n\n/**\n * Wraps DOM insertion methods to identify script elements containing JSONP callback functions and instruments those\n * functions with custom events in the context of a new event emitter scoped only to JSONP.\n * @param {Object} sharedEE - The shared event emitter on which a new scoped event emitter will be based.\n * @returns {Object} Scoped event emitter with a debug ID of `jsonp`.\n */\nexport function wrapJsonP(sharedEE) {\n const ee = scopedEE(sharedEE);\n\n // Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,\n // then we increment the count to track # of feats using this at runtime. JSONP deals with DOM\n // tags so browser window env is required.\n if (!isBrowserScope || wrapped[ee.debugId]) return ee;\n wrapped[ee.debugId] = true; // otherwise, first feature to wrap JSONP\n\n var wrapFn = wfn(ee);\n var CALLBACK_REGEX = /[?&](?:callback|cb)=([^&#]+)/;\n var PARENT_REGEX = /(.*)\\.([^.]+)/;\n var VALUE_REGEX = /^(\\w+)(\\.|$)(.*)$/;\n\n // JSONP works by dynamically inserting \n\n{#if constructors[1]}\n\t\n\t\t{#if constructors[2]}\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t{:else}\n\t\t\t\n\t\t{/if}\n\t\n{:else}\n\t\n{/if}\n\n{#if mounted}\n\t
\n\t\t{#if navigated}\n\t\t\t{title}\n\t\t{/if}\n\t
\n{/if}","import * as client_hooks from '../../../src/hooks.client.js';\n\n\nexport { matchers } from './matchers.js';\n\nexport const nodes = [\n\t() => import('./nodes/0'),\n\t() => import('./nodes/1'),\n\t() => import('./nodes/2'),\n\t() => import('./nodes/3'),\n\t() => import('./nodes/4'),\n\t() => import('./nodes/5'),\n\t() => import('./nodes/6'),\n\t() => import('./nodes/7'),\n\t() => import('./nodes/8'),\n\t() => import('./nodes/9'),\n\t() => import('./nodes/10'),\n\t() => import('./nodes/11'),\n\t() => import('./nodes/12'),\n\t() => import('./nodes/13'),\n\t() => import('./nodes/14')\n];\n\nexport const server_loads = [];\n\nexport const dictionary = {\n\t\t\"/(sigin-in)\": [10],\n\t\t\"/approve-hotel-review/[id]/[approver]\": [11],\n\t\t\"/covid-hub\": [12],\n\t\t\"/(authenticated)/credits\": [3,[2]],\n\t\t\"/(authenticated)/dashboard\": [4,[2]],\n\t\t\"/hotel-review/[id]\": [13],\n\t\t\"/(authenticated)/itinerary/[bookingRef]/[passengerRef]\": [5,[2]],\n\t\t\"/(authenticated)/people\": [6,[2]],\n\t\t\"/(authenticated)/people/[profileId]\": [7,[2]],\n\t\t\"/(authenticated)/risk-hub\": [8,[2]],\n\t\t\"/sso\": [14],\n\t\t\"/(authenticated)/track\": [9,[2]]\n\t};\n\nexport const hooks = {\n\thandleError: client_hooks.handleError || (({ error }) => { console.error(error) }),\n\n\treroute: (() => {})\n};\n\nexport { default as root } from '../root.svelte';"],"file":"_app/immutable/chunks/app.66206aBJ.js"}