190 lines
466 KiB
JavaScript
190 lines
466 KiB
JavaScript
|
"use strict";(()=>{var nf=Object.create;var Zo=Object.defineProperty;var rf=Object.getOwnPropertyDescriptor;var af=Object.getOwnPropertyNames;var of=Object.getPrototypeOf,lf=Object.prototype.hasOwnProperty;var ie=(t,e)=>()=>(t&&(e=t(t=0)),e);var x=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),wA=(t,e)=>{for(var n in e)Zo(t,n,{get:e[n],enumerable:!0})},Af=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of af(e))!lf.call(t,r)&&r!==n&&Zo(t,r,{get:()=>e[r],enumerable:!(a=rf(e,r))||a.enumerable});return t};var _e=(t,e,n)=>(n=t!=null?nf(of(t)):{},Af(e||!t||!t.__esModule?Zo(n,"default",{value:t,enumerable:!0}):n,t));function te(t){return t[t.length-1]||null}function Ue(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 xe(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*MA(t,e){for(let n of t)yield e(n)}function JA(t,e){for(let n of t)e(n)}function rn(t,e){return new Array(Math.max(e-t.length,0)+1).join("0")+t}function jt(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 uf(t){return t-Math.floor(t)}function ca(t){return 2*Math.abs(uf(t)-.5)-1}function UA(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 KA(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 Oe(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 ff(t){let e=null;return()=>(e==null&&(e={result:t()}),e.result)}function PA(t){let e=pf();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),_=e.get(l),h=e.get(s),f=e.get(A),I=e.get(c);if(_==null||h==null||f==null||I==null)throw new Error(`Invalid quartet at indices ${i*4} .. ${i*4+3}: ${t.substring(i*4,i*4+3)}`);r[o++]=_<<2|h>>4,A!=="="&&(r[o++]=(h&15)<<4|f>>2),c!=="="&&(r[o++]=(f&7)<<6|I)}if(o!==a)throw new Error(`Expected to decode ${a} bytes, but only decoded ${o})`);return r}var Bt,pf,W=ie(()=>{"use strict";Bt=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()}};pf=ff(()=>{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=x((xa,js)=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});xa.default=Of;var Pf=/-webkit-|-moz-|-ms-/;function Of(t){return typeof t=="string"&&Pf.test(t)}js.exports=xa.default});var ws=x((Sa,Qs)=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});Sa.default=Wf;var Gf=vn(),zf=Vf(Gf);function Vf(t){return t&&t.__esModule?t:{default:t}}var Yf=["-webkit-","-moz-",""];function Wf(t,e){if(typeof e=="string"&&!(0,zf.default)(e)&&e.indexOf("calc(")>-1)return Yf.map(function(n){return e.replace(/calc\(/g,n+"calc(")})}Qs.exports=Sa.default});var xs=x((Na,bs)=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});Na.default=ep;var qf=vn(),$f=Zf(qf);function Zf(t){return t&&t.__esModule?t:{default:t}}var Xf=["-webkit-",""];function ep(t,e){if(typeof e=="string"&&!(0,$f.default)(e)&&e.indexOf("cross-fade(")>-1)return Xf.map(function(n)
|
||
|
`;break;case 114:f+="\r";break;case 116:f+=" ";break;case 117:{for(var u=0,g=0;g<4;g++)h=a[_++],u<<=4,h>=48&&h<=57?u|=h-48:h>=97&&h<=102?u|=h+-87:h>=65&&h<=70?u|=h+-55:n(a,--_);f+=e(u);break}default:n(a,--_);break}else if(h<=127)f+=e(h);else if((h&224)===192)f+=e((h&31)<<6|a[_++]&63);else if((h&240)===224)f+=e((h&15)<<12|(a[_++]&63)<<6|a[_++]&63);else if((h&248)==240){var p=(h&7)<<18|(a[_++]&63)<<12|(a[_++]&63)<<6|a[_++]&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,--_),f=c,s=r.pop(),c=o.pop(),A=i.pop();break}case 125:{A!==2&&n(a,--_),f=c,s=r.pop(),c=o.pop(),A=i.pop();break}default:n(a,--_)}for(h=a[_];h<=32;)h=a[++_];switch(A){case 0:{if(_===l)return f;break}case 1:{if(c.push(f),h===44){_++;continue}if(h===93)continue;break}case 2:{if(s===null){if(s=f,h===58){_++;continue}}else{if(c[s]=f,s=null,h===44){_++;continue}if(h===125)continue}break}}break}}n(a,_)}})(Mo)});function Ad(t){return t=t.trim(),t[0]==="["&&(t=t.replace(/,\s*$/,""),t[t.length-1]!=="]"&&(t+="]")),JSON.parse(t)}function av(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,ld.JSON_parse)(t)}var id,ld,Jo,Vl,Yl,Uo,en,Wl=ie(()=>{"use strict";id=_e(ad()),ld=_e(od()),Jo=1<<27;Vl=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?Ad(this.chunks[0]):av(this.byteArray)}},Yl=class{constructor(e){this.s=e}splitLines(){return this.s.split(`
|
||
|
`)}firstChunk(){return this.s}parseAsJSON(){return Ad(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 Yl(this.contents)}},en=class t{constructor(e,n){this.namePromise=e;this.uncompressedData=n.then(async a=>{try{return id.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 Vl(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 ov(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 iv(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 Zl(t){let e=new me,n=ov(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 h=a.pop();c.push(h)}for(let h of c)r=Math.max(r,h.endValue),e.leaveFrame(h,r);let _={key:`${i["Source Path"]||""}:${s}`,name:s,file:i["Source Path"],endValue:r+iv(i)};e.enterFrame(_,r),a.push(_)}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 cd(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 cd(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 en.fromFile(t).readAsArrayBuffer()}function lv(t){return en.fromFile(t).readAsText()}function Av(t,e){let n=Ze(t.subdirectories,"corespace"),a=Ze(n.subdirectories,`run${e}`);return Ze(a.subdirectories,"core")}async function sv(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 lv(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 _=o.readUint32();s.push({timestamp:A,threadID:c,backtraceID:_})}return s}throw new Error("Could not find sample list")}async function cv(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(
|
||
|
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);
|
||
|
}
|
||
|
`,vf=`
|
||
|
precision mediump float;
|
||
|
varying vec3 vColor;
|
||
|
|
||
|
void main() {
|
||
|
gl_FragColor = vec4(vColor.rgb, 1);
|
||
|
}
|
||
|
`,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,yf,vf)}render(e){Qt(this.material,"configSpaceToNDC",(()=>{let n=O.betweenRects(e.configSpaceSrcRect,e.physicalSpaceDstRect),a=new B(this.gl.viewport.width,this.gl.viewport.height);return O.withTranslation(new B(-1,1)).times(O.withScale(new B(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(Se(i+A,0,1),Se(l+A,0,1),Se(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(R.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 R(new B(0,r),new B(this.texture.width,1));this.rectangleBatchRenderer.render({batch:this.clearLineBatch,configSpaceSrcRect:R.unit,physicalSpaceDstRect:o}),n(o,a)}})}renderViaAtlas(e,n){let a=this.rowCache.get(e);if(a==null)return!1;let r=new R(new B(0,a),new B(this.texture.width,1));return this.textureRenderer.render({texture:this.texture,srcRect:r,dstRect:n}),!0}};var Ef=`
|
||
|
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);
|
||
|
}
|
||
|
`,Bf=`
|
||
|
precision mediump float;
|
||
|
|
||
|
varying vec2 vUv;
|
||
|
uniform sampler2D texture;
|
||
|
|
||
|
void main() {
|
||
|
gl_FragColor = texture2D(texture, vUv);
|
||
|
}
|
||
|
`,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,Ef,Bf)}render(e){this.material.setUniformSampler("texture",e.texture,0),Qt(this.material,"uvTransform",(()=>{let{srcRect:n,texture:a}=e,o=O.withTranslation(new B(0,1)).times(O.withScale(new B(1,-1))).times(O.betweenRects(new R(B.zero,new B(a.width,a.height)),R.unit)).transformRect(n);return O.betweenRects(R.unit,o)})()),Qt(this.material,"positionTransform",(()=>{let{dstRect:n}=e,{viewport:a}=this.gl,r=new B(a.width,a.height),i=O.withScale(new B(1,-1)).times(O.betweenRects(new R(B.zero,r),R.NDC)).transformRect(n);return O.betweenRects(R.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 jf=`
|
||
|
attribute vec2 position;
|
||
|
|
||
|
void main() {
|
||
|
gl_Position = vec4(position, 0, 1);
|
||
|
}
|
||
|
`,Qf=t=>{let{r:e,g:n,b:a}=ue.fromCSSHex(t.fgSecondaryColor),r=`${e.toFixed(1)}, ${n.toFixed(1)}, ${a.toFixed(1)}`;return`
|
||
|
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);
|
||
|
}
|
||
|
}
|
||
|
`},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,jf,Qf(n))}render(e){Qt(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 wf=`
|
||
|
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);
|
||
|
}
|
||
|
`,bf=t=>`
|
||
|
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);
|
||
|
}
|
||
|
}
|
||
|
`,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,wf,bf(n.colorForBucketGLSL))}render(e){let{srcRect:n,rectInfoTexture:a}=e,o=O.withTranslation(new B(0,1)).times(O.withScale(new B(1,-1))).times(O.betweenRects(new R(B.zero,new B(a.width,a.height)),R.unit)).transformRect(n),i=O.betweenRects(R.unit,o),{dstRect:l}=e,s=new B(this.gl.viewport.width,this.gl.viewport.height),c=O.withScale(new B(1,-1)).times(O.betweenRects(new R(B.zero,s),R.NDC)).transformRect(l),_=O.betweenRects(R.NDC,c),h=B.unit.dividedByPointwise(new B(e.rectInfoTexture.width,e.rectInfoTexture.height));this.material.setUniformSampler("colorTexture",e.rectInfoTexture,0),Qt(this.material,"uvTransform",i),this.material.setUniformFloat("renderOutlines",e.renderOutlines?1:0),this.material.setUniformVec2("uvSpacePixelSize",h.x,h.y),Qt(this.material,"positionTransform",_),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 R(new B(a.left*window.devicePixelRatio,a.top*window.devicePixelRatio),new B(a.width*window.devicePixelRatio,a.height*window.devicePixelRatio));this.setViewport(r,n)}};var an=Un(t=>e=>t.get(e.key)||0),Mt=Oe(({theme:t,frameToColorBucket:e})=>{let n=an(e);return a=>{let r=n(a)/255;return t.colorForBucket(r).toCSS()}}),Jt=Oe(({theme:t,canvas:e})=>new ya(e,t)),OA=Un(t=>new fa(t.gl,t.rectangleBatchRenderer,t.textureRenderer)),GA=Oe(({profile:t,flattenRecursion:e})=>e?t.getProfileWithRecursionFlattened():t),Ut=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,at,zA,yr=0,ci=[],VA=U.__r,YA=U.diffed,WA=U.__c,qA=U.unmount;function vr(t,e){U.__h&&U.__h(at,t,yr||e),yr=0;var n=at.__H||(at.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function Ge(t){return yr=1,$A(ZA,t)}function $A(t,e,n){var a=vr(Kn++,2);return a.__c||(a.__c=at,a.__=[n?n(e):ZA(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,at.__H.__h.push(n))}function gi(t,e){var n=vr(Kn++,4);!U.__s&&di(n.__H,e)&&(n.__=t,n.__H=e,at.__h.push(n))}function on(t){return yr=5,ne(function(){return{current:t}},[])}function ne(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,ne(function(){return t},e)}function ot(t){var e=at.context[t.__c],n=vr(Kn++,
|
||
|
vec3 colorForBucket(float t) {
|
||
|
float x = triangle(30.0 * t);
|
||
|
float H = 360.0 * (0.9 * t);
|
||
|
float C = ${gs.toFixed(1)} + ${ds.toFixed(1)} * x;
|
||
|
float L = ${us.toFixed(1)} - ${fs.toFixed(1)} * x;
|
||
|
return hcl2rgb(H, C, L);
|
||
|
}
|
||
|
`,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:Hf,colorForBucketGLSL:Mf};W();var ps=.25,Cs=.2,ms=.8,Is=.15,Jf=t=>{let e=ca(30*t),n=360*(.9*t),a=ps+Cs*e,r=ms-Is*e;return ue.fromLumaChromaHue(r,a,n)},Uf=`
|
||
|
vec3 colorForBucket(float t) {
|
||
|
float x = triangle(30.0 * t);
|
||
|
float H = 360.0 * (0.9 * t);
|
||
|
float C = ${ps.toFixed(1)} + ${Cs.toFixed(1)} * x;
|
||
|
float L = ${ms.toFixed(1)} - ${Is.toFixed(1)} * x;
|
||
|
return hcl2rgb(H, C, L);
|
||
|
}
|
||
|
`,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:Jf,colorForBucketGLSL:Uf};var vs=Et(ba);function V(){return ot(vs)}function pe(t){return Un(t)}function ys(){return matchMedia("(prefers-color-scheme: dark)")}function Es(t){switch(t){case 0:return"System";case 1:return"Dark";case 2:return"Light"}}function Kf(t,e){switch(t){case 0:return e?vi:ba;case 1:return vi;case 2:return ba}}function Bs(t){let[e,n]=Ge(()=>ys().matches),a=K(i=>{n(i.matches)},[n]);Xe(()=>{let i=ys();return i.addEventListener("change",a),()=>{i.removeEventListener("change",a)}},[a]);let r=q(yn),o=Kf(r,e);return m(vs.Provider,{value:o,children:t.children})}var Dc=_e(ws()),Rc=_e(xs()),Fc=_e(Ns()),Lc=_e(Ds()),Tc=_e(Ls()),Hc=_e(Ms()),Mc=_e(Ks()),Jc=_e(Os()),Uc=_e(zs()),Kc=_e(Ys()),Pc=_e(qs()),Oc=_e(ac()),Gc=_e(ic()),zc=_e(Cc()),Vc=_e(xc()),F=["Webkit"],xi=["Moz"],he=["ms"],Le=["Webkit","Moz"],Qe=["Webkit","ms"],Br=["Webkit","Moz","ms"],gC={plugins:[Dc.default,Rc.default,Fc.default,Lc.default,Tc.default,Hc.default,Mc.default,Jc.default,Uc.default,Kc.default,Pc.default,Oc.default],prefixMap:{transform:Qe,transformOrigin:Qe,transformOriginX:Qe,transformOriginY:Qe,backfaceVisibility:F,perspective:F,perspectiveOrigin:F,transformStyle:F,transformOriginZ:F,animation:F,animationDelay:F,animationDirection:F,animationFillMode:F,animationDuration:F,animationIterationCount:F,animationName:F,animationPlayState:F,animationTimingFunction:F,appearance:Le,userSelect:Br,fontKerning:F,textEmphasisPosition:F,textEmphasis:F,textEmphasisStyle:F,textEmphasisColor:F,boxDecorationBreak:F,clipPath:F,maskImage:F,maskMode:F,maskRepeat:F,maskPosition:F,maskClip:F,maskOrigin:F,maskSize:F,maskComposite:F,mask:F,maskBorderSource:F,maskBorderMode:F,maskBorderSlice:F,maskBorderWidth:F,maskBorderOutset:F,maskBorderRepeat:F,maskBorder:F,maskType:F,textDecorationStyle:Le,textDecorationSkip:Le,textDecorationLine:Le,textDecorationColor:Le,filter:F,fontFeatureSettings:Le,breakAfter:Br,breakBefore:Br,breakInside:Br,columnCount:Le,columnFill:Le,columnGap:Le,columnRule:Le,columnRuleColor:Le,columnRuleStyle:Le,columnRuleWidth:Le,columns:Le,columnSpan:Le,columnWidth:Le,writingMode:Qe,flex:Qe,flexBasis:F,flexDirection:Qe,flexGrow:F,flexFlow:Qe,flexShrink:F,flexWrap:Qe,alignContent:F,alignItems:F,alignSelf:F,justifyContent:F,order:F,transitionDelay:F,transitionDuration:F,transitionProperty:F,transitionTimingFunction:F,backdropFilter:F,scrollSnapType:Qe,scrollSnapPointsX:Qe,scrollSnapPointsY:Qe,scrollSnapDestination:Qe,scrollSnapCoordinate:Qe,shapeImageThreshold:F,shapeImageMargin:F,shapeImageOutside:F,hyphens:Br,flowInto:Qe,flowFrom:Qe,regionFragment:Qe,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:Qe,borderImage:F,borderImageOutset:F,borderImageRepeat:F,borderImageSlice:F,borderImageSource:F,borderImageWidth:F}},dC=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},uC=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 fC(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Sc=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]}]`,n_(i[2]));continue}let l=r.exec(o);if(l){n.set(l[1],n_(l[2]));continue}return null}return o=>n.has(o.name)?{name:n.get(o.name)}:null}Hi();W();var Vt=class{constructor(e){this.source=e;this.layers=[];this.totalWeight=0;this.minFrameWidth=1;let n=[],a=(o,i)=>{let l=te(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=Se(3*this.getMinFrameWidth(),n/a,n);return Se(e,r,n)}getClampedConfigSpaceViewportRect({configSpaceViewportRect:e,renderInverted:n}){let a=new B(this.getTotalWeight(),this.getLayers().length),r=this.getClampedViewportWidth(e.size.x),o=e.size.withX(r),i=B.clamp(e.origin,new B(0,n?0:-1),B.max(B.zero,a.minus(o).plus(new B(0,1))));return new R(i,e.size.withX(r))}};W();var tm=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 R(new B(n,r),new B(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 Bt;let l=a.getLayers().length;for(let s=0;s<l;s++){let A=[],c=i.inverted?l-1-s:s,_=1/0,h=-1/0,f=new mn(this.gl),I=0,u=a.getLayers()[s];for(let g=0;g<u.length;g++){let p=u[g];f.getRectCount()>=tm&&(A.push(new oo(f,new R(new B(_,c),new B(h-_,1)),I)),_=1/0,h=-1/0,f=new mn(this.gl));let C=new R(new B(p.start,c),new B(p.end-p.start,1));_=Math.min(_,C.left()),h=Math.max(h,C.right());let y=new ue((1+g%255)/256,(1+s%255)/256,(1+this.flamechart.getColorBucketForFrame(p.node.frame))/256);f.addRect(C,y),I++}f.getRectCount()>0&&A.push(new oo(f,new R(new B(_,c),new B(h-_,1)),I)),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(I){let u=/\w+/.exec(I.substr(c.originalColumn-1));u&&(_.name=u[0])}}}switch(_.name){case"constructor":{_.name=l.name+" constructor";break}case"function":{_.name=l.name;break}case"const":case"export":{_.name=l.name;break}}return _.name&&l.name.includes(_.name)&&(_.name=l.name),c.source!=null&&(_.file=c.source,_.line=c.originalLine,_.col=c.originalColumn),Ym&&(console.groupCollapsed(`Remapping "${l.name}" -> "${_.name}"`),console.log("before",{...l}),console.log("item @ index",c),console.log("item @ index + 1",o[A+1]),console.log("after",_),console.groupEnd()),_}}W();var rh=({items:t,axis:e,renderItems:n,className:a,initialIndexInView:r})=>{let[o,i]=Ge(null),[l,s]=Ge(0),A=on(null),c=e==="x"?"width":"height",_=e==="x"?"left":"top",h=e==="x"?"scrollLeft":"scrollTop",f=r?t.reduce((v,Q,N)=>N<r?v+Q.size:v,0):0,I=on(f),u=K(v=>{v?requestAnimationFrame(()=>{i(v.getBoundingClientRect()[c]),I.current!=null&&(v.scrollTo({[_]:I.current}),I.current=null)}):i(null),A.current=v},[i,c,_]),g=ne(()=>{if(A.current==null||o==null||l==null)return null;let v=l-o/4,Q=l+o+o/4,N=0,L=0,S=0;for(;S<t.length;S++){let se=t[S];if(L=N,N+=se.size,N>=v)break}let w=S;for(;S<t.length;S++){let se=t[S];if(N+=se.size,N>=Q)break}let M=Math.min(S,t.length-1);return{firstVisibleIndex:w,lastVisibleIndex:M,invisiblePrefixSize:L}},[o,l,t]),p=ne(()=>t.reduce((v,Q)=>v+Q.size,0),[t]),C=K(()=>{A.current!=null&&s(A.current[h])},[h]);Xe(()=>{let v=()=>{A.current!=null&&i(A.current.getBoundingClientRect()[c])};return window.addEventListener("resize",v),()=>{window.removeEventListener("resize",v)}},[c]);let y=ne(()=>g?n(g.firstVisibleIndex,g.lastVisibleIndex):null,[n,g]),E=ne(()=>m("div",{style:{height:p}},m("div",{style:{transform:`translateY(${g?.invisiblePrefixSize||0}px)`}},y)),[g,y,p]);return m("div",{className:a,ref:u,onScroll:C},E)};function ah(t){let e=yo(V());return m("div",{className:j(e.hBarDisplay)},m("div",{className:j(e.hBarDisplayFilled),style:{width:`${t.perc}%`}}))}function sl(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 m("svg",{width:"8",height:"10",viewBox:"0 0 8 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:j(n.sortIcon)},m("path",{d:"M0 4L4 0L8 4H0Z",fill:r}),m("path",{d:"M0 4L4 0L8 4H0Z",transform:"translate(0 10) scale(1 -1)",fill:o}))}function $m(t,e,n){let a=[],r=0;for(let o of e)a.push(t.slice(r,o[0])),a.push(m("span",{className:n},t.slice(o[0],o[1]))),r=o[1];return a.push(t.slice(r)),m("span",null,a)}var Zm=({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(),_=100*A/n.getTotalNonIdleWeight(),h=t===r;return m("tr",{key:`${a}`,onClick:o.bind(null,t),className:j(l.tableRow,a%2==0&&l.tableRowEven,h&&l.tableRowSelected)},m("td",{className:j(l.numericCell)},n.formatValue(s)," (",jt(c),")",m(ah,{perc:c})),m("td",{className:j(l.numericCell)},n.formatValue(A)," (",jt(_),")",m(ah,{perc:_})),m("td",{title:t.file,className:j(l.textCell)},m(_o,{color:i(t)}),e?$m(t.name,e,j(l.matched,h&&l.matchedSelected)):t.name))},Xm=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=ot(kr),_=K((g,p)=>{if(!c)return null;let C=[];for(let y=g;y<=p;y++){let E=c.rowList[y],v=c.getSearchMatchForFrame(E);C.push(Zm({frame:E,matchedRanges:v??null,index:y,profile:t,selectedFrame:a,setSelectedFrame:r,getCSSColorForFrame:o}))}return C.length===0&&(l?C.push(m("tr",null,m("td",{className:j(s.emptyState)},'No symbol names match query "',i,'".'))):C.push(m("tr",null,m("td",{className:j(s.emptyState)},"No symbols found.")))),m("table",{className:j(s.tableView)},C)},[c,t,a,r,o,l,i,s.emptyState,s.ta
|
||
|
//# sourceMappingURL=speedscope-CAEVGCWN.js.map
|