{"version":3,"file":"async-api.5f3a278c2cb6efc9.js","mappings":"uNAQO,WAAgBA,GACrB,IAAIC,EAAaC,SAAOF,GACpBG,EAAM,CACRC,UAAUC,OAYZ,WAAkBC,EAAGC,GACnB,IAAIC,EAAOD,EAAeA,EAAeE,KAAaH,GACtDI,OAAOC,KAAuB,CAAC,WAAY,CACzCH,cACEI,EAAWC,YAAuBZ,GACtCa,EAAWR,EAAG,CACZS,KAAM,WACNC,MAAOR,EAAOC,KACdQ,OAAQ,QAEVP,OAAO,oBAAqB,CAACF,EAAM,iBAAaI,EAAWC,kBAA6BZ,KArBxFiB,gBAkCF,WAAyBZ,EAAGa,IAC1BC,OAAWpB,GAAiBqB,QAAUF,GAlCtCL,aACAQ,WAoCF,WAAoBhB,EAAGS,EAAMQ,KACrBC,EAAe,QACrBJ,KAAWpB,GAAiByB,WAAWV,EAAKW,OAAM,OAAU,GAAKH,GAAIG,OAAM,QAjB7E,WAAoBpB,EAAGqB,GACrB,GAAMA,GAAsB,iBAARA,GAAoBA,EAAIZ,MAAQY,EAAIX,MACxD,KAAIY,EAAS,CACXC,EAAGF,EAAIZ,KACPe,EAAGH,EAAIX,MAAQP,KACfsB,GAAIJ,EAAIK,KAAOL,EAAIX,OAASP,KAC5BwB,EAAGN,EAAIV,QAAU,GACjBX,EAAG,QAELI,OAAO,SAAU,CAACkB,QAAShB,EAAWC,iBAA4BZ,IA1BpEiC,OAAOC,QAAQhC,GAAKiC,QAAQ,EAAEC,EAAQC,MAAYC,OAAgB,OAASF,EAAQC,EAAQ,MAAOrC,IA+BlG,IAAIuB,EAAe,CAG0D","names":["agentIdentifier","instanceEE","ee","api","finished","single","t","providedTime","time","originTime","handle","CUSTOM_METRIC_CHANNEL","undefined","FEATURE_NAMES","addToTrace","name","start","origin","setErrorHandler","handler","getRuntime","onerror","addRelease","id","releaseCount","releaseIds","slice","evt","report","n","s","e","end","o","Object","entries","forEach","fnName","fnCall","registerHandler"],"sourceRoot":"webpack:///","sources":["./node_modules/@newrelic/browser-agent/dist/esm/loaders/api/apiAsync.js"],"sourcesContent":["import { FEATURE_NAMES } from '../features/features';\nimport { getRuntime } from '../../common/config/runtime';\nimport { ee } from '../../common/event-emitter/contextual-ee';\nimport { handle } from '../../common/event-emitter/handle';\nimport { registerHandler } from '../../common/event-emitter/register-handler';\nimport { single } from '../../common/util/invoke';\nimport { CUSTOM_METRIC_CHANNEL } from '../../features/metrics/constants';\nimport { originTime } from '../../common/constants/runtime';\nexport function setAPI(agentIdentifier) {\n var instanceEE = ee.get(agentIdentifier);\n var api = {\n finished: single(finished),\n setErrorHandler,\n addToTrace,\n addRelease\n };\n\n // Hook all of the api functions up to the queues/stubs created in loader/api.js\n Object.entries(api).forEach(([fnName, fnCall]) => registerHandler('api-' + fnName, fnCall, 'api', instanceEE));\n\n // All API functions get passed the time they were called as their\n // first parameter. These functions can be called asynchronously.\n\n function finished(t, providedTime) {\n var time = providedTime ? providedTime - originTime : t;\n handle(CUSTOM_METRIC_CHANNEL, ['finished', {\n time\n }], undefined, FEATURE_NAMES.metrics, instanceEE);\n addToTrace(t, {\n name: 'finished',\n start: time + originTime,\n origin: 'nr'\n });\n handle('api-addPageAction', [time, 'finished'], undefined, FEATURE_NAMES.genericEvents, instanceEE);\n }\n function addToTrace(t, evt) {\n if (!(evt && typeof evt === 'object' && evt.name && evt.start)) return;\n var report = {\n n: evt.name,\n s: evt.start - originTime,\n e: (evt.end || evt.start) - originTime,\n o: evt.origin || '',\n t: 'api'\n };\n handle('bstApi', [report], undefined, FEATURE_NAMES.sessionTrace, instanceEE);\n }\n function setErrorHandler(t, handler) {\n getRuntime(agentIdentifier).onerror = handler;\n }\n var releaseCount = 0;\n function addRelease(t, name, id) {\n if (++releaseCount > 10) return;\n getRuntime(agentIdentifier).releaseIds[name.slice(-200)] = ('' + id).slice(-200);\n }\n}"]}