1import{Y as e,$ as t,a0 as n,_ as s,a1 as a,a2 as r,a3 as o,a4 as i,a5 as c,a6 as u,a7 as l,a8 as d,z as p,a9 as f,aa as m,U as v,ab as w,T as g,l as h,ac as b,ad as k}from"./datadog-rum-DC86RxTu.js";import"./main-934eVNIL.js";function y(e,t){return new Promise((n=>{e.write(t),e.finish((e=>{n(e)}))}))}const I=/\/(?![vV]\d{1,2}\/)([^/\d?]*\d+[^/?]*)/g;const _=(e,t)=>e||function(e){return e?e.replace(I,"/?"):"/"}(t);function S(e,t,n){const{ids:s,names:a}=function(e){const t={ids:[],names:[]};for(const n of e)t.ids.push(n.viewId),n.viewName&&t.names.push(n.viewName);return t.names=Array.from(new Set(t.names)),t}(e.views),r=e.longTasks.map((e=>e.id)).filter((e=>void 0!==e)),o={application:{id:t}};return n&&(o.session={id:n}),s.length&&(o.view={id:s,name:a}),r.length&&(o.long_task={id:r}),o}function T(e,t,n){const s=function(e,t,n){const s=a(t),o=S(e,t.applicationId,n),i=function(e){const t=e.concat(["language:javascript","runtime:chrome","family:chrome","host:browser"]);return t}(s),c={...o,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:i.join(","),_dd:{clock_drift:r()}};return c}
1(e,t,n);return{event:s,"wall-time.json":e}}const M=l;function C(e){const t=o({expireDelay:M});return e.subscribe(12,(({rawRumEvent:e,startClocks:n,duration:s})=>{"long_task"===e.type&&t.add({id:e.long_task.id,startClocks:n,duration:s,entryType:e.long_task.entry_type===c.LONG_TASK?i.LONG_TASK:i.LONG_ANIMATION_FRAME},n.relative).close(u(n.relative,s))})),t}const E={sampleIntervalMs:10,collectIntervalMs:6e4,minProfileDurationMs:5e3,minNumberOfSamples:50};function j(a,r,o,i,c,u,l=E){const I=function(a,r,o,i){const c=e([a.profilingEndpointBuilder],(e=>{r.notify(14,{error:e}),s("Error reported to customer",{"error.message":e.message})})),u=o(i);return{async send({event:e,...s}){const a=new FormData,r=t(e);if(!r)throw new Error("Failed to serialize event");a.append("event",new Blob([r],{type:"application/json"}),"event.json");let o=r.length;for(const[i,c]of n(s)){const e=t(c);if(!e)throw new Error("Failed to serialize attachment");const n=await y(u,e);o+=n.outputBytesCount,a.append(i,new Blob([n.output]),i)}c.send({data:a,bytesCount:o})}}}(a,r,c,6);let S;const M=[],j=d(C)(r);let N={state:"stopped",stateReason:"initializing"};function O(){if("running"===N.state)return;const e=u.findView();S=e?{startClocks:e.startClocks,viewId:e.id,viewName:_(e.name,document.location.pathname)}:void 0,M.push(p(a,window,"visibilitychange",L).stop,p(a,window,"beforeunload",z).stop),P()}function D(e){!function(e){if("paused"===N.state)return void(N={state:"stopped",stateReason:e});if("running"!==N.state)return;const t=N;N={state:"stopped",stateReason:e},t.cleanupTasks.forEach((e=>e())),R(t)}(e),M.forEach((e=>e())),i.set({status:"stopped",error_reason:void 0})}function P(){const e=f().Profiler;if(!e)throw i.set({status:"error",error_reason:"not-supported-by-browser"}),new Error("RUM Profiler is not supported in this browser.");"running"===N.state&&R(N);const{cleanupTasks:t}=function(e){if("running"===e.state)return{cleanupTasks:e.cleanupTasks};const t=[],n=r.subscribe(2,(e=>{const t={viewId:e.id,viewName:_(e.name,document.location.pathname),startClocks:e.startClocks};x(t),S=t}));return t.push(n.unsubscribe),{cleanupTasks:t}}(N);let n;try{n=new e({sampleInterval:l.sampleIntervalMs,maxBufferSize:Math.round(1.5*l.collectIntervalMs/l.sampleIntervalMs)})}catch(s){return void(s instanceof Error&&s.message.includes("disabled by Document Policy")?(m.warn("[DD_RUM] Profiler startup failed. Ensure your server includes the `Document-Policy: js-profiling` response header when serving HTML pages.",s),i.set({status:"error",error_reason:"missing-document-policy-header"})):i.set({status:"error",error_reason:"unexpected-exception"}))}i.set({status:"running",error_reason:void 0}),N={state:"running",startClocks:w(),profiler:n,timeoutId:v(P,l.collectIntervalMs),views:[],cleanupTasks:t,longTasks:[]},x(S),n.addEventListener("samplebufferfull",A)}function R(e){g(e.timeoutId),e.profiler.removeEventListener("samplebufferfull",A);const{startClocks:t,views:n}=e;e.profiler.stop().then((e=>{const s=w(),r=h(t.timeStamp,s.timeStamp),i=j.findAll(t.relative,r),c=r<l.minProfileDurationMs,u=function(e){let t=0;for(const n of e)void 0!==n.stackId&&t++;return t}(e.samples)<l.minNumberOfSamples;0===i.length&&(c||u)||function(e){var t;const n=null===(t=o.findTrackedSession())||void 0===t?void 0:t.id,s=T(e,a,n);I.send(s)}(Object.assign(e,{startClocks:t,endClocks:s,clocksOrigin:b(),longTasks:i,views:n,sampleInterval:l.sampleIntervalMs}))})).catch(k)}function x(e){"running"===N.state&&e&&N.views.push(e)}function A(){P()}function L(){"hidden"===document.visibilityState&&"running"===N.state?function(){if("running"!==N.state)return;const e=N;N={state:"paused"},e.cleanupTasks.forEach((e=>e())),R(e)}():"visible"===document.visibilityState&&"paused"===N.state&&P()}function z(){P()}return r.subscribe(9,(()=>{D("session-expired")})),r.subscribe(10,(()=>{"stopped"===N.state&&"session-expired"===N.stateReason&&O()})),{start:O,stop:function(){D("stopped-by-user")},isStopped:function(){return"stopped"===N.state},isRunning:function(){return"running"===N.state},isPaused:function(){return"paused"===N.state}}}export{E as DEFAULT_RUM_PROFILER_CONFIGURATION,j as createRumProfiler};
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.