Files
tildefriends/deps/speedscope/speedscope-HCR63FMT.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

190 lines
469 KiB
JavaScript
Raw Normal View History

2025-08-13 12:06:47 -04:00
"use strict";(()=>{var of=Object.create;var Zo=Object.defineProperty;var lf=Object.getOwnPropertyDescriptor;var Af=Object.getOwnPropertyNames;var sf=Object.getPrototypeOf,cf=Object.prototype.hasOwnProperty;var le=(t,e)=>()=>(t&&(e=t(t=0)),e);var S=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),SA=(t,e)=>{for(var n in e)Zo(t,n,{get:e[n],enumerable:!0})},_f=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Af(e))!cf.call(t,r)&&r!==n&&Zo(t,r,{get:()=>e[r],enumerable:!(a=lf(e,r))||a.enumerable});return t};var _e=(t,e,n)=>(n=t!=null?of(sf(t)):{},_f(e||!t||!t.__esModule?Zo(n,"default",{value:t,enumerable:!0}):n,t));function ne(t){return t[t.length-1]||null}function Se(t,e){function n(a,r){let o=e(a),i=e(r);return o<i?-1:o>i?1:0}t.sort(n)}function Ne(t,e,n){return t.has(e)||t.set(e,n(e)),t.get(e)}function sa(t,e,n){return t.has(e)?t.get(e):n(e)}function Ze(t,e){if(!t.has(e))throw new Error(`Expected key ${e}`);return t.get(e)}function*KA(t,e){for(let n of t)yield e(n)}function PA(t,e){for(let n of t)e(n)}function an(t,e){return new Array(Math.max(e-t.length,0)+1).join("0")+t}function bt(t){let e=`${t.toFixed(0)}%`;return t===100?e="100%":t>99?e=">99%":t<.01?e="<0.01%":t<1?e=`${t.toFixed(2)}%`:t<10&&(e=`${t.toFixed(1)}%`),e}function Cf(t){return t-Math.floor(t)}function ca(t){return 2*Math.abs(Cf(t)-.5)-1}function OA(t,e,n,a,r=1){for(console.assert(!isNaN(r)&&!isNaN(a));;){if(e-t<=r)return[t,e];let o=(e+t)/2;n(o)<a?t=o:e=o}}function GA(t,e){if(t.length===0)return-1;let n=0,a=t.length-1;for(;a!==n;){let r=Math.floor((n+a)/2);e(t[r])?a=r:n=r+1}return e(t[a])?a:-1}function Jn(...t){}function Ir(t,e){for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(t[n]!==e[n])return!1;return!0}function Ge(t){let e=null;return n=>{let a;return e==null?(a=t(n),e={args:n,result:a},a):(Ir(e.args,n)||(e.args=n,e.result=t(n)),e.result)}}function Un(t){let e=null;return n=>{let a;return e==null?(a=t(n),e={args:n,result:a},a):(e.args===n||(e.args=n,e.result=t(n)),e.result)}}function mf(t){let e=null;return()=>(e==null&&(e={result:t()}),e.result)}function zA(t){let e=If();if(t.length%4!==0)throw new Error(`Invalid length for base64 encoded string. Expected length % 4 = 0, got length = ${t.length}`);let n=t.length/4,a;t.length>=4&&t.charAt(t.length-1)==="="?t.charAt(t.length-2)==="="?a=n*3-2:a=n*3-1:a=n*3;let r=new Uint8Array(a),o=0;for(let i=0;i<n;i++){let l=t.charAt(i*4+0),s=t.charAt(i*4+1),A=t.charAt(i*4+2),c=t.charAt(i*4+3),h=e.get(l),_=e.get(s),f=e.get(A),m=e.get(c);if(h==null||_==null||f==null||m==null)throw new Error(`Invalid quartet at indices ${i*4} .. ${i*4+3}: ${t.substring(i*4,i*4+3)}`);r[o++]=h<<2|_>>4,A!=="="&&(r[o++]=(_&15)<<4|f>>2),c!=="="&&(r[o++]=(f&7)<<6|m)}if(o!==a)throw new Error(`Expected to decode ${a} bytes, but only decoded ${o})`);return r}var wt,If,W=le(()=>{"use strict";wt=class{constructor(){this.map=new Map}getOrInsert(e){let n=e.key,a=this.map.get(n);return a||(this.map.set(n,e),e)}forEach(e){this.map.forEach(e)}[Symbol.iterator](){return this.map.values()}};If=mf(()=>{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=new Map;for(let n=0;n<t.length;n++)e.set(t.charAt(n),n);return e.set("=",-1),e})});var vn=S((xa,bs)=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});xa.default=Vf;var zf=/-webkit-|-moz-|-ms-/;function Vf(t){return typeof t=="string"&&zf.test(t)}bs.exports=xa.default});var Ss=S((Sa,xs)=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});Sa.default=Zf;var Yf=vn(),Wf=qf(Yf);function qf(t){return t&&t.__esModule?t:{default:t}}var $f=["-webkit-","-moz-",""];function Zf(t,e){if(typeof e=="string"&&!(0,Wf.default)(e)&&e.indexOf("calc(")>-1)return $f.map(function(n){return e.replace(/calc\(/g,n+"calc(")})}xs.exports=Sa.default});var ks=S((Na,Ns)=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});Na.default=rp;var Xf=vn(),ep=tp(Xf);function tp(t){return t&&t.__esModule?t:{default:t}}var np=["-webkit-",""];function rp(t,e){if(typeof e=="string"&&!(0,ep.default)(e)&&e.indexOf("cross-fade(")>-1)return np.map(function(n)
`;break;case 114:f+="\r";break;case 116:f+=" ";break;case 117:{for(var u=0,g=0;g<4;g++)_=a[h++],u<<=4,_>=48&&_<=57?u|=_-48:_>=97&&_<=102?u|=_+-87:_>=65&&_<=70?u|=_+-55:n(a,--h);f+=e(u);break}default:n(a,--h);break}else if(_<=127)f+=e(_);else if((_&224)===192)f+=e((_&31)<<6|a[h++]&63);else if((_&240)===224)f+=e((_&15)<<12|(a[h++]&63)<<6|a[h++]&63);else if((_&248)==240){var p=(_&7)<<18|(a[h++]&63)<<12|(a[h++]&63)<<6|a[h++]&63;p>65535&&(p-=65536,f+=e(p>>10&1023|55296),p=56320|p&1023),f+=e(p)}f[0];break}case 91:{f=[],r.push(s),o.push(c),i.push(A),s=null,c=f,A=1;continue}case 123:{f={},r.push(s),o.push(c),i.push(A),s=null,c=f,A=2;continue}case 93:{A!==1&&n(a,--h),f=c,s=r.pop(),c=o.pop(),A=i.pop();break}case 125:{A!==2&&n(a,--h),f=c,s=r.pop(),c=o.pop(),A=i.pop();break}default:n(a,--h)}for(_=a[h];_<=32;)_=a[++h];switch(A){case 0:{if(h===l)return f;break}case 1:{if(c.push(f),_===44){h++;continue}if(_===93)continue;break}case 2:{if(s===null){if(s=f,_===58){h++;continue}}else{if(c[s]=f,s=null,_===44){h++;continue}if(_===125)continue}break}}break}}n(a,h)}})(Mo)});function cd(t){return t=t.trim(),t[0]==="["&&(t=t.replace(/,\s*$/,""),t[t.length-1]!=="]"&&(t+="]")),JSON.parse(t)}function lv(t){let e=0;for(let n=0;n<t.length;n++)if(!/\s/.exec(String.fromCharCode(t[n]))){e=n;break}if(t[e]===91&&t[t.length-1]!==93){let n=t.length;for(;n>0&&/\s/.exec(String.fromCharCode(t[n-1]));)n--;if(String.fromCharCode(t[n-1])===","&&n--,String.fromCharCode(t[n-1])!=="]"){let a=new Uint8Array(n+1);a.set(t.subarray(0,n)),a[n]=93,t=a}}return(0,sd.JSON_parse)(t)}var Ad,sd,Jo,Wl,ql,Uo,nn,$l=le(()=>{"use strict";Ad=_e(id()),sd=_e(ld()),Jo=1<<27;Wl=class{constructor(e){this.chunks=[];let n=this.byteArray=new Uint8Array(e),a="utf-8";if(n.length>2&&(n[0]===255&&n[1]===254?a="utf-16le":n[0]===254&&n[1]===255&&(a="utf-16be")),typeof TextDecoder<"u"){let r=new TextDecoder(a);for(let o=0;o<e.byteLength/Jo;o++){let i=o*Jo,l=new Uint8Array(e,i,Math.min(e.byteLength-i,Jo)),s=r.decode(l,{stream:!0});this.chunks.push(s)}}else{console.warn("This browser does not support TextDecoder. Decoding text as ASCII."),this.chunks.push("");for(let r=0;r<n.length;r++)this.chunks[this.chunks.length-1]+=String.fromCharCode(n[r]),this.chunks[this.chunks.length-1]|0,this.chunks[this.chunks.length-1].length>=Jo&&this.chunks.push("")}}splitLines(){let e=function*(){let n="";for(let a of this.chunks){let r=a.split(`
`);for(let o=0;o<r.length;o++)o===0?n+=r[o]:(yield n,n=r[o])}yield n};return{[Symbol.iterator]:e.bind(this)}}firstChunk(){return this.chunks[0]||""}parseAsJSON(){return this.chunks.length===1?cd(this.chunks[0]):lv(this.byteArray)}},ql=class{constructor(e){this.s=e}splitLines(){return this.s.split(`
`)}firstChunk(){return this.s}parseAsJSON(){return cd(this.s)}},Uo=class{constructor(e,n){this.fileName=e;this.contents=n}async name(){return this.fileName}async readAsArrayBuffer(){return new ArrayBuffer(0)}async readAsText(){return new ql(this.contents)}},nn=class t{constructor(e,n){this.namePromise=e;this.uncompressedData=n.then(async a=>{try{return Ad.inflate(new Uint8Array(a)).buffer}catch{return a}})}async name(){return await this.namePromise}async readAsArrayBuffer(){return await this.uncompressedData}async readAsText(){let e=await this.readAsArrayBuffer();return new Wl(e)}static fromFile(e){let n=new Promise(a=>{let r=new FileReader;r.addEventListener("loadend",()=>{if(!(r.result instanceof ArrayBuffer))throw new Error("Expected reader.result to be an instance of ArrayBuffer");a(r.result)}),r.readAsArrayBuffer(e)});return new t(Promise.resolve(e.name),n)}static fromArrayBuffer(e,n){return new t(Promise.resolve(e),Promise.resolve(n))}}});function Av(t){let e=[...t.splitLines()].map(o=>o.split(" ")),n=e.shift();if(!n)return[];let a=new Map;for(let o=0;o<n.length;o++)a.set(o,n[o]);let r=[];for(let o of e){let i={};for(let l=0;l<o.length;l++)i[a.get(l)]=o[l];r.push(i)}return r}function sv(t){if("Bytes Used"in t){let e=t["Bytes Used"],n=/\s*(\d+(?:[.]\d+)?) (\w+)\s+(?:\d+(?:[.]\d+))%/.exec(e);if(!n)return 0;let a=parseInt(n[1],10),r=n[2];switch(r){case"Bytes":return a;case"KB":return 1024*a;case"MB":return 1024*1024*a;case"GB":return 1024*1024*1024*a}throw new Error(`Unrecognized units ${r}`)}if("Weight"in t||"Running Time"in t){let e=t.Weight||t["Running Time"],n=/\s*(\d+(?:[.]\d+)?) ?(\w+)\s+(?:\d+(?:[.]\d+))%/.exec(e);if(!n)return 0;let a=parseInt(n[1],10),r=n[2];switch(r){case"ms":return a;case"s":return 1e3*a;case"min":return 60*1e3*a;case"cycles":return a;case"Kc":return 1e3*a;case"Mc":return 1e3*1e3*a;case"Gc":return 1e3*1e3*1e3*a}throw new Error(`Unrecognized units ${r}`)}return-1}function eA(t){let e=new me,n=Av(t),a=[],r=0,o=n[0]["Symbol Names"]?n[0]["Symbol Names"].lastIndexOf(" ")+1:0;for(let i of n){let l=i["Symbol Name"]||i["Symbol Names"]?.slice(o);if(!l)continue;let s=l.trim(),A=l.length-s.length;if(a.length-A<0)throw new Error("Invalid format");let c=[];for(;A<a.length;){let _=a.pop();c.push(_)}for(let _ of c)r=Math.max(r,_.endValue),e.leaveFrame(_,r);let h={key:`${i["Source Path"]||""}:${s}`,name:s,file:i["Source Path"],endValue:r+sv(i)};e.enterFrame(h,r),a.push(h)}for(;a.length>0;){let i=a.pop();r=Math.max(r,i.endValue),e.leaveFrame(i,r)}return"Bytes Used"in n[0]?e.setValueFormatter(new ze):("Weight"in n[0]||"Running Time"in n[0])&&e.setValueFormatter(new ee("milliseconds")),e.build()}async function hd(t){let e={name:t.name,files:new Map,subdirectories:new Map},n=await new Promise((a,r)=>{t.createReader().readEntries(o=>{a(o)},r)});for(let a of n)if(a.isDirectory){let r=await hd(a);e.subdirectories.set(r.name,r)}else{let r=await new Promise((o,i)=>{a.file(o,i)});e.files.set(r.name,r)}return e}function Ko(t){return nn.fromFile(t).readAsArrayBuffer()}function cv(t){return nn.fromFile(t).readAsText()}function _v(t,e){let n=Ze(t.subdirectories,"corespace"),a=Ze(n.subdirectories,`run${e}`);return Ze(a.subdirectories,"core")}async function hv(t){let e=Ze(t.subdirectories,"stores");for(let n of e.subdirectories.values()){let a=n.files.get("schema.xml");if(!a)continue;let r=await cv(a);if(!/name="time-profile"/.exec(r.firstChunk()))continue;let o=new $r(await Ko(Ze(n.files,"bulkstore")));o.readUint32(),o.readUint32(),o.readUint32();let i=o.readUint32(),l=o.readUint32();o.seek(i);let s=[];for(;;){let A=o.readUint48();if(A===0)break;let c=o.readUint32();o.skip(l-6-4-4);let h=o.readUint32();s.push({timestamp:A,threadID:c,backtraceID:h})}return s}throw new Error("Could not find sample list")}async function gv(t,e){let n=Ze(e.subdirectories,"uniquing"),a=Ze(n.subdirectories,"arrayUniquer"),r=Ze(a.files,"integeruniquer.index"),o=Ze(a.files,"integeruniquer.data"),i=new $r(await Ko(r)),l=new $r(await Ko(o));i.seek(32);let s=[];for(;i.hasMore();){let A=i.readUint32()+i.readUint32()*1048576;if(A===0)continue;l.seek(
2025-01-17 17:55:47 -05:00
uniform mat3 configSpaceToNDC;
attribute vec2 configSpacePos;
attribute vec3 color;
varying vec3 vColor;
void main() {
vColor = color;
vec2 position = (configSpaceToNDC * vec3(configSpacePos, 1)).xy;
gl_Position = vec4(position, 1, 1);
}
2025-08-13 12:06:47 -04:00
`,jf=`
2025-01-17 17:55:47 -05:00
precision mediump float;
varying vec3 vColor;
void main() {
gl_FragColor = vec4(vColor.rgb, 1);
}
2025-08-13 12:06:47 -04:00
`,mn=class{constructor(e){this.gl=e;this.rects=[];this.colors=[];this.buffer=null}getRectCount(){return this.rects.length}getBuffer(){if(this.buffer)return this.buffer;let e=[[0,0],[1,0],[0,1],[1,0],[0,1],[1,1]],n=new Uint8Array(ua.stride*e.length*this.rects.length),a=new Float32Array(n.buffer),r=0;for(let o=0;o<this.rects.length;o++){let i=this.rects[o],l=this.colors[o];for(let s of e)a[r++]=i.origin.x+s[0]*i.size.x,a[r++]=i.origin.y+s[1]*i.size.y,a[r++]=l.r,a[r++]=l.g,a[r++]=l.b}if(r!==a.length)throw new Error("Buffer expected to be full but wasn't");return this.buffer=this.gl.createVertexBuffer(n.length),this.buffer.upload(n),this.buffer}addRect(e,n){this.rects.push(e),this.colors.push(n),this.buffer&&(this.buffer.free(),this.buffer=null)}free(){this.buffer&&(this.buffer.free(),this.buffer=null)}},da=class{constructor(e){this.gl=e;this.material=e.createMaterial(ua,Bf,jf)}render(e){xt(this.material,"configSpaceToNDC",(()=>{let n=O.betweenRects(e.configSpaceSrcRect,e.physicalSpaceDstRect),a=new v(this.gl.viewport.width,this.gl.viewport.height);return O.withTranslation(new v(-1,1)).times(O.withScale(new v(2,-2).dividedByPointwise(a))).times(n)})()),this.gl.setUnpremultipliedBlendState(),this.gl.draw(z.Primitive.TRIANGLES,this.material,e.batch.getBuffer())}};var ue=class t{constructor(e=0,n=0,a=0,r=1){this.r=e;this.g=n;this.b=a;this.a=r}static fromLumaChromaHue(e,n,a){let r=a/60,o=n*(1-Math.abs(r%2-1)),[i,l,s]=r<1?[n,o,0]:r<2?[o,n,0]:r<3?[0,n,o]:r<4?[0,o,n]:r<5?[o,0,n]:[n,0,o],A=e-(.3*i+.59*l+.11*s);return new t(ke(i+A,0,1),ke(l+A,0,1),ke(s+A,0,1),1)}static fromCSSHex(e){if(e.length!==7||e[0]!=="#")throw new Error(`Invalid color input ${e}`);let n=parseInt(e.substr(1,2),16)/255,a=parseInt(e.substr(3,2),16)/255,r=parseInt(e.substr(5,2),16)/255;if(n<0||n>1||a<0||a>1||r<0||r>1)throw new Error(`Invalid color input ${e}`);return new t(n,a,r)}withAlpha(e){return new t(this.r,this.g,this.b,e)}toCSS(){return`rgba(${(255*this.r).toFixed()}, ${(255*this.g).toFixed()}, ${(255*this.b).toFixed()}, ${this.a.toFixed(2)})`}};var fa=class{constructor(e,n,a){this.gl=e;this.rectangleBatchRenderer=n;this.textureRenderer=a;this.texture=e.createTexture(z.TextureFormat.NEAREST_CLAMP,4096,4096),this.renderTarget=e.createRenderTarget(this.texture),this.rowCache=new ha(this.texture.height),this.clearLineBatch=new mn(e),this.clearLineBatch.addRect(F.unit,new ue(0,0,0,0)),e.addContextResetHandler(()=>{this.rowCache.clear()})}has(e){return this.rowCache.has(e)}getResolution(){return this.texture.width}getCapacity(){return this.texture.height}allocateLine(e){if(this.rowCache.getSize()<this.rowCache.getCapacity()){let n=this.rowCache.getSize();return this.rowCache.insert(e,n),n}else{let[,n]=this.rowCache.removeLRU();return this.rowCache.insert(e,n),n}}writeToAtlasIfNeeded(e,n){ga(this.gl,this.renderTarget,()=>{for(let a of e){let r=this.rowCache.get(a);if(r!=null)continue;r=this.allocateLine(a);let o=new F(new v(0,r),new v(this.texture.width,1));this.rectangleBatchRenderer.render({batch:this.clearLineBatch,configSpaceSrcRect:F.unit,physicalSpaceDstRect:o}),n(o,a)}})}renderViaAtlas(e,n){let a=this.rowCache.get(e);if(a==null)return!1;let r=new F(new v(0,a),new v(this.texture.width,1));return this.textureRenderer.render({texture:this.texture,srcRect:r,dstRect:n}),!0}};var Qf=`
2025-01-17 17:55:47 -05:00
uniform mat3 uvTransform;
uniform mat3 positionTransform;
attribute vec2 position;
attribute vec2 uv;
varying vec2 vUv;
void main() {
vUv = (uvTransform * vec3(uv, 1)).xy;
gl_Position = vec4((positionTransform * vec3(position, 1)).xy, 0, 1);
}
2025-08-13 12:06:47 -04:00
`,wf=`
2025-01-17 17:55:47 -05:00
precision mediump float;
varying vec2 vUv;
uniform sampler2D texture;
void main() {
gl_FragColor = texture2D(texture, vUv);
}
2025-08-13 12:06:47 -04:00
`,pa=class{constructor(e){this.gl=e;let n=new z.VertexFormat;n.add("position",z.AttributeType.FLOAT,2),n.add("uv",z.AttributeType.FLOAT,2);let a=[{pos:[-1,1],uv:[0,1]},{pos:[1,1],uv:[1,1]},{pos:[-1,-1],uv:[0,0]},{pos:[1,-1],uv:[1,0]}],r=[];for(let o of a)r.push(o.pos[0]),r.push(o.pos[1]),r.push(o.uv[0]),r.push(o.uv[1]);this.buffer=e.createVertexBuffer(n.stride*a.length),this.buffer.upload(new Uint8Array(new Float32Array(r).buffer)),this.material=e.createMaterial(n,Qf,wf)}render(e){this.material.setUniformSampler("texture",e.texture,0),xt(this.material,"uvTransform",(()=>{let{srcRect:n,texture:a}=e,o=O.withTranslation(new v(0,1)).times(O.withScale(new v(1,-1))).times(O.betweenRects(new F(v.zero,new v(a.width,a.height)),F.unit)).transformRect(n);return O.betweenRects(F.unit,o)})()),xt(this.material,"positionTransform",(()=>{let{dstRect:n}=e,{viewport:a}=this.gl,r=new v(a.width,a.height),i=O.withScale(new v(1,-1)).times(O.betweenRects(new F(v.zero,r),F.NDC)).transformRect(n);return O.betweenRects(F.NDC,i)})()),this.gl.setUnpremultipliedBlendState(),this.gl.draw(z.Primitive.TRIANGLE_STRIP,this.material,this.buffer)}};var si=new z.VertexFormat;si.add("position",z.AttributeType.FLOAT,2);var bf=`
2025-01-17 17:55:47 -05:00
attribute vec2 position;
void main() {
gl_Position = vec4(position, 0, 1);
}
2025-08-13 12:06:47 -04:00
`,xf=t=>{let{r:e,g:n,b:a}=ue.fromCSSHex(t.fgSecondaryColor),r=`${e.toFixed(1)}, ${n.toFixed(1)}, ${a.toFixed(1)}`;return`
2025-01-17 17:55:47 -05:00
precision mediump float;
uniform mat3 configSpaceToPhysicalViewSpace;
uniform vec2 physicalSize;
uniform vec2 physicalOrigin;
uniform vec2 configSpaceViewportOrigin;
uniform vec2 configSpaceViewportSize;
uniform float framebufferHeight;
void main() {
vec2 origin = (configSpaceToPhysicalViewSpace * vec3(configSpaceViewportOrigin, 1.0)).xy;
vec2 size = (configSpaceToPhysicalViewSpace * vec3(configSpaceViewportSize, 0.0)).xy;
vec2 halfSize = physicalSize / 2.0;
float borderWidth = 2.0;
origin = floor(origin * halfSize) / halfSize + borderWidth * vec2(1.0, 1.0);
size = floor(size * halfSize) / halfSize - 2.0 * borderWidth * vec2(1.0, 1.0);
vec2 coord = gl_FragCoord.xy;
coord.x = coord.x - physicalOrigin.x;
coord.y = framebufferHeight - coord.y - physicalOrigin.y;
vec2 clamped = clamp(coord, origin, origin + size);
vec2 gap = clamped - coord;
float maxdist = max(abs(gap.x), abs(gap.y));
// TOOD(jlfwong): Could probably optimize this to use mix somehow.
if (maxdist == 0.0) {
// Inside viewport rectangle
gl_FragColor = vec4(0, 0, 0, 0);
} else if (maxdist < borderWidth) {
// Inside viewport rectangle at border
gl_FragColor = vec4(${r}, 0.8);
} else {
// Outside viewport rectangle
gl_FragColor = vec4(${r}, 0.5);
}
}
2025-08-13 12:06:47 -04:00
`},Ca=class{constructor(e,n){this.gl=e;let a=[[-1,1],[1,1],[-1,-1],[1,-1]],r=[];for(let o of a)r.push(o[0]),r.push(o[1]);this.buffer=e.createVertexBuffer(si.stride*a.length),this.buffer.upload(new Uint8Array(new Float32Array(r).buffer)),this.material=e.createMaterial(si,bf,xf(n))}render(e){xt(this.material,"configSpaceToPhysicalViewSpace",e.configSpaceToPhysicalViewSpace),Ai(this.material,"configSpaceViewportOrigin",e.configSpaceViewportRect.origin),Ai(this.material,"configSpaceViewportSize",e.configSpaceViewportRect.size);let n=this.gl.viewport;this.material.setUniformVec2("physicalOrigin",n.x,n.y),this.material.setUniformVec2("physicalSize",n.width,n.height),this.material.setUniformFloat("framebufferHeight",this.gl.renderTargetHeightInPixels),this.gl.setBlendState(z.BlendOperation.SOURCE_ALPHA,z.BlendOperation.INVERSE_SOURCE_ALPHA),this.gl.draw(z.Primitive.TRIANGLE_STRIP,this.material,this.buffer)}};var ma=new z.VertexFormat;ma.add("position",z.AttributeType.FLOAT,2);ma.add("uv",z.AttributeType.FLOAT,2);var Sf=`
2025-01-17 17:55:47 -05:00
uniform mat3 uvTransform;
uniform mat3 positionTransform;
attribute vec2 position;
attribute vec2 uv;
varying vec2 vUv;
void main() {
vUv = (uvTransform * vec3(uv, 1)).xy;
gl_Position = vec4((positionTransform * vec3(position, 1)).xy, 0, 1);
}
2025-08-13 12:06:47 -04:00
`,Nf=t=>`
2025-01-17 17:55:47 -05:00
precision mediump float;
uniform vec2 uvSpacePixelSize;
uniform float renderOutlines;
varying vec2 vUv;
uniform sampler2D colorTexture;
// https://en.wikipedia.org/wiki/HSL_and_HSV#From_luma/chroma/hue
vec3 hcl2rgb(float H, float C, float L) {
float hPrime = H / 60.0;
float X = C * (1.0 - abs(mod(hPrime, 2.0) - 1.0));
vec3 RGB =
hPrime < 1.0 ? vec3(C, X, 0) :
hPrime < 2.0 ? vec3(X, C, 0) :
hPrime < 3.0 ? vec3(0, C, X) :
hPrime < 4.0 ? vec3(0, X, C) :
hPrime < 5.0 ? vec3(X, 0, C) :
vec3(C, 0, X);
float m = L - dot(RGB, vec3(0.30, 0.59, 0.11));
return RGB + vec3(m, m, m);
}
float triangle(float x) {
return 2.0 * abs(fract(x) - 0.5) - 1.0;
}
${t}
void main() {
vec4 here = texture2D(colorTexture, vUv);
if (here.z == 0.0) {
// Background color
gl_FragColor = vec4(0, 0, 0, 0);
return;
}
// Sample the 4 surrounding pixels in the depth texture to determine
// if we should draw a boundary here or not.
vec4 N = texture2D(colorTexture, vUv + vec2(0, uvSpacePixelSize.y));
vec4 E = texture2D(colorTexture, vUv + vec2(uvSpacePixelSize.x, 0));
vec4 S = texture2D(colorTexture, vUv + vec2(0, -uvSpacePixelSize.y));
vec4 W = texture2D(colorTexture, vUv + vec2(-uvSpacePixelSize.x, 0));
// NOTE: For outline checks, we intentionally check both the right
// and the left to determine if we're an edge. If a rectangle is a single
// pixel wide, we don't want to render it as an outline, so this method
// of checking ensures that we don't outline single physical-space
// pixel width rectangles.
if (
renderOutlines > 0.0 &&
(
here.y == N.y && here.y != S.y || // Top edge
here.y == S.y && here.y != N.y || // Bottom edge
here.x == E.x && here.x != W.x || // Left edge
here.x == W.x && here.x != E.x
)
) {
// We're on an edge! Draw transparent.
gl_FragColor = vec4(0, 0, 0, 0);
} else {
// Not on an edge. Draw the appropriate color.
gl_FragColor = vec4(colorForBucket(here.z), here.a);
}
}
2025-08-13 12:06:47 -04:00
`,Ia=class{constructor(e,n){this.gl=e;let a=[{pos:[-1,1],uv:[0,1]},{pos:[1,1],uv:[1,1]},{pos:[-1,-1],uv:[0,0]},{pos:[1,-1],uv:[1,0]}],r=[];for(let o of a)r.push(o.pos[0]),r.push(o.pos[1]),r.push(o.uv[0]),r.push(o.uv[1]);this.buffer=e.createVertexBuffer(ma.stride*a.length),this.buffer.uploadFloats(r),this.material=e.createMaterial(ma,Sf,Nf(n.colorForBucketGLSL))}render(e){let{srcRect:n,rectInfoTexture:a}=e,o=O.withTranslation(new v(0,1)).times(O.withScale(new v(1,-1))).times(O.betweenRects(new F(v.zero,new v(a.width,a.height)),F.unit)).transformRect(n),i=O.betweenRects(F.unit,o),{dstRect:l}=e,s=new v(this.gl.viewport.width,this.gl.viewport.height),c=O.withScale(new v(1,-1)).times(O.betweenRects(new F(v.zero,s),F.NDC)).transformRect(l),h=O.betweenRects(F.NDC,c),_=v.unit.dividedByPointwise(new v(e.rectInfoTexture.width,e.rectInfoTexture.height));this.material.setUniformSampler("colorTexture",e.rectInfoTexture,0),xt(this.material,"uvTransform",i),this.material.setUniformFloat("renderOutlines",e.renderOutlines?1:0),this.material.setUniformVec2("uvSpacePixelSize",_.x,_.y),xt(this.material,"positionTransform",h),this.gl.setUnpremultipliedBlendState(),this.gl.draw(z.Primitive.TRIANGLE_STRIP,this.material,this.buffer)}};var ya=class{constructor(e,n){this.animationFrameRequest=null;this.beforeFrameHandlers=new Set;this.onBeforeFrame=()=>{this.animationFrameRequest=null,this.gl.setViewport(0,0,this.gl.renderTargetWidthInPixels,this.gl.renderTargetHeightInPixels);let e=ue.fromCSSHex(this.theme.bgPrimaryColor);this.gl.clear(new z.Color(e.r,e.g,e.b,e.a));for(let n of this.beforeFrameHandlers)n()};this.gl=new li.Context(e),this.rectangleBatchRenderer=new da(this.gl),this.textureRenderer=new pa(this.gl),this.viewportRectangleRenderer=new Ca(this.gl,n),this.flamechartColorPassRenderer=new Ia(this.gl,n),this.theme=n,this.gl.addAfterResizeEventHandler(this.onBeforeFrame);let a=this.gl.getWebGLInfo();a&&console.log(`WebGL initialized. renderer: ${a.renderer}, vendor: ${a.vendor}, version: ${a.version}`),window.testContextLoss=()=>{this.gl.testContextLoss()}}addBeforeFrameHandler(e){this.beforeFrameHandlers.add(e)}removeBeforeFrameHandler(e){this.beforeFrameHandlers.delete(e)}requestFrame(){this.animationFrameRequest||(this.animationFrameRequest=requestAnimationFrame(this.onBeforeFrame))}setViewport(e,n){let{origin:a,size:r}=e,o=this.gl.viewport;this.gl.setViewport(a.x,a.y,r.x,r.y),n();let{x:i,y:l,width:s,height:A}=o;this.gl.setViewport(i,l,s,A)}renderBehind(e,n){let a=e.getBoundingClientRect(),r=new F(new v(a.left*window.devicePixelRatio,a.top*window.devicePixelRatio),new v(a.width*window.devicePixelRatio,a.height*window.devicePixelRatio));this.setViewport(r,n)}};var on=Un(t=>e=>t.get(e.key)||0),Kt=Ge(({theme:t,frameToColorBucket:e})=>{let n=on(e);return a=>{let r=n(a)/255;return t.colorForBucket(r).toCSS()}}),Pt=Ge(({theme:t,canvas:e})=>new ya(e,t)),VA=Un(t=>new fa(t.gl,t.rectangleBatchRenderer,t.textureRenderer)),YA=Ge(({profile:t,flattenRecursion:e})=>e?t.getProfileWithRecursionFlattened():t),Ot=Un(t=>{let e=[];t.forEachFrame(o=>e.push(o));function n(o){return(o.file||"")+o.name}function a(o,i){return n(o)>n(i)?1:-1}e.sort(a);let r=new Map;for(let o=0;o<e.length;o++)r.set(e[o].key,Math.floor(255*o/e.length));return r});var Kn,it,WA,yr=0,ci=[],qA=U.__r,$A=U.diffed,ZA=U.__c,XA=U.unmount;function vr(t,e){U.__h&&U.__h(it,t,yr||e),yr=0;var n=it.__H||(it.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function Ke(t){return yr=1,es(ts,t)}function es(t,e,n){var a=vr(Kn++,2);return a.__c||(a.__c=it,a.__=[n?n(e):ts(void 0,e),function(r){var o=t(a.__[0],r);a.__[0]!==o&&(a.__[0]=o,a.__c.setState({}))}]),a.__}function Xe(t,e){var n=vr(Kn++,3);!U.__s&&di(n.__H,e)&&(n.__=t,n.__H=e,it.__H.__h.push(n))}function gi(t,e){var n=vr(Kn++,4);!U.__s&&di(n.__H,e)&&(n.__=t,n.__H=e,it.__h.push(n))}function ln(t){return yr=5,re(function(){return{current:t}},[])}function re(t,e){var n=vr(Kn++,7);return di(n.__H,e)?(n.__H=e,n.__h=t,n.__=t()):n.__}function K(t,e){return yr=8,re(function(){return t},e)}function lt(t){var e=it.context[t.__c],n=vr(Kn++,
2025-01-17 17:55:47 -05:00
vec3 colorForBucket(float t) {
float x = triangle(30.0 * t);
float H = 360.0 * (0.9 * t);
2025-08-13 12:06:47 -04:00
float C = ${fs.toFixed(1)} + ${ps.toFixed(1)} * x;
float L = ${Cs.toFixed(1)} - ${ms.toFixed(1)} * x;
2025-01-17 17:55:47 -05:00
return hcl2rgb(H, C, L);
}
2025-08-13 12:06:47 -04:00
`,vi={fgPrimaryColor:"#D0D0D0",fgSecondaryColor:"#666666",bgPrimaryColor:"#060606",bgSecondaryColor:"#0C0C0C",altFgPrimaryColor:"#D0D0D0",altFgSecondaryColor:"#666666",altBgPrimaryColor:"#000000",altBgSecondaryColor:"#0C0C0C",selectionPrimaryColor:"#00769B",selectionSecondaryColor:"#004E75",weightColor:"#0F8A42",searchMatchTextColor:"#0C0C0C",searchMatchPrimaryColor:"#A66F1C",searchMatchSecondaryColor:"#D6AE24",colorForBucket:Uf,colorForBucketGLSL:Kf};W();var Is=.25,ys=.2,vs=.8,Es=.15,Pf=t=>{let e=ca(30*t),n=360*(.9*t),a=Is+ys*e,r=vs-Es*e;return ue.fromLumaChromaHue(r,a,n)},Of=`
2025-01-17 17:55:47 -05:00
vec3 colorForBucket(float t) {
float x = triangle(30.0 * t);
float H = 360.0 * (0.9 * t);
2025-08-13 12:06:47 -04:00
float C = ${Is.toFixed(1)} + ${ys.toFixed(1)} * x;
float L = ${vs.toFixed(1)} - ${Es.toFixed(1)} * x;
2025-01-17 17:55:47 -05:00
return hcl2rgb(H, C, L);
}
2025-08-13 12:06:47 -04:00
`,ba={fgPrimaryColor:"#000000",fgSecondaryColor:"#BDBDBD",bgPrimaryColor:"#FFFFFF",bgSecondaryColor:"#F6F6F6",altFgPrimaryColor:"#FFFFFF",altFgSecondaryColor:"#BDBDBD",altBgPrimaryColor:"#000000",altBgSecondaryColor:"#222222",selectionPrimaryColor:"#2F80ED",selectionSecondaryColor:"#8EB7ED",weightColor:"#6FCF97",searchMatchTextColor:"#000000",searchMatchPrimaryColor:"#FFAC02",searchMatchSecondaryColor:"#FEDC62",colorForBucket:Pf,colorForBucketGLSL:Of};var js=Qt(ba);function V(){return lt(js)}function pe(t){return Un(t)}function Bs(){return matchMedia("(prefers-color-scheme: dark)")}function Qs(t){switch(t){case 0:return"System";case 1:return"Dark";case 2:return"Light"}}function Gf(t,e){switch(t){case 0:return e?vi:ba;case 1:return vi;case 2:return ba}}function ws(t){let[e,n]=Ke(()=>Bs().matches),a=K(i=>{n(i.matches)},[n]);Xe(()=>{let i=Bs();return i.addEventListener("change",a),()=>{i.removeEventListener("change",a)}},[a]);let r=q(yn),o=Gf(r,e);return C(js.Provider,{value:o,children:t.children})}var Lc=_e(Ss()),Tc=_e(ks()),Hc=_e(Rs()),Mc=_e(Ls()),Jc=_e(Ms()),Uc=_e(Ks()),Kc=_e(Gs()),Pc=_e(Vs()),Oc=_e(Ws()),Gc=_e($s()),zc=_e(Xs()),Vc=_e(lc()),Yc=_e(sc()),Wc=_e(yc()),qc=_e(kc()),L=["Webkit"],xi=["Moz"],he=["ms"],He=["Webkit","Moz"],we=["Webkit","ms"],Br=["Webkit","Moz","ms"],fC={plugins:[Lc.default,Tc.default,Hc.default,Mc.default,Jc.default,Uc.default,Kc.default,Pc.default,Oc.default,Gc.default,zc.default,Vc.default],prefixMap:{transform:we,transformOrigin:we,transformOriginX:we,transformOriginY:we,backfaceVisibility:L,perspective:L,perspectiveOrigin:L,transformStyle:L,transformOriginZ:L,animation:L,animationDelay:L,animationDirection:L,animationFillMode:L,animationDuration:L,animationIterationCount:L,animationName:L,animationPlayState:L,animationTimingFunction:L,appearance:He,userSelect:Br,fontKerning:L,textEmphasisPosition:L,textEmphasis:L,textEmphasisStyle:L,textEmphasisColor:L,boxDecorationBreak:L,clipPath:L,maskImage:L,maskMode:L,maskRepeat:L,maskPosition:L,maskClip:L,maskOrigin:L,maskSize:L,maskComposite:L,mask:L,maskBorderSource:L,maskBorderMode:L,maskBorderSlice:L,maskBorderWidth:L,maskBorderOutset:L,maskBorderRepeat:L,maskBorder:L,maskType:L,textDecorationStyle:He,textDecorationSkip:He,textDecorationLine:He,textDecorationColor:He,filter:L,fontFeatureSettings:He,breakAfter:Br,breakBefore:Br,breakInside:Br,columnCount:He,columnFill:He,columnGap:He,columnRule:He,columnRuleColor:He,columnRuleStyle:He,columnRuleWidth:He,columns:He,columnSpan:He,columnWidth:He,writingMode:we,flex:we,flexBasis:L,flexDirection:we,flexGrow:L,flexFlow:we,flexShrink:L,flexWrap:we,alignContent:L,alignItems:L,alignSelf:L,justifyContent:L,order:L,transitionDelay:L,transitionDuration:L,transitionProperty:L,transitionTimingFunction:L,backdropFilter:L,scrollSnapType:we,scrollSnapPointsX:we,scrollSnapPointsY:we,scrollSnapDestination:we,scrollSnapCoordinate:we,shapeImageThreshold:L,shapeImageMargin:L,shapeImageOutside:L,hyphens:Br,flowInto:we,flowFrom:we,regionFragment:we,boxSizing:xi,textAlignLast:xi,tabSize:xi,wrapFlow:he,wrapThrough:he,wrapMargin:he,touchAction:he,gridTemplateColumns:he,gridTemplateRows:he,gridTemplateAreas:he,gridTemplate:he,gridAutoColumns:he,gridAutoRows:he,gridAutoFlow:he,grid:he,gridRowStart:he,gridColumnStart:he,gridRowEnd:he,gridRow:he,gridColumn:he,gridColumnEnd:he,gridColumnGap:he,gridRowGap:he,gridArea:he,gridGap:he,textSizeAdjust:we,borderImage:L,borderImageOutset:L,borderImageRepeat:L,borderImageSlice:L,borderImageSource:L,borderImageWidth:L}},pC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},CC=function(){function t(e,n){for(var a=0;a<n.length;a++){var r=n[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(e,n,a){return n&&t(e.prototype,n),a&&t(e,a),e}}();function mC(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Dc=typeof Map<"u",Si=function(){fu
`);if(!e.length||(e[e.length-1]===""&&e.pop(),!e.length))return null;let n=new Map,a=/^(\d+):(.+)$/,r=/^([\$\w]+):([\$\w-]+)$/;for(let o of e){let i=a.exec(o);if(i){n.set(`wasm-function[${i[1]}]`,o_(i[2]));continue}let l=r.exec(o);if(l){n.set(l[1],o_(l[2]));continue}return null}return o=>n.has(o.name)?{name:n.get(o.name)}:null}Hi();W();var Wt=class{constructor(e){this.source=e;this.layers=[];this.totalWeight=0;this.minFrameWidth=1;let n=[],a=(o,i)=>{let l=ne(n),s={node:o,parent:l,children:[],start:i,end:i};l&&l.children.push(s),n.push(s)};this.minFrameWidth=1/0;let r=(o,i)=>{console.assert(n.length>0);let l=n.pop();if(l.end=i,l.end-l.start===0)return;let s=n.length;for(;this.layers.length<=s;)this.layers.push([]);this.layers[s].push(l),this.minFrameWidth=Math.min(this.minFrameWidth,l.end-l.start)};this.totalWeight=e.getTotalWeight(),e.forEachCall(a,r),isFinite(this.minFrameWidth)||(this.minFrameWidth=1)}getTotalWeight(){return this.totalWeight}getLayers(){return this.layers}getColorBucketForFrame(e){return this.source.getColorBucketForFrame(e)}getMinFrameWidth(){return this.minFrameWidth}formatValue(e){return this.source.formatValue(e)}getClampedViewportWidth(e){let n=this.getTotalWeight(),a=Math.pow(2,40),r=ke(3*this.getMinFrameWidth(),n/a,n);return ke(e,r,n)}getClampedConfigSpaceViewportRect({configSpaceViewportRect:e,renderInverted:n}){let a=new v(this.getTotalWeight(),this.getLayers().length),r=this.getClampedViewportWidth(e.size.x),o=e.size.withX(r),i=v.clamp(e.origin,new v(0,n?0:-1),v.max(v.zero,a.minus(o).plus(new v(0,1))));return new F(i,e.size.withX(r))}};W();var am=1e4,oo=class{constructor(e,n,a){this.batch=e;this.bounds=n;this.numPrecedingRectanglesInRow=a;this.children=[]}getBatch(){return this.batch}getBounds(){return this.bounds}getRectCount(){return this.batch.getRectCount()}getChildren(){return this.children}getParity(){return this.numPrecedingRectanglesInRow%2}forEachLeafNodeWithinBounds(e,n){this.bounds.hasIntersectionWith(e)&&n(this)}},Mi=class{constructor(e){this.children=e;this.rectCount=0;if(e.length===0)throw new Error("Empty interior node");let n=1/0,a=-1/0,r=1/0,o=-1/0;for(let i of e){this.rectCount+=i.getRectCount();let l=i.getBounds();n=Math.min(n,l.left()),a=Math.max(a,l.right()),r=Math.min(r,l.top()),o=Math.max(o,l.bottom())}this.bounds=new F(new v(n,r),new v(a-n,o-r))}getBounds(){return this.bounds}getRectCount(){return this.rectCount}getChildren(){return this.children}forEachLeafNodeWithinBounds(e,n){if(this.bounds.hasIntersectionWith(e))for(let a of this.children)a.forEachLeafNodeWithinBounds(e,n)}},io=class t{get key(){return`${this.stackDepth}_${this.index}_${this.zoomLevel}`}constructor(e){this.stackDepth=e.stackDepth,this.zoomLevel=e.zoomLevel,this.index=e.index}static getOrInsert(e,n){return e.getOrInsert(new t(n))}},lo=class{constructor(e,n,a,r,o,i={inverted:!1}){this.gl=e;this.rowAtlas=n;this.flamechart=a;this.rectangleBatchRenderer=r;this.colorPassRenderer=o;this.options=i;this.layers=[];this.rectInfoTexture=null;this.rectInfoRenderTarget=null;this.atlasKeys=new wt;let l=a.getLayers().length;for(let s=0;s<l;s++){let A=[],c=i.inverted?l-1-s:s,h=1/0,_=-1/0,f=new mn(this.gl),m=0,u=a.getLayers()[s];for(let g=0;g<u.length;g++){let p=u[g];f.getRectCount()>=am&&(A.push(new oo(f,new F(new v(h,c),new v(_-h,1)),m)),h=1/0,_=-1/0,f=new mn(this.gl));let I=new F(new v(p.start,c),new v(p.end-p.start,1));h=Math.min(h,I.left()),_=Math.max(_,I.right());let y=new ue((1+g%255)/256,(1+s%255)/256,(1+this.flamechart.getColorBucketForFrame(p.node.frame))/256);f.addRect(I,y),m++}f.getRectCount()>0&&A.push(new oo(f,new F(new v(h,c),new v(_-h,1)),m)),this.layers.push(new Mi(A))}}getRectInfoTexture(e,n){if(this.rectInfoTexture){let a=this.rectInfoTexture;(a.width!=e||a.height!=n)&&a.resize(e,n)}else this.rectInfoTexture=this.gl.createTexture(z.TextureFormat.NEAREST_CLAMP,e,n);return this.rectInfoTexture}getRectInfoRenderTarget(e,n){let a=this.getRectInfoTexture(e,n);return this.rectInfoRenderTarget&&this.rectInfoRenderTarget.texture!=a&&(this.rectInfoRenderTarget.texture.free(),this.rectInfoRenderTarget.setC
`)[c.originalLine-1];if(m){let u=/\w+/.exec(m.substr(c.originalColumn-1));u&&(h.name=u[0])}}}switch(h.name){case"constructor":{h.name=l.name+" constructor";break}case"function":{h.name=l.name;break}case"const":case"export":{h.name=l.name;break}}return h.name&&l.name.includes(h.name)&&(h.name=l.name),c.source!=null&&(h.file=c.source,h.line=c.originalLine,h.col=c.originalColumn),$m&&(console.groupCollapsed(`Remapping "${l.name}" -> "${h.name}"`),console.log("before",{...l}),console.log("item @ index",c),console.log("item @ index + 1",o[A+1]),console.log("after",h),console.groupEnd()),h}}W();var oh=({items:t,axis:e,renderItems:n,className:a,initialIndexInView:r})=>{let[o,i]=Ke(null),[l,s]=Ke(0),A=ln(null),c=e==="x"?"width":"height",h=e==="x"?"left":"top",_=e==="x"?"scrollLeft":"scrollTop",f=r?t.reduce((E,b,D)=>D<r?E+b.size:E,0):0,m=ln(f),u=K(E=>{E?requestAnimationFrame(()=>{i(E.getBoundingClientRect()[c]),m.current!=null&&(E.scrollTo({[h]:m.current}),m.current=null)}):i(null),A.current=E},[i,c,h]),g=re(()=>{if(A.current==null||o==null||l==null)return null;let E=l-o/4,b=l+o+o/4,D=0,T=0,Q=0;for(;Q<t.length;Q++){let te=t[Q];if(T=D,D+=te.size,D>=E)break}let w=Q;for(;Q<t.length;Q++){let te=t[Q];if(D+=te.size,D>=b)break}let N=Math.min(Q,t.length-1);return{firstVisibleIndex:w,lastVisibleIndex:N,invisiblePrefixSize:T}},[o,l,t]),p=re(()=>t.reduce((E,b)=>E+b.size,0),[t]),I=K(()=>{A.current!=null&&s(A.current[_])},[_]);Xe(()=>{let E=()=>{A.current!=null&&i(A.current.getBoundingClientRect()[c])};return window.addEventListener("resize",E),()=>{window.removeEventListener("resize",E)}},[c]);let y=re(()=>g?n(g.firstVisibleIndex,g.lastVisibleIndex):null,[n,g]),B=re(()=>C("div",{style:{height:p}},C("div",{style:{transform:`translateY(${g?.invisiblePrefixSize||0}px)`}},y)),[g,y,p]);return C("div",{className:a,ref:u,onScroll:I},B)};function ih(t){let e=yo(V());return C("div",{className:j(e.hBarDisplay)},C("div",{className:j(e.hBarDisplayFilled),style:{width:`${t.perc}%`}}))}function _l(t){let e=V(),n=yo(e),{activeDirection:a}=t,r=a===0?e.fgPrimaryColor:e.fgSecondaryColor,o=a===1?e.fgPrimaryColor:e.fgSecondaryColor;return C("svg",{width:"8",height:"10",viewBox:"0 0 8 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:j(n.sortIcon)},C("path",{d:"M0 4L4 0L8 4H0Z",fill:r}),C("path",{d:"M0 4L4 0L8 4H0Z",transform:"translate(0 10) scale(1 -1)",fill:o}))}function eI(t,e,n){let a=[],r=0;for(let o of e)a.push(t.slice(r,o[0])),a.push(C("span",{className:n},t.slice(o[0],o[1]))),r=o[1];return a.push(t.slice(r)),C("span",null,a)}var tI=({frame:t,matchedRanges:e,profile:n,index:a,selectedFrame:r,setSelectedFrame:o,getCSSColorForFrame:i})=>{let l=yo(V()),s=t.getTotalWeight(),A=t.getSelfWeight(),c=100*s/n.getTotalNonIdleWeight(),h=100*A/n.getTotalNonIdleWeight(),_=t===r;return C("tr",{key:`${a}`,onClick:o.bind(null,t),className:j(l.tableRow,a%2==0&&l.tableRowEven,_&&l.tableRowSelected)},C("td",{className:j(l.numericCell)},n.formatValue(s)," (",bt(c),")",C(ih,{perc:c})),C("td",{className:j(l.numericCell)},n.formatValue(A)," (",bt(h),")",C(ih,{perc:h})),C("td",{title:t.file,className:j(l.textCell)},C(_o,{color:i(t)}),e?eI(t.name,e,j(l.matched,_&&l.matchedSelected)):t.name))},nI=fe(({profile:t,sortMethod:e,setSortMethod:n,selectedFrame:a,setSelectedFrame:r,getCSSColorForFrame:o,searchQuery:i,searchIsActive:l})=>{let s=yo(V()),A=K((g,p)=>{if(p.preventDefault(),e.field==g)n({field:g,direction:e.direction===0?1:0});else switch(g){case 0:{n({field:g,direction:0});break}case 1:{n({field:g,direction:1});break}case 2:{n({field:g,direction:1});break}}},[e,n]),c=lt(kr),h=K((g,p)=>{if(!c)return null;let I=[];for(let y=g;y<=p;y++){let B=c.rowList[y],E=c.getSearchMatchForFrame(B);I.push(tI({frame:B,matchedRanges:E??null,index:y,profile:t,selectedFrame:a,setSelectedFrame:r,getCSSColorForFrame:o}))}return I.length===0&&(l?I.push(C("tr",null,C("td",{className:j(s.emptyState)},'No symbol names match query "',i,'".'))):I.push(C("tr",null,C("td",{className:j(s.emptyState)},"No symbols found.")))),C("table",{className:j(s.tableView)},I)},[c,t,a,r,o,l,i,s.emptyState,s.ta
//# sourceMappingURL=speedscope-HCR63FMT.js.map