1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9050],{3612:function(e,t,i){i.r(t),i.d(t,{DEFAULT_RUM_PROFILER_CONFIGURATION:function(){return O},createRumProfiler:function(){return D}});var n=i(1394);function r(){let e=(0,n.Ad)();return t=>{e.send("profile",t)}}var a=i(3176),s=i(7182);function o(e,t,i){let n=(0,a.QB)(e,t,i,s.C.PROFILING);return({profile:e,trace:t})=>{n.send({event:e,"wall-time.json":t})}}let l=/\/(?![vV]\d{1,2}\/)([^/\d?]*\d+[^/?]*)/g,u=(e,t)=>e||(t?t.replace(l,"/?"):"/");var d=i(9783),c=i(8907),p=i(8532),f=i(5557);let v=p.TN;function m(e){let t=(0,f.p)({expireDelay:v});return e.subscribe(a.Y5.RAW_RUM_EVENT_COLLECTED,({rawRumEvent:e,startClocks:i,duration:n})=>{"long_task"===e.type&&t.add({id:e.long_task.id,startClocks:i,duration:n,entryType:e.long_task.entry_type===a.wE.LONG_TASK?a.uo.LONG_TASK:a.uo.LONG_ANIMATION_FRAME},i.relative).close((0,c.WK)(i.relative,n))}),t}let _=p.TN;function b(e){let t=(0,f.p)({expireDelay:_});return e.subscribe(a.Y5.ACTION_STARTED,e=>{t.add({id:e.id,label:"",startClocks:e.startClocks,duration:void 0},e.startClocks.relative)}),e.subscribe(a.Y5.RAW_RUM_EVENT_COLLECTED,({rawRumEvent:e,startClocks:i,duration:n})=>{if("action"===e.type){let r=t.getEntries(i.relative).find(t=>t.value.id===e.action.id),a=n??0;r?(r.value.duration=a,r.close((0,c.WK)(i.relative,a))):t.add({id:e.action.id,label:"",startClocks:i,duration:n},i.relative).close((0,c.WK)(i.relative,a))}}),t}let E=p.TN;function g(e){let t=(0,f.p)({expireDelay:E});return e.subscribe(a.Y5.DURATION_VITAL_STARTED,e=>{t.add({id:e.id,type:a.o8.DURATION,startClocks:e.startClocks,duration:void 0,label:e.name},e.startClocks.relative)}),e.subscribe(a.Y5.RAW_RUM_EVENT_COLLECTED,({rawRumEvent:e,startClocks:i,duration:n})=>{if("vital"!==e.type)return;
1if(e.vital.type===a.o8.OPERATION_STEP){if("start"===e.vital.step_type)t.add({id:e.vital.id,type:e.vital.type,operationKey:e.vital.operation_key,startClocks:i,label:e.vital.name},i.relative);else if("end"===e.vital.step_type){let n=t.findAllEntries().find(t=>t.value.type===a.o8.OPERATION_STEP&&t.value.label===e.vital.name&&t.value.operationKey===e.vital.operation_key);if(!n)return;n.value.duration=(0,c._J)(n.value.startClocks.relative,i.relative),n.close(i.relative)}return}let r=t.getEntries(i.relative).find(t=>t.value.id===e.vital.id);if(r){r.value.duration=n,r.close((0,c.WK)(i.relative,n));return}t.add({id:e.vital.id,type:e.vital.type,operationKey:e.vital.operation_key,startClocks:i,duration:n,label:e.vital.name},i.relative).close((0,c.WK)(i.relative,n))}),t}var k=i(8481),h=i(9449),y=i(9464);function I(e,t,i=5e3){let n;let r=(0,y.lp)({proxy:e.proxy,site:e.site,path:"/api/v2/profiling/quota",parameters:`session_id=${t}`,subdomain:"quota"}),a=new AbortController,s=(0,k.h)(r,{credentials:"omit",signal:a.signal,headers:new Headers({"DD-CLIENT-TOKEN":e.clientToken})}).then(e=>{let t=429===e.status?{decision:"quota_ko",reason:"quota_exceeded"}:{decision:"quota_ok",reason:"api-error"};return e.json().then(e=>((0,h.gr)(n),function(e,t){let i=e?.data?.attributes;if(!i||"boolean"!=typeof i.admitted||"string"!=typeof i.reason)return t;let n="backend_client_not_initialized"===i.reason?"backend_unavailable":i.reason;return{decision:i.admitted?"quota_ok":"quota_ko",reason:n}}(e,t)),()=>((0,h.gr)(n),t))}).catch(()=>((0,h.gr)(n),{decision:"quota_ok",reason:"api-error"})),o=new Promise(e=>{n=(0,h.iK)(()=>{a.abort(),e({decision:"quota_ok",reason:"timeout"})},i)});return Promise.race([s,o])}var T=i(8365),C=i(2318),w=i(5250),N=i(4265),R=i(1930),S=i(5262),A=i(7390);let O={sampleIntervalMs:10,collectIntervalMs:6e4,minProfileDurationMs:5e3};function D(e,t,i,s,l,p,f=O){let v;let _=(0,n.xT)()?(0,C.C)(r)():(0,C.C)(o)(e,t,l),E=[],k=(0,C.C)(m)(t),y=(0,C.C)(b)(t),D=(0,C.C)(g)(t),M={state:"stopped",stateReason:"initializing"},L=0;function P(){if("running"===M.state)return;let t=p.findView();v=t?{startClocks:t.startClocks,viewId:t.id,viewName:u(t.name,document.location.pathname)}:void 0,E.push((0,N.Oo)(window,N.EZ.VISIBILITY_CHANGE,j).stop,(0,N.Oo)(window,N.EZ.BEFORE_UNLOAD,Y).stop),x(),function(){if((0,n.xT)())return;let t=++L,r=i.findTrackedSession()?.id;r&&(0,C.C)(I)(e,r).then(e=>{t===L&&("running"===M.state||"paused"===M.state)&&"quota_ko"===e.decision&&q("quota_ko",e.reason)}).catch(A.$y)}()}function q(e,t){(function(e){if("running"!==M.state){("paused"===M.state||"stopped"===M.state&&"stopped-by-user"===e)&&(M={state:"stopped",stateReason:e});return}let t=M;M={state:"stopped",stateReason:e},t.cleanupTasks.forEach(e=>e()),"quota_ko"===e?((0,h.gr)(t.timeoutId),t.profiler.removeEventListener("samplebufferfull",W),t.profiler.stop().catch(A.$y)):K(t)})(e),E.forEach(e=>e()),E.length=0,s.set({status:"stopped",error_reason:void 0,quota_reason:t})}function x(){let e;let n=S.Z.Profiler;if(!n)throw s.set({status:"error",error_reason:"not-supported-by-browser"}),Error("RUM Profiler is not supported in this browser.");"running"===M.state&&K(M);let{cleanupTasks:r}=function(e){if("running"===e.state)return{cleanupTasks:e.cleanupTasks};let i=[],n=t.subscribe(a.Y5.VIEW_CREATED,e=>{let t={viewId:e.id,viewName:u(e.name,document.location.pathname),startClocks:e.startClocks};U(t),v=t});return i.push(n.unsubscribe),{cleanupTasks:i}}(M);try{e=new n({sampleInterval:f.sampleIntervalMs,maxBufferSize:Math.round(1.5*f.collectIntervalMs/f.sampleIntervalMs)})}catch(e){e instanceof Error&&e.message.includes("disabled by Document Policy")?(R.j.warn("[DD_RUM] Profiler startup failed. Ensure your server includes the `Document-Policy: js-profiling` response header when serving HTML pages.",e),s.set({status:"error",error_reason:"missing-document-policy-header"})):s.set({status:"error",error_reason:"unexpected-exception"});return}s.set({status:"running",error_reason:void 0}),M={state:"running",startClocks:(0,c.$I)(),profiler:e,timeoutId:(0,h.iK)(x,f.collectIntervalMs),views:[],cleanupTasks:r,longTasks:[],sessionId:i.findTrackedSession()?.id},U(v),e.addEventListener("samplebufferfull",W)}
1function K(t){(0,h.gr)(t.timeoutId),t.profiler.removeEventListener("samplebufferfull",W);let{startClocks:i,views:n,sessionId:r}=t;t.profiler.stop().then(t=>{let a=(0,c.$I)(),s=(0,c._J)(i.relative,a.relative),o=k.findAll(i.relative,s),l=y.findAll(i.relative,s),u=D.findAll(i.relative,s).map(e=>({id:e.id,label:e.label,startClocks:e.startClocks,duration:e.duration})),p=s<f.minProfileDurationMs;0===o.length&&p||function(t,i){let n={profile:function(e,t,i){let n=(0,d.MS)(t),r=function(e,t,i){let{ids:n,names:r}=function(e){let t={ids:[],names:[]};for(let i of e)t.ids.push(i.viewId),i.viewName&&t.names.push(i.viewName);return t.names=Array.from(new Set(t.names)),t}(e.views),a=e.longTasks.map(e=>e.id).filter(e=>void 0!==e),s=e.actions?.map(e=>e.id).filter(e=>void 0!==e)??[],{ids:o,labels:l}=function(e){let t={ids:[],labels:[]};if(!e)return t;for(let i of e)t.ids.push(i.id),t.labels.push(i.label);return t.labels=Array.from(new Set(t.labels)),t}(e.vitals),u={application:{id:t}};return i&&(u.session={id:i}),n.length&&(u.view={id:n,name:r}),a.length&&(u.long_task={id:a}),s.length&&(u.action={id:s,label:[]}),o.length&&(u.vital={id:o,label:l}),u}(e,t.applicationId,i),a=n.concat(["language:javascript","runtime:chrome","family:chrome","host:browser"]);return{...r,attachments:["wall-time.json"],start:new Date(e.startClocks.timeStamp).toISOString(),end:new Date(e.endClocks.timeStamp).toISOString(),family:"chrome",runtime:"chrome",format:"json",version:4,tags_profiler:a.join(","),_dd:{clock_drift:(0,c.Pv)()}}}(t,e,i),trace:t};_(n)}(Object.assign({},t,{startClocks:i,endClocks:a,clocksOrigin:(0,c.cQ)(),longTasks:o,actions:l,vitals:u,views:n,sampleInterval:f.sampleIntervalMs,debugIds:function(e){let t=new Map(T.J(e)?.map(e=>[e.url,e.id])),i=[];return e.forEach((e,n)=>{let r=t.get(e);void 0!==r&&i.push({resourceId:n,debugId:r})}),i.length?i:void 0}(t.resources)}),r)}).catch(A.$y)}function U(e){"running"===M.state&&e&&M.views.push(e)}function W(){x()}function j(){"hidden"===document.visibilityState&&"running"===M.state?function(){if("running"!==M.state)return;let e=M;M={state:"paused"},e.cleanupTasks.forEach(e=>e()),K(e)}():"visible"===document.visibilityState&&"paused"===M.state&&x()}function Y(){x()}return t.subscribe(a.Y5.SESSION_EXPIRED,()=>{q("session-expired")}),t.subscribe(a.Y5.SESSION_RENEWED,()=>{if("stopped"===M.state&&("session-expired"===M.stateReason||"quota_ko"===M.stateReason)){let t=i.findTrackedSession();t&&(0,w.HR)(t.id,(0,w.HQ)(e.sessionSampleRate,e.profilingSampleRate))&&P()}}),{start:P,stop:function(){q("stopped-by-user")},isStopped:function(){return"stopped"===M.state},isRunning:function(){return"running"===M.state},isPaused:function(){return"paused"===M.state}}}}}]); 2//# sourceMappingURL=datadogProfiler.05339cdcc4556b28.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.