PageSourceSearch

https://sfujiwara.net/assets/profiler-C5suzOTG.js

js sfujiwara.net collected 2026-10-05 22:53:39 UTC 5,465 bytes, 1 lines download raw bytes

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