@kylincloud/flamegraph 0.35.19 → 0.35.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +3 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.node.cjs.js +1 -1
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.esm.js +1 -1
- package/dist/index.node.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/FlameGraph/FlameGraphComponent/DiffLegendPaletteDropdown.tsx +1 -1
- package/src/SharedQueryInput.module.scss +20 -14
package/dist/index.node.esm.js
CHANGED
|
@@ -14,5 +14,5 @@ function V(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n
|
|
|
14
14
|
Copyright (c) 2018 Jed Watson.
|
|
15
15
|
Licensed under the MIT License (MIT), see
|
|
16
16
|
http://jedwatson.github.io/classnames
|
|
17
|
-
*/var ws,xs=(bs||(bs=1,function(e){!function(){var t={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=r(e,a(n)))}return e}function a(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var a="";for(var i in e)t.call(e,i)&&e[i]&&(a=r(a,i));return a}function r(e,t){return t?e?e+" "+t:e+t:e}e.exports?(n.default=n,e.exports=n):window.classNames=n}()}(ys)),ys.exports),ks=D(xs),Ns={};function Ss(){return ws||(ws=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="chevron-left",n=[9001],a="f053",r="M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z";e.definition={prefix:"fas",iconName:t,icon:[320,512,n,a,r]},e.faChevronLeft=e.definition,e.prefix="fas",e.iconName=t,e.width=320,e.height=512,e.ligatures=n,e.unicode=a,e.svgPathData=r,e.aliases=n}(Ns)),Ns}var Ts,Cs=Ss(),_s={};function Rs(){return Ts||(Ts=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="chevron-right",n=[9002],a="f054",r="M311.1 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L243.2 256 73.9 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z";e.definition={prefix:"fas",iconName:t,icon:[320,512,n,a,r]},e.faChevronRight=e.definition,e.prefix="fas",e.iconName=t,e.width=320,e.height=512,e.ligatures=n,e.unicode=a,e.svgPathData=r,e.aliases=n}(_s)),_s}var Ps=Rs(),Ms={table:"Table-module_table__6A8SM",sortable:"Table-module_sortable__J6kyp",sortArrow:"Table-module_sortArrow__Nrncn",asc:"Table-module_asc__tJDI9",desc:"Table-module_desc__fjVRY",isRowSelected:"Table-module_isRowSelected__UhIAJ",isRowDisabled:"Table-module_isRowDisabled__sz3NJ",loadingSpinner:"Table-module_loadingSpinner__SSjMK",pagination:"Table-module_pagination__VXgcO"},Is="Button-module_button__Ed1ge",Es="Button-module_noIcon__Uzjvv",js="Button-module_noBox__mLreC",Fs="Button-module_customIcon__-slpC",As="Button-module_iconWithText__DQRkr",Ds="Button-module_default__HhXlQ",Os="Button-module_outline__Flf4r",Ls="Button-module_float__4marx",Bs="Button-module_primary__xByv0",zs="Button-module_secondary__D0K-F",$s="Button-module_danger__5-vIq",Vs="Button-module_grouped__j8KwB";const Hs=a.forwardRef(function({disabled:n=!1,kind:a="default",type:r="button",icon:i,iconNode:o,children:s,grouped:l,onClick:c,id:f,className:u,form:d,noBox:h,autoFocus:m,...p},g){return t("button",{...p,id:f,ref:g,type:r,"data-testid":p["data-testid"],disabled:n,onClick:c,form:d,autoFocus:m,"aria-label":p["aria-label"],className:ks(Is,l?Vs:"",Ws(a),u,h&&js,o&&Fs,!i&&!o&&Es),children:[i?e(gr,{icon:i,className:s?As:""}):null,o,s]})});function Ws(e){switch(e){case"default":return Ds;case"primary":return Bs;case"secondary":return zs;case"danger":return $s;case"outline":return Os;case"float":return Ls;default:throw Error(`Unsupported kind ${e}`)}}function Us({sortByDirection:a,sortBy:r,updateSortParams:i,table:o,tableBodyRef:s,className:c,isLoading:f,itemsPerPage:u}){const d=a&&r&&i,[h,m]=l(0);return f?e("div",{className:Ms.loadingSpinner}):t(n,{children:[t("table",{className:si(Ms.table,{[c||""]:c}),"data-testid":"table-ui",children:[e("thead",{children:e("tr",{children:o.headRow.map(({sortable:t,label:n,name:s,...l},c)=>t&&"not-filled"!==o.type&&d?w("th",{...l,key:c,className:Ms.sortable,onClick:()=>i(s)},n,e("span",{className:si(Ms.sortArrow,{[Ms[a]]:r===s})})):e("th",{...l,children:n},c))})}),e("tbody",{ref:s,children:"not-filled"===o.type?e("tr",{className:null==o?void 0:o.bodyClassName,children:e("td",{colSpan:o.headRow.length,children:o.value})}):Qs(o.bodyRows,h,u).map(({cells:t,isRowSelected:n,isRowDisabled:a,className:r,...i})=>{const o=Math.random();return e("tr",{...i,className:si(r,{[Ms.isRowSelected]:n,[Ms.isRowDisabled]:a}),children:t&&t.map(({style:t,value:n,...a},r)=>e("td",{style:t,...a,children:n},o+r))},o)})})]}),e(Js,{bodyRows:"filled"===o.type?o.bodyRows:void 0,itemsPerPage:u,currPage:h,setCurrPage:m})]})}function Qs(e,t,n){return n?e.slice(t*n,n*(t+1)):e}function Js({itemsPerPage:n,currPage:a,setCurrPage:r,bodyRows:i}){if(!n)return null;const o=!!i&&Qs(i,a+1,n).length>0,s=!!i&&Qs(i,a-1,n).length>0;return t("nav",{className:Ms.pagination,children:[e(Hs,{"aria-label":"Previous Page",disabled:!s,kind:"float",icon:Cs.faChevronLeft,onClick:()=>r(a-1)}),e(Hs,{disabled:!o,"aria-label":"Next Page",kind:"float",icon:Ps.faChevronRight,onClick:()=>r(a+1)})]})}function Xs({numTicks:t,sampleRate:n,units:a,tableBodyRef:r,palette:i}){const o=Br(t,n,a),s=o.format(t,n),l=Wo(),c=f((e,t,r)=>{var c;const f=null===(c=r.target.closest("tr"))||void 0===c?void 0:c.dataset.row;if(!f)return void t();const[u,d,...h]=f.split(";");switch(u){case"single":{const[t,r]=h,i=o.format(parseInt(t,10),n),l=o.format(parseInt(r,10),n),c=s.split(" "),f="<"===c[0]?c[1]:c[0],u=i.split(" "),m="<"===u[0]?u[1]:u[0],p=l.split(" "),g="<"===p[0]?p[1]:p[0];e({title:{text:d,diff:{text:"",color:""}},tooltipData:[{units:a,self:`${i}(${(parseFloat(m)/parseFloat(f)*100).toFixed(2)}%)`,total:`${l}(${(parseFloat(g)/parseFloat(f)*100).toFixed(2)}%)`,tooltipType:"table"}]});break}case"double":{const[t,r,s,c]=h,f=qo({formatter:o,sampleRate:n,totalLeft:parseInt(t,10),leftTicks:parseInt(r,10),totalRight:parseInt(s,10),rightTicks:parseInt(c,10),title:d,units:a},i,l);e({title:f.title,tooltipData:f.tooltipData});break}}},[o,n,a,s,i,l]);return e(Yo,{dataSourceRef:r,shouldShowTitle:!1,clickInfoSide:"left",setTooltipContent:c,palette:i})}const Ys=e=>e||0;function Zs(e,t,n,a){const r=t;return r.type="single",r.self=Ys(r.self)+e.getBarSelf(n,a),r.total=Ys(r.total)+e.getBarTotal(n,a),r}function Ks(e,t,n,a,r,i){const o=t;return o.type="double",o.self=Ys(o.self)+e.getBarSelf(n,a),o.total=Ys(o.total)+e.getBarTotal(n,a),o.selfLeft=Ys(o.selfLeft)+e.getBarSelfLeft(n,a),o.selfRght=Ys(o.selfRght)+e.getBarSelfRght(n,a),o.selfDiff=Ys(o.selfDiff)+e.getBarSelfDiff(n,a),o.totalLeft=Ys(o.totalLeft)+e.getBarTotalLeft(n,a),o.totalRght=Ys(o.totalRght)+e.getBarTotalRght(n,a),o.totalDiff=Ys(o.totalDiff)+e.getBarTotalDiff(n,a),o.leftTicks=r,o.rightTicks=i,o}function Gs(e,t,n){const a=148-e/t*148,r=n.alpha(1);return{backgroundImage:`linear-gradient(${r}, ${r})`,backgroundPosition:`-${a}px 0px`,backgroundRepeat:"no-repeat"}}const qs=({flamebearer:t,sortBy:n,sortByDirection:a,fitMode:r,handleTableItemClick:i,highlightQuery:o,palette:s,selectedItem:l,messages:c})=>{const{numTicks:f,maxSelf:u,sampleRate:d,spyName:h,units:m}=t,p=function(e){if(!e)return[];const{names:t,levels:n,format:a}=e,r="double"!==a?Tr:Cr,i=new Map;for(let o=0;o<n.length;o++){const s=n[o];for(let n=0;n<s.length;n+=r.jStep){const o=t[r.getBarName(s,n)];i.has(o)||i.set(o,{name:o||"<empty>",self:0,total:0});const l=i.get(o);if(!l)break;"single"===a?Zs(Tr,l,s,n):Ks(Cr,l,s,n,e.leftTicks,e.rightTicks)}}return Array.from(i.values())}(t).sort((e,t)=>t.total-e.total),g="asc"===a?1:-1;let v;if("name"===n)v=p.sort((e,t)=>g*e[n].localeCompare(t[n]));else switch(n){case"total":case"self":v=p.sort((e,t)=>g*(e[n]-t[n]));break;case"baseline":v=p.sort((e,t)=>g*(e.totalLeft/e.leftTicks-t.totalLeft/t.leftTicks));break;case"comparison":v=p.sort((e,t)=>g*(e.totalRght/e.rightTicks-t.totalRght/t.rightTicks));break;case"diff":v=p.sort((e,t)=>{const n=Lr(Or(e.totalLeft/e.leftTicks),Or(e.totalRght/e.rightTicks)),a=Lr(Or(t.totalLeft/t.leftTicks),Or(t.totalRght/t.rightTicks));return g*(n-a)});break;default:v=p}const b=Br(f,d,m),y=e=>!!l.isJust&&e===l.value,w=t=>{return e("button",{className:"table-item-button",children:e("div",{className:"symbol-name",style:(n=r,n===Wr?{direction:"rtl",overflow:"hidden",textOverflow:"ellipsis"}:{overflow:"hidden",textOverflow:"ellipsis"}),children:t.name})});var n},x=v.filter(e=>!o||Kr(o,e.name)).map(e=>{if("double"===e.type)return(e=>{const t=Or(e.totalLeft/e.leftTicks),n=Or(e.totalRght/e.rightTicks),a=Lr(t,n);let r="";a>0?r=s.badColor.rgb().string():a<0&&(r=s.goodColor.rgb().string());let o="";return e.totalLeft&&a!==1/0?e.totalRght?a>0?o=`+${a.toFixed(2)}%`:a<0&&(o=`${a.toFixed(2)}%`):o=c.diffRemoved:o=c.diffNew,{"data-row":`${e.type};${e.name};${e.totalLeft};${e.leftTicks};${e.totalRght};${e.rightTicks}`,isRowSelected:y(e.name),onClick:()=>i(e),cells:[{value:w(e)},{value:`${t} %`},{value:`${n} %`},{value:o,style:{color:r}}]}})(e);const t=Xr(h,e.name);return((e,t)=>({"data-row":`${e.type};${e.name};${e.self};${e.total}`,isRowSelected:y(e.name),onClick:()=>i(e),cells:[{value:w(e)},{value:b.format(e.self,d),style:Gs(e.self,u,t)},{value:b.format(e.total,d),style:Gs(e.total,f,t)}]}))(e,Yr(s,t))});return x.length>0?{bodyRows:x,type:"filled"}:{value:e("div",{className:"unsupported-format",children:c.noItemsFound}),type:"not-filled"}};function el({tableBodyRef:t,flamebearer:n,isDoubles:r,fitMode:i,handleTableItemClick:o,highlightQuery:s,selectedItem:c,palette:f}){const u=Wo(),d=a.useMemo(()=>r?[{sortable:1,name:"name",label:u.location},{sortable:1,name:"baseline",label:u.baseline,default:!0},{sortable:1,name:"comparison",label:u.comparison},{sortable:1,name:"diff",label:u.diff}]:[{sortable:1,name:"name",label:u.location},{sortable:1,name:"self",label:u.self,default:!0},{sortable:1,name:"total",label:u.total}],[u,r]),h=(e=>{const t=e.filter(e=>null==e?void 0:e.default)[0]||e[0],[n,a]=l(t.name),[r,i]=l("desc");return{sortBy:n,sortByDirection:r,updateSortParams:e=>{let t=r;t=n===e?"asc"===t?"desc":"asc":"desc",a(e),i(t)}}})(d),m={headRow:d,...qs({flamebearer:n,sortBy:h.sortBy,sortByDirection:h.sortByDirection,fitMode:i,handleTableItemClick:o,highlightQuery:s,palette:f,selectedItem:c,messages:u})};return e(Us,{...h,tableBodyRef:t,table:m,className:ks("flamegraph-table",{"flamegraph-table-doubles":r})})}const tl=a.memo(function({flamebearer:n,fitMode:a,handleTableItemClick:r,highlightQuery:i,palette:o,selectedItem:s}){const l=c(null),f="double"===n.format;return t("div",{"data-testid":"table-view",className:f?"flamegraph-table-wrapper flamegraph-table-wrapper--double":"flamegraph-table-wrapper",children:[e("div",{className:"flamegraph-table-scroll",children:e(el,{tableBodyRef:l,flamebearer:n,isDoubles:f,fitMode:a,highlightQuery:i,handleTableItemClick:r,palette:o,selectedItem:s})}),e(Xs,{tableBodyRef:l,numTicks:n.numTicks,sampleRate:n.sampleRate,units:n.units,palette:o})]})});var nl,al,rl={},il={};function ol(){return nl||(nl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="arrow-rotate-left",n=[8634,"arrow-left-rotate","arrow-rotate-back","arrow-rotate-backward","undo"],a="f0e2",r="M256 64c-56.8 0-107.9 24.7-143.1 64l47.1 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 192c-17.7 0-32-14.3-32-32L0 32C0 14.3 14.3 0 32 0S64 14.3 64 32l0 54.7C110.9 33.6 179.5 0 256 0 397.4 0 512 114.6 512 256S397.4 512 256 512c-87 0-163.9-43.4-210.1-109.7-10.1-14.5-6.6-34.4 7.9-44.6s34.4-6.6 44.6 7.9c34.8 49.8 92.4 82.3 157.6 82.3 106 0 192-86 192-192S362 64 256 64z";e.definition={prefix:"fas",iconName:t,icon:[512,512,n,a,r]},e.faArrowRotateLeft=e.definition,e.prefix="fas",e.iconName=t,e.width=512,e.height=512,e.ligatures=n,e.unicode=a,e.svgPathData=r,e.aliases=n}(il)),il}function sl(){return al||(al=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=ol();e.definition={prefix:t.prefix,iconName:t.iconName,icon:[t.width,t.height,t.aliases,t.unicode,t.svgPathData]},e.faUndo=e.definition,e.prefix=t.prefix,e.iconName=t.iconName,e.width=t.width,e.height=t.height,e.ligatures=t.aliases,e.unicode=t.unicode,e.svgPathData=t.svgPathData,e.aliases=t.aliases}(rl)),rl}var ll,cl,fl=sl(),ul={},dl={};function hl(){return ll||(ll=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="diagram-project",n=["project-diagram"],a="f542",r="M0 80C0 53.5 21.5 32 48 32l96 0c26.5 0 48 21.5 48 48l0 16 128 0 0-16c0-26.5 21.5-48 48-48l96 0c26.5 0 48 21.5 48 48l0 96c0 26.5-21.5 48-48 48l-96 0c-26.5 0-48-21.5-48-48l0-16-128 0 0 16c0 7.3-1.7 14.3-4.6 20.5l68.6 91.5 80 0c26.5 0 48 21.5 48 48l0 96c0 26.5-21.5 48-48 48l-96 0c-26.5 0-48-21.5-48-48l0-96c0-7.3 1.7-14.3 4.6-20.5L128 224 48 224c-26.5 0-48-21.5-48-48L0 80z";e.definition={prefix:"fas",iconName:t,icon:[512,512,n,a,r]},e.faDiagramProject=e.definition,e.prefix="fas",e.iconName=t,e.width=512,e.height=512,e.ligatures=n,e.unicode=a,e.svgPathData=r,e.aliases=n}(dl)),dl}function ml(){return cl||(cl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=hl();e.definition={prefix:t.prefix,iconName:t.iconName,icon:[t.width,t.height,t.aliases,t.unicode,t.svgPathData]},e.faProjectDiagram=e.definition,e.prefix=t.prefix,e.iconName=t.iconName,e.width=t.width,e.height=t.height,e.ligatures=t.aliases,e.unicode=t.unicode,e.svgPathData=t.svgPathData,e.aliases=t.aliases}(ul)),ul}var pl,gl,vl=ml(),bl={},yl={};function wl(){return pl||(pl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="ellipsis-vertical",n=["ellipsis-v"],a="f142",r="M64 144a56 56 0 1 1 0-112 56 56 0 1 1 0 112zm0 224c30.9 0 56 25.1 56 56s-25.1 56-56 56-56-25.1-56-56 25.1-56 56-56zm56-112c0 30.9-25.1 56-56 56s-56-25.1-56-56 25.1-56 56-56 56 25.1 56 56z";e.definition={prefix:"fas",iconName:t,icon:[128,512,n,a,r]},e.faEllipsisVertical=e.definition,e.prefix="fas",e.iconName=t,e.width=128,e.height=512,e.ligatures=n,e.unicode=a,e.svgPathData=r,e.aliases=n}(yl)),yl}function xl(){return gl||(gl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=wl();e.definition={prefix:t.prefix,iconName:t.iconName,icon:[t.width,t.height,t.aliases,t.unicode,t.svgPathData]},e.faEllipsisV=e.definition,e.prefix=t.prefix,e.iconName=t.iconName,e.width=t.width,e.height=t.height,e.ligatures=t.aliases,e.unicode=t.unicode,e.svgPathData=t.svgPathData,e.aliases=t.aliases}(bl)),bl}var kl=xl();function Nl(e){if(null!=e&&!1!==e){if("string"==typeof e||"number"==typeof e)return String(e);if(Array.isArray(e)){const t=e.map(e=>Nl(e)).filter(e=>!!e);return t.length?t.join(" "):void 0}return a.isValidElement(e)?Nl(e.props.children):void 0}}const Sl=({placement:t,title:a,content:r,children:i})=>{const o=Nl(null!=a?a:r);return o?e("span",{title:o,children:i}):e(n,{children:i})};var Tl,Cl={};function _l(){return Tl||(Tl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="link",n=[128279,"chain"],a="f0c1",r="M419.5 96c-16.6 0-32.7 4.5-46.8 12.7-15.8-16-34.2-29.4-54.5-39.5 28.2-24 64.1-37.2 101.3-37.2 86.4 0 156.5 70 156.5 156.5 0 41.5-16.5 81.3-45.8 110.6l-71.1 71.1c-29.3 29.3-69.1 45.8-110.6 45.8-86.4 0-156.5-70-156.5-156.5 0-1.5 0-3 .1-4.5 .5-17.7 15.2-31.6 32.9-31.1s31.6 15.2 31.1 32.9c0 .9 0 1.8 0 2.6 0 51.1 41.4 92.5 92.5 92.5 24.5 0 48-9.7 65.4-27.1l71.1-71.1c17.3-17.3 27.1-40.9 27.1-65.4 0-51.1-41.4-92.5-92.5-92.5zM275.2 173.3c-1.9-.8-3.8-1.9-5.5-3.1-12.6-6.5-27-10.2-42.1-10.2-24.5 0-48 9.7-65.4 27.1L91.1 258.2c-17.3 17.3-27.1 40.9-27.1 65.4 0 51.1 41.4 92.5 92.5 92.5 16.5 0 32.6-4.4 46.7-12.6 15.8 16 34.2 29.4 54.6 39.5-28.2 23.9-64 37.2-101.3 37.2-86.4 0-156.5-70-156.5-156.5 0-41.5 16.5-81.3 45.8-110.6l71.1-71.1c29.3-29.3 69.1-45.8 110.6-45.8 86.6 0 156.5 70.6 156.5 156.9 0 1.3 0 2.6 0 3.9-.4 17.7-15.1 31.6-32.8 31.2s-31.6-15.1-31.2-32.8c0-.8 0-1.5 0-2.3 0-33.7-18-63.3-44.8-79.6z";e.definition={prefix:"fas",iconName:t,icon:[576,512,n,a,r]},e.faLink=e.definition,e.prefix="fas",e.iconName=t,e.width=576,e.height=512,e.ligatures=n,e.unicode=a,e.svgPathData=r,e.aliases=n}(Cl)),Cl}var Rl=_l(),Pl="Input-module_input__ulQdV";const Ml=a.forwardRef(({testId:t,className:n,type:a,name:r,placeholder:i,minLength:o=0,debounceTimeout:s=100,onChange:l,value:c,htmlId:f},u)=>e(E,{inputRef:u,"data-testid":t,className:`${Pl} ${n||""}`,type:a,name:r,placeholder:i,minLength:o,debounceTimeout:s,onChange:l,value:c,id:f}));var Il="SharedQueryInput-module_wrapper__XRxrd",El="SharedQueryInput-module_search__XlzRv",jl="SharedQueryInput-module_search-synced__J4T4b",Fl="SharedQueryInput-module_searchWithSync__ryuQa",Al="SharedQueryInput-module_icon__Aq0Hv",Dl="SharedQueryInput-module_checked__oRvod",Ol="SharedQueryInput-module_sync__0IO2N",Ll="SharedQueryInput-module_syncSelected__hstBI";const Bl=({onHighlightChange:n,highlightQuery:a,sharedQuery:r,width:o})=>{const s=Wo(),l=(e=>{const t=c();return d(()=>{t.current=e},[e]),t.current})(null==r?void 0:r.syncEnabled);d(()=>{"string"==typeof(null==r?void 0:r.searchQuery)&&(r.syncEnabled&&n(r.searchQuery),!r.syncEnabled&&l&&l!==(null==r?void 0:r.id)&&n(""))},[null==r?void 0:r.searchQuery,null==r?void 0:r.syncEnabled]);const f=i(()=>r&&r.syncEnabled?r.searchQuery||"":a,[r,a]),u=i(()=>`${r?Fl:El} ${(null==r?void 0:r.syncEnabled)?jl:""}`,[r]),h=(null==r?void 0:r.syncEnabled)?s.unsyncSearchBars:s.syncSearchBars;return t("div",{className:Il,style:{width:o},children:[e(Ml,{testId:"flamegraph-search",className:u,type:"search",name:"flamegraph-search",placeholder:s.searchPlaceholder,minLength:1,debounceTimeout:100,onChange:e=>{n(e.target.value),r&&r.syncEnabled&&r.onQueryChange(e.target.value)},value:f}),r?e(Sl,{placement:"top",title:h,children:e("button",{className:r.syncEnabled?Ll:Ol,onClick:()=>{const e=!(null==r?void 0:r.syncEnabled)&&(null==r?void 0:r.id);null==r||r.toggleSync(e),e?null==r||r.onQueryChange(a):(n(a),null==r||r.onQueryChange(""))},children:e(gr,{className:`${r.syncEnabled?Dl:Al}`,icon:Rl.faLink})})}):null]})};var zl="DiffLegend-module_flamegraph-legend__Cywr1",$l="DiffLegend-module_flamegraph-legend-list__swdXj",Vl="DiffLegend-module_flamegraph-legend-item__0P-6g";function Hl(n){const{palette:a,showMode:r}=n,i=function(e){switch(e){case"large":return[-100,-80,-60,-40,-20,-10,0,10,20,40,60,80,100];case"small":return[-100,-40,-20,0,20,40,100];default:throw new Error(`Unsupported ${e}`)}}(r),o=Zr(a);return e("div",{"data-testid":"flamegraph-legend",className:`${zl} ${$l}`,children:i.map(e=>t("div",{className:Vl,style:{backgroundColor:o(e).rgb().toString()},children:[e>0?"+":"",e,"%"]},e))})}function Wl(){return e("svg",{version:"1.1",id:"Capa_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",width:"12px",height:"12px",viewBox:"0 0 405.272 405.272",children:e("g",{children:e("path",{d:"M393.401,124.425L179.603,338.208c-15.832,15.835-41.514,15.835-57.361,0L11.878,227.836\n\n\t\tc-15.838-15.835-15.838-41.52,0-57.358c15.841-15.841,41.521-15.841,57.355-0.006l81.698,81.699L336.037,67.064\n\n\t\tc15.841-15.841,41.523-15.829,57.358,0C409.23,82.902,409.23,108.578,393.401,124.425z"})})})}var Ul="Dropdown-module_dropdownMenu__tbN8r",Ql="Dropdown-module_dropdownMenuButton__Xy8M4";function Jl({id:n,children:a,className:r,disabled:i,value:o,label:s,onItemClick:l,overflow:c,position:f,direction:u,align:d,viewScroll:h,arrow:m,menuButtonClassName:p="",ariaLabel:g,portal:v,...b}){const y=b.menuButton||e(Yl,{"aria-label":g,className:`${Ql} ${p}`,disabled:i,type:"button",children:o||s});return t(So,{id:n,"aria-label":g,className:ks(r,Ul),"data-testid":b["data-testid"],onItemClick:l,overflow:c,position:f,direction:u,align:d,viewScroll:h,arrow:m,menuButton:y,portal:v,children:[e(Ro,{children:s}),a]})}const Xl=_o,Yl=ro;var Zl="DiffLegendPaletteDropdown-module_container__h8Tts",Kl="DiffLegendPaletteDropdown-module_triggerButton__oezA6",Gl="DiffLegendPaletteDropdown-module_dropdownArrow__-Lu0w",ql="DiffLegendPaletteDropdown-module_menuItem__5iWry",ec="DiffLegendPaletteDropdown-module_menuItemText__a-tt0";const tc=[Ao,Do],nc=n=>{const{palette:a=Ao,onChange:r}=n,i=Wo(),o=e=>"Default"===e.name?i.paletteDefaultName:"Color Blind"===e.name?i.paletteColorBlindName:e.name,s=e=>"Default"===e.name?i.paletteDefaultDesc:"Color Blind"===e.name?i.paletteColorBlindDesc:"";return e("div",{className:Zl,children:e(Jl,{label:i.diffLegendSelectPalette,align:"end",menuButton:t(Yl,{className:ks(Ql,Kl),children:[e(Hl,{palette:a,showMode:"small"}),e("span",{className:Gl,children:"▼"})]}),onItemClick:e=>{e.value&&r(e.value)},children:tc.map(n=>e(Xl,{value:n,children:t("div",{className:ql,children:[t("span",{className:ec,children:[o(n)," ",s(n)]}),n.name===a.name&&e(Wl,{})]})},n.name))})})};var ac={navbar:"Toolbar-module_navbar__XN6xZ",searchWrapper:"Toolbar-module_searchWrapper__k--ua",rightSection:"Toolbar-module_rightSection__if7LO",viewType:"Toolbar-module_viewType__AKARg",toggleViewButton:"Toolbar-module_toggleViewButton__OQ9-U",fitModeButton:"Toolbar-module_fitModeButton__jOxve",selected:"Toolbar-module_selected__vwBQt",collapseNodeButton:"Toolbar-module_collapseNodeButton__bLdiw",resetViewButton:"Toolbar-module_resetViewButton__y2ebV",divider:"Toolbar-module_divider__dG6pE",itemsContainer:"Toolbar-module_itemsContainer__gSTMF",item:"Toolbar-module_item__o-hKc",moreButton:"Toolbar-module_moreButton__rhOdT",active:"Toolbar-module_active__36Kt-",navbarCollapsedItems:"Toolbar-module_navbarCollapsedItems__vojhw"};const rc=$.bind(ac),ic=(e,t,n)=>{const a=0===t?e-360-5:e-360-16-5;let r=0,i=0;return n.reverse().forEach(e=>{i+=e,a<=i&&(r+=1)}),r},oc=()=>e("div",{className:ac.divider}),sc=y(({view:a,handleSearchChange:r,highlightQuery:i,isFlamegraphDirty:o,reset:s,updateFitMode:f,fitMode:d,updateView:h,selectedNode:m,onFocusOnSubtree:p,flamegraphType:g,enableChangingDisplay:v=!0,sharedQuery:b,ExportData:y,palette:w,setPalette:k})=>{const N=c(null),S=Wo(),T="double"===g&&w&&k,C=[{el:t(n,{children:[e(fc,{fitMode:d,updateFitMode:f}),e(oc,{})]}),width:93},{el:e(cc,{isFlamegraphDirty:o,reset:s}),width:44},{el:t(n,{children:[e(lc,{selectedNode:m,onFocusOnSubtree:p}),e(oc,{})]}),width:49},v?{el:e(dc,{flamegraphType:g,view:a,updateView:h}),width:44*("single"===g?5:3)}:null,x(y)?{el:t(n,{children:[e(oc,{}),y]}),width:49}:null].filter(e=>null!==e),R=C.reduce((e,t)=>[...e,t.width],[]),{isCollapsed:P,collapsedItemsNumber:M,handleMoreClick:I}=((e,t)=>{const[n,a]=l(!0),[r,i]=l(0);return u(()=>{if(e.current){const{width:n}=e.current.getBoundingClientRect(),a=ic(n,r,t);i(a)}},[e.current,t]),_(e,e=>{const{width:n}=e.target.getBoundingClientRect(),o=ic(n,r,t);i(o),a(!0)}),{isCollapsed:n,handleMoreClick:()=>{a(e=>!e)},collapsedItemsNumber:r}})(N,R),E=C.reduce((e,t,n)=>(n<M?e.hidden.push(t):e.visible.push(t),e),{visible:[],hidden:[]});return e("div",{role:"toolbar",ref:N,children:t("div",{className:ac.navbar,children:[e("div",{className:ac.searchWrapper,children:e(Bl,{width:360,onHighlightChange:r,highlightQuery:i,sharedQuery:b})}),t("div",{className:ac.rightSection,children:[T&&t(n,{children:[e(nc,{palette:w,onChange:k}),e(oc,{})]}),t("div",{className:ac.itemsContainer,children:[E.visible.map((t,n)=>e("div",{className:ac.item,style:{width:t.width},children:t.el},n)),0!==M&&e(Sl,{placement:"top",title:S.more,children:e("button",{onClick:I,className:rc({[ac.moreButton]:!0,[ac.active]:!P}),children:e(gr,{icon:kl.faEllipsisV})})})]})]}),!P&&e("div",{className:ac.navbarCollapsedItems,children:E.hidden.map((t,n)=>e("div",{className:ac.item,style:{width:t.width},children:t.el},n))})]})})});function lc({onFocusOnSubtree:t,selectedNode:n}){const a=Wo(),r=n.mapOr(()=>{},e=>()=>t(e.i,e.j));return e(Sl,{placement:"top",title:a.collapseNodesAbove,children:e("div",{children:e(Hs,{disabled:!n.isJust,onClick:r,className:ac.collapseNodeButton,"aria-label":a.collapseNodesAbove,children:e(gr,{icon:Ii.faCompressAlt})})})})}function cc({isFlamegraphDirty:t,reset:n}){const a=Wo();return e(Sl,{placement:"top",title:a.resetView,children:e("span",{children:e(Hs,{id:"reset",disabled:!t,onClick:n,className:ac.resetViewButton,"aria-label":a.resetView,children:e(gr,{icon:fl.faUndo})})})})}function fc({fitMode:a,updateFitMode:r}){const i=Wo(),o=e=>a===e;return t(n,{children:[e(Sl,{placement:"top",title:i.headFirst,children:e(Hs,{onClick:()=>r("HEAD"),className:rc({[ac.fitModeButton]:!0,[ac.selected]:o("HEAD")}),children:e(ls,{})})}),e(Sl,{placement:"top",title:i.tailFirst,children:e(Hs,{onClick:()=>r("TAIL"),className:rc({[ac.fitModeButton]:!0,[ac.selected]:o("TAIL")}),children:e(cs,{})})})]})}const uc=(t,n)=>"single"===t?[{label:n.viewTable,value:"table",Icon:rs},{label:n.viewTableAndFlamegraph,value:"both",Icon:is},{label:n.viewFlamegraph,value:"flamegraph",Icon:os},{label:n.viewSandwich,value:"sandwich",Icon:ss},{label:n.viewGraphviz,value:"graphviz",Icon:()=>e(gr,{icon:vl.faProjectDiagram})}]:[{label:n.viewTable,value:"table",Icon:rs},{label:n.viewTableAndFlamegraph,value:"both",Icon:is},{label:n.viewFlamegraph,value:"flamegraph",Icon:os}];function dc({view:t,updateView:n,flamegraphType:a}){const r=Wo(),i=uc(a,r);return e("div",{className:ac.viewType,children:i.map(({label:a,value:r,Icon:i})=>e(Sl,{placement:"top",title:a,children:e(Hs,{"data-testid":r,onClick:()=>n(r),className:rc({[ac.toggleViewButton]:!0,selected:t===r}),children:e(i,{})})},r))})}function hc(e,t){const n={},a={};let r={name:"total",children:[],self:[],total:[],key:"/total"};return(t?[e,t]:[e]).forEach((e,t)=>{var i,o;for(let s=0;s<e.levels.length;s+=1)for(let l=0;l<e.levels[s].length;l+=4){const c=[t,s,l].join("/"),f=e.names[e.levels[s][l+3]],u=e.levels[s][l+0],d=e.levels[s][l+1],h=e.levels[s][l+2];let m="";if(0!==s){const n=s-1,r=e.levels[n];for(let e=0;e<r.length;e+=4){const i=r[e+0],o=r[e+1];if(u>=i&&u<i+o){const r=[t,n,e].join("/");m=a[r].key;break}}}const p=[m||"",f].join("/"),g=!n[p];n[p]||(n[p]={name:f,children:[],self:[],total:[],key:p});const v=n[p];(i=v.total)[t]||(i[t]=0),v.total[t]+=d,(o=v.self)[t]||(o[t]=0),v.self[t]+=h,a[c]=v,m&&g&&n[m].children.push(v),0===s&&(r=v)}}),r}const mc=e=>{const t={maxSelf:100,names:[],levels:[]},n=(e,a,r)=>{var i;const{name:o,children:s,self:l,total:c,offset:f}=e;t.names.push(o),(i=t.levels)[a]||(i[a]=[]),t.maxSelf=Math.max(t.maxSelf,l[0]||0),t.levels[a]=t.levels[a].concat([r,c[0]||0,l[0]||0,t.names.length-1]);for(let e=0;e<s.length;e+=1){r+=n(s[e],a+1,r)}return f||c[0]||0};return n(e,0,0),t};function pc(e){const t=new Map;for(let n=0;n<e.children.length;n+=1)t.has(e.children[n].name)||t.set(e.children[n].name,e.children[n]);for(let n=0;n<e.children.length;n+=1){const a=e.children[n],r=t.get(e.children[n].name);r&&r!==a&&(r.total[0]+=a.total[0],r.self[0]+=a.self[0],r.children=r.children.concat(a.children))}e.children=Array.from(t.values());for(let t=0;t<e.children.length;t+=1)pc(e.children[t])}function gc(e,t){const n=function(e,t){const n=hc(e),a={format:"single",numTicks:0,maxSelf:100,sampleRate:100,names:[],levels:[],units:e.units,spyName:e.spyName},r={name:t,total:[],self:[0],children:[]},i=e=>{e.name===t&&(a.numTicks+=e.total[0],r.total=[a.numTicks],r.children=r.children.concat(e.children));for(let t=0;t<e.children.length;t+=1)i(e.children[t])};return i(n),pc(r),{...a,...mc(r)}}(JSON.parse(JSON.stringify(e)),t);return n}function vc(e,t){const n=function(e,t){const n=hc(e),a={format:"single",maxSelf:100,sampleRate:100,numTicks:0,names:[],levels:[],units:e.units,spyName:e.spyName},r=[],i=[],o={name:t,total:[0],self:[0],children:[]},s=(e,n=[])=>{const o=n.concat([{...e,children:[]}]);e.name===t&&(i.push(o),r.push(e.total[0]),a.numTicks+=e.total[0]);for(let t=0;t<e.children.length;t+=1)s(e.children[t],o)};s(n),i.forEach((e,t)=>{o.children.push(((e,t)=>{const n={};let a=n;return e.forEach(({name:e,...n})=>{const r={name:e,...n,total:[t]};a.children=[r],a=r}),n.children[0]})(e.reverse(),r[t]))}),pc(o);const l=mc(o);return l.levels=l.levels.reverse().slice(0,-1),{...a,...l}}(JSON.parse(JSON.stringify(e)),t);return n}var bc={flamegraphContainer:"FlamegraphRenderer-module_flamegraphContainer__-7FRV",createdBy:"FlamegraphRenderer-module_createdBy__rHAOT",horizontal:"FlamegraphRenderer-module_horizontal__zs7--",vertical:"FlamegraphRenderer-module_vertical__fRcHg",panesWrapper:"FlamegraphRenderer-module_panesWrapper__L-mlA",tablePane:"FlamegraphRenderer-module_tablePane__Gin7Y",sandwichPane:"FlamegraphRenderer-module_sandwichPane__IEOyR",sandwichPaneInfo:"FlamegraphRenderer-module_sandwichPaneInfo__5hT4a",arrow:"FlamegraphRenderer-module_arrow__dPzpE",sandwichTop:"FlamegraphRenderer-module_sandwichTop__7N0ZY",sandwichBottom:"FlamegraphRenderer-module_sandwichBottom__Dc64g",name:"FlamegraphRenderer-module_name__XRbN9"};function yc(e){const t=[];return Object.keys(e).forEach(n=>{var a;t.push(`${n}="${a=String(e[n]||""),a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`)}),`[${t.join(" ")}]`}function wc(e,t){return`${(100*e/t).toFixed(2)}%`}function xc(e,t){let n,a,r,i;t?(n=.1,a=.93):(n=1,a=.7),e=Math.max(-1,Math.min(1,e)),Math.abs(e)<.2&&(n*=Math.abs(e)/.2),e>0&&(e**=1-.7),e<0&&(e=-((-e)**(1-.7))),e<0?(i=a,r=a*(1+n*e)):(r=a,i=a*(1-n*e));const o=a*(1-n);return`#${Math.floor(255*r).toString(16).padStart(2,"0")}${Math.floor(255*i).toString(16).padStart(2,"0")}${Math.floor(255*o).toString(16).padStart(2,"0")}`}function kc(e,t,n,a){const{self:r}=t,{total:i}=t,o=t.name.replace(/"/g,'\\"'),s=e(r),l=8+Math.ceil(16*Math.sqrt(r/n)),c=xc(i/a,!1),f=xc(i/a,!0),u=function(e,t,n,a,r){let i="";i=`${function(e){return e.replace(/.*\//,"")}(t)}\n`;const o=e(n);0!==n?i=`${i+o} (${wc(n,r)})`:i+="0";let s=o;a!==n&&(i+=0!==n?"\n":" ",s=e(a),i=`${i}of ${s} (${wc(a,r)})`);return i}(e,o,r,i,a),d={label:u,id:`node${t.index}`,fontsize:l,shape:"box",tooltip:`${o} (${s})`,color:c,fontcolor:"#000000",style:"filled",fontname:"",fillcolor:f};return`N${t.index} ${yc(d)}`}function Nc(e){if("double"===e.metadata.format)return"diff flamegraphs are not supported";const t=hc(e.flamebearer),n=[],a=[];const[r,i,,o]=function e(t,n,a,r,i){return t.children.forEach(t=>{const[o,s]=e(t,n,a,r,i);n=Math.max(n,o),a=Math.max(a,s)}),n=Math.max(n,t.self[0]),a=Math.max(a,t.total[0]),r+=t.self[0],i+=t.total[0],[n,a,r,i]}(t,0,0,0,0),{sampleRate:s,units:l}=e.metadata,c=Br(i,s,l),f=e=>c.format(e,s,!0);let u={};const d={};let h=0;function m(e,t){return-1===t.indexOf(e.name)&&(u[e.name]?(u[e.name].self+=e.self[0],u[e.name].total+=e.total[0]):(h+=1,u[e.name]={index:h,name:e.name,self:e.self[0],total:e.total[0],parents:[],children:[]})),e.children.forEach(n=>{const a=m(n,t.concat([e.name])),r=`${e.name}/${n.name}`;n.name!==e.name&&(d[r]?d[r].weight+=n.total[0]:d[r]={from:u[e.name],to:a,weight:n.total[0],residual:!1},a.parents.push(d[r]),u[e.name].children.push(d[r]))}),u[e.name]}t.children.forEach(e=>{m(e,[])});const p=.005*o,g=.001*o;function v(e,t){let n=0,a=t;if(e.forEach(e=>{e.weight>0&&(a+=Math.abs(e.weight))}),0!==a&&(e.forEach(e=>{const t=Math.abs(e.weight)/a;n+=-t*Math.log2(t)}),t>0)){const e=Math.abs(t)/a;n+=-e*Math.log2(e)}return n}Object.keys(u).forEach(e=>{u[e].total<p&&delete u[e]});const b={};Object.keys(u).forEach(e=>{b[u[e].name]=function(e){let t=0;return 0===e.parents.length?t+=1:t+=v(e.parents,0),0===e.children.length?t+=1:t+=v(e.children,e.self),t*e.total+e.self}(u[e])});const y=Object.values(u).sort((e,t)=>{const n=b[e.name],a=b[t.name];return n!==a?a-n:e.name!==t.name?e.name<t.name?-1:1:e.self!==t.self?a-n:e.name<t.name?-1:1}),w={};function x(e){const[t,n]=[e.from,e.to],a={},r=[n];for(;r.length>0;){const n=r.shift();for(let i=0;i<n.parents.length;i+=1){const o=n.parents[i];if(e!==o&&!a[o.from.name]){if(o.from===t)return!0;a[o.from.name]=!0,r.push(o.from)}}}return!1}return y.forEach(e=>{w[e.name]=e}),y.slice(80).forEach(e=>{delete w[e.name]}),function e(t,n){const a=!w[t.name];t.children.forEach(r=>{const i=!w[r.name];if(e(r,a?n:t),!i&&n&&a){const e=`${n.name}/${r.name}`;d[e]||(d[e]={from:u[n.name],to:u[r.name],weight:0,residual:!0}),d[e].weight+=r.total[0],d[e].residual=!0}})}(t,null),u=w,y.reverse().forEach(e=>{const t=e.parents.sort((e,t)=>t.weight-e.weight),n=[];for(let e=0;e<t.length;e+=1){const a=t[e];if(!a.residual)break;x(a)&&(n.push(a),delete d[`${a.from.name}/${a.to.name}`])}n.forEach(e=>{e.from.children=e.from.children.filter(t=>t.to!==e.to),e.to.parents=e.to.parents.filter(t=>t.from!==e.from)})}),Object.keys(d).forEach(e=>{const t=d[e];u[t.from.name]||delete d[e],u[t.to.name]||delete d[e],t.weight<g&&delete d[e]}),Object.keys(u).forEach(e=>{n.push(kc(f,u[e],r,i))}),Object.keys(d).forEach(e=>{a.push(function(e,t,n){const a=t.from.name.replace(/"/g,'\\"'),r=t.to.name.replace(/"/g,'\\"'),i=t.weight,o=e(t.weight),s=`${a} -> ${r} (${o})`,l={label:o,weight:1+100*i/n,penwidth:1+5*i/n,tooltip:s,labeltooltip:s,fontname:"",color:xc(i/n,!1),style:t.residual?"dotted":""};return`N${t.from.index} -> N${t.to.index} ${yc(l)}`}(f,d[e],i))}),`digraph "unnamed" {\n fontname= ""\n ${n.join("\n")}\n ${a.join("\n")}\n }`}var Sc="GraphVizPanel-module_graphVizPane__B18cQ";const Tc=()=>null;function Cc({flamebearer:t}){var n,a;const r=t,o=(null===(n=r.metadata)||void 0===n?void 0:n.format)&&(null===(a=r.flamebearer)||void 0===a?void 0:a.levels),s=`graphviz-pane-${(null==r?void 0:r.appName)||String((new Date).valueOf())}`,l=i(()=>Nc(r),[JSON.stringify(r)]);return e("div",{className:Sc,children:o?e(Tc,{options:{zoom:!0,width:"150%",height:"100%",scale:1,useWorker:!1},dot:l}):e("div",{children:"NO DATA"})},s)}function _c(e,t){const n=[...t];function a(e,t,n){for(const a of e){let e=0;for(let r=t;r<a.length;r+=n)a[r]-=e,e+=a[r]+a[r+1]}}return"double"===e?(a(n,0,7),a(n,3,7)):a(n,0,4),n}function Rc(e,t){const n=[...t];function a(e,t,n){for(const a of e){let e=0;for(let r=t;r<a.length;r+=n)a[r]+=e,e=a[r]+a[r+1]}}return"double"===e?(a(n,0,7),a(n,3,7)):a(n,0,4),n}function Pc(e){if(e.profile&&e.flamebearer&&console.warn("'profile' and 'flamebearer' properties are mutually exclusive. Please use profile if possible."),e.profile){const n={...e.profile,flamebearer:{...e.profile.flamebearer}};n.flamebearer.levels=JSON.parse(JSON.stringify(n.flamebearer.levels)),(t=n).flamebearer.levels=Rc(t.metadata.format,t.flamebearer.levels);const a={...n,...n.metadata,...n.flamebearer,flamebearer:void 0,metadata:void 0};return delete a.flamebearer,delete a.metadata,a}var t;if(e.flamebearer)return e.flamebearer;return{format:"single",names:[],units:"unknown",levels:[[]],spyName:"unknown",numTicks:0,sampleRate:0,maxSelf:0}}class Mc extends k{constructor(n){super(n),this.resetFlamegraphState={focusedNode:N.nothing(),zoom:N.nothing()},this.initialFlamegraphState=this.resetFlamegraphState,this.calcNewConfigs=(e,t)=>{const n=this.state.flamegraphConfigs,a=(e,t,n)=>{const a=(e,t,n)=>e.names[_r(e.format).getBarName(e.levels[t],n)];if(n.isNothing)return!0;try{const r=n,i=a(e,r.value.i,r.value.j);return i===a(t,r.value.i,r.value.j)}catch{return!1}};a(e,t,this.state.flamegraphConfigs.zoom)||(n.zoom=this.resetFlamegraphState.zoom);return a(e,t,this.state.flamegraphConfigs.focusedNode)||(n.focusedNode=this.resetFlamegraphState.focusedNode),n},this.onSearchChange=e=>{this.setState({searchQuery:e})},this.isSameFlamebearer=(e,t)=>function(e,t){var n;return e.format===t.format&&e.numTicks===t.numTicks&&e.sampleRate===t.sampleRate&&e.units===t.units&&(null===(n=e.names)||void 0===n?void 0:n.length)===(null==t?void 0:t.names.length)&&e.levels.length===t.levels.length&&!!e.names.every((e,n)=>e===t.names[n])&&!!function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){if(e[n].length!==t[n].length)return!1;for(let a=0;a<e[n].length;a++)if(e[n][a]!==t[n][a])return!1}return!0}(e.levels,t.levels)&&JSON.stringify({...e,levels:void 0,names:void 0})===JSON.stringify({...t,levels:void 0,names:void 0})}(e,t),this.onReset=()=>{this.setState({...this.state,flamegraphConfigs:{...this.state.flamegraphConfigs,...this.initialFlamegraphState},selectedItem:N.nothing()})},this.onFlamegraphZoom=e=>{e.isJust&&0===e.value.i&&0===e.value.j?this.onReset():this.setState({...this.state,flamegraphConfigs:{...this.state.flamegraphConfigs,zoom:e}})},this.onFocusOnNode=(e,t)=>{if(0===e&&0===t)return void this.onReset();let n={...this.state.flamegraphConfigs};const{zoom:a}=this.state.flamegraphConfigs;a.isJust&&a.value.i<=e&&(n={...n,zoom:this.initialFlamegraphState.zoom}),this.setState({...this.state,flamegraphConfigs:{...n,focusedNode:N.just({i:e,j:t})}})},this.setActiveItem=e=>{const{name:t}=e;this.state.selectedItem.isJust&&t===this.state.selectedItem.value?this.setState({selectedItem:N.nothing()}):this.setState({selectedItem:N.just(t)})},this.getHighlightQuery=()=>this.state.selectedItem.isJust?this.state.selectedItem.value:this.state.searchQuery,this.updateView=e=>{"sandwich"===e&&this.setState({searchQuery:"",flamegraphConfigs:this.resetFlamegraphState}),this.setState({view:e})},this.updateFlamegraphDirtiness=()=>{const e=this.isDirty();this.setState({isFlamegraphDirty:e})},this.updateFitMode=e=>{this.setState({fitMode:e})},this.isDirty=()=>this.state.selectedItem.isJust||JSON.stringify(this.initialFlamegraphState)!==JSON.stringify(this.state.flamegraphConfigs),this.handleSetPalette=e=>{this.setState({palette:e})},this.render=()=>{const n=e("div",{className:si(bc.tablePane,"vertical"===this.state.panesOrientation?bc.vertical:bc.horizontal),children:e(tl,{"data-testid":"table-view",flamebearer:this.state.flamebearer,fitMode:this.state.fitMode,highlightQuery:this.state.searchQuery,selectedItem:this.state.selectedItem,handleTableItemClick:this.setActiveItem,palette:this.state.palette})},"table-pane"),a=this.shouldShowToolbar(),r=e(vs,{showCredit:this.props.showCredit,flamebearer:this.state.flamebearer,highlightQuery:this.getHighlightQuery(),setActiveItem:this.setActiveItem,selectedItem:this.state.selectedItem,updateView:this.props.onlyDisplay?void 0:this.updateView,fitMode:this.state.fitMode,updateFitMode:this.updateFitMode,zoom:this.state.flamegraphConfigs.zoom,focusedNode:this.state.flamegraphConfigs.focusedNode,onZoom:this.onFlamegraphZoom,onFocusOnNode:this.onFocusOnNode,onReset:this.onReset,isDirty:this.isDirty,palette:this.state.palette,toolbarVisible:a,setPalette:this.handleSetPalette,enableSandwichView:this.props.enableSandwichView},"flamegraph-pane"),i=(()=>{if(this.state.selectedItem.isNothing)return e("div",{className:bc.sandwichPane,children:t("div",{className:si(bc.sandwichPaneInfo,"vertical"===this.state.panesOrientation?bc.vertical:bc.horizontal),children:[e("div",{className:bc.arrow}),"Select a function to view callers/callees sandwich view"]})},"sandwich-pane");const n=vc(this.state.flamebearer,this.state.selectedItem.value),r=gc(this.state.flamebearer,this.state.selectedItem.value),i=t=>e(vs,{disableClick:!0,showCredit:this.props.showCredit,highlightQuery:"",setActiveItem:this.setActiveItem,selectedItem:this.state.selectedItem,fitMode:this.state.fitMode,updateFitMode:this.updateFitMode,zoom:this.state.flamegraphConfigs.zoom,focusedNode:this.state.flamegraphConfigs.focusedNode,onZoom:this.onFlamegraphZoom,onFocusOnNode:this.onFocusOnNode,onReset:this.onReset,isDirty:this.isDirty,palette:this.state.palette,toolbarVisible:a,setPalette:this.handleSetPalette,...t});return t("div",{className:bc.sandwichPane,children:[t("div",{className:bc.sandwichTop,children:[e("span",{className:bc.name,children:"Callers"}),i({flamebearer:n})]}),t("div",{className:bc.sandwichBottom,children:[e("span",{className:bc.name,children:"Callees"}),i({flamebearer:r,headerVisible:!1,showSingleLevel:!0})]})]},"sandwich-pane")})(),o=!this.state.flamebearer||this.state.flamebearer.names.length<=1,s=function(e,t,n,a,r){switch(e){case"table":return[n];case"flamegraph":return[t];case"sandwich":return[n,a];case"both":return[n,t];case"graphviz":return[r];default:throw new Error(`Invalid view '${e}'`)}}(this.state.view,r,n,i,e(Cc,{flamebearer:this.state.flamebearer}));return t("div",{children:[t("div",{children:[a&&e(sc,{sharedQuery:this.props.sharedQuery,enableChangingDisplay:!this.props.onlyDisplay,flamegraphType:this.state.flamebearer.format,view:this.state.view,handleSearchChange:this.onSearchChange,reset:this.onReset,updateView:this.updateView,updateFitMode:this.updateFitMode,fitMode:this.state.fitMode,isFlamegraphDirty:this.isDirty(),selectedNode:this.state.flamegraphConfigs.zoom,highlightQuery:this.state.searchQuery,onFocusOnSubtree:this.onFocusOnNode,ExportData:this.props.ExportData,palette:this.state.palette,setPalette:this.handleSetPalette}),this.props.children,e("div",{className:`${bc.flamegraphContainer} ${si("vertical"===this.state.panesOrientation?bc.vertical:bc.horizontal,bc[this.state.panesOrientation],bc.panesWrapper)}`,children:o?e(ci,{}):s.map(e=>e)})]}),this.props.showPyroscopeLogo&&t("div",{className:bc.createdBy,children:["Created by",t("a",{href:"https://twitter.com/PyroscopeIO",rel:"noreferrer",target:"_blank",children:[e(j,{width:"30",height:"30"}),"@PyroscopeIO"]})]})]})},this.state={isFlamegraphDirty:!1,view:this.props.onlyDisplay?this.props.onlyDisplay:"both",fitMode:"HEAD",flamebearer:Pc(n),panesOrientation:n.panesOrientation?n.panesOrientation:"horizontal",searchQuery:"",selectedItem:N.nothing(),flamegraphConfigs:this.initialFlamegraphState,palette:Ao}}componentDidUpdate(e,t){const n=Pc(e),a=Pc(this.props);if(!this.isSameFlamebearer(n,a)){const e=this.calcNewConfigs(n,a);return void this.setState({flamebearer:a,flamegraphConfigs:{...this.state.flamegraphConfigs,...e},selectedItem:N.nothing()})}t.flamegraphConfigs!==this.state.flamegraphConfigs&&this.updateFlamegraphDirtiness()}shouldShowToolbar(){return void 0===this.props.showToolbar||this.props.showToolbar}}Mc.defaultProps={showCredit:!1};const Ic={showPyroscopeLogo:!1},Ec=(e,t)=>{if(t)return t;const n=null!=e?e:"auto";return"zh-CN"===("auto"===n?"undefined"!=typeof navigator&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh-CN":"en":n)?$o:zo},jc=t=>{const{i18n:n,locale:r,colorMode:i="light",sandwich:o=!0,...s}=t,l=a.useMemo(()=>Ec(r,n),[r,n]),c=a.useMemo(()=>(e=>{switch(e){case"dark":return"ps-theme-dark";case"kylin":return"ps-theme-kylin";default:return"ps-theme-light"}})(i),[i]);return e("pyro-flamegraph",{className:c,children:e(Ho,{messages:l,children:e(Mc,{...Ic,enableSandwichView:o,...s})})})};function Fc(e){const t={numTicks:0,maxSelf:0,names:[],levels:[]},n={},a={children:[]};return e.spans.forEach(e=>{e.children=[],n[e.spanID]=e}),e.spans.forEach(e=>{let t=a;e.references&&e.references.length>0&&(t=n[e.references[0].spanID]||a),t.children.push(e)}),function e(t,n){(t.children||[]).forEach(t=>e(t));let a=0;const r=F(t.children||[],e=>e.operationName);t.children=A(r,e=>{const t=e[0];for(let n=1;n<e.length;n+=1)t.duration+=e[n].duration;return a+=t.duration,t}),t.total=t.duration||a,t.self=Math.max(0,t.total-a)}(a),function n(a,r,i){var o;return t.numTicks||(t.numTicks=a.total),(o=t.levels)[r]||(o[r]=[]),t.levels[r].push(i),t.levels[r].push(a.total),t.levels[r].push(a.self),t.names.push((a.processID?`${e.processes[a.processID].serviceName}: `:"")+(a.operationName||"total")),t.levels[r].push(t.names.length-1),(a.children||[]).forEach(e=>{i+=n(e,r+1,i)}),a.total}(a,0,0),t.levels=_c("single",t.levels),{version:1,flamebearer:t,metadata:{format:"single",units:"trace_samples",spyName:"tracing",sampleRate:1e6}}}function Ac(e,t){e.flamebearer.levels=Rc("single",e.flamebearer.levels),t.flamebearer.levels=Rc("single",t.flamebearer.levels);const n=function(e,t){const n={format:"double",numTicks:e.numTicks+t.numTicks,leftTicks:e.numTicks,rightTicks:t.numTicks,maxSelf:100,sampleRate:e.sampleRate,names:[],levels:[],units:e.units,spyName:e.spyName},a=hc(e,t),r=(e,t,a,i)=>{var o;const{name:s,children:l,self:c,total:f}=e;n.names.push(s),(o=n.levels)[t]||(o[t]=[]),n.maxSelf=Math.max(n.maxSelf,c[0]||0,c[1]||0),n.levels[t]=n.levels[t].concat([a,f[0]||0,c[0]||0,i,f[1]||0,c[1]||0,n.names.length-1]);for(let e=0;e<l.length;e+=1){const[n,o]=r(l[e],t+1,a,i);a+=n,i+=o}return[f[0]||0,f[1]||0]};return r(a,0,0,0),n}(e.flamebearer,t.flamebearer);n.levels=_c("double",n.levels);const a={...e.metadata};return a.format="double",{version:1,flamebearer:n,metadata:a,leftTicks:e.flamebearer.numTicks,rightTicks:t.flamebearer.numTicks}}export{br as Box,Ao as DefaultPalette,ii as Flamegraph,Ho as FlamegraphI18nProvider,jc as FlamegraphRenderer,Fc as convertJaegerTraceToProfile,Ac as diffTwoProfiles,zo as flamegraphDefaultMessages,$o as flamegraphZhCNMessages};
|
|
17
|
+
*/var ws,xs=(bs||(bs=1,function(e){!function(){var t={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=r(e,a(n)))}return e}function a(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var a="";for(var i in e)t.call(e,i)&&e[i]&&(a=r(a,i));return a}function r(e,t){return t?e?e+" "+t:e+t:e}e.exports?(n.default=n,e.exports=n):window.classNames=n}()}(ys)),ys.exports),ks=D(xs),Ns={};function Ss(){return ws||(ws=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="chevron-left",n=[9001],a="f053",r="M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z";e.definition={prefix:"fas",iconName:t,icon:[320,512,n,a,r]},e.faChevronLeft=e.definition,e.prefix="fas",e.iconName=t,e.width=320,e.height=512,e.ligatures=n,e.unicode=a,e.svgPathData=r,e.aliases=n}(Ns)),Ns}var Ts,Cs=Ss(),_s={};function Rs(){return Ts||(Ts=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="chevron-right",n=[9002],a="f054",r="M311.1 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L243.2 256 73.9 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z";e.definition={prefix:"fas",iconName:t,icon:[320,512,n,a,r]},e.faChevronRight=e.definition,e.prefix="fas",e.iconName=t,e.width=320,e.height=512,e.ligatures=n,e.unicode=a,e.svgPathData=r,e.aliases=n}(_s)),_s}var Ps=Rs(),Ms={table:"Table-module_table__6A8SM",sortable:"Table-module_sortable__J6kyp",sortArrow:"Table-module_sortArrow__Nrncn",asc:"Table-module_asc__tJDI9",desc:"Table-module_desc__fjVRY",isRowSelected:"Table-module_isRowSelected__UhIAJ",isRowDisabled:"Table-module_isRowDisabled__sz3NJ",loadingSpinner:"Table-module_loadingSpinner__SSjMK",pagination:"Table-module_pagination__VXgcO"},Is="Button-module_button__Ed1ge",Es="Button-module_noIcon__Uzjvv",js="Button-module_noBox__mLreC",Fs="Button-module_customIcon__-slpC",As="Button-module_iconWithText__DQRkr",Ds="Button-module_default__HhXlQ",Os="Button-module_outline__Flf4r",Ls="Button-module_float__4marx",Bs="Button-module_primary__xByv0",zs="Button-module_secondary__D0K-F",$s="Button-module_danger__5-vIq",Vs="Button-module_grouped__j8KwB";const Hs=a.forwardRef(function({disabled:n=!1,kind:a="default",type:r="button",icon:i,iconNode:o,children:s,grouped:l,onClick:c,id:f,className:u,form:d,noBox:h,autoFocus:m,...p},g){return t("button",{...p,id:f,ref:g,type:r,"data-testid":p["data-testid"],disabled:n,onClick:c,form:d,autoFocus:m,"aria-label":p["aria-label"],className:ks(Is,l?Vs:"",Ws(a),u,h&&js,o&&Fs,!i&&!o&&Es),children:[i?e(gr,{icon:i,className:s?As:""}):null,o,s]})});function Ws(e){switch(e){case"default":return Ds;case"primary":return Bs;case"secondary":return zs;case"danger":return $s;case"outline":return Os;case"float":return Ls;default:throw Error(`Unsupported kind ${e}`)}}function Us({sortByDirection:a,sortBy:r,updateSortParams:i,table:o,tableBodyRef:s,className:c,isLoading:f,itemsPerPage:u}){const d=a&&r&&i,[h,m]=l(0);return f?e("div",{className:Ms.loadingSpinner}):t(n,{children:[t("table",{className:si(Ms.table,{[c||""]:c}),"data-testid":"table-ui",children:[e("thead",{children:e("tr",{children:o.headRow.map(({sortable:t,label:n,name:s,...l},c)=>t&&"not-filled"!==o.type&&d?w("th",{...l,key:c,className:Ms.sortable,onClick:()=>i(s)},n,e("span",{className:si(Ms.sortArrow,{[Ms[a]]:r===s})})):e("th",{...l,children:n},c))})}),e("tbody",{ref:s,children:"not-filled"===o.type?e("tr",{className:null==o?void 0:o.bodyClassName,children:e("td",{colSpan:o.headRow.length,children:o.value})}):Qs(o.bodyRows,h,u).map(({cells:t,isRowSelected:n,isRowDisabled:a,className:r,...i})=>{const o=Math.random();return e("tr",{...i,className:si(r,{[Ms.isRowSelected]:n,[Ms.isRowDisabled]:a}),children:t&&t.map(({style:t,value:n,...a},r)=>e("td",{style:t,...a,children:n},o+r))},o)})})]}),e(Js,{bodyRows:"filled"===o.type?o.bodyRows:void 0,itemsPerPage:u,currPage:h,setCurrPage:m})]})}function Qs(e,t,n){return n?e.slice(t*n,n*(t+1)):e}function Js({itemsPerPage:n,currPage:a,setCurrPage:r,bodyRows:i}){if(!n)return null;const o=!!i&&Qs(i,a+1,n).length>0,s=!!i&&Qs(i,a-1,n).length>0;return t("nav",{className:Ms.pagination,children:[e(Hs,{"aria-label":"Previous Page",disabled:!s,kind:"float",icon:Cs.faChevronLeft,onClick:()=>r(a-1)}),e(Hs,{disabled:!o,"aria-label":"Next Page",kind:"float",icon:Ps.faChevronRight,onClick:()=>r(a+1)})]})}function Xs({numTicks:t,sampleRate:n,units:a,tableBodyRef:r,palette:i}){const o=Br(t,n,a),s=o.format(t,n),l=Wo(),c=f((e,t,r)=>{var c;const f=null===(c=r.target.closest("tr"))||void 0===c?void 0:c.dataset.row;if(!f)return void t();const[u,d,...h]=f.split(";");switch(u){case"single":{const[t,r]=h,i=o.format(parseInt(t,10),n),l=o.format(parseInt(r,10),n),c=s.split(" "),f="<"===c[0]?c[1]:c[0],u=i.split(" "),m="<"===u[0]?u[1]:u[0],p=l.split(" "),g="<"===p[0]?p[1]:p[0];e({title:{text:d,diff:{text:"",color:""}},tooltipData:[{units:a,self:`${i}(${(parseFloat(m)/parseFloat(f)*100).toFixed(2)}%)`,total:`${l}(${(parseFloat(g)/parseFloat(f)*100).toFixed(2)}%)`,tooltipType:"table"}]});break}case"double":{const[t,r,s,c]=h,f=qo({formatter:o,sampleRate:n,totalLeft:parseInt(t,10),leftTicks:parseInt(r,10),totalRight:parseInt(s,10),rightTicks:parseInt(c,10),title:d,units:a},i,l);e({title:f.title,tooltipData:f.tooltipData});break}}},[o,n,a,s,i,l]);return e(Yo,{dataSourceRef:r,shouldShowTitle:!1,clickInfoSide:"left",setTooltipContent:c,palette:i})}const Ys=e=>e||0;function Zs(e,t,n,a){const r=t;return r.type="single",r.self=Ys(r.self)+e.getBarSelf(n,a),r.total=Ys(r.total)+e.getBarTotal(n,a),r}function Ks(e,t,n,a,r,i){const o=t;return o.type="double",o.self=Ys(o.self)+e.getBarSelf(n,a),o.total=Ys(o.total)+e.getBarTotal(n,a),o.selfLeft=Ys(o.selfLeft)+e.getBarSelfLeft(n,a),o.selfRght=Ys(o.selfRght)+e.getBarSelfRght(n,a),o.selfDiff=Ys(o.selfDiff)+e.getBarSelfDiff(n,a),o.totalLeft=Ys(o.totalLeft)+e.getBarTotalLeft(n,a),o.totalRght=Ys(o.totalRght)+e.getBarTotalRght(n,a),o.totalDiff=Ys(o.totalDiff)+e.getBarTotalDiff(n,a),o.leftTicks=r,o.rightTicks=i,o}function Gs(e,t,n){const a=148-e/t*148,r=n.alpha(1);return{backgroundImage:`linear-gradient(${r}, ${r})`,backgroundPosition:`-${a}px 0px`,backgroundRepeat:"no-repeat"}}const qs=({flamebearer:t,sortBy:n,sortByDirection:a,fitMode:r,handleTableItemClick:i,highlightQuery:o,palette:s,selectedItem:l,messages:c})=>{const{numTicks:f,maxSelf:u,sampleRate:d,spyName:h,units:m}=t,p=function(e){if(!e)return[];const{names:t,levels:n,format:a}=e,r="double"!==a?Tr:Cr,i=new Map;for(let o=0;o<n.length;o++){const s=n[o];for(let n=0;n<s.length;n+=r.jStep){const o=t[r.getBarName(s,n)];i.has(o)||i.set(o,{name:o||"<empty>",self:0,total:0});const l=i.get(o);if(!l)break;"single"===a?Zs(Tr,l,s,n):Ks(Cr,l,s,n,e.leftTicks,e.rightTicks)}}return Array.from(i.values())}(t).sort((e,t)=>t.total-e.total),g="asc"===a?1:-1;let v;if("name"===n)v=p.sort((e,t)=>g*e[n].localeCompare(t[n]));else switch(n){case"total":case"self":v=p.sort((e,t)=>g*(e[n]-t[n]));break;case"baseline":v=p.sort((e,t)=>g*(e.totalLeft/e.leftTicks-t.totalLeft/t.leftTicks));break;case"comparison":v=p.sort((e,t)=>g*(e.totalRght/e.rightTicks-t.totalRght/t.rightTicks));break;case"diff":v=p.sort((e,t)=>{const n=Lr(Or(e.totalLeft/e.leftTicks),Or(e.totalRght/e.rightTicks)),a=Lr(Or(t.totalLeft/t.leftTicks),Or(t.totalRght/t.rightTicks));return g*(n-a)});break;default:v=p}const b=Br(f,d,m),y=e=>!!l.isJust&&e===l.value,w=t=>{return e("button",{className:"table-item-button",children:e("div",{className:"symbol-name",style:(n=r,n===Wr?{direction:"rtl",overflow:"hidden",textOverflow:"ellipsis"}:{overflow:"hidden",textOverflow:"ellipsis"}),children:t.name})});var n},x=v.filter(e=>!o||Kr(o,e.name)).map(e=>{if("double"===e.type)return(e=>{const t=Or(e.totalLeft/e.leftTicks),n=Or(e.totalRght/e.rightTicks),a=Lr(t,n);let r="";a>0?r=s.badColor.rgb().string():a<0&&(r=s.goodColor.rgb().string());let o="";return e.totalLeft&&a!==1/0?e.totalRght?a>0?o=`+${a.toFixed(2)}%`:a<0&&(o=`${a.toFixed(2)}%`):o=c.diffRemoved:o=c.diffNew,{"data-row":`${e.type};${e.name};${e.totalLeft};${e.leftTicks};${e.totalRght};${e.rightTicks}`,isRowSelected:y(e.name),onClick:()=>i(e),cells:[{value:w(e)},{value:`${t} %`},{value:`${n} %`},{value:o,style:{color:r}}]}})(e);const t=Xr(h,e.name);return((e,t)=>({"data-row":`${e.type};${e.name};${e.self};${e.total}`,isRowSelected:y(e.name),onClick:()=>i(e),cells:[{value:w(e)},{value:b.format(e.self,d),style:Gs(e.self,u,t)},{value:b.format(e.total,d),style:Gs(e.total,f,t)}]}))(e,Yr(s,t))});return x.length>0?{bodyRows:x,type:"filled"}:{value:e("div",{className:"unsupported-format",children:c.noItemsFound}),type:"not-filled"}};function el({tableBodyRef:t,flamebearer:n,isDoubles:r,fitMode:i,handleTableItemClick:o,highlightQuery:s,selectedItem:c,palette:f}){const u=Wo(),d=a.useMemo(()=>r?[{sortable:1,name:"name",label:u.location},{sortable:1,name:"baseline",label:u.baseline,default:!0},{sortable:1,name:"comparison",label:u.comparison},{sortable:1,name:"diff",label:u.diff}]:[{sortable:1,name:"name",label:u.location},{sortable:1,name:"self",label:u.self,default:!0},{sortable:1,name:"total",label:u.total}],[u,r]),h=(e=>{const t=e.filter(e=>null==e?void 0:e.default)[0]||e[0],[n,a]=l(t.name),[r,i]=l("desc");return{sortBy:n,sortByDirection:r,updateSortParams:e=>{let t=r;t=n===e?"asc"===t?"desc":"asc":"desc",a(e),i(t)}}})(d),m={headRow:d,...qs({flamebearer:n,sortBy:h.sortBy,sortByDirection:h.sortByDirection,fitMode:i,handleTableItemClick:o,highlightQuery:s,palette:f,selectedItem:c,messages:u})};return e(Us,{...h,tableBodyRef:t,table:m,className:ks("flamegraph-table",{"flamegraph-table-doubles":r})})}const tl=a.memo(function({flamebearer:n,fitMode:a,handleTableItemClick:r,highlightQuery:i,palette:o,selectedItem:s}){const l=c(null),f="double"===n.format;return t("div",{"data-testid":"table-view",className:f?"flamegraph-table-wrapper flamegraph-table-wrapper--double":"flamegraph-table-wrapper",children:[e("div",{className:"flamegraph-table-scroll",children:e(el,{tableBodyRef:l,flamebearer:n,isDoubles:f,fitMode:a,highlightQuery:i,handleTableItemClick:r,palette:o,selectedItem:s})}),e(Xs,{tableBodyRef:l,numTicks:n.numTicks,sampleRate:n.sampleRate,units:n.units,palette:o})]})});var nl,al,rl={},il={};function ol(){return nl||(nl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="arrow-rotate-left",n=[8634,"arrow-left-rotate","arrow-rotate-back","arrow-rotate-backward","undo"],a="f0e2",r="M256 64c-56.8 0-107.9 24.7-143.1 64l47.1 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 192c-17.7 0-32-14.3-32-32L0 32C0 14.3 14.3 0 32 0S64 14.3 64 32l0 54.7C110.9 33.6 179.5 0 256 0 397.4 0 512 114.6 512 256S397.4 512 256 512c-87 0-163.9-43.4-210.1-109.7-10.1-14.5-6.6-34.4 7.9-44.6s34.4-6.6 44.6 7.9c34.8 49.8 92.4 82.3 157.6 82.3 106 0 192-86 192-192S362 64 256 64z";e.definition={prefix:"fas",iconName:t,icon:[512,512,n,a,r]},e.faArrowRotateLeft=e.definition,e.prefix="fas",e.iconName=t,e.width=512,e.height=512,e.ligatures=n,e.unicode=a,e.svgPathData=r,e.aliases=n}(il)),il}function sl(){return al||(al=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=ol();e.definition={prefix:t.prefix,iconName:t.iconName,icon:[t.width,t.height,t.aliases,t.unicode,t.svgPathData]},e.faUndo=e.definition,e.prefix=t.prefix,e.iconName=t.iconName,e.width=t.width,e.height=t.height,e.ligatures=t.aliases,e.unicode=t.unicode,e.svgPathData=t.svgPathData,e.aliases=t.aliases}(rl)),rl}var ll,cl,fl=sl(),ul={},dl={};function hl(){return ll||(ll=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="diagram-project",n=["project-diagram"],a="f542",r="M0 80C0 53.5 21.5 32 48 32l96 0c26.5 0 48 21.5 48 48l0 16 128 0 0-16c0-26.5 21.5-48 48-48l96 0c26.5 0 48 21.5 48 48l0 96c0 26.5-21.5 48-48 48l-96 0c-26.5 0-48-21.5-48-48l0-16-128 0 0 16c0 7.3-1.7 14.3-4.6 20.5l68.6 91.5 80 0c26.5 0 48 21.5 48 48l0 96c0 26.5-21.5 48-48 48l-96 0c-26.5 0-48-21.5-48-48l0-96c0-7.3 1.7-14.3 4.6-20.5L128 224 48 224c-26.5 0-48-21.5-48-48L0 80z";e.definition={prefix:"fas",iconName:t,icon:[512,512,n,a,r]},e.faDiagramProject=e.definition,e.prefix="fas",e.iconName=t,e.width=512,e.height=512,e.ligatures=n,e.unicode=a,e.svgPathData=r,e.aliases=n}(dl)),dl}function ml(){return cl||(cl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=hl();e.definition={prefix:t.prefix,iconName:t.iconName,icon:[t.width,t.height,t.aliases,t.unicode,t.svgPathData]},e.faProjectDiagram=e.definition,e.prefix=t.prefix,e.iconName=t.iconName,e.width=t.width,e.height=t.height,e.ligatures=t.aliases,e.unicode=t.unicode,e.svgPathData=t.svgPathData,e.aliases=t.aliases}(ul)),ul}var pl,gl,vl=ml(),bl={},yl={};function wl(){return pl||(pl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="ellipsis-vertical",n=["ellipsis-v"],a="f142",r="M64 144a56 56 0 1 1 0-112 56 56 0 1 1 0 112zm0 224c30.9 0 56 25.1 56 56s-25.1 56-56 56-56-25.1-56-56 25.1-56 56-56zm56-112c0 30.9-25.1 56-56 56s-56-25.1-56-56 25.1-56 56-56 56 25.1 56 56z";e.definition={prefix:"fas",iconName:t,icon:[128,512,n,a,r]},e.faEllipsisVertical=e.definition,e.prefix="fas",e.iconName=t,e.width=128,e.height=512,e.ligatures=n,e.unicode=a,e.svgPathData=r,e.aliases=n}(yl)),yl}function xl(){return gl||(gl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=wl();e.definition={prefix:t.prefix,iconName:t.iconName,icon:[t.width,t.height,t.aliases,t.unicode,t.svgPathData]},e.faEllipsisV=e.definition,e.prefix=t.prefix,e.iconName=t.iconName,e.width=t.width,e.height=t.height,e.ligatures=t.aliases,e.unicode=t.unicode,e.svgPathData=t.svgPathData,e.aliases=t.aliases}(bl)),bl}var kl=xl();function Nl(e){if(null!=e&&!1!==e){if("string"==typeof e||"number"==typeof e)return String(e);if(Array.isArray(e)){const t=e.map(e=>Nl(e)).filter(e=>!!e);return t.length?t.join(" "):void 0}return a.isValidElement(e)?Nl(e.props.children):void 0}}const Sl=({placement:t,title:a,content:r,children:i})=>{const o=Nl(null!=a?a:r);return o?e("span",{title:o,children:i}):e(n,{children:i})};var Tl,Cl={};function _l(){return Tl||(Tl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});var t="link",n=[128279,"chain"],a="f0c1",r="M419.5 96c-16.6 0-32.7 4.5-46.8 12.7-15.8-16-34.2-29.4-54.5-39.5 28.2-24 64.1-37.2 101.3-37.2 86.4 0 156.5 70 156.5 156.5 0 41.5-16.5 81.3-45.8 110.6l-71.1 71.1c-29.3 29.3-69.1 45.8-110.6 45.8-86.4 0-156.5-70-156.5-156.5 0-1.5 0-3 .1-4.5 .5-17.7 15.2-31.6 32.9-31.1s31.6 15.2 31.1 32.9c0 .9 0 1.8 0 2.6 0 51.1 41.4 92.5 92.5 92.5 24.5 0 48-9.7 65.4-27.1l71.1-71.1c17.3-17.3 27.1-40.9 27.1-65.4 0-51.1-41.4-92.5-92.5-92.5zM275.2 173.3c-1.9-.8-3.8-1.9-5.5-3.1-12.6-6.5-27-10.2-42.1-10.2-24.5 0-48 9.7-65.4 27.1L91.1 258.2c-17.3 17.3-27.1 40.9-27.1 65.4 0 51.1 41.4 92.5 92.5 92.5 16.5 0 32.6-4.4 46.7-12.6 15.8 16 34.2 29.4 54.6 39.5-28.2 23.9-64 37.2-101.3 37.2-86.4 0-156.5-70-156.5-156.5 0-41.5 16.5-81.3 45.8-110.6l71.1-71.1c29.3-29.3 69.1-45.8 110.6-45.8 86.6 0 156.5 70.6 156.5 156.9 0 1.3 0 2.6 0 3.9-.4 17.7-15.1 31.6-32.8 31.2s-31.6-15.1-31.2-32.8c0-.8 0-1.5 0-2.3 0-33.7-18-63.3-44.8-79.6z";e.definition={prefix:"fas",iconName:t,icon:[576,512,n,a,r]},e.faLink=e.definition,e.prefix="fas",e.iconName=t,e.width=576,e.height=512,e.ligatures=n,e.unicode=a,e.svgPathData=r,e.aliases=n}(Cl)),Cl}var Rl=_l(),Pl="Input-module_input__ulQdV";const Ml=a.forwardRef(({testId:t,className:n,type:a,name:r,placeholder:i,minLength:o=0,debounceTimeout:s=100,onChange:l,value:c,htmlId:f},u)=>e(E,{inputRef:u,"data-testid":t,className:`${Pl} ${n||""}`,type:a,name:r,placeholder:i,minLength:o,debounceTimeout:s,onChange:l,value:c,id:f}));var Il="SharedQueryInput-module_wrapper__XRxrd",El="SharedQueryInput-module_search__XlzRv",jl="SharedQueryInput-module_search-synced__J4T4b",Fl="SharedQueryInput-module_searchWithSync__ryuQa",Al="SharedQueryInput-module_icon__Aq0Hv",Dl="SharedQueryInput-module_checked__oRvod",Ol="SharedQueryInput-module_sync__0IO2N",Ll="SharedQueryInput-module_syncSelected__hstBI";const Bl=({onHighlightChange:n,highlightQuery:a,sharedQuery:r,width:o})=>{const s=Wo(),l=(e=>{const t=c();return d(()=>{t.current=e},[e]),t.current})(null==r?void 0:r.syncEnabled);d(()=>{"string"==typeof(null==r?void 0:r.searchQuery)&&(r.syncEnabled&&n(r.searchQuery),!r.syncEnabled&&l&&l!==(null==r?void 0:r.id)&&n(""))},[null==r?void 0:r.searchQuery,null==r?void 0:r.syncEnabled]);const f=i(()=>r&&r.syncEnabled?r.searchQuery||"":a,[r,a]),u=i(()=>`${r?Fl:El} ${(null==r?void 0:r.syncEnabled)?jl:""}`,[r]),h=(null==r?void 0:r.syncEnabled)?s.unsyncSearchBars:s.syncSearchBars;return t("div",{className:Il,style:{width:o},children:[e(Ml,{testId:"flamegraph-search",className:u,type:"search",name:"flamegraph-search",placeholder:s.searchPlaceholder,minLength:1,debounceTimeout:100,onChange:e=>{n(e.target.value),r&&r.syncEnabled&&r.onQueryChange(e.target.value)},value:f}),r?e(Sl,{placement:"top",title:h,children:e("button",{className:r.syncEnabled?Ll:Ol,onClick:()=>{const e=!(null==r?void 0:r.syncEnabled)&&(null==r?void 0:r.id);null==r||r.toggleSync(e),e?null==r||r.onQueryChange(a):(n(a),null==r||r.onQueryChange(""))},children:e(gr,{className:`${r.syncEnabled?Dl:Al}`,icon:Rl.faLink})})}):null]})};var zl="DiffLegend-module_flamegraph-legend__Cywr1",$l="DiffLegend-module_flamegraph-legend-list__swdXj",Vl="DiffLegend-module_flamegraph-legend-item__0P-6g";function Hl(n){const{palette:a,showMode:r}=n,i=function(e){switch(e){case"large":return[-100,-80,-60,-40,-20,-10,0,10,20,40,60,80,100];case"small":return[-100,-40,-20,0,20,40,100];default:throw new Error(`Unsupported ${e}`)}}(r),o=Zr(a);return e("div",{"data-testid":"flamegraph-legend",className:`${zl} ${$l}`,children:i.map(e=>t("div",{className:Vl,style:{backgroundColor:o(e).rgb().toString()},children:[e>0?"+":"",e,"%"]},e))})}function Wl(){return e("svg",{version:"1.1",id:"Capa_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",width:"12px",height:"12px",viewBox:"0 0 405.272 405.272",children:e("g",{children:e("path",{d:"M393.401,124.425L179.603,338.208c-15.832,15.835-41.514,15.835-57.361,0L11.878,227.836\n\n\t\tc-15.838-15.835-15.838-41.52,0-57.358c15.841-15.841,41.521-15.841,57.355-0.006l81.698,81.699L336.037,67.064\n\n\t\tc15.841-15.841,41.523-15.829,57.358,0C409.23,82.902,409.23,108.578,393.401,124.425z"})})})}var Ul="Dropdown-module_dropdownMenu__tbN8r",Ql="Dropdown-module_dropdownMenuButton__Xy8M4";function Jl({id:n,children:a,className:r,disabled:i,value:o,label:s,onItemClick:l,overflow:c,position:f,direction:u,align:d,viewScroll:h,arrow:m,menuButtonClassName:p="",ariaLabel:g,portal:v,...b}){const y=b.menuButton||e(Yl,{"aria-label":g,className:`${Ql} ${p}`,disabled:i,type:"button",children:o||s});return t(So,{id:n,"aria-label":g,className:ks(r,Ul),"data-testid":b["data-testid"],onItemClick:l,overflow:c,position:f,direction:u,align:d,viewScroll:h,arrow:m,menuButton:y,portal:v,children:[e(Ro,{children:s}),a]})}const Xl=_o,Yl=ro;var Zl="DiffLegendPaletteDropdown-module_container__h8Tts",Kl="DiffLegendPaletteDropdown-module_triggerButton__oezA6",Gl="DiffLegendPaletteDropdown-module_dropdownArrow__-Lu0w",ql="DiffLegendPaletteDropdown-module_menuItem__5iWry",ec="DiffLegendPaletteDropdown-module_menuItemText__a-tt0";const tc=[Ao,Do],nc=n=>{const{palette:a=Ao,onChange:r}=n,i=Wo(),o=e=>"Default"===e.name?i.paletteDefaultName:"Color Blind"===e.name?i.paletteColorBlindName:e.name,s=e=>"Default"===e.name?i.paletteDefaultDesc:"Color Blind"===e.name?i.paletteColorBlindDesc:"";return e("div",{className:Zl,children:e(Jl,{label:i.diffLegendSelectPalette,align:"end",menuButton:t(Yl,{className:ks(Ql,Kl),children:[e(Hl,{palette:a,showMode:"small"}),e("span",{className:Gl})]}),onItemClick:e=>{e.value&&r(e.value)},children:tc.map(n=>e(Xl,{value:n,children:t("div",{className:ql,children:[t("span",{className:ec,children:[o(n)," ",s(n)]}),n.name===a.name&&e(Wl,{})]})},n.name))})})};var ac={navbar:"Toolbar-module_navbar__XN6xZ",searchWrapper:"Toolbar-module_searchWrapper__k--ua",rightSection:"Toolbar-module_rightSection__if7LO",viewType:"Toolbar-module_viewType__AKARg",toggleViewButton:"Toolbar-module_toggleViewButton__OQ9-U",fitModeButton:"Toolbar-module_fitModeButton__jOxve",selected:"Toolbar-module_selected__vwBQt",collapseNodeButton:"Toolbar-module_collapseNodeButton__bLdiw",resetViewButton:"Toolbar-module_resetViewButton__y2ebV",divider:"Toolbar-module_divider__dG6pE",itemsContainer:"Toolbar-module_itemsContainer__gSTMF",item:"Toolbar-module_item__o-hKc",moreButton:"Toolbar-module_moreButton__rhOdT",active:"Toolbar-module_active__36Kt-",navbarCollapsedItems:"Toolbar-module_navbarCollapsedItems__vojhw"};const rc=$.bind(ac),ic=(e,t,n)=>{const a=0===t?e-360-5:e-360-16-5;let r=0,i=0;return n.reverse().forEach(e=>{i+=e,a<=i&&(r+=1)}),r},oc=()=>e("div",{className:ac.divider}),sc=y(({view:a,handleSearchChange:r,highlightQuery:i,isFlamegraphDirty:o,reset:s,updateFitMode:f,fitMode:d,updateView:h,selectedNode:m,onFocusOnSubtree:p,flamegraphType:g,enableChangingDisplay:v=!0,sharedQuery:b,ExportData:y,palette:w,setPalette:k})=>{const N=c(null),S=Wo(),T="double"===g&&w&&k,C=[{el:t(n,{children:[e(fc,{fitMode:d,updateFitMode:f}),e(oc,{})]}),width:93},{el:e(cc,{isFlamegraphDirty:o,reset:s}),width:44},{el:t(n,{children:[e(lc,{selectedNode:m,onFocusOnSubtree:p}),e(oc,{})]}),width:49},v?{el:e(dc,{flamegraphType:g,view:a,updateView:h}),width:44*("single"===g?5:3)}:null,x(y)?{el:t(n,{children:[e(oc,{}),y]}),width:49}:null].filter(e=>null!==e),R=C.reduce((e,t)=>[...e,t.width],[]),{isCollapsed:P,collapsedItemsNumber:M,handleMoreClick:I}=((e,t)=>{const[n,a]=l(!0),[r,i]=l(0);return u(()=>{if(e.current){const{width:n}=e.current.getBoundingClientRect(),a=ic(n,r,t);i(a)}},[e.current,t]),_(e,e=>{const{width:n}=e.target.getBoundingClientRect(),o=ic(n,r,t);i(o),a(!0)}),{isCollapsed:n,handleMoreClick:()=>{a(e=>!e)},collapsedItemsNumber:r}})(N,R),E=C.reduce((e,t,n)=>(n<M?e.hidden.push(t):e.visible.push(t),e),{visible:[],hidden:[]});return e("div",{role:"toolbar",ref:N,children:t("div",{className:ac.navbar,children:[e("div",{className:ac.searchWrapper,children:e(Bl,{width:360,onHighlightChange:r,highlightQuery:i,sharedQuery:b})}),t("div",{className:ac.rightSection,children:[T&&t(n,{children:[e(nc,{palette:w,onChange:k}),e(oc,{})]}),t("div",{className:ac.itemsContainer,children:[E.visible.map((t,n)=>e("div",{className:ac.item,style:{width:t.width},children:t.el},n)),0!==M&&e(Sl,{placement:"top",title:S.more,children:e("button",{onClick:I,className:rc({[ac.moreButton]:!0,[ac.active]:!P}),children:e(gr,{icon:kl.faEllipsisV})})})]})]}),!P&&e("div",{className:ac.navbarCollapsedItems,children:E.hidden.map((t,n)=>e("div",{className:ac.item,style:{width:t.width},children:t.el},n))})]})})});function lc({onFocusOnSubtree:t,selectedNode:n}){const a=Wo(),r=n.mapOr(()=>{},e=>()=>t(e.i,e.j));return e(Sl,{placement:"top",title:a.collapseNodesAbove,children:e("div",{children:e(Hs,{disabled:!n.isJust,onClick:r,className:ac.collapseNodeButton,"aria-label":a.collapseNodesAbove,children:e(gr,{icon:Ii.faCompressAlt})})})})}function cc({isFlamegraphDirty:t,reset:n}){const a=Wo();return e(Sl,{placement:"top",title:a.resetView,children:e("span",{children:e(Hs,{id:"reset",disabled:!t,onClick:n,className:ac.resetViewButton,"aria-label":a.resetView,children:e(gr,{icon:fl.faUndo})})})})}function fc({fitMode:a,updateFitMode:r}){const i=Wo(),o=e=>a===e;return t(n,{children:[e(Sl,{placement:"top",title:i.headFirst,children:e(Hs,{onClick:()=>r("HEAD"),className:rc({[ac.fitModeButton]:!0,[ac.selected]:o("HEAD")}),children:e(ls,{})})}),e(Sl,{placement:"top",title:i.tailFirst,children:e(Hs,{onClick:()=>r("TAIL"),className:rc({[ac.fitModeButton]:!0,[ac.selected]:o("TAIL")}),children:e(cs,{})})})]})}const uc=(t,n)=>"single"===t?[{label:n.viewTable,value:"table",Icon:rs},{label:n.viewTableAndFlamegraph,value:"both",Icon:is},{label:n.viewFlamegraph,value:"flamegraph",Icon:os},{label:n.viewSandwich,value:"sandwich",Icon:ss},{label:n.viewGraphviz,value:"graphviz",Icon:()=>e(gr,{icon:vl.faProjectDiagram})}]:[{label:n.viewTable,value:"table",Icon:rs},{label:n.viewTableAndFlamegraph,value:"both",Icon:is},{label:n.viewFlamegraph,value:"flamegraph",Icon:os}];function dc({view:t,updateView:n,flamegraphType:a}){const r=Wo(),i=uc(a,r);return e("div",{className:ac.viewType,children:i.map(({label:a,value:r,Icon:i})=>e(Sl,{placement:"top",title:a,children:e(Hs,{"data-testid":r,onClick:()=>n(r),className:rc({[ac.toggleViewButton]:!0,selected:t===r}),children:e(i,{})})},r))})}function hc(e,t){const n={},a={};let r={name:"total",children:[],self:[],total:[],key:"/total"};return(t?[e,t]:[e]).forEach((e,t)=>{var i,o;for(let s=0;s<e.levels.length;s+=1)for(let l=0;l<e.levels[s].length;l+=4){const c=[t,s,l].join("/"),f=e.names[e.levels[s][l+3]],u=e.levels[s][l+0],d=e.levels[s][l+1],h=e.levels[s][l+2];let m="";if(0!==s){const n=s-1,r=e.levels[n];for(let e=0;e<r.length;e+=4){const i=r[e+0],o=r[e+1];if(u>=i&&u<i+o){const r=[t,n,e].join("/");m=a[r].key;break}}}const p=[m||"",f].join("/"),g=!n[p];n[p]||(n[p]={name:f,children:[],self:[],total:[],key:p});const v=n[p];(i=v.total)[t]||(i[t]=0),v.total[t]+=d,(o=v.self)[t]||(o[t]=0),v.self[t]+=h,a[c]=v,m&&g&&n[m].children.push(v),0===s&&(r=v)}}),r}const mc=e=>{const t={maxSelf:100,names:[],levels:[]},n=(e,a,r)=>{var i;const{name:o,children:s,self:l,total:c,offset:f}=e;t.names.push(o),(i=t.levels)[a]||(i[a]=[]),t.maxSelf=Math.max(t.maxSelf,l[0]||0),t.levels[a]=t.levels[a].concat([r,c[0]||0,l[0]||0,t.names.length-1]);for(let e=0;e<s.length;e+=1){r+=n(s[e],a+1,r)}return f||c[0]||0};return n(e,0,0),t};function pc(e){const t=new Map;for(let n=0;n<e.children.length;n+=1)t.has(e.children[n].name)||t.set(e.children[n].name,e.children[n]);for(let n=0;n<e.children.length;n+=1){const a=e.children[n],r=t.get(e.children[n].name);r&&r!==a&&(r.total[0]+=a.total[0],r.self[0]+=a.self[0],r.children=r.children.concat(a.children))}e.children=Array.from(t.values());for(let t=0;t<e.children.length;t+=1)pc(e.children[t])}function gc(e,t){const n=function(e,t){const n=hc(e),a={format:"single",numTicks:0,maxSelf:100,sampleRate:100,names:[],levels:[],units:e.units,spyName:e.spyName},r={name:t,total:[],self:[0],children:[]},i=e=>{e.name===t&&(a.numTicks+=e.total[0],r.total=[a.numTicks],r.children=r.children.concat(e.children));for(let t=0;t<e.children.length;t+=1)i(e.children[t])};return i(n),pc(r),{...a,...mc(r)}}(JSON.parse(JSON.stringify(e)),t);return n}function vc(e,t){const n=function(e,t){const n=hc(e),a={format:"single",maxSelf:100,sampleRate:100,numTicks:0,names:[],levels:[],units:e.units,spyName:e.spyName},r=[],i=[],o={name:t,total:[0],self:[0],children:[]},s=(e,n=[])=>{const o=n.concat([{...e,children:[]}]);e.name===t&&(i.push(o),r.push(e.total[0]),a.numTicks+=e.total[0]);for(let t=0;t<e.children.length;t+=1)s(e.children[t],o)};s(n),i.forEach((e,t)=>{o.children.push(((e,t)=>{const n={};let a=n;return e.forEach(({name:e,...n})=>{const r={name:e,...n,total:[t]};a.children=[r],a=r}),n.children[0]})(e.reverse(),r[t]))}),pc(o);const l=mc(o);return l.levels=l.levels.reverse().slice(0,-1),{...a,...l}}(JSON.parse(JSON.stringify(e)),t);return n}var bc={flamegraphContainer:"FlamegraphRenderer-module_flamegraphContainer__-7FRV",createdBy:"FlamegraphRenderer-module_createdBy__rHAOT",horizontal:"FlamegraphRenderer-module_horizontal__zs7--",vertical:"FlamegraphRenderer-module_vertical__fRcHg",panesWrapper:"FlamegraphRenderer-module_panesWrapper__L-mlA",tablePane:"FlamegraphRenderer-module_tablePane__Gin7Y",sandwichPane:"FlamegraphRenderer-module_sandwichPane__IEOyR",sandwichPaneInfo:"FlamegraphRenderer-module_sandwichPaneInfo__5hT4a",arrow:"FlamegraphRenderer-module_arrow__dPzpE",sandwichTop:"FlamegraphRenderer-module_sandwichTop__7N0ZY",sandwichBottom:"FlamegraphRenderer-module_sandwichBottom__Dc64g",name:"FlamegraphRenderer-module_name__XRbN9"};function yc(e){const t=[];return Object.keys(e).forEach(n=>{var a;t.push(`${n}="${a=String(e[n]||""),a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`)}),`[${t.join(" ")}]`}function wc(e,t){return`${(100*e/t).toFixed(2)}%`}function xc(e,t){let n,a,r,i;t?(n=.1,a=.93):(n=1,a=.7),e=Math.max(-1,Math.min(1,e)),Math.abs(e)<.2&&(n*=Math.abs(e)/.2),e>0&&(e**=1-.7),e<0&&(e=-((-e)**(1-.7))),e<0?(i=a,r=a*(1+n*e)):(r=a,i=a*(1-n*e));const o=a*(1-n);return`#${Math.floor(255*r).toString(16).padStart(2,"0")}${Math.floor(255*i).toString(16).padStart(2,"0")}${Math.floor(255*o).toString(16).padStart(2,"0")}`}function kc(e,t,n,a){const{self:r}=t,{total:i}=t,o=t.name.replace(/"/g,'\\"'),s=e(r),l=8+Math.ceil(16*Math.sqrt(r/n)),c=xc(i/a,!1),f=xc(i/a,!0),u=function(e,t,n,a,r){let i="";i=`${function(e){return e.replace(/.*\//,"")}(t)}\n`;const o=e(n);0!==n?i=`${i+o} (${wc(n,r)})`:i+="0";let s=o;a!==n&&(i+=0!==n?"\n":" ",s=e(a),i=`${i}of ${s} (${wc(a,r)})`);return i}(e,o,r,i,a),d={label:u,id:`node${t.index}`,fontsize:l,shape:"box",tooltip:`${o} (${s})`,color:c,fontcolor:"#000000",style:"filled",fontname:"",fillcolor:f};return`N${t.index} ${yc(d)}`}function Nc(e){if("double"===e.metadata.format)return"diff flamegraphs are not supported";const t=hc(e.flamebearer),n=[],a=[];const[r,i,,o]=function e(t,n,a,r,i){return t.children.forEach(t=>{const[o,s]=e(t,n,a,r,i);n=Math.max(n,o),a=Math.max(a,s)}),n=Math.max(n,t.self[0]),a=Math.max(a,t.total[0]),r+=t.self[0],i+=t.total[0],[n,a,r,i]}(t,0,0,0,0),{sampleRate:s,units:l}=e.metadata,c=Br(i,s,l),f=e=>c.format(e,s,!0);let u={};const d={};let h=0;function m(e,t){return-1===t.indexOf(e.name)&&(u[e.name]?(u[e.name].self+=e.self[0],u[e.name].total+=e.total[0]):(h+=1,u[e.name]={index:h,name:e.name,self:e.self[0],total:e.total[0],parents:[],children:[]})),e.children.forEach(n=>{const a=m(n,t.concat([e.name])),r=`${e.name}/${n.name}`;n.name!==e.name&&(d[r]?d[r].weight+=n.total[0]:d[r]={from:u[e.name],to:a,weight:n.total[0],residual:!1},a.parents.push(d[r]),u[e.name].children.push(d[r]))}),u[e.name]}t.children.forEach(e=>{m(e,[])});const p=.005*o,g=.001*o;function v(e,t){let n=0,a=t;if(e.forEach(e=>{e.weight>0&&(a+=Math.abs(e.weight))}),0!==a&&(e.forEach(e=>{const t=Math.abs(e.weight)/a;n+=-t*Math.log2(t)}),t>0)){const e=Math.abs(t)/a;n+=-e*Math.log2(e)}return n}Object.keys(u).forEach(e=>{u[e].total<p&&delete u[e]});const b={};Object.keys(u).forEach(e=>{b[u[e].name]=function(e){let t=0;return 0===e.parents.length?t+=1:t+=v(e.parents,0),0===e.children.length?t+=1:t+=v(e.children,e.self),t*e.total+e.self}(u[e])});const y=Object.values(u).sort((e,t)=>{const n=b[e.name],a=b[t.name];return n!==a?a-n:e.name!==t.name?e.name<t.name?-1:1:e.self!==t.self?a-n:e.name<t.name?-1:1}),w={};function x(e){const[t,n]=[e.from,e.to],a={},r=[n];for(;r.length>0;){const n=r.shift();for(let i=0;i<n.parents.length;i+=1){const o=n.parents[i];if(e!==o&&!a[o.from.name]){if(o.from===t)return!0;a[o.from.name]=!0,r.push(o.from)}}}return!1}return y.forEach(e=>{w[e.name]=e}),y.slice(80).forEach(e=>{delete w[e.name]}),function e(t,n){const a=!w[t.name];t.children.forEach(r=>{const i=!w[r.name];if(e(r,a?n:t),!i&&n&&a){const e=`${n.name}/${r.name}`;d[e]||(d[e]={from:u[n.name],to:u[r.name],weight:0,residual:!0}),d[e].weight+=r.total[0],d[e].residual=!0}})}(t,null),u=w,y.reverse().forEach(e=>{const t=e.parents.sort((e,t)=>t.weight-e.weight),n=[];for(let e=0;e<t.length;e+=1){const a=t[e];if(!a.residual)break;x(a)&&(n.push(a),delete d[`${a.from.name}/${a.to.name}`])}n.forEach(e=>{e.from.children=e.from.children.filter(t=>t.to!==e.to),e.to.parents=e.to.parents.filter(t=>t.from!==e.from)})}),Object.keys(d).forEach(e=>{const t=d[e];u[t.from.name]||delete d[e],u[t.to.name]||delete d[e],t.weight<g&&delete d[e]}),Object.keys(u).forEach(e=>{n.push(kc(f,u[e],r,i))}),Object.keys(d).forEach(e=>{a.push(function(e,t,n){const a=t.from.name.replace(/"/g,'\\"'),r=t.to.name.replace(/"/g,'\\"'),i=t.weight,o=e(t.weight),s=`${a} -> ${r} (${o})`,l={label:o,weight:1+100*i/n,penwidth:1+5*i/n,tooltip:s,labeltooltip:s,fontname:"",color:xc(i/n,!1),style:t.residual?"dotted":""};return`N${t.from.index} -> N${t.to.index} ${yc(l)}`}(f,d[e],i))}),`digraph "unnamed" {\n fontname= ""\n ${n.join("\n")}\n ${a.join("\n")}\n }`}var Sc="GraphVizPanel-module_graphVizPane__B18cQ";const Tc=()=>null;function Cc({flamebearer:t}){var n,a;const r=t,o=(null===(n=r.metadata)||void 0===n?void 0:n.format)&&(null===(a=r.flamebearer)||void 0===a?void 0:a.levels),s=`graphviz-pane-${(null==r?void 0:r.appName)||String((new Date).valueOf())}`,l=i(()=>Nc(r),[JSON.stringify(r)]);return e("div",{className:Sc,children:o?e(Tc,{options:{zoom:!0,width:"150%",height:"100%",scale:1,useWorker:!1},dot:l}):e("div",{children:"NO DATA"})},s)}function _c(e,t){const n=[...t];function a(e,t,n){for(const a of e){let e=0;for(let r=t;r<a.length;r+=n)a[r]-=e,e+=a[r]+a[r+1]}}return"double"===e?(a(n,0,7),a(n,3,7)):a(n,0,4),n}function Rc(e,t){const n=[...t];function a(e,t,n){for(const a of e){let e=0;for(let r=t;r<a.length;r+=n)a[r]+=e,e=a[r]+a[r+1]}}return"double"===e?(a(n,0,7),a(n,3,7)):a(n,0,4),n}function Pc(e){if(e.profile&&e.flamebearer&&console.warn("'profile' and 'flamebearer' properties are mutually exclusive. Please use profile if possible."),e.profile){const n={...e.profile,flamebearer:{...e.profile.flamebearer}};n.flamebearer.levels=JSON.parse(JSON.stringify(n.flamebearer.levels)),(t=n).flamebearer.levels=Rc(t.metadata.format,t.flamebearer.levels);const a={...n,...n.metadata,...n.flamebearer,flamebearer:void 0,metadata:void 0};return delete a.flamebearer,delete a.metadata,a}var t;if(e.flamebearer)return e.flamebearer;return{format:"single",names:[],units:"unknown",levels:[[]],spyName:"unknown",numTicks:0,sampleRate:0,maxSelf:0}}class Mc extends k{constructor(n){super(n),this.resetFlamegraphState={focusedNode:N.nothing(),zoom:N.nothing()},this.initialFlamegraphState=this.resetFlamegraphState,this.calcNewConfigs=(e,t)=>{const n=this.state.flamegraphConfigs,a=(e,t,n)=>{const a=(e,t,n)=>e.names[_r(e.format).getBarName(e.levels[t],n)];if(n.isNothing)return!0;try{const r=n,i=a(e,r.value.i,r.value.j);return i===a(t,r.value.i,r.value.j)}catch{return!1}};a(e,t,this.state.flamegraphConfigs.zoom)||(n.zoom=this.resetFlamegraphState.zoom);return a(e,t,this.state.flamegraphConfigs.focusedNode)||(n.focusedNode=this.resetFlamegraphState.focusedNode),n},this.onSearchChange=e=>{this.setState({searchQuery:e})},this.isSameFlamebearer=(e,t)=>function(e,t){var n;return e.format===t.format&&e.numTicks===t.numTicks&&e.sampleRate===t.sampleRate&&e.units===t.units&&(null===(n=e.names)||void 0===n?void 0:n.length)===(null==t?void 0:t.names.length)&&e.levels.length===t.levels.length&&!!e.names.every((e,n)=>e===t.names[n])&&!!function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){if(e[n].length!==t[n].length)return!1;for(let a=0;a<e[n].length;a++)if(e[n][a]!==t[n][a])return!1}return!0}(e.levels,t.levels)&&JSON.stringify({...e,levels:void 0,names:void 0})===JSON.stringify({...t,levels:void 0,names:void 0})}(e,t),this.onReset=()=>{this.setState({...this.state,flamegraphConfigs:{...this.state.flamegraphConfigs,...this.initialFlamegraphState},selectedItem:N.nothing()})},this.onFlamegraphZoom=e=>{e.isJust&&0===e.value.i&&0===e.value.j?this.onReset():this.setState({...this.state,flamegraphConfigs:{...this.state.flamegraphConfigs,zoom:e}})},this.onFocusOnNode=(e,t)=>{if(0===e&&0===t)return void this.onReset();let n={...this.state.flamegraphConfigs};const{zoom:a}=this.state.flamegraphConfigs;a.isJust&&a.value.i<=e&&(n={...n,zoom:this.initialFlamegraphState.zoom}),this.setState({...this.state,flamegraphConfigs:{...n,focusedNode:N.just({i:e,j:t})}})},this.setActiveItem=e=>{const{name:t}=e;this.state.selectedItem.isJust&&t===this.state.selectedItem.value?this.setState({selectedItem:N.nothing()}):this.setState({selectedItem:N.just(t)})},this.getHighlightQuery=()=>this.state.selectedItem.isJust?this.state.selectedItem.value:this.state.searchQuery,this.updateView=e=>{"sandwich"===e&&this.setState({searchQuery:"",flamegraphConfigs:this.resetFlamegraphState}),this.setState({view:e})},this.updateFlamegraphDirtiness=()=>{const e=this.isDirty();this.setState({isFlamegraphDirty:e})},this.updateFitMode=e=>{this.setState({fitMode:e})},this.isDirty=()=>this.state.selectedItem.isJust||JSON.stringify(this.initialFlamegraphState)!==JSON.stringify(this.state.flamegraphConfigs),this.handleSetPalette=e=>{this.setState({palette:e})},this.render=()=>{const n=e("div",{className:si(bc.tablePane,"vertical"===this.state.panesOrientation?bc.vertical:bc.horizontal),children:e(tl,{"data-testid":"table-view",flamebearer:this.state.flamebearer,fitMode:this.state.fitMode,highlightQuery:this.state.searchQuery,selectedItem:this.state.selectedItem,handleTableItemClick:this.setActiveItem,palette:this.state.palette})},"table-pane"),a=this.shouldShowToolbar(),r=e(vs,{showCredit:this.props.showCredit,flamebearer:this.state.flamebearer,highlightQuery:this.getHighlightQuery(),setActiveItem:this.setActiveItem,selectedItem:this.state.selectedItem,updateView:this.props.onlyDisplay?void 0:this.updateView,fitMode:this.state.fitMode,updateFitMode:this.updateFitMode,zoom:this.state.flamegraphConfigs.zoom,focusedNode:this.state.flamegraphConfigs.focusedNode,onZoom:this.onFlamegraphZoom,onFocusOnNode:this.onFocusOnNode,onReset:this.onReset,isDirty:this.isDirty,palette:this.state.palette,toolbarVisible:a,setPalette:this.handleSetPalette,enableSandwichView:this.props.enableSandwichView},"flamegraph-pane"),i=(()=>{if(this.state.selectedItem.isNothing)return e("div",{className:bc.sandwichPane,children:t("div",{className:si(bc.sandwichPaneInfo,"vertical"===this.state.panesOrientation?bc.vertical:bc.horizontal),children:[e("div",{className:bc.arrow}),"Select a function to view callers/callees sandwich view"]})},"sandwich-pane");const n=vc(this.state.flamebearer,this.state.selectedItem.value),r=gc(this.state.flamebearer,this.state.selectedItem.value),i=t=>e(vs,{disableClick:!0,showCredit:this.props.showCredit,highlightQuery:"",setActiveItem:this.setActiveItem,selectedItem:this.state.selectedItem,fitMode:this.state.fitMode,updateFitMode:this.updateFitMode,zoom:this.state.flamegraphConfigs.zoom,focusedNode:this.state.flamegraphConfigs.focusedNode,onZoom:this.onFlamegraphZoom,onFocusOnNode:this.onFocusOnNode,onReset:this.onReset,isDirty:this.isDirty,palette:this.state.palette,toolbarVisible:a,setPalette:this.handleSetPalette,...t});return t("div",{className:bc.sandwichPane,children:[t("div",{className:bc.sandwichTop,children:[e("span",{className:bc.name,children:"Callers"}),i({flamebearer:n})]}),t("div",{className:bc.sandwichBottom,children:[e("span",{className:bc.name,children:"Callees"}),i({flamebearer:r,headerVisible:!1,showSingleLevel:!0})]})]},"sandwich-pane")})(),o=!this.state.flamebearer||this.state.flamebearer.names.length<=1,s=function(e,t,n,a,r){switch(e){case"table":return[n];case"flamegraph":return[t];case"sandwich":return[n,a];case"both":return[n,t];case"graphviz":return[r];default:throw new Error(`Invalid view '${e}'`)}}(this.state.view,r,n,i,e(Cc,{flamebearer:this.state.flamebearer}));return t("div",{children:[t("div",{children:[a&&e(sc,{sharedQuery:this.props.sharedQuery,enableChangingDisplay:!this.props.onlyDisplay,flamegraphType:this.state.flamebearer.format,view:this.state.view,handleSearchChange:this.onSearchChange,reset:this.onReset,updateView:this.updateView,updateFitMode:this.updateFitMode,fitMode:this.state.fitMode,isFlamegraphDirty:this.isDirty(),selectedNode:this.state.flamegraphConfigs.zoom,highlightQuery:this.state.searchQuery,onFocusOnSubtree:this.onFocusOnNode,ExportData:this.props.ExportData,palette:this.state.palette,setPalette:this.handleSetPalette}),this.props.children,e("div",{className:`${bc.flamegraphContainer} ${si("vertical"===this.state.panesOrientation?bc.vertical:bc.horizontal,bc[this.state.panesOrientation],bc.panesWrapper)}`,children:o?e(ci,{}):s.map(e=>e)})]}),this.props.showPyroscopeLogo&&t("div",{className:bc.createdBy,children:["Created by",t("a",{href:"https://twitter.com/PyroscopeIO",rel:"noreferrer",target:"_blank",children:[e(j,{width:"30",height:"30"}),"@PyroscopeIO"]})]})]})},this.state={isFlamegraphDirty:!1,view:this.props.onlyDisplay?this.props.onlyDisplay:"both",fitMode:"HEAD",flamebearer:Pc(n),panesOrientation:n.panesOrientation?n.panesOrientation:"horizontal",searchQuery:"",selectedItem:N.nothing(),flamegraphConfigs:this.initialFlamegraphState,palette:Ao}}componentDidUpdate(e,t){const n=Pc(e),a=Pc(this.props);if(!this.isSameFlamebearer(n,a)){const e=this.calcNewConfigs(n,a);return void this.setState({flamebearer:a,flamegraphConfigs:{...this.state.flamegraphConfigs,...e},selectedItem:N.nothing()})}t.flamegraphConfigs!==this.state.flamegraphConfigs&&this.updateFlamegraphDirtiness()}shouldShowToolbar(){return void 0===this.props.showToolbar||this.props.showToolbar}}Mc.defaultProps={showCredit:!1};const Ic={showPyroscopeLogo:!1},Ec=(e,t)=>{if(t)return t;const n=null!=e?e:"auto";return"zh-CN"===("auto"===n?"undefined"!=typeof navigator&&navigator.language&&navigator.language.toLowerCase().startsWith("zh")?"zh-CN":"en":n)?$o:zo},jc=t=>{const{i18n:n,locale:r,colorMode:i="light",sandwich:o=!0,...s}=t,l=a.useMemo(()=>Ec(r,n),[r,n]),c=a.useMemo(()=>(e=>{switch(e){case"dark":return"ps-theme-dark";case"kylin":return"ps-theme-kylin";default:return"ps-theme-light"}})(i),[i]);return e("pyro-flamegraph",{className:c,children:e(Ho,{messages:l,children:e(Mc,{...Ic,enableSandwichView:o,...s})})})};function Fc(e){const t={numTicks:0,maxSelf:0,names:[],levels:[]},n={},a={children:[]};return e.spans.forEach(e=>{e.children=[],n[e.spanID]=e}),e.spans.forEach(e=>{let t=a;e.references&&e.references.length>0&&(t=n[e.references[0].spanID]||a),t.children.push(e)}),function e(t,n){(t.children||[]).forEach(t=>e(t));let a=0;const r=F(t.children||[],e=>e.operationName);t.children=A(r,e=>{const t=e[0];for(let n=1;n<e.length;n+=1)t.duration+=e[n].duration;return a+=t.duration,t}),t.total=t.duration||a,t.self=Math.max(0,t.total-a)}(a),function n(a,r,i){var o;return t.numTicks||(t.numTicks=a.total),(o=t.levels)[r]||(o[r]=[]),t.levels[r].push(i),t.levels[r].push(a.total),t.levels[r].push(a.self),t.names.push((a.processID?`${e.processes[a.processID].serviceName}: `:"")+(a.operationName||"total")),t.levels[r].push(t.names.length-1),(a.children||[]).forEach(e=>{i+=n(e,r+1,i)}),a.total}(a,0,0),t.levels=_c("single",t.levels),{version:1,flamebearer:t,metadata:{format:"single",units:"trace_samples",spyName:"tracing",sampleRate:1e6}}}function Ac(e,t){e.flamebearer.levels=Rc("single",e.flamebearer.levels),t.flamebearer.levels=Rc("single",t.flamebearer.levels);const n=function(e,t){const n={format:"double",numTicks:e.numTicks+t.numTicks,leftTicks:e.numTicks,rightTicks:t.numTicks,maxSelf:100,sampleRate:e.sampleRate,names:[],levels:[],units:e.units,spyName:e.spyName},a=hc(e,t),r=(e,t,a,i)=>{var o;const{name:s,children:l,self:c,total:f}=e;n.names.push(s),(o=n.levels)[t]||(o[t]=[]),n.maxSelf=Math.max(n.maxSelf,c[0]||0,c[1]||0),n.levels[t]=n.levels[t].concat([a,f[0]||0,c[0]||0,i,f[1]||0,c[1]||0,n.names.length-1]);for(let e=0;e<l.length;e+=1){const[n,o]=r(l[e],t+1,a,i);a+=n,i+=o}return[f[0]||0,f[1]||0]};return r(a,0,0,0),n}(e.flamebearer,t.flamebearer);n.levels=_c("double",n.levels);const a={...e.metadata};return a.format="double",{version:1,flamebearer:n,metadata:a,leftTicks:e.flamebearer.numTicks,rightTicks:t.flamebearer.numTicks}}export{br as Box,Ao as DefaultPalette,ii as Flamegraph,Ho as FlamegraphI18nProvider,jc as FlamegraphRenderer,Fc as convertJaegerTraceToProfile,Ac as diffTwoProfiles,zo as flamegraphDefaultMessages,$o as flamegraphZhCNMessages};
|
|
18
18
|
//# sourceMappingURL=index.node.esm.js.map
|