"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isChromeTimeline=i,exports.isChromeTimelineObject=o,exports.importFromChromeTimeline=l,exports.importFromChromeCPUProfile=c,exports.importFromOldV8CPUProfile=f;vare=require("../lib/profile"),t=require("../lib/utils"),n=require("../lib/value-formatters"),r=require("./v8cpuFormatter");functioni(e){if(!Array.isArray(e))return!1;if(e.length<1)return!1;constt=e[0];return"pid"int&&"tid"int&&"ph"int&&"cat"int&&!!e.find(e=>"CpuProfile"===e.name||"Profile"===e.name||"ProfileChunk"===e.name)}functiono(e){return"traceEvents"ine&&i(e.traceEvents)}functionl(e,n){constr=newMap,i=newMap,o=newMap;(0,t.sortBy)(e,e=>e.ts);for(lettofe){if("CpuProfile"===t.name){conste=`${t.pid}:${t.tid}`,n=t.id||e;r.set(n,t.args.data.cpuProfile),i.set(n,e)}if("Profile"===t.name){conste=`${t.pid}:${t.tid}`;r.set(t.id||e,Object.assign({startTime:0,endTime:0,nodes:[],samples:[],timeDeltas:[]},t.args.data)),t.id&&i.set(t.id,`${t.pid}:${t.tid}`)}if("thread_name"===t.name&&o.set(`${t.pid}:${t.tid}`,t.args.name),"ProfileChunk"===t.name){conste=`${t.pid}:${t.tid}`,n=r.get(t.id||e);if(n){conste=t.args.data;e.cpuProfile&&(e.cpuProfile.nodes&&(n.nodes=n.nodes.concat(e.cpuProfile.nodes)),e.cpuProfile.samples&&(n.samples=n.samples.concat(e.cpuProfile.samples))),e.timeDeltas&&(n.timeDeltas=n.timeDeltas.concat(e.timeDeltas)),null!=e.startTime&&(n.startTime=e.startTime),null!=e.endTime&&(n.endTime=e.endTime)}elseconsole.warn(`Ignoring ProfileChunk for undeclared Profile with id ${t.id||e}`)}}if(r.size>0){conste=[];letl=0;return(0,t.itForEach)(r.keys(),t=>{lets=null,a=i.get(t);a&&(s=o.get(a)||null);constm=c(r.get(t));s&&r.size>1?(m.setName(`${n} - ${s}`),"CrRendererMain"===s&&(l=e.length)):m.setName(`${n}`),e.push(m)}),{name:n,indexToView:l,profiles:e}}thrownewError("Could not find CPU profile in Timeline")}consts=newMap;functiona(e){return(0,t.getOrInsert)(s,e,e=>{constt=e.url;letn=e.lineNumber;null!=n&&n++;letr=e.columnNumber;null!=r&&r++;consti=e.functionName||(t?`(anonymous ${t.split("/").pop()}:${n})`:"(anonymous)");return{key:`${i}:${t}:${n}:${r}`,name:i,file:t,line:n,col:r}})}functionm(e){const{functionName:t,url:n}=e;return"native dummy.js"===n||("(root)"===t||"(idle)"===t)}functionu(e){return"(garbage collector)"===e||"(program)"===e}functionc(r){consti=newe.CallTreeProfileBuilder(r.endTime-r.startTime),o=newMap;for(leteofr.nodes)o.set(e.id,e);for(leteofr.nodes)if("number"==typeofe.parent&&(e.parent=o.get(e.parent)),e.children)for(lettofe.children){constn=o.get(t);n&&(n.parent=e)}constl=[],s=[];letc=r.timeDeltas[0],f=c,p=NaN;for(lete=0;e<r.samples.length;e++){constt=r.samples[e];if(t!=p&&(l.push(t),c<f?s.push(f):(s.push(c),f=c)),e===r.samples.length-1)isNaN(p)||(l.push(p),c<f?s.push(f):(s.push(c),f=c));else{c+=r.timeDeltas[e+1],p=t}}letd=[];for(lete=0;e<l.length;e++){constn=s[e],r=l[e];letc=o.get(r);if(!c)continue;letf=null;for(f=c;f&&-1===d.indexOf(f);f=u(f.callFrame.functionName)?(0,t.lastOf)(d):f.parent||null);for(;d.length>0&&(0,t.lastOf)(d)!=f;){conste=a(d.pop().callFrame);i.leaveFrame(e,n)}constp=[];for(lete=c;e&&e!=f&&!m(e.callFrame);e=u(e.callFrame.functionName)?(0,t.lastOf)(d):e.parent||null)p.push(e);p.reverse();for(leteofp)i.enterFrame(a(e.callFrame),n);d=d.concat(p)}for(lete=d.length-1;e>=0;e--)i.leaveFrame(a(d[e].callFrame),(0,t.lastOf)(s));returni.setValueFormatter(newn.TimeFormatter("microseconds")),i.build()}functionf(e){returnc((0,r.chromeTreeToNodes)(e))}
"use strict";varr="undefined"!=typeofUint8Array&&"undefined"!=typeofUint16Array&&"undefined"!=typeofInt32Array;functiont(r,t){returnObject.prototype.hasOwnProperty.call(r,t)}exports.assign=function(r){for(vare=Array.prototype.slice.call(arguments,1);e.length;){varn=e.shift();if(n){if("object"!=typeofn)thrownewTypeError(n+"must be non-object");for(varainn)t(n,a)&&(r[a]=n[a])}}returnr},exports.shrinkBuf=function(r,t){returnr.length===t?r:r.subarray?r.subarray(0,t):(r.length=t,r)};vare={arraySet:function(r,t,e,n,a){if(t.subarray&&r.subarray)r.set(t.subarray(e,e+n),a);elsefor(varo=0;o<n;o++)r[a+o]=t[e+o]},flattenChunks:function(r){vart,e,n,a,o,s;for(n=0,t=0,e=r.length;t<e;t++)n+=r[t].length;for(s=newUint8Array(n),a=0,t=0,e=r.length;t<e;t++)o=r[t],s.set(o,a),a+=o.length;returns}},n={arraySet:function(r,t,e,n,a){for(varo=0;o<n;o++)r[a+o]=t[e+o]},flattenChunks:function(r){return[].concat.apply([],r)}};exports.setTyped=function(r){r?(exports.Buf8=Uint8Array,exports.Buf16=Uint16Array,exports.Buf32=Int32Array,exports.assign(exports,e)):(exports.Buf8=Array,exports.Buf16=Array,exports.Buf32=Array,exports.assign(exports,n))},exports.setTyped(r);
"use strict";vari=30,e=12;module.exports=function(o,a){vart,d,n,l,s,f,r,b,c,u,v,m,w,h,k,_,x,g,p,z,j,q,y,A,B;t=o.state,d=o.next_in,A=o.input,n=d+(o.avail_in-5),l=o.next_out,B=o.output,s=l-(a-o.avail_out),f=l+(o.avail_out-257),r=t.dmax,b=t.wsize,c=t.whave,u=t.wnext,v=t.window,m=t.hold,w=t.bits,h=t.lencode,k=t.distcode,_=(1<<t.lenbits)-1,x=(1<<t.distbits)-1;i:do{w<15&&(m+=A[d++]<<w,w+=8,m+=A[d++]<<w,w+=8),g=h[m&_];e:for(;;){if(m>>>=p=g>>>24,w-=p,0===(p=g>>>16&255))B[l++]=65535&g;else{if(!(16&p)){if(0==(64&p)){g=h[(65535&g)+(m&(1<<p)-1)];continuee}if(32&p){t.mode=e;breaki}o.msg="invalid literal/length code",t.mode=i;breaki}z=65535&g,(p&=15)&&(w<p&&(m+=A[d++]<<w,w+=8),z+=m&(1<<p)-1,m>>>=p,w-=p),w<15&&(m+=A[d++]<<w,w+=8,m+=A[d++]<<w,w+=8),g=k[m&x];o:for(;;){if(m>>>=p=g>>>24,w-=p,!(16&(p=g>>>16&255))){if(0==(64&p)){g=k[(65535&g)+(m&(1<<p)-1)];continueo}o.msg="invalid distance code",t.mode=i;breaki}if(j=65535&g,w<(p&=15)&&(m+=A[d++]<<w,(w+=8)<p&&(m+=A[d++]<<w,w+=8)),(j+=m&(1<<p)-1)>r){o.msg="invalid distance too far back",t.mode=i;breaki}if(m>>>=p,w-=p,j>(p=l-s)){if((p=j-p)>c&&t.sane){o.msg="invalid distance too far back",t.mode=i;breaki}if(q=0,y=v,0===u){if(q+=b-p,p<z){z-=p;do{B[l++]=v[q++]}while(--p);q=l-j,y=B}}elseif(u<p){if(q+=b+u-p,(p-=u)<z){z-=p;do{B[l++]=v[q++]}while(--p);if(q=0,u<z){z-=p=u;do{B[l++]=v[q++]}while(--p);q=l-j,y=B}}}elseif(q+=u-p,p<z){z-=p;do{B[l++]=v[q++]}while(--p);q=l-j,y=B}for(;z>2;)B[l++]=y[q++],B[l++]=y[q++],B[l++]=y[q++],z-=3;z&&(B[l++]=y[q++],z>1&&(B[l++]=y[q++]))}else{q=l-j;do{B[l++]=B[q++],B[l++]=B[q++],B[l++]=B[q++],z-=3}while(z>2);z&&(B[l++]=B[q++],z>1&&(B[l++]=B[q++]))}break}}break}}while(d<n&&l<f);d-=z=w>>3,m&=(1<<(w-=z<<3))-1,o.next_in=d,o.next_out=l,o.avail_in=d<n?n-d+5:5-(d-n),o.avail_out=l<f?f-l+257:257-(l-f),t.hold=m,t.bits=w};
!function(e){vara=String.fromCharCode;functions(e,s,c){for(varn=e[s],r=1,i=0,t=0;t<s;t++)10===e[t]?(r++,i=0):i++;thrownewSyntaxError(c||(s===e.length?"Unexpected end of input while parsing JSON":n>=32&&n<=126?"Unexpected character "+a(n)+" in JSON at position "+s+" (line "+r+", column "+i+")":"Unexpected byte 0x"+n.toString(16)+" in JSON at position "+s+" (line "+r+", column "+i+")"))}e.JSON_parse=function(e){if(!(einstanceofUint8Array))thrownewError("JSON input must be a Uint8Array");for(varc,n=[],r=[],i=[],t=e.length,o=null,u=0,f=0;f<t;){varp=e[f++];if(!(p<=32)){varl=void0;switch(2===u&&null===o&&34!==p&&125!==p&&s(e,--f),p){case116:114===e[f++]&&117===e[f++]&&101===e[f++]||s(e,--f),l=!0;break;case102:97===e[f++]&&108===e[f++]&&115===e[f++]&&101===e[f++]||s(e,--f),l=!1;break;case110:117===e[f++]&&108===e[f++]&&108===e[f++]||s(e,--f),l=null;break;case45:case46:case48:case49:case50:case51:case52:case53:case54:case55:case56:case57:varb=f;for(l=a(p),p=e[f];;){switch(p){case43:case45:case46:case48:case49:case50:case51:case52:case53:case54:case55:case56:case57:case101:case69:l+=a(p),p=e[++f];continue}break}l=+l,isNaN(l)&&s(e,--b,"Invalid number");break;case34:for(l="";f>=t&&s(e,t),34!==(p=e[f++]);)if(92===p)switch(e[f++]){case34:l+='"';break;case47:l+="/";break;case92:l+="\\";break;case98:l+="\b";break;case102:l+="\f";break;case110:l+="\n";break;case114:l+="\r";break;case116:l+="\t";break;case117:for(vark=0,h=0;h<4;h++)k<<=4,(p=e[f++])>=48&&p<=57?k|=p-48:p>=97&&p<=102?k|=p+-87:p>=65&&p<=70?k|=p+-55:s(e,--f);l+=a(k);break;default:s(e,--f)}elseif(p<=127)l+=a(p);elseif(192==(224&p))l+=a((31&p)<<6|63&e[f++]);elseif(224==(240&p))l+=a((15&p)<<12|(63&e[f++])<<6|63&e[f++]);elseif(240==(248&p)){vard=(7&p)<<18|(63&e[f++])<<12|(63&e[f++])<<6|63&e[f++];d>65535&&(l+=a((d-=65536)>>10&1023|55296),d=56320|1023&d),l+=a(d)}l[0];break;case91:l=[],n.push(o),r.push(c),i.push(u),o=null,c=l,u=1;continue;case123:l={},n.push(o),r.push(c),i.push(u),o=null,c=l,u=2;continue;case93:1!==u&&s(e,--f),l=c,o=n.pop(),c=r.pop(),u=i.pop();break;case125:2!==u&&s(e,--f),l=c,o=n.pop(),c=r.pop(),u=i.pop();break;default:s(e,--f)}for(p=e[f];p<=32;)p=e[++f];switch(u){case0:if(f===t)returnl;break;case1:if(c.push(l),44===p){f++;continue}if(93===p)continue;break;case2:if(null===o){if(o=l,58===p){f++;continue}}else{if(c[o]=l,o=null,44===p){f++;continue}if(125===p)continue}}break}}s(e,f)}}("undefined"!=typeofexports?exports:this);
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.withMockedFileChunkSizeForTests=o,exports.MaybeCompressedDataReader=exports.TextProfileDataSource=exports.StringBackedTextFileContent=exports.BufferBackedTextFileContent=void0;vare=n(require("pako")),t=require("uint8array-json-parser");functionr(){if("function"!=typeofWeakMap)returnnull;vare=newWeakMap;returnr=function(){returne},e}functionn(e){if(e&&e.__esModule)returne;if(null===e||"object"!=typeofe&&"function"!=typeofe)return{default:e};vart=r();if(t&&t.has(e))returnt.get(e);varn={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(variine)if(Object.prototype.hasOwnProperty.call(e,i)){varo=s?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(n,i,o):n[i]=e[i]}returnn.default=e,t&&t.set(e,n),n}vars=function(e,t,r,n){returnnew(r||(r=Promise))(function(s,i){functiono(e){try{a(n.next(e))}catch(t){i(t)}}functionu(e){try{a(n.throw(e))}catch(t){i(t)}}functiona(e){vart;e.done?s(e.value):(t=e.value,tinstanceofr?t:newr(function(e){e(t)})).then(o,u)}a((n=n.apply(e,t||[])).next())})};leti=1<<27;functiono(e,t){returns(this,void0,void0,function*(){constr=i;i=e;try{yieldt()}finally{i=r}})}functionu(e){return"["===(e=e.trim())[0]&&"]"!==(e=e.replace(/,\s*$/,""))[e.length-1]&&(e+="]"),JSON.parse(e)}functiona(e){letr=0;for(lett=0;t<e.length;t++)if(!/\s/.exec(String.fromCharCode(e[t]))){r=t;break}if(e[r]==="[".charCodeAt(0)&&e[e.length-1]!=="]".charCodeAt(0)){lett=e.length;for(;t>0&&/\s/.exec(String.fromCharCode(e[t-1]));)t--;if(","===String.fromCharCode(e[t-1])&&t--,"]"!==String.fromCharCode(e[t-1])){constr=newUint8Array(t+1);r.set(e.subarray(0,t)),r[t]="]".charCodeAt(0),e=r}}return(0,t.JSON_parse)(e)}classc{constructor(e){this.chunks=[];constt=this.byteArray=newUint8Array(e);letr="utf-8";if(t.length>2&&(255===t[0]&&254===t[1]?r="utf-16le":254===t[0]&&255===t[1]&&(r="utf-16be")),"undefined"!=typeofTextDecoder){constt=newTextDecoder(r);for(letr=0;r<e.byteLength/i;r++){constn=r*i,s=newUint8Array(e,n,Math.min(e.byteLength-n,i)),o=t.decode(s,{stream:!0});this.chunks.push(o)}}else{console.warn("This browser does not support TextDecoder. Decoding text as ASCII."),this.chunks.push("");for(lete=0;e<t.length;e++)this.chunks[this.chunks.length-1]+=String.fromCharCode(t[e]),this.chunks[this.chunks.length-1],this.chunks[this.chunks.length-1].length>=i&&this.chunks.push("")}}splitLines(){return{[Symbol.iterator]:function*(){lete="";for(lettofthis.chunks){constr=t.split("\n");for(lett=0;t<r.length;t++)0===t?e+=r[t]:(yielde,e=r[t])}yielde}.bind(this)}}firstChunk(){returnthis.chunks[0]||""}parseAsJSON(){return1===this.chunks.length?u(this.chunks[0]):a(this.byteArray)}}exports.BufferBackedTextFileContent=c;classf{constructor(e){this.s=e}splitLines(){returnthis.s.split("\n")}firstChunk(){returnthis.s}parseAsJSON(){returnu(this.s)}}exports.StringBackedTextFileContent=f;classh{constructor(e,t){this.fileName=e,this.contents=t}name(){returns(this,void0,void0,function*(){returnthis.fileName})}readAsArrayBuffer(){returns(this,void0,void0,function*(){returnnewArrayBuffer(0)})}readAsText(){returns(this,void0,void0,function*(){returnnewf(this.contents)})}}exports.TextProfileDataSource=h;classl{constructor(t,r){this.namePromise=t,this.uncompressedData=r.then(t=>s(this,void0,void0,function*(){try{returne.inflate(newUint8Array(t)).buffer}catch(r){returnt}}))}name(){returns(this,void0,void0,function*(){returnyieldthis.namePromise})}readAsArrayBuffer(){returns(this,void0,void0,function*(){returnyieldthis.uncompressedData})}readAsText(){returns(this,void0,void0,function*(){conste=yieldthis.readAsArrayBuffer();returnnewc(e)})}staticfromFile(e){constt=newPromise(t=>{constr=newFileReader;r.addEventListener("loadend",()=>{if(!(r.resultinstanceofArrayBuffer))thrownewError("Expected reader.result to be an instance of ArrayBuffer");t(r.result)}),r.readAsArrayBuffer(e)});returnnewl(Promise.resolve(e.name),t)}staticfromArrayBuffer(e,t){returnn
"use strict";exports.byteLength=u,exports.toByteArray=i,exports.fromByteArray=d;for(varr=[],t=[],e="undefined"!=typeofUint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=n.length;o<a;++o)r[o]=n[o],t[n.charCodeAt(o)]=o;functionh(r){vart=r.length;if(t%4>0)thrownewError("Invalid string. Length must be a multiple of 4");vare=r.indexOf("=");return-1===e&&(e=t),[e,e===t?0:4-e%4]}functionu(r){vart=h(r),e=t[0],n=t[1];return3*(e+n)/4-n}functionc(r,t,e){return3*(t+e)/4-e}functioni(r){varn,o,a=h(r),u=a[0],i=a[1],f=newe(c(r,u,i)),A=0,d=i>0?u-4:u;for(o=0;o<d;o+=4)n=t[r.charCodeAt(o)]<<18|t[r.charCodeAt(o+1)]<<12|t[r.charCodeAt(o+2)]<<6|t[r.charCodeAt(o+3)],f[A++]=n>>16&255,f[A++]=n>>8&255,f[A++]=255&n;return2===i&&(n=t[r.charCodeAt(o)]<<2|t[r.charCodeAt(o+1)]>>4,f[A++]=255&n),1===i&&(n=t[r.charCodeAt(o)]<<10|t[r.charCodeAt(o+1)]<<4|t[r.charCodeAt(o+2)]>>2,f[A++]=n>>8&255,f[A++]=255&n),f}functionf(t){returnr[t>>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}functionA(r,t,e){for(varn,o=[],a=t;a<e;a+=3)n=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(255&r[a+2]),o.push(f(n));returno.join("")}functiond(t){for(vare,n=t.length,o=n%3,a=[],h=0,u=n-o;h<u;h+=16383)a.push(A(t,h,h+16383>u?u:h+16383));return1===o?(e=t[n-1],a.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],a.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),a.join("")}t["-".charCodeAt(0)]=62,t["_".charCodeAt(0)]=63;
vart=arguments[3],r=require("base64-js"),e=require("ieee754"),n=require("isarray");functioni(){try{vart=newUint8Array(1);returnt.__proto__={__proto__:Uint8Array.prototype,foo:function(){return42}},42===t.foo()&&"function"==typeoft.subarray&&0===t.subarray(1,1).byteLength}catch(r){return!1}}functiono(){returnf.TYPED_ARRAY_SUPPORT?2147483647:1073741823}functionu(t,r){if(o()<r)thrownewRangeError("Invalid typed array length");returnf.TYPED_ARRAY_SUPPORT?(t=newUint8Array(r)).__proto__=f.prototype:(null===t&&(t=newf(r)),t.length=r),t}functionf(t,r,e){if(!(f.TYPED_ARRAY_SUPPORT||thisinstanceoff))returnnewf(t,r,e);if("number"==typeoft){if("string"==typeofr)thrownewError("If encoding is specified then the first argument must be a string");returnc(this,t)}returns(this,t,r,e)}functions(t,r,e,n){if("number"==typeofr)thrownewTypeError('"value" argument must not be a number');return"undefined"!=typeofArrayBuffer&&rinstanceofArrayBuffer?g(t,r,e,n):"string"==typeofr?l(t,r,e):y(t,r)}functionh(t){if("number"!=typeoft)thrownewTypeError('"size" argument must be a number');if(t<0)thrownewRangeError('"size" argument must not be negative')}functiona(t,r,e,n){returnh(r),r<=0?u(t,r):void0!==e?"string"==typeofn?u(t,r).fill(e,n):u(t,r).fill(e):u(t,r)}functionc(t,r){if(h(r),t=u(t,r<0?0:0|w(r)),!f.TYPED_ARRAY_SUPPORT)for(vare=0;e<r;++e)t[e]=0;returnt}functionl(t,r,e){if("string"==typeofe&&""!==e||(e="utf8"),!f.isEncoding(e))thrownewTypeError('"encoding" must be a valid string encoding');varn=0|v(r,e),i=(t=u(t,n)).write(r,e);returni!==n&&(t=t.slice(0,i)),t}functionp(t,r){vare=r.length<0?0:0|w(r.length);t=u(t,e);for(varn=0;n<e;n+=1)t[n]=255&r[n];returnt}functiong(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)thrownewRangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))thrownewRangeError("'length' is out of bounds");returnr=void0===e&&void0===n?newUint8Array(r):void0===n?newUint8Array(r,e):newUint8Array(r,e,n),f.TYPED_ARRAY_SUPPORT?(t=r).__proto__=f.prototype:t=p(t,r),t}functiony(t,r){if(f.isBuffer(r)){vare=0|w(r.length);return0===(t=u(t,e)).length?t:(r.copy(t,0,0,e),t)}if(r){if("undefined"!=typeofArrayBuffer&&r.bufferinstanceofArrayBuffer||"length"inr)return"number"!=typeofr.length||W(r.length)?u(t,0):p(t,r);if("Buffer"===r.type&&n(r.data))returnp(t,r.data)}thrownewTypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}functionw(t){if(t>=o())thrownewRangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return0|t}functiond(t){return+t!=t&&(t=0),f.alloc(+t)}functionv(t,r){if(f.isBuffer(t))returnt.length;if("undefined"!=typeofArrayBuffer&&"function"==typeofArrayBuffer.isView&&(ArrayBuffer.isView(t)||tinstanceofArrayBuffer))returnt.byteLength;"string"!=typeoft&&(t=""+t);vare=t.length;if(0===e)return0;for(varn=!1;;)switch(r){case"ascii":case"latin1":case"binary":returne;case"utf8":case"utf-8":casevoid0:return$(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return2*e;case"hex":returne>>>1;case"base64":returnK(t).length;default:if(n)return$(t).length;r=(""+r).toLowerCase(),n=!0}}functionE(t,r,e){varn=!1;if((void0===r||r<0)&&(r=0),r>this.length)return"";if((void0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":returnx(this,r,e);case"utf8":case"utf-8":returnY(this,r,e);case"ascii":returnL(this,r,e);case"latin1":case"binary":returnD(this,r,e);case"base64":returnS(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":returnC(this,r,e);default:if(n)thrownewTypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}functionb(t,r,e){varn=t[r];t[r]=t[e],t[e]=n}functionR(t,r,e,n,i){if(0===t.length)return-1;if("string"==typeofe?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}elseif(e<0){if(!i)return-1;e=0}if("string"==typeofr&&(r=f.from(r,n)),f.
"use strict";module.exports=h;vart,i=require("./util/minimal"),s=i.LongBits,r=i.utf8;functiono(t,i){returnRangeError("index out of range: "+t.pos+" + "+(i||1)+" > "+t.len)}functionh(t){this.buf=t,this.pos=0,this.len=t.length}varn="undefined"!=typeofUint8Array?function(t){if(tinstanceofUint8Array||Array.isArray(t))returnnewh(t);throwError("illegal buffer")}:function(t){if(Array.isArray(t))returnnewh(t);throwError("illegal buffer")};functione(){vart=news(0,0),i=0;if(!(this.len-this.pos>4)){for(;i<3;++i){if(this.pos>=this.len)throwo(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*i)>>>0,this.buf[this.pos++]<128)returnt}returnt.lo=(t.lo|(127&this.buf[this.pos++])<<7*i)>>>0,t}for(;i<4;++i)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*i)>>>0,this.buf[this.pos++]<128)returnt;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)returnt;if(i=0,this.len-this.pos>4){for(;i<5;++i)if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*i+3)>>>0,this.buf[this.pos++]<128)returnt}elsefor(;i<5;++i){if(this.pos>=this.len)throwo(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*i+3)>>>0,this.buf[this.pos++]<128)returnt}throwError("invalid varint encoding")}functionu(t,i){return(t[i-4]|t[i-3]<<8|t[i-2]<<16|t[i-1]<<24)>>>0}functionf(){if(this.pos+8>this.len)throwo(this,8);returnnews(u(this.buf,this.pos+=4),u(this.buf,this.pos+=4))}h.create=i.Buffer?function(s){return(h.create=function(s){returni.Buffer.isBuffer(s)?newt(s):n(s)})(s)}:n,h.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,h.prototype.uint32=function(){vart=4294967295;returnfunction(){if(t=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)returnt;if(t=(t|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)returnt;if(t=(t|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)returnt;if(t=(t|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)returnt;if(t=(t|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)returnt;if((this.pos+=5)>this.len)throwthis.pos=this.len,o(this,10);returnt}}(),h.prototype.int32=function(){return0|this.uint32()},h.prototype.sint32=function(){vart=this.uint32();returnt>>>1^-(1&t)|0},h.prototype.bool=function(){return0!==this.uint32()},h.prototype.fixed32=function(){if(this.pos+4>this.len)throwo(this,4);returnu(this.buf,this.pos+=4)},h.prototype.sfixed32=function(){if(this.pos+4>this.len)throwo(this,4);return0|u(this.buf,this.pos+=4)},h.prototype.float=function(){if(this.pos+4>this.len)throwo(this,4);vart=i.float.readFloatLE(this.buf,this.pos);returnthis.pos+=4,t},h.prototype.double=function(){if(this.pos+8>this.len)throwo(this,4);vart=i.float.readDoubleLE(this.buf,this.pos);returnthis.pos+=8,t},h.prototype.bytes=function(){vart=this.uint32(),i=this.pos,s=this.pos+t;if(s>this.len)throwo(this,t);returnthis.pos+=t,Array.isArray(this.buf)?this.buf.slice(i,s):i===s?newthis.buf.constructor(0):this._slice.call(this.buf,i,s)},h.prototype.string=function(){vart=this.bytes();returnr.read(t,0,t.length)},h.prototype.skip=function(t){if("number"==typeoft){if(this.pos+t>this.len)throwo(this,t);this.pos+=t}elsedo{if(this.pos>=this.len)throwo(this)}while(128&this.buf[this.pos++]);returnthis},h.prototype.skipType=function(t){switch(t){case0:this.skip();break;case1:this.skip(8);break;case2:this.skip(this.uint32());break;case3:for(;4!=(t=7&this.uint32());)this.skipType(t);break;case5:this.skip(4);break;default:throwError("invalid wire type "+t+" at offset "+this.pos)}returnthis},h._configure=function(s){t=s;varr=i.Long?"toLong":"toNumber";i.merge(h.prototype,{int64:function(){returne.call(this)[r](!1)},uint64:function(){returne.call(this)[r](!0)},sint64:function(){returne.call(this).zzDecode()[r](!1)},fixed64:function(){returnf.call(this)[r](!0)},sfixed64:function(){returnf.call(this)[r](!1)}})};
"use strict";module.exports=t;vare=require("../util/minimal");functiont(t,r,i){if("function"!=typeoft)throwTypeError("rpcImpl must be a function");e.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=Boolean(r),this.responseDelimited=Boolean(i)}(t.prototype=Object.create(e.EventEmitter.prototype)).constructor=t,t.prototype.rpcCall=functiont(r,i,n,o,l){if(!o)throwTypeError("request must be specified");varu=this;if(!l)returne.asPromise(t,u,r,i,n,o);if(u.rpcImpl)try{returnu.rpcImpl(r,i[u.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(e,t){if(e)returnu.emit("error",e,r),l(e);if(null!==t){if(!(tinstanceofn))try{t=n[u.responseDelimited?"decodeDelimited":"decode"](t)}catch(e){returnu.emit("error",e,r),l(e)}returnu.emit("data",t,r),l(null,t)}u.end(!0)})}catch(c){returnu.emit("error",c,r),voidsetTimeout(function(){l(c)},0)}elsesetTimeout(function(){l(Error("already ended"))},0)},t.prototype.end=function(e){returnthis.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isTraceEventFormatted=m,exports.importTraceEvents=g;vare=require("../lib/utils"),t=require("../lib/profile"),n=require("../lib/value-formatters");functionr(t,n){return`${(0,e.zeroPad)(""+t,10)}:${(0,e.zeroPad)(""+n,10)}`}functions(t){constn=newMap;for(letsoft){(0,e.getOrInsert)(n,r(s.pid,s.tid),()=>[]).push(s)}returnn}functiono(e,t){if(0===e.length&&0===t.length)thrownewError("This method should not be given both queues empty");if(0===t.length)return"B";if(0===e.length)return"E";constn=e[0],r=t[0],s=n.ts,o=r.ts;returns<o?"B":o<s?"E":n.name===r.name?"B":"E"}functiona(e){constt=[],n=[];if(e.length>0){lett=Number.MAX_SAFE_INTEGER;for(letnofe)t=Math.min(t,n.ts);for(letnofe)n.ts-=t}constr=[];for(letaofe)switch(a.ph){case"B":t.push(a);break;case"E":n.push(a);break;case"X":r.push(a);break;default:returna}functions(e){vart,n;returnnull!==(n=null!==(t=e.dur)&&void0!==t?t:e.tdur)&&void0!==n?n:0}r.sort((e,t)=>{if(e.ts<t.ts)return-1;if(e.ts>t.ts)return1;constn=s(e),r=s(t);returnn>r?-1:n<r?1:0});for(letaofr){conste=s(a);t.push(Object.assign(Object.assign({},a),{ph:"B"})),n.push(Object.assign(Object.assign({},a),{ph:"E",ts:a.ts+e}))}functiono(e,t){returne.ts<t.ts?-1:e.ts>t.ts?1:0}returnt.sort(o),n.sort(o),[t,n]}functioni(e){constt=[];for(letnofe)switch(n.ph){case"B":case"E":case"X":t.push(n)}returnt}functionu(e){constt=newMap;for(letnofe)"M"===n.ph&&"process_name"===n.name&&n.args&&n.args.name&&t.set(n.pid,n.args.name);returnt}functionc(e){constt=newMap;for(letnofe)"M"===n.ph&&"thread_name"===n.name&&n.args&&n.args.name&&t.set(r(n.pid,n.tid),n.args.name);returnt}functionf(e){lett=`${e.name||"(unnamed)"}`;returne.args&&(t+=`${JSON.stringify(e.args)}`),t}functionl(e){constt=f(e);return{name:t,key:t}}functionh(f){consth=s(i(f)),d=u(f),p=c(f),m=[];returnh.forEach(s=>{if(0===s.length)return;const{pid:i,tid:u}=s[0],c=newt.CallTreeProfileBuilder;c.setValueFormatter(newn.TimeFormatter("microseconds"));constf=d.get(i),h=p.get(r(i,u));null!=f&&null!=h?c.setName(`${f} (pid ${i}), ${h} (tid ${u})`):null!=f?c.setName(`${f} (pid ${i}, tid ${u})`):null!=h?c.setName(`${h} (pid ${i}, tid ${u})`):c.setName(`pid ${i}, tid ${u}`);const[g,$]=a(s),k=[],b=e=>{k.push(e),c.enterFrame(l(e),e.ts)},w=t=>{constn=(0,e.lastOf)(k);if(null==n)returnvoidconsole.warn(`Tried to end frame "${l(t).key}", but the stack was empty. Doing nothing instead.`);constr=l(t),s=l(n);t.name===n.name?(r.key!==s.key&&console.warn(`ts=${t.ts}: Tried to end "${r.key}" when "${s.key}" was on the top of the stack. Ending ${s.key} instead.`),k.pop(),c.leaveFrame(s,t.ts)):console.warn(`ts=${t.ts}: Tried to end "${r.key}" when "${s.key}" was on the top of the stack. Doing nothing instead.`)};for(;g.length>0||$.length>0;){constt=o(g,$);switch(t){case"B":b(g.shift());break;case"E":{constt=(0,e.lastOf)(k);if(null!=t){conste=l(t);letn=!1;for(lett=1;t<$.length;t++){constr=$[t];if(r.ts>$[0].ts)break;consts=l(r);if(e.key===s.key){conste=$[0];$[0]=$[t],$[t]=e,n=!0;break}}if(!n)for(letr=1;r<$.length;r++){conste=$[r];if(e.ts>$[0].ts)break;if(e.name===t.name){conste=$[0];$[0]=$[r],$[r]=e,n=!0;break}}}w($.shift());break}default:returnt}}for(lete=k.length-1;e>=0;e--){constt=l(k[e]);console.warn(`Frame "${t.key}" was still open at end of profile. Closing automatically.`),c.leaveFrame(t,c.getTotalWeight())}m.push([r(i,u),c.build()])}),(0,e.sortBy)(m,e=>e[0]),{name:"",indexToView:0,profiles:m.map(e=>e[1])}}functiond(e){if(!Array.isArray(e))return!1;if(0===e.length)return!1;for(lettofe){if(!("ph"int))return!1;switch(t.ph){case"B":case"E":case"X":if(!("ts"int))return!1}}return!0}functionp(e){return"traceEvents"ine&&d(e.traceEvents)}functionm(e){returnp(e)||d(e)}functiong(e){if(p(e))returnh(e.traceEvents);if(d(e))returnh(e);returne}
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.importFromCallgrind=r;vare=require("../lib/profile"),t=require("../lib/utils"),i=require("../lib/value-formatters");classs{constructor(e,i){this.fileName=e,this.fieldName=i,this.frameSet=newt.KeyedSet,this.totalWeights=newMap,this.childrenTotalWeights=newMap}getOrInsertFrame(t){returne.Frame.getOrInsert(this.frameSet,t)}addToTotalWeight(e,t){this.totalWeights.has(e)?this.totalWeights.set(e,this.totalWeights.get(e)+t):this.totalWeights.set(e,t)}addSelfWeight(e,t){this.addToTotalWeight(this.getOrInsertFrame(e),t)}addChildWithTotalWeight(e,i,s){constn=this.getOrInsertFrame(e),r=this.getOrInsertFrame(i),a=(0,t.getOrInsert)(this.childrenTotalWeights,n,e=>newMap);a.has(r)?a.set(r,a.get(r)+s):a.set(r,s),this.addToTotalWeight(n,s)}toProfile(){consts=newe.CallTreeProfileBuilder;letn=1;"Time_(10ns)"===this.fieldName?(s.setName(`${this.fileName} -- Time`),n=10,s.setValueFormatter(newi.TimeFormatter("nanoseconds"))):"Memory_(bytes)"==this.fieldName?(s.setName(`${this.fileName} -- Memory`),s.setValueFormatter(newi.ByteFormatter)):s.setName(`${this.fileName} -- ${this.fieldName}`);letr=0;consta=newSet;letl=0;for(let[e,t]ofthis.totalWeights)l=Math.max(l,t);consto=(e,i)=>{if(a.has(e))return;if(i<1e-4*l)return;consth=(0,t.getOrElse)(this.totalWeights,e,()=>0);if(0===h)return;letm=i;s.enterFrame(e,Math.round(r*n)),a.add(e);for(let[t,s]ofthis.childrenTotalWeights.get(e)||[]){lete=r;o(t,i*(s/h)),m-=r-e}a.delete(e),r+=m,s.leaveFrame(e,Math.round(r*n))},h=newSet(this.frameSet);for(let[e,t]ofthis.childrenTotalWeights)for(let[i,s]oft)h.delete(i);for(leteofh)o(e,this.totalWeights.get(e));returns.build()}}classn{constructor(e,t){this.importedFileName=t,this.callGraphs=null,this.eventsLine=null,this.filename=null,this.functionName=null,this.calleeFilename=null,this.calleeFunctionName=null,this.savedFileNames={},this.savedFunctionNames={},this.prevCostLineNumbers=[],this.lines=[...e.splitLines()],this.lineNum=0}parse(){for(;this.lineNum<this.lines.length;){conste=this.lines[this.lineNum++];if(!/^\s*#/.exec(e)&&!(/^\s*$/.exec(e)||this.parseHeaderLine(e)||this.parseAssignmentLine(e)||this.parseCostLine(e,"self")))thrownewError(`Unrecognized line "${e}" on line ${this.lineNum}`)}returnthis.callGraphs?{name:this.importedFileName,indexToView:0,profiles:this.callGraphs.map(e=>e.toProfile())}:null}frameInfo(){conste=this.filename||"(unknown)",t=this.functionName||"(unknown)";return{key:`${e}:${t}`,name:t,file:e}}calleeFrameInfo(){conste=this.calleeFilename||this.filename||"(unknown)",t=this.calleeFunctionName||"(unknown)";return{key:`${e}:${t}`,name:t,file:e}}parseHeaderLine(e){constt=/^\s*(\w+):\s*(.*)+$/.exec(e);if(!t)return!1;if("events"!==t[1])return!0;consti=t[2].split(" ");if(null!=this.callGraphs)thrownewError(`Duplicate "events: " lines specified. First was "${this.eventsLine}", now received "${e}" on ${this.lineNum}.`);returnthis.callGraphs=i.map(e=>news(this.importedFileName,e)),!0}parseAssignmentLine(e){constt=/^(\w+)=\s*(.*)$/.exec(e);if(!t)return!1;consti=t[1],s=t[2];switch(i){case"fe":case"fi":this.parseNameWithCompression(s,this.savedFileNames);break;case"fl":this.filename=this.parseNameWithCompression(s,this.savedFileNames);break;case"fn":this.functionName=this.parseNameWithCompression(s,this.savedFunctionNames);break;case"cfi":case"cfl":this.calleeFilename=this.parseNameWithCompression(s,this.savedFileNames);break;case"cfn":this.calleeFunctionName=this.parseNameWithCompression(s,this.savedFunctionNames);break;case"calls":this.parseCostLine(this.lines[this.lineNum++],"child"),this.calleeFilename=null,this.calleeFunctionName=null;break;case"cob":case"ob":break;default:console.log(`Ignoring assignment to unrecognized key "${e}" on line ${this.lineNum}`)}return!0}parseNameWithCompression(e,t){{consti=/^\((\d+)\)\s*(.+)$/.exec(e);if(i){conste=i[1],s=i[2];if(eint)thrownewError(`Redefinition of name with id: ${e}. Original value was "${t[e]}". Tried to redefine as "${s}" on line ${this.lineNum}.`);returnt[e]=s,s}}{cons
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.importFromPapyrus=r;vare=require("../lib/profile"),t=require("../lib/utils"),n=require("../lib/value-formatters");functionr(r){consta=newe.CallTreeProfileBuilder;a.setValueFormatter(newn.TimeFormatter("milliseconds"));constl=[...r.splitLines()].filter(e=>!/^$|^Log closed$|log opened/.exec(e));lets=-1;consto=I(l[0]);if(null===o)throwError;s=o.at;consti=(0,t.lastOf)(l);if(null===i)throwError;constc=I(i);if(null===c)throwError;constu=c.at,f=newt.KeyedSet,h=[];letm,p=0,v=-1;functiond(t,n,r){functionl(t,n){h.push(n),a.enterFrame(e.Frame.getOrInsert(f,{name:n,key:n}),t),p=t}v>-1&&(v=-1,m===r&&v>=p&&d(t,v,`QUEUE ${r}`));consts=`STACK ${t}`;[...h].reverse().find(e=>e.startsWith("STACK "))!==s&&(1===h.length&&g(p),l(n,s)),l(n,r)}functiong(n){constr=h.pop();if(void0===r)throwError("Tried to leave frame when nothing was on stack.");a.leaveFrame(e.Frame.getOrInsert(f,{name:r,key:r}),n);letl=(0,t.lastOf)(h);null!==l&&l.startsWith("QUEUE ")&&(g(n),l=(0,t.lastOf)(h)),h.length>1&&null!==l&&l.startsWith("STACK ")&&g(n),p=n}functionw(e,n,r){(0,t.lastOf)(h)===r?g(n):0===p?(console.log(`Tried to leave frame "${r}" which was never entered. Assuming it has been running since the start.`),d(e,0,r),g(n)):console.log(`Tried to leave frame "${r}" which was never entered. Other events have happened since the start, ignoring line.`)}functionI(e){if(void0===e)throwError("Probably tried to import empty file.");constt=e.split(":");returnt.length<3?null:-1!==s?{at:parseInt(t[0])-s,event:t[1],stackInt:parseInt(t[2]),name:t[5]}:{at:parseInt(t[0]),event:t[1],stackInt:parseInt(t[2]),name:t[5]}}for(l.forEach((e,t,n)=>{constr=I(e);if(null!==r)if("PUSH"===r.event){d(r.stackInt,r.at,r.name);lete=I(n[t+=1]);for(;null!==e&&e.at===r.at;)e.name===r.name&&e.stackInt===r.stackInt&&"POP"===e.event?(w(e.stackInt,e.at,e.name),n.splice(t,1),e=null):(t+=1)<n.length&&(e=I(n[t]))}elseif("POP"===r.event)w(r.stackInt,r.at,r.name);elseif("QUEUE_PUSH"===r.event)returnm=r.name.replace(/\?/g,""),void(v=r.at)});h.length>0;)g(u);returna.build()}
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.importProfileGroupFromText=C,exports.importProfileGroupFromBase64=I,exports.importProfilesFromFile=x,exports.importProfilesFromArrayBuffer=y,exports.importFromFileSystemDirectoryEntry=T;varr=require("./chrome"),e=require("./stackprof"),o=require("./instruments"),i=require("./bg-flamegraph"),t=require("./firefox"),n=require("../lib/file-format"),s=require("./v8proflog"),l=require("./linux-tools-perf"),m=require("./haskell"),p=require("./safari"),a=require("./utils"),f=require("./pprof"),c=require("../lib/utils"),u=require("./v8heapalloc"),d=require("./trace-event"),g=require("./callgrind"),h=require("./papyrus"),F=function(r,e,o,i){returnnew(o||(o=Promise))(function(t,n){functions(r){try{m(i.next(r))}catch(e){n(e)}}functionl(r){try{m(i.throw(r))}catch(e){n(e)}}functionm(r){vare;r.done?t(r.value):(e=r.value,einstanceofo?e:newo(function(r){r(e)})).then(s,l)}m((i=i.apply(r,e||[])).next())})};functionC(r,e){returnF(this,void0,void0,function*(){returnyieldP(newa.TextProfileDataSource(r,e))})}functionI(r,e){returnF(this,void0,void0,function*(){returnyieldP(a.MaybeCompressedDataReader.fromArrayBuffer(r,(0,c.decodeBase64)(e).buffer))})}functionx(r){returnF(this,void0,void0,function*(){returnP(a.MaybeCompressedDataReader.fromFile(r))})}functiony(r,e){returnF(this,void0,void0,function*(){returnP(a.MaybeCompressedDataReader.fromArrayBuffer(r,e))})}functionP(r){returnF(this,void0,void0,function*(){conste=yieldr.name(),o=yieldS(r);if(o){o.name||(o.name=e);for(letrofo.profiles)r&&!r.getName()&&r.setName(e);returno}returnnull})}functionv(r){returnr?{name:r.getName(),indexToView:0,profiles:[r]}:null}functionS(a){returnF(this,void0,void0,function*(){constc=yielda.name(),F=yielda.readAsArrayBuffer();{constr=(0,f.importAsPprofProfile)(F);if(r)returnconsole.log("Importing as protobuf encoded pprof file"),v(r)}constC=yielda.readAsText();if(c.endsWith(".speedscope.json"))returnconsole.log("Importing as speedscope json file"),(0,n.importSpeedscopeProfiles)(C.parseAsJSON());if(/Trace-\d{8}T\d{6}/.exec(c))returnconsole.log("Importing as Chrome Timeline Object"),(0,r.importFromChromeTimeline)(C.parseAsJSON().traceEvents,c);if(c.endsWith(".chrome.json")||/Profile-\d{8}T\d{6}/.exec(c))returnconsole.log("Importing as Chrome Timeline"),(0,r.importFromChromeTimeline)(C.parseAsJSON(),c);if(c.endsWith(".stackprof.json"))returnconsole.log("Importing as stackprof profile"),v((0,e.importFromStackprof)(C.parseAsJSON()));if(c.endsWith(".instruments.txt"))returnconsole.log("Importing as Instruments.app deep copy"),v((0,o.importFromInstrumentsDeepCopy)(C));if(c.endsWith(".linux-perf.txt"))returnconsole.log("Importing as output of linux perf script"),(0,l.importFromLinuxPerf)(C);if(c.endsWith(".collapsedstack.txt"))returnconsole.log("Importing as collapsed stack format"),v((0,i.importFromBGFlameGraph)(C));if(c.endsWith(".v8log.json"))returnconsole.log("Importing as --prof-process v8 log"),v((0,s.importFromV8ProfLog)(C.parseAsJSON()));if(c.endsWith(".heapprofile"))returnconsole.log("Importing as Chrome Heap Profile"),v((0,u.importFromChromeHeapProfile)(C.parseAsJSON()));if(c.endsWith("-recording.json"))returnconsole.log("Importing as Safari profile"),v((0,p.importFromSafari)(C.parseAsJSON()));if(c.startsWith("callgrind."))returnconsole.log("Importing as Callgrind profile"),(0,g.importFromCallgrind)(C,c);letI;try{I=C.parseAsJSON()}catch(x){}if(I){if("https://www.speedscope.app/file-format-schema.json"===I.$schema)returnconsole.log("Importing as speedscope json file"),(0,n.importSpeedscopeProfiles)(I);if(I.systemHost&&"Firefox"==I.systemHost.name)returnconsole.log("Importing as Firefox profile"),v((0,t.importFromFirefox)(I));if((0,r.isChromeTimeline)(I))returnconsole.log("Importing as Chrome Timeline"),(0,r.importFromChromeTimeline)(I,c);if((0,r.isChromeTimelineObject)(I))returnconsole.log("Importing as Chrome Timeline Object"),(0,r.importFromChromeTimeline)(I.traceEvents,c);if("nodes"inI&&"samples"inI&&"timeDeltas"