diff --git a/404.html b/404.html index 13308cca..ea54b9e9 100644 --- a/404.html +++ b/404.html @@ -10,14 +10,14 @@ Page Not Found | memlab - - + +
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

- - + + \ No newline at end of file diff --git a/assets/js/015e0bf7.0e281620.js b/assets/js/015e0bf7.08259160.js similarity index 98% rename from assets/js/015e0bf7.0e281620.js rename to assets/js/015e0bf7.08259160.js index 0471ab50..520d613c 100644 --- a/assets/js/015e0bf7.0e281620.js +++ b/assets/js/015e0bf7.08259160.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[2775],{5680:(e,a,n)=>{n.d(a,{xA:()=>y,yg:()=>m});var t=n(6540);function s(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function i(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function r(e){for(var a=1;a=0||(s[n]=e[n]);return s}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var o=t.createContext({}),p=function(e){var a=t.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):r(r({},a),e)),n},y=function(e){var a=p(e.components);return t.createElement(o.Provider,{value:a},e.children)},g="mdxType",c={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},u=t.forwardRef((function(e,a){var n=e.components,s=e.mdxType,i=e.originalType,o=e.parentName,y=l(e,["components","mdxType","originalType","parentName"]),g=p(n),u=s,m=g["".concat(o,".").concat(u)]||g[u]||c[u]||i;return n?t.createElement(m,r(r({ref:a},y),{},{components:n})):t.createElement(m,r({ref:a},y))}));function m(e,a){var n=arguments,s=a&&a.mdxType;if("string"==typeof e||s){var i=n.length,r=new Array(i);r[0]=u;var l={};for(var o in a)hasOwnProperty.call(a,o)&&(l[o]=a[o]);l.originalType=e,l[g]="string"==typeof e?e:s,r[1]=l;for(var p=2;p{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>r,default:()=>c,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var t=n(8168),s=(n(6540),n(5680));const i={id:"heap_analysis_src.StringAnalysis",title:"Class: StringAnalysis",sidebar_label:"StringAnalysis",custom_edit_url:null},r=void 0,l={unversionedId:"api/classes/heap_analysis_src.StringAnalysis",id:"api/classes/heap_analysis_src.StringAnalysis",title:"Class: StringAnalysis",description:"This analysis finds duplicated string instance in JavaScript heap",source:"@site/docs/api/classes/heap_analysis_src.StringAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.StringAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.StringAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.StringAnalysis",title:"Class: StringAnalysis",sidebar_label:"StringAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"ShapeUnboundGrowthAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ShapeUnboundGrowthAnalysis"},next:{title:"IBrowserInfo",permalink:"/memlab/docs/api/interfaces/core_src.IBrowserInfo"}},o={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new StringAnalysis()',id:"new-stringanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotFromFile(file, options?)',id:"analyzesnapshotfromfilefile-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3},{value:'getTopDuplicatedStringsInCount()',id:"gettopduplicatedstringsincount",level:3}],y={toc:p},g="wrapper";function c(e){let{components:a,...n}=e;return(0,s.yg)(g,(0,t.A)({},y,n,{components:a,mdxType:"MDXLayout"}),(0,s.yg)("p",null,"This analysis finds duplicated string instance in JavaScript heap\nand rank them based on the duplicated string size and count."),(0,s.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},(0,s.yg)("inlineCode",{parentName:"a"},"BaseAnalysis"))),(0,s.yg)("p",{parentName:"li"},"\u21b3 ",(0,s.yg)("strong",{parentName:"p"},(0,s.yg)("inlineCode",{parentName:"strong"},"StringAnalysis"))))),(0,s.yg)("h2",{id:"constructors"},"Constructors"),(0,s.yg)("h3",{id:"new-stringanalysis"},(0,s.yg)("a",{id:"new stringanalysis"}),(0,s.yg)("strong",{parentName:"h3"},"new StringAnalysis"),"()"),(0,s.yg)("h2",{id:"methods"},"Methods"),(0,s.yg)("h3",{id:"analyzesnapshotfromfilefile-options"},(0,s.yg)("a",{id:"analyzesnapshotfromfile"}),(0,s.yg)("strong",{parentName:"h3"},"analyzeSnapshotFromFile"),"(",(0,s.yg)("inlineCode",{parentName:"h3"},"file"),", ",(0,s.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,s.yg)("p",null,"Run heap analysis for a single heap snapshot file"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Parameters"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of a ",(0,s.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," file."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,s.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,s.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Example"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile);\n// query analysis-specific and structured results\nconst stringPatterns = analysis.getTopDuplicatedStringsInCount();\n")),(0,s.yg)("p",null,"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:"),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/BaseAnalysis.ts#L95"},"heap-analysis/src/BaseAnalysis.ts:95"))))),(0,s.yg)("hr",null),(0,s.yg)("h3",{id:"getcommandname"},(0,s.yg)("a",{id:"getcommandname"}),(0,s.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,s.yg)("p",null,"get CLI command name for this memory analysis;\nuse it with ",(0,s.yg)("inlineCode",{parentName:"p"},"memlab analyze ")," in CLI"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("strong",{parentName:"p"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"p"},"string")," | command name")),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("strong",{parentName:"p"},"Source"),":"),(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/plugins/StringAnalysis.ts#L118"},"heap-analysis/src/plugins/StringAnalysis.ts:118"))))),(0,s.yg)("hr",null),(0,s.yg)("h3",{id:"gettopduplicatedstringsincount"},(0,s.yg)("a",{id:"gettopduplicatedstringsincount"}),(0,s.yg)("strong",{parentName:"h3"},"getTopDuplicatedStringsInCount"),"()"),(0,s.yg)("p",null,"get the top duplicated string in terms of duplicated string count"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("strong",{parentName:"p"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"p"},"StringRecord"),"[] | an array of the top-duplicated strings' information")),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("strong",{parentName:"p"},"Source"),":"),(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/plugins/StringAnalysis.ts#L68"},"heap-analysis/src/plugins/StringAnalysis.ts:68"))))))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[2775],{5680:(e,a,n)=>{n.d(a,{xA:()=>y,yg:()=>m});var t=n(6540);function s(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function i(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function r(e){for(var a=1;a=0||(s[n]=e[n]);return s}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var o=t.createContext({}),p=function(e){var a=t.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):r(r({},a),e)),n},y=function(e){var a=p(e.components);return t.createElement(o.Provider,{value:a},e.children)},g="mdxType",c={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},u=t.forwardRef((function(e,a){var n=e.components,s=e.mdxType,i=e.originalType,o=e.parentName,y=l(e,["components","mdxType","originalType","parentName"]),g=p(n),u=s,m=g["".concat(o,".").concat(u)]||g[u]||c[u]||i;return n?t.createElement(m,r(r({ref:a},y),{},{components:n})):t.createElement(m,r({ref:a},y))}));function m(e,a){var n=arguments,s=a&&a.mdxType;if("string"==typeof e||s){var i=n.length,r=new Array(i);r[0]=u;var l={};for(var o in a)hasOwnProperty.call(a,o)&&(l[o]=a[o]);l.originalType=e,l[g]="string"==typeof e?e:s,r[1]=l;for(var p=2;p{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>r,default:()=>c,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var t=n(8168),s=(n(6540),n(5680));const i={id:"heap_analysis_src.StringAnalysis",title:"Class: StringAnalysis",sidebar_label:"StringAnalysis",custom_edit_url:null},r=void 0,l={unversionedId:"api/classes/heap_analysis_src.StringAnalysis",id:"api/classes/heap_analysis_src.StringAnalysis",title:"Class: StringAnalysis",description:"This analysis finds duplicated string instance in JavaScript heap",source:"@site/docs/api/classes/heap_analysis_src.StringAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.StringAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.StringAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.StringAnalysis",title:"Class: StringAnalysis",sidebar_label:"StringAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"ShapeUnboundGrowthAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ShapeUnboundGrowthAnalysis"},next:{title:"IBrowserInfo",permalink:"/memlab/docs/api/interfaces/core_src.IBrowserInfo"}},o={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new StringAnalysis()',id:"new-stringanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotFromFile(file, options?)',id:"analyzesnapshotfromfilefile-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3},{value:'getTopDuplicatedStringsInCount()',id:"gettopduplicatedstringsincount",level:3}],y={toc:p},g="wrapper";function c(e){let{components:a,...n}=e;return(0,s.yg)(g,(0,t.A)({},y,n,{components:a,mdxType:"MDXLayout"}),(0,s.yg)("p",null,"This analysis finds duplicated string instance in JavaScript heap\nand rank them based on the duplicated string size and count."),(0,s.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},(0,s.yg)("inlineCode",{parentName:"a"},"BaseAnalysis"))),(0,s.yg)("p",{parentName:"li"},"\u21b3 ",(0,s.yg)("strong",{parentName:"p"},(0,s.yg)("inlineCode",{parentName:"strong"},"StringAnalysis"))))),(0,s.yg)("h2",{id:"constructors"},"Constructors"),(0,s.yg)("h3",{id:"new-stringanalysis"},(0,s.yg)("a",{id:"new stringanalysis"}),(0,s.yg)("strong",{parentName:"h3"},"new StringAnalysis"),"()"),(0,s.yg)("h2",{id:"methods"},"Methods"),(0,s.yg)("h3",{id:"analyzesnapshotfromfilefile-options"},(0,s.yg)("a",{id:"analyzesnapshotfromfile"}),(0,s.yg)("strong",{parentName:"h3"},"analyzeSnapshotFromFile"),"(",(0,s.yg)("inlineCode",{parentName:"h3"},"file"),", ",(0,s.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,s.yg)("p",null,"Run heap analysis for a single heap snapshot file"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Parameters"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of a ",(0,s.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," file."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,s.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,s.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Example"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile);\n// query analysis-specific and structured results\nconst stringPatterns = analysis.getTopDuplicatedStringsInCount();\n")),(0,s.yg)("p",null,"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:"),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/BaseAnalysis.ts#L95"},"heap-analysis/src/BaseAnalysis.ts:95"))))),(0,s.yg)("hr",null),(0,s.yg)("h3",{id:"getcommandname"},(0,s.yg)("a",{id:"getcommandname"}),(0,s.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,s.yg)("p",null,"get CLI command name for this memory analysis;\nuse it with ",(0,s.yg)("inlineCode",{parentName:"p"},"memlab analyze ")," in CLI"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("strong",{parentName:"p"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"p"},"string")," | command name")),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("strong",{parentName:"p"},"Source"),":"),(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/plugins/StringAnalysis.ts#L118"},"heap-analysis/src/plugins/StringAnalysis.ts:118"))))),(0,s.yg)("hr",null),(0,s.yg)("h3",{id:"gettopduplicatedstringsincount"},(0,s.yg)("a",{id:"gettopduplicatedstringsincount"}),(0,s.yg)("strong",{parentName:"h3"},"getTopDuplicatedStringsInCount"),"()"),(0,s.yg)("p",null,"get the top duplicated string in terms of duplicated string count"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("strong",{parentName:"p"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"p"},"StringRecord"),"[] | an array of the top-duplicated strings' information")),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("strong",{parentName:"p"},"Source"),":"),(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/plugins/StringAnalysis.ts#L68"},"heap-analysis/src/plugins/StringAnalysis.ts:68"))))))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/086eefc4.ffc16a5b.js b/assets/js/086eefc4.4fa0f3b0.js similarity index 97% rename from assets/js/086eefc4.ffc16a5b.js rename to assets/js/086eefc4.4fa0f3b0.js index ab2acde0..10b46825 100644 --- a/assets/js/086eefc4.ffc16a5b.js +++ b/assets/js/086eefc4.4fa0f3b0.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[6192],{5680:(e,a,t)=>{t.d(a,{xA:()=>g,yg:()=>d});var n=t(6540);function r(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function s(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function l(e){for(var a=1;a=0||(r[t]=e[t]);return r}(e,a);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var i=n.createContext({}),p=function(e){var a=n.useContext(i),t=a;return e&&(t="function"==typeof e?e(a):l(l({},a),e)),t},g=function(e){var a=p(e.components);return n.createElement(i.Provider,{value:a},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},m=n.forwardRef((function(e,a){var t=e.components,r=e.mdxType,s=e.originalType,i=e.parentName,g=o(e,["components","mdxType","originalType","parentName"]),u=p(t),m=r,d=u["".concat(i,".").concat(m)]||u[m]||c[m]||s;return t?n.createElement(d,l(l({ref:a},g),{},{components:t})):n.createElement(d,l({ref:a},g))}));function d(e,a){var t=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var s=t.length,l=new Array(s);l[0]=m;var o={};for(var i in a)hasOwnProperty.call(a,i)&&(o[i]=a[i]);o.originalType=e,o[u]="string"==typeof e?e:r,l[1]=o;for(var p=2;p{t.r(a),t.d(a,{assets:()=>i,contentTitle:()=>l,default:()=>c,frontMatter:()=>s,metadata:()=>o,toc:()=>p});var n=t(8168),r=(t(6540),t(5680));const s={id:"api_src.SnapshotResultReader",title:"Class: SnapshotResultReader",sidebar_label:"SnapshotResultReader",custom_edit_url:null},l=void 0,o={unversionedId:"api/classes/api_src.SnapshotResultReader",id:"api/classes/api_src.SnapshotResultReader",title:"Class: SnapshotResultReader",description:"A utility entity to read all MemLab files generated from",source:"@site/docs/api/classes/api_src.SnapshotResultReader.md",sourceDirName:"api/classes",slug:"/api/classes/api_src.SnapshotResultReader",permalink:"/memlab/docs/api/classes/api_src.SnapshotResultReader",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"api_src.SnapshotResultReader",title:"Class: SnapshotResultReader",sidebar_label:"SnapshotResultReader",custom_edit_url:null},sidebar:"sidebar",previous:{title:"BrowserInteractionResultReader",permalink:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"},next:{title:"BaseAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"}},i={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Methods",id:"methods",level:2},{value:'getConsoleBackupFile()',id:"getconsolebackupfile",level:3},{value:'getInteractionSteps()',id:"getinteractionsteps",level:3},{value:'getRootDirectory()',id:"getrootdirectory",level:3},{value:'getSnapshotFiles()',id:"getsnapshotfiles",level:3},{value:'Static fromSnapshots(baselineSnapshot, targetSnapshot, finalSnapshot)',id:"static-fromsnapshotsbaselinesnapshot-targetsnapshot-finalsnapshot",level:3}],g={toc:p},u="wrapper";function c(e){let{components:a,...t}=e;return(0,r.yg)(u,(0,n.A)({},g,t,{components:a,mdxType:"MDXLayout"}),(0,r.yg)("p",null,"A utility entity to read all MemLab files generated from\nbaseline, target and final heap snapshots."),(0,r.yg)("p",null,"The most useful feature of this class is when you have\nthree separate snapshots (baseline, target, and final)\nthat are not taken from MemLab, but you still would\nlike to use the ",(0,r.yg)("inlineCode",{parentName:"p"},"findLeaks")," to detect memory leaks:"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {SnapshotResultReader, findLeaks} = require('@memlab/api');\n\n// baseline, target, and final are file paths of heap snapshot files\nconst reader = SnapshotResultReader.fromSnapshots(baseline, target, final);\nconst leaks = await findLeaks(reader);\n")),(0,r.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("inlineCode",{parentName:"p"},"default")),(0,r.yg)("p",{parentName:"li"},"\u21b3 ",(0,r.yg)("strong",{parentName:"p"},(0,r.yg)("inlineCode",{parentName:"strong"},"SnapshotResultReader"))))),(0,r.yg)("h2",{id:"methods"},"Methods"),(0,r.yg)("h3",{id:"getconsolebackupfile"},(0,r.yg)("a",{id:"getconsolebackupfile"}),(0,r.yg)("strong",{parentName:"h3"},"getConsoleBackupFile"),"()"),(0,r.yg)("p",null,"This method gets the backup file of the console output."),(0,r.yg)("p",null,"The memlab CLI commands (e.g., ",(0,r.yg)("inlineCode",{parentName:"p"},"memlab find-leaks"),") outputs a\nnon-structured string representation for easy reading, while the\nAPIs (e.g., ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#findleaks"},"findLeaks")),") return structured leaks\nrepresentation that is handy for post-processing. If you need to\nobtain all the string output from the CLI in the current working directory,\nyou can read them from the CLI output backup file returned by this method."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of the backup file"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {takeSnapshots, findLeaks} = require('@memlab/api');\n\n(async function () {\n const scenario = { url: () => 'https://www.npmjs.com'};\n const result = await takeSnapshots({scenario});\n const leaks = await findLeaks(result);\n\n // get the console output backup file\n const consoleBackupFile = result.getConsoleBackupFile();\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/result-reader/BaseResultReader.ts#L102"},"api/src/result-reader/BaseResultReader.ts:102"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"getinteractionsteps"},(0,r.yg)("a",{id:"getinteractionsteps"}),(0,r.yg)("strong",{parentName:"h3"},"getInteractionSteps"),"()"),(0,r.yg)("p",null,"browser interaction step sequence"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"E2EStepInfo"),"[] | an array of browser interaction step information")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {SnapshotResultReader} = require('@memlab/api');\n\n// baseline, target, and final are file paths of heap snapshot files\nconst reader = SnapshotResultReader.fromSnapshots(baseline, target, final);\nconst paths = reader.getInteractionSteps();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/result-reader/SnapshotResultReader.ts#L159"},"api/src/result-reader/SnapshotResultReader.ts:159"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"getrootdirectory"},(0,r.yg)("a",{id:"getrootdirectory"}),(0,r.yg)("strong",{parentName:"h3"},"getRootDirectory"),"()"),(0,r.yg)("p",null,"get the directory where the data and generated files of\nthe memlab run were stored"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | absolute path of the directory"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {takeSnapshots} = require('@memlab/api');\n\n(async function () {\n const scenario = { url: () => 'https://www.npmjs.com'};\n const result = await takeSnapshots({scenario});\n\n // get the directory that stores all the files\n // generated from the takeSnapshots call\n const dataDir = result.getRootDirectory();\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/result-reader/BaseResultReader.ts#L72"},"api/src/result-reader/BaseResultReader.ts:72"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"getsnapshotfiles"},(0,r.yg)("a",{id:"getsnapshotfiles"}),(0,r.yg)("strong",{parentName:"h3"},"getSnapshotFiles"),"()"),(0,r.yg)("p",null,"get all snapshot files related to this SnapshotResultReader"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"string"),"[] | an array of snapshot file's absolute path")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {SnapshotResultReader} = require('@memlab/api');\n\n// baseline, target, and final are file paths of heap snapshot files\nconst reader = SnapshotResultReader.fromSnapshots(baseline, target, final);\nconst paths = reader.getSnapshotFiles();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/result-reader/SnapshotResultReader.ts#L132"},"api/src/result-reader/SnapshotResultReader.ts:132"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"static-fromsnapshotsbaselinesnapshot-targetsnapshot-finalsnapshot"},(0,r.yg)("a",{id:"fromsnapshots"}),(0,r.yg)("inlineCode",{parentName:"h3"},"Static")," ",(0,r.yg)("strong",{parentName:"h3"},"fromSnapshots"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"baselineSnapshot"),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"targetSnapshot"),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"finalSnapshot"),")"),(0,r.yg)("p",null,"Build a result reader from baseline, target, and final heap snapshot files.\nThe three snapshot files do not have to be in the same directory."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"baselineSnapshot"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | file path of the baseline heap snapshot"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"targetSnapshot"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | file path of the target heap snapshot"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"finalSnapshot"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | file path of the final heap snapshot"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/api_src.SnapshotResultReader"},(0,r.yg)("inlineCode",{parentName:"a"},"SnapshotResultReader"))," | the ResultReader instance")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {SnapshotResultReader, findLeaks} = require('@memlab/api');\n\n// baseline, target, and final are file paths of heap snapshot files\nconst reader = SnapshotResultReader.fromSnapshots(baseline, target, final);\nconst leaks = await findLeaks(reader);\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/result-reader/SnapshotResultReader.ts#L99"},"api/src/result-reader/SnapshotResultReader.ts:99"))))))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[6192],{5680:(e,a,t)=>{t.d(a,{xA:()=>g,yg:()=>d});var n=t(6540);function r(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function s(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function l(e){for(var a=1;a=0||(r[t]=e[t]);return r}(e,a);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var i=n.createContext({}),p=function(e){var a=n.useContext(i),t=a;return e&&(t="function"==typeof e?e(a):l(l({},a),e)),t},g=function(e){var a=p(e.components);return n.createElement(i.Provider,{value:a},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},m=n.forwardRef((function(e,a){var t=e.components,r=e.mdxType,s=e.originalType,i=e.parentName,g=o(e,["components","mdxType","originalType","parentName"]),u=p(t),m=r,d=u["".concat(i,".").concat(m)]||u[m]||c[m]||s;return t?n.createElement(d,l(l({ref:a},g),{},{components:t})):n.createElement(d,l({ref:a},g))}));function d(e,a){var t=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var s=t.length,l=new Array(s);l[0]=m;var o={};for(var i in a)hasOwnProperty.call(a,i)&&(o[i]=a[i]);o.originalType=e,o[u]="string"==typeof e?e:r,l[1]=o;for(var p=2;p{t.r(a),t.d(a,{assets:()=>i,contentTitle:()=>l,default:()=>c,frontMatter:()=>s,metadata:()=>o,toc:()=>p});var n=t(8168),r=(t(6540),t(5680));const s={id:"api_src.SnapshotResultReader",title:"Class: SnapshotResultReader",sidebar_label:"SnapshotResultReader",custom_edit_url:null},l=void 0,o={unversionedId:"api/classes/api_src.SnapshotResultReader",id:"api/classes/api_src.SnapshotResultReader",title:"Class: SnapshotResultReader",description:"A utility entity to read all MemLab files generated from",source:"@site/docs/api/classes/api_src.SnapshotResultReader.md",sourceDirName:"api/classes",slug:"/api/classes/api_src.SnapshotResultReader",permalink:"/memlab/docs/api/classes/api_src.SnapshotResultReader",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"api_src.SnapshotResultReader",title:"Class: SnapshotResultReader",sidebar_label:"SnapshotResultReader",custom_edit_url:null},sidebar:"sidebar",previous:{title:"BrowserInteractionResultReader",permalink:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"},next:{title:"BaseAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"}},i={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Methods",id:"methods",level:2},{value:'getConsoleBackupFile()',id:"getconsolebackupfile",level:3},{value:'getInteractionSteps()',id:"getinteractionsteps",level:3},{value:'getRootDirectory()',id:"getrootdirectory",level:3},{value:'getSnapshotFiles()',id:"getsnapshotfiles",level:3},{value:'Static fromSnapshots(baselineSnapshot, targetSnapshot, finalSnapshot)',id:"static-fromsnapshotsbaselinesnapshot-targetsnapshot-finalsnapshot",level:3}],g={toc:p},u="wrapper";function c(e){let{components:a,...t}=e;return(0,r.yg)(u,(0,n.A)({},g,t,{components:a,mdxType:"MDXLayout"}),(0,r.yg)("p",null,"A utility entity to read all MemLab files generated from\nbaseline, target and final heap snapshots."),(0,r.yg)("p",null,"The most useful feature of this class is when you have\nthree separate snapshots (baseline, target, and final)\nthat are not taken from MemLab, but you still would\nlike to use the ",(0,r.yg)("inlineCode",{parentName:"p"},"findLeaks")," to detect memory leaks:"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {SnapshotResultReader, findLeaks} = require('@memlab/api');\n\n// baseline, target, and final are file paths of heap snapshot files\nconst reader = SnapshotResultReader.fromSnapshots(baseline, target, final);\nconst leaks = await findLeaks(reader);\n")),(0,r.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("inlineCode",{parentName:"p"},"default")),(0,r.yg)("p",{parentName:"li"},"\u21b3 ",(0,r.yg)("strong",{parentName:"p"},(0,r.yg)("inlineCode",{parentName:"strong"},"SnapshotResultReader"))))),(0,r.yg)("h2",{id:"methods"},"Methods"),(0,r.yg)("h3",{id:"getconsolebackupfile"},(0,r.yg)("a",{id:"getconsolebackupfile"}),(0,r.yg)("strong",{parentName:"h3"},"getConsoleBackupFile"),"()"),(0,r.yg)("p",null,"This method gets the backup file of the console output."),(0,r.yg)("p",null,"The memlab CLI commands (e.g., ",(0,r.yg)("inlineCode",{parentName:"p"},"memlab find-leaks"),") outputs a\nnon-structured string representation for easy reading, while the\nAPIs (e.g., ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#findleaks"},"findLeaks")),") return structured leaks\nrepresentation that is handy for post-processing. If you need to\nobtain all the string output from the CLI in the current working directory,\nyou can read them from the CLI output backup file returned by this method."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of the backup file"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {takeSnapshots, findLeaks} = require('@memlab/api');\n\n(async function () {\n const scenario = { url: () => 'https://www.npmjs.com'};\n const result = await takeSnapshots({scenario});\n const leaks = await findLeaks(result);\n\n // get the console output backup file\n const consoleBackupFile = result.getConsoleBackupFile();\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/result-reader/BaseResultReader.ts#L102"},"api/src/result-reader/BaseResultReader.ts:102"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"getinteractionsteps"},(0,r.yg)("a",{id:"getinteractionsteps"}),(0,r.yg)("strong",{parentName:"h3"},"getInteractionSteps"),"()"),(0,r.yg)("p",null,"browser interaction step sequence"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"E2EStepInfo"),"[] | an array of browser interaction step information")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {SnapshotResultReader} = require('@memlab/api');\n\n// baseline, target, and final are file paths of heap snapshot files\nconst reader = SnapshotResultReader.fromSnapshots(baseline, target, final);\nconst paths = reader.getInteractionSteps();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/result-reader/SnapshotResultReader.ts#L159"},"api/src/result-reader/SnapshotResultReader.ts:159"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"getrootdirectory"},(0,r.yg)("a",{id:"getrootdirectory"}),(0,r.yg)("strong",{parentName:"h3"},"getRootDirectory"),"()"),(0,r.yg)("p",null,"get the directory where the data and generated files of\nthe memlab run were stored"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | absolute path of the directory"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {takeSnapshots} = require('@memlab/api');\n\n(async function () {\n const scenario = { url: () => 'https://www.npmjs.com'};\n const result = await takeSnapshots({scenario});\n\n // get the directory that stores all the files\n // generated from the takeSnapshots call\n const dataDir = result.getRootDirectory();\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/result-reader/BaseResultReader.ts#L72"},"api/src/result-reader/BaseResultReader.ts:72"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"getsnapshotfiles"},(0,r.yg)("a",{id:"getsnapshotfiles"}),(0,r.yg)("strong",{parentName:"h3"},"getSnapshotFiles"),"()"),(0,r.yg)("p",null,"get all snapshot files related to this SnapshotResultReader"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"string"),"[] | an array of snapshot file's absolute path")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {SnapshotResultReader} = require('@memlab/api');\n\n// baseline, target, and final are file paths of heap snapshot files\nconst reader = SnapshotResultReader.fromSnapshots(baseline, target, final);\nconst paths = reader.getSnapshotFiles();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/result-reader/SnapshotResultReader.ts#L132"},"api/src/result-reader/SnapshotResultReader.ts:132"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"static-fromsnapshotsbaselinesnapshot-targetsnapshot-finalsnapshot"},(0,r.yg)("a",{id:"fromsnapshots"}),(0,r.yg)("inlineCode",{parentName:"h3"},"Static")," ",(0,r.yg)("strong",{parentName:"h3"},"fromSnapshots"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"baselineSnapshot"),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"targetSnapshot"),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"finalSnapshot"),")"),(0,r.yg)("p",null,"Build a result reader from baseline, target, and final heap snapshot files.\nThe three snapshot files do not have to be in the same directory."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"baselineSnapshot"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | file path of the baseline heap snapshot"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"targetSnapshot"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | file path of the target heap snapshot"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"finalSnapshot"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | file path of the final heap snapshot"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/api_src.SnapshotResultReader"},(0,r.yg)("inlineCode",{parentName:"a"},"SnapshotResultReader"))," | the ResultReader instance")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {SnapshotResultReader, findLeaks} = require('@memlab/api');\n\n// baseline, target, and final are file paths of heap snapshot files\nconst reader = SnapshotResultReader.fromSnapshots(baseline, target, final);\nconst leaks = await findLeaks(reader);\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/result-reader/SnapshotResultReader.ts#L99"},"api/src/result-reader/SnapshotResultReader.ts:99"))))))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0d63082f.c50dc84f.js b/assets/js/0d63082f.8bdf34e4.js similarity index 97% rename from assets/js/0d63082f.c50dc84f.js rename to assets/js/0d63082f.8bdf34e4.js index 4f41345c..9f0b9f32 100644 --- a/assets/js/0d63082f.c50dc84f.js +++ b/assets/js/0d63082f.8bdf34e4.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[5214],{5680:(e,a,n)=>{n.d(a,{xA:()=>y,yg:()=>u});var s=n(6540);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);a&&(s=s.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,s)}return n}function i(e){for(var a=1;a=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(s=0;s=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var o=s.createContext({}),p=function(e){var a=s.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},y=function(e){var a=p(e.components);return s.createElement(o.Provider,{value:a},e.children)},g="mdxType",m={inlineCode:"code",wrapper:function(e){var a=e.children;return s.createElement(s.Fragment,{},a)}},c=s.forwardRef((function(e,a){var n=e.components,t=e.mdxType,l=e.originalType,o=e.parentName,y=r(e,["components","mdxType","originalType","parentName"]),g=p(n),c=t,u=g["".concat(o,".").concat(c)]||g[c]||m[c]||l;return n?s.createElement(u,i(i({ref:a},y),{},{components:n})):s.createElement(u,i({ref:a},y))}));function u(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var l=n.length,i=new Array(l);i[0]=c;var r={};for(var o in a)hasOwnProperty.call(a,o)&&(r[o]=a[o]);r.originalType=e,r[g]="string"==typeof e?e:t,i[1]=r;for(var p=2;p{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>p});var s=n(8168),t=(n(6540),n(5680));const l={id:"heap_analysis_src.BaseAnalysis",title:"Class: BaseAnalysis",sidebar_label:"BaseAnalysis",custom_edit_url:null},i=void 0,r={unversionedId:"api/classes/heap_analysis_src.BaseAnalysis",id:"api/classes/heap_analysis_src.BaseAnalysis",title:"Class: BaseAnalysis",description:"Hierarchy",source:"@site/docs/api/classes/heap_analysis_src.BaseAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.BaseAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.BaseAnalysis",title:"Class: BaseAnalysis",sidebar_label:"BaseAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"SnapshotResultReader",permalink:"/memlab/docs/api/classes/api_src.SnapshotResultReader"},next:{title:"CollectionsHoldingStaleAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.CollectionsHoldingStaleAnalysis"}},o={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new BaseAnalysis()',id:"new-baseanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotFromFile(file, options?)',id:"analyzesnapshotfromfilefile-options",level:3},{value:'analyzeSnapshotsInDirectory(directory, options?)',id:"analyzesnapshotsindirectorydirectory-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3},{value:'getDescription()',id:"getdescription",level:3},{value:'getOptions()',id:"getoptions",level:3},{value:'process(options)',id:"processoptions",level:3}],y={toc:p},g="wrapper";function m(e){let{components:a,...n}=e;return(0,t.yg)(g,(0,s.A)({},y,n,{components:a,mdxType:"MDXLayout"}),(0,t.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("inlineCode",{parentName:"p"},"Analysis")),(0,t.yg)("p",{parentName:"li"},"\u21b3 ",(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"BaseAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.DetachedDOMElementAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"DetachedDOMElementAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.GlobalVariableAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"GlobalVariableAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.CollectionsHoldingStaleAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"CollectionsHoldingStaleAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.ObjectShallowAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"ObjectShallowAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.ObjectSizeAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"ObjectSizeAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.ShapeUnboundGrowthAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"ShapeUnboundGrowthAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.ObjectFanoutAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"ObjectFanoutAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.ObjectShapeAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"ObjectShapeAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.ObjectUnboundGrowthAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"ObjectUnboundGrowthAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.StringAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"StringAnalysis"))))),(0,t.yg)("h2",{id:"constructors"},"Constructors"),(0,t.yg)("h3",{id:"new-baseanalysis"},(0,t.yg)("a",{id:"new baseanalysis"}),(0,t.yg)("strong",{parentName:"h3"},"new BaseAnalysis"),"()"),(0,t.yg)("h2",{id:"methods"},"Methods"),(0,t.yg)("h3",{id:"analyzesnapshotfromfilefile-options"},(0,t.yg)("a",{id:"analyzesnapshotfromfile"}),(0,t.yg)("strong",{parentName:"h3"},"analyzeSnapshotFromFile"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"file"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,t.yg)("p",null,"Run heap analysis for a single heap snapshot file"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of a ",(0,t.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," file."),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,t.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,t.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Example"),":")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile);\n// query analysis-specific and structured results\nconst stringPatterns = analysis.getTopDuplicatedStringsInCount();\n")),(0,t.yg)("p",null,"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/BaseAnalysis.ts#L95"},"heap-analysis/src/BaseAnalysis.ts:95"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"analyzesnapshotsindirectorydirectory-options"},(0,t.yg)("a",{id:"analyzesnapshotsindirectory"}),(0,t.yg)("strong",{parentName:"h3"},"analyzeSnapshotsInDirectory"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"directory"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,t.yg)("p",null,"Run heap analysis for a series of heap snapshot files"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"directory"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of the directory holding a series of ",(0,t.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," files, all snapshot files will be loaded and analyzed in the alphanumerically ascending order of those snapshot file names."),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,t.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,t.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Example"),":")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new ShapeUnboundGrowthAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotsInDirectory(snapshotDirectory);\n// query analysis-specific and structured results\nconst shapes = analysis.getShapesWithUnboundGrowth();\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new ShapeUnboundGrowthAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotsInDirectory(snapshotDirectory, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/BaseAnalysis.ts#L148"},"heap-analysis/src/BaseAnalysis.ts:148"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getcommandname"},(0,t.yg)("a",{id:"getcommandname"}),(0,t.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,t.yg)("p",null,"Get the name of the heap analysis, which is also used to reference\nthe analysis in memlab command-line tool."),(0,t.yg)("p",null,"The following terminal command will initiate with this analysis:\n",(0,t.yg)("inlineCode",{parentName:"p"},"memlab analyze ")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | the name of the analysis"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples"),":")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new YourAnalysis();\nconst name = analysis.getCommandName();\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/BaseAnalysis.ts#L189"},"heap-analysis/src/BaseAnalysis.ts:189"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getdescription"},(0,t.yg)("a",{id:"getdescription"}),(0,t.yg)("strong",{parentName:"h3"},"getDescription"),"()"),(0,t.yg)("p",null,"Get the textual description of the heap analysis.\nThe description of this analysis will be printed by:\n",(0,t.yg)("inlineCode",{parentName:"p"},"memlab analyze list")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"p"},"string")," | the description")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Source"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/BaseAnalysis.ts#L201"},"heap-analysis/src/BaseAnalysis.ts:201"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getoptions"},(0,t.yg)("a",{id:"getoptions"}),(0,t.yg)("strong",{parentName:"h3"},"getOptions"),"()"),(0,t.yg)("p",null,"override this method if you would like CLI to print the option info"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"p"},"default"),"[] | an array of command line options")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Source"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/BaseAnalysis.ts#L228"},"heap-analysis/src/BaseAnalysis.ts:228"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"processoptions"},(0,t.yg)("a",{id:"process"}),(0,t.yg)("strong",{parentName:"h3"},"process"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"options"),")"),(0,t.yg)("p",null,"Callback for ",(0,t.yg)("inlineCode",{parentName:"p"},"memlab analyze "),".\nDo the memory analysis and print results in this callback\nThe analysis should support:\n1) printing results on screen\n2) returning results via the return value"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#heapanalysisoptions"},(0,t.yg)("inlineCode",{parentName:"a"},"HeapAnalysisOptions"))," | This is the auto-generated arguments passed to all the ",(0,t.yg)("inlineCode",{parentName:"li"},"process")," method that your self-defined heap analysis should implement. You are not supposed to construct instances of this class."))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,t.yg)("inlineCode",{parentName:"li"},"any"),">"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/BaseAnalysis.ts#L216"},"heap-analysis/src/BaseAnalysis.ts:216"))))))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[5214],{5680:(e,a,n)=>{n.d(a,{xA:()=>y,yg:()=>u});var s=n(6540);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);a&&(s=s.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,s)}return n}function i(e){for(var a=1;a=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(s=0;s=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var o=s.createContext({}),p=function(e){var a=s.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},y=function(e){var a=p(e.components);return s.createElement(o.Provider,{value:a},e.children)},g="mdxType",m={inlineCode:"code",wrapper:function(e){var a=e.children;return s.createElement(s.Fragment,{},a)}},c=s.forwardRef((function(e,a){var n=e.components,t=e.mdxType,l=e.originalType,o=e.parentName,y=r(e,["components","mdxType","originalType","parentName"]),g=p(n),c=t,u=g["".concat(o,".").concat(c)]||g[c]||m[c]||l;return n?s.createElement(u,i(i({ref:a},y),{},{components:n})):s.createElement(u,i({ref:a},y))}));function u(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var l=n.length,i=new Array(l);i[0]=c;var r={};for(var o in a)hasOwnProperty.call(a,o)&&(r[o]=a[o]);r.originalType=e,r[g]="string"==typeof e?e:t,i[1]=r;for(var p=2;p{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>p});var s=n(8168),t=(n(6540),n(5680));const l={id:"heap_analysis_src.BaseAnalysis",title:"Class: BaseAnalysis",sidebar_label:"BaseAnalysis",custom_edit_url:null},i=void 0,r={unversionedId:"api/classes/heap_analysis_src.BaseAnalysis",id:"api/classes/heap_analysis_src.BaseAnalysis",title:"Class: BaseAnalysis",description:"Hierarchy",source:"@site/docs/api/classes/heap_analysis_src.BaseAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.BaseAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.BaseAnalysis",title:"Class: BaseAnalysis",sidebar_label:"BaseAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"SnapshotResultReader",permalink:"/memlab/docs/api/classes/api_src.SnapshotResultReader"},next:{title:"CollectionsHoldingStaleAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.CollectionsHoldingStaleAnalysis"}},o={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new BaseAnalysis()',id:"new-baseanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotFromFile(file, options?)',id:"analyzesnapshotfromfilefile-options",level:3},{value:'analyzeSnapshotsInDirectory(directory, options?)',id:"analyzesnapshotsindirectorydirectory-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3},{value:'getDescription()',id:"getdescription",level:3},{value:'getOptions()',id:"getoptions",level:3},{value:'process(options)',id:"processoptions",level:3}],y={toc:p},g="wrapper";function m(e){let{components:a,...n}=e;return(0,t.yg)(g,(0,s.A)({},y,n,{components:a,mdxType:"MDXLayout"}),(0,t.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("inlineCode",{parentName:"p"},"Analysis")),(0,t.yg)("p",{parentName:"li"},"\u21b3 ",(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"BaseAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.DetachedDOMElementAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"DetachedDOMElementAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.GlobalVariableAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"GlobalVariableAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.CollectionsHoldingStaleAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"CollectionsHoldingStaleAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.ObjectShallowAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"ObjectShallowAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.ObjectSizeAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"ObjectSizeAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.ShapeUnboundGrowthAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"ShapeUnboundGrowthAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.ObjectFanoutAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"ObjectFanoutAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.ObjectShapeAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"ObjectShapeAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.ObjectUnboundGrowthAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"ObjectUnboundGrowthAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.StringAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"StringAnalysis"))))),(0,t.yg)("h2",{id:"constructors"},"Constructors"),(0,t.yg)("h3",{id:"new-baseanalysis"},(0,t.yg)("a",{id:"new baseanalysis"}),(0,t.yg)("strong",{parentName:"h3"},"new BaseAnalysis"),"()"),(0,t.yg)("h2",{id:"methods"},"Methods"),(0,t.yg)("h3",{id:"analyzesnapshotfromfilefile-options"},(0,t.yg)("a",{id:"analyzesnapshotfromfile"}),(0,t.yg)("strong",{parentName:"h3"},"analyzeSnapshotFromFile"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"file"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,t.yg)("p",null,"Run heap analysis for a single heap snapshot file"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of a ",(0,t.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," file."),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,t.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,t.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Example"),":")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile);\n// query analysis-specific and structured results\nconst stringPatterns = analysis.getTopDuplicatedStringsInCount();\n")),(0,t.yg)("p",null,"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/BaseAnalysis.ts#L95"},"heap-analysis/src/BaseAnalysis.ts:95"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"analyzesnapshotsindirectorydirectory-options"},(0,t.yg)("a",{id:"analyzesnapshotsindirectory"}),(0,t.yg)("strong",{parentName:"h3"},"analyzeSnapshotsInDirectory"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"directory"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,t.yg)("p",null,"Run heap analysis for a series of heap snapshot files"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"directory"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of the directory holding a series of ",(0,t.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," files, all snapshot files will be loaded and analyzed in the alphanumerically ascending order of those snapshot file names."),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,t.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,t.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Example"),":")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new ShapeUnboundGrowthAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotsInDirectory(snapshotDirectory);\n// query analysis-specific and structured results\nconst shapes = analysis.getShapesWithUnboundGrowth();\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new ShapeUnboundGrowthAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotsInDirectory(snapshotDirectory, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/BaseAnalysis.ts#L148"},"heap-analysis/src/BaseAnalysis.ts:148"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getcommandname"},(0,t.yg)("a",{id:"getcommandname"}),(0,t.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,t.yg)("p",null,"Get the name of the heap analysis, which is also used to reference\nthe analysis in memlab command-line tool."),(0,t.yg)("p",null,"The following terminal command will initiate with this analysis:\n",(0,t.yg)("inlineCode",{parentName:"p"},"memlab analyze ")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | the name of the analysis"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples"),":")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new YourAnalysis();\nconst name = analysis.getCommandName();\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/BaseAnalysis.ts#L189"},"heap-analysis/src/BaseAnalysis.ts:189"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getdescription"},(0,t.yg)("a",{id:"getdescription"}),(0,t.yg)("strong",{parentName:"h3"},"getDescription"),"()"),(0,t.yg)("p",null,"Get the textual description of the heap analysis.\nThe description of this analysis will be printed by:\n",(0,t.yg)("inlineCode",{parentName:"p"},"memlab analyze list")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"p"},"string")," | the description")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Source"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/BaseAnalysis.ts#L201"},"heap-analysis/src/BaseAnalysis.ts:201"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getoptions"},(0,t.yg)("a",{id:"getoptions"}),(0,t.yg)("strong",{parentName:"h3"},"getOptions"),"()"),(0,t.yg)("p",null,"override this method if you would like CLI to print the option info"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"p"},"default"),"[] | an array of command line options")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Source"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/BaseAnalysis.ts#L228"},"heap-analysis/src/BaseAnalysis.ts:228"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"processoptions"},(0,t.yg)("a",{id:"process"}),(0,t.yg)("strong",{parentName:"h3"},"process"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"options"),")"),(0,t.yg)("p",null,"Callback for ",(0,t.yg)("inlineCode",{parentName:"p"},"memlab analyze "),".\nDo the memory analysis and print results in this callback\nThe analysis should support:\n1) printing results on screen\n2) returning results via the return value"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#heapanalysisoptions"},(0,t.yg)("inlineCode",{parentName:"a"},"HeapAnalysisOptions"))," | This is the auto-generated arguments passed to all the ",(0,t.yg)("inlineCode",{parentName:"li"},"process")," method that your self-defined heap analysis should implement. You are not supposed to construct instances of this class."))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,t.yg)("inlineCode",{parentName:"li"},"any"),">"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/BaseAnalysis.ts#L216"},"heap-analysis/src/BaseAnalysis.ts:216"))))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0ee6ea57.ed0b5255.js b/assets/js/0ee6ea57.6f8a19ac.js similarity index 94% rename from assets/js/0ee6ea57.ed0b5255.js rename to assets/js/0ee6ea57.6f8a19ac.js index b4a2fedc..b5cca22c 100644 --- a/assets/js/0ee6ea57.ed0b5255.js +++ b/assets/js/0ee6ea57.6f8a19ac.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[4573],{5680:(e,a,n)=>{n.d(a,{xA:()=>s,yg:()=>y});var r=n(6540);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function i(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);a&&(r=r.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var a=1;a=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var p=r.createContext({}),g=function(e){var a=r.useContext(p),n=a;return e&&(n="function"==typeof e?e(a):o(o({},a),e)),n},s=function(e){var a=g(e.components);return r.createElement(p.Provider,{value:a},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var a=e.children;return r.createElement(r.Fragment,{},a)}},m=r.forwardRef((function(e,a){var n=e.components,t=e.mdxType,i=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),d=g(n),m=t,y=d["".concat(p,".").concat(m)]||d[m]||c[m]||i;return n?r.createElement(y,o(o({ref:a},s),{},{components:n})):r.createElement(y,o({ref:a},s))}));function y(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var i=n.length,o=new Array(i);o[0]=m;var l={};for(var p in a)hasOwnProperty.call(a,p)&&(l[p]=a[p]);l.originalType=e,l[d]="string"==typeof e?e:t,o[1]=l;for(var g=2;g{n.r(a),n.d(a,{assets:()=>p,contentTitle:()=>o,default:()=>c,frontMatter:()=>i,metadata:()=>l,toc:()=>g});var r=n(8168),t=(n(6540),n(5680));const i={id:"core_src.IHeapNode",title:"Interface: IHeapNode",sidebar_label:"IHeapNode",custom_edit_url:null},o=void 0,l={unversionedId:"api/interfaces/core_src.IHeapNode",id:"api/interfaces/core_src.IHeapNode",title:"Interface: IHeapNode",description:"An IHeapNode instance represents a JS heap object in a heap snapshot.",source:"@site/docs/api/interfaces/core_src.IHeapNode.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/core_src.IHeapNode",permalink:"/memlab/docs/api/interfaces/core_src.IHeapNode",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"core_src.IHeapNode",title:"Interface: IHeapNode",sidebar_label:"IHeapNode",custom_edit_url:null},sidebar:"sidebar",previous:{title:"IHeapLocation",permalink:"/memlab/docs/api/interfaces/core_src.IHeapLocation"},next:{title:"IHeapNodes",permalink:"/memlab/docs/api/interfaces/core_src.IHeapNodes"}},p={},g=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Properties",id:"properties",level:2},{value:' dominatorNode: Nullable<IHeapNode>',id:"-dominatornode-nullableiheapnode",level:3},{value:' edge_count: number',id:"-edge_count-number",level:3},{value:' hasPathEdge: boolean',id:"-haspathedge-boolean",level:3},{value:' id: number',id:"-id-number",level:3},{value:' isString: boolean',id:"-isstring-boolean",level:3},{value:' is_detached: boolean',id:"-is_detached-boolean",level:3},{value:' location: Nullable<IHeapLocation>',id:"-location-nullableiheaplocation",level:3},{value:' name: string',id:"-name-string",level:3},{value:' nodeIndex: number',id:"-nodeindex-number",level:3},{value:' numOfReferrers: number',id:"-numofreferrers-number",level:3},{value:' pathEdge: null | IHeapEdge',id:"-pathedge-null--iheapedge",level:3},{value:' references: IHeapEdge[]',id:"-references-iheapedge",level:3},{value:' referrers: IHeapEdge[]',id:"-referrers-iheapedge",level:3},{value:' retainedSize: number',id:"-retainedsize-number",level:3},{value:' self_size: number',id:"-self_size-number",level:3},{value:' snapshot: IHeapSnapshot',id:"-snapshot-iheapsnapshot",level:3},{value:' type: string',id:"-type-string",level:3},{value:"Methods",id:"methods",level:2},{value:'findAnyReference(predicate)',id:"findanyreferencepredicate",level:3},{value:'findAnyReferrer(predicate)',id:"findanyreferrerpredicate",level:3},{value:'findAnyReferrerNode(predicate)',id:"findanyreferrernodepredicate",level:3},{value:'findReferrerNodes(predicate)',id:"findreferrernodespredicate",level:3},{value:'findReferrers(predicate)',id:"findreferrerspredicate",level:3},{value:'forEachReference(callback)',id:"foreachreferencecallback",level:3},{value:'forEachReferrer(callback)',id:"foreachreferrercallback",level:3},{value:'getAnyReferrer(edgeName, edgeType?)',id:"getanyreferreredgename-edgetype",level:3},{value:'getAnyReferrerNode(edgeName, edgeType?)',id:"getanyreferrernodeedgename-edgetype",level:3},{value:'getJSONifyableObject()',id:"getjsonifyableobject",level:3},{value:'getReference(edgeName, edgeType?)',id:"getreferenceedgename-edgetype",level:3},{value:'getReferenceNode(edgeName, edgeType?)',id:"getreferencenodeedgename-edgetype",level:3},{value:'getReferrerNodes(edgeName, edgeType?)',id:"getreferrernodesedgename-edgetype",level:3},{value:'getReferrers(edgeName, edgeType?)',id:"getreferrersedgename-edgetype",level:3},{value:'toJSONString(...args)',id:"tojsonstringargs",level:3},{value:'toStringNode()',id:"tostringnode",level:3}],s={toc:g},d="wrapper";function c(e){let{components:a,...n}=e;return(0,t.yg)(d,(0,r.A)({},s,n,{components:a,mdxType:"MDXLayout"}),(0,t.yg)("p",null,"An ",(0,t.yg)("inlineCode",{parentName:"p"},"IHeapNode")," instance represents a JS heap object in a heap snapshot.\nA heap snapshot is generally a graph where graph nodes are JS heap objects\nand graph edges are JS references among JS heap objects."),(0,t.yg)("p",null,(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"readonly"))," it is not recommended to modify any ",(0,t.yg)("inlineCode",{parentName:"p"},"IHeapNode")," instance"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples"),": V8 or hermes heap snapshot can be parsed by the\n",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#getfullheapfromfile"},"getFullHeapFromFile")," API.")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot, IHeapNode} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n // iterate over each node (heap object)\n heap.nodes.forEach((node: IHeapNode, i: number) => {\n // use the heap node APIs here\n const id = node.id;\n const type = node.type;\n // ...\n });\n})();\n")),(0,t.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("inlineCode",{parentName:"p"},"IHeapNodeBasic")),(0,t.yg)("p",{parentName:"li"},"\u21b3 ",(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"IHeapNode"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapStringNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapStringNode"))))),(0,t.yg)("h2",{id:"properties"},"Properties"),(0,t.yg)("h3",{id:"-dominatornode-nullableiheapnode"},(0,t.yg)("a",{id:"dominatornode",name:"dominatornode"})," ",(0,t.yg)("strong",{parentName:"h3"},"dominatorNode"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"),(0,t.yg)("p",null,"get the dominator node of this node. If the dominator node gets released\nthere will be no path from GC to this node, and therefore this node can\nalso be released.\nFor more information on what a dominator node is, please check out\n",(0,t.yg)("a",{parentName:"p",href:"https://developer.chrome.com/docs/devtools/memory-problems/memory-101/#dominators"},"this doc"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1904"},"core/src/lib/Types.ts:1904"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-edge_count-number"},(0,t.yg)("a",{id:"edge\\_count",name:"edge\\_count"})," ",(0,t.yg)("strong",{parentName:"h3"},"edge","_","count"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"The total number of outgoing JS references (including engine-internal,\nnative, and JS references)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1858"},"core/src/lib/Types.ts:1858"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-haspathedge-boolean"},(0,t.yg)("a",{id:"haspathedge",name:"haspathedge"})," ",(0,t.yg)("strong",{parentName:"h3"},"hasPathEdge"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"boolean")),(0,t.yg)("p",null,"returns true if the heap node has been set an incoming edge\nwhich leads to the parent node on the shortest path to GC root."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1880"},"core/src/lib/Types.ts:1880"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-id-number"},(0,t.yg)("a",{id:"id",name:"id"})," ",(0,t.yg)("strong",{parentName:"h3"},"id"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"unique id of the heap object"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1785"},"core/src/lib/Types.ts:1785"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-isstring-boolean"},(0,t.yg)("a",{id:"isstring",name:"isstring"})," ",(0,t.yg)("strong",{parentName:"h3"},"isString"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"boolean")),(0,t.yg)("p",null,"check if this a string node (normal string node, concatenated string node\nor sliced string node)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1916"},"core/src/lib/Types.ts:1916"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-is_detached-boolean"},(0,t.yg)("a",{id:"is\\_detached",name:"is\\_detached"})," ",(0,t.yg)("strong",{parentName:"h3"},"is","_","detached"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"boolean")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},"If the heap object is a DOM element and the DOM element is detached\nfrom the DOM tree, ",(0,t.yg)("inlineCode",{parentName:"p"},"is_detached")," will be ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),";")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},"If the heap object is a React Fiber node and the Fiber node is unmounted\nfrom the React Fiber tree, ",(0,t.yg)("inlineCode",{parentName:"p"},"is_detached")," will be ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),";\notherwise it will be ",(0,t.yg)("inlineCode",{parentName:"p"},"false"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Source"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1840"},"core/src/lib/Types.ts:1840"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-location-nullableiheaplocation"},(0,t.yg)("a",{id:"location",name:"location"})," ",(0,t.yg)("strong",{parentName:"h3"},"location"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapLocation"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapLocation")),">"),(0,t.yg)("p",null,"source location information of this heap object (if it is recorded by\nthe heap snapshot)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1909"},"core/src/lib/Types.ts:1909"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-name-string"},(0,t.yg)("a",{id:"name",name:"name"})," ",(0,t.yg)("strong",{parentName:"h3"},"name"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"string")),(0,t.yg)("p",null,"this is the ",(0,t.yg)("inlineCode",{parentName:"p"},"name")," field associated with the heap object,\nfor JS object instances (type ",(0,t.yg)("inlineCode",{parentName:"p"},"object"),"), ",(0,t.yg)("inlineCode",{parentName:"p"},"name")," is the constructor's name\nof the object instance. for ",(0,t.yg)("inlineCode",{parentName:"p"},"string"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"name")," is the string value."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1781"},"core/src/lib/Types.ts:1781"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-nodeindex-number"},(0,t.yg)("a",{id:"nodeindex",name:"nodeindex"})," ",(0,t.yg)("strong",{parentName:"h3"},"nodeIndex"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"index of this heap object inside the ",(0,t.yg)("inlineCode",{parentName:"p"},"node.snapshot.nodes")," pseudo array"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1889"},"core/src/lib/Types.ts:1889"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-numofreferrers-number"},(0,t.yg)("a",{id:"numofreferrers",name:"numofreferrers"})," ",(0,t.yg)("strong",{parentName:"h3"},"numOfReferrers"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"Get the number of all incoming references pointing to this heap object\n(including engine-internal, native, and JS references)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1875"},"core/src/lib/Types.ts:1875"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-pathedge-null--iheapedge"},(0,t.yg)("a",{id:"pathedge",name:"pathedge"})," ",(0,t.yg)("strong",{parentName:"h3"},"pathEdge"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"null")," ","|"," ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge"))),(0,t.yg)("p",null,"The incoming edge which leads to the parent node\non the shortest path to GC root."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1885"},"core/src/lib/Types.ts:1885"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-references-iheapedge"},(0,t.yg)("a",{id:"references",name:"references"})," ",(0,t.yg)("strong",{parentName:"h3"},"references"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),"[]"),(0,t.yg)("p",null,"Get a JS array containing all outgoing JS references from this heap object\n(including engine-internal, native, and JS references)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1865"},"core/src/lib/Types.ts:1865"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-referrers-iheapedge"},(0,t.yg)("a",{id:"referrers",name:"referrers"})," ",(0,t.yg)("strong",{parentName:"h3"},"referrers"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),"[]"),(0,t.yg)("p",null,"Get a JS array containing all incoming JS references pointing to this heap\nobject (including engine-internal, native, and JS references)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1870"},"core/src/lib/Types.ts:1870"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-retainedsize-number"},(0,t.yg)("a",{id:"retainedsize",name:"retainedsize"})," ",(0,t.yg)("strong",{parentName:"h3"},"retainedSize"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"The ",(0,t.yg)("em",{parentName:"p"},"retained size")," of the heap object (i.e., the total size of memory that\ncould be released if this object is released). For difference between\n",(0,t.yg)("strong",{parentName:"p"},"retained size")," and ",(0,t.yg)("strong",{parentName:"p"},"shallow size"),", check out\n",(0,t.yg)("a",{parentName:"p",href:"https://developer.chrome.com/docs/devtools/memory-problems/memory-101/#object_sizes"},"this doc"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1896"},"core/src/lib/Types.ts:1896"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-self_size-number"},(0,t.yg)("a",{id:"self\\_size",name:"self\\_size"})," ",(0,t.yg)("strong",{parentName:"h3"},"self","_","size"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"The ",(0,t.yg)("em",{parentName:"p"},"shallow size")," of the heap object (i.e., the size of memory that is held\nby the object itself.). For difference between ",(0,t.yg)("strong",{parentName:"p"},"shallow size")," and\n",(0,t.yg)("strong",{parentName:"p"},"retained size"),", check out\n",(0,t.yg)("a",{parentName:"p",href:"https://developer.chrome.com/docs/devtools/memory-problems/memory-101/#object_sizes"},"this doc"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1853"},"core/src/lib/Types.ts:1853"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-snapshot-iheapsnapshot"},(0,t.yg)("a",{id:"snapshot",name:"snapshot"})," ",(0,t.yg)("strong",{parentName:"h3"},"snapshot"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot"))),(0,t.yg)("p",null,"get the ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")," containing this heap object"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1832"},"core/src/lib/Types.ts:1832"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-type-string"},(0,t.yg)("a",{id:"type",name:"type"})," ",(0,t.yg)("strong",{parentName:"h3"},"type"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"string")),(0,t.yg)("p",null,"the type of the heap node object. All possible types:\nThis is engine-specific, for example all types in V8:\n",(0,t.yg)("inlineCode",{parentName:"p"},"hidden"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"array"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"string"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"object"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"code"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"closure"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"regexp"),",\n",(0,t.yg)("inlineCode",{parentName:"p"},"number"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"native"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"synthetic"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"concatenated string"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"sliced string"),",\n",(0,t.yg)("inlineCode",{parentName:"p"},"symbol"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"bigint")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1775"},"core/src/lib/Types.ts:1775"))))),(0,t.yg)("h2",{id:"methods"},"Methods"),(0,t.yg)("h3",{id:"findanyreferencepredicate"},(0,t.yg)("a",{id:"findanyreference"}),(0,t.yg)("strong",{parentName:"h3"},"findAnyReference"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"predicate"),")"),(0,t.yg)("p",null,"executes a provided predicate callback once for each JavaScript reference\nin the hosting node (or outgoing edges from the node) until the predicate\nreturns ",(0,t.yg)("inlineCode",{parentName:"p"},"true")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"predicate"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#predicator"},(0,t.yg)("inlineCode",{parentName:"a"},"Predicator")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the callback for each outgoing JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the first outgoing edge for which the predicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),",\notherwise returns ",(0,t.yg)("inlineCode",{parentName:"p"},"null")," if no such edge is found.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const reference = node.findAnyReference((edge: IHeapEdge) => {\n // find the outgoing reference with name \"ref\"\n return edge.name_or_index === 'ref';\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1997"},"core/src/lib/Types.ts:1997"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"findanyreferrerpredicate"},(0,t.yg)("a",{id:"findanyreferrer"}),(0,t.yg)("strong",{parentName:"h3"},"findAnyReferrer"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"predicate"),")"),(0,t.yg)("p",null,"executes a provided predicate callback once for each JavaScript reference\npointing to the hosting node (or incoming edges to the node) until the\npredicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"predicate"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#predicator"},(0,t.yg)("inlineCode",{parentName:"a"},"Predicator")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the callback for each incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the first incoming edge for which the predicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),",\notherwise returns ",(0,t.yg)("inlineCode",{parentName:"p"},"null")," if no such edge is found.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const referrer = node.findAnyReferrer((edge: IHeapEdge) => {\n // find the incoming reference with name \"ref\"\n return edge.name_or_index === 'ref';\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2014"},"core/src/lib/Types.ts:2014"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"findanyreferrernodepredicate"},(0,t.yg)("a",{id:"findanyreferrernode"}),(0,t.yg)("strong",{parentName:"h3"},"findAnyReferrerNode"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"predicate"),")"),(0,t.yg)("p",null,"executes a provided predicate callback once for each JavaScript heap\nobject (heap graph node) pointing to the hosting node\n(or nodes having edges to the hosting node) until the predicate\nreturns ",(0,t.yg)("inlineCode",{parentName:"p"},"true")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"predicate"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#predicator"},(0,t.yg)("inlineCode",{parentName:"a"},"Predicator")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the callback for each incoming JavaScript heap object"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the first referring node for which the predicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),",\notherwise returns ",(0,t.yg)("inlineCode",{parentName:"p"},"null")," if no such node is found.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const referrer = node.findAnyReferrerNode((node: IHeapNode) => {\n // find the referring node with name \"Parent\"\n return node.name === 'Parent';\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2032"},"core/src/lib/Types.ts:2032"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"findreferrernodespredicate"},(0,t.yg)("a",{id:"findreferrernodes"}),(0,t.yg)("strong",{parentName:"h3"},"findReferrerNodes"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"predicate"),")"),(0,t.yg)("p",null,"executes a provided predicate callback once for each JavaScript heap\nobject (heap graph node) pointing to the hosting node\n(or nodes having edges to the hosting node)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"predicate"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#predicator"},(0,t.yg)("inlineCode",{parentName:"a"},"Predicator")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the callback for each referrer nodes"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),"[] | an array containing all the referrer nodes for which the\npredicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),", otherwise returns an empty array if no such\nnode is found.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const referrerNodes = node.findReferrerNodes((node: IHeapNode) => {\n // find all the referring nodes with name \"Parent\"\n return node.name === 'Parent';\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2067"},"core/src/lib/Types.ts:2067"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"findreferrerspredicate"},(0,t.yg)("a",{id:"findreferrers"}),(0,t.yg)("strong",{parentName:"h3"},"findReferrers"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"predicate"),")"),(0,t.yg)("p",null,"executes a provided predicate callback once for each JavaScript reference\npointing to the hosting node (or incoming edges to the node)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"predicate"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#predicator"},(0,t.yg)("inlineCode",{parentName:"a"},"Predicator")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the callback for each incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),"[] | an array containing all the incoming edges for which the\npredicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),", otherwise returns an empty array if no such\nedge is found.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const referrers = node.findReferrers((edge: IHeapEdge) => {\n // find all the incoming references with name \"ref\"\n return edge.name_or_index === 'ref';\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2049"},"core/src/lib/Types.ts:2049"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"foreachreferencecallback"},(0,t.yg)("a",{id:"foreachreference"}),(0,t.yg)("strong",{parentName:"h3"},"forEachReference"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"callback"),")"),(0,t.yg)("p",null,"executes a provided callback once for each JavaScript reference in the\nhosting node (or outgoing edges from the node)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"callback"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#edgeiterationcallback"},(0,t.yg)("inlineCode",{parentName:"a"},"EdgeIterationCallback"))," | the callback for each outgoing JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"p"},"void")," | this API returns void")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"node.forEachReference((edge: IHeapEdge) => {\n // process edge ...\n\n // if no need to iterate over remaining edges after\n // the current edge in the node.references list\n return {stop: true};\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1962"},"core/src/lib/Types.ts:1962"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"foreachreferrercallback"},(0,t.yg)("a",{id:"foreachreferrer"}),(0,t.yg)("strong",{parentName:"h3"},"forEachReferrer"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"callback"),")"),(0,t.yg)("p",null,"executes a provided callback once for each JavaScript reference pointing\nto the hosting node (or incoming edges to the node)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"callback"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#edgeiterationcallback"},(0,t.yg)("inlineCode",{parentName:"a"},"EdgeIterationCallback"))," | the callback for each incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"p"},"void")," | this API returns void")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"node.forEachReferrer((edge: IHeapEdge) => {\n // process edge ...\n\n // if no need to iterate over remaining edges after\n // the current edge in the node.referrers list\n return {stop: true};\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1980"},"core/src/lib/Types.ts:1980"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getanyreferreredgename-edgetype"},(0,t.yg)("a",{id:"getanyreferrer"}),(0,t.yg)("strong",{parentName:"h3"},"getAnyReferrer"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds an incoming JS\nreference pointing to the hosting node."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the incoming JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the incoming edge that meets the specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find one of the JS reference named \"ref\" pointing to node\nconst reference = node.getAnyReferrer('ref', 'property');\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2122"},"core/src/lib/Types.ts:2122"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getanyreferrernodeedgename-edgetype"},(0,t.yg)("a",{id:"getanyreferrernode"}),(0,t.yg)("strong",{parentName:"h3"},"getAnyReferrerNode"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds one of the incoming JS\nreferences pointing to the hosting node, and returns the JS heap object\ncontaining the incoming reference."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the incoming JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the node containing the incoming JS reference that meets\nthe specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find one of the JS heap object with a JS reference\n// named \"ref\" pointing to node\nconst n1 = node.getAnyReferrerNode('ref', 'property');\n// this is equivalent to\nconst n2 = node.getAnyReferrer('ref', 'property')?.fromNode;\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2145"},"core/src/lib/Types.ts:2145"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getjsonifyableobject"},(0,t.yg)("a",{id:"getjsonifyableobject"}),(0,t.yg)("strong",{parentName:"h3"},"getJSONifyableObject"),"()"),(0,t.yg)("p",null,"convert to a concise readable object that can be used for serialization\n(like calling ",(0,t.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)"),")."),(0,t.yg)("p",null,"This API does not contain all the information\ncaptured by the hosting object."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"AnyRecord")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1931"},"core/src/lib/Types.ts:1931"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getreferenceedgename-edgetype"},(0,t.yg)("a",{id:"getreference"}),(0,t.yg)("strong",{parentName:"h3"},"getReference"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds an outgoing JS\nreference from the hosting node."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the outgoing JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the outgoing JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the outgoing edge that meets the specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find the internal reference to node's hidden class\nconst reference = node.getReference('map', 'hidden');\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2082"},"core/src/lib/Types.ts:2082"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getreferencenodeedgename-edgetype"},(0,t.yg)("a",{id:"getreferencenode"}),(0,t.yg)("strong",{parentName:"h3"},"getReferenceNode"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds the outgoing JS\nreference from the hosting node, and returns the JS heap object pointed to\nby the outgoing JS reference."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the outgoing JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the outgoing JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the node pointed to by the outgoing reference that meets\nthe specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find the node's hidden class\nconst hiddenClassNode = node.getReferenceNode('map', 'hidden');\n// this is equivalent to\nconst hiddenClassNode2 = node.getReference('map', 'hidden')?.toNode;\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2104"},"core/src/lib/Types.ts:2104"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getreferrernodesedgename-edgetype"},(0,t.yg)("a",{id:"getreferrernodes"}),(0,t.yg)("strong",{parentName:"h3"},"getReferrerNodes"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds all of the incoming JS\nreferences pointing to the hosting node, and returns an array containing\nthe hosting node for each of the incoming JS references."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the incoming JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),"[] | an array containing the hosting nodes, with each node corresponds\nto each incoming JS reference that meets the specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find all of the JS heap object with a JS reference\n// named \"ref\" pointing to node\nconst nodes1 = node.getReferrerNodes('ref', 'property');\n// this is equivalent to\nconst nodes2 = node.getReferrers('ref', 'property')\n .map(edge => edge.fromNode);\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2185"},"core/src/lib/Types.ts:2185"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getreferrersedgename-edgetype"},(0,t.yg)("a",{id:"getreferrers"}),(0,t.yg)("strong",{parentName:"h3"},"getReferrers"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds all the incoming JS\nreference pointing to the hosting node."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the incoming JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),"[] | an array containing all the incoming edges that\nmeet the specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find all of of the JS reference named \"ref\" pointing to node\nconst referrers = node.getReferrers('ref', 'property');\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2164"},"core/src/lib/Types.ts:2164"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"tojsonstringargs"},(0,t.yg)("a",{id:"tojsonstring"}),(0,t.yg)("strong",{parentName:"h3"},"toJSONString"),"(...",(0,t.yg)("inlineCode",{parentName:"h3"},"args"),")"),(0,t.yg)("p",null,"convert to a concise readable string output\n(like calling ",(0,t.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)"),")."),(0,t.yg)("p",null,"Note: Please be aware that using ",(0,t.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)")," is\nnot recommended as it will generate a JSON representation of the host\nobject that is too large to be easily readable due to its connections\nto other parts of the data structures within the heap snapshot."),(0,t.yg)("p",null,"This API does not completely serialize all the information\ncaptured by the hosting object."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"...args"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"any"),"[]"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1944"},"core/src/lib/Types.ts:1944"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"tostringnode"},(0,t.yg)("a",{id:"tostringnode"}),(0,t.yg)("strong",{parentName:"h3"},"toStringNode"),"()"),(0,t.yg)("p",null,"convert to an ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapStringNode"},"IHeapStringNode")," object if this node is a string node.\nThe ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapStringNode"},"IHeapStringNode")," object supports querying the string content\ninside the string node."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapStringNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapStringNode")),">"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1922"},"core/src/lib/Types.ts:1922"))))))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[4573],{5680:(e,a,n)=>{n.d(a,{xA:()=>s,yg:()=>y});var r=n(6540);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function i(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);a&&(r=r.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var a=1;a=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var p=r.createContext({}),g=function(e){var a=r.useContext(p),n=a;return e&&(n="function"==typeof e?e(a):o(o({},a),e)),n},s=function(e){var a=g(e.components);return r.createElement(p.Provider,{value:a},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var a=e.children;return r.createElement(r.Fragment,{},a)}},d=r.forwardRef((function(e,a){var n=e.components,t=e.mdxType,i=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),c=g(n),d=t,y=c["".concat(p,".").concat(d)]||c[d]||m[d]||i;return n?r.createElement(y,o(o({ref:a},s),{},{components:n})):r.createElement(y,o({ref:a},s))}));function y(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var i=n.length,o=new Array(i);o[0]=d;var l={};for(var p in a)hasOwnProperty.call(a,p)&&(l[p]=a[p]);l.originalType=e,l[c]="string"==typeof e?e:t,o[1]=l;for(var g=2;g{n.r(a),n.d(a,{assets:()=>p,contentTitle:()=>o,default:()=>m,frontMatter:()=>i,metadata:()=>l,toc:()=>g});var r=n(8168),t=(n(6540),n(5680));const i={id:"core_src.IHeapNode",title:"Interface: IHeapNode",sidebar_label:"IHeapNode",custom_edit_url:null},o=void 0,l={unversionedId:"api/interfaces/core_src.IHeapNode",id:"api/interfaces/core_src.IHeapNode",title:"Interface: IHeapNode",description:"An IHeapNode instance represents a JS heap object in a heap snapshot.",source:"@site/docs/api/interfaces/core_src.IHeapNode.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/core_src.IHeapNode",permalink:"/memlab/docs/api/interfaces/core_src.IHeapNode",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"core_src.IHeapNode",title:"Interface: IHeapNode",sidebar_label:"IHeapNode",custom_edit_url:null},sidebar:"sidebar",previous:{title:"IHeapLocation",permalink:"/memlab/docs/api/interfaces/core_src.IHeapLocation"},next:{title:"IHeapNodes",permalink:"/memlab/docs/api/interfaces/core_src.IHeapNodes"}},p={},g=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Properties",id:"properties",level:2},{value:' dominatorNode: Nullable<IHeapNode>',id:"-dominatornode-nullableiheapnode",level:3},{value:' edge_count: number',id:"-edge_count-number",level:3},{value:' hasPathEdge: boolean',id:"-haspathedge-boolean",level:3},{value:' id: number',id:"-id-number",level:3},{value:' isString: boolean',id:"-isstring-boolean",level:3},{value:' is_detached: boolean',id:"-is_detached-boolean",level:3},{value:' location: Nullable<IHeapLocation>',id:"-location-nullableiheaplocation",level:3},{value:' name: string',id:"-name-string",level:3},{value:' nodeIndex: number',id:"-nodeindex-number",level:3},{value:' numOfReferrers: number',id:"-numofreferrers-number",level:3},{value:' pathEdge: null | IHeapEdge',id:"-pathedge-null--iheapedge",level:3},{value:' references: IHeapEdge[]',id:"-references-iheapedge",level:3},{value:' referrers: IHeapEdge[]',id:"-referrers-iheapedge",level:3},{value:' retainedSize: number',id:"-retainedsize-number",level:3},{value:' self_size: number',id:"-self_size-number",level:3},{value:' snapshot: IHeapSnapshot',id:"-snapshot-iheapsnapshot",level:3},{value:' type: string',id:"-type-string",level:3},{value:"Methods",id:"methods",level:2},{value:'findAnyReference(predicate)',id:"findanyreferencepredicate",level:3},{value:'findAnyReferrer(predicate)',id:"findanyreferrerpredicate",level:3},{value:'findAnyReferrerNode(predicate)',id:"findanyreferrernodepredicate",level:3},{value:'findReferrerNodes(predicate)',id:"findreferrernodespredicate",level:3},{value:'findReferrers(predicate)',id:"findreferrerspredicate",level:3},{value:'forEachReference(callback)',id:"foreachreferencecallback",level:3},{value:'forEachReferrer(callback)',id:"foreachreferrercallback",level:3},{value:'getAnyReferrer(edgeName, edgeType?)',id:"getanyreferreredgename-edgetype",level:3},{value:'getAnyReferrerNode(edgeName, edgeType?)',id:"getanyreferrernodeedgename-edgetype",level:3},{value:'getJSONifyableObject()',id:"getjsonifyableobject",level:3},{value:'getReference(edgeName, edgeType?)',id:"getreferenceedgename-edgetype",level:3},{value:'getReferenceNode(edgeName, edgeType?)',id:"getreferencenodeedgename-edgetype",level:3},{value:'getReferrerNodes(edgeName, edgeType?)',id:"getreferrernodesedgename-edgetype",level:3},{value:'getReferrers(edgeName, edgeType?)',id:"getreferrersedgename-edgetype",level:3},{value:'toJSONString(...args)',id:"tojsonstringargs",level:3},{value:'toStringNode()',id:"tostringnode",level:3}],s={toc:g},c="wrapper";function m(e){let{components:a,...n}=e;return(0,t.yg)(c,(0,r.A)({},s,n,{components:a,mdxType:"MDXLayout"}),(0,t.yg)("p",null,"An ",(0,t.yg)("inlineCode",{parentName:"p"},"IHeapNode")," instance represents a JS heap object in a heap snapshot.\nA heap snapshot is generally a graph where graph nodes are JS heap objects\nand graph edges are JS references among JS heap objects."),(0,t.yg)("p",null,(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"readonly"))," it is not recommended to modify any ",(0,t.yg)("inlineCode",{parentName:"p"},"IHeapNode")," instance"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples"),": V8 or hermes heap snapshot can be parsed by the\n",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#getfullheapfromfile"},"getFullHeapFromFile")," API.")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot, IHeapNode} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n // iterate over each node (heap object)\n heap.nodes.forEach((node: IHeapNode, i: number) => {\n // use the heap node APIs here\n const id = node.id;\n const type = node.type;\n // ...\n });\n})();\n")),(0,t.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("inlineCode",{parentName:"p"},"IHeapNodeBasic")),(0,t.yg)("p",{parentName:"li"},"\u21b3 ",(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"IHeapNode"))),(0,t.yg)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapStringNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapStringNode"))))),(0,t.yg)("h2",{id:"properties"},"Properties"),(0,t.yg)("h3",{id:"-dominatornode-nullableiheapnode"},(0,t.yg)("a",{id:"dominatornode",name:"dominatornode"})," ",(0,t.yg)("strong",{parentName:"h3"},"dominatorNode"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"),(0,t.yg)("p",null,"get the dominator node of this node. If the dominator node gets released\nthere will be no path from GC to this node, and therefore this node can\nalso be released.\nFor more information on what a dominator node is, please check out\n",(0,t.yg)("a",{parentName:"p",href:"https://developer.chrome.com/docs/devtools/memory-problems/memory-101/#dominators"},"this doc"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1904"},"core/src/lib/Types.ts:1904"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-edge_count-number"},(0,t.yg)("a",{id:"edge\\_count",name:"edge\\_count"})," ",(0,t.yg)("strong",{parentName:"h3"},"edge","_","count"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"The total number of outgoing JS references (including engine-internal,\nnative, and JS references)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1858"},"core/src/lib/Types.ts:1858"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-haspathedge-boolean"},(0,t.yg)("a",{id:"haspathedge",name:"haspathedge"})," ",(0,t.yg)("strong",{parentName:"h3"},"hasPathEdge"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"boolean")),(0,t.yg)("p",null,"returns true if the heap node has been set an incoming edge\nwhich leads to the parent node on the shortest path to GC root."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1880"},"core/src/lib/Types.ts:1880"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-id-number"},(0,t.yg)("a",{id:"id",name:"id"})," ",(0,t.yg)("strong",{parentName:"h3"},"id"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"unique id of the heap object"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1785"},"core/src/lib/Types.ts:1785"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-isstring-boolean"},(0,t.yg)("a",{id:"isstring",name:"isstring"})," ",(0,t.yg)("strong",{parentName:"h3"},"isString"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"boolean")),(0,t.yg)("p",null,"check if this a string node (normal string node, concatenated string node\nor sliced string node)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1916"},"core/src/lib/Types.ts:1916"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-is_detached-boolean"},(0,t.yg)("a",{id:"is\\_detached",name:"is\\_detached"})," ",(0,t.yg)("strong",{parentName:"h3"},"is","_","detached"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"boolean")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},"If the heap object is a DOM element and the DOM element is detached\nfrom the DOM tree, ",(0,t.yg)("inlineCode",{parentName:"p"},"is_detached")," will be ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),";")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},"If the heap object is a React Fiber node and the Fiber node is unmounted\nfrom the React Fiber tree, ",(0,t.yg)("inlineCode",{parentName:"p"},"is_detached")," will be ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),";\notherwise it will be ",(0,t.yg)("inlineCode",{parentName:"p"},"false"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Source"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1840"},"core/src/lib/Types.ts:1840"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-location-nullableiheaplocation"},(0,t.yg)("a",{id:"location",name:"location"})," ",(0,t.yg)("strong",{parentName:"h3"},"location"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapLocation"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapLocation")),">"),(0,t.yg)("p",null,"source location information of this heap object (if it is recorded by\nthe heap snapshot)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1909"},"core/src/lib/Types.ts:1909"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-name-string"},(0,t.yg)("a",{id:"name",name:"name"})," ",(0,t.yg)("strong",{parentName:"h3"},"name"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"string")),(0,t.yg)("p",null,"this is the ",(0,t.yg)("inlineCode",{parentName:"p"},"name")," field associated with the heap object,\nfor JS object instances (type ",(0,t.yg)("inlineCode",{parentName:"p"},"object"),"), ",(0,t.yg)("inlineCode",{parentName:"p"},"name")," is the constructor's name\nof the object instance. for ",(0,t.yg)("inlineCode",{parentName:"p"},"string"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"name")," is the string value."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1781"},"core/src/lib/Types.ts:1781"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-nodeindex-number"},(0,t.yg)("a",{id:"nodeindex",name:"nodeindex"})," ",(0,t.yg)("strong",{parentName:"h3"},"nodeIndex"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"index of this heap object inside the ",(0,t.yg)("inlineCode",{parentName:"p"},"node.snapshot.nodes")," pseudo array"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1889"},"core/src/lib/Types.ts:1889"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-numofreferrers-number"},(0,t.yg)("a",{id:"numofreferrers",name:"numofreferrers"})," ",(0,t.yg)("strong",{parentName:"h3"},"numOfReferrers"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"Get the number of all incoming references pointing to this heap object\n(including engine-internal, native, and JS references)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1875"},"core/src/lib/Types.ts:1875"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-pathedge-null--iheapedge"},(0,t.yg)("a",{id:"pathedge",name:"pathedge"})," ",(0,t.yg)("strong",{parentName:"h3"},"pathEdge"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"null")," ","|"," ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge"))),(0,t.yg)("p",null,"The incoming edge which leads to the parent node\non the shortest path to GC root."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1885"},"core/src/lib/Types.ts:1885"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-references-iheapedge"},(0,t.yg)("a",{id:"references",name:"references"})," ",(0,t.yg)("strong",{parentName:"h3"},"references"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),"[]"),(0,t.yg)("p",null,"Get a JS array containing all outgoing JS references from this heap object\n(including engine-internal, native, and JS references)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1865"},"core/src/lib/Types.ts:1865"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-referrers-iheapedge"},(0,t.yg)("a",{id:"referrers",name:"referrers"})," ",(0,t.yg)("strong",{parentName:"h3"},"referrers"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),"[]"),(0,t.yg)("p",null,"Get a JS array containing all incoming JS references pointing to this heap\nobject (including engine-internal, native, and JS references)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1870"},"core/src/lib/Types.ts:1870"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-retainedsize-number"},(0,t.yg)("a",{id:"retainedsize",name:"retainedsize"})," ",(0,t.yg)("strong",{parentName:"h3"},"retainedSize"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"The ",(0,t.yg)("em",{parentName:"p"},"retained size")," of the heap object (i.e., the total size of memory that\ncould be released if this object is released). For difference between\n",(0,t.yg)("strong",{parentName:"p"},"retained size")," and ",(0,t.yg)("strong",{parentName:"p"},"shallow size"),", check out\n",(0,t.yg)("a",{parentName:"p",href:"https://developer.chrome.com/docs/devtools/memory-problems/memory-101/#object_sizes"},"this doc"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1896"},"core/src/lib/Types.ts:1896"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-self_size-number"},(0,t.yg)("a",{id:"self\\_size",name:"self\\_size"})," ",(0,t.yg)("strong",{parentName:"h3"},"self","_","size"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"The ",(0,t.yg)("em",{parentName:"p"},"shallow size")," of the heap object (i.e., the size of memory that is held\nby the object itself.). For difference between ",(0,t.yg)("strong",{parentName:"p"},"shallow size")," and\n",(0,t.yg)("strong",{parentName:"p"},"retained size"),", check out\n",(0,t.yg)("a",{parentName:"p",href:"https://developer.chrome.com/docs/devtools/memory-problems/memory-101/#object_sizes"},"this doc"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1853"},"core/src/lib/Types.ts:1853"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-snapshot-iheapsnapshot"},(0,t.yg)("a",{id:"snapshot",name:"snapshot"})," ",(0,t.yg)("strong",{parentName:"h3"},"snapshot"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot"))),(0,t.yg)("p",null,"get the ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")," containing this heap object"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1832"},"core/src/lib/Types.ts:1832"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-type-string"},(0,t.yg)("a",{id:"type",name:"type"})," ",(0,t.yg)("strong",{parentName:"h3"},"type"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"string")),(0,t.yg)("p",null,"the type of the heap node object. All possible types:\nThis is engine-specific, for example all types in V8:\n",(0,t.yg)("inlineCode",{parentName:"p"},"hidden"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"array"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"string"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"object"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"code"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"closure"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"regexp"),",\n",(0,t.yg)("inlineCode",{parentName:"p"},"number"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"native"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"synthetic"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"concatenated string"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"sliced string"),",\n",(0,t.yg)("inlineCode",{parentName:"p"},"symbol"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"bigint")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1775"},"core/src/lib/Types.ts:1775"))))),(0,t.yg)("h2",{id:"methods"},"Methods"),(0,t.yg)("h3",{id:"findanyreferencepredicate"},(0,t.yg)("a",{id:"findanyreference"}),(0,t.yg)("strong",{parentName:"h3"},"findAnyReference"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"predicate"),")"),(0,t.yg)("p",null,"executes a provided predicate callback once for each JavaScript reference\nin the hosting node (or outgoing edges from the node) until the predicate\nreturns ",(0,t.yg)("inlineCode",{parentName:"p"},"true")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"predicate"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#predicator"},(0,t.yg)("inlineCode",{parentName:"a"},"Predicator")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the callback for each outgoing JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the first outgoing edge for which the predicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),",\notherwise returns ",(0,t.yg)("inlineCode",{parentName:"p"},"null")," if no such edge is found.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const reference = node.findAnyReference((edge: IHeapEdge) => {\n // find the outgoing reference with name \"ref\"\n return edge.name_or_index === 'ref';\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1997"},"core/src/lib/Types.ts:1997"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"findanyreferrerpredicate"},(0,t.yg)("a",{id:"findanyreferrer"}),(0,t.yg)("strong",{parentName:"h3"},"findAnyReferrer"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"predicate"),")"),(0,t.yg)("p",null,"executes a provided predicate callback once for each JavaScript reference\npointing to the hosting node (or incoming edges to the node) until the\npredicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"predicate"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#predicator"},(0,t.yg)("inlineCode",{parentName:"a"},"Predicator")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the callback for each incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the first incoming edge for which the predicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),",\notherwise returns ",(0,t.yg)("inlineCode",{parentName:"p"},"null")," if no such edge is found.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const referrer = node.findAnyReferrer((edge: IHeapEdge) => {\n // find the incoming reference with name \"ref\"\n return edge.name_or_index === 'ref';\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2014"},"core/src/lib/Types.ts:2014"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"findanyreferrernodepredicate"},(0,t.yg)("a",{id:"findanyreferrernode"}),(0,t.yg)("strong",{parentName:"h3"},"findAnyReferrerNode"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"predicate"),")"),(0,t.yg)("p",null,"executes a provided predicate callback once for each JavaScript heap\nobject (heap graph node) pointing to the hosting node\n(or nodes having edges to the hosting node) until the predicate\nreturns ",(0,t.yg)("inlineCode",{parentName:"p"},"true")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"predicate"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#predicator"},(0,t.yg)("inlineCode",{parentName:"a"},"Predicator")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the callback for each incoming JavaScript heap object"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the first referring node for which the predicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),",\notherwise returns ",(0,t.yg)("inlineCode",{parentName:"p"},"null")," if no such node is found.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const referrer = node.findAnyReferrerNode((node: IHeapNode) => {\n // find the referring node with name \"Parent\"\n return node.name === 'Parent';\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2032"},"core/src/lib/Types.ts:2032"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"findreferrernodespredicate"},(0,t.yg)("a",{id:"findreferrernodes"}),(0,t.yg)("strong",{parentName:"h3"},"findReferrerNodes"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"predicate"),")"),(0,t.yg)("p",null,"executes a provided predicate callback once for each JavaScript heap\nobject (heap graph node) pointing to the hosting node\n(or nodes having edges to the hosting node)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"predicate"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#predicator"},(0,t.yg)("inlineCode",{parentName:"a"},"Predicator")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the callback for each referrer nodes"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),"[] | an array containing all the referrer nodes for which the\npredicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),", otherwise returns an empty array if no such\nnode is found.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const referrerNodes = node.findReferrerNodes((node: IHeapNode) => {\n // find all the referring nodes with name \"Parent\"\n return node.name === 'Parent';\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2067"},"core/src/lib/Types.ts:2067"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"findreferrerspredicate"},(0,t.yg)("a",{id:"findreferrers"}),(0,t.yg)("strong",{parentName:"h3"},"findReferrers"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"predicate"),")"),(0,t.yg)("p",null,"executes a provided predicate callback once for each JavaScript reference\npointing to the hosting node (or incoming edges to the node)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"predicate"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#predicator"},(0,t.yg)("inlineCode",{parentName:"a"},"Predicator")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the callback for each incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),"[] | an array containing all the incoming edges for which the\npredicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),", otherwise returns an empty array if no such\nedge is found.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const referrers = node.findReferrers((edge: IHeapEdge) => {\n // find all the incoming references with name \"ref\"\n return edge.name_or_index === 'ref';\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2049"},"core/src/lib/Types.ts:2049"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"foreachreferencecallback"},(0,t.yg)("a",{id:"foreachreference"}),(0,t.yg)("strong",{parentName:"h3"},"forEachReference"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"callback"),")"),(0,t.yg)("p",null,"executes a provided callback once for each JavaScript reference in the\nhosting node (or outgoing edges from the node)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"callback"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#edgeiterationcallback"},(0,t.yg)("inlineCode",{parentName:"a"},"EdgeIterationCallback"))," | the callback for each outgoing JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"p"},"void")," | this API returns void")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"node.forEachReference((edge: IHeapEdge) => {\n // process edge ...\n\n // if no need to iterate over remaining edges after\n // the current edge in the node.references list\n return {stop: true};\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1962"},"core/src/lib/Types.ts:1962"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"foreachreferrercallback"},(0,t.yg)("a",{id:"foreachreferrer"}),(0,t.yg)("strong",{parentName:"h3"},"forEachReferrer"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"callback"),")"),(0,t.yg)("p",null,"executes a provided callback once for each JavaScript reference pointing\nto the hosting node (or incoming edges to the node)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"callback"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#edgeiterationcallback"},(0,t.yg)("inlineCode",{parentName:"a"},"EdgeIterationCallback"))," | the callback for each incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"p"},"void")," | this API returns void")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"node.forEachReferrer((edge: IHeapEdge) => {\n // process edge ...\n\n // if no need to iterate over remaining edges after\n // the current edge in the node.referrers list\n return {stop: true};\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1980"},"core/src/lib/Types.ts:1980"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getanyreferreredgename-edgetype"},(0,t.yg)("a",{id:"getanyreferrer"}),(0,t.yg)("strong",{parentName:"h3"},"getAnyReferrer"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds an incoming JS\nreference pointing to the hosting node."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the incoming JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the incoming edge that meets the specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find one of the JS reference named \"ref\" pointing to node\nconst reference = node.getAnyReferrer('ref', 'property');\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2122"},"core/src/lib/Types.ts:2122"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getanyreferrernodeedgename-edgetype"},(0,t.yg)("a",{id:"getanyreferrernode"}),(0,t.yg)("strong",{parentName:"h3"},"getAnyReferrerNode"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds one of the incoming JS\nreferences pointing to the hosting node, and returns the JS heap object\ncontaining the incoming reference."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the incoming JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the node containing the incoming JS reference that meets\nthe specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find one of the JS heap object with a JS reference\n// named \"ref\" pointing to node\nconst n1 = node.getAnyReferrerNode('ref', 'property');\n// this is equivalent to\nconst n2 = node.getAnyReferrer('ref', 'property')?.fromNode;\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2145"},"core/src/lib/Types.ts:2145"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getjsonifyableobject"},(0,t.yg)("a",{id:"getjsonifyableobject"}),(0,t.yg)("strong",{parentName:"h3"},"getJSONifyableObject"),"()"),(0,t.yg)("p",null,"convert to a concise readable object that can be used for serialization\n(like calling ",(0,t.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)"),")."),(0,t.yg)("p",null,"This API does not contain all the information\ncaptured by the hosting object."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"AnyRecord")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1931"},"core/src/lib/Types.ts:1931"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getreferenceedgename-edgetype"},(0,t.yg)("a",{id:"getreference"}),(0,t.yg)("strong",{parentName:"h3"},"getReference"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds an outgoing JS\nreference from the hosting node."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the outgoing JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the outgoing JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the outgoing edge that meets the specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find the internal reference to node's hidden class\nconst reference = node.getReference('map', 'hidden');\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2082"},"core/src/lib/Types.ts:2082"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getreferencenodeedgename-edgetype"},(0,t.yg)("a",{id:"getreferencenode"}),(0,t.yg)("strong",{parentName:"h3"},"getReferenceNode"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds the outgoing JS\nreference from the hosting node, and returns the JS heap object pointed to\nby the outgoing JS reference."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the outgoing JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the outgoing JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the node pointed to by the outgoing reference that meets\nthe specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find the node's hidden class\nconst hiddenClassNode = node.getReferenceNode('map', 'hidden');\n// this is equivalent to\nconst hiddenClassNode2 = node.getReference('map', 'hidden')?.toNode;\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2104"},"core/src/lib/Types.ts:2104"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getreferrernodesedgename-edgetype"},(0,t.yg)("a",{id:"getreferrernodes"}),(0,t.yg)("strong",{parentName:"h3"},"getReferrerNodes"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds all of the incoming JS\nreferences pointing to the hosting node, and returns an array containing\nthe hosting node for each of the incoming JS references."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the incoming JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),"[] | an array containing the hosting nodes, with each node corresponds\nto each incoming JS reference that meets the specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find all of the JS heap object with a JS reference\n// named \"ref\" pointing to node\nconst nodes1 = node.getReferrerNodes('ref', 'property');\n// this is equivalent to\nconst nodes2 = node.getReferrers('ref', 'property')\n .map(edge => edge.fromNode);\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2185"},"core/src/lib/Types.ts:2185"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getreferrersedgename-edgetype"},(0,t.yg)("a",{id:"getreferrers"}),(0,t.yg)("strong",{parentName:"h3"},"getReferrers"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds all the incoming JS\nreference pointing to the hosting node."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the incoming JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),"[] | an array containing all the incoming edges that\nmeet the specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find all of of the JS reference named \"ref\" pointing to node\nconst referrers = node.getReferrers('ref', 'property');\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2164"},"core/src/lib/Types.ts:2164"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"tojsonstringargs"},(0,t.yg)("a",{id:"tojsonstring"}),(0,t.yg)("strong",{parentName:"h3"},"toJSONString"),"(...",(0,t.yg)("inlineCode",{parentName:"h3"},"args"),")"),(0,t.yg)("p",null,"convert to a concise readable string output\n(like calling ",(0,t.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)"),")."),(0,t.yg)("p",null,"Note: Please be aware that using ",(0,t.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)")," is\nnot recommended as it will generate a JSON representation of the host\nobject that is too large to be easily readable due to its connections\nto other parts of the data structures within the heap snapshot."),(0,t.yg)("p",null,"This API does not completely serialize all the information\ncaptured by the hosting object."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"...args"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"any"),"[]"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1944"},"core/src/lib/Types.ts:1944"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"tostringnode"},(0,t.yg)("a",{id:"tostringnode"}),(0,t.yg)("strong",{parentName:"h3"},"toStringNode"),"()"),(0,t.yg)("p",null,"convert to an ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapStringNode"},"IHeapStringNode")," object if this node is a string node.\nThe ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapStringNode"},"IHeapStringNode")," object supports querying the string content\ninside the string node."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapStringNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapStringNode")),">"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1922"},"core/src/lib/Types.ts:1922"))))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1a4e3797.2f9cbdc7.js b/assets/js/1a4e3797.2f9cbdc7.js deleted file mode 100644 index 4f44b5d0..00000000 --- a/assets/js/1a4e3797.2f9cbdc7.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 1a4e3797.2f9cbdc7.js.LICENSE.txt */ -(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[2138],{2733:e=>{function t(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function n(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=t,t.prototype._events=void 0,t.prototype._maxListeners=void 0,t.defaultMaxListeners=10,t.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},t.prototype.emit=function(e){var t,a,s,c,o,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||n(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var h=new Error('Uncaught, unspecified "error" event. ('+t+")");throw h.context=t,h}if(i(a=this._events[e]))return!1;if(r(a))switch(arguments.length){case 1:a.call(this);break;case 2:a.call(this,arguments[1]);break;case 3:a.call(this,arguments[1],arguments[2]);break;default:c=Array.prototype.slice.call(arguments,1),a.apply(this,c)}else if(n(a))for(c=Array.prototype.slice.call(arguments,1),s=(u=a.slice()).length,o=0;o0&&this._events[e].length>s&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},t.prototype.on=t.prototype.addListener,t.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},t.prototype.removeListener=function(e,t){var i,a,s,c;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(s=(i=this._events[e]).length,a=-1,i===t||r(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(n(i)){for(c=s;c-- >0;)if(i[c]===t||i[c].listener&&i[c].listener===t){a=c;break}if(a<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(a,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},t.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},t.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},t.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},t.listenerCount=function(e,t){return e.listenerCount(t)}},4103:(e,t,r)=>{"use strict";var n=r(6571),i=r(9127),a=r(2223),s=r(3371),c=r(7691);function o(e,t,r,i){return new n(e,t,r,i)}o.version=r(6938),o.AlgoliaSearchHelper=n,o.SearchParameters=s,o.RecommendParameters=i,o.SearchResults=c,o.RecommendResults=a,e.exports=o},6732:(e,t,r)=>{"use strict";var n=r(2733);function i(e,t,r){this.main=e,this.fn=t,this.recommendFn=r,this.lastResults=null,this.lastRecommendResults=null}r(3014)(i,n),i.prototype.detach=function(){this.removeAllListeners(),this.main.detachDerivedHelper(this)},i.prototype.getModifiedState=function(e){return this.fn(e)},i.prototype.getModifiedRecommendState=function(e){return this.recommendFn(e)},e.exports=i},9127:e=>{"use strict";function t(e){e=e||{},this.params=e.params||[]}t.prototype={constructor:t,addParams:function(e){var r=this.params.slice();return r.push(e),new t({params:r})},removeParams:function(e){return new t({params:this.params.filter((function(t){return t.$$id!==e}))})},addFrequentlyBoughtTogether:function(e){return this.addParams(Object.assign({},e,{model:"bought-together"}))},addRelatedProducts:function(e){return this.addParams(Object.assign({},e,{model:"related-products"}))},addTrendingItems:function(e){return this.addParams(Object.assign({},e,{model:"trending-items"}))},addTrendingFacets:function(e){return this.addParams(Object.assign({},e,{model:"trending-facets"}))},addLookingSimilar:function(e){return this.addParams(Object.assign({},e,{model:"looking-similar"}))},_buildQueries:function(e,t){return this.params.filter((function(e){return void 0===t[e.$$id]})).map((function(t){var r=Object.assign({},t,{indexName:e,threshold:t.threshold||0});return delete r.$$id,r}))}},e.exports=t},2223:e=>{"use strict";function t(e,t){this._state=e,this._rawResults={};var r=this;e.params.forEach((function(e){var n=e.$$id;r[n]=t[n],r._rawResults[n]=t[n]}))}t.prototype={constructor:t},e.exports=t},1673:(e,t,r)=>{"use strict";var n=r(9110),i=r(317),a=r(1383),s={addRefinement:function(e,t,r){if(s.isRefined(e,t,r))return e;var i=""+r,a=e[t]?e[t].concat(i):[i],c={};return c[t]=a,n({},c,e)},removeRefinement:function(e,t,r){if(void 0===r)return s.clearRefinement(e,(function(e,r){return t===r}));var n=""+r;return s.clearRefinement(e,(function(e,r){return t===r&&n===e}))},toggleRefinement:function(e,t,r){if(void 0===r)throw new Error("toggleRefinement should be used with a value");return s.isRefined(e,t,r)?s.removeRefinement(e,t,r):s.addRefinement(e,t,r)},clearRefinement:function(e,t,r){if(void 0===t)return i(e)?{}:e;if("string"==typeof t)return a(e,[t]);if("function"==typeof t){var n=!1,s=Object.keys(e).reduce((function(i,a){var s=e[a]||[],c=s.filter((function(e){return!t(e,a,r)}));return c.length!==s.length&&(n=!0),i[a]=c,i}),{});return n?s:e}},isRefined:function(e,t,r){var n=Boolean(e[t])&&e[t].length>0;if(void 0===r||!n)return n;var i=""+r;return-1!==e[t].indexOf(i)}};e.exports=s},3371:(e,t,r)=>{"use strict";var n=r(9110),i=r(849),a=r(4843),s=r(4728),c=r(317),o=r(1383),u=r(7507),h=r(2208),l=r(1673);function f(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((function(e,r){return f(t[r],e)})):e===t}function m(e){var t=e?m._parseNumbers(e):{};void 0===t.userToken||h(t.userToken)||console.warn("[algoliasearch-helper] The `userToken` parameter is invalid. This can lead to wrong analytics.\n - Format: [a-zA-Z0-9_-]{1,64}"),this.facets=t.facets||[],this.disjunctiveFacets=t.disjunctiveFacets||[],this.hierarchicalFacets=t.hierarchicalFacets||[],this.facetsRefinements=t.facetsRefinements||{},this.facetsExcludes=t.facetsExcludes||{},this.disjunctiveFacetsRefinements=t.disjunctiveFacetsRefinements||{},this.numericRefinements=t.numericRefinements||{},this.tagRefinements=t.tagRefinements||[],this.hierarchicalFacetsRefinements=t.hierarchicalFacetsRefinements||{};var r=this;Object.keys(t).forEach((function(e){var n=-1!==m.PARAMETERS.indexOf(e),i=void 0!==t[e];!n&&i&&(r[e]=t[e])}))}m.PARAMETERS=Object.keys(new m),m._parseNumbers=function(e){if(e instanceof m)return e;var t={};if(["aroundPrecision","aroundRadius","getRankingInfo","minWordSizefor2Typos","minWordSizefor1Typo","page","maxValuesPerFacet","distinct","minimumAroundRadius","hitsPerPage","minProximity"].forEach((function(r){var n=e[r];if("string"==typeof n){var i=parseFloat(n);t[r]=isNaN(i)?n:i}})),Array.isArray(e.insideBoundingBox)&&(t.insideBoundingBox=e.insideBoundingBox.map((function(e){return Array.isArray(e)?e.map((function(e){return parseFloat(e)})):e}))),e.numericRefinements){var r={};Object.keys(e.numericRefinements).forEach((function(t){var n=e.numericRefinements[t]||{};r[t]={},Object.keys(n).forEach((function(e){var i=n[e].map((function(e){return Array.isArray(e)?e.map((function(e){return"string"==typeof e?parseFloat(e):e})):"string"==typeof e?parseFloat(e):e}));r[t][e]=i}))})),t.numericRefinements=r}return s(e,t)},m.make=function(e){var t=new m(e);return(e.hierarchicalFacets||[]).forEach((function(e){if(e.rootPath){var r=t.getHierarchicalRefinement(e.name);r.length>0&&0!==r[0].indexOf(e.rootPath)&&(t=t.clearRefinements(e.name)),0===(r=t.getHierarchicalRefinement(e.name)).length&&(t=t.toggleHierarchicalFacetRefinement(e.name,e.rootPath))}})),t},m.validate=function(e,t){var r=t||{};return e.tagFilters&&r.tagRefinements&&r.tagRefinements.length>0?new Error("[Tags] Cannot switch from the managed tag API to the advanced API. It is probably an error, if it is really what you want, you should first clear the tags with clearTags method."):e.tagRefinements.length>0&&r.tagFilters?new Error("[Tags] Cannot switch from the advanced tag API to the managed API. It is probably an error, if it is not, you should first clear the tags with clearTags method."):e.numericFilters&&r.numericRefinements&&c(r.numericRefinements)?new Error("[Numeric filters] Can't switch from the advanced to the managed API. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):c(e.numericRefinements)&&r.numericFilters?new Error("[Numeric filters] Can't switch from the managed API to the advanced. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):null},m.prototype={constructor:m,clearRefinements:function(e){var t={numericRefinements:this._clearNumericRefinements(e),facetsRefinements:l.clearRefinement(this.facetsRefinements,e,"conjunctiveFacet"),facetsExcludes:l.clearRefinement(this.facetsExcludes,e,"exclude"),disjunctiveFacetsRefinements:l.clearRefinement(this.disjunctiveFacetsRefinements,e,"disjunctiveFacet"),hierarchicalFacetsRefinements:l.clearRefinement(this.hierarchicalFacetsRefinements,e,"hierarchicalFacet")};return t.numericRefinements===this.numericRefinements&&t.facetsRefinements===this.facetsRefinements&&t.facetsExcludes===this.facetsExcludes&&t.disjunctiveFacetsRefinements===this.disjunctiveFacetsRefinements&&t.hierarchicalFacetsRefinements===this.hierarchicalFacetsRefinements?this:this.setQueryParameters(t)},clearTags:function(){return void 0===this.tagFilters&&0===this.tagRefinements.length?this:this.setQueryParameters({tagFilters:void 0,tagRefinements:[]})},setIndex:function(e){return e===this.index?this:this.setQueryParameters({index:e})},setQuery:function(e){return e===this.query?this:this.setQueryParameters({query:e})},setPage:function(e){return e===this.page?this:this.setQueryParameters({page:e})},setFacets:function(e){return this.setQueryParameters({facets:e})},setDisjunctiveFacets:function(e){return this.setQueryParameters({disjunctiveFacets:e})},setHitsPerPage:function(e){return this.hitsPerPage===e?this:this.setQueryParameters({hitsPerPage:e})},setTypoTolerance:function(e){return this.typoTolerance===e?this:this.setQueryParameters({typoTolerance:e})},addNumericRefinement:function(e,t,r){var n=u(r);if(this.isNumericRefined(e,t,n))return this;var i=s({},this.numericRefinements);return i[e]=s({},i[e]),i[e][t]?(i[e][t]=i[e][t].slice(),i[e][t].push(n)):i[e][t]=[n],this.setQueryParameters({numericRefinements:i})},getConjunctiveRefinements:function(e){return this.isConjunctiveFacet(e)&&this.facetsRefinements[e]||[]},getDisjunctiveRefinements:function(e){return this.isDisjunctiveFacet(e)&&this.disjunctiveFacetsRefinements[e]||[]},getHierarchicalRefinement:function(e){return this.hierarchicalFacetsRefinements[e]||[]},getExcludeRefinements:function(e){return this.isConjunctiveFacet(e)&&this.facetsExcludes[e]||[]},removeNumericRefinement:function(e,t,r){var n=r;return void 0!==n?this.isNumericRefined(e,t,n)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements((function(r,i){return i===e&&r.op===t&&f(r.val,u(n))}))}):this:void 0!==t?this.isNumericRefined(e,t)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements((function(r,n){return n===e&&r.op===t}))}):this:this.isNumericRefined(e)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements((function(t,r){return r===e}))}):this},getNumericRefinements:function(e){return this.numericRefinements[e]||{}},getNumericRefinement:function(e,t){return this.numericRefinements[e]&&this.numericRefinements[e][t]},_clearNumericRefinements:function(e){if(void 0===e)return c(this.numericRefinements)?{}:this.numericRefinements;if("string"==typeof e)return o(this.numericRefinements,[e]);if("function"==typeof e){var t=!1,r=this.numericRefinements,n=Object.keys(r).reduce((function(n,i){var a=r[i],s={};return a=a||{},Object.keys(a).forEach((function(r){var n=a[r]||[],c=[];n.forEach((function(t){e({val:t,op:r},i,"numeric")||c.push(t)})),c.length!==n.length&&(t=!0),s[r]=c})),n[i]=s,n}),{});return t?n:this.numericRefinements}},addFacet:function(e){return this.isConjunctiveFacet(e)?this:this.setQueryParameters({facets:this.facets.concat([e])})},addDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this:this.setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.concat([e])})},addHierarchicalFacet:function(e){if(this.isHierarchicalFacet(e.name))throw new Error("Cannot declare two hierarchical facets with the same name: `"+e.name+"`");return this.setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.concat([e])})},addFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return l.isRefined(this.facetsRefinements,e,t)?this:this.setQueryParameters({facetsRefinements:l.addRefinement(this.facetsRefinements,e,t)})},addExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return l.isRefined(this.facetsExcludes,e,t)?this:this.setQueryParameters({facetsExcludes:l.addRefinement(this.facetsExcludes,e,t)})},addDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return l.isRefined(this.disjunctiveFacetsRefinements,e,t)?this:this.setQueryParameters({disjunctiveFacetsRefinements:l.addRefinement(this.disjunctiveFacetsRefinements,e,t)})},addTagRefinement:function(e){if(this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.concat(e)};return this.setQueryParameters(t)},removeFacet:function(e){return this.isConjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({facets:this.facets.filter((function(t){return t!==e}))}):this},removeDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.filter((function(t){return t!==e}))}):this},removeHierarchicalFacet:function(e){return this.isHierarchicalFacet(e)?this.clearRefinements(e).setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.filter((function(t){return t.name!==e}))}):this},removeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return l.isRefined(this.facetsRefinements,e,t)?this.setQueryParameters({facetsRefinements:l.removeRefinement(this.facetsRefinements,e,t)}):this},removeExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return l.isRefined(this.facetsExcludes,e,t)?this.setQueryParameters({facetsExcludes:l.removeRefinement(this.facetsExcludes,e,t)}):this},removeDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return l.isRefined(this.disjunctiveFacetsRefinements,e,t)?this.setQueryParameters({disjunctiveFacetsRefinements:l.removeRefinement(this.disjunctiveFacetsRefinements,e,t)}):this},removeTagRefinement:function(e){if(!this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.filter((function(t){return t!==e}))};return this.setQueryParameters(t)},toggleRefinement:function(e,t){return this.toggleFacetRefinement(e,t)},toggleFacetRefinement:function(e,t){if(this.isHierarchicalFacet(e))return this.toggleHierarchicalFacetRefinement(e,t);if(this.isConjunctiveFacet(e))return this.toggleConjunctiveFacetRefinement(e,t);if(this.isDisjunctiveFacet(e))return this.toggleDisjunctiveFacetRefinement(e,t);throw new Error("Cannot refine the undeclared facet "+e+"; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets")},toggleConjunctiveFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsRefinements:l.toggleRefinement(this.facetsRefinements,e,t)})},toggleExcludeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsExcludes:l.toggleRefinement(this.facetsExcludes,e,t)})},toggleDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return this.setQueryParameters({disjunctiveFacetsRefinements:l.toggleRefinement(this.disjunctiveFacetsRefinements,e,t)})},toggleHierarchicalFacetRefinement:function(e,t){if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration");var r=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e)),i={};return void 0!==this.hierarchicalFacetsRefinements[e]&&this.hierarchicalFacetsRefinements[e].length>0&&(this.hierarchicalFacetsRefinements[e][0]===t||0===this.hierarchicalFacetsRefinements[e][0].indexOf(t+r))?-1===t.indexOf(r)?i[e]=[]:i[e]=[t.slice(0,t.lastIndexOf(r))]:i[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:n({},i,this.hierarchicalFacetsRefinements)})},addHierarchicalFacetRefinement:function(e,t){if(this.isHierarchicalFacetRefined(e))throw new Error(e+" is already refined.");if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration.");var r={};return r[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:n({},r,this.hierarchicalFacetsRefinements)})},removeHierarchicalFacetRefinement:function(e){if(!this.isHierarchicalFacetRefined(e))return this;var t={};return t[e]=[],this.setQueryParameters({hierarchicalFacetsRefinements:n({},t,this.hierarchicalFacetsRefinements)})},toggleTagRefinement:function(e){return this.isTagRefined(e)?this.removeTagRefinement(e):this.addTagRefinement(e)},isDisjunctiveFacet:function(e){return this.disjunctiveFacets.indexOf(e)>-1},isHierarchicalFacet:function(e){return void 0!==this.getHierarchicalFacetByName(e)},isConjunctiveFacet:function(e){return this.facets.indexOf(e)>-1},isFacetRefined:function(e,t){return!!this.isConjunctiveFacet(e)&&l.isRefined(this.facetsRefinements,e,t)},isExcludeRefined:function(e,t){return!!this.isConjunctiveFacet(e)&&l.isRefined(this.facetsExcludes,e,t)},isDisjunctiveFacetRefined:function(e,t){return!!this.isDisjunctiveFacet(e)&&l.isRefined(this.disjunctiveFacetsRefinements,e,t)},isHierarchicalFacetRefined:function(e,t){if(!this.isHierarchicalFacet(e))return!1;var r=this.getHierarchicalRefinement(e);return t?-1!==r.indexOf(t):r.length>0},isNumericRefined:function(e,t,r){if(void 0===r&&void 0===t)return Boolean(this.numericRefinements[e]);var n=this.numericRefinements[e]&&void 0!==this.numericRefinements[e][t];if(void 0===r||!n)return n;var a,s,c=u(r),o=void 0!==(a=this.numericRefinements[e][t],s=c,i(a,(function(e){return f(e,s)})));return n&&o},isTagRefined:function(e){return-1!==this.tagRefinements.indexOf(e)},getRefinedDisjunctiveFacets:function(){var e=this,t=a(Object.keys(this.numericRefinements).filter((function(t){return Object.keys(e.numericRefinements[t]).length>0})),this.disjunctiveFacets);return Object.keys(this.disjunctiveFacetsRefinements).filter((function(t){return e.disjunctiveFacetsRefinements[t].length>0})).concat(t).concat(this.getRefinedHierarchicalFacets()).sort()},getRefinedHierarchicalFacets:function(){var e=this;return a(this.hierarchicalFacets.map((function(e){return e.name})),Object.keys(this.hierarchicalFacetsRefinements).filter((function(t){return e.hierarchicalFacetsRefinements[t].length>0}))).sort()},getUnrefinedDisjunctiveFacets:function(){var e=this.getRefinedDisjunctiveFacets();return this.disjunctiveFacets.filter((function(t){return-1===e.indexOf(t)}))},managedParameters:["index","facets","disjunctiveFacets","facetsRefinements","hierarchicalFacets","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements","hierarchicalFacetsRefinements"],getQueryParams:function(){var e=this.managedParameters,t={},r=this;return Object.keys(this).forEach((function(n){var i=r[n];-1===e.indexOf(n)&&void 0!==i&&(t[n]=i)})),t},setQueryParameter:function(e,t){if(this[e]===t)return this;var r={};return r[e]=t,this.setQueryParameters(r)},setQueryParameters:function(e){if(!e)return this;var t=m.validate(this,e);if(t)throw t;var r=this,n=m._parseNumbers(e),i=Object.keys(this).reduce((function(e,t){return e[t]=r[t],e}),{}),a=Object.keys(n).reduce((function(e,t){var r=void 0!==e[t],i=void 0!==n[t];return r&&!i?o(e,[t]):(i&&(e[t]=n[t]),e)}),i);return new this.constructor(a)},resetPage:function(){return void 0===this.page?this:this.setPage(0)},_getHierarchicalFacetSortBy:function(e){return e.sortBy||["isRefined:desc","name:asc"]},_getHierarchicalFacetSeparator:function(e){return e.separator||" > "},_getHierarchicalRootPath:function(e){return e.rootPath||null},_getHierarchicalShowParentLevel:function(e){return"boolean"!=typeof e.showParentLevel||e.showParentLevel},getHierarchicalFacetByName:function(e){return i(this.hierarchicalFacets,(function(t){return t.name===e}))},getHierarchicalFacetBreadcrumb:function(e){if(!this.isHierarchicalFacet(e))return[];var t=this.getHierarchicalRefinement(e)[0];if(!t)return[];var r=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e));return t.split(r).map((function(e){return e.trim()}))},toString:function(){return JSON.stringify(this,null,2)}},e.exports=m},6673:(e,t,r)=>{"use strict";e.exports=function(e){return function(t,r){var n=e.hierarchicalFacets[r],u=e.hierarchicalFacetsRefinements[n.name]&&e.hierarchicalFacetsRefinements[n.name][0]||"",h=e._getHierarchicalFacetSeparator(n),l=e._getHierarchicalRootPath(n),f=e._getHierarchicalShowParentLevel(n),m=a(e._getHierarchicalFacetSortBy(n)),d=t.every((function(e){return e.exhaustive})),p=function(e,t,r,n,a){return function(u,h,l){var f=u;if(l>0){var m=0;for(f=u;m{"use strict";var n=r(8965),i=r(9110),a=r(2909),s=r(849),c=r(3917),o=r(7577),u=r(4728),h=r(8601),l=a.escapeFacetValue,f=a.unescapeFacetValue,m=r(6673);function d(e){var t={};return e.forEach((function(e,r){t[e]=r})),t}function p(e,t,r){t&&t[r]&&(e.stats=t[r])}function g(e,t,r){var a=t[0]||{};this._rawResults=t;var o=this;Object.keys(a).forEach((function(e){o[e]=a[e]}));var h=u({persistHierarchicalRootCount:!1},r);Object.keys(h).forEach((function(e){o[e]=h[e]})),this.processingTimeMS=t.reduce((function(e,t){return void 0===t.processingTimeMS?e:e+t.processingTimeMS}),0),this.disjunctiveFacets=[],this.hierarchicalFacets=e.hierarchicalFacets.map((function(){return[]})),this.facets=[];var l=e.getRefinedDisjunctiveFacets(),g=d(e.facets),v=d(e.disjunctiveFacets),y=1,R=a.facets||{};Object.keys(R).forEach((function(t){var r,n,i=R[t],u=(r=e.hierarchicalFacets,n=t,s(r,(function(e){return(e.attributes||[]).indexOf(n)>-1})));if(u){var h=u.attributes.indexOf(t),l=c(e.hierarchicalFacets,(function(e){return e.name===u.name}));o.hierarchicalFacets[l][h]={attribute:t,data:i,exhaustive:a.exhaustiveFacetsCount}}else{var f,m=-1!==e.disjunctiveFacets.indexOf(t),d=-1!==e.facets.indexOf(t);m&&(f=v[t],o.disjunctiveFacets[f]={name:t,data:i,exhaustive:a.exhaustiveFacetsCount},p(o.disjunctiveFacets[f],a.facets_stats,t)),d&&(f=g[t],o.facets[f]={name:t,data:i,exhaustive:a.exhaustiveFacetsCount},p(o.facets[f],a.facets_stats,t))}})),this.hierarchicalFacets=n(this.hierarchicalFacets),l.forEach((function(r){var n=t[y],s=n&&n.facets?n.facets:{},h=e.getHierarchicalFacetByName(r);Object.keys(s).forEach((function(t){var r,l=s[t];if(h){r=c(e.hierarchicalFacets,(function(e){return e.name===h.name}));var m=c(o.hierarchicalFacets[r],(function(e){return e.attribute===t}));if(-1===m)return;o.hierarchicalFacets[r][m].data=u({},o.hierarchicalFacets[r][m].data,l)}else{r=v[t];var d=a.facets&&a.facets[t]||{};o.disjunctiveFacets[r]={name:t,data:i({},l,d),exhaustive:n.exhaustiveFacetsCount},p(o.disjunctiveFacets[r],n.facets_stats,t),e.disjunctiveFacetsRefinements[t]&&e.disjunctiveFacetsRefinements[t].forEach((function(n){!o.disjunctiveFacets[r].data[n]&&e.disjunctiveFacetsRefinements[t].indexOf(f(n))>-1&&(o.disjunctiveFacets[r].data[n]=0)}))}})),y++})),e.getRefinedHierarchicalFacets().forEach((function(r){var n=e.getHierarchicalFacetByName(r),a=e._getHierarchicalFacetSeparator(n),s=e.getHierarchicalRefinement(r);0===s.length||s[0].split(a).length<2||t.slice(y).forEach((function(t){var r=t&&t.facets?t.facets:{};Object.keys(r).forEach((function(t){var u=r[t],h=c(e.hierarchicalFacets,(function(e){return e.name===n.name})),l=c(o.hierarchicalFacets[h],(function(e){return e.attribute===t}));if(-1!==l){var f={};if(s.length>0&&!o.persistHierarchicalRootCount){var m=s[0].split(a)[0];f[m]=o.hierarchicalFacets[h][l].data[m]}o.hierarchicalFacets[h][l].data=i(f,u,o.hierarchicalFacets[h][l].data)}})),y++}))})),Object.keys(e.facetsExcludes).forEach((function(t){var r=e.facetsExcludes[t],n=g[t];o.facets[n]={name:t,data:R[t],exhaustive:a.exhaustiveFacetsCount},r.forEach((function(e){o.facets[n]=o.facets[n]||{name:t},o.facets[n].data=o.facets[n].data||{},o.facets[n].data[e]=0}))})),this.hierarchicalFacets=this.hierarchicalFacets.map(m(e)),this.facets=n(this.facets),this.disjunctiveFacets=n(this.disjunctiveFacets),this._state=e}function v(e,t){function r(e){return e.name===t}if(e._state.isConjunctiveFacet(t)){var n=s(e.facets,r);return n?Object.keys(n.data).map((function(r){var i=l(r);return{name:r,escapedValue:i,count:n.data[r],isRefined:e._state.isFacetRefined(t,i),isExcluded:e._state.isExcludeRefined(t,r)}})):[]}if(e._state.isDisjunctiveFacet(t)){var i=s(e.disjunctiveFacets,r);return i?Object.keys(i.data).map((function(r){var n=l(r);return{name:r,escapedValue:n,count:i.data[r],isRefined:e._state.isDisjunctiveFacetRefined(t,n)}})):[]}if(e._state.isHierarchicalFacet(t)){var a=s(e.hierarchicalFacets,r);if(!a)return a;var c=e._state.getHierarchicalFacetByName(t),o=e._state._getHierarchicalFacetSeparator(c),u=f(e._state.getHierarchicalRefinement(t)[0]||"");0===u.indexOf(c.rootPath)&&(u=u.replace(c.rootPath+o,""));var h=u.split(o);return h.unshift(t),y(a,h,0),a}}function y(e,t,r){e.isRefined=e.name===(t[r]&&t[r].trim()),e.data&&e.data.forEach((function(e){y(e,t,r+1)}))}function R(e,t,r,n){if(n=n||0,Array.isArray(t))return e(t,r[n]);if(!t.data||0===t.data.length)return t;var a=t.data.map((function(t){return R(e,t,r,n+1)})),s=e(a,r[n]);return i({data:s},t)}function F(e,t){var r=s(e,(function(e){return e.name===t}));return r&&r.stats}function b(e,t,r,n,i){var a=s(i,(function(e){return e.name===r})),c=a&&a.data&&a.data[n]?a.data[n]:0,o=a&&a.exhaustive||!1;return{type:t,attributeName:r,name:n,count:c,exhaustive:o}}g.prototype.getFacetByName=function(e){function t(t){return t.name===e}return s(this.facets,t)||s(this.disjunctiveFacets,t)||s(this.hierarchicalFacets,t)},g.DEFAULT_SORT=["isRefined:desc","count:desc","name:asc"],g.prototype.getFacetValues=function(e,t){var r=v(this,e);if(r){var n,a=i({},t,{sortBy:g.DEFAULT_SORT,facetOrdering:!(t&&t.sortBy)}),s=this;if(Array.isArray(r))n=[e];else n=s._state.getHierarchicalFacetByName(r.name).attributes;return R((function(e,t){if(a.facetOrdering){var r=function(e,t){return e.renderingContent&&e.renderingContent.facetOrdering&&e.renderingContent.facetOrdering.values&&e.renderingContent.facetOrdering.values[t]}(s,t);if(r)return function(e,t){var r=[],n=[],i=t.hide||[],a=(t.order||[]).reduce((function(e,t,r){return e[t]=r,e}),{});e.forEach((function(e){var t=e.path||e.name,s=i.indexOf(t)>-1;s||void 0===a[t]?s||n.push(e):r[a[t]]=e})),r=r.filter((function(e){return e}));var s,c=t.sortRemainingBy;return"hidden"===c?r:(s="alpha"===c?[["path","name"],["asc","asc"]]:[["count"],["desc"]],r.concat(h(n,s[0],s[1])))}(e,r)}if(Array.isArray(a.sortBy)){var n=o(a.sortBy,g.DEFAULT_SORT);return h(e,n[0],n[1])}if("function"==typeof a.sortBy)return function(e,t){return t.sort(e)}(a.sortBy,e);throw new Error("options.sortBy is optional but if defined it must be either an array of string (predicates) or a sorting function")}),r,n)}},g.prototype.getFacetStats=function(e){return this._state.isConjunctiveFacet(e)?F(this.facets,e):this._state.isDisjunctiveFacet(e)?F(this.disjunctiveFacets,e):void 0},g.prototype.getRefinements=function(){var e=this._state,t=this,r=[];return Object.keys(e.facetsRefinements).forEach((function(n){e.facetsRefinements[n].forEach((function(i){r.push(b(e,"facet",n,i,t.facets))}))})),Object.keys(e.facetsExcludes).forEach((function(n){e.facetsExcludes[n].forEach((function(i){r.push(b(e,"exclude",n,i,t.facets))}))})),Object.keys(e.disjunctiveFacetsRefinements).forEach((function(n){e.disjunctiveFacetsRefinements[n].forEach((function(i){r.push(b(e,"disjunctive",n,i,t.disjunctiveFacets))}))})),Object.keys(e.hierarchicalFacetsRefinements).forEach((function(n){e.hierarchicalFacetsRefinements[n].forEach((function(i){r.push(function(e,t,r,n){var i=e.getHierarchicalFacetByName(t),a=e._getHierarchicalFacetSeparator(i),c=r.split(a),o=s(n,(function(e){return e.name===t})),u=c.reduce((function(e,t){var r=e&&s(e.data,(function(e){return e.name===t}));return void 0!==r?r:e}),o),h=u&&u.count||0,l=u&&u.exhaustive||!1,f=u&&u.path||"";return{type:"hierarchical",attributeName:t,name:f,count:h,exhaustive:l}}(e,n,i,t.hierarchicalFacets))}))})),Object.keys(e.numericRefinements).forEach((function(t){var n=e.numericRefinements[t];Object.keys(n).forEach((function(e){n[e].forEach((function(n){r.push({type:"numeric",attributeName:t,name:n,numericValue:n,operator:e})}))}))})),e.tagRefinements.forEach((function(e){r.push({type:"tag",attributeName:"_tags",name:e})})),r},e.exports=g},6571:(e,t,r)=>{"use strict";var n=r(2733),i=r(6732),a=r(2909).escapeFacetValue,s=r(3014),c=r(4728),o=r(317),u=r(1383),h=r(9127),l=r(2223),f=r(9228),m=r(3371),d=r(7691),p=r(7749),g=r(6938);function v(e,t,r,n){"function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+g+")"),this.setClient(e);var i=r||{};i.index=t,this.state=m.make(i),this.recommendState=new h({params:i.recommendState}),this.lastResults=null,this.lastRecommendResults=null,this._queryId=0,this._recommendQueryId=0,this._lastQueryIdReceived=-1,this._lastRecommendQueryIdReceived=-1,this.derivedHelpers=[],this._currentNbQueries=0,this._currentNbRecommendQueries=0,this._searchResultsOptions=n,this._recommendCache={}}function y(e){if(e<0)throw new Error("Page requested below 0.");return this._change({state:this.state.setPage(e),isPageReset:!1}),this}function R(){return this.state.page}s(v,n),v.prototype.search=function(){return this._search({onlyWithDerivedHelpers:!1}),this},v.prototype.searchOnlyWithDerivedHelpers=function(){return this._search({onlyWithDerivedHelpers:!0}),this},v.prototype.recommend=function(){return this._recommend(),this},v.prototype.getQuery=function(){var e=this.state;return f._getHitsSearchParams(e)},v.prototype.searchOnce=function(e,t){var r=e?this.state.setQueryParameters(e):this.state,n=f._getQueries(r.index,r),i=this;if(this._currentNbQueries++,this.emit("searchOnce",{state:r}),!t)return this.client.search(n).then((function(e){return i._currentNbQueries--,0===i._currentNbQueries&&i.emit("searchQueueEmpty"),{content:new d(r,e.results),state:r,_originalResponse:e}}),(function(e){throw i._currentNbQueries--,0===i._currentNbQueries&&i.emit("searchQueueEmpty"),e}));this.client.search(n).then((function(e){i._currentNbQueries--,0===i._currentNbQueries&&i.emit("searchQueueEmpty"),t(null,new d(r,e.results),r)})).catch((function(e){i._currentNbQueries--,0===i._currentNbQueries&&i.emit("searchQueueEmpty"),t(e,null,r)}))},v.prototype.findAnswers=function(e){console.warn("[algoliasearch-helper] answers is no longer supported");var t=this.state,r=this.derivedHelpers[0];if(!r)return Promise.resolve([]);var n=r.getModifiedState(t),i=c({attributesForPrediction:e.attributesForPrediction,nbHits:e.nbHits},{params:u(f._getHitsSearchParams(n),["attributesToSnippet","hitsPerPage","restrictSearchableAttributes","snippetEllipsisText"])}),a="search for answers was called, but this client does not have a function client.initIndex(index).findAnswers";if("function"!=typeof this.client.initIndex)throw new Error(a);var s=this.client.initIndex(n.index);if("function"!=typeof s.findAnswers)throw new Error(a);return s.findAnswers(n.query,e.queryLanguages,i)},v.prototype.searchForFacetValues=function(e,t,r,n){var i="function"==typeof this.client.searchForFacetValues,s="function"==typeof this.client.initIndex;if(!i&&!s&&"function"!=typeof this.client.search)throw new Error("search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues or client.initIndex(index).searchForFacetValues");var c=this.state.setQueryParameters(n||{}),o=c.isDisjunctiveFacet(e),u=f.getSearchForFacetQuery(e,t,r,c);this._currentNbQueries++;var h,l=this;return i?h=this.client.searchForFacetValues([{indexName:c.index,params:u}]):s?h=this.client.initIndex(c.index).searchForFacetValues(u):(delete u.facetName,h=this.client.search([{type:"facet",facet:e,indexName:c.index,params:u}]).then((function(e){return e.results[0]}))),this.emit("searchForFacetValues",{state:c,facet:e,query:t}),h.then((function(t){return l._currentNbQueries--,0===l._currentNbQueries&&l.emit("searchQueueEmpty"),(t=Array.isArray(t)?t[0]:t).facetHits.forEach((function(t){t.escapedValue=a(t.value),t.isRefined=o?c.isDisjunctiveFacetRefined(e,t.escapedValue):c.isFacetRefined(e,t.escapedValue)})),t}),(function(e){throw l._currentNbQueries--,0===l._currentNbQueries&&l.emit("searchQueueEmpty"),e}))},v.prototype.setQuery=function(e){return this._change({state:this.state.resetPage().setQuery(e),isPageReset:!0}),this},v.prototype.clearRefinements=function(e){return this._change({state:this.state.resetPage().clearRefinements(e),isPageReset:!0}),this},v.prototype.clearTags=function(){return this._change({state:this.state.resetPage().clearTags(),isPageReset:!0}),this},v.prototype.addDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},v.prototype.addDisjunctiveRefine=function(){return this.addDisjunctiveFacetRefinement.apply(this,arguments)},v.prototype.addHierarchicalFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addHierarchicalFacetRefinement(e,t),isPageReset:!0}),this},v.prototype.addNumericRefinement=function(e,t,r){return this._change({state:this.state.resetPage().addNumericRefinement(e,t,r),isPageReset:!0}),this},v.prototype.addFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addFacetRefinement(e,t),isPageReset:!0}),this},v.prototype.addRefine=function(){return this.addFacetRefinement.apply(this,arguments)},v.prototype.addFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().addExcludeRefinement(e,t),isPageReset:!0}),this},v.prototype.addExclude=function(){return this.addFacetExclusion.apply(this,arguments)},v.prototype.addTag=function(e){return this._change({state:this.state.resetPage().addTagRefinement(e),isPageReset:!0}),this},v.prototype.addFrequentlyBoughtTogether=function(e){return this._recommendChange({state:this.recommendState.addFrequentlyBoughtTogether(e)}),this},v.prototype.addRelatedProducts=function(e){return this._recommendChange({state:this.recommendState.addRelatedProducts(e)}),this},v.prototype.addTrendingItems=function(e){return this._recommendChange({state:this.recommendState.addTrendingItems(e)}),this},v.prototype.addTrendingFacets=function(e){return this._recommendChange({state:this.recommendState.addTrendingFacets(e)}),this},v.prototype.addLookingSimilar=function(e){return this._recommendChange({state:this.recommendState.addLookingSimilar(e)}),this},v.prototype.removeNumericRefinement=function(e,t,r){return this._change({state:this.state.resetPage().removeNumericRefinement(e,t,r),isPageReset:!0}),this},v.prototype.removeDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},v.prototype.removeDisjunctiveRefine=function(){return this.removeDisjunctiveFacetRefinement.apply(this,arguments)},v.prototype.removeHierarchicalFacetRefinement=function(e){return this._change({state:this.state.resetPage().removeHierarchicalFacetRefinement(e),isPageReset:!0}),this},v.prototype.removeFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeFacetRefinement(e,t),isPageReset:!0}),this},v.prototype.removeRefine=function(){return this.removeFacetRefinement.apply(this,arguments)},v.prototype.removeFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().removeExcludeRefinement(e,t),isPageReset:!0}),this},v.prototype.removeExclude=function(){return this.removeFacetExclusion.apply(this,arguments)},v.prototype.removeTag=function(e){return this._change({state:this.state.resetPage().removeTagRefinement(e),isPageReset:!0}),this},v.prototype.removeFrequentlyBoughtTogether=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},v.prototype.removeRelatedProducts=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},v.prototype.removeTrendingItems=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},v.prototype.removeTrendingFacets=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},v.prototype.removeLookingSimilar=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},v.prototype.toggleFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().toggleExcludeFacetRefinement(e,t),isPageReset:!0}),this},v.prototype.toggleExclude=function(){return this.toggleFacetExclusion.apply(this,arguments)},v.prototype.toggleRefinement=function(e,t){return this.toggleFacetRefinement(e,t)},v.prototype.toggleFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().toggleFacetRefinement(e,t),isPageReset:!0}),this},v.prototype.toggleRefine=function(){return this.toggleFacetRefinement.apply(this,arguments)},v.prototype.toggleTag=function(e){return this._change({state:this.state.resetPage().toggleTagRefinement(e),isPageReset:!0}),this},v.prototype.nextPage=function(){var e=this.state.page||0;return this.setPage(e+1)},v.prototype.previousPage=function(){var e=this.state.page||0;return this.setPage(e-1)},v.prototype.setCurrentPage=y,v.prototype.setPage=y,v.prototype.setIndex=function(e){return this._change({state:this.state.resetPage().setIndex(e),isPageReset:!0}),this},v.prototype.setQueryParameter=function(e,t){return this._change({state:this.state.resetPage().setQueryParameter(e,t),isPageReset:!0}),this},v.prototype.setState=function(e){return this._change({state:m.make(e),isPageReset:!1}),this},v.prototype.overrideStateWithoutTriggeringChangeEvent=function(e){return this.state=new m(e),this},v.prototype.hasRefinements=function(e){return!!o(this.state.getNumericRefinements(e))||(this.state.isConjunctiveFacet(e)?this.state.isFacetRefined(e):this.state.isDisjunctiveFacet(e)?this.state.isDisjunctiveFacetRefined(e):!!this.state.isHierarchicalFacet(e)&&this.state.isHierarchicalFacetRefined(e))},v.prototype.isExcluded=function(e,t){return this.state.isExcludeRefined(e,t)},v.prototype.isDisjunctiveRefined=function(e,t){return this.state.isDisjunctiveFacetRefined(e,t)},v.prototype.hasTag=function(e){return this.state.isTagRefined(e)},v.prototype.isTagRefined=function(){return this.hasTagRefinements.apply(this,arguments)},v.prototype.getIndex=function(){return this.state.index},v.prototype.getCurrentPage=R,v.prototype.getPage=R,v.prototype.getTags=function(){return this.state.tagRefinements},v.prototype.getRefinements=function(e){var t=[];if(this.state.isConjunctiveFacet(e))this.state.getConjunctiveRefinements(e).forEach((function(e){t.push({value:e,type:"conjunctive"})})),this.state.getExcludeRefinements(e).forEach((function(e){t.push({value:e,type:"exclude"})}));else if(this.state.isDisjunctiveFacet(e)){this.state.getDisjunctiveRefinements(e).forEach((function(e){t.push({value:e,type:"disjunctive"})}))}var r=this.state.getNumericRefinements(e);return Object.keys(r).forEach((function(e){var n=r[e];t.push({value:n,operator:e,type:"numeric"})})),t},v.prototype.getNumericRefinement=function(e,t){return this.state.getNumericRefinement(e,t)},v.prototype.getHierarchicalFacetBreadcrumb=function(e){return this.state.getHierarchicalFacetBreadcrumb(e)},v.prototype._search=function(e){var t=this.state,r=[],n=[];e.onlyWithDerivedHelpers||(n=f._getQueries(t.index,t),r.push({state:t,queriesCount:n.length,helper:this}),this.emit("search",{state:t,results:this.lastResults}));var i=this.derivedHelpers.map((function(e){var n=e.getModifiedState(t),i=n.index?f._getQueries(n.index,n):[];return r.push({state:n,queriesCount:i.length,helper:e}),e.emit("search",{state:n,results:e.lastResults}),i})),a=Array.prototype.concat.apply(n,i),s=this._queryId++;if(this._currentNbQueries++,!a.length)return Promise.resolve({results:[]}).then(this._dispatchAlgoliaResponse.bind(this,r,s));try{this.client.search(a).then(this._dispatchAlgoliaResponse.bind(this,r,s)).catch(this._dispatchAlgoliaError.bind(this,s))}catch(c){this.emit("error",{error:c})}},v.prototype._recommend=function(){var e=this.state,t=this.recommendState,r=this.getIndex(),n=[{state:t,index:r,helper:this}],i=t.params.map((function(e){return e.$$id}));this.emit("fetch",{recommend:{state:t,results:this.lastRecommendResults}});var a=this._recommendCache,s=this.derivedHelpers.map((function(t){var r=t.getModifiedState(e).index;if(!r)return[];var s=t.getModifiedRecommendState(new h);return n.push({state:s,index:r,helper:t}),i=Array.prototype.concat.apply(i,s.params.map((function(e){return e.$$id}))),t.emit("fetch",{recommend:{state:s,results:t.lastRecommendResults}}),s._buildQueries(r,a)})),c=Array.prototype.concat.apply(this.recommendState._buildQueries(r,a),s);if(0!==c.length)if(c.length>0&&void 0===this.client.getRecommendations)console.warn("Please update algoliasearch/lite to the latest version in order to use recommend widgets.");else{var o=this._recommendQueryId++;this._currentNbRecommendQueries++;try{this.client.getRecommendations(c).then(this._dispatchRecommendResponse.bind(this,o,n,i)).catch(this._dispatchRecommendError.bind(this,o))}catch(u){this.emit("error",{error:u})}}},v.prototype._dispatchAlgoliaResponse=function(e,t,r){var n=this;if(!(t0},v.prototype._change=function(e){var t=e.state,r=e.isPageReset;t!==this.state&&(this.state=t,this.emit("change",{state:this.state,results:this.lastResults,isPageReset:r}))},v.prototype._recommendChange=function(e){var t=e.state;t!==this.recommendState&&(this.recommendState=t,this.emit("recommend:change",{search:{results:this.lastResults,state:this.state},recommend:{results:this.lastRecommendResults,state:this.recommendState}}))},v.prototype.clearCache=function(){return this.client.clearCache&&this.client.clearCache(),this},v.prototype.setClient=function(e){return this.client===e||("function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+g+")"),this.client=e),this},v.prototype.getClient=function(){return this.client},v.prototype.derive=function(e,t){var r=new i(this,e,t);return this.derivedHelpers.push(r),r},v.prototype.detachDerivedHelper=function(e){var t=this.derivedHelpers.indexOf(e);if(-1===t)throw new Error("Derived helper already detached");this.derivedHelpers.splice(t,1)},v.prototype.hasPendingRequests=function(){return this._currentNbQueries>0},e.exports=v},8965:e=>{"use strict";e.exports=function(e){return Array.isArray(e)?e.filter(Boolean):[]}},9110:e=>{"use strict";e.exports=function(){return Array.prototype.slice.call(arguments).reduceRight((function(e,t){return Object.keys(Object(t)).forEach((function(r){void 0!==t[r]&&(void 0!==e[r]&&delete e[r],e[r]=t[r])})),e}),{})}},2909:e=>{"use strict";e.exports={escapeFacetValue:function(e){return"string"!=typeof e?e:String(e).replace(/^-/,"\\-")},unescapeFacetValue:function(e){return"string"!=typeof e?e:e.replace(/^\\-/,"-")}}},849:e=>{"use strict";e.exports=function(e,t){if(Array.isArray(e))for(var r=0;r{"use strict";e.exports=function(e,t){if(!Array.isArray(e))return-1;for(var r=0;r{e.exports=function(e){return e.reduce((function(e,t){return e.concat(t)}),[])}},7577:(e,t,r)=>{"use strict";var n=r(849);e.exports=function(e,t){var r=(t||[]).map((function(e){return e.split(":")}));return e.reduce((function(e,t){var i=t.split(":"),a=n(r,(function(e){return e[0]===i[0]}));return i.length>1||!a?(e[0].push(i[0]),e[1].push(i[1]),e):(e[0].push(a[0]),e[1].push(a[1]),e)}),[[],[]])}},3014:e=>{"use strict";e.exports=function(e,t){e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}},4843:e=>{"use strict";e.exports=function(e,t){return e.filter((function(r,n){return t.indexOf(r)>-1&&e.indexOf(r)===n}))}},4728:e=>{"use strict";function t(e){return"function"==typeof e||Array.isArray(e)||"[object Object]"===Object.prototype.toString.call(e)}function r(e,n){if(e===n)return e;for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&"__proto__"!==i&&"constructor"!==i){var a=n[i],s=e[i];void 0!==s&&void 0===a||(t(s)&&t(a)?e[i]=r(s,a):e[i]="object"==typeof(c=a)&&null!==c?r(Array.isArray(c)?[]:{},c):c)}var c;return e}e.exports=function(e){t(e)||(e={});for(var n=1,i=arguments.length;n{"use strict";e.exports=function(e){return e&&Object.keys(e).length>0}},1383:e=>{"use strict";e.exports=function(e,t){if(null===e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n=0||(i[r]=e[r]);return i}},8601:e=>{"use strict";function t(e,t){if(e!==t){var r=void 0!==e,n=null===e,i=void 0!==t,a=null===t;if(!a&&e>t||n&&i||!r)return 1;if(!n&&e=n.length?a:"desc"===n[i]?-a:a}return e.index-r.index})),i.map((function(e){return e.value}))}},7507:e=>{"use strict";e.exports=function e(t){if("number"==typeof t)return t;if("string"==typeof t)return parseFloat(t);if(Array.isArray(t))return t.map(e);throw new Error("The value should be a number, a parsable string or an array of those.")}},9228:(e,t,r)=>{"use strict";var n=r(4728);function i(e){return Object.keys(e).sort().reduce((function(t,r){return t[r]=e[r],t}),{})}var a={_getQueries:function(e,t){var r=[];return r.push({indexName:e,params:a._getHitsSearchParams(t)}),t.getRefinedDisjunctiveFacets().forEach((function(n){r.push({indexName:e,params:a._getDisjunctiveFacetSearchParams(t,n)})})),t.getRefinedHierarchicalFacets().forEach((function(n){var i=t.getHierarchicalFacetByName(n),s=t.getHierarchicalRefinement(n),c=t._getHierarchicalFacetSeparator(i);if(s.length>0&&s[0].split(c).length>1){var o=s[0].split(c).slice(0,-1).reduce((function(e,t,r){return e.concat({attribute:i.attributes[r],value:0===r?t:[e[e.length-1].value,t].join(c)})}),[]);o.forEach((function(n,s){var c=a._getDisjunctiveFacetSearchParams(t,n.attribute,0===s);function u(e){return i.attributes.some((function(t){return t===e.split(":")[0]}))}var h=(c.facetFilters||[]).reduce((function(e,t){if(Array.isArray(t)){var r=t.filter((function(e){return!u(e)}));r.length>0&&e.push(r)}return"string"!=typeof t||u(t)||e.push(t),e}),[]),l=o[s-1];s>0?c.facetFilters=h.concat(l.attribute+":"+l.value):h.length>0?c.facetFilters=h:delete c.facetFilters,r.push({indexName:e,params:c})}))}})),r},_getHitsSearchParams:function(e){var t=e.facets.concat(e.disjunctiveFacets).concat(a._getHitsHierarchicalFacetsAttributes(e)).sort(),r=a._getFacetFilters(e),s=a._getNumericFilters(e),c=a._getTagFilters(e),o={};return t.length>0&&(o.facets=t.indexOf("*")>-1?["*"]:t),c.length>0&&(o.tagFilters=c),r.length>0&&(o.facetFilters=r),s.length>0&&(o.numericFilters=s),i(n({},e.getQueryParams(),o))},_getDisjunctiveFacetSearchParams:function(e,t,r){var s=a._getFacetFilters(e,t,r),c=a._getNumericFilters(e,t),o=a._getTagFilters(e),u={hitsPerPage:0,page:0,analytics:!1,clickAnalytics:!1};o.length>0&&(u.tagFilters=o);var h=e.getHierarchicalFacetByName(t);return u.facets=h?a._getDisjunctiveHierarchicalFacetAttribute(e,h,r):t,c.length>0&&(u.numericFilters=c),s.length>0&&(u.facetFilters=s),i(n({},e.getQueryParams(),u))},_getNumericFilters:function(e,t){if(e.numericFilters)return e.numericFilters;var r=[];return Object.keys(e.numericRefinements).forEach((function(n){var i=e.numericRefinements[n]||{};Object.keys(i).forEach((function(e){var a=i[e]||[];t!==n&&a.forEach((function(t){if(Array.isArray(t)){var i=t.map((function(t){return n+e+t}));r.push(i)}else r.push(n+e+t)}))}))})),r},_getTagFilters:function(e){return e.tagFilters?e.tagFilters:e.tagRefinements.join(",")},_getFacetFilters:function(e,t,r){var n=[],i=e.facetsRefinements||{};Object.keys(i).sort().forEach((function(e){(i[e]||[]).slice().sort().forEach((function(t){n.push(e+":"+t)}))}));var a=e.facetsExcludes||{};Object.keys(a).sort().forEach((function(e){(a[e]||[]).sort().forEach((function(t){n.push(e+":-"+t)}))}));var s=e.disjunctiveFacetsRefinements||{};Object.keys(s).sort().forEach((function(e){var r=s[e]||[];if(e!==t&&r&&0!==r.length){var i=[];r.slice().sort().forEach((function(t){i.push(e+":"+t)})),n.push(i)}}));var c=e.hierarchicalFacetsRefinements||{};return Object.keys(c).sort().forEach((function(i){var a=(c[i]||[])[0];if(void 0!==a){var s,o,u=e.getHierarchicalFacetByName(i),h=e._getHierarchicalFacetSeparator(u),l=e._getHierarchicalRootPath(u);if(t===i){if(-1===a.indexOf(h)||!l&&!0===r||l&&l.split(h).length===a.split(h).length)return;l?(o=l.split(h).length-1,a=l):(o=a.split(h).length-2,a=a.slice(0,a.lastIndexOf(h))),s=u.attributes[o]}else o=a.split(h).length-1,s=u.attributes[o];s&&n.push([s+":"+a])}})),n},_getHitsHierarchicalFacetsAttributes:function(e){return e.hierarchicalFacets.reduce((function(t,r){var n=e.getHierarchicalRefinement(r.name)[0];if(!n)return t.push(r.attributes[0]),t;var i=e._getHierarchicalFacetSeparator(r),a=n.split(i).length,s=r.attributes.slice(0,a+1);return t.concat(s)}),[])},_getDisjunctiveHierarchicalFacetAttribute:function(e,t,r){var n=e._getHierarchicalFacetSeparator(t);if(!0===r){var i=e._getHierarchicalRootPath(t),a=0;return i&&(a=i.split(n).length),[t.attributes[a]]}var s=(e.getHierarchicalRefinement(t.name)[0]||"").split(n).length-1;return t.attributes.slice(0,s+1)},getSearchForFacetQuery:function(e,t,r,s){var c=s.isDisjunctiveFacet(e)?s.clearRefinements(e):s,o={facetQuery:t,facetName:e};return"number"==typeof r&&(o.maxFacetHits=r),i(n({},a._getHitsSearchParams(c),o))}};e.exports=a},2208:e=>{"use strict";e.exports=function(e){return null!==e&&/^[a-zA-Z0-9_-]{1,64}$/.test(e)}},7749:(e,t,r)=>{"use strict";var n=r(849),i=r(8657);e.exports=function(e){var t={};return e.forEach((function(e){e.forEach((function(e,r){t[e.objectID]?t[e.objectID]={indexSum:t[e.objectID].indexSum+r,count:t[e.objectID].count+1}:t[e.objectID]={indexSum:r,count:1}}))})),function(e,t){var r=[];return Object.keys(e).forEach((function(n){e[n].count<2&&(e[n].indexSum+=100),r.push({objectID:n,avgOfIndices:e[n].indexSum/t})})),r.sort((function(e,t){return e.avgOfIndices>t.avgOfIndices?1:-1}))}(t,e.length).reduce((function(t,r){var a=n(i(e),(function(e){return e.objectID===r.objectID}));return a?t.concat(a):t}),[])}},6938:e=>{"use strict";e.exports="3.22.4"},3643:function(e){e.exports=function(){"use strict";function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function r(r){for(var n=1;n=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var r=[],n=!0,i=!1,a=void 0;try{for(var s,c=e[Symbol.iterator]();!(n=(s=c.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{n||null==c.return||c.return()}finally{if(i)throw a}}return r}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function a(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then((function(){c();var t=JSON.stringify(e);return a()[t]})).then((function(e){return Promise.all([e?e.value:t(),void 0!==e])})).then((function(e){var t=i(e,2),n=t[0],a=t[1];return Promise.all([n,a||r.miss(n)])})).then((function(e){return i(e,1)[0]}))},set:function(e,t){return Promise.resolve().then((function(){var i=a();return i[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},n().setItem(r,JSON.stringify(i)),t}))},delete:function(e){return Promise.resolve().then((function(){var t=a();delete t[JSON.stringify(e)],n().setItem(r,JSON.stringify(t))}))},clear:function(){return Promise.resolve().then((function(){n().removeItem(r)}))}}}function c(e){var t=a(e.caches),r=t.shift();return void 0===r?{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return t().then((function(e){return Promise.all([e,r.miss(e)])})).then((function(e){return i(e,1)[0]}))},set:function(e,t){return Promise.resolve(t)},delete:function(e){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return r.get(e,n,i).catch((function(){return c({caches:t}).get(e,n,i)}))},set:function(e,n){return r.set(e,n).catch((function(){return c({caches:t}).set(e,n)}))},delete:function(e){return r.delete(e).catch((function(){return c({caches:t}).delete(e)}))},clear:function(){return r.clear().catch((function(){return c({caches:t}).clear()}))}}}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{serializable:!0},t={};return{get:function(r,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},a=JSON.stringify(r);if(a in t)return Promise.resolve(e.serializable?JSON.parse(t[a]):t[a]);var s=n(),c=i&&i.miss||function(){return Promise.resolve()};return s.then((function(e){return c(e)})).then((function(){return s}))},set:function(r,n){return t[JSON.stringify(r)]=e.serializable?JSON.stringify(n):n,Promise.resolve(n)},delete:function(e){return delete t[JSON.stringify(e)],Promise.resolve()},clear:function(){return t={},Promise.resolve()}}}function u(e){for(var t=e.length-1;t>0;t--){var r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}function h(e,t){return t?(Object.keys(t).forEach((function(r){e[r]=t[r](e)})),e):e}function l(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n0?n:void 0,timeout:r.timeout||t,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}var d={Read:1,Write:2,Any:3},p=1,g=2,v=3;function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;return r(r({},e),{},{status:t,lastUpdate:Date.now()})}function R(e){return"string"==typeof e?{protocol:"https",url:e,accept:d.Any}:{protocol:e.protocol||"https",url:e.url,accept:e.accept||d.Any}}var F="GET",b="POST";function _(e,t){return Promise.all(t.map((function(t){return e.get(t,(function(){return Promise.resolve(y(t))}))}))).then((function(e){var r=e.filter((function(e){return function(e){return e.status===p||Date.now()-e.lastUpdate>12e4}(e)})),n=e.filter((function(e){return function(e){return e.status===v&&Date.now()-e.lastUpdate<=12e4}(e)})),i=[].concat(a(r),a(n));return{getTimeout:function(e,t){return(0===n.length&&0===e?1:n.length+3+e)*t},statelessHosts:i.length>0?i.map((function(e){return R(e)})):t}}))}function P(e,t,n,i){var s=[],c=function(e,t){if(e.method!==F&&(void 0!==e.data||void 0!==t.data)){var n=Array.isArray(e.data)?e.data:r(r({},e.data),t.data);return JSON.stringify(n)}}(n,i),o=function(e,t){var n=r(r({},e.headers),t.headers),i={};return Object.keys(n).forEach((function(e){var t=n[e];i[e.toLowerCase()]=t})),i}(e,i),u=n.method,h=n.method!==F?{}:r(r({},n.data),i.data),l=r(r(r({"x-algolia-agent":e.userAgent.value},e.queryParameters),h),i.queryParameters),f=0,m=function t(r,a){var h=r.pop();if(void 0===h)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support .",transporterStackTrace:O(s)};var m={data:c,headers:o,method:u,url:x(h,n.path,l),connectTimeout:a(f,e.timeouts.connect),responseTimeout:a(f,i.timeout)},d=function(e){var t={request:m,response:e,host:h,triesLeft:r.length};return s.push(t),t},p={onSuccess:function(e){return function(e){try{return JSON.parse(e.content)}catch(t){throw function(e,t){return{name:"DeserializationError",message:e,response:t}}(t.message,e)}}(e)},onRetry:function(n){var i=d(n);return n.isTimedOut&&f++,Promise.all([e.logger.info("Retryable failure",w(i)),e.hostsCache.set(h,y(h,n.isTimedOut?v:g))]).then((function(){return t(r,a)}))},onFail:function(e){throw d(e),function(e,t){var r=e.content,n=e.status,i=r;try{i=JSON.parse(r).message}catch(e){}return function(e,t,r){return{name:"ApiError",message:e,status:t,transporterStackTrace:r}}(i,n,t)}(e,O(s))}};return e.requester.send(m).then((function(e){return function(e,t){return function(e){var t=e.status;return e.isTimedOut||function(e){var t=e.isTimedOut,r=e.status;return!t&&!~~r}(e)||2!=~~(t/100)&&4!=~~(t/100)}(e)?t.onRetry(e):2==~~(e.status/100)?t.onSuccess(e):t.onFail(e)}(e,p)}))};return _(e.hostsCache,t).then((function(e){return m(a(e.statelessHosts).reverse(),e.getTimeout)}))}function j(e){var t={value:"Algolia for JavaScript (".concat(e,")"),add:function(e){var r="; ".concat(e.segment).concat(void 0!==e.version?" (".concat(e.version,")"):"");return-1===t.value.indexOf(r)&&(t.value="".concat(t.value).concat(r)),t}};return t}function x(e,t,r){var n=E(r),i="".concat(e.protocol,"://").concat(e.url,"/").concat("/"===t.charAt(0)?t.substr(1):t);return n.length&&(i+="?".concat(n)),i}function E(e){return Object.keys(e).map((function(t){return l("%s=%s",t,(r=e[t],"[object Object]"===Object.prototype.toString.call(r)||"[object Array]"===Object.prototype.toString.call(r)?JSON.stringify(e[t]):e[t]));var r})).join("&")}function O(e){return e.map((function(e){return w(e)}))}function w(e){var t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return r(r({},e),{},{request:r(r({},e.request),{},{headers:r(r({},e.request.headers),t)})})}var S=function(e){var t=e.appId,n=function(e,t,r){var n={"x-algolia-api-key":r,"x-algolia-application-id":t};return{headers:function(){return e===f.WithinHeaders?n:{}},queryParameters:function(){return e===f.WithinQueryParameters?n:{}}}}(void 0!==e.authMode?e.authMode:f.WithinHeaders,t,e.apiKey),a=function(e){var t=e.hostsCache,r=e.logger,n=e.requester,a=e.requestsCache,s=e.responsesCache,c=e.timeouts,o=e.userAgent,u=e.hosts,h=e.queryParameters,l={hostsCache:t,logger:r,requester:n,requestsCache:a,responsesCache:s,timeouts:c,userAgent:o,headers:e.headers,queryParameters:h,hosts:u.map((function(e){return R(e)})),read:function(e,t){var r=m(t,l.timeouts.read),n=function(){return P(l,l.hosts.filter((function(e){return!!(e.accept&d.Read)})),e,r)};if(!0!==(void 0!==r.cacheable?r.cacheable:e.cacheable))return n();var a={request:e,mappedRequestOptions:r,transporter:{queryParameters:l.queryParameters,headers:l.headers}};return l.responsesCache.get(a,(function(){return l.requestsCache.get(a,(function(){return l.requestsCache.set(a,n()).then((function(e){return Promise.all([l.requestsCache.delete(a),e])}),(function(e){return Promise.all([l.requestsCache.delete(a),Promise.reject(e)])})).then((function(e){var t=i(e,2);return t[0],t[1]}))}))}),{miss:function(e){return l.responsesCache.set(a,e)}})},write:function(e,t){return P(l,l.hosts.filter((function(e){return!!(e.accept&d.Write)})),e,m(t,l.timeouts.write))}};return l}(r(r({hosts:[{url:"".concat(t,"-dsn.algolia.net"),accept:d.Read},{url:"".concat(t,".algolia.net"),accept:d.Write}].concat(u([{url:"".concat(t,"-1.algolianet.com")},{url:"".concat(t,"-2.algolianet.com")},{url:"".concat(t,"-3.algolianet.com")}]))},e),{},{headers:r(r(r({},n.headers()),{"content-type":"application/x-www-form-urlencoded"}),e.headers),queryParameters:r(r({},n.queryParameters()),e.queryParameters)}));return h({transporter:a,appId:t,addAlgoliaAgent:function(e,t){a.userAgent.add({segment:e,version:t})},clearCache:function(){return Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then((function(){}))}},e.methods)},A=function(e){return function(t,r){return t.method===F?e.transporter.read(t,r):e.transporter.write(t,r)}},N=function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return h({transporter:e.transporter,appId:e.appId,indexName:t},r.methods)}},Q=function(e){return function(t,n){var i=t.map((function(e){return r(r({},e),{},{params:E(e.params||{})})}));return e.transporter.read({method:b,path:"1/indexes/*/queries",data:{requests:i},cacheable:!0},n)}},H=function(e){return function(t,i){return Promise.all(t.map((function(t){var a=t.params,s=a.facetName,c=a.facetQuery,o=n(a,["facetName","facetQuery"]);return N(e)(t.indexName,{methods:{searchForFacetValues:I}}).searchForFacetValues(s,c,r(r({},i),o))})))}},T=function(e){return function(t,r,n){return e.transporter.read({method:b,path:l("1/answers/%s/prediction",e.indexName),data:{query:t,queryLanguages:r},cacheable:!0},n)}},C=function(e){return function(t,r){return e.transporter.read({method:b,path:l("1/indexes/%s/query",e.indexName),data:{query:t},cacheable:!0},r)}},I=function(e){return function(t,r,n){return e.transporter.read({method:b,path:l("1/indexes/%s/facets/%s/query",e.indexName,t),data:{facetQuery:r},cacheable:!0},n)}},k=1,D=2,q=3,L=function(e){return function(t,n){var i=t.map((function(e){return r(r({},e),{},{threshold:e.threshold||0})}));return e.transporter.read({method:b,path:"1/indexes/*/recommendations",data:{requests:i},cacheable:!0},n)}};function V(e,t,n){var i,a={appId:e,apiKey:t,timeouts:{connect:1,read:2,write:30},requester:{send:function(e){return new Promise((function(t){var r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((function(t){return r.setRequestHeader(t,e.headers[t])}));var n,i=function(e,n){return setTimeout((function(){r.abort(),t({status:0,content:n,isTimedOut:!0})}),1e3*e)},a=i(e.connectTimeout,"Connection timeout");r.onreadystatechange=function(){r.readyState>r.OPENED&&void 0===n&&(clearTimeout(a),n=i(e.responseTimeout,"Socket timeout"))},r.onerror=function(){0===r.status&&(clearTimeout(a),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=function(){clearTimeout(a),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},logger:(i=q,{debug:function(e,t){return k>=i&&console.debug(e,t),Promise.resolve()},info:function(e,t){return D>=i&&console.info(e,t),Promise.resolve()},error:function(e,t){return console.error(e,t),Promise.resolve()}}),responsesCache:o(),requestsCache:o({serializable:!1}),hostsCache:c({caches:[s({key:"".concat("4.24.0","-").concat(e)}),o()]}),userAgent:j("4.24.0").add({segment:"Browser",version:"lite"}),authMode:f.WithinQueryParameters};return S(r(r(r({},a),n),{},{methods:{search:Q,searchForFacetValues:H,multipleQueries:Q,multipleSearchForFacetValues:H,customRequest:A,initIndex:function(e){return function(t){return N(e)(t,{methods:{search:C,searchForFacetValues:I,findAnswers:T}})}},getRecommendations:L}}))}return V.version="4.24.0",V}()},6996:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>S});var n=r(6540),i=r(53),a=r(3643),s=r.n(a),c=r(4103),o=r.n(c),u=r(5260),h=r(5489),l=r(8193),f=r(4586);const m=["zero","one","two","few","many","other"];function d(e){return m.filter((t=>e.includes(t)))}const p={locale:"en",pluralForms:d(["one","other"]),select:e=>1===e?"one":"other"};function g(){const{i18n:{currentLocale:e}}=(0,f.A)();return(0,n.useMemo)((()=>{try{return function(e){const t=new Intl.PluralRules(e);return{locale:e,pluralForms:d(t.resolvedOptions().pluralCategories),select:e=>t.select(e)}}(e)}catch(t){return console.error(`Failed to use Intl.PluralRules for locale "${e}".\nDocusaurus will fallback to the default (English) implementation.\nError: ${t.message}\n`),p}}),[e])}function v(){const e=g();return{selectMessage:(t,r)=>function(e,t,r){const n=e.split("|");if(1===n.length)return n[0];n.length>r.pluralForms.length&&console.error(`For locale=${r.locale}, a maximum of ${r.pluralForms.length} plural forms are expected (${r.pluralForms.join(",")}), but the message contains ${n.length}: ${e}`);const i=r.select(t),a=r.pluralForms.indexOf(i);return n[Math.min(a,n.length-1)]}(r,t,e)}}var y=r(4255),R=r(1252),F=r(9532),b=r(481),_=r(9024),P=r(4070),j=r(1312),x=r(8916);const E={searchQueryInput:"searchQueryInput_fOvw",searchVersionInput:"searchVersionInput_uwCD",searchResultsColumn:"searchResultsColumn_XAOM",algoliaLogo:"algoliaLogo_lMQB",algoliaLogoPathFill:"algoliaLogoPathFill_UGFK",searchResultItem:"searchResultItem_RfWM",searchResultItemHeading:"searchResultItemHeading_cu9x",searchResultItemPath:"searchResultItemPath_bRHw",searchResultItemSummary:"searchResultItemSummary_gq1k",searchQueryColumn:"searchQueryColumn_vJqv",searchVersionColumn:"searchVersionColumn_Afdn",searchLogoColumn:"searchLogoColumn_D3Uo",loadingSpinner:"loadingSpinner_bRrL","loading-spin":"loading-spin_kfRG",loader:"loader_Ubv2"};function O(e){let{docsSearchVersionsHelpers:t}=e;const r=Object.entries(t.allDocsData).filter((e=>{let[,t]=e;return t.versions.length>1}));return n.createElement("div",{className:(0,i.A)("col","col--3","padding-left--none",E.searchVersionColumn)},r.map((e=>{let[i,a]=e;const s=r.length>1?`${i}: `:"";return n.createElement("select",{key:i,onChange:e=>t.setSearchVersion(i,e.target.value),defaultValue:t.searchVersions[i],className:E.searchVersionInput},a.versions.map(((e,t)=>n.createElement("option",{key:t,label:`${s}${e.label}`,value:e.name}))))})))}function w(){const{siteConfig:{themeConfig:e},i18n:{currentLocale:t}}=(0,f.A)(),{algolia:{appId:r,apiKey:a,indexName:c,externalUrlRegex:m}}=e,d=function(){const{selectMessage:e}=v();return t=>e(t,(0,j.T)({id:"theme.SearchPage.documentsFound.plurals",description:'Pluralized label for "{count} documents found". Use as much plural forms (separated by "|") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)',message:"One document found|{count} documents found"},{count:t}))}(),p=function(){const e=(0,P.Gy)(),[t,r]=(0,n.useState)((()=>Object.entries(e).reduce(((e,t)=>{let[r,n]=t;return{...e,[r]:n.versions[0].name}}),{}))),i=Object.values(e).some((e=>e.versions.length>1));return{allDocsData:e,versioningEnabled:i,searchVersions:t,setSearchVersion:(e,t)=>r((r=>({...r,[e]:t})))}}(),{searchQuery:g,setSearchQuery:_}=(0,y.n)(),w={items:[],query:null,totalResults:null,totalPages:null,lastPage:null,hasMore:null,loading:null},[S,A]=(0,n.useReducer)(((e,t)=>{switch(t.type){case"reset":return w;case"loading":return{...e,loading:!0};case"update":return g!==t.value.query?e:{...t.value,items:0===t.value.lastPage?t.value.items:e.items.concat(t.value.items)};case"advance":{const t=e.totalPages>e.lastPage+1;return{...e,lastPage:t?e.lastPage+1:e.lastPage,hasMore:t}}default:return e}}),w),N=s()(r,a),Q=o()(N,c,{hitsPerPage:15,advancedSyntax:!0,disjunctiveFacets:["language","docusaurus_tag"]});Q.on("result",(e=>{let{results:{query:t,hits:r,page:n,nbHits:i,nbPages:a}}=e;if(""===t||!Array.isArray(r))return void A({type:"reset"});const s=e=>e.replace(/algolia-docsearch-suggestion--highlight/g,"search-result-match"),c=r.map((e=>{let{url:t,_highlightResult:{hierarchy:r},_snippetResult:n={}}=e;const i=new URL(t),a=Object.keys(r).map((e=>s(r[e].value)));return{title:a.pop(),url:(0,R.G)(m,i.href)?i.href:i.pathname+i.hash,summary:n.content?`${s(n.content.value)}...`:"",breadcrumbs:a}}));A({type:"update",value:{items:c,query:t,totalResults:i,totalPages:a,lastPage:n,hasMore:a>n+1,loading:!1}})}));const[H,T]=(0,n.useState)(null),C=(0,n.useRef)(0),I=(0,n.useRef)(l.A.canUseDOM&&new IntersectionObserver((e=>{const{isIntersecting:t,boundingClientRect:{y:r}}=e[0];t&&C.current>r&&A({type:"advance"}),C.current=r}),{threshold:1})),k=()=>g?(0,j.T)({id:"theme.SearchPage.existingResultsTitle",message:'Search results for "{query}"',description:"The search page title for non-empty query"},{query:g}):(0,j.T)({id:"theme.SearchPage.emptyResultsTitle",message:"Search the documentation",description:"The search page title for empty query"}),D=(0,F.qd)((function(e){void 0===e&&(e=0),Q.addDisjunctiveFacetRefinement("docusaurus_tag","default"),Q.addDisjunctiveFacetRefinement("language",t),Object.entries(p.searchVersions).forEach((e=>{let[t,r]=e;Q.addDisjunctiveFacetRefinement("docusaurus_tag",`docs-${t}-${r}`)})),Q.setQuery(g).setPage(e).search()}));return(0,n.useEffect)((()=>{if(!H)return;const e=I.current;return e?(e.observe(H),()=>e.unobserve(H)):()=>!0}),[H]),(0,n.useEffect)((()=>{A({type:"reset"}),g&&(A({type:"loading"}),setTimeout((()=>{D()}),300))}),[g,p.searchVersions,D]),(0,n.useEffect)((()=>{S.lastPage&&0!==S.lastPage&&D(S.lastPage)}),[D,S.lastPage]),n.createElement(x.A,null,n.createElement(u.A,null,n.createElement("title",null,(0,b.s)(k())),n.createElement("meta",{property:"robots",content:"noindex, follow"})),n.createElement("div",{className:"container margin-vert--lg"},n.createElement("h1",null,k()),n.createElement("form",{className:"row",onSubmit:e=>e.preventDefault()},n.createElement("div",{className:(0,i.A)("col",E.searchQueryColumn,{"col--9":p.versioningEnabled,"col--12":!p.versioningEnabled})},n.createElement("input",{type:"search",name:"q",className:E.searchQueryInput,placeholder:(0,j.T)({id:"theme.SearchPage.inputPlaceholder",message:"Type your search here",description:"The placeholder for search page input"}),"aria-label":(0,j.T)({id:"theme.SearchPage.inputLabel",message:"Search",description:"The ARIA label for search page input"}),onChange:e=>_(e.target.value),value:g,autoComplete:"off",autoFocus:!0})),p.versioningEnabled&&n.createElement(O,{docsSearchVersionsHelpers:p})),n.createElement("div",{className:"row"},n.createElement("div",{className:(0,i.A)("col","col--8",E.searchResultsColumn)},!!S.totalResults&&d(S.totalResults)),n.createElement("div",{className:(0,i.A)("col","col--4","text--right",E.searchLogoColumn)},n.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:"https://www.algolia.com/","aria-label":(0,j.T)({id:"theme.SearchPage.algoliaLabel",message:"Search by Algolia",description:"The ARIA label for Algolia mention"})},n.createElement("svg",{viewBox:"0 0 168 24",className:E.algoliaLogo},n.createElement("g",{fill:"none"},n.createElement("path",{className:E.algoliaLogoPathFill,d:"M120.925 18.804c-4.386.02-4.386-3.54-4.386-4.106l-.007-13.336 2.675-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-10.846-2.18c.821 0 1.43-.047 1.855-.129v-2.719a6.334 6.334 0 0 0-1.574-.199 5.7 5.7 0 0 0-.897.069 2.699 2.699 0 0 0-.814.24c-.24.116-.439.28-.582.491-.15.212-.219.335-.219.656 0 .628.219.991.616 1.23s.938.362 1.615.362zm-.233-9.7c.883 0 1.629.109 2.231.328.602.218 1.088.525 1.444.915.363.396.609.922.76 1.483.157.56.232 1.175.232 1.85v6.874a32.5 32.5 0 0 1-1.868.314c-.834.123-1.772.185-2.813.185-.69 0-1.327-.069-1.895-.198a4.001 4.001 0 0 1-1.471-.636 3.085 3.085 0 0 1-.951-1.134c-.226-.465-.343-1.12-.343-1.803 0-.656.13-1.073.384-1.525a3.24 3.24 0 0 1 1.047-1.106c.445-.287.95-.492 1.532-.615a8.8 8.8 0 0 1 1.82-.185 8.404 8.404 0 0 1 1.972.24v-.438c0-.307-.035-.6-.11-.874a1.88 1.88 0 0 0-.384-.73 1.784 1.784 0 0 0-.724-.493 3.164 3.164 0 0 0-1.143-.205c-.616 0-1.177.075-1.69.164a7.735 7.735 0 0 0-1.26.307l-.321-2.192c.335-.117.834-.233 1.478-.349a10.98 10.98 0 0 1 2.073-.178zm52.842 9.626c.822 0 1.43-.048 1.854-.13V13.7a6.347 6.347 0 0 0-1.574-.199c-.294 0-.595.021-.896.069a2.7 2.7 0 0 0-.814.24 1.46 1.46 0 0 0-.582.491c-.15.212-.218.335-.218.656 0 .628.218.991.615 1.23.404.245.938.362 1.615.362zm-.226-9.694c.883 0 1.629.108 2.231.327.602.219 1.088.526 1.444.915.355.39.609.923.759 1.483a6.8 6.8 0 0 1 .233 1.852v6.873c-.41.088-1.034.19-1.868.314-.834.123-1.772.184-2.813.184-.69 0-1.327-.068-1.895-.198a4.001 4.001 0 0 1-1.471-.635 3.085 3.085 0 0 1-.951-1.134c-.226-.465-.343-1.12-.343-1.804 0-.656.13-1.073.384-1.524.26-.45.608-.82 1.047-1.107.445-.286.95-.491 1.532-.614a8.803 8.803 0 0 1 2.751-.13c.329.034.671.096 1.04.185v-.437a3.3 3.3 0 0 0-.109-.875 1.873 1.873 0 0 0-.384-.731 1.784 1.784 0 0 0-.724-.492 3.165 3.165 0 0 0-1.143-.205c-.616 0-1.177.075-1.69.164a7.75 7.75 0 0 0-1.26.307l-.321-2.193c.335-.116.834-.232 1.478-.348a11.633 11.633 0 0 1 2.073-.177zm-8.034-1.271a1.626 1.626 0 0 1-1.628-1.62c0-.895.725-1.62 1.628-1.62.904 0 1.63.725 1.63 1.62 0 .895-.733 1.62-1.63 1.62zm1.348 13.22h-2.689V7.27l2.69-.423v11.956zm-4.714 0c-4.386.02-4.386-3.54-4.386-4.107l-.008-13.336 2.676-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-8.698-5.903c0-1.156-.253-2.119-.746-2.788-.493-.677-1.183-1.01-2.067-1.01-.882 0-1.574.333-2.065 1.01-.493.676-.733 1.632-.733 2.788 0 1.168.246 1.953.74 2.63.492.683 1.183 1.018 2.066 1.018.882 0 1.574-.342 2.067-1.019.492-.683.738-1.46.738-2.63zm2.737-.007c0 .902-.13 1.584-.397 2.33a5.52 5.52 0 0 1-1.128 1.906 4.986 4.986 0 0 1-1.752 1.223c-.685.286-1.739.45-2.265.45-.528-.006-1.574-.157-2.252-.45a5.096 5.096 0 0 1-1.744-1.223c-.487-.527-.863-1.162-1.137-1.906a6.345 6.345 0 0 1-.41-2.33c0-.902.123-1.77.397-2.508a5.554 5.554 0 0 1 1.15-1.892 5.133 5.133 0 0 1 1.75-1.216c.679-.287 1.425-.423 2.232-.423.808 0 1.553.142 2.237.423a4.88 4.88 0 0 1 1.753 1.216 5.644 5.644 0 0 1 1.135 1.892c.287.738.431 1.606.431 2.508zm-20.138 0c0 1.12.246 2.363.738 2.882.493.52 1.13.78 1.91.78.424 0 .828-.062 1.204-.178.377-.116.677-.253.917-.417V9.33a10.476 10.476 0 0 0-1.766-.226c-.971-.028-1.71.37-2.23 1.004-.513.636-.773 1.75-.773 2.788zm7.438 5.274c0 1.824-.466 3.156-1.404 4.004-.936.846-2.367 1.27-4.296 1.27-.705 0-2.17-.137-3.34-.396l.431-2.118c.98.205 2.272.26 2.95.26 1.074 0 1.84-.219 2.299-.656.459-.437.684-1.086.684-1.948v-.437a8.07 8.07 0 0 1-1.047.397c-.43.13-.93.198-1.492.198-.739 0-1.41-.116-2.018-.349a4.206 4.206 0 0 1-1.567-1.025c-.431-.45-.774-1.017-1.013-1.694-.24-.677-.363-1.885-.363-2.773 0-.834.13-1.88.384-2.577.26-.696.629-1.298 1.129-1.796.493-.498 1.095-.881 1.8-1.162a6.605 6.605 0 0 1 2.428-.457c.87 0 1.67.109 2.45.24.78.129 1.444.265 1.985.415V18.17zM6.972 6.677v1.627c-.712-.446-1.52-.67-2.425-.67-.585 0-1.045.13-1.38.391a1.24 1.24 0 0 0-.502 1.03c0 .425.164.765.494 1.02.33.256.835.532 1.516.83.447.192.795.356 1.045.495.25.138.537.332.862.582.324.25.563.548.718.894.154.345.23.741.23 1.188 0 .947-.334 1.691-1.004 2.234-.67.542-1.537.814-2.601.814-1.18 0-2.16-.229-2.936-.686v-1.708c.84.628 1.814.942 2.92.942.585 0 1.048-.136 1.388-.407.34-.271.51-.646.51-1.125 0-.287-.1-.55-.302-.79-.203-.24-.42-.42-.655-.542-.234-.123-.585-.29-1.053-.503a61.27 61.27 0 0 1-.582-.271 13.67 13.67 0 0 1-.55-.287 4.275 4.275 0 0 1-.567-.351 6.92 6.92 0 0 1-.455-.4c-.18-.17-.31-.34-.39-.51-.08-.17-.155-.37-.224-.598a2.553 2.553 0 0 1-.104-.742c0-.915.333-1.638.998-2.17.664-.532 1.523-.798 2.576-.798.968 0 1.793.17 2.473.51zm7.468 5.696v-.287c-.022-.607-.187-1.088-.495-1.444-.309-.357-.75-.535-1.324-.535-.532 0-.99.194-1.373.583-.382.388-.622.949-.717 1.683h3.909zm1.005 2.792v1.404c-.596.34-1.383.51-2.362.51-1.255 0-2.255-.377-3-1.132-.744-.755-1.116-1.744-1.116-2.968 0-1.297.34-2.316 1.021-3.055.68-.74 1.548-1.11 2.6-1.11 1.033 0 1.852.323 2.458.966.606.644.91 1.572.91 2.784 0 .33-.033.676-.096 1.038h-5.314c.107.702.405 1.239.894 1.611.49.372 1.106.558 1.85.558.862 0 1.58-.202 2.155-.606zm6.605-1.77h-1.212c-.596 0-1.045.116-1.349.35-.303.234-.454.532-.454.894 0 .372.117.664.35.877.235.213.575.32 1.022.32.51 0 .912-.142 1.204-.424.293-.281.44-.651.44-1.108v-.91zm-4.068-2.554V9.325c.627-.361 1.457-.542 2.489-.542 2.116 0 3.175 1.026 3.175 3.08V17h-1.548v-.957c-.415.68-1.143 1.02-2.186 1.02-.766 0-1.38-.22-1.843-.661-.462-.442-.694-1.003-.694-1.684 0-.776.293-1.38.878-1.81.585-.431 1.404-.647 2.457-.647h1.34V11.8c0-.554-.133-.971-.399-1.253-.266-.282-.707-.423-1.324-.423a4.07 4.07 0 0 0-2.345.718zm9.333-1.93v1.42c.394-1 1.101-1.5 2.123-1.5.148 0 .313.016.494.048v1.531a1.885 1.885 0 0 0-.75-.143c-.542 0-.989.24-1.34.718-.351.479-.527 1.048-.527 1.707V17h-1.563V8.91h1.563zm5.01 4.084c.022.82.272 1.492.75 2.019.479.526 1.15.79 2.01.79.639 0 1.235-.176 1.788-.527v1.404c-.521.319-1.186.479-1.995.479-1.265 0-2.276-.4-3.031-1.197-.755-.798-1.133-1.792-1.133-2.984 0-1.16.38-2.151 1.14-2.975.761-.825 1.79-1.237 3.088-1.237.702 0 1.346.149 1.93.447v1.436a3.242 3.242 0 0 0-1.77-.495c-.84 0-1.513.266-2.019.798-.505.532-.758 1.213-.758 2.042zM40.24 5.72v4.579c.458-1 1.293-1.5 2.505-1.5.787 0 1.42.245 1.899.734.479.49.718 1.17.718 2.042V17h-1.564v-5.106c0-.553-.14-.98-.422-1.284-.282-.303-.652-.455-1.11-.455-.531 0-1.002.202-1.411.606-.41.405-.615 1.022-.615 1.851V17h-1.563V5.72h1.563zm14.966 10.02c.596 0 1.096-.253 1.5-.758.404-.506.606-1.157.606-1.955 0-.915-.202-1.62-.606-2.114-.404-.495-.92-.742-1.548-.742-.553 0-1.05.224-1.491.67-.442.447-.662 1.133-.662 2.058 0 .958.212 1.67.638 2.138.425.469.946.703 1.563.703zM53.004 5.72v4.42c.574-.894 1.388-1.341 2.44-1.341 1.022 0 1.857.383 2.506 1.149.649.766.973 1.781.973 3.047 0 1.138-.309 2.109-.925 2.912-.617.803-1.463 1.205-2.537 1.205-1.075 0-1.894-.447-2.457-1.34V17h-1.58V5.72h1.58zm9.908 11.104l-3.223-7.913h1.739l1.005 2.632 1.26 3.415c.096-.32.48-1.458 1.15-3.415l.909-2.632h1.66l-2.92 7.866c-.777 2.074-1.963 3.11-3.559 3.11a2.92 2.92 0 0 1-.734-.079v-1.34c.17.042.351.064.543.064 1.032 0 1.755-.57 2.17-1.708z"}),n.createElement("path",{fill:"#5468FF",d:"M78.988.938h16.594a2.968 2.968 0 0 1 2.966 2.966V20.5a2.967 2.967 0 0 1-2.966 2.964H78.988a2.967 2.967 0 0 1-2.966-2.964V3.897A2.961 2.961 0 0 1 78.988.938z"}),n.createElement("path",{fill:"white",d:"M89.632 5.967v-.772a.978.978 0 0 0-.978-.977h-2.28a.978.978 0 0 0-.978.977v.793c0 .088.082.15.171.13a7.127 7.127 0 0 1 1.984-.28c.65 0 1.295.088 1.917.259.082.02.164-.04.164-.13m-6.248 1.01l-.39-.389a.977.977 0 0 0-1.382 0l-.465.465a.973.973 0 0 0 0 1.38l.383.383c.062.061.15.047.205-.014.226-.307.472-.601.746-.874.281-.28.568-.526.883-.751.068-.042.075-.137.02-.2m4.16 2.453v3.341c0 .096.104.165.192.117l2.97-1.537c.068-.034.089-.117.055-.184a3.695 3.695 0 0 0-3.08-1.866c-.068 0-.136.054-.136.13m0 8.048a4.489 4.489 0 0 1-4.49-4.482 4.488 4.488 0 0 1 4.49-4.482 4.488 4.488 0 0 1 4.489 4.482 4.484 4.484 0 0 1-4.49 4.482m0-10.85a6.363 6.363 0 1 0 0 12.729 6.37 6.37 0 0 0 6.372-6.368 6.358 6.358 0 0 0-6.371-6.36"})))))),S.items.length>0?n.createElement("main",null,S.items.map(((e,t)=>{let{title:r,url:a,summary:s,breadcrumbs:c}=e;return n.createElement("article",{key:t,className:E.searchResultItem},n.createElement("h2",{className:E.searchResultItemHeading},n.createElement(h.A,{to:a,dangerouslySetInnerHTML:{__html:r}})),c.length>0&&n.createElement("nav",{"aria-label":"breadcrumbs"},n.createElement("ul",{className:(0,i.A)("breadcrumbs",E.searchResultItemPath)},c.map(((e,t)=>n.createElement("li",{key:t,className:"breadcrumbs__item",dangerouslySetInnerHTML:{__html:e}}))))),s&&n.createElement("p",{className:E.searchResultItemSummary,dangerouslySetInnerHTML:{__html:s}}))}))):[g&&!S.loading&&n.createElement("p",{key:"no-results"},n.createElement(j.A,{id:"theme.SearchPage.noResultsText",description:"The paragraph for empty search result"},"No results were found")),!!S.loading&&n.createElement("div",{key:"spinner",className:E.loadingSpinner})],S.hasMore&&n.createElement("div",{className:E.loader,ref:T},n.createElement(j.A,{id:"theme.SearchPage.fetchingNewResults",description:"The paragraph for fetching new search results"},"Fetching new results..."))))}function S(){return n.createElement(_.e3,{className:"search-page-wrapper"},n.createElement(w,null))}}}]); \ No newline at end of file diff --git a/assets/js/1a4e3797.6f617479.js b/assets/js/1a4e3797.6f617479.js new file mode 100644 index 00000000..1754a9aa --- /dev/null +++ b/assets/js/1a4e3797.6f617479.js @@ -0,0 +1,2 @@ +/*! For license information please see 1a4e3797.6f617479.js.LICENSE.txt */ +(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[2138],{2733:e=>{function t(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function n(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=t,t.prototype._events=void 0,t.prototype._maxListeners=void 0,t.defaultMaxListeners=10,t.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},t.prototype.emit=function(e){var t,a,s,c,o,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||n(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var h=new Error('Uncaught, unspecified "error" event. ('+t+")");throw h.context=t,h}if(i(a=this._events[e]))return!1;if(r(a))switch(arguments.length){case 1:a.call(this);break;case 2:a.call(this,arguments[1]);break;case 3:a.call(this,arguments[1],arguments[2]);break;default:c=Array.prototype.slice.call(arguments,1),a.apply(this,c)}else if(n(a))for(c=Array.prototype.slice.call(arguments,1),s=(u=a.slice()).length,o=0;o0&&this._events[e].length>s&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},t.prototype.on=t.prototype.addListener,t.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},t.prototype.removeListener=function(e,t){var i,a,s,c;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(s=(i=this._events[e]).length,a=-1,i===t||r(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(n(i)){for(c=s;c-- >0;)if(i[c]===t||i[c].listener&&i[c].listener===t){a=c;break}if(a<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(a,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},t.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},t.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},t.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},t.listenerCount=function(e,t){return e.listenerCount(t)}},4103:(e,t,r)=>{"use strict";var n=r(6571),i=r(9127),a=r(2223),s=r(3371),c=r(7691);function o(e,t,r,i){return new n(e,t,r,i)}o.version=r(6938),o.AlgoliaSearchHelper=n,o.SearchParameters=s,o.RecommendParameters=i,o.SearchResults=c,o.RecommendResults=a,e.exports=o},6732:(e,t,r)=>{"use strict";var n=r(2733);function i(e,t,r){this.main=e,this.fn=t,this.recommendFn=r,this.lastResults=null,this.lastRecommendResults=null}r(3014)(i,n),i.prototype.detach=function(){this.removeAllListeners(),this.main.detachDerivedHelper(this)},i.prototype.getModifiedState=function(e){return this.fn(e)},i.prototype.getModifiedRecommendState=function(e){return this.recommendFn(e)},e.exports=i},9127:e=>{"use strict";function t(e){e=e||{},this.params=e.params||[]}t.prototype={constructor:t,addParams:function(e){var r=this.params.slice();return r.push(e),new t({params:r})},removeParams:function(e){return new t({params:this.params.filter((function(t){return t.$$id!==e}))})},addFrequentlyBoughtTogether:function(e){return this.addParams(Object.assign({},e,{model:"bought-together"}))},addRelatedProducts:function(e){return this.addParams(Object.assign({},e,{model:"related-products"}))},addTrendingItems:function(e){return this.addParams(Object.assign({},e,{model:"trending-items"}))},addTrendingFacets:function(e){return this.addParams(Object.assign({},e,{model:"trending-facets"}))},addLookingSimilar:function(e){return this.addParams(Object.assign({},e,{model:"looking-similar"}))},_buildQueries:function(e,t){return this.params.filter((function(e){return void 0===t[e.$$id]})).map((function(t){var r=Object.assign({},t,{indexName:e,threshold:t.threshold||0});return delete r.$$id,r}))}},e.exports=t},2223:e=>{"use strict";function t(e,t){this._state=e,this._rawResults={};var r=this;e.params.forEach((function(e){var n=e.$$id;r[n]=t[n],r._rawResults[n]=t[n]}))}t.prototype={constructor:t},e.exports=t},1673:(e,t,r)=>{"use strict";var n=r(9110),i=r(317),a=r(1383),s={addRefinement:function(e,t,r){if(s.isRefined(e,t,r))return e;var i=""+r,a=e[t]?e[t].concat(i):[i],c={};return c[t]=a,n({},c,e)},removeRefinement:function(e,t,r){if(void 0===r)return s.clearRefinement(e,(function(e,r){return t===r}));var n=""+r;return s.clearRefinement(e,(function(e,r){return t===r&&n===e}))},toggleRefinement:function(e,t,r){if(void 0===r)throw new Error("toggleRefinement should be used with a value");return s.isRefined(e,t,r)?s.removeRefinement(e,t,r):s.addRefinement(e,t,r)},clearRefinement:function(e,t,r){if(void 0===t)return i(e)?{}:e;if("string"==typeof t)return a(e,[t]);if("function"==typeof t){var n=!1,s=Object.keys(e).reduce((function(i,a){var s=e[a]||[],c=s.filter((function(e){return!t(e,a,r)}));return c.length!==s.length&&(n=!0),i[a]=c,i}),{});return n?s:e}},isRefined:function(e,t,r){var n=Boolean(e[t])&&e[t].length>0;if(void 0===r||!n)return n;var i=""+r;return-1!==e[t].indexOf(i)}};e.exports=s},3371:(e,t,r)=>{"use strict";var n=r(9110),i=r(849),a=r(4843),s=r(4728),c=r(317),o=r(1383),u=r(7507),h=r(2208),l=r(1673);function f(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((function(e,r){return f(t[r],e)})):e===t}function m(e){var t=e?m._parseNumbers(e):{};void 0===t.userToken||h(t.userToken)||console.warn("[algoliasearch-helper] The `userToken` parameter is invalid. This can lead to wrong analytics.\n - Format: [a-zA-Z0-9_-]{1,64}"),this.facets=t.facets||[],this.disjunctiveFacets=t.disjunctiveFacets||[],this.hierarchicalFacets=t.hierarchicalFacets||[],this.facetsRefinements=t.facetsRefinements||{},this.facetsExcludes=t.facetsExcludes||{},this.disjunctiveFacetsRefinements=t.disjunctiveFacetsRefinements||{},this.numericRefinements=t.numericRefinements||{},this.tagRefinements=t.tagRefinements||[],this.hierarchicalFacetsRefinements=t.hierarchicalFacetsRefinements||{};var r=this;Object.keys(t).forEach((function(e){var n=-1!==m.PARAMETERS.indexOf(e),i=void 0!==t[e];!n&&i&&(r[e]=t[e])}))}m.PARAMETERS=Object.keys(new m),m._parseNumbers=function(e){if(e instanceof m)return e;var t={};if(["aroundPrecision","aroundRadius","getRankingInfo","minWordSizefor2Typos","minWordSizefor1Typo","page","maxValuesPerFacet","distinct","minimumAroundRadius","hitsPerPage","minProximity"].forEach((function(r){var n=e[r];if("string"==typeof n){var i=parseFloat(n);t[r]=isNaN(i)?n:i}})),Array.isArray(e.insideBoundingBox)&&(t.insideBoundingBox=e.insideBoundingBox.map((function(e){return Array.isArray(e)?e.map((function(e){return parseFloat(e)})):e}))),e.numericRefinements){var r={};Object.keys(e.numericRefinements).forEach((function(t){var n=e.numericRefinements[t]||{};r[t]={},Object.keys(n).forEach((function(e){var i=n[e].map((function(e){return Array.isArray(e)?e.map((function(e){return"string"==typeof e?parseFloat(e):e})):"string"==typeof e?parseFloat(e):e}));r[t][e]=i}))})),t.numericRefinements=r}return s(e,t)},m.make=function(e){var t=new m(e);return(e.hierarchicalFacets||[]).forEach((function(e){if(e.rootPath){var r=t.getHierarchicalRefinement(e.name);r.length>0&&0!==r[0].indexOf(e.rootPath)&&(t=t.clearRefinements(e.name)),0===(r=t.getHierarchicalRefinement(e.name)).length&&(t=t.toggleHierarchicalFacetRefinement(e.name,e.rootPath))}})),t},m.validate=function(e,t){var r=t||{};return e.tagFilters&&r.tagRefinements&&r.tagRefinements.length>0?new Error("[Tags] Cannot switch from the managed tag API to the advanced API. It is probably an error, if it is really what you want, you should first clear the tags with clearTags method."):e.tagRefinements.length>0&&r.tagFilters?new Error("[Tags] Cannot switch from the advanced tag API to the managed API. It is probably an error, if it is not, you should first clear the tags with clearTags method."):e.numericFilters&&r.numericRefinements&&c(r.numericRefinements)?new Error("[Numeric filters] Can't switch from the advanced to the managed API. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):c(e.numericRefinements)&&r.numericFilters?new Error("[Numeric filters] Can't switch from the managed API to the advanced. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):null},m.prototype={constructor:m,clearRefinements:function(e){var t={numericRefinements:this._clearNumericRefinements(e),facetsRefinements:l.clearRefinement(this.facetsRefinements,e,"conjunctiveFacet"),facetsExcludes:l.clearRefinement(this.facetsExcludes,e,"exclude"),disjunctiveFacetsRefinements:l.clearRefinement(this.disjunctiveFacetsRefinements,e,"disjunctiveFacet"),hierarchicalFacetsRefinements:l.clearRefinement(this.hierarchicalFacetsRefinements,e,"hierarchicalFacet")};return t.numericRefinements===this.numericRefinements&&t.facetsRefinements===this.facetsRefinements&&t.facetsExcludes===this.facetsExcludes&&t.disjunctiveFacetsRefinements===this.disjunctiveFacetsRefinements&&t.hierarchicalFacetsRefinements===this.hierarchicalFacetsRefinements?this:this.setQueryParameters(t)},clearTags:function(){return void 0===this.tagFilters&&0===this.tagRefinements.length?this:this.setQueryParameters({tagFilters:void 0,tagRefinements:[]})},setIndex:function(e){return e===this.index?this:this.setQueryParameters({index:e})},setQuery:function(e){return e===this.query?this:this.setQueryParameters({query:e})},setPage:function(e){return e===this.page?this:this.setQueryParameters({page:e})},setFacets:function(e){return this.setQueryParameters({facets:e})},setDisjunctiveFacets:function(e){return this.setQueryParameters({disjunctiveFacets:e})},setHitsPerPage:function(e){return this.hitsPerPage===e?this:this.setQueryParameters({hitsPerPage:e})},setTypoTolerance:function(e){return this.typoTolerance===e?this:this.setQueryParameters({typoTolerance:e})},addNumericRefinement:function(e,t,r){var n=u(r);if(this.isNumericRefined(e,t,n))return this;var i=s({},this.numericRefinements);return i[e]=s({},i[e]),i[e][t]?(i[e][t]=i[e][t].slice(),i[e][t].push(n)):i[e][t]=[n],this.setQueryParameters({numericRefinements:i})},getConjunctiveRefinements:function(e){return this.isConjunctiveFacet(e)&&this.facetsRefinements[e]||[]},getDisjunctiveRefinements:function(e){return this.isDisjunctiveFacet(e)&&this.disjunctiveFacetsRefinements[e]||[]},getHierarchicalRefinement:function(e){return this.hierarchicalFacetsRefinements[e]||[]},getExcludeRefinements:function(e){return this.isConjunctiveFacet(e)&&this.facetsExcludes[e]||[]},removeNumericRefinement:function(e,t,r){var n=r;return void 0!==n?this.isNumericRefined(e,t,n)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements((function(r,i){return i===e&&r.op===t&&f(r.val,u(n))}))}):this:void 0!==t?this.isNumericRefined(e,t)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements((function(r,n){return n===e&&r.op===t}))}):this:this.isNumericRefined(e)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements((function(t,r){return r===e}))}):this},getNumericRefinements:function(e){return this.numericRefinements[e]||{}},getNumericRefinement:function(e,t){return this.numericRefinements[e]&&this.numericRefinements[e][t]},_clearNumericRefinements:function(e){if(void 0===e)return c(this.numericRefinements)?{}:this.numericRefinements;if("string"==typeof e)return o(this.numericRefinements,[e]);if("function"==typeof e){var t=!1,r=this.numericRefinements,n=Object.keys(r).reduce((function(n,i){var a=r[i],s={};return a=a||{},Object.keys(a).forEach((function(r){var n=a[r]||[],c=[];n.forEach((function(t){e({val:t,op:r},i,"numeric")||c.push(t)})),c.length!==n.length&&(t=!0),s[r]=c})),n[i]=s,n}),{});return t?n:this.numericRefinements}},addFacet:function(e){return this.isConjunctiveFacet(e)?this:this.setQueryParameters({facets:this.facets.concat([e])})},addDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this:this.setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.concat([e])})},addHierarchicalFacet:function(e){if(this.isHierarchicalFacet(e.name))throw new Error("Cannot declare two hierarchical facets with the same name: `"+e.name+"`");return this.setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.concat([e])})},addFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return l.isRefined(this.facetsRefinements,e,t)?this:this.setQueryParameters({facetsRefinements:l.addRefinement(this.facetsRefinements,e,t)})},addExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return l.isRefined(this.facetsExcludes,e,t)?this:this.setQueryParameters({facetsExcludes:l.addRefinement(this.facetsExcludes,e,t)})},addDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return l.isRefined(this.disjunctiveFacetsRefinements,e,t)?this:this.setQueryParameters({disjunctiveFacetsRefinements:l.addRefinement(this.disjunctiveFacetsRefinements,e,t)})},addTagRefinement:function(e){if(this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.concat(e)};return this.setQueryParameters(t)},removeFacet:function(e){return this.isConjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({facets:this.facets.filter((function(t){return t!==e}))}):this},removeDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.filter((function(t){return t!==e}))}):this},removeHierarchicalFacet:function(e){return this.isHierarchicalFacet(e)?this.clearRefinements(e).setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.filter((function(t){return t.name!==e}))}):this},removeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return l.isRefined(this.facetsRefinements,e,t)?this.setQueryParameters({facetsRefinements:l.removeRefinement(this.facetsRefinements,e,t)}):this},removeExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return l.isRefined(this.facetsExcludes,e,t)?this.setQueryParameters({facetsExcludes:l.removeRefinement(this.facetsExcludes,e,t)}):this},removeDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return l.isRefined(this.disjunctiveFacetsRefinements,e,t)?this.setQueryParameters({disjunctiveFacetsRefinements:l.removeRefinement(this.disjunctiveFacetsRefinements,e,t)}):this},removeTagRefinement:function(e){if(!this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.filter((function(t){return t!==e}))};return this.setQueryParameters(t)},toggleRefinement:function(e,t){return this.toggleFacetRefinement(e,t)},toggleFacetRefinement:function(e,t){if(this.isHierarchicalFacet(e))return this.toggleHierarchicalFacetRefinement(e,t);if(this.isConjunctiveFacet(e))return this.toggleConjunctiveFacetRefinement(e,t);if(this.isDisjunctiveFacet(e))return this.toggleDisjunctiveFacetRefinement(e,t);throw new Error("Cannot refine the undeclared facet "+e+"; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets")},toggleConjunctiveFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsRefinements:l.toggleRefinement(this.facetsRefinements,e,t)})},toggleExcludeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsExcludes:l.toggleRefinement(this.facetsExcludes,e,t)})},toggleDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return this.setQueryParameters({disjunctiveFacetsRefinements:l.toggleRefinement(this.disjunctiveFacetsRefinements,e,t)})},toggleHierarchicalFacetRefinement:function(e,t){if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration");var r=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e)),i={};return void 0!==this.hierarchicalFacetsRefinements[e]&&this.hierarchicalFacetsRefinements[e].length>0&&(this.hierarchicalFacetsRefinements[e][0]===t||0===this.hierarchicalFacetsRefinements[e][0].indexOf(t+r))?-1===t.indexOf(r)?i[e]=[]:i[e]=[t.slice(0,t.lastIndexOf(r))]:i[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:n({},i,this.hierarchicalFacetsRefinements)})},addHierarchicalFacetRefinement:function(e,t){if(this.isHierarchicalFacetRefined(e))throw new Error(e+" is already refined.");if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration.");var r={};return r[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:n({},r,this.hierarchicalFacetsRefinements)})},removeHierarchicalFacetRefinement:function(e){if(!this.isHierarchicalFacetRefined(e))return this;var t={};return t[e]=[],this.setQueryParameters({hierarchicalFacetsRefinements:n({},t,this.hierarchicalFacetsRefinements)})},toggleTagRefinement:function(e){return this.isTagRefined(e)?this.removeTagRefinement(e):this.addTagRefinement(e)},isDisjunctiveFacet:function(e){return this.disjunctiveFacets.indexOf(e)>-1},isHierarchicalFacet:function(e){return void 0!==this.getHierarchicalFacetByName(e)},isConjunctiveFacet:function(e){return this.facets.indexOf(e)>-1},isFacetRefined:function(e,t){return!!this.isConjunctiveFacet(e)&&l.isRefined(this.facetsRefinements,e,t)},isExcludeRefined:function(e,t){return!!this.isConjunctiveFacet(e)&&l.isRefined(this.facetsExcludes,e,t)},isDisjunctiveFacetRefined:function(e,t){return!!this.isDisjunctiveFacet(e)&&l.isRefined(this.disjunctiveFacetsRefinements,e,t)},isHierarchicalFacetRefined:function(e,t){if(!this.isHierarchicalFacet(e))return!1;var r=this.getHierarchicalRefinement(e);return t?-1!==r.indexOf(t):r.length>0},isNumericRefined:function(e,t,r){if(void 0===r&&void 0===t)return Boolean(this.numericRefinements[e]);var n=this.numericRefinements[e]&&void 0!==this.numericRefinements[e][t];if(void 0===r||!n)return n;var a,s,c=u(r),o=void 0!==(a=this.numericRefinements[e][t],s=c,i(a,(function(e){return f(e,s)})));return n&&o},isTagRefined:function(e){return-1!==this.tagRefinements.indexOf(e)},getRefinedDisjunctiveFacets:function(){var e=this,t=a(Object.keys(this.numericRefinements).filter((function(t){return Object.keys(e.numericRefinements[t]).length>0})),this.disjunctiveFacets);return Object.keys(this.disjunctiveFacetsRefinements).filter((function(t){return e.disjunctiveFacetsRefinements[t].length>0})).concat(t).concat(this.getRefinedHierarchicalFacets()).sort()},getRefinedHierarchicalFacets:function(){var e=this;return a(this.hierarchicalFacets.map((function(e){return e.name})),Object.keys(this.hierarchicalFacetsRefinements).filter((function(t){return e.hierarchicalFacetsRefinements[t].length>0}))).sort()},getUnrefinedDisjunctiveFacets:function(){var e=this.getRefinedDisjunctiveFacets();return this.disjunctiveFacets.filter((function(t){return-1===e.indexOf(t)}))},managedParameters:["index","facets","disjunctiveFacets","facetsRefinements","hierarchicalFacets","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements","hierarchicalFacetsRefinements"],getQueryParams:function(){var e=this.managedParameters,t={},r=this;return Object.keys(this).forEach((function(n){var i=r[n];-1===e.indexOf(n)&&void 0!==i&&(t[n]=i)})),t},setQueryParameter:function(e,t){if(this[e]===t)return this;var r={};return r[e]=t,this.setQueryParameters(r)},setQueryParameters:function(e){if(!e)return this;var t=m.validate(this,e);if(t)throw t;var r=this,n=m._parseNumbers(e),i=Object.keys(this).reduce((function(e,t){return e[t]=r[t],e}),{}),a=Object.keys(n).reduce((function(e,t){var r=void 0!==e[t],i=void 0!==n[t];return r&&!i?o(e,[t]):(i&&(e[t]=n[t]),e)}),i);return new this.constructor(a)},resetPage:function(){return void 0===this.page?this:this.setPage(0)},_getHierarchicalFacetSortBy:function(e){return e.sortBy||["isRefined:desc","name:asc"]},_getHierarchicalFacetSeparator:function(e){return e.separator||" > "},_getHierarchicalRootPath:function(e){return e.rootPath||null},_getHierarchicalShowParentLevel:function(e){return"boolean"!=typeof e.showParentLevel||e.showParentLevel},getHierarchicalFacetByName:function(e){return i(this.hierarchicalFacets,(function(t){return t.name===e}))},getHierarchicalFacetBreadcrumb:function(e){if(!this.isHierarchicalFacet(e))return[];var t=this.getHierarchicalRefinement(e)[0];if(!t)return[];var r=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e));return t.split(r).map((function(e){return e.trim()}))},toString:function(){return JSON.stringify(this,null,2)}},e.exports=m},6673:(e,t,r)=>{"use strict";e.exports=function(e){return function(t,r){var n=e.hierarchicalFacets[r],u=e.hierarchicalFacetsRefinements[n.name]&&e.hierarchicalFacetsRefinements[n.name][0]||"",h=e._getHierarchicalFacetSeparator(n),l=e._getHierarchicalRootPath(n),f=e._getHierarchicalShowParentLevel(n),m=a(e._getHierarchicalFacetSortBy(n)),d=t.every((function(e){return e.exhaustive})),p=function(e,t,r,n,a){return function(u,h,l){var f=u;if(l>0){var m=0;for(f=u;m{"use strict";var n=r(8965),i=r(9110),a=r(2909),s=r(849),c=r(3917),o=r(7577),u=r(4728),h=r(8601),l=a.escapeFacetValue,f=a.unescapeFacetValue,m=r(6673);function d(e){var t={};return e.forEach((function(e,r){t[e]=r})),t}function p(e,t,r){t&&t[r]&&(e.stats=t[r])}function g(e,t,r){var a=t[0]||{};this._rawResults=t;var o=this;Object.keys(a).forEach((function(e){o[e]=a[e]}));var h=u({persistHierarchicalRootCount:!1},r);Object.keys(h).forEach((function(e){o[e]=h[e]})),this.processingTimeMS=t.reduce((function(e,t){return void 0===t.processingTimeMS?e:e+t.processingTimeMS}),0),this.disjunctiveFacets=[],this.hierarchicalFacets=e.hierarchicalFacets.map((function(){return[]})),this.facets=[];var l=e.getRefinedDisjunctiveFacets(),g=d(e.facets),v=d(e.disjunctiveFacets),y=1,R=a.facets||{};Object.keys(R).forEach((function(t){var r,n,i=R[t],u=(r=e.hierarchicalFacets,n=t,s(r,(function(e){return(e.attributes||[]).indexOf(n)>-1})));if(u){var h=u.attributes.indexOf(t),l=c(e.hierarchicalFacets,(function(e){return e.name===u.name}));o.hierarchicalFacets[l][h]={attribute:t,data:i,exhaustive:a.exhaustiveFacetsCount}}else{var f,m=-1!==e.disjunctiveFacets.indexOf(t),d=-1!==e.facets.indexOf(t);m&&(f=v[t],o.disjunctiveFacets[f]={name:t,data:i,exhaustive:a.exhaustiveFacetsCount},p(o.disjunctiveFacets[f],a.facets_stats,t)),d&&(f=g[t],o.facets[f]={name:t,data:i,exhaustive:a.exhaustiveFacetsCount},p(o.facets[f],a.facets_stats,t))}})),this.hierarchicalFacets=n(this.hierarchicalFacets),l.forEach((function(r){var n=t[y],s=n&&n.facets?n.facets:{},h=e.getHierarchicalFacetByName(r);Object.keys(s).forEach((function(t){var r,l=s[t];if(h){r=c(e.hierarchicalFacets,(function(e){return e.name===h.name}));var m=c(o.hierarchicalFacets[r],(function(e){return e.attribute===t}));if(-1===m)return;o.hierarchicalFacets[r][m].data=u({},o.hierarchicalFacets[r][m].data,l)}else{r=v[t];var d=a.facets&&a.facets[t]||{};o.disjunctiveFacets[r]={name:t,data:i({},l,d),exhaustive:n.exhaustiveFacetsCount},p(o.disjunctiveFacets[r],n.facets_stats,t),e.disjunctiveFacetsRefinements[t]&&e.disjunctiveFacetsRefinements[t].forEach((function(n){!o.disjunctiveFacets[r].data[n]&&e.disjunctiveFacetsRefinements[t].indexOf(f(n))>-1&&(o.disjunctiveFacets[r].data[n]=0)}))}})),y++})),e.getRefinedHierarchicalFacets().forEach((function(r){var n=e.getHierarchicalFacetByName(r),a=e._getHierarchicalFacetSeparator(n),s=e.getHierarchicalRefinement(r);0===s.length||s[0].split(a).length<2||t.slice(y).forEach((function(t){var r=t&&t.facets?t.facets:{};Object.keys(r).forEach((function(t){var u=r[t],h=c(e.hierarchicalFacets,(function(e){return e.name===n.name})),l=c(o.hierarchicalFacets[h],(function(e){return e.attribute===t}));if(-1!==l){var f={};if(s.length>0&&!o.persistHierarchicalRootCount){var m=s[0].split(a)[0];f[m]=o.hierarchicalFacets[h][l].data[m]}o.hierarchicalFacets[h][l].data=i(f,u,o.hierarchicalFacets[h][l].data)}})),y++}))})),Object.keys(e.facetsExcludes).forEach((function(t){var r=e.facetsExcludes[t],n=g[t];o.facets[n]={name:t,data:R[t],exhaustive:a.exhaustiveFacetsCount},r.forEach((function(e){o.facets[n]=o.facets[n]||{name:t},o.facets[n].data=o.facets[n].data||{},o.facets[n].data[e]=0}))})),this.hierarchicalFacets=this.hierarchicalFacets.map(m(e)),this.facets=n(this.facets),this.disjunctiveFacets=n(this.disjunctiveFacets),this._state=e}function v(e,t){function r(e){return e.name===t}if(e._state.isConjunctiveFacet(t)){var n=s(e.facets,r);return n?Object.keys(n.data).map((function(r){var i=l(r);return{name:r,escapedValue:i,count:n.data[r],isRefined:e._state.isFacetRefined(t,i),isExcluded:e._state.isExcludeRefined(t,r)}})):[]}if(e._state.isDisjunctiveFacet(t)){var i=s(e.disjunctiveFacets,r);return i?Object.keys(i.data).map((function(r){var n=l(r);return{name:r,escapedValue:n,count:i.data[r],isRefined:e._state.isDisjunctiveFacetRefined(t,n)}})):[]}if(e._state.isHierarchicalFacet(t)){var a=s(e.hierarchicalFacets,r);if(!a)return a;var c=e._state.getHierarchicalFacetByName(t),o=e._state._getHierarchicalFacetSeparator(c),u=f(e._state.getHierarchicalRefinement(t)[0]||"");0===u.indexOf(c.rootPath)&&(u=u.replace(c.rootPath+o,""));var h=u.split(o);return h.unshift(t),y(a,h,0),a}}function y(e,t,r){e.isRefined=e.name===(t[r]&&t[r].trim()),e.data&&e.data.forEach((function(e){y(e,t,r+1)}))}function R(e,t,r,n){if(n=n||0,Array.isArray(t))return e(t,r[n]);if(!t.data||0===t.data.length)return t;var a=t.data.map((function(t){return R(e,t,r,n+1)})),s=e(a,r[n]);return i({data:s},t)}function F(e,t){var r=s(e,(function(e){return e.name===t}));return r&&r.stats}function b(e,t,r,n,i){var a=s(i,(function(e){return e.name===r})),c=a&&a.data&&a.data[n]?a.data[n]:0,o=a&&a.exhaustive||!1;return{type:t,attributeName:r,name:n,count:c,exhaustive:o}}g.prototype.getFacetByName=function(e){function t(t){return t.name===e}return s(this.facets,t)||s(this.disjunctiveFacets,t)||s(this.hierarchicalFacets,t)},g.DEFAULT_SORT=["isRefined:desc","count:desc","name:asc"],g.prototype.getFacetValues=function(e,t){var r=v(this,e);if(r){var n,a=i({},t,{sortBy:g.DEFAULT_SORT,facetOrdering:!(t&&t.sortBy)}),s=this;if(Array.isArray(r))n=[e];else n=s._state.getHierarchicalFacetByName(r.name).attributes;return R((function(e,t){if(a.facetOrdering){var r=function(e,t){return e.renderingContent&&e.renderingContent.facetOrdering&&e.renderingContent.facetOrdering.values&&e.renderingContent.facetOrdering.values[t]}(s,t);if(r)return function(e,t){var r=[],n=[],i=t.hide||[],a=(t.order||[]).reduce((function(e,t,r){return e[t]=r,e}),{});e.forEach((function(e){var t=e.path||e.name,s=i.indexOf(t)>-1;s||void 0===a[t]?s||n.push(e):r[a[t]]=e})),r=r.filter((function(e){return e}));var s,c=t.sortRemainingBy;return"hidden"===c?r:(s="alpha"===c?[["path","name"],["asc","asc"]]:[["count"],["desc"]],r.concat(h(n,s[0],s[1])))}(e,r)}if(Array.isArray(a.sortBy)){var n=o(a.sortBy,g.DEFAULT_SORT);return h(e,n[0],n[1])}if("function"==typeof a.sortBy)return function(e,t){return t.sort(e)}(a.sortBy,e);throw new Error("options.sortBy is optional but if defined it must be either an array of string (predicates) or a sorting function")}),r,n)}},g.prototype.getFacetStats=function(e){return this._state.isConjunctiveFacet(e)?F(this.facets,e):this._state.isDisjunctiveFacet(e)?F(this.disjunctiveFacets,e):void 0},g.prototype.getRefinements=function(){var e=this._state,t=this,r=[];return Object.keys(e.facetsRefinements).forEach((function(n){e.facetsRefinements[n].forEach((function(i){r.push(b(e,"facet",n,i,t.facets))}))})),Object.keys(e.facetsExcludes).forEach((function(n){e.facetsExcludes[n].forEach((function(i){r.push(b(e,"exclude",n,i,t.facets))}))})),Object.keys(e.disjunctiveFacetsRefinements).forEach((function(n){e.disjunctiveFacetsRefinements[n].forEach((function(i){r.push(b(e,"disjunctive",n,i,t.disjunctiveFacets))}))})),Object.keys(e.hierarchicalFacetsRefinements).forEach((function(n){e.hierarchicalFacetsRefinements[n].forEach((function(i){r.push(function(e,t,r,n){var i=e.getHierarchicalFacetByName(t),a=e._getHierarchicalFacetSeparator(i),c=r.split(a),o=s(n,(function(e){return e.name===t})),u=c.reduce((function(e,t){var r=e&&s(e.data,(function(e){return e.name===t}));return void 0!==r?r:e}),o),h=u&&u.count||0,l=u&&u.exhaustive||!1,f=u&&u.path||"";return{type:"hierarchical",attributeName:t,name:f,count:h,exhaustive:l}}(e,n,i,t.hierarchicalFacets))}))})),Object.keys(e.numericRefinements).forEach((function(t){var n=e.numericRefinements[t];Object.keys(n).forEach((function(e){n[e].forEach((function(n){r.push({type:"numeric",attributeName:t,name:n,numericValue:n,operator:e})}))}))})),e.tagRefinements.forEach((function(e){r.push({type:"tag",attributeName:"_tags",name:e})})),r},e.exports=g},6571:(e,t,r)=>{"use strict";var n=r(2733),i=r(6732),a=r(2909).escapeFacetValue,s=r(3014),c=r(4728),o=r(317),u=r(1383),h=r(9127),l=r(2223),f=r(9228),m=r(3371),d=r(7691),p=r(7749),g=r(6938);function v(e,t,r,n){"function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+g+")"),this.setClient(e);var i=r||{};i.index=t,this.state=m.make(i),this.recommendState=new h({params:i.recommendState}),this.lastResults=null,this.lastRecommendResults=null,this._queryId=0,this._recommendQueryId=0,this._lastQueryIdReceived=-1,this._lastRecommendQueryIdReceived=-1,this.derivedHelpers=[],this._currentNbQueries=0,this._currentNbRecommendQueries=0,this._searchResultsOptions=n,this._recommendCache={}}function y(e){if(e<0)throw new Error("Page requested below 0.");return this._change({state:this.state.setPage(e),isPageReset:!1}),this}function R(){return this.state.page}s(v,n),v.prototype.search=function(){return this._search({onlyWithDerivedHelpers:!1}),this},v.prototype.searchOnlyWithDerivedHelpers=function(){return this._search({onlyWithDerivedHelpers:!0}),this},v.prototype.recommend=function(){return this._recommend(),this},v.prototype.getQuery=function(){var e=this.state;return f._getHitsSearchParams(e)},v.prototype.searchOnce=function(e,t){var r=e?this.state.setQueryParameters(e):this.state,n=f._getQueries(r.index,r),i=this;if(this._currentNbQueries++,this.emit("searchOnce",{state:r}),!t)return this.client.search(n).then((function(e){return i._currentNbQueries--,0===i._currentNbQueries&&i.emit("searchQueueEmpty"),{content:new d(r,e.results),state:r,_originalResponse:e}}),(function(e){throw i._currentNbQueries--,0===i._currentNbQueries&&i.emit("searchQueueEmpty"),e}));this.client.search(n).then((function(e){i._currentNbQueries--,0===i._currentNbQueries&&i.emit("searchQueueEmpty"),t(null,new d(r,e.results),r)})).catch((function(e){i._currentNbQueries--,0===i._currentNbQueries&&i.emit("searchQueueEmpty"),t(e,null,r)}))},v.prototype.findAnswers=function(e){console.warn("[algoliasearch-helper] answers is no longer supported");var t=this.state,r=this.derivedHelpers[0];if(!r)return Promise.resolve([]);var n=r.getModifiedState(t),i=c({attributesForPrediction:e.attributesForPrediction,nbHits:e.nbHits},{params:u(f._getHitsSearchParams(n),["attributesToSnippet","hitsPerPage","restrictSearchableAttributes","snippetEllipsisText"])}),a="search for answers was called, but this client does not have a function client.initIndex(index).findAnswers";if("function"!=typeof this.client.initIndex)throw new Error(a);var s=this.client.initIndex(n.index);if("function"!=typeof s.findAnswers)throw new Error(a);return s.findAnswers(n.query,e.queryLanguages,i)},v.prototype.searchForFacetValues=function(e,t,r,n){var i="function"==typeof this.client.searchForFacetValues&&"function"!=typeof this.client.searchForFacets,s="function"==typeof this.client.initIndex;if(!i&&!s&&"function"!=typeof this.client.search)throw new Error("search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues or client.initIndex(index).searchForFacetValues");var c=this.state.setQueryParameters(n||{}),o=c.isDisjunctiveFacet(e),u=f.getSearchForFacetQuery(e,t,r,c);this._currentNbQueries++;var h,l=this;return i?h=this.client.searchForFacetValues([{indexName:c.index,params:u}]):s?h=this.client.initIndex(c.index).searchForFacetValues(u):(delete u.facetName,h=this.client.search([{type:"facet",facet:e,indexName:c.index,params:u}]).then((function(e){return e.results[0]}))),this.emit("searchForFacetValues",{state:c,facet:e,query:t}),h.then((function(t){return l._currentNbQueries--,0===l._currentNbQueries&&l.emit("searchQueueEmpty"),(t=Array.isArray(t)?t[0]:t).facetHits.forEach((function(t){t.escapedValue=a(t.value),t.isRefined=o?c.isDisjunctiveFacetRefined(e,t.escapedValue):c.isFacetRefined(e,t.escapedValue)})),t}),(function(e){throw l._currentNbQueries--,0===l._currentNbQueries&&l.emit("searchQueueEmpty"),e}))},v.prototype.setQuery=function(e){return this._change({state:this.state.resetPage().setQuery(e),isPageReset:!0}),this},v.prototype.clearRefinements=function(e){return this._change({state:this.state.resetPage().clearRefinements(e),isPageReset:!0}),this},v.prototype.clearTags=function(){return this._change({state:this.state.resetPage().clearTags(),isPageReset:!0}),this},v.prototype.addDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},v.prototype.addDisjunctiveRefine=function(){return this.addDisjunctiveFacetRefinement.apply(this,arguments)},v.prototype.addHierarchicalFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addHierarchicalFacetRefinement(e,t),isPageReset:!0}),this},v.prototype.addNumericRefinement=function(e,t,r){return this._change({state:this.state.resetPage().addNumericRefinement(e,t,r),isPageReset:!0}),this},v.prototype.addFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addFacetRefinement(e,t),isPageReset:!0}),this},v.prototype.addRefine=function(){return this.addFacetRefinement.apply(this,arguments)},v.prototype.addFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().addExcludeRefinement(e,t),isPageReset:!0}),this},v.prototype.addExclude=function(){return this.addFacetExclusion.apply(this,arguments)},v.prototype.addTag=function(e){return this._change({state:this.state.resetPage().addTagRefinement(e),isPageReset:!0}),this},v.prototype.addFrequentlyBoughtTogether=function(e){return this._recommendChange({state:this.recommendState.addFrequentlyBoughtTogether(e)}),this},v.prototype.addRelatedProducts=function(e){return this._recommendChange({state:this.recommendState.addRelatedProducts(e)}),this},v.prototype.addTrendingItems=function(e){return this._recommendChange({state:this.recommendState.addTrendingItems(e)}),this},v.prototype.addTrendingFacets=function(e){return this._recommendChange({state:this.recommendState.addTrendingFacets(e)}),this},v.prototype.addLookingSimilar=function(e){return this._recommendChange({state:this.recommendState.addLookingSimilar(e)}),this},v.prototype.removeNumericRefinement=function(e,t,r){return this._change({state:this.state.resetPage().removeNumericRefinement(e,t,r),isPageReset:!0}),this},v.prototype.removeDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},v.prototype.removeDisjunctiveRefine=function(){return this.removeDisjunctiveFacetRefinement.apply(this,arguments)},v.prototype.removeHierarchicalFacetRefinement=function(e){return this._change({state:this.state.resetPage().removeHierarchicalFacetRefinement(e),isPageReset:!0}),this},v.prototype.removeFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeFacetRefinement(e,t),isPageReset:!0}),this},v.prototype.removeRefine=function(){return this.removeFacetRefinement.apply(this,arguments)},v.prototype.removeFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().removeExcludeRefinement(e,t),isPageReset:!0}),this},v.prototype.removeExclude=function(){return this.removeFacetExclusion.apply(this,arguments)},v.prototype.removeTag=function(e){return this._change({state:this.state.resetPage().removeTagRefinement(e),isPageReset:!0}),this},v.prototype.removeFrequentlyBoughtTogether=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},v.prototype.removeRelatedProducts=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},v.prototype.removeTrendingItems=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},v.prototype.removeTrendingFacets=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},v.prototype.removeLookingSimilar=function(e){return this._recommendChange({state:this.recommendState.removeParams(e)}),this},v.prototype.toggleFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().toggleExcludeFacetRefinement(e,t),isPageReset:!0}),this},v.prototype.toggleExclude=function(){return this.toggleFacetExclusion.apply(this,arguments)},v.prototype.toggleRefinement=function(e,t){return this.toggleFacetRefinement(e,t)},v.prototype.toggleFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().toggleFacetRefinement(e,t),isPageReset:!0}),this},v.prototype.toggleRefine=function(){return this.toggleFacetRefinement.apply(this,arguments)},v.prototype.toggleTag=function(e){return this._change({state:this.state.resetPage().toggleTagRefinement(e),isPageReset:!0}),this},v.prototype.nextPage=function(){var e=this.state.page||0;return this.setPage(e+1)},v.prototype.previousPage=function(){var e=this.state.page||0;return this.setPage(e-1)},v.prototype.setCurrentPage=y,v.prototype.setPage=y,v.prototype.setIndex=function(e){return this._change({state:this.state.resetPage().setIndex(e),isPageReset:!0}),this},v.prototype.setQueryParameter=function(e,t){return this._change({state:this.state.resetPage().setQueryParameter(e,t),isPageReset:!0}),this},v.prototype.setState=function(e){return this._change({state:m.make(e),isPageReset:!1}),this},v.prototype.overrideStateWithoutTriggeringChangeEvent=function(e){return this.state=new m(e),this},v.prototype.hasRefinements=function(e){return!!o(this.state.getNumericRefinements(e))||(this.state.isConjunctiveFacet(e)?this.state.isFacetRefined(e):this.state.isDisjunctiveFacet(e)?this.state.isDisjunctiveFacetRefined(e):!!this.state.isHierarchicalFacet(e)&&this.state.isHierarchicalFacetRefined(e))},v.prototype.isExcluded=function(e,t){return this.state.isExcludeRefined(e,t)},v.prototype.isDisjunctiveRefined=function(e,t){return this.state.isDisjunctiveFacetRefined(e,t)},v.prototype.hasTag=function(e){return this.state.isTagRefined(e)},v.prototype.isTagRefined=function(){return this.hasTagRefinements.apply(this,arguments)},v.prototype.getIndex=function(){return this.state.index},v.prototype.getCurrentPage=R,v.prototype.getPage=R,v.prototype.getTags=function(){return this.state.tagRefinements},v.prototype.getRefinements=function(e){var t=[];if(this.state.isConjunctiveFacet(e))this.state.getConjunctiveRefinements(e).forEach((function(e){t.push({value:e,type:"conjunctive"})})),this.state.getExcludeRefinements(e).forEach((function(e){t.push({value:e,type:"exclude"})}));else if(this.state.isDisjunctiveFacet(e)){this.state.getDisjunctiveRefinements(e).forEach((function(e){t.push({value:e,type:"disjunctive"})}))}var r=this.state.getNumericRefinements(e);return Object.keys(r).forEach((function(e){var n=r[e];t.push({value:n,operator:e,type:"numeric"})})),t},v.prototype.getNumericRefinement=function(e,t){return this.state.getNumericRefinement(e,t)},v.prototype.getHierarchicalFacetBreadcrumb=function(e){return this.state.getHierarchicalFacetBreadcrumb(e)},v.prototype._search=function(e){var t=this.state,r=[],n=[];e.onlyWithDerivedHelpers||(n=f._getQueries(t.index,t),r.push({state:t,queriesCount:n.length,helper:this}),this.emit("search",{state:t,results:this.lastResults}));var i=this.derivedHelpers.map((function(e){var n=e.getModifiedState(t),i=n.index?f._getQueries(n.index,n):[];return r.push({state:n,queriesCount:i.length,helper:e}),e.emit("search",{state:n,results:e.lastResults}),i})),a=Array.prototype.concat.apply(n,i),s=this._queryId++;if(this._currentNbQueries++,!a.length)return Promise.resolve({results:[]}).then(this._dispatchAlgoliaResponse.bind(this,r,s));try{this.client.search(a).then(this._dispatchAlgoliaResponse.bind(this,r,s)).catch(this._dispatchAlgoliaError.bind(this,s))}catch(c){this.emit("error",{error:c})}},v.prototype._recommend=function(){var e=this.state,t=this.recommendState,r=this.getIndex(),n=[{state:t,index:r,helper:this}],i=t.params.map((function(e){return e.$$id}));this.emit("fetch",{recommend:{state:t,results:this.lastRecommendResults}});var a=this._recommendCache,s=this.derivedHelpers.map((function(t){var r=t.getModifiedState(e).index;if(!r)return[];var s=t.getModifiedRecommendState(new h);return n.push({state:s,index:r,helper:t}),i=Array.prototype.concat.apply(i,s.params.map((function(e){return e.$$id}))),t.emit("fetch",{recommend:{state:s,results:t.lastRecommendResults}}),s._buildQueries(r,a)})),c=Array.prototype.concat.apply(this.recommendState._buildQueries(r,a),s);if(0!==c.length)if(c.length>0&&void 0===this.client.getRecommendations)console.warn("Please update algoliasearch/lite to the latest version in order to use recommend widgets.");else{var o=this._recommendQueryId++;this._currentNbRecommendQueries++;try{this.client.getRecommendations(c).then(this._dispatchRecommendResponse.bind(this,o,n,i)).catch(this._dispatchRecommendError.bind(this,o))}catch(u){this.emit("error",{error:u})}}},v.prototype._dispatchAlgoliaResponse=function(e,t,r){var n=this;if(!(t0},v.prototype._change=function(e){var t=e.state,r=e.isPageReset;t!==this.state&&(this.state=t,this.emit("change",{state:this.state,results:this.lastResults,isPageReset:r}))},v.prototype._recommendChange=function(e){var t=e.state;t!==this.recommendState&&(this.recommendState=t,this.emit("recommend:change",{search:{results:this.lastResults,state:this.state},recommend:{results:this.lastRecommendResults,state:this.recommendState}}))},v.prototype.clearCache=function(){return this.client.clearCache&&this.client.clearCache(),this},v.prototype.setClient=function(e){return this.client===e||("function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+g+")"),this.client=e),this},v.prototype.getClient=function(){return this.client},v.prototype.derive=function(e,t){var r=new i(this,e,t);return this.derivedHelpers.push(r),r},v.prototype.detachDerivedHelper=function(e){var t=this.derivedHelpers.indexOf(e);if(-1===t)throw new Error("Derived helper already detached");this.derivedHelpers.splice(t,1)},v.prototype.hasPendingRequests=function(){return this._currentNbQueries>0},e.exports=v},8965:e=>{"use strict";e.exports=function(e){return Array.isArray(e)?e.filter(Boolean):[]}},9110:e=>{"use strict";e.exports=function(){return Array.prototype.slice.call(arguments).reduceRight((function(e,t){return Object.keys(Object(t)).forEach((function(r){void 0!==t[r]&&(void 0!==e[r]&&delete e[r],e[r]=t[r])})),e}),{})}},2909:e=>{"use strict";e.exports={escapeFacetValue:function(e){return"string"!=typeof e?e:String(e).replace(/^-/,"\\-")},unescapeFacetValue:function(e){return"string"!=typeof e?e:e.replace(/^\\-/,"-")}}},849:e=>{"use strict";e.exports=function(e,t){if(Array.isArray(e))for(var r=0;r{"use strict";e.exports=function(e,t){if(!Array.isArray(e))return-1;for(var r=0;r{e.exports=function(e){return e.reduce((function(e,t){return e.concat(t)}),[])}},7577:(e,t,r)=>{"use strict";var n=r(849);e.exports=function(e,t){var r=(t||[]).map((function(e){return e.split(":")}));return e.reduce((function(e,t){var i=t.split(":"),a=n(r,(function(e){return e[0]===i[0]}));return i.length>1||!a?(e[0].push(i[0]),e[1].push(i[1]),e):(e[0].push(a[0]),e[1].push(a[1]),e)}),[[],[]])}},3014:e=>{"use strict";e.exports=function(e,t){e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}},4843:e=>{"use strict";e.exports=function(e,t){return e.filter((function(r,n){return t.indexOf(r)>-1&&e.indexOf(r)===n}))}},4728:e=>{"use strict";function t(e){return"function"==typeof e||Array.isArray(e)||"[object Object]"===Object.prototype.toString.call(e)}function r(e,n){if(e===n)return e;for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&"__proto__"!==i&&"constructor"!==i){var a=n[i],s=e[i];void 0!==s&&void 0===a||(t(s)&&t(a)?e[i]=r(s,a):e[i]="object"==typeof(c=a)&&null!==c?r(Array.isArray(c)?[]:{},c):c)}var c;return e}e.exports=function(e){t(e)||(e={});for(var n=1,i=arguments.length;n{"use strict";e.exports=function(e){return e&&Object.keys(e).length>0}},1383:e=>{"use strict";e.exports=function(e,t){if(null===e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n=0||(i[r]=e[r]);return i}},8601:e=>{"use strict";function t(e,t){if(e!==t){var r=void 0!==e,n=null===e,i=void 0!==t,a=null===t;if(!a&&e>t||n&&i||!r)return 1;if(!n&&e=n.length?a:"desc"===n[i]?-a:a}return e.index-r.index})),i.map((function(e){return e.value}))}},7507:e=>{"use strict";e.exports=function e(t){if("number"==typeof t)return t;if("string"==typeof t)return parseFloat(t);if(Array.isArray(t))return t.map(e);throw new Error("The value should be a number, a parsable string or an array of those.")}},9228:(e,t,r)=>{"use strict";var n=r(4728);function i(e){return Object.keys(e).sort().reduce((function(t,r){return t[r]=e[r],t}),{})}var a={_getQueries:function(e,t){var r=[];return r.push({indexName:e,params:a._getHitsSearchParams(t)}),t.getRefinedDisjunctiveFacets().forEach((function(n){r.push({indexName:e,params:a._getDisjunctiveFacetSearchParams(t,n)})})),t.getRefinedHierarchicalFacets().forEach((function(n){var i=t.getHierarchicalFacetByName(n),s=t.getHierarchicalRefinement(n),c=t._getHierarchicalFacetSeparator(i);if(s.length>0&&s[0].split(c).length>1){var o=s[0].split(c).slice(0,-1).reduce((function(e,t,r){return e.concat({attribute:i.attributes[r],value:0===r?t:[e[e.length-1].value,t].join(c)})}),[]);o.forEach((function(n,s){var c=a._getDisjunctiveFacetSearchParams(t,n.attribute,0===s);function u(e){return i.attributes.some((function(t){return t===e.split(":")[0]}))}var h=(c.facetFilters||[]).reduce((function(e,t){if(Array.isArray(t)){var r=t.filter((function(e){return!u(e)}));r.length>0&&e.push(r)}return"string"!=typeof t||u(t)||e.push(t),e}),[]),l=o[s-1];s>0?c.facetFilters=h.concat(l.attribute+":"+l.value):h.length>0?c.facetFilters=h:delete c.facetFilters,r.push({indexName:e,params:c})}))}})),r},_getHitsSearchParams:function(e){var t=e.facets.concat(e.disjunctiveFacets).concat(a._getHitsHierarchicalFacetsAttributes(e)).sort(),r=a._getFacetFilters(e),s=a._getNumericFilters(e),c=a._getTagFilters(e),o={};return t.length>0&&(o.facets=t.indexOf("*")>-1?["*"]:t),c.length>0&&(o.tagFilters=c),r.length>0&&(o.facetFilters=r),s.length>0&&(o.numericFilters=s),i(n({},e.getQueryParams(),o))},_getDisjunctiveFacetSearchParams:function(e,t,r){var s=a._getFacetFilters(e,t,r),c=a._getNumericFilters(e,t),o=a._getTagFilters(e),u={hitsPerPage:0,page:0,analytics:!1,clickAnalytics:!1};o.length>0&&(u.tagFilters=o);var h=e.getHierarchicalFacetByName(t);return u.facets=h?a._getDisjunctiveHierarchicalFacetAttribute(e,h,r):t,c.length>0&&(u.numericFilters=c),s.length>0&&(u.facetFilters=s),i(n({},e.getQueryParams(),u))},_getNumericFilters:function(e,t){if(e.numericFilters)return e.numericFilters;var r=[];return Object.keys(e.numericRefinements).forEach((function(n){var i=e.numericRefinements[n]||{};Object.keys(i).forEach((function(e){var a=i[e]||[];t!==n&&a.forEach((function(t){if(Array.isArray(t)){var i=t.map((function(t){return n+e+t}));r.push(i)}else r.push(n+e+t)}))}))})),r},_getTagFilters:function(e){return e.tagFilters?e.tagFilters:e.tagRefinements.join(",")},_getFacetFilters:function(e,t,r){var n=[],i=e.facetsRefinements||{};Object.keys(i).sort().forEach((function(e){(i[e]||[]).slice().sort().forEach((function(t){n.push(e+":"+t)}))}));var a=e.facetsExcludes||{};Object.keys(a).sort().forEach((function(e){(a[e]||[]).sort().forEach((function(t){n.push(e+":-"+t)}))}));var s=e.disjunctiveFacetsRefinements||{};Object.keys(s).sort().forEach((function(e){var r=s[e]||[];if(e!==t&&r&&0!==r.length){var i=[];r.slice().sort().forEach((function(t){i.push(e+":"+t)})),n.push(i)}}));var c=e.hierarchicalFacetsRefinements||{};return Object.keys(c).sort().forEach((function(i){var a=(c[i]||[])[0];if(void 0!==a){var s,o,u=e.getHierarchicalFacetByName(i),h=e._getHierarchicalFacetSeparator(u),l=e._getHierarchicalRootPath(u);if(t===i){if(-1===a.indexOf(h)||!l&&!0===r||l&&l.split(h).length===a.split(h).length)return;l?(o=l.split(h).length-1,a=l):(o=a.split(h).length-2,a=a.slice(0,a.lastIndexOf(h))),s=u.attributes[o]}else o=a.split(h).length-1,s=u.attributes[o];s&&n.push([s+":"+a])}})),n},_getHitsHierarchicalFacetsAttributes:function(e){return e.hierarchicalFacets.reduce((function(t,r){var n=e.getHierarchicalRefinement(r.name)[0];if(!n)return t.push(r.attributes[0]),t;var i=e._getHierarchicalFacetSeparator(r),a=n.split(i).length,s=r.attributes.slice(0,a+1);return t.concat(s)}),[])},_getDisjunctiveHierarchicalFacetAttribute:function(e,t,r){var n=e._getHierarchicalFacetSeparator(t);if(!0===r){var i=e._getHierarchicalRootPath(t),a=0;return i&&(a=i.split(n).length),[t.attributes[a]]}var s=(e.getHierarchicalRefinement(t.name)[0]||"").split(n).length-1;return t.attributes.slice(0,s+1)},getSearchForFacetQuery:function(e,t,r,s){var c=s.isDisjunctiveFacet(e)?s.clearRefinements(e):s,o={facetQuery:t,facetName:e};return"number"==typeof r&&(o.maxFacetHits=r),i(n({},a._getHitsSearchParams(c),o))}};e.exports=a},2208:e=>{"use strict";e.exports=function(e){return null!==e&&/^[a-zA-Z0-9_-]{1,64}$/.test(e)}},7749:(e,t,r)=>{"use strict";var n=r(849),i=r(8657);e.exports=function(e){var t={};return e.forEach((function(e){e.forEach((function(e,r){t[e.objectID]?t[e.objectID]={indexSum:t[e.objectID].indexSum+r,count:t[e.objectID].count+1}:t[e.objectID]={indexSum:r,count:1}}))})),function(e,t){var r=[];return Object.keys(e).forEach((function(n){e[n].count<2&&(e[n].indexSum+=100),r.push({objectID:n,avgOfIndices:e[n].indexSum/t})})),r.sort((function(e,t){return e.avgOfIndices>t.avgOfIndices?1:-1}))}(t,e.length).reduce((function(t,r){var a=n(i(e),(function(e){return e.objectID===r.objectID}));return a?t.concat(a):t}),[])}},6938:e=>{"use strict";e.exports="3.22.5"},3643:function(e){e.exports=function(){"use strict";function e(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function r(r){for(var n=1;n=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var r=[],n=!0,i=!1,a=void 0;try{for(var s,c=e[Symbol.iterator]();!(n=(s=c.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{n||null==c.return||c.return()}finally{if(i)throw a}}return r}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function a(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then((function(){c();var t=JSON.stringify(e);return a()[t]})).then((function(e){return Promise.all([e?e.value:t(),void 0!==e])})).then((function(e){var t=i(e,2),n=t[0],a=t[1];return Promise.all([n,a||r.miss(n)])})).then((function(e){return i(e,1)[0]}))},set:function(e,t){return Promise.resolve().then((function(){var i=a();return i[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},n().setItem(r,JSON.stringify(i)),t}))},delete:function(e){return Promise.resolve().then((function(){var t=a();delete t[JSON.stringify(e)],n().setItem(r,JSON.stringify(t))}))},clear:function(){return Promise.resolve().then((function(){n().removeItem(r)}))}}}function c(e){var t=a(e.caches),r=t.shift();return void 0===r?{get:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return t().then((function(e){return Promise.all([e,r.miss(e)])})).then((function(e){return i(e,1)[0]}))},set:function(e,t){return Promise.resolve(t)},delete:function(e){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}};return r.get(e,n,i).catch((function(){return c({caches:t}).get(e,n,i)}))},set:function(e,n){return r.set(e,n).catch((function(){return c({caches:t}).set(e,n)}))},delete:function(e){return r.delete(e).catch((function(){return c({caches:t}).delete(e)}))},clear:function(){return r.clear().catch((function(){return c({caches:t}).clear()}))}}}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{serializable:!0},t={};return{get:function(r,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{miss:function(){return Promise.resolve()}},a=JSON.stringify(r);if(a in t)return Promise.resolve(e.serializable?JSON.parse(t[a]):t[a]);var s=n(),c=i&&i.miss||function(){return Promise.resolve()};return s.then((function(e){return c(e)})).then((function(){return s}))},set:function(r,n){return t[JSON.stringify(r)]=e.serializable?JSON.stringify(n):n,Promise.resolve(n)},delete:function(e){return delete t[JSON.stringify(e)],Promise.resolve()},clear:function(){return t={},Promise.resolve()}}}function u(e){for(var t=e.length-1;t>0;t--){var r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}function h(e,t){return t?(Object.keys(t).forEach((function(r){e[r]=t[r](e)})),e):e}function l(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n0?n:void 0,timeout:r.timeout||t,headers:r.headers||{},queryParameters:r.queryParameters||{},cacheable:r.cacheable}}var d={Read:1,Write:2,Any:3},p=1,g=2,v=3;function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;return r(r({},e),{},{status:t,lastUpdate:Date.now()})}function R(e){return"string"==typeof e?{protocol:"https",url:e,accept:d.Any}:{protocol:e.protocol||"https",url:e.url,accept:e.accept||d.Any}}var F="GET",b="POST";function _(e,t){return Promise.all(t.map((function(t){return e.get(t,(function(){return Promise.resolve(y(t))}))}))).then((function(e){var r=e.filter((function(e){return function(e){return e.status===p||Date.now()-e.lastUpdate>12e4}(e)})),n=e.filter((function(e){return function(e){return e.status===v&&Date.now()-e.lastUpdate<=12e4}(e)})),i=[].concat(a(r),a(n));return{getTimeout:function(e,t){return(0===n.length&&0===e?1:n.length+3+e)*t},statelessHosts:i.length>0?i.map((function(e){return R(e)})):t}}))}function P(e,t,n,i){var s=[],c=function(e,t){if(e.method!==F&&(void 0!==e.data||void 0!==t.data)){var n=Array.isArray(e.data)?e.data:r(r({},e.data),t.data);return JSON.stringify(n)}}(n,i),o=function(e,t){var n=r(r({},e.headers),t.headers),i={};return Object.keys(n).forEach((function(e){var t=n[e];i[e.toLowerCase()]=t})),i}(e,i),u=n.method,h=n.method!==F?{}:r(r({},n.data),i.data),l=r(r(r({"x-algolia-agent":e.userAgent.value},e.queryParameters),h),i.queryParameters),f=0,m=function t(r,a){var h=r.pop();if(void 0===h)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support .",transporterStackTrace:O(s)};var m={data:c,headers:o,method:u,url:x(h,n.path,l),connectTimeout:a(f,e.timeouts.connect),responseTimeout:a(f,i.timeout)},d=function(e){var t={request:m,response:e,host:h,triesLeft:r.length};return s.push(t),t},p={onSuccess:function(e){return function(e){try{return JSON.parse(e.content)}catch(t){throw function(e,t){return{name:"DeserializationError",message:e,response:t}}(t.message,e)}}(e)},onRetry:function(n){var i=d(n);return n.isTimedOut&&f++,Promise.all([e.logger.info("Retryable failure",w(i)),e.hostsCache.set(h,y(h,n.isTimedOut?v:g))]).then((function(){return t(r,a)}))},onFail:function(e){throw d(e),function(e,t){var r=e.content,n=e.status,i=r;try{i=JSON.parse(r).message}catch(e){}return function(e,t,r){return{name:"ApiError",message:e,status:t,transporterStackTrace:r}}(i,n,t)}(e,O(s))}};return e.requester.send(m).then((function(e){return function(e,t){return function(e){var t=e.status;return e.isTimedOut||function(e){var t=e.isTimedOut,r=e.status;return!t&&!~~r}(e)||2!=~~(t/100)&&4!=~~(t/100)}(e)?t.onRetry(e):2==~~(e.status/100)?t.onSuccess(e):t.onFail(e)}(e,p)}))};return _(e.hostsCache,t).then((function(e){return m(a(e.statelessHosts).reverse(),e.getTimeout)}))}function j(e){var t={value:"Algolia for JavaScript (".concat(e,")"),add:function(e){var r="; ".concat(e.segment).concat(void 0!==e.version?" (".concat(e.version,")"):"");return-1===t.value.indexOf(r)&&(t.value="".concat(t.value).concat(r)),t}};return t}function x(e,t,r){var n=E(r),i="".concat(e.protocol,"://").concat(e.url,"/").concat("/"===t.charAt(0)?t.substr(1):t);return n.length&&(i+="?".concat(n)),i}function E(e){return Object.keys(e).map((function(t){return l("%s=%s",t,(r=e[t],"[object Object]"===Object.prototype.toString.call(r)||"[object Array]"===Object.prototype.toString.call(r)?JSON.stringify(e[t]):e[t]));var r})).join("&")}function O(e){return e.map((function(e){return w(e)}))}function w(e){var t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return r(r({},e),{},{request:r(r({},e.request),{},{headers:r(r({},e.request.headers),t)})})}var S=function(e){var t=e.appId,n=function(e,t,r){var n={"x-algolia-api-key":r,"x-algolia-application-id":t};return{headers:function(){return e===f.WithinHeaders?n:{}},queryParameters:function(){return e===f.WithinQueryParameters?n:{}}}}(void 0!==e.authMode?e.authMode:f.WithinHeaders,t,e.apiKey),a=function(e){var t=e.hostsCache,r=e.logger,n=e.requester,a=e.requestsCache,s=e.responsesCache,c=e.timeouts,o=e.userAgent,u=e.hosts,h=e.queryParameters,l={hostsCache:t,logger:r,requester:n,requestsCache:a,responsesCache:s,timeouts:c,userAgent:o,headers:e.headers,queryParameters:h,hosts:u.map((function(e){return R(e)})),read:function(e,t){var r=m(t,l.timeouts.read),n=function(){return P(l,l.hosts.filter((function(e){return!!(e.accept&d.Read)})),e,r)};if(!0!==(void 0!==r.cacheable?r.cacheable:e.cacheable))return n();var a={request:e,mappedRequestOptions:r,transporter:{queryParameters:l.queryParameters,headers:l.headers}};return l.responsesCache.get(a,(function(){return l.requestsCache.get(a,(function(){return l.requestsCache.set(a,n()).then((function(e){return Promise.all([l.requestsCache.delete(a),e])}),(function(e){return Promise.all([l.requestsCache.delete(a),Promise.reject(e)])})).then((function(e){var t=i(e,2);return t[0],t[1]}))}))}),{miss:function(e){return l.responsesCache.set(a,e)}})},write:function(e,t){return P(l,l.hosts.filter((function(e){return!!(e.accept&d.Write)})),e,m(t,l.timeouts.write))}};return l}(r(r({hosts:[{url:"".concat(t,"-dsn.algolia.net"),accept:d.Read},{url:"".concat(t,".algolia.net"),accept:d.Write}].concat(u([{url:"".concat(t,"-1.algolianet.com")},{url:"".concat(t,"-2.algolianet.com")},{url:"".concat(t,"-3.algolianet.com")}]))},e),{},{headers:r(r(r({},n.headers()),{"content-type":"application/x-www-form-urlencoded"}),e.headers),queryParameters:r(r({},n.queryParameters()),e.queryParameters)}));return h({transporter:a,appId:t,addAlgoliaAgent:function(e,t){a.userAgent.add({segment:e,version:t})},clearCache:function(){return Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then((function(){}))}},e.methods)},A=function(e){return function(t,r){return t.method===F?e.transporter.read(t,r):e.transporter.write(t,r)}},N=function(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return h({transporter:e.transporter,appId:e.appId,indexName:t},r.methods)}},Q=function(e){return function(t,n){var i=t.map((function(e){return r(r({},e),{},{params:E(e.params||{})})}));return e.transporter.read({method:b,path:"1/indexes/*/queries",data:{requests:i},cacheable:!0},n)}},H=function(e){return function(t,i){return Promise.all(t.map((function(t){var a=t.params,s=a.facetName,c=a.facetQuery,o=n(a,["facetName","facetQuery"]);return N(e)(t.indexName,{methods:{searchForFacetValues:I}}).searchForFacetValues(s,c,r(r({},i),o))})))}},T=function(e){return function(t,r,n){return e.transporter.read({method:b,path:l("1/answers/%s/prediction",e.indexName),data:{query:t,queryLanguages:r},cacheable:!0},n)}},C=function(e){return function(t,r){return e.transporter.read({method:b,path:l("1/indexes/%s/query",e.indexName),data:{query:t},cacheable:!0},r)}},I=function(e){return function(t,r,n){return e.transporter.read({method:b,path:l("1/indexes/%s/facets/%s/query",e.indexName,t),data:{facetQuery:r},cacheable:!0},n)}},k=1,D=2,q=3,L=function(e){return function(t,n){var i=t.map((function(e){return r(r({},e),{},{threshold:e.threshold||0})}));return e.transporter.read({method:b,path:"1/indexes/*/recommendations",data:{requests:i},cacheable:!0},n)}};function V(e,t,n){var i,a={appId:e,apiKey:t,timeouts:{connect:1,read:2,write:30},requester:{send:function(e){return new Promise((function(t){var r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((function(t){return r.setRequestHeader(t,e.headers[t])}));var n,i=function(e,n){return setTimeout((function(){r.abort(),t({status:0,content:n,isTimedOut:!0})}),1e3*e)},a=i(e.connectTimeout,"Connection timeout");r.onreadystatechange=function(){r.readyState>r.OPENED&&void 0===n&&(clearTimeout(a),n=i(e.responseTimeout,"Socket timeout"))},r.onerror=function(){0===r.status&&(clearTimeout(a),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=function(){clearTimeout(a),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},logger:(i=q,{debug:function(e,t){return k>=i&&console.debug(e,t),Promise.resolve()},info:function(e,t){return D>=i&&console.info(e,t),Promise.resolve()},error:function(e,t){return console.error(e,t),Promise.resolve()}}),responsesCache:o(),requestsCache:o({serializable:!1}),hostsCache:c({caches:[s({key:"".concat("4.24.0","-").concat(e)}),o()]}),userAgent:j("4.24.0").add({segment:"Browser",version:"lite"}),authMode:f.WithinQueryParameters};return S(r(r(r({},a),n),{},{methods:{search:Q,searchForFacetValues:H,multipleQueries:Q,multipleSearchForFacetValues:H,customRequest:A,initIndex:function(e){return function(t){return N(e)(t,{methods:{search:C,searchForFacetValues:I,findAnswers:T}})}},getRecommendations:L}}))}return V.version="4.24.0",V}()},6996:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>S});var n=r(6540),i=r(53),a=r(3643),s=r.n(a),c=r(4103),o=r.n(c),u=r(5260),h=r(5489),l=r(8193),f=r(4586);const m=["zero","one","two","few","many","other"];function d(e){return m.filter((t=>e.includes(t)))}const p={locale:"en",pluralForms:d(["one","other"]),select:e=>1===e?"one":"other"};function g(){const{i18n:{currentLocale:e}}=(0,f.A)();return(0,n.useMemo)((()=>{try{return function(e){const t=new Intl.PluralRules(e);return{locale:e,pluralForms:d(t.resolvedOptions().pluralCategories),select:e=>t.select(e)}}(e)}catch(t){return console.error(`Failed to use Intl.PluralRules for locale "${e}".\nDocusaurus will fallback to the default (English) implementation.\nError: ${t.message}\n`),p}}),[e])}function v(){const e=g();return{selectMessage:(t,r)=>function(e,t,r){const n=e.split("|");if(1===n.length)return n[0];n.length>r.pluralForms.length&&console.error(`For locale=${r.locale}, a maximum of ${r.pluralForms.length} plural forms are expected (${r.pluralForms.join(",")}), but the message contains ${n.length}: ${e}`);const i=r.select(t),a=r.pluralForms.indexOf(i);return n[Math.min(a,n.length-1)]}(r,t,e)}}var y=r(4255),R=r(1252),F=r(9532),b=r(481),_=r(9024),P=r(4070),j=r(1312),x=r(8916);const E={searchQueryInput:"searchQueryInput_fOvw",searchVersionInput:"searchVersionInput_uwCD",searchResultsColumn:"searchResultsColumn_XAOM",algoliaLogo:"algoliaLogo_lMQB",algoliaLogoPathFill:"algoliaLogoPathFill_UGFK",searchResultItem:"searchResultItem_RfWM",searchResultItemHeading:"searchResultItemHeading_cu9x",searchResultItemPath:"searchResultItemPath_bRHw",searchResultItemSummary:"searchResultItemSummary_gq1k",searchQueryColumn:"searchQueryColumn_vJqv",searchVersionColumn:"searchVersionColumn_Afdn",searchLogoColumn:"searchLogoColumn_D3Uo",loadingSpinner:"loadingSpinner_bRrL","loading-spin":"loading-spin_kfRG",loader:"loader_Ubv2"};function O(e){let{docsSearchVersionsHelpers:t}=e;const r=Object.entries(t.allDocsData).filter((e=>{let[,t]=e;return t.versions.length>1}));return n.createElement("div",{className:(0,i.A)("col","col--3","padding-left--none",E.searchVersionColumn)},r.map((e=>{let[i,a]=e;const s=r.length>1?`${i}: `:"";return n.createElement("select",{key:i,onChange:e=>t.setSearchVersion(i,e.target.value),defaultValue:t.searchVersions[i],className:E.searchVersionInput},a.versions.map(((e,t)=>n.createElement("option",{key:t,label:`${s}${e.label}`,value:e.name}))))})))}function w(){const{siteConfig:{themeConfig:e},i18n:{currentLocale:t}}=(0,f.A)(),{algolia:{appId:r,apiKey:a,indexName:c,externalUrlRegex:m}}=e,d=function(){const{selectMessage:e}=v();return t=>e(t,(0,j.T)({id:"theme.SearchPage.documentsFound.plurals",description:'Pluralized label for "{count} documents found". Use as much plural forms (separated by "|") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)',message:"One document found|{count} documents found"},{count:t}))}(),p=function(){const e=(0,P.Gy)(),[t,r]=(0,n.useState)((()=>Object.entries(e).reduce(((e,t)=>{let[r,n]=t;return{...e,[r]:n.versions[0].name}}),{}))),i=Object.values(e).some((e=>e.versions.length>1));return{allDocsData:e,versioningEnabled:i,searchVersions:t,setSearchVersion:(e,t)=>r((r=>({...r,[e]:t})))}}(),{searchQuery:g,setSearchQuery:_}=(0,y.n)(),w={items:[],query:null,totalResults:null,totalPages:null,lastPage:null,hasMore:null,loading:null},[S,A]=(0,n.useReducer)(((e,t)=>{switch(t.type){case"reset":return w;case"loading":return{...e,loading:!0};case"update":return g!==t.value.query?e:{...t.value,items:0===t.value.lastPage?t.value.items:e.items.concat(t.value.items)};case"advance":{const t=e.totalPages>e.lastPage+1;return{...e,lastPage:t?e.lastPage+1:e.lastPage,hasMore:t}}default:return e}}),w),N=s()(r,a),Q=o()(N,c,{hitsPerPage:15,advancedSyntax:!0,disjunctiveFacets:["language","docusaurus_tag"]});Q.on("result",(e=>{let{results:{query:t,hits:r,page:n,nbHits:i,nbPages:a}}=e;if(""===t||!Array.isArray(r))return void A({type:"reset"});const s=e=>e.replace(/algolia-docsearch-suggestion--highlight/g,"search-result-match"),c=r.map((e=>{let{url:t,_highlightResult:{hierarchy:r},_snippetResult:n={}}=e;const i=new URL(t),a=Object.keys(r).map((e=>s(r[e].value)));return{title:a.pop(),url:(0,R.G)(m,i.href)?i.href:i.pathname+i.hash,summary:n.content?`${s(n.content.value)}...`:"",breadcrumbs:a}}));A({type:"update",value:{items:c,query:t,totalResults:i,totalPages:a,lastPage:n,hasMore:a>n+1,loading:!1}})}));const[H,T]=(0,n.useState)(null),C=(0,n.useRef)(0),I=(0,n.useRef)(l.A.canUseDOM&&new IntersectionObserver((e=>{const{isIntersecting:t,boundingClientRect:{y:r}}=e[0];t&&C.current>r&&A({type:"advance"}),C.current=r}),{threshold:1})),k=()=>g?(0,j.T)({id:"theme.SearchPage.existingResultsTitle",message:'Search results for "{query}"',description:"The search page title for non-empty query"},{query:g}):(0,j.T)({id:"theme.SearchPage.emptyResultsTitle",message:"Search the documentation",description:"The search page title for empty query"}),D=(0,F.qd)((function(e){void 0===e&&(e=0),Q.addDisjunctiveFacetRefinement("docusaurus_tag","default"),Q.addDisjunctiveFacetRefinement("language",t),Object.entries(p.searchVersions).forEach((e=>{let[t,r]=e;Q.addDisjunctiveFacetRefinement("docusaurus_tag",`docs-${t}-${r}`)})),Q.setQuery(g).setPage(e).search()}));return(0,n.useEffect)((()=>{if(!H)return;const e=I.current;return e?(e.observe(H),()=>e.unobserve(H)):()=>!0}),[H]),(0,n.useEffect)((()=>{A({type:"reset"}),g&&(A({type:"loading"}),setTimeout((()=>{D()}),300))}),[g,p.searchVersions,D]),(0,n.useEffect)((()=>{S.lastPage&&0!==S.lastPage&&D(S.lastPage)}),[D,S.lastPage]),n.createElement(x.A,null,n.createElement(u.A,null,n.createElement("title",null,(0,b.s)(k())),n.createElement("meta",{property:"robots",content:"noindex, follow"})),n.createElement("div",{className:"container margin-vert--lg"},n.createElement("h1",null,k()),n.createElement("form",{className:"row",onSubmit:e=>e.preventDefault()},n.createElement("div",{className:(0,i.A)("col",E.searchQueryColumn,{"col--9":p.versioningEnabled,"col--12":!p.versioningEnabled})},n.createElement("input",{type:"search",name:"q",className:E.searchQueryInput,placeholder:(0,j.T)({id:"theme.SearchPage.inputPlaceholder",message:"Type your search here",description:"The placeholder for search page input"}),"aria-label":(0,j.T)({id:"theme.SearchPage.inputLabel",message:"Search",description:"The ARIA label for search page input"}),onChange:e=>_(e.target.value),value:g,autoComplete:"off",autoFocus:!0})),p.versioningEnabled&&n.createElement(O,{docsSearchVersionsHelpers:p})),n.createElement("div",{className:"row"},n.createElement("div",{className:(0,i.A)("col","col--8",E.searchResultsColumn)},!!S.totalResults&&d(S.totalResults)),n.createElement("div",{className:(0,i.A)("col","col--4","text--right",E.searchLogoColumn)},n.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:"https://www.algolia.com/","aria-label":(0,j.T)({id:"theme.SearchPage.algoliaLabel",message:"Search by Algolia",description:"The ARIA label for Algolia mention"})},n.createElement("svg",{viewBox:"0 0 168 24",className:E.algoliaLogo},n.createElement("g",{fill:"none"},n.createElement("path",{className:E.algoliaLogoPathFill,d:"M120.925 18.804c-4.386.02-4.386-3.54-4.386-4.106l-.007-13.336 2.675-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-10.846-2.18c.821 0 1.43-.047 1.855-.129v-2.719a6.334 6.334 0 0 0-1.574-.199 5.7 5.7 0 0 0-.897.069 2.699 2.699 0 0 0-.814.24c-.24.116-.439.28-.582.491-.15.212-.219.335-.219.656 0 .628.219.991.616 1.23s.938.362 1.615.362zm-.233-9.7c.883 0 1.629.109 2.231.328.602.218 1.088.525 1.444.915.363.396.609.922.76 1.483.157.56.232 1.175.232 1.85v6.874a32.5 32.5 0 0 1-1.868.314c-.834.123-1.772.185-2.813.185-.69 0-1.327-.069-1.895-.198a4.001 4.001 0 0 1-1.471-.636 3.085 3.085 0 0 1-.951-1.134c-.226-.465-.343-1.12-.343-1.803 0-.656.13-1.073.384-1.525a3.24 3.24 0 0 1 1.047-1.106c.445-.287.95-.492 1.532-.615a8.8 8.8 0 0 1 1.82-.185 8.404 8.404 0 0 1 1.972.24v-.438c0-.307-.035-.6-.11-.874a1.88 1.88 0 0 0-.384-.73 1.784 1.784 0 0 0-.724-.493 3.164 3.164 0 0 0-1.143-.205c-.616 0-1.177.075-1.69.164a7.735 7.735 0 0 0-1.26.307l-.321-2.192c.335-.117.834-.233 1.478-.349a10.98 10.98 0 0 1 2.073-.178zm52.842 9.626c.822 0 1.43-.048 1.854-.13V13.7a6.347 6.347 0 0 0-1.574-.199c-.294 0-.595.021-.896.069a2.7 2.7 0 0 0-.814.24 1.46 1.46 0 0 0-.582.491c-.15.212-.218.335-.218.656 0 .628.218.991.615 1.23.404.245.938.362 1.615.362zm-.226-9.694c.883 0 1.629.108 2.231.327.602.219 1.088.526 1.444.915.355.39.609.923.759 1.483a6.8 6.8 0 0 1 .233 1.852v6.873c-.41.088-1.034.19-1.868.314-.834.123-1.772.184-2.813.184-.69 0-1.327-.068-1.895-.198a4.001 4.001 0 0 1-1.471-.635 3.085 3.085 0 0 1-.951-1.134c-.226-.465-.343-1.12-.343-1.804 0-.656.13-1.073.384-1.524.26-.45.608-.82 1.047-1.107.445-.286.95-.491 1.532-.614a8.803 8.803 0 0 1 2.751-.13c.329.034.671.096 1.04.185v-.437a3.3 3.3 0 0 0-.109-.875 1.873 1.873 0 0 0-.384-.731 1.784 1.784 0 0 0-.724-.492 3.165 3.165 0 0 0-1.143-.205c-.616 0-1.177.075-1.69.164a7.75 7.75 0 0 0-1.26.307l-.321-2.193c.335-.116.834-.232 1.478-.348a11.633 11.633 0 0 1 2.073-.177zm-8.034-1.271a1.626 1.626 0 0 1-1.628-1.62c0-.895.725-1.62 1.628-1.62.904 0 1.63.725 1.63 1.62 0 .895-.733 1.62-1.63 1.62zm1.348 13.22h-2.689V7.27l2.69-.423v11.956zm-4.714 0c-4.386.02-4.386-3.54-4.386-4.107l-.008-13.336 2.676-.424v13.254c0 .322 0 2.358 1.718 2.364v2.248zm-8.698-5.903c0-1.156-.253-2.119-.746-2.788-.493-.677-1.183-1.01-2.067-1.01-.882 0-1.574.333-2.065 1.01-.493.676-.733 1.632-.733 2.788 0 1.168.246 1.953.74 2.63.492.683 1.183 1.018 2.066 1.018.882 0 1.574-.342 2.067-1.019.492-.683.738-1.46.738-2.63zm2.737-.007c0 .902-.13 1.584-.397 2.33a5.52 5.52 0 0 1-1.128 1.906 4.986 4.986 0 0 1-1.752 1.223c-.685.286-1.739.45-2.265.45-.528-.006-1.574-.157-2.252-.45a5.096 5.096 0 0 1-1.744-1.223c-.487-.527-.863-1.162-1.137-1.906a6.345 6.345 0 0 1-.41-2.33c0-.902.123-1.77.397-2.508a5.554 5.554 0 0 1 1.15-1.892 5.133 5.133 0 0 1 1.75-1.216c.679-.287 1.425-.423 2.232-.423.808 0 1.553.142 2.237.423a4.88 4.88 0 0 1 1.753 1.216 5.644 5.644 0 0 1 1.135 1.892c.287.738.431 1.606.431 2.508zm-20.138 0c0 1.12.246 2.363.738 2.882.493.52 1.13.78 1.91.78.424 0 .828-.062 1.204-.178.377-.116.677-.253.917-.417V9.33a10.476 10.476 0 0 0-1.766-.226c-.971-.028-1.71.37-2.23 1.004-.513.636-.773 1.75-.773 2.788zm7.438 5.274c0 1.824-.466 3.156-1.404 4.004-.936.846-2.367 1.27-4.296 1.27-.705 0-2.17-.137-3.34-.396l.431-2.118c.98.205 2.272.26 2.95.26 1.074 0 1.84-.219 2.299-.656.459-.437.684-1.086.684-1.948v-.437a8.07 8.07 0 0 1-1.047.397c-.43.13-.93.198-1.492.198-.739 0-1.41-.116-2.018-.349a4.206 4.206 0 0 1-1.567-1.025c-.431-.45-.774-1.017-1.013-1.694-.24-.677-.363-1.885-.363-2.773 0-.834.13-1.88.384-2.577.26-.696.629-1.298 1.129-1.796.493-.498 1.095-.881 1.8-1.162a6.605 6.605 0 0 1 2.428-.457c.87 0 1.67.109 2.45.24.78.129 1.444.265 1.985.415V18.17zM6.972 6.677v1.627c-.712-.446-1.52-.67-2.425-.67-.585 0-1.045.13-1.38.391a1.24 1.24 0 0 0-.502 1.03c0 .425.164.765.494 1.02.33.256.835.532 1.516.83.447.192.795.356 1.045.495.25.138.537.332.862.582.324.25.563.548.718.894.154.345.23.741.23 1.188 0 .947-.334 1.691-1.004 2.234-.67.542-1.537.814-2.601.814-1.18 0-2.16-.229-2.936-.686v-1.708c.84.628 1.814.942 2.92.942.585 0 1.048-.136 1.388-.407.34-.271.51-.646.51-1.125 0-.287-.1-.55-.302-.79-.203-.24-.42-.42-.655-.542-.234-.123-.585-.29-1.053-.503a61.27 61.27 0 0 1-.582-.271 13.67 13.67 0 0 1-.55-.287 4.275 4.275 0 0 1-.567-.351 6.92 6.92 0 0 1-.455-.4c-.18-.17-.31-.34-.39-.51-.08-.17-.155-.37-.224-.598a2.553 2.553 0 0 1-.104-.742c0-.915.333-1.638.998-2.17.664-.532 1.523-.798 2.576-.798.968 0 1.793.17 2.473.51zm7.468 5.696v-.287c-.022-.607-.187-1.088-.495-1.444-.309-.357-.75-.535-1.324-.535-.532 0-.99.194-1.373.583-.382.388-.622.949-.717 1.683h3.909zm1.005 2.792v1.404c-.596.34-1.383.51-2.362.51-1.255 0-2.255-.377-3-1.132-.744-.755-1.116-1.744-1.116-2.968 0-1.297.34-2.316 1.021-3.055.68-.74 1.548-1.11 2.6-1.11 1.033 0 1.852.323 2.458.966.606.644.91 1.572.91 2.784 0 .33-.033.676-.096 1.038h-5.314c.107.702.405 1.239.894 1.611.49.372 1.106.558 1.85.558.862 0 1.58-.202 2.155-.606zm6.605-1.77h-1.212c-.596 0-1.045.116-1.349.35-.303.234-.454.532-.454.894 0 .372.117.664.35.877.235.213.575.32 1.022.32.51 0 .912-.142 1.204-.424.293-.281.44-.651.44-1.108v-.91zm-4.068-2.554V9.325c.627-.361 1.457-.542 2.489-.542 2.116 0 3.175 1.026 3.175 3.08V17h-1.548v-.957c-.415.68-1.143 1.02-2.186 1.02-.766 0-1.38-.22-1.843-.661-.462-.442-.694-1.003-.694-1.684 0-.776.293-1.38.878-1.81.585-.431 1.404-.647 2.457-.647h1.34V11.8c0-.554-.133-.971-.399-1.253-.266-.282-.707-.423-1.324-.423a4.07 4.07 0 0 0-2.345.718zm9.333-1.93v1.42c.394-1 1.101-1.5 2.123-1.5.148 0 .313.016.494.048v1.531a1.885 1.885 0 0 0-.75-.143c-.542 0-.989.24-1.34.718-.351.479-.527 1.048-.527 1.707V17h-1.563V8.91h1.563zm5.01 4.084c.022.82.272 1.492.75 2.019.479.526 1.15.79 2.01.79.639 0 1.235-.176 1.788-.527v1.404c-.521.319-1.186.479-1.995.479-1.265 0-2.276-.4-3.031-1.197-.755-.798-1.133-1.792-1.133-2.984 0-1.16.38-2.151 1.14-2.975.761-.825 1.79-1.237 3.088-1.237.702 0 1.346.149 1.93.447v1.436a3.242 3.242 0 0 0-1.77-.495c-.84 0-1.513.266-2.019.798-.505.532-.758 1.213-.758 2.042zM40.24 5.72v4.579c.458-1 1.293-1.5 2.505-1.5.787 0 1.42.245 1.899.734.479.49.718 1.17.718 2.042V17h-1.564v-5.106c0-.553-.14-.98-.422-1.284-.282-.303-.652-.455-1.11-.455-.531 0-1.002.202-1.411.606-.41.405-.615 1.022-.615 1.851V17h-1.563V5.72h1.563zm14.966 10.02c.596 0 1.096-.253 1.5-.758.404-.506.606-1.157.606-1.955 0-.915-.202-1.62-.606-2.114-.404-.495-.92-.742-1.548-.742-.553 0-1.05.224-1.491.67-.442.447-.662 1.133-.662 2.058 0 .958.212 1.67.638 2.138.425.469.946.703 1.563.703zM53.004 5.72v4.42c.574-.894 1.388-1.341 2.44-1.341 1.022 0 1.857.383 2.506 1.149.649.766.973 1.781.973 3.047 0 1.138-.309 2.109-.925 2.912-.617.803-1.463 1.205-2.537 1.205-1.075 0-1.894-.447-2.457-1.34V17h-1.58V5.72h1.58zm9.908 11.104l-3.223-7.913h1.739l1.005 2.632 1.26 3.415c.096-.32.48-1.458 1.15-3.415l.909-2.632h1.66l-2.92 7.866c-.777 2.074-1.963 3.11-3.559 3.11a2.92 2.92 0 0 1-.734-.079v-1.34c.17.042.351.064.543.064 1.032 0 1.755-.57 2.17-1.708z"}),n.createElement("path",{fill:"#5468FF",d:"M78.988.938h16.594a2.968 2.968 0 0 1 2.966 2.966V20.5a2.967 2.967 0 0 1-2.966 2.964H78.988a2.967 2.967 0 0 1-2.966-2.964V3.897A2.961 2.961 0 0 1 78.988.938z"}),n.createElement("path",{fill:"white",d:"M89.632 5.967v-.772a.978.978 0 0 0-.978-.977h-2.28a.978.978 0 0 0-.978.977v.793c0 .088.082.15.171.13a7.127 7.127 0 0 1 1.984-.28c.65 0 1.295.088 1.917.259.082.02.164-.04.164-.13m-6.248 1.01l-.39-.389a.977.977 0 0 0-1.382 0l-.465.465a.973.973 0 0 0 0 1.38l.383.383c.062.061.15.047.205-.014.226-.307.472-.601.746-.874.281-.28.568-.526.883-.751.068-.042.075-.137.02-.2m4.16 2.453v3.341c0 .096.104.165.192.117l2.97-1.537c.068-.034.089-.117.055-.184a3.695 3.695 0 0 0-3.08-1.866c-.068 0-.136.054-.136.13m0 8.048a4.489 4.489 0 0 1-4.49-4.482 4.488 4.488 0 0 1 4.49-4.482 4.488 4.488 0 0 1 4.489 4.482 4.484 4.484 0 0 1-4.49 4.482m0-10.85a6.363 6.363 0 1 0 0 12.729 6.37 6.37 0 0 0 6.372-6.368 6.358 6.358 0 0 0-6.371-6.36"})))))),S.items.length>0?n.createElement("main",null,S.items.map(((e,t)=>{let{title:r,url:a,summary:s,breadcrumbs:c}=e;return n.createElement("article",{key:t,className:E.searchResultItem},n.createElement("h2",{className:E.searchResultItemHeading},n.createElement(h.A,{to:a,dangerouslySetInnerHTML:{__html:r}})),c.length>0&&n.createElement("nav",{"aria-label":"breadcrumbs"},n.createElement("ul",{className:(0,i.A)("breadcrumbs",E.searchResultItemPath)},c.map(((e,t)=>n.createElement("li",{key:t,className:"breadcrumbs__item",dangerouslySetInnerHTML:{__html:e}}))))),s&&n.createElement("p",{className:E.searchResultItemSummary,dangerouslySetInnerHTML:{__html:s}}))}))):[g&&!S.loading&&n.createElement("p",{key:"no-results"},n.createElement(j.A,{id:"theme.SearchPage.noResultsText",description:"The paragraph for empty search result"},"No results were found")),!!S.loading&&n.createElement("div",{key:"spinner",className:E.loadingSpinner})],S.hasMore&&n.createElement("div",{className:E.loader,ref:T},n.createElement(j.A,{id:"theme.SearchPage.fetchingNewResults",description:"The paragraph for fetching new search results"},"Fetching new results..."))))}function S(){return n.createElement(_.e3,{className:"search-page-wrapper"},n.createElement(w,null))}}}]); \ No newline at end of file diff --git a/assets/js/1a4e3797.2f9cbdc7.js.LICENSE.txt b/assets/js/1a4e3797.6f617479.js.LICENSE.txt similarity index 100% rename from assets/js/1a4e3797.2f9cbdc7.js.LICENSE.txt rename to assets/js/1a4e3797.6f617479.js.LICENSE.txt diff --git a/assets/js/1bb76b7a.ffb915e4.js b/assets/js/1bb76b7a.ea1b1015.js similarity index 93% rename from assets/js/1bb76b7a.ffb915e4.js rename to assets/js/1bb76b7a.ea1b1015.js index ef9b9e00..727788a1 100644 --- a/assets/js/1bb76b7a.ffb915e4.js +++ b/assets/js/1bb76b7a.ea1b1015.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[2915],{5680:(e,a,n)=>{n.d(a,{xA:()=>p,yg:()=>m});var t=n(6540);function s(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function r(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function l(e){for(var a=1;a=0||(s[n]=e[n]);return s}(e,a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var o=t.createContext({}),y=function(e){var a=t.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},p=function(e){var a=y(e.components);return t.createElement(o.Provider,{value:a},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},d=t.forwardRef((function(e,a){var n=e.components,s=e.mdxType,r=e.originalType,o=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),c=y(n),d=s,m=c["".concat(o,".").concat(d)]||c[d]||u[d]||r;return n?t.createElement(m,l(l({ref:a},p),{},{components:n})):t.createElement(m,l({ref:a},p))}));function m(e,a){var n=arguments,s=a&&a.mdxType;if("string"==typeof e||s){var r=n.length,l=new Array(r);l[0]=d;var i={};for(var o in a)hasOwnProperty.call(a,o)&&(i[o]=a[o]);i.originalType=e,i[c]="string"==typeof e?e:s,l[1]=i;for(var y=2;y{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>l,default:()=>u,frontMatter:()=>r,metadata:()=>i,toc:()=>y});var t=n(8168),s=(n(6540),n(5680));const r={id:"heap_analysis_src.ObjectUnboundGrowthAnalysis",title:"Class: ObjectUnboundGrowthAnalysis",sidebar_label:"ObjectUnboundGrowthAnalysis",custom_edit_url:null},l=void 0,i={unversionedId:"api/classes/heap_analysis_src.ObjectUnboundGrowthAnalysis",id:"api/classes/heap_analysis_src.ObjectUnboundGrowthAnalysis",title:"Class: ObjectUnboundGrowthAnalysis",description:"Hierarchy",source:"@site/docs/api/classes/heap_analysis_src.ObjectUnboundGrowthAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.ObjectUnboundGrowthAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectUnboundGrowthAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.ObjectUnboundGrowthAnalysis",title:"Class: ObjectUnboundGrowthAnalysis",sidebar_label:"ObjectUnboundGrowthAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"ObjectSizeAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectSizeAnalysis"},next:{title:"ShapeUnboundGrowthAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ShapeUnboundGrowthAnalysis"}},o={},y=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new ObjectUnboundGrowthAnalysis()',id:"new-objectunboundgrowthanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotsInDirectory(directory, options?)',id:"analyzesnapshotsindirectorydirectory-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3}],p={toc:y},c="wrapper";function u(e){let{components:a,...n}=e;return(0,s.yg)(c,(0,t.A)({},p,n,{components:a,mdxType:"MDXLayout"}),(0,s.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},(0,s.yg)("inlineCode",{parentName:"a"},"BaseAnalysis"))),(0,s.yg)("p",{parentName:"li"},"\u21b3 ",(0,s.yg)("strong",{parentName:"p"},(0,s.yg)("inlineCode",{parentName:"strong"},"ObjectUnboundGrowthAnalysis"))))),(0,s.yg)("h2",{id:"constructors"},"Constructors"),(0,s.yg)("h3",{id:"new-objectunboundgrowthanalysis"},(0,s.yg)("a",{id:"new objectunboundgrowthanalysis"}),(0,s.yg)("strong",{parentName:"h3"},"new ObjectUnboundGrowthAnalysis"),"()"),(0,s.yg)("h2",{id:"methods"},"Methods"),(0,s.yg)("h3",{id:"analyzesnapshotsindirectorydirectory-options"},(0,s.yg)("a",{id:"analyzesnapshotsindirectory"}),(0,s.yg)("strong",{parentName:"h3"},"analyzeSnapshotsInDirectory"),"(",(0,s.yg)("inlineCode",{parentName:"h3"},"directory"),", ",(0,s.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,s.yg)("p",null,"Run heap analysis for a series of heap snapshot files"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Parameters"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"directory"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of the directory holding a series of ",(0,s.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," files, all snapshot files will be loaded and analyzed in the alphanumerically ascending order of those snapshot file names."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,s.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,s.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Example"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new ShapeUnboundGrowthAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotsInDirectory(snapshotDirectory);\n// query analysis-specific and structured results\nconst shapes = analysis.getShapesWithUnboundGrowth();\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new ShapeUnboundGrowthAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotsInDirectory(snapshotDirectory, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/BaseAnalysis.ts#L148"},"heap-analysis/src/BaseAnalysis.ts:148"))))),(0,s.yg)("hr",null),(0,s.yg)("h3",{id:"getcommandname"},(0,s.yg)("a",{id:"getcommandname"}),(0,s.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,s.yg)("p",null,"Get the name of the heap analysis, which is also used to reference\nthe analysis in memlab command-line tool."),(0,s.yg)("p",null,"The following terminal command will initiate with this analysis:\n",(0,s.yg)("inlineCode",{parentName:"p"},"memlab analyze ")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the name of the analysis"),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Examples"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new YourAnalysis();\nconst name = analysis.getCommandName();\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/plugins/ObjectUnboundGrowthAnalysis.ts#L33"},"heap-analysis/src/plugins/ObjectUnboundGrowthAnalysis.ts:33"))))))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[2915],{5680:(e,a,n)=>{n.d(a,{xA:()=>p,yg:()=>d});var t=n(6540);function s(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function r(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function l(e){for(var a=1;a=0||(s[n]=e[n]);return s}(e,a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var o=t.createContext({}),y=function(e){var a=t.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},p=function(e){var a=y(e.components);return t.createElement(o.Provider,{value:a},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},m=t.forwardRef((function(e,a){var n=e.components,s=e.mdxType,r=e.originalType,o=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),c=y(n),m=s,d=c["".concat(o,".").concat(m)]||c[m]||u[m]||r;return n?t.createElement(d,l(l({ref:a},p),{},{components:n})):t.createElement(d,l({ref:a},p))}));function d(e,a){var n=arguments,s=a&&a.mdxType;if("string"==typeof e||s){var r=n.length,l=new Array(r);l[0]=m;var i={};for(var o in a)hasOwnProperty.call(a,o)&&(i[o]=a[o]);i.originalType=e,i[c]="string"==typeof e?e:s,l[1]=i;for(var y=2;y{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>l,default:()=>u,frontMatter:()=>r,metadata:()=>i,toc:()=>y});var t=n(8168),s=(n(6540),n(5680));const r={id:"heap_analysis_src.ObjectUnboundGrowthAnalysis",title:"Class: ObjectUnboundGrowthAnalysis",sidebar_label:"ObjectUnboundGrowthAnalysis",custom_edit_url:null},l=void 0,i={unversionedId:"api/classes/heap_analysis_src.ObjectUnboundGrowthAnalysis",id:"api/classes/heap_analysis_src.ObjectUnboundGrowthAnalysis",title:"Class: ObjectUnboundGrowthAnalysis",description:"Hierarchy",source:"@site/docs/api/classes/heap_analysis_src.ObjectUnboundGrowthAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.ObjectUnboundGrowthAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectUnboundGrowthAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.ObjectUnboundGrowthAnalysis",title:"Class: ObjectUnboundGrowthAnalysis",sidebar_label:"ObjectUnboundGrowthAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"ObjectSizeAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectSizeAnalysis"},next:{title:"ShapeUnboundGrowthAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ShapeUnboundGrowthAnalysis"}},o={},y=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new ObjectUnboundGrowthAnalysis()',id:"new-objectunboundgrowthanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotsInDirectory(directory, options?)',id:"analyzesnapshotsindirectorydirectory-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3}],p={toc:y},c="wrapper";function u(e){let{components:a,...n}=e;return(0,s.yg)(c,(0,t.A)({},p,n,{components:a,mdxType:"MDXLayout"}),(0,s.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},(0,s.yg)("inlineCode",{parentName:"a"},"BaseAnalysis"))),(0,s.yg)("p",{parentName:"li"},"\u21b3 ",(0,s.yg)("strong",{parentName:"p"},(0,s.yg)("inlineCode",{parentName:"strong"},"ObjectUnboundGrowthAnalysis"))))),(0,s.yg)("h2",{id:"constructors"},"Constructors"),(0,s.yg)("h3",{id:"new-objectunboundgrowthanalysis"},(0,s.yg)("a",{id:"new objectunboundgrowthanalysis"}),(0,s.yg)("strong",{parentName:"h3"},"new ObjectUnboundGrowthAnalysis"),"()"),(0,s.yg)("h2",{id:"methods"},"Methods"),(0,s.yg)("h3",{id:"analyzesnapshotsindirectorydirectory-options"},(0,s.yg)("a",{id:"analyzesnapshotsindirectory"}),(0,s.yg)("strong",{parentName:"h3"},"analyzeSnapshotsInDirectory"),"(",(0,s.yg)("inlineCode",{parentName:"h3"},"directory"),", ",(0,s.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,s.yg)("p",null,"Run heap analysis for a series of heap snapshot files"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Parameters"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"directory"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of the directory holding a series of ",(0,s.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," files, all snapshot files will be loaded and analyzed in the alphanumerically ascending order of those snapshot file names."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,s.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,s.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Example"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new ShapeUnboundGrowthAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotsInDirectory(snapshotDirectory);\n// query analysis-specific and structured results\nconst shapes = analysis.getShapesWithUnboundGrowth();\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new ShapeUnboundGrowthAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotsInDirectory(snapshotDirectory, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/BaseAnalysis.ts#L148"},"heap-analysis/src/BaseAnalysis.ts:148"))))),(0,s.yg)("hr",null),(0,s.yg)("h3",{id:"getcommandname"},(0,s.yg)("a",{id:"getcommandname"}),(0,s.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,s.yg)("p",null,"Get the name of the heap analysis, which is also used to reference\nthe analysis in memlab command-line tool."),(0,s.yg)("p",null,"The following terminal command will initiate with this analysis:\n",(0,s.yg)("inlineCode",{parentName:"p"},"memlab analyze ")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the name of the analysis"),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Examples"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new YourAnalysis();\nconst name = analysis.getCommandName();\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/plugins/ObjectUnboundGrowthAnalysis.ts#L33"},"heap-analysis/src/plugins/ObjectUnboundGrowthAnalysis.ts:33"))))))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1be78505.c37e911a.js b/assets/js/1be78505.c37e911a.js new file mode 100644 index 00000000..8bb72214 --- /dev/null +++ b/assets/js/1be78505.c37e911a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[8714,1774],{8067:(e,t,n)=>{n.r(t),n.d(t,{default:()=>ge});var a=n(6540),l=n(53),o=n(1754),r=n(2967),c=n(9024),i=n(7559),s=n(2252),d=n(6588),m=n(8916),u=n(1312),b=n(3104),p=n(5062);const h={backToTopButton:"backToTopButton_sjWU",backToTopButtonShow:"backToTopButtonShow_xfvO"};function E(){const{shown:e,scrollToTop:t}=function(e){let{threshold:t}=e;const[n,l]=(0,a.useState)(!1),o=(0,a.useRef)(!1),{startScroll:r,cancelScroll:c}=(0,b.gk)();return(0,b.Mq)(((e,n)=>{let{scrollY:a}=e;const r=n?.scrollY;r&&(o.current?o.current=!1:a>=r?(c(),l(!1)):a{e.location.hash&&(o.current=!0,l(!1))})),{shown:n,scrollToTop:()=>r(0)}}({threshold:300});return a.createElement("button",{"aria-label":(0,u.T)({id:"theme.BackToTopButton.buttonAriaLabel",message:"Scroll back to top",description:"The ARIA label for the back to top button"}),className:(0,l.A)("clean-btn",i.G.common.backToTopButton,h.backToTopButton,e&&h.backToTopButtonShow),type:"button",onClick:t})}var f=n(6347),g=n(4581),v=n(6342),_=n(3465),C=n(8168);function k(e){return a.createElement("svg",(0,C.A)({width:"20",height:"20","aria-hidden":"true"},e),a.createElement("g",{fill:"#7a7a7a"},a.createElement("path",{d:"M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"}),a.createElement("path",{d:"M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"})))}const A="collapseSidebarButton_PEFL",S="collapseSidebarButtonIcon_kv0_";function N(e){let{onClick:t}=e;return a.createElement("button",{type:"button",title:(0,u.T)({id:"theme.docs.sidebar.collapseButtonTitle",message:"Collapse sidebar",description:"The title attribute for collapse button of doc sidebar"}),"aria-label":(0,u.T)({id:"theme.docs.sidebar.collapseButtonAriaLabel",message:"Collapse sidebar",description:"The title attribute for collapse button of doc sidebar"}),className:(0,l.A)("button button--secondary button--outline",A),onClick:t},a.createElement(k,{className:S}))}var T=n(5041),I=n(9532);const x=Symbol("EmptyContext"),y=a.createContext(x);function w(e){let{children:t}=e;const[n,l]=(0,a.useState)(null),o=(0,a.useMemo)((()=>({expandedItem:n,setExpandedItem:l})),[n]);return a.createElement(y.Provider,{value:o},t)}var B=n(9169),M=n(1422),L=n(5489),P=n(2303);function G(e){let{categoryLabel:t,onClick:n}=e;return a.createElement("button",{"aria-label":(0,u.T)({id:"theme.DocSidebarItem.toggleCollapsedCategoryAriaLabel",message:"Toggle the collapsible sidebar category '{label}'",description:"The ARIA label to toggle the collapsible sidebar category"},{label:t}),type:"button",className:"clean-btn menu__caret",onClick:n})}function H(e){let{item:t,onItemClick:n,activePath:r,level:c,index:s,...d}=e;const{items:m,label:u,collapsible:b,className:p,href:h}=t,{docs:{sidebar:{autoCollapseCategories:E}}}=(0,v.p)(),f=function(e){const t=(0,P.A)();return(0,a.useMemo)((()=>e.href?e.href:!t&&e.collapsible?(0,o._o)(e):void 0),[e,t])}(t),g=(0,o.w8)(t,r),_=(0,B.ys)(h,r),{collapsed:k,setCollapsed:A}=(0,M.u)({initialState:()=>!!b&&(!g&&t.collapsed)}),{expandedItem:S,setExpandedItem:N}=function(){const e=(0,a.useContext)(y);if(e===x)throw new I.dV("DocSidebarItemsExpandedStateProvider");return e}(),T=function(e){void 0===e&&(e=!k),N(e?null:s),A(e)};return function(e){let{isActive:t,collapsed:n,updateCollapsed:l}=e;const o=(0,I.ZC)(t);(0,a.useEffect)((()=>{t&&!o&&n&&l(!1)}),[t,o,n,l])}({isActive:g,collapsed:k,updateCollapsed:T}),(0,a.useEffect)((()=>{b&&S&&S!==s&&E&&A(!0)}),[b,S,s,A,E]),a.createElement("li",{className:(0,l.A)(i.G.docs.docSidebarItemCategory,i.G.docs.docSidebarItemCategoryLevel(c),"menu__list-item",{"menu__list-item--collapsed":k},p)},a.createElement("div",{className:(0,l.A)("menu__list-item-collapsible",{"menu__list-item-collapsible--active":_})},a.createElement(L.A,(0,C.A)({className:(0,l.A)("menu__link",{"menu__link--sublist":b,"menu__link--sublist-caret":!h&&b,"menu__link--active":g}),onClick:b?e=>{n?.(t),h?T(!1):(e.preventDefault(),T())}:()=>{n?.(t)},"aria-current":_?"page":void 0,"aria-expanded":b?!k:void 0,href:b?f??"#":f},d),u),h&&b&&a.createElement(G,{categoryLabel:u,onClick:e=>{e.preventDefault(),T()}})),a.createElement(M.N,{lazy:!0,as:"ul",className:"menu__list",collapsed:k},a.createElement(K,{items:m,tabIndex:k?-1:0,onItemClick:n,activePath:r,level:c+1})))}var F=n(6654),W=n(2523);const D="menuExternalLink_NmtK";function z(e){let{item:t,onItemClick:n,activePath:r,level:c,index:s,...d}=e;const{href:m,label:u,className:b}=t,p=(0,o.w8)(t,r),h=(0,F.A)(m);return a.createElement("li",{className:(0,l.A)(i.G.docs.docSidebarItemLink,i.G.docs.docSidebarItemLinkLevel(c),"menu__list-item",b),key:u},a.createElement(L.A,(0,C.A)({className:(0,l.A)("menu__link",!h&&D,{"menu__link--active":p}),"aria-current":p?"page":void 0,to:m},h&&{onClick:n?()=>n(t):void 0},d),u,!h&&a.createElement(W.A,null)))}const R="menuHtmlItem_M9Kj";function U(e){let{item:t,level:n,index:o}=e;const{value:r,defaultStyle:c,className:s}=t;return a.createElement("li",{className:(0,l.A)(i.G.docs.docSidebarItemLink,i.G.docs.docSidebarItemLinkLevel(n),c&&[R,"menu__list-item"],s),key:o,dangerouslySetInnerHTML:{__html:r}})}function V(e){let{item:t,...n}=e;switch(t.type){case"category":return a.createElement(H,(0,C.A)({item:t},n));case"html":return a.createElement(U,(0,C.A)({item:t},n));default:return a.createElement(z,(0,C.A)({item:t},n))}}function j(e){let{items:t,...n}=e;return a.createElement(w,null,t.map(((e,t)=>a.createElement(V,(0,C.A)({key:t,item:e,index:t},n)))))}const K=(0,a.memo)(j),q="menu_SIkG",Y="menuWithAnnouncementBar_GW3s";function O(e){let{path:t,sidebar:n,className:o}=e;const r=function(){const{isActive:e}=(0,T.Mj)(),[t,n]=(0,a.useState)(e);return(0,b.Mq)((t=>{let{scrollY:a}=t;e&&n(0===a)}),[e]),e&&t}();return a.createElement("nav",{className:(0,l.A)("menu thin-scrollbar",q,r&&Y,o)},a.createElement("ul",{className:(0,l.A)(i.G.docs.docSidebarMenu,"menu__list")},a.createElement(K,{items:n,activePath:t,level:1})))}const X="sidebar_njMd",Z="sidebarWithHideableNavbar_wUlq",$="sidebarHidden_VK0M",J="sidebarLogo_isFc";function Q(e){let{path:t,sidebar:n,onCollapse:o,isHidden:r}=e;const{navbar:{hideOnScroll:c},docs:{sidebar:{hideable:i}}}=(0,v.p)();return a.createElement("div",{className:(0,l.A)(X,c&&Z,r&&$)},c&&a.createElement(_.A,{tabIndex:-1,className:J}),a.createElement(O,{path:t,sidebar:n}),i&&a.createElement(N,{onClick:o}))}const ee=a.memo(Q);var te=n(9876),ne=n(5600);const ae=e=>{let{sidebar:t,path:n}=e;const o=(0,te.M)();return a.createElement("ul",{className:(0,l.A)(i.G.docs.docSidebarMenu,"menu__list")},a.createElement(K,{items:t,activePath:n,onItemClick:e=>{"category"===e.type&&e.href&&o.toggle(),"link"===e.type&&o.toggle()},level:1}))};function le(e){return a.createElement(ne.GX,{component:ae,props:e})}const oe=a.memo(le);function re(e){const t=(0,g.l)(),n="desktop"===t||"ssr"===t,l="mobile"===t;return a.createElement(a.Fragment,null,n&&a.createElement(ee,e),l&&a.createElement(oe,e))}const ce={expandButton:"expandButton_m80_",expandButtonIcon:"expandButtonIcon_BlDH"};function ie(e){let{toggleSidebar:t}=e;return a.createElement("div",{className:ce.expandButton,title:(0,u.T)({id:"theme.docs.sidebar.expandButtonTitle",message:"Expand sidebar",description:"The ARIA label and title attribute for expand button of doc sidebar"}),"aria-label":(0,u.T)({id:"theme.docs.sidebar.expandButtonAriaLabel",message:"Expand sidebar",description:"The ARIA label and title attribute for expand button of doc sidebar"}),tabIndex:0,role:"button",onKeyDown:t,onClick:t},a.createElement(k,{className:ce.expandButtonIcon}))}const se={docSidebarContainer:"docSidebarContainer_b6E3",docSidebarContainerHidden:"docSidebarContainerHidden_b3ry"};function de(e){let{children:t}=e;const n=(0,d.t)();return a.createElement(a.Fragment,{key:n?.name??"noSidebar"},t)}function me(e){let{sidebar:t,hiddenSidebarContainer:n,setHiddenSidebarContainer:o}=e;const{pathname:r}=(0,f.zy)(),[c,s]=(0,a.useState)(!1),d=(0,a.useCallback)((()=>{c&&s(!1),o((e=>!e))}),[o,c]);return a.createElement("aside",{className:(0,l.A)(i.G.docs.docSidebarContainer,se.docSidebarContainer,n&&se.docSidebarContainerHidden),onTransitionEnd:e=>{e.currentTarget.classList.contains(se.docSidebarContainer)&&n&&s(!0)}},a.createElement(de,null,a.createElement(re,{sidebar:t,path:r,onCollapse:d,isHidden:c})),c&&a.createElement(ie,{toggleSidebar:d}))}const ue={docMainContainer:"docMainContainer_gTbr",docMainContainerEnhanced:"docMainContainerEnhanced_Uz_u",docItemWrapperEnhanced:"docItemWrapperEnhanced_czyv"};function be(e){let{hiddenSidebarContainer:t,children:n}=e;const o=(0,d.t)();return a.createElement("main",{className:(0,l.A)(ue.docMainContainer,(t||!o)&&ue.docMainContainerEnhanced)},a.createElement("div",{className:(0,l.A)("container padding-top--md padding-bottom--lg",ue.docItemWrapper,t&&ue.docItemWrapperEnhanced)},n))}const pe={docPage:"docPage__5DB",docsWrapper:"docsWrapper_BCFX"};function he(e){let{children:t}=e;const n=(0,d.t)(),[l,o]=(0,a.useState)(!1);return a.createElement(m.A,{wrapperClassName:pe.docsWrapper},a.createElement(E,null),a.createElement("div",{className:pe.docPage},n&&a.createElement(me,{sidebar:n.items,hiddenSidebarContainer:l,setHiddenSidebarContainer:o}),a.createElement(be,{hiddenSidebarContainer:l},t)))}var Ee=n(1774),fe=n(1463);function ge(e){const{versionMetadata:t}=e,n=(0,o.mz)(e);if(!n)return a.createElement(Ee.default,null);const{docElement:m,sidebarName:u,sidebarItems:b}=n;return a.createElement(a.Fragment,null,a.createElement(fe.A,{version:t.version,tag:(0,r.tU)(t.pluginId,t.version)}),a.createElement(c.e3,{className:(0,l.A)(i.G.wrapper.docsPages,i.G.page.docsDocPage,e.versionMetadata.className)},a.createElement(s.n,{version:t},a.createElement(d.V,{name:u,items:b},a.createElement(he,null,m)))))}},1774:(e,t,n)=>{n.r(t),n.d(t,{default:()=>c});var a=n(6540),l=n(1312),o=n(9024),r=n(8916);function c(){return a.createElement(a.Fragment,null,a.createElement(o.be,{title:(0,l.T)({id:"theme.NotFound.title",message:"Page Not Found"})}),a.createElement(r.A,null,a.createElement("main",{className:"container margin-vert--xl"},a.createElement("div",{className:"row"},a.createElement("div",{className:"col col--6 col--offset-3"},a.createElement("h1",{className:"hero__title"},a.createElement(l.A,{id:"theme.NotFound.title",description:"The title of the 404 page"},"Page Not Found")),a.createElement("p",null,a.createElement(l.A,{id:"theme.NotFound.p1",description:"The first paragraph of the 404 page"},"We could not find what you were looking for.")),a.createElement("p",null,a.createElement(l.A,{id:"theme.NotFound.p2",description:"The 2nd paragraph of the 404 page"},"Please contact the owner of the site that linked you to the original URL and let them know their link is broken.")))))))}},2252:(e,t,n)=>{n.d(t,{n:()=>r,r:()=>c});var a=n(6540),l=n(9532);const o=a.createContext(null);function r(e){let{children:t,version:n}=e;return a.createElement(o.Provider,{value:n},t)}function c(){const e=(0,a.useContext)(o);if(null===e)throw new l.dV("DocsVersionProvider");return e}}}]); \ No newline at end of file diff --git a/assets/js/1be78505.cc3d2b74.js b/assets/js/1be78505.cc3d2b74.js deleted file mode 100644 index 8c1dca50..00000000 --- a/assets/js/1be78505.cc3d2b74.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[8714,1774],{8067:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Ee});var a=n(6540),l=n(53),o=n(1754),r=n(2967),c=n(9024),i=n(7559),s=n(2252),d=n(6588),m=n(8916),u=n(1312),b=n(3104),p=n(5062);const h={backToTopButton:"backToTopButton_sjWU",backToTopButtonShow:"backToTopButtonShow_xfvO"};function E(){const{shown:e,scrollToTop:t}=function(e){let{threshold:t}=e;const[n,l]=(0,a.useState)(!1),o=(0,a.useRef)(!1),{startScroll:r,cancelScroll:c}=(0,b.gk)();return(0,b.Mq)(((e,n)=>{let{scrollY:a}=e;const r=n?.scrollY;r&&(o.current?o.current=!1:a>=r?(c(),l(!1)):a{e.location.hash&&(o.current=!0,l(!1))})),{shown:n,scrollToTop:()=>r(0)}}({threshold:300});return a.createElement("button",{"aria-label":(0,u.T)({id:"theme.BackToTopButton.buttonAriaLabel",message:"Scroll back to top",description:"The ARIA label for the back to top button"}),className:(0,l.A)("clean-btn",i.G.common.backToTopButton,h.backToTopButton,e&&h.backToTopButtonShow),type:"button",onClick:t})}var f=n(6347),g=n(4581),v=n(6342),_=n(3465),C=n(8168);function k(e){return a.createElement("svg",(0,C.A)({width:"20",height:"20","aria-hidden":"true"},e),a.createElement("g",{fill:"#7a7a7a"},a.createElement("path",{d:"M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0"}),a.createElement("path",{d:"M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0"})))}const A={collapseSidebarButton:"collapseSidebarButton_PEFL",collapseSidebarButtonIcon:"collapseSidebarButtonIcon_kv0_"};function S(e){let{onClick:t}=e;return a.createElement("button",{type:"button",title:(0,u.T)({id:"theme.docs.sidebar.collapseButtonTitle",message:"Collapse sidebar",description:"The title attribute for collapse button of doc sidebar"}),"aria-label":(0,u.T)({id:"theme.docs.sidebar.collapseButtonAriaLabel",message:"Collapse sidebar",description:"The title attribute for collapse button of doc sidebar"}),className:(0,l.A)("button button--secondary button--outline",A.collapseSidebarButton),onClick:t},a.createElement(k,{className:A.collapseSidebarButtonIcon}))}var N=n(5041),T=n(9532);const I=Symbol("EmptyContext"),x=a.createContext(I);function y(e){let{children:t}=e;const[n,l]=(0,a.useState)(null),o=(0,a.useMemo)((()=>({expandedItem:n,setExpandedItem:l})),[n]);return a.createElement(x.Provider,{value:o},t)}var B=n(9169),w=n(1422),L=n(5489),M=n(2303);function P(e){let{categoryLabel:t,onClick:n}=e;return a.createElement("button",{"aria-label":(0,u.T)({id:"theme.DocSidebarItem.toggleCollapsedCategoryAriaLabel",message:"Toggle the collapsible sidebar category '{label}'",description:"The ARIA label to toggle the collapsible sidebar category"},{label:t}),type:"button",className:"clean-btn menu__caret",onClick:n})}function H(e){let{item:t,onItemClick:n,activePath:r,level:c,index:s,...d}=e;const{items:m,label:u,collapsible:b,className:p,href:h}=t,{docs:{sidebar:{autoCollapseCategories:E}}}=(0,v.p)(),f=function(e){const t=(0,M.A)();return(0,a.useMemo)((()=>e.href?e.href:!t&&e.collapsible?(0,o._o)(e):void 0),[e,t])}(t),g=(0,o.w8)(t,r),_=(0,B.ys)(h,r),{collapsed:k,setCollapsed:A}=(0,w.u)({initialState:()=>!!b&&(!g&&t.collapsed)}),{expandedItem:S,setExpandedItem:N}=function(){const e=(0,a.useContext)(x);if(e===I)throw new T.dV("DocSidebarItemsExpandedStateProvider");return e}(),y=function(e){void 0===e&&(e=!k),N(e?null:s),A(e)};return function(e){let{isActive:t,collapsed:n,updateCollapsed:l}=e;const o=(0,T.ZC)(t);(0,a.useEffect)((()=>{t&&!o&&n&&l(!1)}),[t,o,n,l])}({isActive:g,collapsed:k,updateCollapsed:y}),(0,a.useEffect)((()=>{b&&S&&S!==s&&E&&A(!0)}),[b,S,s,A,E]),a.createElement("li",{className:(0,l.A)(i.G.docs.docSidebarItemCategory,i.G.docs.docSidebarItemCategoryLevel(c),"menu__list-item",{"menu__list-item--collapsed":k},p)},a.createElement("div",{className:(0,l.A)("menu__list-item-collapsible",{"menu__list-item-collapsible--active":_})},a.createElement(L.A,(0,C.A)({className:(0,l.A)("menu__link",{"menu__link--sublist":b,"menu__link--sublist-caret":!h&&b,"menu__link--active":g}),onClick:b?e=>{n?.(t),h?y(!1):(e.preventDefault(),y())}:()=>{n?.(t)},"aria-current":_?"page":void 0,"aria-expanded":b?!k:void 0,href:b?f??"#":f},d),u),h&&b&&a.createElement(P,{categoryLabel:u,onClick:e=>{e.preventDefault(),y()}})),a.createElement(w.N,{lazy:!0,as:"ul",className:"menu__list",collapsed:k},a.createElement(j,{items:m,tabIndex:k?-1:0,onItemClick:n,activePath:r,level:c+1})))}var G=n(6654),W=n(2523);const F={menuExternalLink:"menuExternalLink_NmtK"};function D(e){let{item:t,onItemClick:n,activePath:r,level:c,index:s,...d}=e;const{href:m,label:u,className:b}=t,p=(0,o.w8)(t,r),h=(0,G.A)(m);return a.createElement("li",{className:(0,l.A)(i.G.docs.docSidebarItemLink,i.G.docs.docSidebarItemLinkLevel(c),"menu__list-item",b),key:u},a.createElement(L.A,(0,C.A)({className:(0,l.A)("menu__link",!h&&F.menuExternalLink,{"menu__link--active":p}),"aria-current":p?"page":void 0,to:m},h&&{onClick:n?()=>n(t):void 0},d),u,!h&&a.createElement(W.A,null)))}const z={menuHtmlItem:"menuHtmlItem_M9Kj"};function R(e){let{item:t,level:n,index:o}=e;const{value:r,defaultStyle:c,className:s}=t;return a.createElement("li",{className:(0,l.A)(i.G.docs.docSidebarItemLink,i.G.docs.docSidebarItemLinkLevel(n),c&&[z.menuHtmlItem,"menu__list-item"],s),key:o,dangerouslySetInnerHTML:{__html:r}})}function U(e){let{item:t,...n}=e;switch(t.type){case"category":return a.createElement(H,(0,C.A)({item:t},n));case"html":return a.createElement(R,(0,C.A)({item:t},n));default:return a.createElement(D,(0,C.A)({item:t},n))}}function V(e){let{items:t,...n}=e;return a.createElement(y,null,t.map(((e,t)=>a.createElement(U,(0,C.A)({key:t,item:e,index:t},n)))))}const j=(0,a.memo)(V),K={menu:"menu_SIkG",menuWithAnnouncementBar:"menuWithAnnouncementBar_GW3s"};function q(e){let{path:t,sidebar:n,className:o}=e;const r=function(){const{isActive:e}=(0,N.Mj)(),[t,n]=(0,a.useState)(e);return(0,b.Mq)((t=>{let{scrollY:a}=t;e&&n(0===a)}),[e]),e&&t}();return a.createElement("nav",{className:(0,l.A)("menu thin-scrollbar",K.menu,r&&K.menuWithAnnouncementBar,o)},a.createElement("ul",{className:(0,l.A)(i.G.docs.docSidebarMenu,"menu__list")},a.createElement(j,{items:n,activePath:t,level:1})))}const Y="sidebar_njMd",O="sidebarWithHideableNavbar_wUlq",X="sidebarHidden_VK0M",Z="sidebarLogo_isFc";function $(e){let{path:t,sidebar:n,onCollapse:o,isHidden:r}=e;const{navbar:{hideOnScroll:c},docs:{sidebar:{hideable:i}}}=(0,v.p)();return a.createElement("div",{className:(0,l.A)(Y,c&&O,r&&X)},c&&a.createElement(_.A,{tabIndex:-1,className:Z}),a.createElement(q,{path:t,sidebar:n}),i&&a.createElement(S,{onClick:o}))}const J=a.memo($);var Q=n(9876),ee=n(5600);const te=e=>{let{sidebar:t,path:n}=e;const o=(0,Q.M)();return a.createElement("ul",{className:(0,l.A)(i.G.docs.docSidebarMenu,"menu__list")},a.createElement(j,{items:t,activePath:n,onItemClick:e=>{"category"===e.type&&e.href&&o.toggle(),"link"===e.type&&o.toggle()},level:1}))};function ne(e){return a.createElement(ee.GX,{component:te,props:e})}const ae=a.memo(ne);function le(e){const t=(0,g.l)(),n="desktop"===t||"ssr"===t,l="mobile"===t;return a.createElement(a.Fragment,null,n&&a.createElement(J,e),l&&a.createElement(ae,e))}const oe={expandButton:"expandButton_m80_",expandButtonIcon:"expandButtonIcon_BlDH"};function re(e){let{toggleSidebar:t}=e;return a.createElement("div",{className:oe.expandButton,title:(0,u.T)({id:"theme.docs.sidebar.expandButtonTitle",message:"Expand sidebar",description:"The ARIA label and title attribute for expand button of doc sidebar"}),"aria-label":(0,u.T)({id:"theme.docs.sidebar.expandButtonAriaLabel",message:"Expand sidebar",description:"The ARIA label and title attribute for expand button of doc sidebar"}),tabIndex:0,role:"button",onKeyDown:t,onClick:t},a.createElement(k,{className:oe.expandButtonIcon}))}const ce={docSidebarContainer:"docSidebarContainer_b6E3",docSidebarContainerHidden:"docSidebarContainerHidden_b3ry"};function ie(e){let{children:t}=e;const n=(0,d.t)();return a.createElement(a.Fragment,{key:n?.name??"noSidebar"},t)}function se(e){let{sidebar:t,hiddenSidebarContainer:n,setHiddenSidebarContainer:o}=e;const{pathname:r}=(0,f.zy)(),[c,s]=(0,a.useState)(!1),d=(0,a.useCallback)((()=>{c&&s(!1),o((e=>!e))}),[o,c]);return a.createElement("aside",{className:(0,l.A)(i.G.docs.docSidebarContainer,ce.docSidebarContainer,n&&ce.docSidebarContainerHidden),onTransitionEnd:e=>{e.currentTarget.classList.contains(ce.docSidebarContainer)&&n&&s(!0)}},a.createElement(ie,null,a.createElement(le,{sidebar:t,path:r,onCollapse:d,isHidden:c})),c&&a.createElement(re,{toggleSidebar:d}))}const de={docMainContainer:"docMainContainer_gTbr",docMainContainerEnhanced:"docMainContainerEnhanced_Uz_u",docItemWrapperEnhanced:"docItemWrapperEnhanced_czyv"};function me(e){let{hiddenSidebarContainer:t,children:n}=e;const o=(0,d.t)();return a.createElement("main",{className:(0,l.A)(de.docMainContainer,(t||!o)&&de.docMainContainerEnhanced)},a.createElement("div",{className:(0,l.A)("container padding-top--md padding-bottom--lg",de.docItemWrapper,t&&de.docItemWrapperEnhanced)},n))}const ue={docPage:"docPage__5DB",docsWrapper:"docsWrapper_BCFX"};function be(e){let{children:t}=e;const n=(0,d.t)(),[l,o]=(0,a.useState)(!1);return a.createElement(m.A,{wrapperClassName:ue.docsWrapper},a.createElement(E,null),a.createElement("div",{className:ue.docPage},n&&a.createElement(se,{sidebar:n.items,hiddenSidebarContainer:l,setHiddenSidebarContainer:o}),a.createElement(me,{hiddenSidebarContainer:l},t)))}var pe=n(1774),he=n(1463);function Ee(e){const{versionMetadata:t}=e,n=(0,o.mz)(e);if(!n)return a.createElement(pe.default,null);const{docElement:m,sidebarName:u,sidebarItems:b}=n;return a.createElement(a.Fragment,null,a.createElement(he.A,{version:t.version,tag:(0,r.tU)(t.pluginId,t.version)}),a.createElement(c.e3,{className:(0,l.A)(i.G.wrapper.docsPages,i.G.page.docsDocPage,e.versionMetadata.className)},a.createElement(s.n,{version:t},a.createElement(d.V,{name:u,items:b},a.createElement(be,null,m)))))}},1774:(e,t,n)=>{n.r(t),n.d(t,{default:()=>c});var a=n(6540),l=n(1312),o=n(9024),r=n(8916);function c(){return a.createElement(a.Fragment,null,a.createElement(o.be,{title:(0,l.T)({id:"theme.NotFound.title",message:"Page Not Found"})}),a.createElement(r.A,null,a.createElement("main",{className:"container margin-vert--xl"},a.createElement("div",{className:"row"},a.createElement("div",{className:"col col--6 col--offset-3"},a.createElement("h1",{className:"hero__title"},a.createElement(l.A,{id:"theme.NotFound.title",description:"The title of the 404 page"},"Page Not Found")),a.createElement("p",null,a.createElement(l.A,{id:"theme.NotFound.p1",description:"The first paragraph of the 404 page"},"We could not find what you were looking for.")),a.createElement("p",null,a.createElement(l.A,{id:"theme.NotFound.p2",description:"The 2nd paragraph of the 404 page"},"Please contact the owner of the site that linked you to the original URL and let them know their link is broken.")))))))}},2252:(e,t,n)=>{n.d(t,{n:()=>r,r:()=>c});var a=n(6540),l=n(9532);const o=a.createContext(null);function r(e){let{children:t,version:n}=e;return a.createElement(o.Provider,{value:n},t)}function c(){const e=(0,a.useContext)(o);if(null===e)throw new l.dV("DocsVersionProvider");return e}}}]); \ No newline at end of file diff --git a/assets/js/2025.19a2b888.js b/assets/js/2025.19a2b888.js new file mode 100644 index 00000000..cb2ef1a3 --- /dev/null +++ b/assets/js/2025.19a2b888.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[2025],{1107:(e,n,t)=>{t.d(n,{A:()=>o});var a=t(8168),l=t(6540),r=t(53),i=t(1312),c=t(6342);const s={anchorWithStickyNavbar:"anchorWithStickyNavbar_LWe7",anchorWithHideOnScrollNavbar:"anchorWithHideOnScrollNavbar_WYt5"};function o(e){let{as:n,id:t,...o}=e;const{navbar:{hideOnScroll:m}}=(0,c.p)();return"h1"!==n&&t?l.createElement(n,(0,a.A)({},o,{className:(0,r.A)("anchor",m?s.anchorWithHideOnScrollNavbar:s.anchorWithStickyNavbar),id:t}),o.children,l.createElement("a",{className:"hash-link",href:`#${t}`,title:(0,i.T)({id:"theme.common.headingLinkTitle",message:"Direct link to heading",description:"Title for link to heading"})},"\u200b")):l.createElement(n,(0,a.A)({},o,{id:void 0}))}},1363:(e,n,t)=>{t.d(n,{A:()=>k});var a=t(6540),l=t(5680),r=t(8168),i=t(5260);var c=t(9324);var s=t(5489);var o=t(53),m=t(2303),d=t(1422);const u="details_lb9f",f="isBrowser_bmU9",h="collapsibleContent_i85q";function p(e){return!!e&&("SUMMARY"===e.tagName||p(e.parentElement))}function v(e,n){return!!e&&(e===n||v(e.parentElement,n))}function g(e){let{summary:n,children:t,...l}=e;const i=(0,m.A)(),c=(0,a.useRef)(null),{collapsed:s,setCollapsed:g}=(0,d.u)({initialState:!l.open}),[E,A]=(0,a.useState)(l.open);return a.createElement("details",(0,r.A)({},l,{ref:c,open:E,"data-collapsed":s,className:(0,o.A)(u,i&&f,l.className),onMouseDown:e=>{p(e.target)&&e.detail>1&&e.preventDefault()},onClick:e=>{e.stopPropagation();const n=e.target;p(n)&&v(n,c.current)&&(e.preventDefault(),s?(g(!1),A(!0)):g(!0))}}),n??a.createElement("summary",null,"Details"),a.createElement(d.N,{lazy:!1,collapsed:s,disableSSRStyle:!0,onCollapseTransitionEnd:e=>{g(e),A(!e)}},a.createElement("div",{className:h},t)))}const E="details_b_Ee";function A(e){let{...n}=e;return a.createElement(g,(0,r.A)({},n,{className:(0,o.A)("alert alert--info",E,n.className)}))}var N=t(1107);function b(e){return a.createElement(N.A,e)}const C="containsTaskList_mC6p";const L="img_ev3q";const y={head:function(e){const n=a.Children.map(e.children,(e=>a.isValidElement(e)?function(e){if(e.props?.mdxType&&e.props.originalType){const{mdxType:n,originalType:t,...l}=e.props;return a.createElement(e.props.originalType,l)}return e}(e):e));return a.createElement(i.A,e,n)},code:function(e){const n=["a","b","big","i","span","em","strong","sup","sub","small"];return a.Children.toArray(e.children).every((e=>"string"==typeof e&&!e.includes("\n")||(0,a.isValidElement)(e)&&n.includes(e.props.mdxType)))?a.createElement("code",e):a.createElement(c.A,e)},a:function(e){return a.createElement(s.A,e)},pre:function(e){return a.createElement(c.A,(0,a.isValidElement)(e.children)&&"code"===e.children.props?.originalType?e.children.props:{...e})},details:function(e){const n=a.Children.toArray(e.children),t=n.find((e=>a.isValidElement(e)&&"summary"===e.props?.mdxType)),l=a.createElement(a.Fragment,null,n.filter((e=>e!==t)));return a.createElement(A,(0,r.A)({},e,{summary:t}),l)},ul:function(e){return a.createElement("ul",(0,r.A)({},e,{className:(n=e.className,(0,o.A)(n,n?.includes("contains-task-list")&&C))}));var n},img:function(e){return a.createElement("img",(0,r.A)({loading:"lazy"},e,{className:(n=e.className,(0,o.A)(n,L))}));var n},h1:e=>a.createElement(b,(0,r.A)({as:"h1"},e)),h2:e=>a.createElement(b,(0,r.A)({as:"h2"},e)),h3:e=>a.createElement(b,(0,r.A)({as:"h3"},e)),h4:e=>a.createElement(b,(0,r.A)({as:"h4"},e)),h5:e=>a.createElement(b,(0,r.A)({as:"h5"},e)),h6:e=>a.createElement(b,(0,r.A)({as:"h6"},e))};function k(e){let{children:n}=e;return a.createElement(l.xA,{components:y},n)}},7763:(e,n,t)=>{t.d(n,{A:()=>m});var a=t(8168),l=t(6540),r=t(53),i=t(5195);const c={tableOfContents:"tableOfContents_bqdL",docItemContainer:"docItemContainer_F8PC"},s="table-of-contents__link toc-highlight",o="table-of-contents__link--active";function m(e){let{className:n,...t}=e;return l.createElement("div",{className:(0,r.A)(c.tableOfContents,"thin-scrollbar",n)},l.createElement(i.A,(0,a.A)({},t,{linkClassName:s,linkActiveClassName:o})))}},5195:(e,n,t)=>{t.d(n,{A:()=>h});var a=t(8168),l=t(6540),r=t(6342);function i(e){const n=e.map((e=>({...e,parentIndex:-1,children:[]}))),t=Array(7).fill(-1);n.forEach(((e,n)=>{const a=t.slice(2,e.level);e.parentIndex=Math.max(...a),t[e.level]=n}));const a=[];return n.forEach((e=>{const{parentIndex:t,...l}=e;t>=0?n[t].children.push(l):a.push(l)})),a}function c(e){let{toc:n,minHeadingLevel:t,maxHeadingLevel:a}=e;return n.flatMap((e=>{const n=c({toc:e.children,minHeadingLevel:t,maxHeadingLevel:a});return function(e){return e.level>=t&&e.level<=a}(e)?[{...e,children:n}]:n}))}function s(e){const n=e.getBoundingClientRect();return n.top===n.bottom?s(e.parentNode):n}function o(e,n){let{anchorTopOffset:t}=n;const a=e.find((e=>s(e).top>=t));if(a){return function(e){return e.top>0&&e.bottom{e.current=n?0:document.querySelector(".navbar").clientHeight}),[n]),e}function d(e){const n=(0,l.useRef)(void 0),t=m();(0,l.useEffect)((()=>{if(!e)return()=>{};const{linkClassName:a,linkActiveClassName:l,minHeadingLevel:r,maxHeadingLevel:i}=e;function c(){const e=function(e){return Array.from(document.getElementsByClassName(e))}(a),c=function(e){let{minHeadingLevel:n,maxHeadingLevel:t}=e;const a=[];for(let l=n;l<=t;l+=1)a.push(`h${l}.anchor`);return Array.from(document.querySelectorAll(a.join()))}({minHeadingLevel:r,maxHeadingLevel:i}),s=o(c,{anchorTopOffset:t.current}),m=e.find((e=>s&&s.id===function(e){return decodeURIComponent(e.href.substring(e.href.indexOf("#")+1))}(e)));e.forEach((e=>{!function(e,t){t?(n.current&&n.current!==e&&n.current.classList.remove(l),e.classList.add(l),n.current=e):e.classList.remove(l)}(e,e===m)}))}return document.addEventListener("scroll",c),document.addEventListener("resize",c),c(),()=>{document.removeEventListener("scroll",c),document.removeEventListener("resize",c)}}),[e,t])}function u(e){let{toc:n,className:t,linkClassName:a,isChild:r}=e;return n.length?l.createElement("ul",{className:r?void 0:t},n.map((e=>l.createElement("li",{key:e.id},l.createElement("a",{href:`#${e.id}`,className:a??void 0,dangerouslySetInnerHTML:{__html:e.value}}),l.createElement(u,{isChild:!0,toc:e.children,className:t,linkClassName:a}))))):null}const f=l.memo(u);function h(e){let{toc:n,className:t="table-of-contents table-of-contents__left-border",linkClassName:s="table-of-contents__link",linkActiveClassName:o,minHeadingLevel:m,maxHeadingLevel:u,...h}=e;const p=(0,r.p)(),v=m??p.tableOfContents.minHeadingLevel,g=u??p.tableOfContents.maxHeadingLevel,E=function(e){let{toc:n,minHeadingLevel:t,maxHeadingLevel:a}=e;return(0,l.useMemo)((()=>c({toc:i(n),minHeadingLevel:t,maxHeadingLevel:a})),[n,t,a])}({toc:n,minHeadingLevel:v,maxHeadingLevel:g});return d((0,l.useMemo)((()=>{if(s&&o)return{linkClassName:s,linkActiveClassName:o,minHeadingLevel:v,maxHeadingLevel:g}}),[s,o,v,g])),l.createElement(f,(0,a.A)({toc:E,className:t,linkClassName:s},h))}}}]); \ No newline at end of file diff --git a/assets/js/2025.a5ad8a15.js b/assets/js/2025.a5ad8a15.js deleted file mode 100644 index d9320297..00000000 --- a/assets/js/2025.a5ad8a15.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[2025],{1107:(e,n,t)=>{t.d(n,{A:()=>o});var a=t(8168),l=t(6540),r=t(53),i=t(1312),s=t(6342);const c={anchorWithStickyNavbar:"anchorWithStickyNavbar_LWe7",anchorWithHideOnScrollNavbar:"anchorWithHideOnScrollNavbar_WYt5"};function o(e){let{as:n,id:t,...o}=e;const{navbar:{hideOnScroll:m}}=(0,s.p)();return"h1"!==n&&t?l.createElement(n,(0,a.A)({},o,{className:(0,r.A)("anchor",m?c.anchorWithHideOnScrollNavbar:c.anchorWithStickyNavbar),id:t}),o.children,l.createElement("a",{className:"hash-link",href:`#${t}`,title:(0,i.T)({id:"theme.common.headingLinkTitle",message:"Direct link to heading",description:"Title for link to heading"})},"\u200b")):l.createElement(n,(0,a.A)({},o,{id:void 0}))}},1363:(e,n,t)=>{t.d(n,{A:()=>k});var a=t(6540),l=t(5680),r=t(8168),i=t(5260);var s=t(9324);var c=t(5489);var o=t(53),m=t(2303),d=t(1422);const u={details:"details_lb9f",isBrowser:"isBrowser_bmU9",collapsibleContent:"collapsibleContent_i85q"};function f(e){return!!e&&("SUMMARY"===e.tagName||f(e.parentElement))}function h(e,n){return!!e&&(e===n||h(e.parentElement,n))}function p(e){let{summary:n,children:t,...l}=e;const i=(0,m.A)(),s=(0,a.useRef)(null),{collapsed:c,setCollapsed:p}=(0,d.u)({initialState:!l.open}),[v,g]=(0,a.useState)(l.open);return a.createElement("details",(0,r.A)({},l,{ref:s,open:v,"data-collapsed":c,className:(0,o.A)(u.details,i&&u.isBrowser,l.className),onMouseDown:e=>{f(e.target)&&e.detail>1&&e.preventDefault()},onClick:e=>{e.stopPropagation();const n=e.target;f(n)&&h(n,s.current)&&(e.preventDefault(),c?(p(!1),g(!0)):p(!0))}}),n??a.createElement("summary",null,"Details"),a.createElement(d.N,{lazy:!1,collapsed:c,disableSSRStyle:!0,onCollapseTransitionEnd:e=>{p(e),g(!e)}},a.createElement("div",{className:u.collapsibleContent},t)))}const v={details:"details_b_Ee"},g="alert alert--info";function E(e){let{...n}=e;return a.createElement(p,(0,r.A)({},n,{className:(0,o.A)(g,v.details,n.className)}))}var A=t(1107);function b(e){return a.createElement(A.A,e)}const N={containsTaskList:"containsTaskList_mC6p"};const C={img:"img_ev3q"};const L={head:function(e){const n=a.Children.map(e.children,(e=>a.isValidElement(e)?function(e){if(e.props?.mdxType&&e.props.originalType){const{mdxType:n,originalType:t,...l}=e.props;return a.createElement(e.props.originalType,l)}return e}(e):e));return a.createElement(i.A,e,n)},code:function(e){const n=["a","b","big","i","span","em","strong","sup","sub","small"];return a.Children.toArray(e.children).every((e=>"string"==typeof e&&!e.includes("\n")||(0,a.isValidElement)(e)&&n.includes(e.props.mdxType)))?a.createElement("code",e):a.createElement(s.A,e)},a:function(e){return a.createElement(c.A,e)},pre:function(e){return a.createElement(s.A,(0,a.isValidElement)(e.children)&&"code"===e.children.props?.originalType?e.children.props:{...e})},details:function(e){const n=a.Children.toArray(e.children),t=n.find((e=>a.isValidElement(e)&&"summary"===e.props?.mdxType)),l=a.createElement(a.Fragment,null,n.filter((e=>e!==t)));return a.createElement(E,(0,r.A)({},e,{summary:t}),l)},ul:function(e){return a.createElement("ul",(0,r.A)({},e,{className:(n=e.className,(0,o.A)(n,n?.includes("contains-task-list")&&N.containsTaskList))}));var n},img:function(e){return a.createElement("img",(0,r.A)({loading:"lazy"},e,{className:(n=e.className,(0,o.A)(n,C.img))}));var n},h1:e=>a.createElement(b,(0,r.A)({as:"h1"},e)),h2:e=>a.createElement(b,(0,r.A)({as:"h2"},e)),h3:e=>a.createElement(b,(0,r.A)({as:"h3"},e)),h4:e=>a.createElement(b,(0,r.A)({as:"h4"},e)),h5:e=>a.createElement(b,(0,r.A)({as:"h5"},e)),h6:e=>a.createElement(b,(0,r.A)({as:"h6"},e))};function k(e){let{children:n}=e;return a.createElement(l.xA,{components:L},n)}},7763:(e,n,t)=>{t.d(n,{A:()=>m});var a=t(8168),l=t(6540),r=t(53),i=t(5195);const s={tableOfContents:"tableOfContents_bqdL",docItemContainer:"docItemContainer_F8PC"},c="table-of-contents__link toc-highlight",o="table-of-contents__link--active";function m(e){let{className:n,...t}=e;return l.createElement("div",{className:(0,r.A)(s.tableOfContents,"thin-scrollbar",n)},l.createElement(i.A,(0,a.A)({},t,{linkClassName:c,linkActiveClassName:o})))}},5195:(e,n,t)=>{t.d(n,{A:()=>h});var a=t(8168),l=t(6540),r=t(6342);function i(e){const n=e.map((e=>({...e,parentIndex:-1,children:[]}))),t=Array(7).fill(-1);n.forEach(((e,n)=>{const a=t.slice(2,e.level);e.parentIndex=Math.max(...a),t[e.level]=n}));const a=[];return n.forEach((e=>{const{parentIndex:t,...l}=e;t>=0?n[t].children.push(l):a.push(l)})),a}function s(e){let{toc:n,minHeadingLevel:t,maxHeadingLevel:a}=e;return n.flatMap((e=>{const n=s({toc:e.children,minHeadingLevel:t,maxHeadingLevel:a});return function(e){return e.level>=t&&e.level<=a}(e)?[{...e,children:n}]:n}))}function c(e){const n=e.getBoundingClientRect();return n.top===n.bottom?c(e.parentNode):n}function o(e,n){let{anchorTopOffset:t}=n;const a=e.find((e=>c(e).top>=t));if(a){return function(e){return e.top>0&&e.bottom{e.current=n?0:document.querySelector(".navbar").clientHeight}),[n]),e}function d(e){const n=(0,l.useRef)(void 0),t=m();(0,l.useEffect)((()=>{if(!e)return()=>{};const{linkClassName:a,linkActiveClassName:l,minHeadingLevel:r,maxHeadingLevel:i}=e;function s(){const e=function(e){return Array.from(document.getElementsByClassName(e))}(a),s=function(e){let{minHeadingLevel:n,maxHeadingLevel:t}=e;const a=[];for(let l=n;l<=t;l+=1)a.push(`h${l}.anchor`);return Array.from(document.querySelectorAll(a.join()))}({minHeadingLevel:r,maxHeadingLevel:i}),c=o(s,{anchorTopOffset:t.current}),m=e.find((e=>c&&c.id===function(e){return decodeURIComponent(e.href.substring(e.href.indexOf("#")+1))}(e)));e.forEach((e=>{!function(e,t){t?(n.current&&n.current!==e&&n.current.classList.remove(l),e.classList.add(l),n.current=e):e.classList.remove(l)}(e,e===m)}))}return document.addEventListener("scroll",s),document.addEventListener("resize",s),s(),()=>{document.removeEventListener("scroll",s),document.removeEventListener("resize",s)}}),[e,t])}function u(e){let{toc:n,className:t,linkClassName:a,isChild:r}=e;return n.length?l.createElement("ul",{className:r?void 0:t},n.map((e=>l.createElement("li",{key:e.id},l.createElement("a",{href:`#${e.id}`,className:a??void 0,dangerouslySetInnerHTML:{__html:e.value}}),l.createElement(u,{isChild:!0,toc:e.children,className:t,linkClassName:a}))))):null}const f=l.memo(u);function h(e){let{toc:n,className:t="table-of-contents table-of-contents__left-border",linkClassName:c="table-of-contents__link",linkActiveClassName:o,minHeadingLevel:m,maxHeadingLevel:u,...h}=e;const p=(0,r.p)(),v=m??p.tableOfContents.minHeadingLevel,g=u??p.tableOfContents.maxHeadingLevel,E=function(e){let{toc:n,minHeadingLevel:t,maxHeadingLevel:a}=e;return(0,l.useMemo)((()=>s({toc:i(n),minHeadingLevel:t,maxHeadingLevel:a})),[n,t,a])}({toc:n,minHeadingLevel:v,maxHeadingLevel:g});return d((0,l.useMemo)((()=>{if(c&&o)return{linkClassName:c,linkActiveClassName:o,minHeadingLevel:v,maxHeadingLevel:g}}),[c,o,v,g])),l.createElement(f,(0,a.A)({toc:E,className:t,linkClassName:c},h))}}}]); \ No newline at end of file diff --git a/assets/js/26eba521.ab50ddbe.js b/assets/js/26eba521.72d0a1b3.js similarity index 96% rename from assets/js/26eba521.ab50ddbe.js rename to assets/js/26eba521.72d0a1b3.js index 3282a668..3d0df195 100644 --- a/assets/js/26eba521.ab50ddbe.js +++ b/assets/js/26eba521.72d0a1b3.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[6571],{5680:(e,a,n)=>{n.d(a,{xA:()=>s,yg:()=>y});var t=n(6540);function r(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function i(e){for(var a=1;a=0||(r[n]=e[n]);return r}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=t.createContext({}),g=function(e){var a=t.useContext(p),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},s=function(e){var a=g(e.components);return t.createElement(p.Provider,{value:a},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},c=t.forwardRef((function(e,a){var n=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),m=g(n),c=r,y=m["".concat(p,".").concat(c)]||m[c]||d[c]||l;return n?t.createElement(y,i(i({ref:a},s),{},{components:n})):t.createElement(y,i({ref:a},s))}));function y(e,a){var n=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=c;var o={};for(var p in a)hasOwnProperty.call(a,p)&&(o[p]=a[p]);o.originalType=e,o[m]="string"==typeof e?e:r,i[1]=o;for(var g=2;g{n.r(a),n.d(a,{assets:()=>p,contentTitle:()=>i,default:()=>d,frontMatter:()=>l,metadata:()=>o,toc:()=>g});var t=n(8168),r=(n(6540),n(5680));const l={id:"core_src",title:"Package: @memlab/core",sidebar_label:"core/src",sidebar_position:0,custom_edit_url:null},i=void 0,o={unversionedId:"api/modules/core_src",id:"api/modules/core_src",title:"Package: @memlab/core",description:"Interfaces",source:"@site/docs/api/modules/core_src.md",sourceDirName:"api/modules",slug:"/api/modules/core_src",permalink:"/memlab/docs/api/modules/core_src",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"core_src",title:"Package: @memlab/core",sidebar_label:"core/src",sidebar_position:0,custom_edit_url:null},sidebar:"sidebar",previous:{title:"api/src",permalink:"/memlab/docs/api/modules/api_src"},next:{title:"heap-analysis/src",permalink:"/memlab/docs/api/modules/heap_analysis_src"}},p={},g=[{value:"Interfaces",id:"interfaces",level:2},{value:"Type Aliases",id:"type-aliases",level:2},{value:' CheckPageLoadCallback: (page: Page) => Promise<boolean>',id:"-checkpageloadcallback-page-page--promiseboolean",level:3},{value:' Cookie: Object',id:"-cookie-object",level:3},{value:' Cookies: Cookie[]',id:"-cookies-cookie",level:3},{value:' EdgeIterationCallback: (edge: IHeapEdge) => Optional<{ stop: boolean }> | void',id:"-edgeiterationcallback-edge-iheapedge--optional-stop-boolean----void",level:3},{value:' InitLeakFilterCallback: (snapshot: IHeapSnapshot, leakedNodeIds: HeapNodeIdSet) => void',id:"-initleakfiltercallback-snapshot-iheapsnapshot-leakednodeids-heapnodeidset--void",level:3},{value:' InteractionsCallback: (page: Page, args?: OperationArgs) => Promise<void>',id:"-interactionscallback-page-page-args-operationargs--promisevoid",level:3},{value:' LeakFilterCallback: (node: IHeapNode, snapshot: IHeapSnapshot, leakedNodeIds: HeapNodeIdSet) => boolean',id:"-leakfiltercallback-node-iheapnode-snapshot-iheapsnapshot-leakednodeids-heapnodeidset--boolean",level:3},{value:' Nullable<T>: T | null',id:"-nullablet-t--null",level:3},{value:"Type parameters",id:"type-parameters",level:4},{value:' Optional<T>: T | null | undefined',id:"-optionalt-t--null--undefined",level:3},{value:"Type parameters",id:"type-parameters-1",level:4},{value:' Page: PuppeteerPage',id:"-page-puppeteerpage",level:3},{value:' Predicator<T>: (entity: T) => boolean',id:"-predicatort-entity-t--boolean",level:3},{value:"Type parameters",id:"type-parameters-2",level:4},{value:' ReferenceFilterCallback: (edge: IHeapEdge, snapshot: IHeapSnapshot, isReferenceUsedByDefault: boolean) => boolean',id:"-referencefiltercallback-edge-iheapedge-snapshot-iheapsnapshot-isreferenceusedbydefault-boolean--boolean",level:3},{value:' RunMetaInfo: Object',id:"-runmetainfo-object",level:3},{value:' Undefinable<T>: T | undefined',id:"-undefinablet-t--undefined",level:3},{value:"Type parameters",id:"type-parameters-3",level:4},{value:"Functions",id:"functions",level:2},{value:'dumpNodeHeapSnapshot()',id:"dumpnodeheapsnapshot",level:3},{value:'tagObject<T>(o, tag)',id:"tagobjectto-tag",level:3},{value:"Type parameters",id:"type-parameters-4",level:4},{value:'takeNodeMinimalHeap()',id:"takenodeminimalheap",level:3}],s={toc:g},m="wrapper";function d(e){let{components:a,...n}=e;return(0,r.yg)(m,(0,t.A)({},s,n,{components:a,mdxType:"MDXLayout"}),(0,r.yg)("h2",{id:"interfaces"},"Interfaces"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IBrowserInfo"},"IBrowserInfo")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},"IHeapEdge")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdges"},"IHeapEdges")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapLocation"},"IHeapLocation")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},"IHeapNode")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapNodes"},"IHeapNodes")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapStringNode"},"IHeapStringNode")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.ILeakFilter"},"ILeakFilter")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IScenario"},"IScenario"))),(0,r.yg)("h2",{id:"type-aliases"},"Type Aliases"),(0,r.yg)("h3",{id:"-checkpageloadcallback-page-page--promiseboolean"},(0,r.yg)("a",{id:"checkpageloadcallback",name:"checkpageloadcallback"})," ",(0,r.yg)("strong",{parentName:"h3"},"CheckPageLoadCallback"),": (",(0,r.yg)("inlineCode",{parentName:"h3"},"page"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page")),") => ",(0,r.yg)("inlineCode",{parentName:"h3"},"Promise"),"<",(0,r.yg)("inlineCode",{parentName:"h3"},"boolean"),">"),(0,r.yg)("p",null,"Callback function to provide if the page is loaded.\nFor concrete example, check out ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IScenario#ispageloaded"},"isPageLoaded"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"page"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page"))," | puppeteer's ",(0,r.yg)("a",{parentName:"li",href:"https://pptr.dev/api/puppeteer.page/"},"Page")," object. To import this type, check out ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"),"."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.yg)("inlineCode",{parentName:"p"},"boolean"),">"," | a boolean value, if it returns ",(0,r.yg)("inlineCode",{parentName:"p"},"true"),", memlab will consider\nthe navigation completes, if it returns ",(0,r.yg)("inlineCode",{parentName:"p"},"false"),", memlab will keep calling\nthis callback until it returns ",(0,r.yg)("inlineCode",{parentName:"p"},"true"),". This is an async callback, you can\nalso ",(0,r.yg)("inlineCode",{parentName:"p"},"await")," and returns ",(0,r.yg)("inlineCode",{parentName:"p"},"true")," until some async logic is resolved.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Source"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1166"},"core/src/lib/Types.ts:1166"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-cookie-object"},(0,r.yg)("a",{id:"cookie",name:"cookie"})," ",(0,r.yg)("strong",{parentName:"h3"},"Cookie"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"Object")),(0,r.yg)("p",null,"A single cookie entry in a Cookies list.\nThe ",(0,r.yg)("inlineCode",{parentName:"p"},"name")," and ",(0,r.yg)("inlineCode",{parentName:"p"},"value")," field is mandatory.\nIt is better to also specify the ",(0,r.yg)("inlineCode",{parentName:"p"},"domain")," field, otherwise MemLab\nwill try to infer ",(0,r.yg)("inlineCode",{parentName:"p"},"domain")," automatically.\nThe other fields are optional.\nFor concrete use case, please check out ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IScenario#cookies"},"cookies"),"."),(0,r.yg)("table",null,(0,r.yg)("thead",{parentName:"table"},(0,r.yg)("tr",{parentName:"thead"},(0,r.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Type"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.yg)("tbody",{parentName:"table"},(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"domain?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"string")),(0,r.yg)("td",{parentName:"tr",align:"left"},"Add when possible: Defines the domain associated with the cookie")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"expires?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/modules/core_src#undefinable"},(0,r.yg)("inlineCode",{parentName:"a"},"Undefinable")),"<",(0,r.yg)("inlineCode",{parentName:"td"},"number"),">"),(0,r.yg)("td",{parentName:"tr",align:"left"},"Optional: Indicates when the cookie will expire, in Unix time (seconds)")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"httpOnly?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/modules/core_src#undefinable"},(0,r.yg)("inlineCode",{parentName:"a"},"Undefinable")),"<",(0,r.yg)("inlineCode",{parentName:"td"},"boolean"),">"),(0,r.yg)("td",{parentName:"tr",align:"left"},"Optional: Flag to determine if the cookie is accessible only over HTTP")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"name")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"string")),(0,r.yg)("td",{parentName:"tr",align:"left"},"Mandatory: Represents the name of the cookie")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"path?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/modules/core_src#undefinable"},(0,r.yg)("inlineCode",{parentName:"a"},"Undefinable")),"<",(0,r.yg)("inlineCode",{parentName:"td"},"string"),">"),(0,r.yg)("td",{parentName:"tr",align:"left"},"Optional: Defines the domain associated with the cookie")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"sameSite?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/modules/core_src#undefinable"},(0,r.yg)("inlineCode",{parentName:"a"},"Undefinable")),"<",(0,r.yg)("inlineCode",{parentName:"td"},'"Strict"')," ","|"," ",(0,r.yg)("inlineCode",{parentName:"td"},'"Lax"'),">"),(0,r.yg)("td",{parentName:"tr",align:"left"},"Optional: Determines if a cookie is transmitted with cross-site requests, offering a degree of defense against cross-site request forgery attacks.")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"secure?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/modules/core_src#undefinable"},(0,r.yg)("inlineCode",{parentName:"a"},"Undefinable")),"<",(0,r.yg)("inlineCode",{parentName:"td"},"boolean"),">"),(0,r.yg)("td",{parentName:"tr",align:"left"},"Optional: Flag to indicate if the cookie transmission requires a secure protocol (e.g., HTTPS)")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"session?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/modules/core_src#undefinable"},(0,r.yg)("inlineCode",{parentName:"a"},"Undefinable")),"<",(0,r.yg)("inlineCode",{parentName:"td"},"boolean"),">"),(0,r.yg)("td",{parentName:"tr",align:"left"},"Optional: Flag to check if the cookie is a session cookie")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"url?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/modules/core_src#undefinable"},(0,r.yg)("inlineCode",{parentName:"a"},"Undefinable")),"<",(0,r.yg)("inlineCode",{parentName:"td"},"string"),">"),(0,r.yg)("td",{parentName:"tr",align:"left"},"Optional: Specifies the request-URI linked with the cookie setup. This can influence the cookie's default domain and path")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"value")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"string")),(0,r.yg)("td",{parentName:"tr",align:"left"},"Mandatory: Represents the value assigned to the cookie")))),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L236"},"core/src/lib/Types.ts:236"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-cookies-cookie"},(0,r.yg)("a",{id:"cookies",name:"cookies"})," ",(0,r.yg)("strong",{parentName:"h3"},"Cookies"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#cookie"},(0,r.yg)("inlineCode",{parentName:"a"},"Cookie")),"[]"),(0,r.yg)("p",null,"Data structure for holding cookies.\nFor concrete use case, please check out ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IScenario#cookies"},"cookies"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L226"},"core/src/lib/Types.ts:226"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-edgeiterationcallback-edge-iheapedge--optional-stop-boolean----void"},(0,r.yg)("a",{id:"edgeiterationcallback",name:"edgeiterationcallback"})," ",(0,r.yg)("strong",{parentName:"h3"},"EdgeIterationCallback"),": (",(0,r.yg)("inlineCode",{parentName:"h3"},"edge"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),") => ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#optional"},(0,r.yg)("inlineCode",{parentName:"a"},"Optional")),"<{ ",(0,r.yg)("inlineCode",{parentName:"h3"},"stop"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"boolean")," }",">"," ","|"," ",(0,r.yg)("inlineCode",{parentName:"h3"},"void")),(0,r.yg)("p",null,"Executes a provided callback once for JavaScript references.\nFor concrete examples, check out ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode#foreachreference"},"forEachReference"),"\nor ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode#foreachreferrer"},"forEachReferrer"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"edge"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapEdge"))))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#optional"},(0,r.yg)("inlineCode",{parentName:"a"},"Optional")),"<{ ",(0,r.yg)("inlineCode",{parentName:"p"},"stop"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"boolean")," }",">"," ","|"," ",(0,r.yg)("inlineCode",{parentName:"p"},"void")," | this API returns void")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Source"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1795"},"core/src/lib/Types.ts:1795"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-initleakfiltercallback-snapshot-iheapsnapshot-leakednodeids-heapnodeidset--void"},(0,r.yg)("a",{id:"initleakfiltercallback",name:"initleakfiltercallback"})," ",(0,r.yg)("strong",{parentName:"h3"},"InitLeakFilterCallback"),": (",(0,r.yg)("inlineCode",{parentName:"h3"},"snapshot"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot")),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"leakedNodeIds"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"HeapNodeIdSet"),") => ",(0,r.yg)("inlineCode",{parentName:"h3"},"void")),(0,r.yg)("p",null,"Lifecycle function callback that is invoked initially once before calling any\nleak filter function.\nFor concrete example, check out ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.ILeakFilter#beforeleakfilter"},"beforeLeakFilter"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot"))," | heap snapshot see ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"leakedNodeIds"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"HeapNodeIdSet")," | the set of leaked object (node) ids."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"void"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Source"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L554"},"core/src/lib/Types.ts:554"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-interactionscallback-page-page-args-operationargs--promisevoid"},(0,r.yg)("a",{id:"interactionscallback",name:"interactionscallback"})," ",(0,r.yg)("strong",{parentName:"h3"},"InteractionsCallback"),": (",(0,r.yg)("inlineCode",{parentName:"h3"},"page"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page")),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"args?"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"OperationArgs"),") => ",(0,r.yg)("inlineCode",{parentName:"h3"},"Promise"),"<",(0,r.yg)("inlineCode",{parentName:"h3"},"void"),">"),(0,r.yg)("p",null,"The callback defines browser interactions which are\nused by memlab to interact with the web app under test.\nFor concrete examples, check out ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IScenario#action"},"action")," or ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IScenario#back"},"back"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"page"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page"))," | the puppeteer ",(0,r.yg)("a",{parentName:"li",href:"https://pptr.dev/api/puppeteer.page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page"))," object, which provides APIs to interact with the web browser. To import this type, check out ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"),"."),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"args?"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"OperationArgs")))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.yg)("inlineCode",{parentName:"p"},"void"),">"," | no return value")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Source"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L640"},"core/src/lib/Types.ts:640"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-leakfiltercallback-node-iheapnode-snapshot-iheapsnapshot-leakednodeids-heapnodeidset--boolean"},(0,r.yg)("a",{id:"leakfiltercallback",name:"leakfiltercallback"})," ",(0,r.yg)("strong",{parentName:"h3"},"LeakFilterCallback"),": (",(0,r.yg)("inlineCode",{parentName:"h3"},"node"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapNode")),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"snapshot"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot")),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"leakedNodeIds"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"HeapNodeIdSet"),") => ",(0,r.yg)("inlineCode",{parentName:"h3"},"boolean")),(0,r.yg)("p",null,"Callback that can be used to define a logic to filter the\nleaked objects. The callback is only called for every node\nallocated but not released from the target interaction\nin the heap snapshot."),(0,r.yg)("p",null,"For concrete examples, check out ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.ILeakFilter#leakfilter"},"leakFilter"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Parameters"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"node"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapNode"))," | the node that is kept alive in the memory in the heap snapshot"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot"))," | the snapshot of target interaction"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"leakedNodeIds"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"HeapNodeIdSet")," | the set of leaked node ids"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"boolean")," | the value indicating whether the given node in the snapshot\nshould be considered as leaked."),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"// any node in the heap snapshot that is greater than 1MB\nfunction leakFilter(node, _snapshot, _leakedNodeIds) {\n return node.retainedSize > 1000000;\n};\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L581"},"core/src/lib/Types.ts:581"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-nullablet-t--null"},(0,r.yg)("a",{id:"nullable",name:"nullable"})," ",(0,r.yg)("strong",{parentName:"h3"},"Nullable"),"<",(0,r.yg)("inlineCode",{parentName:"h3"},"T"),">",": ",(0,r.yg)("inlineCode",{parentName:"h3"},"T")," ","|"," ",(0,r.yg)("inlineCode",{parentName:"h3"},"null")),(0,r.yg)("p",null,"Given any type ",(0,r.yg)("inlineCode",{parentName:"p"},"T"),", return the union type ",(0,r.yg)("inlineCode",{parentName:"p"},"T")," and ",(0,r.yg)("inlineCode",{parentName:"p"},"null")),(0,r.yg)("h4",{id:"type-parameters"},"Type parameters"),(0,r.yg)("table",null,(0,r.yg)("thead",{parentName:"table"},(0,r.yg)("tr",{parentName:"thead"},(0,r.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.yg)("tbody",{parentName:"table"},(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"T")),(0,r.yg)("td",{parentName:"tr",align:"left"},"The type that will be made nullable.")))),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L32"},"core/src/lib/Types.ts:32"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-optionalt-t--null--undefined"},(0,r.yg)("a",{id:"optional",name:"optional"})," ",(0,r.yg)("strong",{parentName:"h3"},"Optional"),"<",(0,r.yg)("inlineCode",{parentName:"h3"},"T"),">",": ",(0,r.yg)("inlineCode",{parentName:"h3"},"T")," ","|"," ",(0,r.yg)("inlineCode",{parentName:"h3"},"null")," ","|"," ",(0,r.yg)("inlineCode",{parentName:"h3"},"undefined")),(0,r.yg)("p",null,"Given any type ",(0,r.yg)("inlineCode",{parentName:"p"},"T"),", return the union type ",(0,r.yg)("inlineCode",{parentName:"p"},"T"),", ",(0,r.yg)("inlineCode",{parentName:"p"},"null"),", and ",(0,r.yg)("inlineCode",{parentName:"p"},"undefined"),"."),(0,r.yg)("h4",{id:"type-parameters-1"},"Type parameters"),(0,r.yg)("table",null,(0,r.yg)("thead",{parentName:"table"},(0,r.yg)("tr",{parentName:"thead"},(0,r.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.yg)("tbody",{parentName:"table"},(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"T")),(0,r.yg)("td",{parentName:"tr",align:"left"},"The type that will be made both nullable and undefinable.")))),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L38"},"core/src/lib/Types.ts:38"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-page-puppeteerpage"},(0,r.yg)("a",{id:"page",name:"page"})," ",(0,r.yg)("strong",{parentName:"h3"},"Page"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"PuppeteerPage")),(0,r.yg)("p",null,"This is the puppeteer ",(0,r.yg)("a",{parentName:"p",href:"https://pptr.dev/api/puppeteer.page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page")),"\nclass used by MemLab. The puppeteer ",(0,r.yg)("inlineCode",{parentName:"p"},"Page")," class instance provides\nAPIs to interact with the web browser."),(0,r.yg)("p",null,"The puppeteer ",(0,r.yg)("inlineCode",{parentName:"p"},"Page")," type can be incompatible across different versions.\nYour local npm-installed puppeteer version may be different from\nthe puppeteer used by MemLab. This may cause some type errors, for example:"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {Page} from 'puppeteer';\nimport type {RunOptions} from '@memlab/api';\n\nconst runOptions: RunOptions = {\n scenario: {\n // initial page load url: Google Maps\n url: () => {\n return \"https://www.google.com/maps/@37.386427,-122.0428214,11z\";\n },\n // type error here if your local puppeeter version is different\n // from the puppeteer used by MemLab\n action: async function (page: Page) {\n await page.click('button[aria-label=\"Hotels\"]');\n },\n },\n};\n")),(0,r.yg)("p",null,"To avoid the type error in the code example above, MemLab exports the\npuppeteer ",(0,r.yg)("inlineCode",{parentName:"p"},"Page")," type used by MemLab so that your code can import it\nwhen necessary:"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {Page} from '@memlab/core' // import Page type from memlab\nimport type {RunOptions} from 'memlab';\n\nconst runOptions: RunOptions = {\n scenario: {\n // initial page load url: Google Maps\n url: () => {\n return \"https://www.google.com/maps/@37.386427,-122.0428214,11z\";\n },\n // no type error here\n action: async function (page: Page) {\n await page.click('button[aria-label=\"Hotels\"]');\n },\n },\n};\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L207"},"core/src/lib/Types.ts:207"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-predicatort-entity-t--boolean"},(0,r.yg)("a",{id:"predicator",name:"predicator"})," ",(0,r.yg)("strong",{parentName:"h3"},"Predicator"),"<",(0,r.yg)("inlineCode",{parentName:"h3"},"T"),">",": (",(0,r.yg)("inlineCode",{parentName:"h3"},"entity"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"T"),") => ",(0,r.yg)("inlineCode",{parentName:"h3"},"boolean")),(0,r.yg)("h4",{id:"type-parameters-2"},"Type parameters"),(0,r.yg)("table",null,(0,r.yg)("thead",{parentName:"table"},(0,r.yg)("tr",{parentName:"thead"},(0,r.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.yg)("tbody",{parentName:"table"},(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"T")),(0,r.yg)("td",{parentName:"tr",align:"left"},"the type of the entity to be checked")))),(0,r.yg)("p",null,"the predicate callback is used to decide if a\nentity of type ",(0,r.yg)("inlineCode",{parentName:"p"},"T"),".\nFor more concrete examples on where it is used,\ncheck out ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode#findanyreference"},"findAnyReference"),", ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode#findanyreferrer"},"findAnyReferrer"),",\nand ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode#findreferrers"},"findReferrers"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"entity"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"T")," | the entity to be checked"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"boolean")," | whether the entity passes the predicate check")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Source"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L220"},"core/src/lib/Types.ts:220"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-referencefiltercallback-edge-iheapedge-snapshot-iheapsnapshot-isreferenceusedbydefault-boolean--boolean"},(0,r.yg)("a",{id:"referencefiltercallback",name:"referencefiltercallback"})," ",(0,r.yg)("strong",{parentName:"h3"},"ReferenceFilterCallback"),": (",(0,r.yg)("inlineCode",{parentName:"h3"},"edge"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"snapshot"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot")),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"isReferenceUsedByDefault"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"boolean"),") => ",(0,r.yg)("inlineCode",{parentName:"h3"},"boolean")),(0,r.yg)("p",null,"Callback that can be used to define a logic to decide whether\na reference should be filtered (included) for some\ncalculations (e.g., retainer trace calculation)"),(0,r.yg)("p",null,"For concrete examples, check out ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.ILeakFilter#leakfilter"},"leakFilter"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Parameters"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"edge"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapEdge"))," | the reference (edge) that is considered for calcualting the retainer trace"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot"))," | the final snapshot taken after all browser interactions are done."),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"isReferenceUsedByDefault"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"boolean")," | MemLab has its own default logic for whether a reference should be filtered (included), if this parameter is true, it means MemLab will consider this reference for inclusion"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"boolean")," | the value indicating whether the given reference should be\nfiltered (i.e., included)")),(0,r.yg)("p",null,"Please also be aware that some edges like self-referencing edges,\nJS engine's internal edges, and hidden edges should not be considered\nas part of the retainer trace. These edges could make the retainer trace\nunncessarily complex and cause confusion. ",(0,r.yg)("inlineCode",{parentName:"p"},"isReferenceUsedByDefault")," will\nbe ",(0,r.yg)("inlineCode",{parentName:"p"},"false")," for these types of edges."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"// exclude react fiber references\nfunction retainerReferenceFilter(edge, _snapshot, _isReferenceUsedByDefault) {\n if (edge.name_or_index.toString().startsWith('__reactFiber$')) {\n return false;\n }\n // exclude other references here\n // ...\n return true;\n};\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L624"},"core/src/lib/Types.ts:624"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-runmetainfo-object"},(0,r.yg)("a",{id:"runmetainfo",name:"runmetainfo"})," ",(0,r.yg)("strong",{parentName:"h3"},"RunMetaInfo"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"Object")),(0,r.yg)("p",null,"This data structure holds the information about memlab run.\nYou can retrieve the instance of this type through ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader#getrunmetainfo"},"getRunMetaInfo"),"."),(0,r.yg)("table",null,(0,r.yg)("thead",{parentName:"table"},(0,r.yg)("tr",{parentName:"thead"},(0,r.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Type"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.yg)("tbody",{parentName:"table"},(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"browserInfo")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/interfaces/core_src.IBrowserInfo"},(0,r.yg)("inlineCode",{parentName:"a"},"IBrowserInfo"))),(0,r.yg)("td",{parentName:"tr",align:"left"},"input configuration for the browser and output data from the browser")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"type")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"string")),(0,r.yg)("td",{parentName:"tr",align:"left"},"type of the memlab run")))),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1247"},"core/src/lib/Types.ts:1247"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-undefinablet-t--undefined"},(0,r.yg)("a",{id:"undefinable",name:"undefinable"})," ",(0,r.yg)("strong",{parentName:"h3"},"Undefinable"),"<",(0,r.yg)("inlineCode",{parentName:"h3"},"T"),">",": ",(0,r.yg)("inlineCode",{parentName:"h3"},"T")," ","|"," ",(0,r.yg)("inlineCode",{parentName:"h3"},"undefined")),(0,r.yg)("p",null,"Given any type ",(0,r.yg)("inlineCode",{parentName:"p"},"T"),", return the union type ",(0,r.yg)("inlineCode",{parentName:"p"},"T")," and ",(0,r.yg)("inlineCode",{parentName:"p"},"undefined"),"."),(0,r.yg)("h4",{id:"type-parameters-3"},"Type parameters"),(0,r.yg)("table",null,(0,r.yg)("thead",{parentName:"table"},(0,r.yg)("tr",{parentName:"thead"},(0,r.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.yg)("tbody",{parentName:"table"},(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"T")),(0,r.yg)("td",{parentName:"tr",align:"left"},"The type that will be made undefinable.")))),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L44"},"core/src/lib/Types.ts:44"))))),(0,r.yg)("h2",{id:"functions"},"Functions"),(0,r.yg)("h3",{id:"dumpnodeheapsnapshot"},(0,r.yg)("a",{id:"dumpnodeheapsnapshot"}),(0,r.yg)("strong",{parentName:"h3"},"dumpNodeHeapSnapshot"),"()"),(0,r.yg)("p",null,"Take a heap snapshot of the current program state and save it as a\n",(0,r.yg)("inlineCode",{parentName:"p"},".heapsnapshot")," file under a randomly generated folder inside the system's\ntemp folder."),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"Note"),": All ",(0,r.yg)("inlineCode",{parentName:"p"},".heapsnapshot")," files could also be loaded by Chrome DevTools."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"string")," | the absolute file path to the saved ",(0,r.yg)("inlineCode",{parentName:"p"},".heapsnapshot")," file.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/NodeHeap.ts#L84"},"core/src/lib/NodeHeap.ts:84"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"tagobjectto-tag"},(0,r.yg)("a",{id:"tagobject"}),(0,r.yg)("strong",{parentName:"h3"},"tagObject"),"<",(0,r.yg)("inlineCode",{parentName:"h3"},"T"),">","(",(0,r.yg)("inlineCode",{parentName:"h3"},"o"),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"tag"),")"),(0,r.yg)("p",null,"Tags a string marker to an object instance, which can later be checked by\n",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot#hasobjectwithtag"},"hasObjectWithTag"),". This API does not modify the object instance in\nany way (e.g., no additional or hidden properties added to the tagged\nobject)."),(0,r.yg)("h4",{id:"type-parameters-4"},"Type parameters"),(0,r.yg)("table",null,(0,r.yg)("thead",{parentName:"table"},(0,r.yg)("tr",{parentName:"thead"},(0,r.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.yg)("tbody",{parentName:"table"},(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"T")),(0,r.yg)("td",{parentName:"tr",align:"left"},"extends ",(0,r.yg)("inlineCode",{parentName:"td"},"object"))))),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Parameters"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"o"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"T")," | specify the object instance you want to tag, you cannot tag a ",(0,r.yg)("a",{parentName:"li",href:"https://developer.mozilla.org/en-US/docs/Glossary/Primitive"},"primitive"),"."),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"tag"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | marker name to tag on the object instance"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"T")," | returns the tagged object instance (same reference as\nthe input argument ",(0,r.yg)("inlineCode",{parentName:"li"},"o"),")"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot, AnyValue} from '@memlab/core';\nimport {config, takeNodeMinimalHeap, tagObject} from '@memlab/core';\n\ntest('memory test', async () => {\n config.muteConsole = true;\n const o1: AnyValue = {};\n let o2: AnyValue = {};\n\n // tag o1 with marker: \"memlab-mark-1\", does not modify o1 in any way\n tagObject(o1, 'memlab-mark-1');\n // tag o2 with marker: \"memlab-mark-2\", does not modify o2 in any way\n tagObject(o2, 'memlab-mark-2');\n\n o2 = null;\n\n const heap: IHeapSnapshot = await takeNodeMinimalHeap();\n\n // expect object with marker \"memlab-mark-1\" exists\n expect(heap.hasObjectWithTag('memlab-mark-1')).toBe(true);\n\n // expect object with marker \"memlab-mark-2\" can be GCed\n expect(heap.hasObjectWithTag('memlab-mark-2')).toBe(false);\n\n}, 30000);\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/NodeHeap.ts#L59"},"core/src/lib/NodeHeap.ts:59"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"takenodeminimalheap"},(0,r.yg)("a",{id:"takenodeminimalheap"}),(0,r.yg)("strong",{parentName:"h3"},"takeNodeMinimalHeap"),"()"),(0,r.yg)("p",null,"Take a heap snapshot of the current program state\nand parse it as ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot"),". Notice that\nthis API does not calculate some heap analysis meta data\nfor heap analysis. But this also means faster heap parsing."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot")),">"," | heap representation without heap analysis meta data.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples:")))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport {takeNodeMinimalHeap} from '@memlab/core';\n\n(async function () {\n const heap: IHeapSnapshot = await takeNodeMinimalHeap();\n})();\n")),(0,r.yg)("p",null,"If you need to get the heap snapshot with heap analysis meta data, please\nuse ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/heap_analysis_src#getfullheapfromfile"},"getFullHeapFromFile"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/NodeHeap.ts#L152"},"core/src/lib/NodeHeap.ts:152"))))))}d.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[6571],{5680:(e,a,n)=>{n.d(a,{xA:()=>s,yg:()=>y});var t=n(6540);function r(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function i(e){for(var a=1;a=0||(r[n]=e[n]);return r}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=t.createContext({}),g=function(e){var a=t.useContext(p),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},s=function(e){var a=g(e.components);return t.createElement(p.Provider,{value:a},e.children)},m="mdxType",c={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},d=t.forwardRef((function(e,a){var n=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),m=g(n),d=r,y=m["".concat(p,".").concat(d)]||m[d]||c[d]||l;return n?t.createElement(y,i(i({ref:a},s),{},{components:n})):t.createElement(y,i({ref:a},s))}));function y(e,a){var n=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=d;var o={};for(var p in a)hasOwnProperty.call(a,p)&&(o[p]=a[p]);o.originalType=e,o[m]="string"==typeof e?e:r,i[1]=o;for(var g=2;g{n.r(a),n.d(a,{assets:()=>p,contentTitle:()=>i,default:()=>c,frontMatter:()=>l,metadata:()=>o,toc:()=>g});var t=n(8168),r=(n(6540),n(5680));const l={id:"core_src",title:"Package: @memlab/core",sidebar_label:"core/src",sidebar_position:0,custom_edit_url:null},i=void 0,o={unversionedId:"api/modules/core_src",id:"api/modules/core_src",title:"Package: @memlab/core",description:"Interfaces",source:"@site/docs/api/modules/core_src.md",sourceDirName:"api/modules",slug:"/api/modules/core_src",permalink:"/memlab/docs/api/modules/core_src",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"core_src",title:"Package: @memlab/core",sidebar_label:"core/src",sidebar_position:0,custom_edit_url:null},sidebar:"sidebar",previous:{title:"api/src",permalink:"/memlab/docs/api/modules/api_src"},next:{title:"heap-analysis/src",permalink:"/memlab/docs/api/modules/heap_analysis_src"}},p={},g=[{value:"Interfaces",id:"interfaces",level:2},{value:"Type Aliases",id:"type-aliases",level:2},{value:' CheckPageLoadCallback: (page: Page) => Promise<boolean>',id:"-checkpageloadcallback-page-page--promiseboolean",level:3},{value:' Cookie: Object',id:"-cookie-object",level:3},{value:' Cookies: Cookie[]',id:"-cookies-cookie",level:3},{value:' EdgeIterationCallback: (edge: IHeapEdge) => Optional<{ stop: boolean }> | void',id:"-edgeiterationcallback-edge-iheapedge--optional-stop-boolean----void",level:3},{value:' InitLeakFilterCallback: (snapshot: IHeapSnapshot, leakedNodeIds: HeapNodeIdSet) => void',id:"-initleakfiltercallback-snapshot-iheapsnapshot-leakednodeids-heapnodeidset--void",level:3},{value:' InteractionsCallback: (page: Page, args?: OperationArgs) => Promise<void>',id:"-interactionscallback-page-page-args-operationargs--promisevoid",level:3},{value:' LeakFilterCallback: (node: IHeapNode, snapshot: IHeapSnapshot, leakedNodeIds: HeapNodeIdSet) => boolean',id:"-leakfiltercallback-node-iheapnode-snapshot-iheapsnapshot-leakednodeids-heapnodeidset--boolean",level:3},{value:' Nullable<T>: T | null',id:"-nullablet-t--null",level:3},{value:"Type parameters",id:"type-parameters",level:4},{value:' Optional<T>: T | null | undefined',id:"-optionalt-t--null--undefined",level:3},{value:"Type parameters",id:"type-parameters-1",level:4},{value:' Page: PuppeteerPage',id:"-page-puppeteerpage",level:3},{value:' Predicator<T>: (entity: T) => boolean',id:"-predicatort-entity-t--boolean",level:3},{value:"Type parameters",id:"type-parameters-2",level:4},{value:' ReferenceFilterCallback: (edge: IHeapEdge, snapshot: IHeapSnapshot, isReferenceUsedByDefault: boolean) => boolean',id:"-referencefiltercallback-edge-iheapedge-snapshot-iheapsnapshot-isreferenceusedbydefault-boolean--boolean",level:3},{value:' RunMetaInfo: Object',id:"-runmetainfo-object",level:3},{value:' Undefinable<T>: T | undefined',id:"-undefinablet-t--undefined",level:3},{value:"Type parameters",id:"type-parameters-3",level:4},{value:"Functions",id:"functions",level:2},{value:'dumpNodeHeapSnapshot()',id:"dumpnodeheapsnapshot",level:3},{value:'tagObject<T>(o, tag)',id:"tagobjectto-tag",level:3},{value:"Type parameters",id:"type-parameters-4",level:4},{value:'takeNodeMinimalHeap()',id:"takenodeminimalheap",level:3}],s={toc:g},m="wrapper";function c(e){let{components:a,...n}=e;return(0,r.yg)(m,(0,t.A)({},s,n,{components:a,mdxType:"MDXLayout"}),(0,r.yg)("h2",{id:"interfaces"},"Interfaces"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IBrowserInfo"},"IBrowserInfo")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},"IHeapEdge")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdges"},"IHeapEdges")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapLocation"},"IHeapLocation")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},"IHeapNode")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapNodes"},"IHeapNodes")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapStringNode"},"IHeapStringNode")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.ILeakFilter"},"ILeakFilter")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IScenario"},"IScenario"))),(0,r.yg)("h2",{id:"type-aliases"},"Type Aliases"),(0,r.yg)("h3",{id:"-checkpageloadcallback-page-page--promiseboolean"},(0,r.yg)("a",{id:"checkpageloadcallback",name:"checkpageloadcallback"})," ",(0,r.yg)("strong",{parentName:"h3"},"CheckPageLoadCallback"),": (",(0,r.yg)("inlineCode",{parentName:"h3"},"page"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page")),") => ",(0,r.yg)("inlineCode",{parentName:"h3"},"Promise"),"<",(0,r.yg)("inlineCode",{parentName:"h3"},"boolean"),">"),(0,r.yg)("p",null,"Callback function to provide if the page is loaded.\nFor concrete example, check out ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IScenario#ispageloaded"},"isPageLoaded"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"page"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page"))," | puppeteer's ",(0,r.yg)("a",{parentName:"li",href:"https://pptr.dev/api/puppeteer.page/"},"Page")," object. To import this type, check out ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"),"."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.yg)("inlineCode",{parentName:"p"},"boolean"),">"," | a boolean value, if it returns ",(0,r.yg)("inlineCode",{parentName:"p"},"true"),", memlab will consider\nthe navigation completes, if it returns ",(0,r.yg)("inlineCode",{parentName:"p"},"false"),", memlab will keep calling\nthis callback until it returns ",(0,r.yg)("inlineCode",{parentName:"p"},"true"),". This is an async callback, you can\nalso ",(0,r.yg)("inlineCode",{parentName:"p"},"await")," and returns ",(0,r.yg)("inlineCode",{parentName:"p"},"true")," until some async logic is resolved.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Source"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1166"},"core/src/lib/Types.ts:1166"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-cookie-object"},(0,r.yg)("a",{id:"cookie",name:"cookie"})," ",(0,r.yg)("strong",{parentName:"h3"},"Cookie"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"Object")),(0,r.yg)("p",null,"A single cookie entry in a Cookies list.\nThe ",(0,r.yg)("inlineCode",{parentName:"p"},"name")," and ",(0,r.yg)("inlineCode",{parentName:"p"},"value")," field is mandatory.\nIt is better to also specify the ",(0,r.yg)("inlineCode",{parentName:"p"},"domain")," field, otherwise MemLab\nwill try to infer ",(0,r.yg)("inlineCode",{parentName:"p"},"domain")," automatically.\nThe other fields are optional.\nFor concrete use case, please check out ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IScenario#cookies"},"cookies"),"."),(0,r.yg)("table",null,(0,r.yg)("thead",{parentName:"table"},(0,r.yg)("tr",{parentName:"thead"},(0,r.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Type"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.yg)("tbody",{parentName:"table"},(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"domain?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"string")),(0,r.yg)("td",{parentName:"tr",align:"left"},"Add when possible: Defines the domain associated with the cookie")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"expires?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/modules/core_src#undefinable"},(0,r.yg)("inlineCode",{parentName:"a"},"Undefinable")),"<",(0,r.yg)("inlineCode",{parentName:"td"},"number"),">"),(0,r.yg)("td",{parentName:"tr",align:"left"},"Optional: Indicates when the cookie will expire, in Unix time (seconds)")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"httpOnly?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/modules/core_src#undefinable"},(0,r.yg)("inlineCode",{parentName:"a"},"Undefinable")),"<",(0,r.yg)("inlineCode",{parentName:"td"},"boolean"),">"),(0,r.yg)("td",{parentName:"tr",align:"left"},"Optional: Flag to determine if the cookie is accessible only over HTTP")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"name")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"string")),(0,r.yg)("td",{parentName:"tr",align:"left"},"Mandatory: Represents the name of the cookie")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"path?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/modules/core_src#undefinable"},(0,r.yg)("inlineCode",{parentName:"a"},"Undefinable")),"<",(0,r.yg)("inlineCode",{parentName:"td"},"string"),">"),(0,r.yg)("td",{parentName:"tr",align:"left"},"Optional: Defines the domain associated with the cookie")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"sameSite?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/modules/core_src#undefinable"},(0,r.yg)("inlineCode",{parentName:"a"},"Undefinable")),"<",(0,r.yg)("inlineCode",{parentName:"td"},'"Strict"')," ","|"," ",(0,r.yg)("inlineCode",{parentName:"td"},'"Lax"'),">"),(0,r.yg)("td",{parentName:"tr",align:"left"},"Optional: Determines if a cookie is transmitted with cross-site requests, offering a degree of defense against cross-site request forgery attacks.")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"secure?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/modules/core_src#undefinable"},(0,r.yg)("inlineCode",{parentName:"a"},"Undefinable")),"<",(0,r.yg)("inlineCode",{parentName:"td"},"boolean"),">"),(0,r.yg)("td",{parentName:"tr",align:"left"},"Optional: Flag to indicate if the cookie transmission requires a secure protocol (e.g., HTTPS)")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"session?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/modules/core_src#undefinable"},(0,r.yg)("inlineCode",{parentName:"a"},"Undefinable")),"<",(0,r.yg)("inlineCode",{parentName:"td"},"boolean"),">"),(0,r.yg)("td",{parentName:"tr",align:"left"},"Optional: Flag to check if the cookie is a session cookie")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"url?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/modules/core_src#undefinable"},(0,r.yg)("inlineCode",{parentName:"a"},"Undefinable")),"<",(0,r.yg)("inlineCode",{parentName:"td"},"string"),">"),(0,r.yg)("td",{parentName:"tr",align:"left"},"Optional: Specifies the request-URI linked with the cookie setup. This can influence the cookie's default domain and path")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"value")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"string")),(0,r.yg)("td",{parentName:"tr",align:"left"},"Mandatory: Represents the value assigned to the cookie")))),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L236"},"core/src/lib/Types.ts:236"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-cookies-cookie"},(0,r.yg)("a",{id:"cookies",name:"cookies"})," ",(0,r.yg)("strong",{parentName:"h3"},"Cookies"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#cookie"},(0,r.yg)("inlineCode",{parentName:"a"},"Cookie")),"[]"),(0,r.yg)("p",null,"Data structure for holding cookies.\nFor concrete use case, please check out ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IScenario#cookies"},"cookies"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L226"},"core/src/lib/Types.ts:226"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-edgeiterationcallback-edge-iheapedge--optional-stop-boolean----void"},(0,r.yg)("a",{id:"edgeiterationcallback",name:"edgeiterationcallback"})," ",(0,r.yg)("strong",{parentName:"h3"},"EdgeIterationCallback"),": (",(0,r.yg)("inlineCode",{parentName:"h3"},"edge"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),") => ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#optional"},(0,r.yg)("inlineCode",{parentName:"a"},"Optional")),"<{ ",(0,r.yg)("inlineCode",{parentName:"h3"},"stop"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"boolean")," }",">"," ","|"," ",(0,r.yg)("inlineCode",{parentName:"h3"},"void")),(0,r.yg)("p",null,"Executes a provided callback once for JavaScript references.\nFor concrete examples, check out ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode#foreachreference"},"forEachReference"),"\nor ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode#foreachreferrer"},"forEachReferrer"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"edge"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapEdge"))))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#optional"},(0,r.yg)("inlineCode",{parentName:"a"},"Optional")),"<{ ",(0,r.yg)("inlineCode",{parentName:"p"},"stop"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"boolean")," }",">"," ","|"," ",(0,r.yg)("inlineCode",{parentName:"p"},"void")," | this API returns void")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Source"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1795"},"core/src/lib/Types.ts:1795"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-initleakfiltercallback-snapshot-iheapsnapshot-leakednodeids-heapnodeidset--void"},(0,r.yg)("a",{id:"initleakfiltercallback",name:"initleakfiltercallback"})," ",(0,r.yg)("strong",{parentName:"h3"},"InitLeakFilterCallback"),": (",(0,r.yg)("inlineCode",{parentName:"h3"},"snapshot"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot")),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"leakedNodeIds"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"HeapNodeIdSet"),") => ",(0,r.yg)("inlineCode",{parentName:"h3"},"void")),(0,r.yg)("p",null,"Lifecycle function callback that is invoked initially once before calling any\nleak filter function.\nFor concrete example, check out ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.ILeakFilter#beforeleakfilter"},"beforeLeakFilter"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot"))," | heap snapshot see ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"leakedNodeIds"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"HeapNodeIdSet")," | the set of leaked object (node) ids."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"void"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Source"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L554"},"core/src/lib/Types.ts:554"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-interactionscallback-page-page-args-operationargs--promisevoid"},(0,r.yg)("a",{id:"interactionscallback",name:"interactionscallback"})," ",(0,r.yg)("strong",{parentName:"h3"},"InteractionsCallback"),": (",(0,r.yg)("inlineCode",{parentName:"h3"},"page"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page")),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"args?"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"OperationArgs"),") => ",(0,r.yg)("inlineCode",{parentName:"h3"},"Promise"),"<",(0,r.yg)("inlineCode",{parentName:"h3"},"void"),">"),(0,r.yg)("p",null,"The callback defines browser interactions which are\nused by memlab to interact with the web app under test.\nFor concrete examples, check out ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IScenario#action"},"action")," or ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IScenario#back"},"back"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"page"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page"))," | the puppeteer ",(0,r.yg)("a",{parentName:"li",href:"https://pptr.dev/api/puppeteer.page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page"))," object, which provides APIs to interact with the web browser. To import this type, check out ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"),"."),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"args?"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"OperationArgs")))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.yg)("inlineCode",{parentName:"p"},"void"),">"," | no return value")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Source"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L640"},"core/src/lib/Types.ts:640"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-leakfiltercallback-node-iheapnode-snapshot-iheapsnapshot-leakednodeids-heapnodeidset--boolean"},(0,r.yg)("a",{id:"leakfiltercallback",name:"leakfiltercallback"})," ",(0,r.yg)("strong",{parentName:"h3"},"LeakFilterCallback"),": (",(0,r.yg)("inlineCode",{parentName:"h3"},"node"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapNode")),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"snapshot"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot")),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"leakedNodeIds"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"HeapNodeIdSet"),") => ",(0,r.yg)("inlineCode",{parentName:"h3"},"boolean")),(0,r.yg)("p",null,"Callback that can be used to define a logic to filter the\nleaked objects. The callback is only called for every node\nallocated but not released from the target interaction\nin the heap snapshot."),(0,r.yg)("p",null,"For concrete examples, check out ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.ILeakFilter#leakfilter"},"leakFilter"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Parameters"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"node"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapNode"))," | the node that is kept alive in the memory in the heap snapshot"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot"))," | the snapshot of target interaction"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"leakedNodeIds"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"HeapNodeIdSet")," | the set of leaked node ids"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"boolean")," | the value indicating whether the given node in the snapshot\nshould be considered as leaked."),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"// any node in the heap snapshot that is greater than 1MB\nfunction leakFilter(node, _snapshot, _leakedNodeIds) {\n return node.retainedSize > 1000000;\n};\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L581"},"core/src/lib/Types.ts:581"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-nullablet-t--null"},(0,r.yg)("a",{id:"nullable",name:"nullable"})," ",(0,r.yg)("strong",{parentName:"h3"},"Nullable"),"<",(0,r.yg)("inlineCode",{parentName:"h3"},"T"),">",": ",(0,r.yg)("inlineCode",{parentName:"h3"},"T")," ","|"," ",(0,r.yg)("inlineCode",{parentName:"h3"},"null")),(0,r.yg)("p",null,"Given any type ",(0,r.yg)("inlineCode",{parentName:"p"},"T"),", return the union type ",(0,r.yg)("inlineCode",{parentName:"p"},"T")," and ",(0,r.yg)("inlineCode",{parentName:"p"},"null")),(0,r.yg)("h4",{id:"type-parameters"},"Type parameters"),(0,r.yg)("table",null,(0,r.yg)("thead",{parentName:"table"},(0,r.yg)("tr",{parentName:"thead"},(0,r.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.yg)("tbody",{parentName:"table"},(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"T")),(0,r.yg)("td",{parentName:"tr",align:"left"},"The type that will be made nullable.")))),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L32"},"core/src/lib/Types.ts:32"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-optionalt-t--null--undefined"},(0,r.yg)("a",{id:"optional",name:"optional"})," ",(0,r.yg)("strong",{parentName:"h3"},"Optional"),"<",(0,r.yg)("inlineCode",{parentName:"h3"},"T"),">",": ",(0,r.yg)("inlineCode",{parentName:"h3"},"T")," ","|"," ",(0,r.yg)("inlineCode",{parentName:"h3"},"null")," ","|"," ",(0,r.yg)("inlineCode",{parentName:"h3"},"undefined")),(0,r.yg)("p",null,"Given any type ",(0,r.yg)("inlineCode",{parentName:"p"},"T"),", return the union type ",(0,r.yg)("inlineCode",{parentName:"p"},"T"),", ",(0,r.yg)("inlineCode",{parentName:"p"},"null"),", and ",(0,r.yg)("inlineCode",{parentName:"p"},"undefined"),"."),(0,r.yg)("h4",{id:"type-parameters-1"},"Type parameters"),(0,r.yg)("table",null,(0,r.yg)("thead",{parentName:"table"},(0,r.yg)("tr",{parentName:"thead"},(0,r.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.yg)("tbody",{parentName:"table"},(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"T")),(0,r.yg)("td",{parentName:"tr",align:"left"},"The type that will be made both nullable and undefinable.")))),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L38"},"core/src/lib/Types.ts:38"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-page-puppeteerpage"},(0,r.yg)("a",{id:"page",name:"page"})," ",(0,r.yg)("strong",{parentName:"h3"},"Page"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"PuppeteerPage")),(0,r.yg)("p",null,"This is the puppeteer ",(0,r.yg)("a",{parentName:"p",href:"https://pptr.dev/api/puppeteer.page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page")),"\nclass used by MemLab. The puppeteer ",(0,r.yg)("inlineCode",{parentName:"p"},"Page")," class instance provides\nAPIs to interact with the web browser."),(0,r.yg)("p",null,"The puppeteer ",(0,r.yg)("inlineCode",{parentName:"p"},"Page")," type can be incompatible across different versions.\nYour local npm-installed puppeteer version may be different from\nthe puppeteer used by MemLab. This may cause some type errors, for example:"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {Page} from 'puppeteer';\nimport type {RunOptions} from '@memlab/api';\n\nconst runOptions: RunOptions = {\n scenario: {\n // initial page load url: Google Maps\n url: () => {\n return \"https://www.google.com/maps/@37.386427,-122.0428214,11z\";\n },\n // type error here if your local puppeeter version is different\n // from the puppeteer used by MemLab\n action: async function (page: Page) {\n await page.click('button[aria-label=\"Hotels\"]');\n },\n },\n};\n")),(0,r.yg)("p",null,"To avoid the type error in the code example above, MemLab exports the\npuppeteer ",(0,r.yg)("inlineCode",{parentName:"p"},"Page")," type used by MemLab so that your code can import it\nwhen necessary:"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {Page} from '@memlab/core' // import Page type from memlab\nimport type {RunOptions} from 'memlab';\n\nconst runOptions: RunOptions = {\n scenario: {\n // initial page load url: Google Maps\n url: () => {\n return \"https://www.google.com/maps/@37.386427,-122.0428214,11z\";\n },\n // no type error here\n action: async function (page: Page) {\n await page.click('button[aria-label=\"Hotels\"]');\n },\n },\n};\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L207"},"core/src/lib/Types.ts:207"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-predicatort-entity-t--boolean"},(0,r.yg)("a",{id:"predicator",name:"predicator"})," ",(0,r.yg)("strong",{parentName:"h3"},"Predicator"),"<",(0,r.yg)("inlineCode",{parentName:"h3"},"T"),">",": (",(0,r.yg)("inlineCode",{parentName:"h3"},"entity"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"T"),") => ",(0,r.yg)("inlineCode",{parentName:"h3"},"boolean")),(0,r.yg)("h4",{id:"type-parameters-2"},"Type parameters"),(0,r.yg)("table",null,(0,r.yg)("thead",{parentName:"table"},(0,r.yg)("tr",{parentName:"thead"},(0,r.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.yg)("tbody",{parentName:"table"},(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"T")),(0,r.yg)("td",{parentName:"tr",align:"left"},"the type of the entity to be checked")))),(0,r.yg)("p",null,"the predicate callback is used to decide if a\nentity of type ",(0,r.yg)("inlineCode",{parentName:"p"},"T"),".\nFor more concrete examples on where it is used,\ncheck out ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode#findanyreference"},"findAnyReference"),", ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode#findanyreferrer"},"findAnyReferrer"),",\nand ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode#findreferrers"},"findReferrers"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"entity"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"T")," | the entity to be checked"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"boolean")," | whether the entity passes the predicate check")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Source"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L220"},"core/src/lib/Types.ts:220"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-referencefiltercallback-edge-iheapedge-snapshot-iheapsnapshot-isreferenceusedbydefault-boolean--boolean"},(0,r.yg)("a",{id:"referencefiltercallback",name:"referencefiltercallback"})," ",(0,r.yg)("strong",{parentName:"h3"},"ReferenceFilterCallback"),": (",(0,r.yg)("inlineCode",{parentName:"h3"},"edge"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"snapshot"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot")),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"isReferenceUsedByDefault"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"boolean"),") => ",(0,r.yg)("inlineCode",{parentName:"h3"},"boolean")),(0,r.yg)("p",null,"Callback that can be used to define a logic to decide whether\na reference should be filtered (included) for some\ncalculations (e.g., retainer trace calculation)"),(0,r.yg)("p",null,"For concrete examples, check out ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.ILeakFilter#leakfilter"},"leakFilter"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Parameters"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"edge"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapEdge"))," | the reference (edge) that is considered for calcualting the retainer trace"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot"))," | the final snapshot taken after all browser interactions are done."),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"isReferenceUsedByDefault"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"boolean")," | MemLab has its own default logic for whether a reference should be filtered (included), if this parameter is true, it means MemLab will consider this reference for inclusion"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"boolean")," | the value indicating whether the given reference should be\nfiltered (i.e., included)")),(0,r.yg)("p",null,"Please also be aware that some edges like self-referencing edges,\nJS engine's internal edges, and hidden edges should not be considered\nas part of the retainer trace. These edges could make the retainer trace\nunncessarily complex and cause confusion. ",(0,r.yg)("inlineCode",{parentName:"p"},"isReferenceUsedByDefault")," will\nbe ",(0,r.yg)("inlineCode",{parentName:"p"},"false")," for these types of edges."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"// exclude react fiber references\nfunction retainerReferenceFilter(edge, _snapshot, _isReferenceUsedByDefault) {\n if (edge.name_or_index.toString().startsWith('__reactFiber$')) {\n return false;\n }\n // exclude other references here\n // ...\n return true;\n};\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L624"},"core/src/lib/Types.ts:624"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-runmetainfo-object"},(0,r.yg)("a",{id:"runmetainfo",name:"runmetainfo"})," ",(0,r.yg)("strong",{parentName:"h3"},"RunMetaInfo"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"Object")),(0,r.yg)("p",null,"This data structure holds the information about memlab run.\nYou can retrieve the instance of this type through ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader#getrunmetainfo"},"getRunMetaInfo"),"."),(0,r.yg)("table",null,(0,r.yg)("thead",{parentName:"table"},(0,r.yg)("tr",{parentName:"thead"},(0,r.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Type"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.yg)("tbody",{parentName:"table"},(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"browserInfo")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/interfaces/core_src.IBrowserInfo"},(0,r.yg)("inlineCode",{parentName:"a"},"IBrowserInfo"))),(0,r.yg)("td",{parentName:"tr",align:"left"},"input configuration for the browser and output data from the browser")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"type")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"string")),(0,r.yg)("td",{parentName:"tr",align:"left"},"type of the memlab run")))),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1247"},"core/src/lib/Types.ts:1247"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-undefinablet-t--undefined"},(0,r.yg)("a",{id:"undefinable",name:"undefinable"})," ",(0,r.yg)("strong",{parentName:"h3"},"Undefinable"),"<",(0,r.yg)("inlineCode",{parentName:"h3"},"T"),">",": ",(0,r.yg)("inlineCode",{parentName:"h3"},"T")," ","|"," ",(0,r.yg)("inlineCode",{parentName:"h3"},"undefined")),(0,r.yg)("p",null,"Given any type ",(0,r.yg)("inlineCode",{parentName:"p"},"T"),", return the union type ",(0,r.yg)("inlineCode",{parentName:"p"},"T")," and ",(0,r.yg)("inlineCode",{parentName:"p"},"undefined"),"."),(0,r.yg)("h4",{id:"type-parameters-3"},"Type parameters"),(0,r.yg)("table",null,(0,r.yg)("thead",{parentName:"table"},(0,r.yg)("tr",{parentName:"thead"},(0,r.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.yg)("tbody",{parentName:"table"},(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"T")),(0,r.yg)("td",{parentName:"tr",align:"left"},"The type that will be made undefinable.")))),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L44"},"core/src/lib/Types.ts:44"))))),(0,r.yg)("h2",{id:"functions"},"Functions"),(0,r.yg)("h3",{id:"dumpnodeheapsnapshot"},(0,r.yg)("a",{id:"dumpnodeheapsnapshot"}),(0,r.yg)("strong",{parentName:"h3"},"dumpNodeHeapSnapshot"),"()"),(0,r.yg)("p",null,"Take a heap snapshot of the current program state and save it as a\n",(0,r.yg)("inlineCode",{parentName:"p"},".heapsnapshot")," file under a randomly generated folder inside the system's\ntemp folder."),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"Note"),": All ",(0,r.yg)("inlineCode",{parentName:"p"},".heapsnapshot")," files could also be loaded by Chrome DevTools."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"string")," | the absolute file path to the saved ",(0,r.yg)("inlineCode",{parentName:"p"},".heapsnapshot")," file.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/NodeHeap.ts#L84"},"core/src/lib/NodeHeap.ts:84"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"tagobjectto-tag"},(0,r.yg)("a",{id:"tagobject"}),(0,r.yg)("strong",{parentName:"h3"},"tagObject"),"<",(0,r.yg)("inlineCode",{parentName:"h3"},"T"),">","(",(0,r.yg)("inlineCode",{parentName:"h3"},"o"),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"tag"),")"),(0,r.yg)("p",null,"Tags a string marker to an object instance, which can later be checked by\n",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot#hasobjectwithtag"},"hasObjectWithTag"),". This API does not modify the object instance in\nany way (e.g., no additional or hidden properties added to the tagged\nobject)."),(0,r.yg)("h4",{id:"type-parameters-4"},"Type parameters"),(0,r.yg)("table",null,(0,r.yg)("thead",{parentName:"table"},(0,r.yg)("tr",{parentName:"thead"},(0,r.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.yg)("tbody",{parentName:"table"},(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"T")),(0,r.yg)("td",{parentName:"tr",align:"left"},"extends ",(0,r.yg)("inlineCode",{parentName:"td"},"object"))))),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Parameters"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"o"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"T")," | specify the object instance you want to tag, you cannot tag a ",(0,r.yg)("a",{parentName:"li",href:"https://developer.mozilla.org/en-US/docs/Glossary/Primitive"},"primitive"),"."),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"tag"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | marker name to tag on the object instance"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"T")," | returns the tagged object instance (same reference as\nthe input argument ",(0,r.yg)("inlineCode",{parentName:"li"},"o"),")"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot, AnyValue} from '@memlab/core';\nimport {config, takeNodeMinimalHeap, tagObject} from '@memlab/core';\n\ntest('memory test', async () => {\n config.muteConsole = true;\n const o1: AnyValue = {};\n let o2: AnyValue = {};\n\n // tag o1 with marker: \"memlab-mark-1\", does not modify o1 in any way\n tagObject(o1, 'memlab-mark-1');\n // tag o2 with marker: \"memlab-mark-2\", does not modify o2 in any way\n tagObject(o2, 'memlab-mark-2');\n\n o2 = null;\n\n const heap: IHeapSnapshot = await takeNodeMinimalHeap();\n\n // expect object with marker \"memlab-mark-1\" exists\n expect(heap.hasObjectWithTag('memlab-mark-1')).toBe(true);\n\n // expect object with marker \"memlab-mark-2\" can be GCed\n expect(heap.hasObjectWithTag('memlab-mark-2')).toBe(false);\n\n}, 30000);\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/NodeHeap.ts#L59"},"core/src/lib/NodeHeap.ts:59"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"takenodeminimalheap"},(0,r.yg)("a",{id:"takenodeminimalheap"}),(0,r.yg)("strong",{parentName:"h3"},"takeNodeMinimalHeap"),"()"),(0,r.yg)("p",null,"Take a heap snapshot of the current program state\nand parse it as ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot"),". Notice that\nthis API does not calculate some heap analysis meta data\nfor heap analysis. But this also means faster heap parsing."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot")),">"," | heap representation without heap analysis meta data.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples:")))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport {takeNodeMinimalHeap} from '@memlab/core';\n\n(async function () {\n const heap: IHeapSnapshot = await takeNodeMinimalHeap();\n})();\n")),(0,r.yg)("p",null,"If you need to get the heap snapshot with heap analysis meta data, please\nuse ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/heap_analysis_src#getfullheapfromfile"},"getFullHeapFromFile"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/NodeHeap.ts#L152"},"core/src/lib/NodeHeap.ts:152"))))))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/27652c34.d0a6a2c5.js b/assets/js/27652c34.a31534fa.js similarity index 94% rename from assets/js/27652c34.d0a6a2c5.js rename to assets/js/27652c34.a31534fa.js index e31e3fb8..d0f25de1 100644 --- a/assets/js/27652c34.d0a6a2c5.js +++ b/assets/js/27652c34.a31534fa.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[8417],{5680:(e,a,n)=>{n.d(a,{xA:()=>s,yg:()=>y});var r=n(6540);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function i(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);a&&(r=r.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var a=1;a=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var g=r.createContext({}),p=function(e){var a=r.useContext(g),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},s=function(e){var a=p(e.components);return r.createElement(g.Provider,{value:a},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var a=e.children;return r.createElement(r.Fragment,{},a)}},m=r.forwardRef((function(e,a){var n=e.components,t=e.mdxType,i=e.originalType,g=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),d=p(n),m=t,y=d["".concat(g,".").concat(m)]||d[m]||c[m]||i;return n?r.createElement(y,l(l({ref:a},s),{},{components:n})):r.createElement(y,l({ref:a},s))}));function y(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var i=n.length,l=new Array(i);l[0]=m;var o={};for(var g in a)hasOwnProperty.call(a,g)&&(o[g]=a[g]);o.originalType=e,o[d]="string"==typeof e?e:t,l[1]=o;for(var p=2;p{n.r(a),n.d(a,{assets:()=>g,contentTitle:()=>l,default:()=>c,frontMatter:()=>i,metadata:()=>o,toc:()=>p});var r=n(8168),t=(n(6540),n(5680));const i={id:"core_src.IHeapStringNode",title:"Interface: IHeapStringNode",sidebar_label:"IHeapStringNode",custom_edit_url:null},l=void 0,o={unversionedId:"api/interfaces/core_src.IHeapStringNode",id:"api/interfaces/core_src.IHeapStringNode",title:"Interface: IHeapStringNode",description:"An IHeapStringNode instance represents a JS string in a heap snapshot.",source:"@site/docs/api/interfaces/core_src.IHeapStringNode.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/core_src.IHeapStringNode",permalink:"/memlab/docs/api/interfaces/core_src.IHeapStringNode",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"core_src.IHeapStringNode",title:"Interface: IHeapStringNode",sidebar_label:"IHeapStringNode",custom_edit_url:null},sidebar:"sidebar",previous:{title:"IHeapSnapshot",permalink:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},next:{title:"ILeakFilter",permalink:"/memlab/docs/api/interfaces/core_src.ILeakFilter"}},g={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Properties",id:"properties",level:2},{value:' dominatorNode: Nullable<IHeapNode>',id:"-dominatornode-nullableiheapnode",level:3},{value:' edge_count: number',id:"-edge_count-number",level:3},{value:' hasPathEdge: boolean',id:"-haspathedge-boolean",level:3},{value:' id: number',id:"-id-number",level:3},{value:' isString: boolean',id:"-isstring-boolean",level:3},{value:' is_detached: boolean',id:"-is_detached-boolean",level:3},{value:' location: Nullable<IHeapLocation>',id:"-location-nullableiheaplocation",level:3},{value:' name: string',id:"-name-string",level:3},{value:' nodeIndex: number',id:"-nodeindex-number",level:3},{value:' numOfReferrers: number',id:"-numofreferrers-number",level:3},{value:' pathEdge: null | IHeapEdge',id:"-pathedge-null--iheapedge",level:3},{value:' references: IHeapEdge[]',id:"-references-iheapedge",level:3},{value:' referrers: IHeapEdge[]',id:"-referrers-iheapedge",level:3},{value:' retainedSize: number',id:"-retainedsize-number",level:3},{value:' self_size: number',id:"-self_size-number",level:3},{value:' snapshot: IHeapSnapshot',id:"-snapshot-iheapsnapshot",level:3},{value:' stringValue: string',id:"-stringvalue-string",level:3},{value:' type: string',id:"-type-string",level:3},{value:"Methods",id:"methods",level:2},{value:'findAnyReference(predicate)',id:"findanyreferencepredicate",level:3},{value:'findAnyReferrer(predicate)',id:"findanyreferrerpredicate",level:3},{value:'findAnyReferrerNode(predicate)',id:"findanyreferrernodepredicate",level:3},{value:'findReferrerNodes(predicate)',id:"findreferrernodespredicate",level:3},{value:'findReferrers(predicate)',id:"findreferrerspredicate",level:3},{value:'forEachReference(callback)',id:"foreachreferencecallback",level:3},{value:'forEachReferrer(callback)',id:"foreachreferrercallback",level:3},{value:'getAnyReferrer(edgeName, edgeType?)',id:"getanyreferreredgename-edgetype",level:3},{value:'getAnyReferrerNode(edgeName, edgeType?)',id:"getanyreferrernodeedgename-edgetype",level:3},{value:'getJSONifyableObject()',id:"getjsonifyableobject",level:3},{value:'getReference(edgeName, edgeType?)',id:"getreferenceedgename-edgetype",level:3},{value:'getReferenceNode(edgeName, edgeType?)',id:"getreferencenodeedgename-edgetype",level:3},{value:'getReferrerNodes(edgeName, edgeType?)',id:"getreferrernodesedgename-edgetype",level:3},{value:'getReferrers(edgeName, edgeType?)',id:"getreferrersedgename-edgetype",level:3},{value:'toJSONString(...args)',id:"tojsonstringargs",level:3},{value:'toStringNode()',id:"tostringnode",level:3}],s={toc:p},d="wrapper";function c(e){let{components:a,...n}=e;return(0,t.yg)(d,(0,r.A)({},s,n,{components:a,mdxType:"MDXLayout"}),(0,t.yg)("p",null,"An ",(0,t.yg)("inlineCode",{parentName:"p"},"IHeapStringNode")," instance represents a JS string in a heap snapshot.\nA heap snapshot is generally a graph where graph nodes are JS heap objects\nand graph edges are JS references among JS heap objects."),(0,t.yg)("p",null,(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"readonly"))," it is not recommended to modify any ",(0,t.yg)("inlineCode",{parentName:"p"},"IHeapStringNode")," instance"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples"),": V8 or hermes heap snapshot can be parsed by the\n",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#getfullheapfromfile"},"getFullHeapFromFile")," API.")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot, IHeapNode, IHeapStringNode} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n // iterate over each node (heap object)\n heap.nodes.forEach((node: IHeapNode, i: number) => {\n if (node.isString) {\n const stringNode: IheapStringNode = node.toStringNode();\n // get the string value\n stringNode.stringValue;\n }\n });\n})();\n")),(0,t.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode"))),(0,t.yg)("p",{parentName:"li"},"\u21b3 ",(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"IHeapStringNode"))))),(0,t.yg)("h2",{id:"properties"},"Properties"),(0,t.yg)("h3",{id:"-dominatornode-nullableiheapnode"},(0,t.yg)("a",{id:"dominatornode",name:"dominatornode"})," ",(0,t.yg)("strong",{parentName:"h3"},"dominatorNode"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"),(0,t.yg)("p",null,"get the dominator node of this node. If the dominator node gets released\nthere will be no path from GC to this node, and therefore this node can\nalso be released.\nFor more information on what a dominator node is, please check out\n",(0,t.yg)("a",{parentName:"p",href:"https://developer.chrome.com/docs/devtools/memory-problems/memory-101/#dominators"},"this doc"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1904"},"core/src/lib/Types.ts:1904"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-edge_count-number"},(0,t.yg)("a",{id:"edge\\_count",name:"edge\\_count"})," ",(0,t.yg)("strong",{parentName:"h3"},"edge","_","count"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"The total number of outgoing JS references (including engine-internal,\nnative, and JS references)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1858"},"core/src/lib/Types.ts:1858"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-haspathedge-boolean"},(0,t.yg)("a",{id:"haspathedge",name:"haspathedge"})," ",(0,t.yg)("strong",{parentName:"h3"},"hasPathEdge"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"boolean")),(0,t.yg)("p",null,"returns true if the heap node has been set an incoming edge\nwhich leads to the parent node on the shortest path to GC root."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1880"},"core/src/lib/Types.ts:1880"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-id-number"},(0,t.yg)("a",{id:"id",name:"id"})," ",(0,t.yg)("strong",{parentName:"h3"},"id"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"unique id of the heap object"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1785"},"core/src/lib/Types.ts:1785"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-isstring-boolean"},(0,t.yg)("a",{id:"isstring",name:"isstring"})," ",(0,t.yg)("strong",{parentName:"h3"},"isString"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"boolean")),(0,t.yg)("p",null,"check if this a string node (normal string node, concatenated string node\nor sliced string node)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1916"},"core/src/lib/Types.ts:1916"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-is_detached-boolean"},(0,t.yg)("a",{id:"is\\_detached",name:"is\\_detached"})," ",(0,t.yg)("strong",{parentName:"h3"},"is","_","detached"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"boolean")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},"If the heap object is a DOM element and the DOM element is detached\nfrom the DOM tree, ",(0,t.yg)("inlineCode",{parentName:"p"},"is_detached")," will be ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),";")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},"If the heap object is a React Fiber node and the Fiber node is unmounted\nfrom the React Fiber tree, ",(0,t.yg)("inlineCode",{parentName:"p"},"is_detached")," will be ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),";\notherwise it will be ",(0,t.yg)("inlineCode",{parentName:"p"},"false"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Source"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1840"},"core/src/lib/Types.ts:1840"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-location-nullableiheaplocation"},(0,t.yg)("a",{id:"location",name:"location"})," ",(0,t.yg)("strong",{parentName:"h3"},"location"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapLocation"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapLocation")),">"),(0,t.yg)("p",null,"source location information of this heap object (if it is recorded by\nthe heap snapshot)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1909"},"core/src/lib/Types.ts:1909"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-name-string"},(0,t.yg)("a",{id:"name",name:"name"})," ",(0,t.yg)("strong",{parentName:"h3"},"name"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"string")),(0,t.yg)("p",null,"this is the ",(0,t.yg)("inlineCode",{parentName:"p"},"name")," field associated with the heap object,\nfor JS object instances (type ",(0,t.yg)("inlineCode",{parentName:"p"},"object"),"), ",(0,t.yg)("inlineCode",{parentName:"p"},"name")," is the constructor's name\nof the object instance. for ",(0,t.yg)("inlineCode",{parentName:"p"},"string"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"name")," is the string value."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1781"},"core/src/lib/Types.ts:1781"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-nodeindex-number"},(0,t.yg)("a",{id:"nodeindex",name:"nodeindex"})," ",(0,t.yg)("strong",{parentName:"h3"},"nodeIndex"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"index of this heap object inside the ",(0,t.yg)("inlineCode",{parentName:"p"},"node.snapshot.nodes")," pseudo array"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1889"},"core/src/lib/Types.ts:1889"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-numofreferrers-number"},(0,t.yg)("a",{id:"numofreferrers",name:"numofreferrers"})," ",(0,t.yg)("strong",{parentName:"h3"},"numOfReferrers"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"Get the number of all incoming references pointing to this heap object\n(including engine-internal, native, and JS references)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1875"},"core/src/lib/Types.ts:1875"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-pathedge-null--iheapedge"},(0,t.yg)("a",{id:"pathedge",name:"pathedge"})," ",(0,t.yg)("strong",{parentName:"h3"},"pathEdge"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"null")," ","|"," ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge"))),(0,t.yg)("p",null,"The incoming edge which leads to the parent node\non the shortest path to GC root."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1885"},"core/src/lib/Types.ts:1885"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-references-iheapedge"},(0,t.yg)("a",{id:"references",name:"references"})," ",(0,t.yg)("strong",{parentName:"h3"},"references"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),"[]"),(0,t.yg)("p",null,"Get a JS array containing all outgoing JS references from this heap object\n(including engine-internal, native, and JS references)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1865"},"core/src/lib/Types.ts:1865"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-referrers-iheapedge"},(0,t.yg)("a",{id:"referrers",name:"referrers"})," ",(0,t.yg)("strong",{parentName:"h3"},"referrers"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),"[]"),(0,t.yg)("p",null,"Get a JS array containing all incoming JS references pointing to this heap\nobject (including engine-internal, native, and JS references)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1870"},"core/src/lib/Types.ts:1870"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-retainedsize-number"},(0,t.yg)("a",{id:"retainedsize",name:"retainedsize"})," ",(0,t.yg)("strong",{parentName:"h3"},"retainedSize"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"The ",(0,t.yg)("em",{parentName:"p"},"retained size")," of the heap object (i.e., the total size of memory that\ncould be released if this object is released). For difference between\n",(0,t.yg)("strong",{parentName:"p"},"retained size")," and ",(0,t.yg)("strong",{parentName:"p"},"shallow size"),", check out\n",(0,t.yg)("a",{parentName:"p",href:"https://developer.chrome.com/docs/devtools/memory-problems/memory-101/#object_sizes"},"this doc"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1896"},"core/src/lib/Types.ts:1896"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-self_size-number"},(0,t.yg)("a",{id:"self\\_size",name:"self\\_size"})," ",(0,t.yg)("strong",{parentName:"h3"},"self","_","size"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"The ",(0,t.yg)("em",{parentName:"p"},"shallow size")," of the heap object (i.e., the size of memory that is held\nby the object itself.). For difference between ",(0,t.yg)("strong",{parentName:"p"},"shallow size")," and\n",(0,t.yg)("strong",{parentName:"p"},"retained size"),", check out\n",(0,t.yg)("a",{parentName:"p",href:"https://developer.chrome.com/docs/devtools/memory-problems/memory-101/#object_sizes"},"this doc"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1853"},"core/src/lib/Types.ts:1853"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-snapshot-iheapsnapshot"},(0,t.yg)("a",{id:"snapshot",name:"snapshot"})," ",(0,t.yg)("strong",{parentName:"h3"},"snapshot"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot"))),(0,t.yg)("p",null,"get the ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")," containing this heap object"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1832"},"core/src/lib/Types.ts:1832"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-stringvalue-string"},(0,t.yg)("a",{id:"stringvalue",name:"stringvalue"})," ",(0,t.yg)("strong",{parentName:"h3"},"stringValue"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"string")),(0,t.yg)("p",null,"get the string value of the JS string heap object associated with\nthis ",(0,t.yg)("inlineCode",{parentName:"p"},"IHeapStringNode")," instance in heap"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2226"},"core/src/lib/Types.ts:2226"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-type-string"},(0,t.yg)("a",{id:"type",name:"type"})," ",(0,t.yg)("strong",{parentName:"h3"},"type"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"string")),(0,t.yg)("p",null,"the type of the heap node object. All possible types:\nThis is engine-specific, for example all types in V8:\n",(0,t.yg)("inlineCode",{parentName:"p"},"hidden"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"array"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"string"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"object"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"code"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"closure"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"regexp"),",\n",(0,t.yg)("inlineCode",{parentName:"p"},"number"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"native"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"synthetic"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"concatenated string"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"sliced string"),",\n",(0,t.yg)("inlineCode",{parentName:"p"},"symbol"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"bigint")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1775"},"core/src/lib/Types.ts:1775"))))),(0,t.yg)("h2",{id:"methods"},"Methods"),(0,t.yg)("h3",{id:"findanyreferencepredicate"},(0,t.yg)("a",{id:"findanyreference"}),(0,t.yg)("strong",{parentName:"h3"},"findAnyReference"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"predicate"),")"),(0,t.yg)("p",null,"executes a provided predicate callback once for each JavaScript reference\nin the hosting node (or outgoing edges from the node) until the predicate\nreturns ",(0,t.yg)("inlineCode",{parentName:"p"},"true")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"predicate"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#predicator"},(0,t.yg)("inlineCode",{parentName:"a"},"Predicator")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the callback for each outgoing JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the first outgoing edge for which the predicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),",\notherwise returns ",(0,t.yg)("inlineCode",{parentName:"p"},"null")," if no such edge is found.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const reference = node.findAnyReference((edge: IHeapEdge) => {\n // find the outgoing reference with name \"ref\"\n return edge.name_or_index === 'ref';\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1997"},"core/src/lib/Types.ts:1997"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"findanyreferrerpredicate"},(0,t.yg)("a",{id:"findanyreferrer"}),(0,t.yg)("strong",{parentName:"h3"},"findAnyReferrer"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"predicate"),")"),(0,t.yg)("p",null,"executes a provided predicate callback once for each JavaScript reference\npointing to the hosting node (or incoming edges to the node) until the\npredicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"predicate"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#predicator"},(0,t.yg)("inlineCode",{parentName:"a"},"Predicator")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the callback for each incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the first incoming edge for which the predicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),",\notherwise returns ",(0,t.yg)("inlineCode",{parentName:"p"},"null")," if no such edge is found.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const referrer = node.findAnyReferrer((edge: IHeapEdge) => {\n // find the incoming reference with name \"ref\"\n return edge.name_or_index === 'ref';\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2014"},"core/src/lib/Types.ts:2014"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"findanyreferrernodepredicate"},(0,t.yg)("a",{id:"findanyreferrernode"}),(0,t.yg)("strong",{parentName:"h3"},"findAnyReferrerNode"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"predicate"),")"),(0,t.yg)("p",null,"executes a provided predicate callback once for each JavaScript heap\nobject (heap graph node) pointing to the hosting node\n(or nodes having edges to the hosting node) until the predicate\nreturns ",(0,t.yg)("inlineCode",{parentName:"p"},"true")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"predicate"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#predicator"},(0,t.yg)("inlineCode",{parentName:"a"},"Predicator")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the callback for each incoming JavaScript heap object"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the first referring node for which the predicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),",\notherwise returns ",(0,t.yg)("inlineCode",{parentName:"p"},"null")," if no such node is found.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const referrer = node.findAnyReferrerNode((node: IHeapNode) => {\n // find the referring node with name \"Parent\"\n return node.name === 'Parent';\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2032"},"core/src/lib/Types.ts:2032"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"findreferrernodespredicate"},(0,t.yg)("a",{id:"findreferrernodes"}),(0,t.yg)("strong",{parentName:"h3"},"findReferrerNodes"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"predicate"),")"),(0,t.yg)("p",null,"executes a provided predicate callback once for each JavaScript heap\nobject (heap graph node) pointing to the hosting node\n(or nodes having edges to the hosting node)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"predicate"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#predicator"},(0,t.yg)("inlineCode",{parentName:"a"},"Predicator")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the callback for each referrer nodes"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),"[] | an array containing all the referrer nodes for which the\npredicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),", otherwise returns an empty array if no such\nnode is found.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const referrerNodes = node.findReferrerNodes((node: IHeapNode) => {\n // find all the referring nodes with name \"Parent\"\n return node.name === 'Parent';\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2067"},"core/src/lib/Types.ts:2067"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"findreferrerspredicate"},(0,t.yg)("a",{id:"findreferrers"}),(0,t.yg)("strong",{parentName:"h3"},"findReferrers"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"predicate"),")"),(0,t.yg)("p",null,"executes a provided predicate callback once for each JavaScript reference\npointing to the hosting node (or incoming edges to the node)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"predicate"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#predicator"},(0,t.yg)("inlineCode",{parentName:"a"},"Predicator")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the callback for each incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),"[] | an array containing all the incoming edges for which the\npredicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),", otherwise returns an empty array if no such\nedge is found.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const referrers = node.findReferrers((edge: IHeapEdge) => {\n // find all the incoming references with name \"ref\"\n return edge.name_or_index === 'ref';\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2049"},"core/src/lib/Types.ts:2049"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"foreachreferencecallback"},(0,t.yg)("a",{id:"foreachreference"}),(0,t.yg)("strong",{parentName:"h3"},"forEachReference"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"callback"),")"),(0,t.yg)("p",null,"executes a provided callback once for each JavaScript reference in the\nhosting node (or outgoing edges from the node)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"callback"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#edgeiterationcallback"},(0,t.yg)("inlineCode",{parentName:"a"},"EdgeIterationCallback"))," | the callback for each outgoing JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"p"},"void")," | this API returns void")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"node.forEachReference((edge: IHeapEdge) => {\n // process edge ...\n\n // if no need to iterate over remaining edges after\n // the current edge in the node.references list\n return {stop: true};\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1962"},"core/src/lib/Types.ts:1962"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"foreachreferrercallback"},(0,t.yg)("a",{id:"foreachreferrer"}),(0,t.yg)("strong",{parentName:"h3"},"forEachReferrer"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"callback"),")"),(0,t.yg)("p",null,"executes a provided callback once for each JavaScript reference pointing\nto the hosting node (or incoming edges to the node)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"callback"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#edgeiterationcallback"},(0,t.yg)("inlineCode",{parentName:"a"},"EdgeIterationCallback"))," | the callback for each incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"p"},"void")," | this API returns void")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"node.forEachReferrer((edge: IHeapEdge) => {\n // process edge ...\n\n // if no need to iterate over remaining edges after\n // the current edge in the node.referrers list\n return {stop: true};\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1980"},"core/src/lib/Types.ts:1980"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getanyreferreredgename-edgetype"},(0,t.yg)("a",{id:"getanyreferrer"}),(0,t.yg)("strong",{parentName:"h3"},"getAnyReferrer"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds an incoming JS\nreference pointing to the hosting node."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the incoming JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the incoming edge that meets the specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find one of the JS reference named \"ref\" pointing to node\nconst reference = node.getAnyReferrer('ref', 'property');\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2122"},"core/src/lib/Types.ts:2122"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getanyreferrernodeedgename-edgetype"},(0,t.yg)("a",{id:"getanyreferrernode"}),(0,t.yg)("strong",{parentName:"h3"},"getAnyReferrerNode"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds one of the incoming JS\nreferences pointing to the hosting node, and returns the JS heap object\ncontaining the incoming reference."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the incoming JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the node containing the incoming JS reference that meets\nthe specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find one of the JS heap object with a JS reference\n// named \"ref\" pointing to node\nconst n1 = node.getAnyReferrerNode('ref', 'property');\n// this is equivalent to\nconst n2 = node.getAnyReferrer('ref', 'property')?.fromNode;\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2145"},"core/src/lib/Types.ts:2145"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getjsonifyableobject"},(0,t.yg)("a",{id:"getjsonifyableobject"}),(0,t.yg)("strong",{parentName:"h3"},"getJSONifyableObject"),"()"),(0,t.yg)("p",null,"convert to a concise readable object that can be used for serialization\n(like calling ",(0,t.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)"),")."),(0,t.yg)("p",null,"This API does not contain all the information\ncaptured by the hosting object."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"AnyRecord")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1931"},"core/src/lib/Types.ts:1931"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getreferenceedgename-edgetype"},(0,t.yg)("a",{id:"getreference"}),(0,t.yg)("strong",{parentName:"h3"},"getReference"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds an outgoing JS\nreference from the hosting node."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the outgoing JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the outgoing JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the outgoing edge that meets the specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find the internal reference to node's hidden class\nconst reference = node.getReference('map', 'hidden');\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2082"},"core/src/lib/Types.ts:2082"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getreferencenodeedgename-edgetype"},(0,t.yg)("a",{id:"getreferencenode"}),(0,t.yg)("strong",{parentName:"h3"},"getReferenceNode"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds the outgoing JS\nreference from the hosting node, and returns the JS heap object pointed to\nby the outgoing JS reference."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the outgoing JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the outgoing JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the node pointed to by the outgoing reference that meets\nthe specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find the node's hidden class\nconst hiddenClassNode = node.getReferenceNode('map', 'hidden');\n// this is equivalent to\nconst hiddenClassNode2 = node.getReference('map', 'hidden')?.toNode;\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2104"},"core/src/lib/Types.ts:2104"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getreferrernodesedgename-edgetype"},(0,t.yg)("a",{id:"getreferrernodes"}),(0,t.yg)("strong",{parentName:"h3"},"getReferrerNodes"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds all of the incoming JS\nreferences pointing to the hosting node, and returns an array containing\nthe hosting node for each of the incoming JS references."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the incoming JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),"[] | an array containing the hosting nodes, with each node corresponds\nto each incoming JS reference that meets the specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find all of the JS heap object with a JS reference\n// named \"ref\" pointing to node\nconst nodes1 = node.getReferrerNodes('ref', 'property');\n// this is equivalent to\nconst nodes2 = node.getReferrers('ref', 'property')\n .map(edge => edge.fromNode);\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2185"},"core/src/lib/Types.ts:2185"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getreferrersedgename-edgetype"},(0,t.yg)("a",{id:"getreferrers"}),(0,t.yg)("strong",{parentName:"h3"},"getReferrers"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds all the incoming JS\nreference pointing to the hosting node."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the incoming JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),"[] | an array containing all the incoming edges that\nmeet the specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find all of of the JS reference named \"ref\" pointing to node\nconst referrers = node.getReferrers('ref', 'property');\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2164"},"core/src/lib/Types.ts:2164"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"tojsonstringargs"},(0,t.yg)("a",{id:"tojsonstring"}),(0,t.yg)("strong",{parentName:"h3"},"toJSONString"),"(...",(0,t.yg)("inlineCode",{parentName:"h3"},"args"),")"),(0,t.yg)("p",null,"convert to a concise readable string output\n(like calling ",(0,t.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)"),")."),(0,t.yg)("p",null,"Note: Please be aware that using ",(0,t.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)")," is\nnot recommended as it will generate a JSON representation of the host\nobject that is too large to be easily readable due to its connections\nto other parts of the data structures within the heap snapshot."),(0,t.yg)("p",null,"This API does not completely serialize all the information\ncaptured by the hosting object."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"...args"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"any"),"[]"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1944"},"core/src/lib/Types.ts:1944"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"tostringnode"},(0,t.yg)("a",{id:"tostringnode"}),(0,t.yg)("strong",{parentName:"h3"},"toStringNode"),"()"),(0,t.yg)("p",null,"convert to an ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapStringNode"},"IHeapStringNode")," object if this node is a string node.\nThe ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapStringNode"},"IHeapStringNode")," object supports querying the string content\ninside the string node."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapStringNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapStringNode")),">"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1922"},"core/src/lib/Types.ts:1922"))))))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[8417],{5680:(e,a,n)=>{n.d(a,{xA:()=>s,yg:()=>y});var r=n(6540);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function i(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);a&&(r=r.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var a=1;a=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var g=r.createContext({}),p=function(e){var a=r.useContext(g),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},s=function(e){var a=p(e.components);return r.createElement(g.Provider,{value:a},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var a=e.children;return r.createElement(r.Fragment,{},a)}},d=r.forwardRef((function(e,a){var n=e.components,t=e.mdxType,i=e.originalType,g=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),c=p(n),d=t,y=c["".concat(g,".").concat(d)]||c[d]||m[d]||i;return n?r.createElement(y,l(l({ref:a},s),{},{components:n})):r.createElement(y,l({ref:a},s))}));function y(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var i=n.length,l=new Array(i);l[0]=d;var o={};for(var g in a)hasOwnProperty.call(a,g)&&(o[g]=a[g]);o.originalType=e,o[c]="string"==typeof e?e:t,l[1]=o;for(var p=2;p{n.r(a),n.d(a,{assets:()=>g,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>o,toc:()=>p});var r=n(8168),t=(n(6540),n(5680));const i={id:"core_src.IHeapStringNode",title:"Interface: IHeapStringNode",sidebar_label:"IHeapStringNode",custom_edit_url:null},l=void 0,o={unversionedId:"api/interfaces/core_src.IHeapStringNode",id:"api/interfaces/core_src.IHeapStringNode",title:"Interface: IHeapStringNode",description:"An IHeapStringNode instance represents a JS string in a heap snapshot.",source:"@site/docs/api/interfaces/core_src.IHeapStringNode.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/core_src.IHeapStringNode",permalink:"/memlab/docs/api/interfaces/core_src.IHeapStringNode",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"core_src.IHeapStringNode",title:"Interface: IHeapStringNode",sidebar_label:"IHeapStringNode",custom_edit_url:null},sidebar:"sidebar",previous:{title:"IHeapSnapshot",permalink:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},next:{title:"ILeakFilter",permalink:"/memlab/docs/api/interfaces/core_src.ILeakFilter"}},g={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Properties",id:"properties",level:2},{value:' dominatorNode: Nullable<IHeapNode>',id:"-dominatornode-nullableiheapnode",level:3},{value:' edge_count: number',id:"-edge_count-number",level:3},{value:' hasPathEdge: boolean',id:"-haspathedge-boolean",level:3},{value:' id: number',id:"-id-number",level:3},{value:' isString: boolean',id:"-isstring-boolean",level:3},{value:' is_detached: boolean',id:"-is_detached-boolean",level:3},{value:' location: Nullable<IHeapLocation>',id:"-location-nullableiheaplocation",level:3},{value:' name: string',id:"-name-string",level:3},{value:' nodeIndex: number',id:"-nodeindex-number",level:3},{value:' numOfReferrers: number',id:"-numofreferrers-number",level:3},{value:' pathEdge: null | IHeapEdge',id:"-pathedge-null--iheapedge",level:3},{value:' references: IHeapEdge[]',id:"-references-iheapedge",level:3},{value:' referrers: IHeapEdge[]',id:"-referrers-iheapedge",level:3},{value:' retainedSize: number',id:"-retainedsize-number",level:3},{value:' self_size: number',id:"-self_size-number",level:3},{value:' snapshot: IHeapSnapshot',id:"-snapshot-iheapsnapshot",level:3},{value:' stringValue: string',id:"-stringvalue-string",level:3},{value:' type: string',id:"-type-string",level:3},{value:"Methods",id:"methods",level:2},{value:'findAnyReference(predicate)',id:"findanyreferencepredicate",level:3},{value:'findAnyReferrer(predicate)',id:"findanyreferrerpredicate",level:3},{value:'findAnyReferrerNode(predicate)',id:"findanyreferrernodepredicate",level:3},{value:'findReferrerNodes(predicate)',id:"findreferrernodespredicate",level:3},{value:'findReferrers(predicate)',id:"findreferrerspredicate",level:3},{value:'forEachReference(callback)',id:"foreachreferencecallback",level:3},{value:'forEachReferrer(callback)',id:"foreachreferrercallback",level:3},{value:'getAnyReferrer(edgeName, edgeType?)',id:"getanyreferreredgename-edgetype",level:3},{value:'getAnyReferrerNode(edgeName, edgeType?)',id:"getanyreferrernodeedgename-edgetype",level:3},{value:'getJSONifyableObject()',id:"getjsonifyableobject",level:3},{value:'getReference(edgeName, edgeType?)',id:"getreferenceedgename-edgetype",level:3},{value:'getReferenceNode(edgeName, edgeType?)',id:"getreferencenodeedgename-edgetype",level:3},{value:'getReferrerNodes(edgeName, edgeType?)',id:"getreferrernodesedgename-edgetype",level:3},{value:'getReferrers(edgeName, edgeType?)',id:"getreferrersedgename-edgetype",level:3},{value:'toJSONString(...args)',id:"tojsonstringargs",level:3},{value:'toStringNode()',id:"tostringnode",level:3}],s={toc:p},c="wrapper";function m(e){let{components:a,...n}=e;return(0,t.yg)(c,(0,r.A)({},s,n,{components:a,mdxType:"MDXLayout"}),(0,t.yg)("p",null,"An ",(0,t.yg)("inlineCode",{parentName:"p"},"IHeapStringNode")," instance represents a JS string in a heap snapshot.\nA heap snapshot is generally a graph where graph nodes are JS heap objects\nand graph edges are JS references among JS heap objects."),(0,t.yg)("p",null,(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"readonly"))," it is not recommended to modify any ",(0,t.yg)("inlineCode",{parentName:"p"},"IHeapStringNode")," instance"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples"),": V8 or hermes heap snapshot can be parsed by the\n",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#getfullheapfromfile"},"getFullHeapFromFile")," API.")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot, IHeapNode, IHeapStringNode} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n // iterate over each node (heap object)\n heap.nodes.forEach((node: IHeapNode, i: number) => {\n if (node.isString) {\n const stringNode: IheapStringNode = node.toStringNode();\n // get the string value\n stringNode.stringValue;\n }\n });\n})();\n")),(0,t.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode"))),(0,t.yg)("p",{parentName:"li"},"\u21b3 ",(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"IHeapStringNode"))))),(0,t.yg)("h2",{id:"properties"},"Properties"),(0,t.yg)("h3",{id:"-dominatornode-nullableiheapnode"},(0,t.yg)("a",{id:"dominatornode",name:"dominatornode"})," ",(0,t.yg)("strong",{parentName:"h3"},"dominatorNode"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"),(0,t.yg)("p",null,"get the dominator node of this node. If the dominator node gets released\nthere will be no path from GC to this node, and therefore this node can\nalso be released.\nFor more information on what a dominator node is, please check out\n",(0,t.yg)("a",{parentName:"p",href:"https://developer.chrome.com/docs/devtools/memory-problems/memory-101/#dominators"},"this doc"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1904"},"core/src/lib/Types.ts:1904"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-edge_count-number"},(0,t.yg)("a",{id:"edge\\_count",name:"edge\\_count"})," ",(0,t.yg)("strong",{parentName:"h3"},"edge","_","count"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"The total number of outgoing JS references (including engine-internal,\nnative, and JS references)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1858"},"core/src/lib/Types.ts:1858"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-haspathedge-boolean"},(0,t.yg)("a",{id:"haspathedge",name:"haspathedge"})," ",(0,t.yg)("strong",{parentName:"h3"},"hasPathEdge"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"boolean")),(0,t.yg)("p",null,"returns true if the heap node has been set an incoming edge\nwhich leads to the parent node on the shortest path to GC root."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1880"},"core/src/lib/Types.ts:1880"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-id-number"},(0,t.yg)("a",{id:"id",name:"id"})," ",(0,t.yg)("strong",{parentName:"h3"},"id"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"unique id of the heap object"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1785"},"core/src/lib/Types.ts:1785"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-isstring-boolean"},(0,t.yg)("a",{id:"isstring",name:"isstring"})," ",(0,t.yg)("strong",{parentName:"h3"},"isString"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"boolean")),(0,t.yg)("p",null,"check if this a string node (normal string node, concatenated string node\nor sliced string node)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1916"},"core/src/lib/Types.ts:1916"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-is_detached-boolean"},(0,t.yg)("a",{id:"is\\_detached",name:"is\\_detached"})," ",(0,t.yg)("strong",{parentName:"h3"},"is","_","detached"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"boolean")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},"If the heap object is a DOM element and the DOM element is detached\nfrom the DOM tree, ",(0,t.yg)("inlineCode",{parentName:"p"},"is_detached")," will be ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),";")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},"If the heap object is a React Fiber node and the Fiber node is unmounted\nfrom the React Fiber tree, ",(0,t.yg)("inlineCode",{parentName:"p"},"is_detached")," will be ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),";\notherwise it will be ",(0,t.yg)("inlineCode",{parentName:"p"},"false"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Source"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1840"},"core/src/lib/Types.ts:1840"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-location-nullableiheaplocation"},(0,t.yg)("a",{id:"location",name:"location"})," ",(0,t.yg)("strong",{parentName:"h3"},"location"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapLocation"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapLocation")),">"),(0,t.yg)("p",null,"source location information of this heap object (if it is recorded by\nthe heap snapshot)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1909"},"core/src/lib/Types.ts:1909"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-name-string"},(0,t.yg)("a",{id:"name",name:"name"})," ",(0,t.yg)("strong",{parentName:"h3"},"name"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"string")),(0,t.yg)("p",null,"this is the ",(0,t.yg)("inlineCode",{parentName:"p"},"name")," field associated with the heap object,\nfor JS object instances (type ",(0,t.yg)("inlineCode",{parentName:"p"},"object"),"), ",(0,t.yg)("inlineCode",{parentName:"p"},"name")," is the constructor's name\nof the object instance. for ",(0,t.yg)("inlineCode",{parentName:"p"},"string"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"name")," is the string value."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1781"},"core/src/lib/Types.ts:1781"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-nodeindex-number"},(0,t.yg)("a",{id:"nodeindex",name:"nodeindex"})," ",(0,t.yg)("strong",{parentName:"h3"},"nodeIndex"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"index of this heap object inside the ",(0,t.yg)("inlineCode",{parentName:"p"},"node.snapshot.nodes")," pseudo array"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1889"},"core/src/lib/Types.ts:1889"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-numofreferrers-number"},(0,t.yg)("a",{id:"numofreferrers",name:"numofreferrers"})," ",(0,t.yg)("strong",{parentName:"h3"},"numOfReferrers"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"Get the number of all incoming references pointing to this heap object\n(including engine-internal, native, and JS references)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1875"},"core/src/lib/Types.ts:1875"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-pathedge-null--iheapedge"},(0,t.yg)("a",{id:"pathedge",name:"pathedge"})," ",(0,t.yg)("strong",{parentName:"h3"},"pathEdge"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"null")," ","|"," ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge"))),(0,t.yg)("p",null,"The incoming edge which leads to the parent node\non the shortest path to GC root."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1885"},"core/src/lib/Types.ts:1885"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-references-iheapedge"},(0,t.yg)("a",{id:"references",name:"references"})," ",(0,t.yg)("strong",{parentName:"h3"},"references"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),"[]"),(0,t.yg)("p",null,"Get a JS array containing all outgoing JS references from this heap object\n(including engine-internal, native, and JS references)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1865"},"core/src/lib/Types.ts:1865"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-referrers-iheapedge"},(0,t.yg)("a",{id:"referrers",name:"referrers"})," ",(0,t.yg)("strong",{parentName:"h3"},"referrers"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),"[]"),(0,t.yg)("p",null,"Get a JS array containing all incoming JS references pointing to this heap\nobject (including engine-internal, native, and JS references)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1870"},"core/src/lib/Types.ts:1870"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-retainedsize-number"},(0,t.yg)("a",{id:"retainedsize",name:"retainedsize"})," ",(0,t.yg)("strong",{parentName:"h3"},"retainedSize"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"The ",(0,t.yg)("em",{parentName:"p"},"retained size")," of the heap object (i.e., the total size of memory that\ncould be released if this object is released). For difference between\n",(0,t.yg)("strong",{parentName:"p"},"retained size")," and ",(0,t.yg)("strong",{parentName:"p"},"shallow size"),", check out\n",(0,t.yg)("a",{parentName:"p",href:"https://developer.chrome.com/docs/devtools/memory-problems/memory-101/#object_sizes"},"this doc"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1896"},"core/src/lib/Types.ts:1896"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-self_size-number"},(0,t.yg)("a",{id:"self\\_size",name:"self\\_size"})," ",(0,t.yg)("strong",{parentName:"h3"},"self","_","size"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"The ",(0,t.yg)("em",{parentName:"p"},"shallow size")," of the heap object (i.e., the size of memory that is held\nby the object itself.). For difference between ",(0,t.yg)("strong",{parentName:"p"},"shallow size")," and\n",(0,t.yg)("strong",{parentName:"p"},"retained size"),", check out\n",(0,t.yg)("a",{parentName:"p",href:"https://developer.chrome.com/docs/devtools/memory-problems/memory-101/#object_sizes"},"this doc"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1853"},"core/src/lib/Types.ts:1853"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-snapshot-iheapsnapshot"},(0,t.yg)("a",{id:"snapshot",name:"snapshot"})," ",(0,t.yg)("strong",{parentName:"h3"},"snapshot"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot"))),(0,t.yg)("p",null,"get the ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")," containing this heap object"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1832"},"core/src/lib/Types.ts:1832"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-stringvalue-string"},(0,t.yg)("a",{id:"stringvalue",name:"stringvalue"})," ",(0,t.yg)("strong",{parentName:"h3"},"stringValue"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"string")),(0,t.yg)("p",null,"get the string value of the JS string heap object associated with\nthis ",(0,t.yg)("inlineCode",{parentName:"p"},"IHeapStringNode")," instance in heap"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2226"},"core/src/lib/Types.ts:2226"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-type-string"},(0,t.yg)("a",{id:"type",name:"type"})," ",(0,t.yg)("strong",{parentName:"h3"},"type"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"string")),(0,t.yg)("p",null,"the type of the heap node object. All possible types:\nThis is engine-specific, for example all types in V8:\n",(0,t.yg)("inlineCode",{parentName:"p"},"hidden"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"array"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"string"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"object"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"code"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"closure"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"regexp"),",\n",(0,t.yg)("inlineCode",{parentName:"p"},"number"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"native"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"synthetic"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"concatenated string"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"sliced string"),",\n",(0,t.yg)("inlineCode",{parentName:"p"},"symbol"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"bigint")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1775"},"core/src/lib/Types.ts:1775"))))),(0,t.yg)("h2",{id:"methods"},"Methods"),(0,t.yg)("h3",{id:"findanyreferencepredicate"},(0,t.yg)("a",{id:"findanyreference"}),(0,t.yg)("strong",{parentName:"h3"},"findAnyReference"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"predicate"),")"),(0,t.yg)("p",null,"executes a provided predicate callback once for each JavaScript reference\nin the hosting node (or outgoing edges from the node) until the predicate\nreturns ",(0,t.yg)("inlineCode",{parentName:"p"},"true")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"predicate"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#predicator"},(0,t.yg)("inlineCode",{parentName:"a"},"Predicator")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the callback for each outgoing JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the first outgoing edge for which the predicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),",\notherwise returns ",(0,t.yg)("inlineCode",{parentName:"p"},"null")," if no such edge is found.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const reference = node.findAnyReference((edge: IHeapEdge) => {\n // find the outgoing reference with name \"ref\"\n return edge.name_or_index === 'ref';\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1997"},"core/src/lib/Types.ts:1997"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"findanyreferrerpredicate"},(0,t.yg)("a",{id:"findanyreferrer"}),(0,t.yg)("strong",{parentName:"h3"},"findAnyReferrer"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"predicate"),")"),(0,t.yg)("p",null,"executes a provided predicate callback once for each JavaScript reference\npointing to the hosting node (or incoming edges to the node) until the\npredicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"predicate"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#predicator"},(0,t.yg)("inlineCode",{parentName:"a"},"Predicator")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the callback for each incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the first incoming edge for which the predicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),",\notherwise returns ",(0,t.yg)("inlineCode",{parentName:"p"},"null")," if no such edge is found.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const referrer = node.findAnyReferrer((edge: IHeapEdge) => {\n // find the incoming reference with name \"ref\"\n return edge.name_or_index === 'ref';\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2014"},"core/src/lib/Types.ts:2014"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"findanyreferrernodepredicate"},(0,t.yg)("a",{id:"findanyreferrernode"}),(0,t.yg)("strong",{parentName:"h3"},"findAnyReferrerNode"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"predicate"),")"),(0,t.yg)("p",null,"executes a provided predicate callback once for each JavaScript heap\nobject (heap graph node) pointing to the hosting node\n(or nodes having edges to the hosting node) until the predicate\nreturns ",(0,t.yg)("inlineCode",{parentName:"p"},"true")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"predicate"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#predicator"},(0,t.yg)("inlineCode",{parentName:"a"},"Predicator")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the callback for each incoming JavaScript heap object"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the first referring node for which the predicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),",\notherwise returns ",(0,t.yg)("inlineCode",{parentName:"p"},"null")," if no such node is found.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const referrer = node.findAnyReferrerNode((node: IHeapNode) => {\n // find the referring node with name \"Parent\"\n return node.name === 'Parent';\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2032"},"core/src/lib/Types.ts:2032"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"findreferrernodespredicate"},(0,t.yg)("a",{id:"findreferrernodes"}),(0,t.yg)("strong",{parentName:"h3"},"findReferrerNodes"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"predicate"),")"),(0,t.yg)("p",null,"executes a provided predicate callback once for each JavaScript heap\nobject (heap graph node) pointing to the hosting node\n(or nodes having edges to the hosting node)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"predicate"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#predicator"},(0,t.yg)("inlineCode",{parentName:"a"},"Predicator")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the callback for each referrer nodes"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),"[] | an array containing all the referrer nodes for which the\npredicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),", otherwise returns an empty array if no such\nnode is found.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const referrerNodes = node.findReferrerNodes((node: IHeapNode) => {\n // find all the referring nodes with name \"Parent\"\n return node.name === 'Parent';\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2067"},"core/src/lib/Types.ts:2067"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"findreferrerspredicate"},(0,t.yg)("a",{id:"findreferrers"}),(0,t.yg)("strong",{parentName:"h3"},"findReferrers"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"predicate"),")"),(0,t.yg)("p",null,"executes a provided predicate callback once for each JavaScript reference\npointing to the hosting node (or incoming edges to the node)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"predicate"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#predicator"},(0,t.yg)("inlineCode",{parentName:"a"},"Predicator")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the callback for each incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),"[] | an array containing all the incoming edges for which the\npredicate returns ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),", otherwise returns an empty array if no such\nedge is found.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const referrers = node.findReferrers((edge: IHeapEdge) => {\n // find all the incoming references with name \"ref\"\n return edge.name_or_index === 'ref';\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2049"},"core/src/lib/Types.ts:2049"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"foreachreferencecallback"},(0,t.yg)("a",{id:"foreachreference"}),(0,t.yg)("strong",{parentName:"h3"},"forEachReference"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"callback"),")"),(0,t.yg)("p",null,"executes a provided callback once for each JavaScript reference in the\nhosting node (or outgoing edges from the node)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"callback"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#edgeiterationcallback"},(0,t.yg)("inlineCode",{parentName:"a"},"EdgeIterationCallback"))," | the callback for each outgoing JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"p"},"void")," | this API returns void")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"node.forEachReference((edge: IHeapEdge) => {\n // process edge ...\n\n // if no need to iterate over remaining edges after\n // the current edge in the node.references list\n return {stop: true};\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1962"},"core/src/lib/Types.ts:1962"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"foreachreferrercallback"},(0,t.yg)("a",{id:"foreachreferrer"}),(0,t.yg)("strong",{parentName:"h3"},"forEachReferrer"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"callback"),")"),(0,t.yg)("p",null,"executes a provided callback once for each JavaScript reference pointing\nto the hosting node (or incoming edges to the node)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"callback"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#edgeiterationcallback"},(0,t.yg)("inlineCode",{parentName:"a"},"EdgeIterationCallback"))," | the callback for each incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"p"},"void")," | this API returns void")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"node.forEachReferrer((edge: IHeapEdge) => {\n // process edge ...\n\n // if no need to iterate over remaining edges after\n // the current edge in the node.referrers list\n return {stop: true};\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1980"},"core/src/lib/Types.ts:1980"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getanyreferreredgename-edgetype"},(0,t.yg)("a",{id:"getanyreferrer"}),(0,t.yg)("strong",{parentName:"h3"},"getAnyReferrer"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds an incoming JS\nreference pointing to the hosting node."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the incoming JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the incoming edge that meets the specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find one of the JS reference named \"ref\" pointing to node\nconst reference = node.getAnyReferrer('ref', 'property');\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2122"},"core/src/lib/Types.ts:2122"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getanyreferrernodeedgename-edgetype"},(0,t.yg)("a",{id:"getanyreferrernode"}),(0,t.yg)("strong",{parentName:"h3"},"getAnyReferrerNode"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds one of the incoming JS\nreferences pointing to the hosting node, and returns the JS heap object\ncontaining the incoming reference."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the incoming JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the node containing the incoming JS reference that meets\nthe specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find one of the JS heap object with a JS reference\n// named \"ref\" pointing to node\nconst n1 = node.getAnyReferrerNode('ref', 'property');\n// this is equivalent to\nconst n2 = node.getAnyReferrer('ref', 'property')?.fromNode;\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2145"},"core/src/lib/Types.ts:2145"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getjsonifyableobject"},(0,t.yg)("a",{id:"getjsonifyableobject"}),(0,t.yg)("strong",{parentName:"h3"},"getJSONifyableObject"),"()"),(0,t.yg)("p",null,"convert to a concise readable object that can be used for serialization\n(like calling ",(0,t.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)"),")."),(0,t.yg)("p",null,"This API does not contain all the information\ncaptured by the hosting object."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"AnyRecord")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1931"},"core/src/lib/Types.ts:1931"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getreferenceedgename-edgetype"},(0,t.yg)("a",{id:"getreference"}),(0,t.yg)("strong",{parentName:"h3"},"getReference"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds an outgoing JS\nreference from the hosting node."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the outgoing JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the outgoing JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | the outgoing edge that meets the specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find the internal reference to node's hidden class\nconst reference = node.getReference('map', 'hidden');\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2082"},"core/src/lib/Types.ts:2082"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getreferencenodeedgename-edgetype"},(0,t.yg)("a",{id:"getreferencenode"}),(0,t.yg)("strong",{parentName:"h3"},"getReferenceNode"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds the outgoing JS\nreference from the hosting node, and returns the JS heap object pointed to\nby the outgoing JS reference."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the outgoing JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the outgoing JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the node pointed to by the outgoing reference that meets\nthe specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find the node's hidden class\nconst hiddenClassNode = node.getReferenceNode('map', 'hidden');\n// this is equivalent to\nconst hiddenClassNode2 = node.getReference('map', 'hidden')?.toNode;\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2104"},"core/src/lib/Types.ts:2104"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getreferrernodesedgename-edgetype"},(0,t.yg)("a",{id:"getreferrernodes"}),(0,t.yg)("strong",{parentName:"h3"},"getReferrerNodes"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds all of the incoming JS\nreferences pointing to the hosting node, and returns an array containing\nthe hosting node for each of the incoming JS references."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the incoming JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),"[] | an array containing the hosting nodes, with each node corresponds\nto each incoming JS reference that meets the specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find all of the JS heap object with a JS reference\n// named \"ref\" pointing to node\nconst nodes1 = node.getReferrerNodes('ref', 'property');\n// this is equivalent to\nconst nodes2 = node.getReferrers('ref', 'property')\n .map(edge => edge.fromNode);\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2185"},"core/src/lib/Types.ts:2185"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getreferrersedgename-edgetype"},(0,t.yg)("a",{id:"getreferrers"}),(0,t.yg)("strong",{parentName:"h3"},"getReferrers"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeName"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"edgeType?"),")"),(0,t.yg)("p",null,"Given a JS reference's name and type, this API finds all the incoming JS\nreference pointing to the hosting node."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeName"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the name of the incoming JavaScript reference"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edgeType?"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | optional parameter specifying the type of the incoming JavaScript reference"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),"[] | an array containing all the incoming edges that\nmeet the specification")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"// find all of of the JS reference named \"ref\" pointing to node\nconst referrers = node.getReferrers('ref', 'property');\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2164"},"core/src/lib/Types.ts:2164"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"tojsonstringargs"},(0,t.yg)("a",{id:"tojsonstring"}),(0,t.yg)("strong",{parentName:"h3"},"toJSONString"),"(...",(0,t.yg)("inlineCode",{parentName:"h3"},"args"),")"),(0,t.yg)("p",null,"convert to a concise readable string output\n(like calling ",(0,t.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)"),")."),(0,t.yg)("p",null,"Note: Please be aware that using ",(0,t.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)")," is\nnot recommended as it will generate a JSON representation of the host\nobject that is too large to be easily readable due to its connections\nto other parts of the data structures within the heap snapshot."),(0,t.yg)("p",null,"This API does not completely serialize all the information\ncaptured by the hosting object."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"...args"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"any"),"[]"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1944"},"core/src/lib/Types.ts:1944"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"tostringnode"},(0,t.yg)("a",{id:"tostringnode"}),(0,t.yg)("strong",{parentName:"h3"},"toStringNode"),"()"),(0,t.yg)("p",null,"convert to an ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapStringNode"},"IHeapStringNode")," object if this node is a string node.\nThe ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapStringNode"},"IHeapStringNode")," object supports querying the string content\ninside the string node."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapStringNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapStringNode")),">"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1922"},"core/src/lib/Types.ts:1922"))))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2d8affd8.b192b553.js b/assets/js/2d8affd8.2431d2ef.js similarity index 88% rename from assets/js/2d8affd8.b192b553.js rename to assets/js/2d8affd8.2431d2ef.js index 09919d31..91d61bfb 100644 --- a/assets/js/2d8affd8.b192b553.js +++ b/assets/js/2d8affd8.2431d2ef.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[8032],{5680:(e,t,n)=>{n.d(t,{xA:()=>p,yg:()=>g});var a=n(6540);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),u=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=u(e.components);return a.createElement(s.Provider,{value:t},e.children)},m="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),m=u(n),d=r,g=m["".concat(s,".").concat(d)]||m[d]||c[d]||o;return n?a.createElement(g,l(l({ref:t},p),{},{components:n})):a.createElement(g,l({ref:t},p))}));function g(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[m]="string"==typeof e?e:r,l[1]=i;for(var u=2;u{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>u});var a=n(8168),r=(n(6540),n(5680));const o={id:"api_src.ConsoleMode",title:"Enumeration: ConsoleMode",sidebar_label:"ConsoleMode",custom_edit_url:null},l=void 0,i={unversionedId:"api/enums/api_src.ConsoleMode",id:"api/enums/api_src.ConsoleMode",title:"Enumeration: ConsoleMode",description:"enum of all console mode options",source:"@site/docs/api/enums/api_src.ConsoleMode.md",sourceDirName:"api/enums",slug:"/api/enums/api_src.ConsoleMode",permalink:"/memlab/docs/api/enums/api_src.ConsoleMode",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"api_src.ConsoleMode",title:"Enumeration: ConsoleMode",sidebar_label:"ConsoleMode",custom_edit_url:null},sidebar:"sidebar",previous:{title:"heap-analysis/src",permalink:"/memlab/docs/api/modules/heap_analysis_src"},next:{title:"BrowserInteractionResultReader",permalink:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"}},s={},u=[{value:"Enumeration Members",id:"enumeration-members",level:2},{value:' CONTINUOUS_TEST',id:"-continuous_test",level:3},{value:' DEFAULT',id:"-default",level:3},{value:' SILENT',id:"-silent",level:3},{value:' VERBOSE',id:"-verbose",level:3}],p={toc:u},m="wrapper";function c(e){let{components:t,...n}=e;return(0,r.yg)(m,(0,a.A)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.yg)("p",null,"enum of all console mode options"),(0,r.yg)("h2",{id:"enumeration-members"},"Enumeration Members"),(0,r.yg)("h3",{id:"-continuous_test"},(0,r.yg)("a",{id:"continuous\\_test",name:"continuous\\_test"})," ",(0,r.yg)("strong",{parentName:"h3"},"CONTINUOUS","_","TEST")),(0,r.yg)("p",null,"continuous test mode, no terminal output overwrite or animation,\nequivalent to using ",(0,r.yg)("inlineCode",{parentName:"p"},"--sc")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/state/ConsoleModeManager.ts#L26"},"api/src/state/ConsoleModeManager.ts:26"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-default"},(0,r.yg)("a",{id:"default",name:"default"})," ",(0,r.yg)("strong",{parentName:"h3"},"DEFAULT")),(0,r.yg)("p",null,"the default mode, there could be terminal output overwrite and animation,"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/state/ConsoleModeManager.ts#L30"},"api/src/state/ConsoleModeManager.ts:30"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-silent"},(0,r.yg)("a",{id:"silent",name:"silent"})," ",(0,r.yg)("strong",{parentName:"h3"},"SILENT")),(0,r.yg)("p",null,"mute all terminal output, equivalent to using ",(0,r.yg)("inlineCode",{parentName:"p"},"--silent")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/state/ConsoleModeManager.ts#L21"},"api/src/state/ConsoleModeManager.ts:21"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-verbose"},(0,r.yg)("a",{id:"verbose",name:"verbose"})," ",(0,r.yg)("strong",{parentName:"h3"},"VERBOSE")),(0,r.yg)("p",null,"verbose mode, there could be terminal output overwrite and animation"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/state/ConsoleModeManager.ts#L34"},"api/src/state/ConsoleModeManager.ts:34"))))))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[8032],{5680:(e,t,n)=>{n.d(t,{xA:()=>p,yg:()=>d});var a=n(6540);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),u=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=u(e.components);return a.createElement(s.Provider,{value:t},e.children)},m="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},g=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),m=u(n),g=r,d=m["".concat(s,".").concat(g)]||m[g]||c[g]||o;return n?a.createElement(d,l(l({ref:t},p),{},{components:n})):a.createElement(d,l({ref:t},p))}));function d(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=g;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[m]="string"==typeof e?e:r,l[1]=i;for(var u=2;u{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>u});var a=n(8168),r=(n(6540),n(5680));const o={id:"api_src.ConsoleMode",title:"Enumeration: ConsoleMode",sidebar_label:"ConsoleMode",custom_edit_url:null},l=void 0,i={unversionedId:"api/enums/api_src.ConsoleMode",id:"api/enums/api_src.ConsoleMode",title:"Enumeration: ConsoleMode",description:"enum of all console mode options",source:"@site/docs/api/enums/api_src.ConsoleMode.md",sourceDirName:"api/enums",slug:"/api/enums/api_src.ConsoleMode",permalink:"/memlab/docs/api/enums/api_src.ConsoleMode",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"api_src.ConsoleMode",title:"Enumeration: ConsoleMode",sidebar_label:"ConsoleMode",custom_edit_url:null},sidebar:"sidebar",previous:{title:"heap-analysis/src",permalink:"/memlab/docs/api/modules/heap_analysis_src"},next:{title:"BrowserInteractionResultReader",permalink:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"}},s={},u=[{value:"Enumeration Members",id:"enumeration-members",level:2},{value:' CONTINUOUS_TEST',id:"-continuous_test",level:3},{value:' DEFAULT',id:"-default",level:3},{value:' SILENT',id:"-silent",level:3},{value:' VERBOSE',id:"-verbose",level:3}],p={toc:u},m="wrapper";function c(e){let{components:t,...n}=e;return(0,r.yg)(m,(0,a.A)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.yg)("p",null,"enum of all console mode options"),(0,r.yg)("h2",{id:"enumeration-members"},"Enumeration Members"),(0,r.yg)("h3",{id:"-continuous_test"},(0,r.yg)("a",{id:"continuous\\_test",name:"continuous\\_test"})," ",(0,r.yg)("strong",{parentName:"h3"},"CONTINUOUS","_","TEST")),(0,r.yg)("p",null,"continuous test mode, no terminal output overwrite or animation,\nequivalent to using ",(0,r.yg)("inlineCode",{parentName:"p"},"--sc")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/state/ConsoleModeManager.ts#L26"},"api/src/state/ConsoleModeManager.ts:26"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-default"},(0,r.yg)("a",{id:"default",name:"default"})," ",(0,r.yg)("strong",{parentName:"h3"},"DEFAULT")),(0,r.yg)("p",null,"the default mode, there could be terminal output overwrite and animation,"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/state/ConsoleModeManager.ts#L30"},"api/src/state/ConsoleModeManager.ts:30"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-silent"},(0,r.yg)("a",{id:"silent",name:"silent"})," ",(0,r.yg)("strong",{parentName:"h3"},"SILENT")),(0,r.yg)("p",null,"mute all terminal output, equivalent to using ",(0,r.yg)("inlineCode",{parentName:"p"},"--silent")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/state/ConsoleModeManager.ts#L21"},"api/src/state/ConsoleModeManager.ts:21"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-verbose"},(0,r.yg)("a",{id:"verbose",name:"verbose"})," ",(0,r.yg)("strong",{parentName:"h3"},"VERBOSE")),(0,r.yg)("p",null,"verbose mode, there could be terminal output overwrite and animation"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/state/ConsoleModeManager.ts#L34"},"api/src/state/ConsoleModeManager.ts:34"))))))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2ecac66d.327215f5.js b/assets/js/2ecac66d.9dd709d1.js similarity index 94% rename from assets/js/2ecac66d.327215f5.js rename to assets/js/2ecac66d.9dd709d1.js index 7fdf9911..f8e3c506 100644 --- a/assets/js/2ecac66d.327215f5.js +++ b/assets/js/2ecac66d.9dd709d1.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[1797],{5680:(e,a,n)=>{n.d(a,{xA:()=>y,yg:()=>d});var t=n(6540);function l(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function s(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function i(e){for(var a=1;a=0||(l[n]=e[n]);return l}(e,a);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}var o=t.createContext({}),p=function(e){var a=t.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},y=function(e){var a=p(e.components);return t.createElement(o.Provider,{value:a},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},g=t.forwardRef((function(e,a){var n=e.components,l=e.mdxType,s=e.originalType,o=e.parentName,y=r(e,["components","mdxType","originalType","parentName"]),c=p(n),g=l,d=c["".concat(o,".").concat(g)]||c[g]||m[g]||s;return n?t.createElement(d,i(i({ref:a},y),{},{components:n})):t.createElement(d,i({ref:a},y))}));function d(e,a){var n=arguments,l=a&&a.mdxType;if("string"==typeof e||l){var s=n.length,i=new Array(s);i[0]=g;var r={};for(var o in a)hasOwnProperty.call(a,o)&&(r[o]=a[o]);r.originalType=e,r[c]="string"==typeof e?e:l,i[1]=r;for(var p=2;p{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>i,default:()=>m,frontMatter:()=>s,metadata:()=>r,toc:()=>p});var t=n(8168),l=(n(6540),n(5680));const s={id:"heap_analysis_src.DetachedDOMElementAnalysis",title:"Class: DetachedDOMElementAnalysis",sidebar_label:"DetachedDOMElementAnalysis",custom_edit_url:null},i=void 0,r={unversionedId:"api/classes/heap_analysis_src.DetachedDOMElementAnalysis",id:"api/classes/heap_analysis_src.DetachedDOMElementAnalysis",title:"Class: DetachedDOMElementAnalysis",description:"Hierarchy",source:"@site/docs/api/classes/heap_analysis_src.DetachedDOMElementAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.DetachedDOMElementAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.DetachedDOMElementAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.DetachedDOMElementAnalysis",title:"Class: DetachedDOMElementAnalysis",sidebar_label:"DetachedDOMElementAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"CollectionsHoldingStaleAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.CollectionsHoldingStaleAnalysis"},next:{title:"GlobalVariableAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.GlobalVariableAnalysis"}},o={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new DetachedDOMElementAnalysis()',id:"new-detacheddomelementanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotFromFile(file, options?)',id:"analyzesnapshotfromfilefile-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3},{value:'getDetachedElements()',id:"getdetachedelements",level:3}],y={toc:p},c="wrapper";function m(e){let{components:a,...n}=e;return(0,l.yg)(c,(0,t.A)({},y,n,{components:a,mdxType:"MDXLayout"}),(0,l.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("p",{parentName:"li"},(0,l.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},(0,l.yg)("inlineCode",{parentName:"a"},"BaseAnalysis"))),(0,l.yg)("p",{parentName:"li"},"\u21b3 ",(0,l.yg)("strong",{parentName:"p"},(0,l.yg)("inlineCode",{parentName:"strong"},"DetachedDOMElementAnalysis"))))),(0,l.yg)("h2",{id:"constructors"},"Constructors"),(0,l.yg)("h3",{id:"new-detacheddomelementanalysis"},(0,l.yg)("a",{id:"new detacheddomelementanalysis"}),(0,l.yg)("strong",{parentName:"h3"},"new DetachedDOMElementAnalysis"),"()"),(0,l.yg)("h2",{id:"methods"},"Methods"),(0,l.yg)("h3",{id:"analyzesnapshotfromfilefile-options"},(0,l.yg)("a",{id:"analyzesnapshotfromfile"}),(0,l.yg)("strong",{parentName:"h3"},"analyzeSnapshotFromFile"),"(",(0,l.yg)("inlineCode",{parentName:"h3"},"file"),", ",(0,l.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,l.yg)("p",null,"Run heap analysis for a single heap snapshot file"),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Parameters"),":",(0,l.yg)("ul",{parentName:"li"},(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,l.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of a ",(0,l.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," file."),(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,l.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,l.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Returns"),": ",(0,l.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,l.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,l.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,l.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Example"),":")),(0,l.yg)("pre",null,(0,l.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile);\n// query analysis-specific and structured results\nconst stringPatterns = analysis.getTopDuplicatedStringsInCount();\n")),(0,l.yg)("p",null,"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:"),(0,l.yg)("pre",null,(0,l.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Source"),":",(0,l.yg)("ul",{parentName:"li"},(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/BaseAnalysis.ts#L95"},"heap-analysis/src/BaseAnalysis.ts:95"))))),(0,l.yg)("hr",null),(0,l.yg)("h3",{id:"getcommandname"},(0,l.yg)("a",{id:"getcommandname"}),(0,l.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,l.yg)("p",null,"Get the name of the heap analysis, which is also used to reference\nthe analysis in memlab command-line tool."),(0,l.yg)("p",null,"The following terminal command will initiate with this analysis:\n",(0,l.yg)("inlineCode",{parentName:"p"},"memlab analyze ")),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Returns"),": ",(0,l.yg)("inlineCode",{parentName:"li"},"string")," | the name of the analysis"),(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Examples"),":")),(0,l.yg)("pre",null,(0,l.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new YourAnalysis();\nconst name = analysis.getCommandName();\n")),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Source"),":",(0,l.yg)("ul",{parentName:"li"},(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/plugins/DetachedDOMElementAnalysis.ts#L21"},"heap-analysis/src/plugins/DetachedDOMElementAnalysis.ts:21"))))),(0,l.yg)("hr",null),(0,l.yg)("h3",{id:"getdetachedelements"},(0,l.yg)("a",{id:"getdetachedelements"}),(0,l.yg)("strong",{parentName:"h3"},"getDetachedElements"),"()"),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Returns"),": ",(0,l.yg)("inlineCode",{parentName:"li"},"IHeapNode"),"[]"),(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Source"),":",(0,l.yg)("ul",{parentName:"li"},(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/plugins/DetachedDOMElementAnalysis.ts#L48"},"heap-analysis/src/plugins/DetachedDOMElementAnalysis.ts:48"))))))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[1797],{5680:(e,a,n)=>{n.d(a,{xA:()=>y,yg:()=>u});var t=n(6540);function l(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function s(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function i(e){for(var a=1;a=0||(l[n]=e[n]);return l}(e,a);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}var o=t.createContext({}),p=function(e){var a=t.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},y=function(e){var a=p(e.components);return t.createElement(o.Provider,{value:a},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},g=t.forwardRef((function(e,a){var n=e.components,l=e.mdxType,s=e.originalType,o=e.parentName,y=r(e,["components","mdxType","originalType","parentName"]),c=p(n),g=l,u=c["".concat(o,".").concat(g)]||c[g]||m[g]||s;return n?t.createElement(u,i(i({ref:a},y),{},{components:n})):t.createElement(u,i({ref:a},y))}));function u(e,a){var n=arguments,l=a&&a.mdxType;if("string"==typeof e||l){var s=n.length,i=new Array(s);i[0]=g;var r={};for(var o in a)hasOwnProperty.call(a,o)&&(r[o]=a[o]);r.originalType=e,r[c]="string"==typeof e?e:l,i[1]=r;for(var p=2;p{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>i,default:()=>m,frontMatter:()=>s,metadata:()=>r,toc:()=>p});var t=n(8168),l=(n(6540),n(5680));const s={id:"heap_analysis_src.DetachedDOMElementAnalysis",title:"Class: DetachedDOMElementAnalysis",sidebar_label:"DetachedDOMElementAnalysis",custom_edit_url:null},i=void 0,r={unversionedId:"api/classes/heap_analysis_src.DetachedDOMElementAnalysis",id:"api/classes/heap_analysis_src.DetachedDOMElementAnalysis",title:"Class: DetachedDOMElementAnalysis",description:"Hierarchy",source:"@site/docs/api/classes/heap_analysis_src.DetachedDOMElementAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.DetachedDOMElementAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.DetachedDOMElementAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.DetachedDOMElementAnalysis",title:"Class: DetachedDOMElementAnalysis",sidebar_label:"DetachedDOMElementAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"CollectionsHoldingStaleAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.CollectionsHoldingStaleAnalysis"},next:{title:"GlobalVariableAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.GlobalVariableAnalysis"}},o={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new DetachedDOMElementAnalysis()',id:"new-detacheddomelementanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotFromFile(file, options?)',id:"analyzesnapshotfromfilefile-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3},{value:'getDetachedElements()',id:"getdetachedelements",level:3}],y={toc:p},c="wrapper";function m(e){let{components:a,...n}=e;return(0,l.yg)(c,(0,t.A)({},y,n,{components:a,mdxType:"MDXLayout"}),(0,l.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("p",{parentName:"li"},(0,l.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},(0,l.yg)("inlineCode",{parentName:"a"},"BaseAnalysis"))),(0,l.yg)("p",{parentName:"li"},"\u21b3 ",(0,l.yg)("strong",{parentName:"p"},(0,l.yg)("inlineCode",{parentName:"strong"},"DetachedDOMElementAnalysis"))))),(0,l.yg)("h2",{id:"constructors"},"Constructors"),(0,l.yg)("h3",{id:"new-detacheddomelementanalysis"},(0,l.yg)("a",{id:"new detacheddomelementanalysis"}),(0,l.yg)("strong",{parentName:"h3"},"new DetachedDOMElementAnalysis"),"()"),(0,l.yg)("h2",{id:"methods"},"Methods"),(0,l.yg)("h3",{id:"analyzesnapshotfromfilefile-options"},(0,l.yg)("a",{id:"analyzesnapshotfromfile"}),(0,l.yg)("strong",{parentName:"h3"},"analyzeSnapshotFromFile"),"(",(0,l.yg)("inlineCode",{parentName:"h3"},"file"),", ",(0,l.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,l.yg)("p",null,"Run heap analysis for a single heap snapshot file"),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Parameters"),":",(0,l.yg)("ul",{parentName:"li"},(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,l.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of a ",(0,l.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," file."),(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,l.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,l.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Returns"),": ",(0,l.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,l.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,l.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,l.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Example"),":")),(0,l.yg)("pre",null,(0,l.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile);\n// query analysis-specific and structured results\nconst stringPatterns = analysis.getTopDuplicatedStringsInCount();\n")),(0,l.yg)("p",null,"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:"),(0,l.yg)("pre",null,(0,l.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Source"),":",(0,l.yg)("ul",{parentName:"li"},(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/BaseAnalysis.ts#L95"},"heap-analysis/src/BaseAnalysis.ts:95"))))),(0,l.yg)("hr",null),(0,l.yg)("h3",{id:"getcommandname"},(0,l.yg)("a",{id:"getcommandname"}),(0,l.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,l.yg)("p",null,"Get the name of the heap analysis, which is also used to reference\nthe analysis in memlab command-line tool."),(0,l.yg)("p",null,"The following terminal command will initiate with this analysis:\n",(0,l.yg)("inlineCode",{parentName:"p"},"memlab analyze ")),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Returns"),": ",(0,l.yg)("inlineCode",{parentName:"li"},"string")," | the name of the analysis"),(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Examples"),":")),(0,l.yg)("pre",null,(0,l.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new YourAnalysis();\nconst name = analysis.getCommandName();\n")),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Source"),":",(0,l.yg)("ul",{parentName:"li"},(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/plugins/DetachedDOMElementAnalysis.ts#L21"},"heap-analysis/src/plugins/DetachedDOMElementAnalysis.ts:21"))))),(0,l.yg)("hr",null),(0,l.yg)("h3",{id:"getdetachedelements"},(0,l.yg)("a",{id:"getdetachedelements"}),(0,l.yg)("strong",{parentName:"h3"},"getDetachedElements"),"()"),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Returns"),": ",(0,l.yg)("inlineCode",{parentName:"li"},"IHeapNode"),"[]"),(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Source"),":",(0,l.yg)("ul",{parentName:"li"},(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/plugins/DetachedDOMElementAnalysis.ts#L48"},"heap-analysis/src/plugins/DetachedDOMElementAnalysis.ts:48"))))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3531de3b.8689b73f.js b/assets/js/3531de3b.6b8696d9.js similarity index 96% rename from assets/js/3531de3b.8689b73f.js rename to assets/js/3531de3b.6b8696d9.js index 57c7d35c..a3c65b7d 100644 --- a/assets/js/3531de3b.8689b73f.js +++ b/assets/js/3531de3b.6b8696d9.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[9477],{5680:(e,r,n)=>{n.d(r,{xA:()=>p,yg:()=>m});var t=n(6540);function o(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function a(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function s(e){for(var r=1;r=0||(o[n]=e[n]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=t.createContext({}),c=function(e){var r=t.useContext(l),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},p=function(e){var r=c(e.components);return t.createElement(l.Provider,{value:r},e.children)},u="mdxType",g={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},f=t.forwardRef((function(e,r){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(n),f=o,m=u["".concat(l,".").concat(f)]||u[f]||g[f]||a;return n?t.createElement(m,s(s({ref:r},p),{},{components:n})):t.createElement(m,s({ref:r},p))}));function m(e,r){var n=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=f;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i[u]="string"==typeof e?e:o,s[1]=i;for(var c=2;c{n.r(r),n.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>g,frontMatter:()=>a,metadata:()=>i,toc:()=>c});var t=n(8168),o=(n(6540),n(5680));const a={id:"core_src.IBrowserInfo",title:"Interface: IBrowserInfo",sidebar_label:"IBrowserInfo",custom_edit_url:null},s=void 0,i={unversionedId:"api/interfaces/core_src.IBrowserInfo",id:"api/interfaces/core_src.IBrowserInfo",title:"Interface: IBrowserInfo",description:"This data structure contains the input configuration for the browser and",source:"@site/docs/api/interfaces/core_src.IBrowserInfo.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/core_src.IBrowserInfo",permalink:"/memlab/docs/api/interfaces/core_src.IBrowserInfo",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"core_src.IBrowserInfo",title:"Interface: IBrowserInfo",sidebar_label:"IBrowserInfo",custom_edit_url:null},sidebar:"sidebar",previous:{title:"StringAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.StringAnalysis"},next:{title:"IHeapEdge",permalink:"/memlab/docs/api/interfaces/core_src.IHeapEdge"}},l={},c=[{value:"Properties",id:"properties",level:2},{value:' _browserVersion: string',id:"-_browserversion-string",level:3},{value:' _consoleMessages: string[]',id:"-_consolemessages-string",level:3},{value:' _puppeteerConfig: LaunchOptions',id:"-_puppeteerconfig-launchoptions",level:3}],p={toc:c},u="wrapper";function g(e){let{components:r,...n}=e;return(0,o.yg)(u,(0,t.A)({},p,n,{components:r,mdxType:"MDXLayout"}),(0,o.yg)("p",null,"This data structure contains the input configuration for the browser and\noutput data from the browser. You can retrieve the instance of this type\nthrough ",(0,o.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#runmetainfo"},"RunMetaInfo"),"."),(0,o.yg)("h2",{id:"properties"},"Properties"),(0,o.yg)("h3",{id:"-_browserversion-string"},(0,o.yg)("a",{id:"\\_browserversion",name:"\\_browserversion"})," ",(0,o.yg)("strong",{parentName:"h3"},"_","browserVersion"),": ",(0,o.yg)("inlineCode",{parentName:"h3"},"string")),(0,o.yg)("p",null,"browser version"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("strong",{parentName:"li"},"Source"),":",(0,o.yg)("ul",{parentName:"li"},(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1232"},"core/src/lib/Types.ts:1232"))))),(0,o.yg)("hr",null),(0,o.yg)("h3",{id:"-_consolemessages-string"},(0,o.yg)("a",{id:"\\_consolemessages",name:"\\_consolemessages"})," ",(0,o.yg)("strong",{parentName:"h3"},"_","consoleMessages"),": ",(0,o.yg)("inlineCode",{parentName:"h3"},"string"),"[]"),(0,o.yg)("p",null,"all web console output"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("strong",{parentName:"li"},"Source"),":",(0,o.yg)("ul",{parentName:"li"},(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1240"},"core/src/lib/Types.ts:1240"))))),(0,o.yg)("hr",null),(0,o.yg)("h3",{id:"-_puppeteerconfig-launchoptions"},(0,o.yg)("a",{id:"\\_puppeteerconfig",name:"\\_puppeteerconfig"})," ",(0,o.yg)("strong",{parentName:"h3"},"_","puppeteerConfig"),": ",(0,o.yg)("inlineCode",{parentName:"h3"},"LaunchOptions")),(0,o.yg)("p",null,"configuration for puppeteer"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("strong",{parentName:"li"},"Source"),":",(0,o.yg)("ul",{parentName:"li"},(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1236"},"core/src/lib/Types.ts:1236"))))))}g.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[9477],{5680:(e,r,n)=>{n.d(r,{xA:()=>p,yg:()=>m});var t=n(6540);function o(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function a(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function s(e){for(var r=1;r=0||(o[n]=e[n]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=t.createContext({}),c=function(e){var r=t.useContext(l),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},p=function(e){var r=c(e.components);return t.createElement(l.Provider,{value:r},e.children)},u="mdxType",g={inlineCode:"code",wrapper:function(e){var r=e.children;return t.createElement(t.Fragment,{},r)}},f=t.forwardRef((function(e,r){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(n),f=o,m=u["".concat(l,".").concat(f)]||u[f]||g[f]||a;return n?t.createElement(m,s(s({ref:r},p),{},{components:n})):t.createElement(m,s({ref:r},p))}));function m(e,r){var n=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=f;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i[u]="string"==typeof e?e:o,s[1]=i;for(var c=2;c{n.r(r),n.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>g,frontMatter:()=>a,metadata:()=>i,toc:()=>c});var t=n(8168),o=(n(6540),n(5680));const a={id:"core_src.IBrowserInfo",title:"Interface: IBrowserInfo",sidebar_label:"IBrowserInfo",custom_edit_url:null},s=void 0,i={unversionedId:"api/interfaces/core_src.IBrowserInfo",id:"api/interfaces/core_src.IBrowserInfo",title:"Interface: IBrowserInfo",description:"This data structure contains the input configuration for the browser and",source:"@site/docs/api/interfaces/core_src.IBrowserInfo.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/core_src.IBrowserInfo",permalink:"/memlab/docs/api/interfaces/core_src.IBrowserInfo",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"core_src.IBrowserInfo",title:"Interface: IBrowserInfo",sidebar_label:"IBrowserInfo",custom_edit_url:null},sidebar:"sidebar",previous:{title:"StringAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.StringAnalysis"},next:{title:"IHeapEdge",permalink:"/memlab/docs/api/interfaces/core_src.IHeapEdge"}},l={},c=[{value:"Properties",id:"properties",level:2},{value:' _browserVersion: string',id:"-_browserversion-string",level:3},{value:' _consoleMessages: string[]',id:"-_consolemessages-string",level:3},{value:' _puppeteerConfig: LaunchOptions',id:"-_puppeteerconfig-launchoptions",level:3}],p={toc:c},u="wrapper";function g(e){let{components:r,...n}=e;return(0,o.yg)(u,(0,t.A)({},p,n,{components:r,mdxType:"MDXLayout"}),(0,o.yg)("p",null,"This data structure contains the input configuration for the browser and\noutput data from the browser. You can retrieve the instance of this type\nthrough ",(0,o.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#runmetainfo"},"RunMetaInfo"),"."),(0,o.yg)("h2",{id:"properties"},"Properties"),(0,o.yg)("h3",{id:"-_browserversion-string"},(0,o.yg)("a",{id:"\\_browserversion",name:"\\_browserversion"})," ",(0,o.yg)("strong",{parentName:"h3"},"_","browserVersion"),": ",(0,o.yg)("inlineCode",{parentName:"h3"},"string")),(0,o.yg)("p",null,"browser version"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("strong",{parentName:"li"},"Source"),":",(0,o.yg)("ul",{parentName:"li"},(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1232"},"core/src/lib/Types.ts:1232"))))),(0,o.yg)("hr",null),(0,o.yg)("h3",{id:"-_consolemessages-string"},(0,o.yg)("a",{id:"\\_consolemessages",name:"\\_consolemessages"})," ",(0,o.yg)("strong",{parentName:"h3"},"_","consoleMessages"),": ",(0,o.yg)("inlineCode",{parentName:"h3"},"string"),"[]"),(0,o.yg)("p",null,"all web console output"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("strong",{parentName:"li"},"Source"),":",(0,o.yg)("ul",{parentName:"li"},(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1240"},"core/src/lib/Types.ts:1240"))))),(0,o.yg)("hr",null),(0,o.yg)("h3",{id:"-_puppeteerconfig-launchoptions"},(0,o.yg)("a",{id:"\\_puppeteerconfig",name:"\\_puppeteerconfig"})," ",(0,o.yg)("strong",{parentName:"h3"},"_","puppeteerConfig"),": ",(0,o.yg)("inlineCode",{parentName:"h3"},"LaunchOptions")),(0,o.yg)("p",null,"configuration for puppeteer"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("strong",{parentName:"li"},"Source"),":",(0,o.yg)("ul",{parentName:"li"},(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1236"},"core/src/lib/Types.ts:1236"))))))}g.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4527bbe9.46c3ba3a.js b/assets/js/4527bbe9.d56ca64d.js similarity index 98% rename from assets/js/4527bbe9.46c3ba3a.js rename to assets/js/4527bbe9.d56ca64d.js index 5a34fb9a..0f385013 100644 --- a/assets/js/4527bbe9.46c3ba3a.js +++ b/assets/js/4527bbe9.d56ca64d.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[2625],{5680:(e,a,n)=>{n.d(a,{xA:()=>y,yg:()=>g});var l=n(6540);function s(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function t(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);a&&(l=l.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,l)}return n}function i(e){for(var a=1;a=0||(s[n]=e[n]);return s}(e,a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);for(l=0;l=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var o=l.createContext({}),p=function(e){var a=l.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},y=function(e){var a=p(e.components);return l.createElement(o.Provider,{value:a},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var a=e.children;return l.createElement(l.Fragment,{},a)}},u=l.forwardRef((function(e,a){var n=e.components,s=e.mdxType,t=e.originalType,o=e.parentName,y=r(e,["components","mdxType","originalType","parentName"]),c=p(n),u=s,g=c["".concat(o,".").concat(u)]||c[u]||m[u]||t;return n?l.createElement(g,i(i({ref:a},y),{},{components:n})):l.createElement(g,i({ref:a},y))}));function g(e,a){var n=arguments,s=a&&a.mdxType;if("string"==typeof e||s){var t=n.length,i=new Array(t);i[0]=u;var r={};for(var o in a)hasOwnProperty.call(a,o)&&(r[o]=a[o]);r.originalType=e,r[c]="string"==typeof e?e:s,i[1]=r;for(var p=2;p{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>i,default:()=>m,frontMatter:()=>t,metadata:()=>r,toc:()=>p});var l=n(8168),s=(n(6540),n(5680));const t={id:"heap_analysis_src.GlobalVariableAnalysis",title:"Class: GlobalVariableAnalysis",sidebar_label:"GlobalVariableAnalysis",custom_edit_url:null},i=void 0,r={unversionedId:"api/classes/heap_analysis_src.GlobalVariableAnalysis",id:"api/classes/heap_analysis_src.GlobalVariableAnalysis",title:"Class: GlobalVariableAnalysis",description:"Hierarchy",source:"@site/docs/api/classes/heap_analysis_src.GlobalVariableAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.GlobalVariableAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.GlobalVariableAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.GlobalVariableAnalysis",title:"Class: GlobalVariableAnalysis",sidebar_label:"GlobalVariableAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"DetachedDOMElementAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.DetachedDOMElementAnalysis"},next:{title:"ObjectFanoutAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectFanoutAnalysis"}},o={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new GlobalVariableAnalysis()',id:"new-globalvariableanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotFromFile(file, options?)',id:"analyzesnapshotfromfilefile-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3}],y={toc:p},c="wrapper";function m(e){let{components:a,...n}=e;return(0,s.yg)(c,(0,l.A)({},y,n,{components:a,mdxType:"MDXLayout"}),(0,s.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},(0,s.yg)("inlineCode",{parentName:"a"},"BaseAnalysis"))),(0,s.yg)("p",{parentName:"li"},"\u21b3 ",(0,s.yg)("strong",{parentName:"p"},(0,s.yg)("inlineCode",{parentName:"strong"},"GlobalVariableAnalysis"))))),(0,s.yg)("h2",{id:"constructors"},"Constructors"),(0,s.yg)("h3",{id:"new-globalvariableanalysis"},(0,s.yg)("a",{id:"new globalvariableanalysis"}),(0,s.yg)("strong",{parentName:"h3"},"new GlobalVariableAnalysis"),"()"),(0,s.yg)("h2",{id:"methods"},"Methods"),(0,s.yg)("h3",{id:"analyzesnapshotfromfilefile-options"},(0,s.yg)("a",{id:"analyzesnapshotfromfile"}),(0,s.yg)("strong",{parentName:"h3"},"analyzeSnapshotFromFile"),"(",(0,s.yg)("inlineCode",{parentName:"h3"},"file"),", ",(0,s.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,s.yg)("p",null,"Run heap analysis for a single heap snapshot file"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Parameters"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of a ",(0,s.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," file."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,s.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,s.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Example"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile);\n// query analysis-specific and structured results\nconst stringPatterns = analysis.getTopDuplicatedStringsInCount();\n")),(0,s.yg)("p",null,"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:"),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/BaseAnalysis.ts#L95"},"heap-analysis/src/BaseAnalysis.ts:95"))))),(0,s.yg)("hr",null),(0,s.yg)("h3",{id:"getcommandname"},(0,s.yg)("a",{id:"getcommandname"}),(0,s.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,s.yg)("p",null,"Get the name of the heap analysis, which is also used to reference\nthe analysis in memlab command-line tool."),(0,s.yg)("p",null,"The following terminal command will initiate with this analysis:\n",(0,s.yg)("inlineCode",{parentName:"p"},"memlab analyze ")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the name of the analysis"),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Examples"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new YourAnalysis();\nconst name = analysis.getCommandName();\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/plugins/GlobalVariableAnalysis/GlobalVariableAnalysis.ts#L25"},"heap-analysis/src/plugins/GlobalVariableAnalysis/GlobalVariableAnalysis.ts:25"))))))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[2625],{5680:(e,a,n)=>{n.d(a,{xA:()=>y,yg:()=>g});var l=n(6540);function s(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function t(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);a&&(l=l.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,l)}return n}function i(e){for(var a=1;a=0||(s[n]=e[n]);return s}(e,a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);for(l=0;l=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var o=l.createContext({}),p=function(e){var a=l.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},y=function(e){var a=p(e.components);return l.createElement(o.Provider,{value:a},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var a=e.children;return l.createElement(l.Fragment,{},a)}},u=l.forwardRef((function(e,a){var n=e.components,s=e.mdxType,t=e.originalType,o=e.parentName,y=r(e,["components","mdxType","originalType","parentName"]),c=p(n),u=s,g=c["".concat(o,".").concat(u)]||c[u]||m[u]||t;return n?l.createElement(g,i(i({ref:a},y),{},{components:n})):l.createElement(g,i({ref:a},y))}));function g(e,a){var n=arguments,s=a&&a.mdxType;if("string"==typeof e||s){var t=n.length,i=new Array(t);i[0]=u;var r={};for(var o in a)hasOwnProperty.call(a,o)&&(r[o]=a[o]);r.originalType=e,r[c]="string"==typeof e?e:s,i[1]=r;for(var p=2;p{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>i,default:()=>m,frontMatter:()=>t,metadata:()=>r,toc:()=>p});var l=n(8168),s=(n(6540),n(5680));const t={id:"heap_analysis_src.GlobalVariableAnalysis",title:"Class: GlobalVariableAnalysis",sidebar_label:"GlobalVariableAnalysis",custom_edit_url:null},i=void 0,r={unversionedId:"api/classes/heap_analysis_src.GlobalVariableAnalysis",id:"api/classes/heap_analysis_src.GlobalVariableAnalysis",title:"Class: GlobalVariableAnalysis",description:"Hierarchy",source:"@site/docs/api/classes/heap_analysis_src.GlobalVariableAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.GlobalVariableAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.GlobalVariableAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.GlobalVariableAnalysis",title:"Class: GlobalVariableAnalysis",sidebar_label:"GlobalVariableAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"DetachedDOMElementAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.DetachedDOMElementAnalysis"},next:{title:"ObjectFanoutAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectFanoutAnalysis"}},o={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new GlobalVariableAnalysis()',id:"new-globalvariableanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotFromFile(file, options?)',id:"analyzesnapshotfromfilefile-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3}],y={toc:p},c="wrapper";function m(e){let{components:a,...n}=e;return(0,s.yg)(c,(0,l.A)({},y,n,{components:a,mdxType:"MDXLayout"}),(0,s.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},(0,s.yg)("inlineCode",{parentName:"a"},"BaseAnalysis"))),(0,s.yg)("p",{parentName:"li"},"\u21b3 ",(0,s.yg)("strong",{parentName:"p"},(0,s.yg)("inlineCode",{parentName:"strong"},"GlobalVariableAnalysis"))))),(0,s.yg)("h2",{id:"constructors"},"Constructors"),(0,s.yg)("h3",{id:"new-globalvariableanalysis"},(0,s.yg)("a",{id:"new globalvariableanalysis"}),(0,s.yg)("strong",{parentName:"h3"},"new GlobalVariableAnalysis"),"()"),(0,s.yg)("h2",{id:"methods"},"Methods"),(0,s.yg)("h3",{id:"analyzesnapshotfromfilefile-options"},(0,s.yg)("a",{id:"analyzesnapshotfromfile"}),(0,s.yg)("strong",{parentName:"h3"},"analyzeSnapshotFromFile"),"(",(0,s.yg)("inlineCode",{parentName:"h3"},"file"),", ",(0,s.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,s.yg)("p",null,"Run heap analysis for a single heap snapshot file"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Parameters"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of a ",(0,s.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," file."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,s.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,s.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Example"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile);\n// query analysis-specific and structured results\nconst stringPatterns = analysis.getTopDuplicatedStringsInCount();\n")),(0,s.yg)("p",null,"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:"),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/BaseAnalysis.ts#L95"},"heap-analysis/src/BaseAnalysis.ts:95"))))),(0,s.yg)("hr",null),(0,s.yg)("h3",{id:"getcommandname"},(0,s.yg)("a",{id:"getcommandname"}),(0,s.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,s.yg)("p",null,"Get the name of the heap analysis, which is also used to reference\nthe analysis in memlab command-line tool."),(0,s.yg)("p",null,"The following terminal command will initiate with this analysis:\n",(0,s.yg)("inlineCode",{parentName:"p"},"memlab analyze ")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the name of the analysis"),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Examples"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new YourAnalysis();\nconst name = analysis.getCommandName();\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/plugins/GlobalVariableAnalysis/GlobalVariableAnalysis.ts#L25"},"heap-analysis/src/plugins/GlobalVariableAnalysis/GlobalVariableAnalysis.ts:25"))))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5a17db6f.ed14df67.js b/assets/js/5a17db6f.4ba1b449.js similarity index 98% rename from assets/js/5a17db6f.ed14df67.js rename to assets/js/5a17db6f.4ba1b449.js index acf3a85e..47356029 100644 --- a/assets/js/5a17db6f.ed14df67.js +++ b/assets/js/5a17db6f.4ba1b449.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[8807],{5680:(e,a,n)=>{n.d(a,{xA:()=>y,yg:()=>g});var t=n(6540);function s(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function i(e){for(var a=1;a=0||(s[n]=e[n]);return s}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var o=t.createContext({}),p=function(e){var a=t.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},y=function(e){var a=p(e.components);return t.createElement(o.Provider,{value:a},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},u=t.forwardRef((function(e,a){var n=e.components,s=e.mdxType,l=e.originalType,o=e.parentName,y=r(e,["components","mdxType","originalType","parentName"]),c=p(n),u=s,g=c["".concat(o,".").concat(u)]||c[u]||m[u]||l;return n?t.createElement(g,i(i({ref:a},y),{},{components:n})):t.createElement(g,i({ref:a},y))}));function g(e,a){var n=arguments,s=a&&a.mdxType;if("string"==typeof e||s){var l=n.length,i=new Array(l);i[0]=u;var r={};for(var o in a)hasOwnProperty.call(a,o)&&(r[o]=a[o]);r.originalType=e,r[c]="string"==typeof e?e:s,i[1]=r;for(var p=2;p{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>p});var t=n(8168),s=(n(6540),n(5680));const l={id:"heap_analysis_src.ObjectSizeAnalysis",title:"Class: ObjectSizeAnalysis",sidebar_label:"ObjectSizeAnalysis",custom_edit_url:null},i=void 0,r={unversionedId:"api/classes/heap_analysis_src.ObjectSizeAnalysis",id:"api/classes/heap_analysis_src.ObjectSizeAnalysis",title:"Class: ObjectSizeAnalysis",description:"Hierarchy",source:"@site/docs/api/classes/heap_analysis_src.ObjectSizeAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.ObjectSizeAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectSizeAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.ObjectSizeAnalysis",title:"Class: ObjectSizeAnalysis",sidebar_label:"ObjectSizeAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"ObjectShapeAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectShapeAnalysis"},next:{title:"ObjectUnboundGrowthAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectUnboundGrowthAnalysis"}},o={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new ObjectSizeAnalysis()',id:"new-objectsizeanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotFromFile(file, options?)',id:"analyzesnapshotfromfilefile-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3}],y={toc:p},c="wrapper";function m(e){let{components:a,...n}=e;return(0,s.yg)(c,(0,t.A)({},y,n,{components:a,mdxType:"MDXLayout"}),(0,s.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},(0,s.yg)("inlineCode",{parentName:"a"},"BaseAnalysis"))),(0,s.yg)("p",{parentName:"li"},"\u21b3 ",(0,s.yg)("strong",{parentName:"p"},(0,s.yg)("inlineCode",{parentName:"strong"},"ObjectSizeAnalysis"))))),(0,s.yg)("h2",{id:"constructors"},"Constructors"),(0,s.yg)("h3",{id:"new-objectsizeanalysis"},(0,s.yg)("a",{id:"new objectsizeanalysis"}),(0,s.yg)("strong",{parentName:"h3"},"new ObjectSizeAnalysis"),"()"),(0,s.yg)("h2",{id:"methods"},"Methods"),(0,s.yg)("h3",{id:"analyzesnapshotfromfilefile-options"},(0,s.yg)("a",{id:"analyzesnapshotfromfile"}),(0,s.yg)("strong",{parentName:"h3"},"analyzeSnapshotFromFile"),"(",(0,s.yg)("inlineCode",{parentName:"h3"},"file"),", ",(0,s.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,s.yg)("p",null,"Run heap analysis for a single heap snapshot file"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Parameters"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of a ",(0,s.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," file."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,s.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,s.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Example"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile);\n// query analysis-specific and structured results\nconst stringPatterns = analysis.getTopDuplicatedStringsInCount();\n")),(0,s.yg)("p",null,"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:"),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/BaseAnalysis.ts#L95"},"heap-analysis/src/BaseAnalysis.ts:95"))))),(0,s.yg)("hr",null),(0,s.yg)("h3",{id:"getcommandname"},(0,s.yg)("a",{id:"getcommandname"}),(0,s.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,s.yg)("p",null,"Get the name of the heap analysis, which is also used to reference\nthe analysis in memlab command-line tool."),(0,s.yg)("p",null,"The following terminal command will initiate with this analysis:\n",(0,s.yg)("inlineCode",{parentName:"p"},"memlab analyze ")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the name of the analysis"),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Examples"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new YourAnalysis();\nconst name = analysis.getCommandName();\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/plugins/ObjectSizeAnalysis.ts#L20"},"heap-analysis/src/plugins/ObjectSizeAnalysis.ts:20"))))))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[8807],{5680:(e,a,n)=>{n.d(a,{xA:()=>y,yg:()=>g});var t=n(6540);function s(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function i(e){for(var a=1;a=0||(s[n]=e[n]);return s}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var o=t.createContext({}),p=function(e){var a=t.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},y=function(e){var a=p(e.components);return t.createElement(o.Provider,{value:a},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},u=t.forwardRef((function(e,a){var n=e.components,s=e.mdxType,l=e.originalType,o=e.parentName,y=r(e,["components","mdxType","originalType","parentName"]),c=p(n),u=s,g=c["".concat(o,".").concat(u)]||c[u]||m[u]||l;return n?t.createElement(g,i(i({ref:a},y),{},{components:n})):t.createElement(g,i({ref:a},y))}));function g(e,a){var n=arguments,s=a&&a.mdxType;if("string"==typeof e||s){var l=n.length,i=new Array(l);i[0]=u;var r={};for(var o in a)hasOwnProperty.call(a,o)&&(r[o]=a[o]);r.originalType=e,r[c]="string"==typeof e?e:s,i[1]=r;for(var p=2;p{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>p});var t=n(8168),s=(n(6540),n(5680));const l={id:"heap_analysis_src.ObjectSizeAnalysis",title:"Class: ObjectSizeAnalysis",sidebar_label:"ObjectSizeAnalysis",custom_edit_url:null},i=void 0,r={unversionedId:"api/classes/heap_analysis_src.ObjectSizeAnalysis",id:"api/classes/heap_analysis_src.ObjectSizeAnalysis",title:"Class: ObjectSizeAnalysis",description:"Hierarchy",source:"@site/docs/api/classes/heap_analysis_src.ObjectSizeAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.ObjectSizeAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectSizeAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.ObjectSizeAnalysis",title:"Class: ObjectSizeAnalysis",sidebar_label:"ObjectSizeAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"ObjectShapeAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectShapeAnalysis"},next:{title:"ObjectUnboundGrowthAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectUnboundGrowthAnalysis"}},o={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new ObjectSizeAnalysis()',id:"new-objectsizeanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotFromFile(file, options?)',id:"analyzesnapshotfromfilefile-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3}],y={toc:p},c="wrapper";function m(e){let{components:a,...n}=e;return(0,s.yg)(c,(0,t.A)({},y,n,{components:a,mdxType:"MDXLayout"}),(0,s.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},(0,s.yg)("inlineCode",{parentName:"a"},"BaseAnalysis"))),(0,s.yg)("p",{parentName:"li"},"\u21b3 ",(0,s.yg)("strong",{parentName:"p"},(0,s.yg)("inlineCode",{parentName:"strong"},"ObjectSizeAnalysis"))))),(0,s.yg)("h2",{id:"constructors"},"Constructors"),(0,s.yg)("h3",{id:"new-objectsizeanalysis"},(0,s.yg)("a",{id:"new objectsizeanalysis"}),(0,s.yg)("strong",{parentName:"h3"},"new ObjectSizeAnalysis"),"()"),(0,s.yg)("h2",{id:"methods"},"Methods"),(0,s.yg)("h3",{id:"analyzesnapshotfromfilefile-options"},(0,s.yg)("a",{id:"analyzesnapshotfromfile"}),(0,s.yg)("strong",{parentName:"h3"},"analyzeSnapshotFromFile"),"(",(0,s.yg)("inlineCode",{parentName:"h3"},"file"),", ",(0,s.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,s.yg)("p",null,"Run heap analysis for a single heap snapshot file"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Parameters"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of a ",(0,s.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," file."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,s.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,s.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Example"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile);\n// query analysis-specific and structured results\nconst stringPatterns = analysis.getTopDuplicatedStringsInCount();\n")),(0,s.yg)("p",null,"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:"),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/BaseAnalysis.ts#L95"},"heap-analysis/src/BaseAnalysis.ts:95"))))),(0,s.yg)("hr",null),(0,s.yg)("h3",{id:"getcommandname"},(0,s.yg)("a",{id:"getcommandname"}),(0,s.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,s.yg)("p",null,"Get the name of the heap analysis, which is also used to reference\nthe analysis in memlab command-line tool."),(0,s.yg)("p",null,"The following terminal command will initiate with this analysis:\n",(0,s.yg)("inlineCode",{parentName:"p"},"memlab analyze ")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the name of the analysis"),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Examples"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new YourAnalysis();\nconst name = analysis.getCommandName();\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/plugins/ObjectSizeAnalysis.ts#L20"},"heap-analysis/src/plugins/ObjectSizeAnalysis.ts:20"))))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5b1d4bc5.c90c1034.js b/assets/js/5b1d4bc5.b919d5e8.js similarity index 97% rename from assets/js/5b1d4bc5.c90c1034.js rename to assets/js/5b1d4bc5.b919d5e8.js index 483847c2..1ec921f2 100644 --- a/assets/js/5b1d4bc5.c90c1034.js +++ b/assets/js/5b1d4bc5.b919d5e8.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[9439],{5680:(e,a,n)=>{n.d(a,{xA:()=>m,yg:()=>d});var s=n(6540);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);a&&(s=s.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,s)}return n}function i(e){for(var a=1;a=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(s=0;s=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var o=s.createContext({}),r=function(e){var a=s.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},m=function(e){var a=r(e.components);return s.createElement(o.Provider,{value:a},e.children)},y="mdxType",g={inlineCode:"code",wrapper:function(e){var a=e.children;return s.createElement(s.Fragment,{},a)}},h=s.forwardRef((function(e,a){var n=e.components,t=e.mdxType,l=e.originalType,o=e.parentName,m=p(e,["components","mdxType","originalType","parentName"]),y=r(n),h=t,d=y["".concat(o,".").concat(h)]||y[h]||g[h]||l;return n?s.createElement(d,i(i({ref:a},m),{},{components:n})):s.createElement(d,i({ref:a},m))}));function d(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var l=n.length,i=new Array(l);i[0]=h;var p={};for(var o in a)hasOwnProperty.call(a,o)&&(p[o]=a[o]);p.originalType=e,p[y]="string"==typeof e?e:t,i[1]=p;for(var r=2;r{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>i,default:()=>g,frontMatter:()=>l,metadata:()=>p,toc:()=>r});var s=n(8168),t=(n(6540),n(5680));const l={id:"heap_analysis_src",title:"Package: @memlab/heap-analysis",sidebar_label:"heap-analysis/src",sidebar_position:0,custom_edit_url:null},i=void 0,p={unversionedId:"api/modules/heap_analysis_src",id:"api/modules/heap_analysis_src",title:"Package: @memlab/heap-analysis",description:"Classes",source:"@site/docs/api/modules/heap_analysis_src.md",sourceDirName:"api/modules",slug:"/api/modules/heap_analysis_src",permalink:"/memlab/docs/api/modules/heap_analysis_src",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"heap_analysis_src",title:"Package: @memlab/heap-analysis",sidebar_label:"heap-analysis/src",sidebar_position:0,custom_edit_url:null},sidebar:"sidebar",previous:{title:"core/src",permalink:"/memlab/docs/api/modules/core_src"},next:{title:"ConsoleMode",permalink:"/memlab/docs/api/enums/api_src.ConsoleMode"}},o={},r=[{value:"Classes",id:"classes",level:2},{value:"Type Aliases",id:"type-aliases",level:2},{value:' AnalyzeSnapshotResult: Object',id:"-analyzesnapshotresult-object",level:3},{value:' HeapAnalysisOptions: Object',id:"-heapanalysisoptions-object",level:3},{value:' RunHeapAnalysisOptions: Object',id:"-runheapanalysisoptions-object",level:3},{value:"Functions",id:"functions",level:2},{value:'getDominatorNodes(ids, snapshot)',id:"getdominatornodesids-snapshot",level:3},{value:'getFullHeapFromFile(file)',id:"getfullheapfromfilefile",level:3},{value:'getHeapFromFile(file)',id:"getheapfromfilefile",level:3},{value:'getSnapshotDirForAnalysis(options)',id:"getsnapshotdirforanalysisoptions",level:3},{value:'getSnapshotFileForAnalysis(options)',id:"getsnapshotfileforanalysisoptions",level:3},{value:'loadHeapSnapshot(options)',id:"loadheapsnapshotoptions",level:3},{value:'snapshotMapReduce<T1, T2>(mapCallback, reduceCallback, options)',id:"snapshotmapreducet1-t2mapcallback-reducecallback-options",level:3},{value:"Type parameters",id:"type-parameters",level:4},{value:'takeNodeFullHeap()',id:"takenodefullheap",level:3}],m={toc:r},y="wrapper";function g(e){let{components:a,...n}=e;return(0,t.yg)(y,(0,s.A)({},m,n,{components:a,mdxType:"MDXLayout"}),(0,t.yg)("h2",{id:"classes"},"Classes"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},"BaseAnalysis")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.CollectionsHoldingStaleAnalysis"},"CollectionsHoldingStaleAnalysis")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.DetachedDOMElementAnalysis"},"DetachedDOMElementAnalysis")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.GlobalVariableAnalysis"},"GlobalVariableAnalysis")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.ObjectFanoutAnalysis"},"ObjectFanoutAnalysis")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.ObjectShallowAnalysis"},"ObjectShallowAnalysis")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.ObjectShapeAnalysis"},"ObjectShapeAnalysis")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.ObjectSizeAnalysis"},"ObjectSizeAnalysis")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.ObjectUnboundGrowthAnalysis"},"ObjectUnboundGrowthAnalysis")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.ShapeUnboundGrowthAnalysis"},"ShapeUnboundGrowthAnalysis")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.StringAnalysis"},"StringAnalysis"))),(0,t.yg)("h2",{id:"type-aliases"},"Type Aliases"),(0,t.yg)("h3",{id:"-analyzesnapshotresult-object"},(0,t.yg)("a",{id:"analyzesnapshotresult",name:"analyzesnapshotresult"})," ",(0,t.yg)("strong",{parentName:"h3"},"AnalyzeSnapshotResult"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"Object")),(0,t.yg)("p",null,"This is the return type from calling ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis#analyzesnapshotfromfile"},"analyzeSnapshotFromFile"),"\nor ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis#analyzesnapshotsindirectory"},"analyzeSnapshotsInDirectory"),"."),(0,t.yg)("table",null,(0,t.yg)("thead",{parentName:"table"},(0,t.yg)("tr",{parentName:"thead"},(0,t.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,t.yg)("th",{parentName:"tr",align:"left"},"Type"),(0,t.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,t.yg)("tbody",{parentName:"table"},(0,t.yg)("tr",{parentName:"tbody"},(0,t.yg)("td",{parentName:"tr",align:"left"},(0,t.yg)("inlineCode",{parentName:"td"},"analysisOutputFile")),(0,t.yg)("td",{parentName:"tr",align:"left"},(0,t.yg)("inlineCode",{parentName:"td"},"string")),(0,t.yg)("td",{parentName:"tr",align:"left"},"file path of the console output of the heap analysis call")))),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/PluginUtils.ts#L93"},"heap-analysis/src/PluginUtils.ts:93"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-heapanalysisoptions-object"},(0,t.yg)("a",{id:"heapanalysisoptions",name:"heapanalysisoptions"})," ",(0,t.yg)("strong",{parentName:"h3"},"HeapAnalysisOptions"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"Object")),(0,t.yg)("p",null,"This is the auto-generated arguments passed to all the ",(0,t.yg)("inlineCode",{parentName:"p"},"process")," method\nthat your self-defined heap analysis should implement.\nYou are not supposed to construct instances of this class."),(0,t.yg)("p",null,"For code examples on how this options could be used, see\n",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/heap_analysis_src#getsnapshotfileforanalysis"},"getSnapshotFileForAnalysis"),", ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/heap_analysis_src#loadheapsnapshot"},"loadHeapSnapshot"),",\nor ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/heap_analysis_src#snapshotmapreduce"},"snapshotMapReduce"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/PluginUtils.ts#L70"},"heap-analysis/src/PluginUtils.ts:70"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-runheapanalysisoptions-object"},(0,t.yg)("a",{id:"runheapanalysisoptions",name:"runheapanalysisoptions"})," ",(0,t.yg)("strong",{parentName:"h3"},"RunHeapAnalysisOptions"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"Object")),(0,t.yg)("p",null,"This is the input option for ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis#analyzesnapshotfromfile"},"analyzeSnapshotFromFile"),"\nand ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis#analyzesnapshotsindirectory"},"analyzeSnapshotsInDirectory"),"."),(0,t.yg)("table",null,(0,t.yg)("thead",{parentName:"table"},(0,t.yg)("tr",{parentName:"thead"},(0,t.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,t.yg)("th",{parentName:"tr",align:"left"},"Type"),(0,t.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,t.yg)("tbody",{parentName:"table"},(0,t.yg)("tr",{parentName:"tbody"},(0,t.yg)("td",{parentName:"tr",align:"left"},(0,t.yg)("inlineCode",{parentName:"td"},"workDir?")),(0,t.yg)("td",{parentName:"tr",align:"left"},(0,t.yg)("inlineCode",{parentName:"td"},"string")),(0,t.yg)("td",{parentName:"tr",align:"left"},"specify the working directory to where the intermediate, logging, and output files should be saved")))),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/PluginUtils.ts#L81"},"heap-analysis/src/PluginUtils.ts:81"))))),(0,t.yg)("h2",{id:"functions"},"Functions"),(0,t.yg)("h3",{id:"getdominatornodesids-snapshot"},(0,t.yg)("a",{id:"getdominatornodes"}),(0,t.yg)("strong",{parentName:"h3"},"getDominatorNodes"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"ids"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"snapshot"),")"),(0,t.yg)("p",null,"This API calculate the set of\n",(0,t.yg)("a",{parentName:"p",href:"https://firefox-source-docs.mozilla.org/devtools-user/memory/dominators/index.html"},"dominator nodes"),"\nof the set of input heap objects."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"ids"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Set"),"<",(0,t.yg)("inlineCode",{parentName:"li"},"number"),">"," | Set of ids of heap objects (or nodes)"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"IHeapSnapshot")," | heap loaded from a heap snapshot"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Set"),"<",(0,t.yg)("inlineCode",{parentName:"li"},"number"),">"," | the set of dominator nodes/objects"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples"),":")))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile, getDominatorNodes} from '@memlab/heap-analysis';\n\nclass TestObject {}\n\n(async function () {\n const t1 = new TestObject();\n const t2 = new TestObject();\n\n // dump the heap of this running JavaScript program\n const heapFile = dumpNodeHeapSnapshot();\n const heap = await getFullHeapFromFile(heapFile);\n\n // find the heap node for TestObject\n let nodes = [];\n heap.nodes.forEach(node => {\n if (node.name === 'TestObject' && node.type === 'object') {\n nodes.push(node);\n }\n });\n\n // get the dominator nodes\n const dominatorIds = getDominatorNodes(\n new Set(nodes.map(node => node.id)),\n heap,\n );\n})();\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/PluginUtils.ts#L757"},"heap-analysis/src/PluginUtils.ts:757"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getfullheapfromfilefile"},(0,t.yg)("a",{id:"getfullheapfromfile"}),(0,t.yg)("strong",{parentName:"h3"},"getFullHeapFromFile"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"file"),")"),(0,t.yg)("p",null,"Load and parse a ",(0,t.yg)("inlineCode",{parentName:"p"},".heapsnapshot")," file and calculate meta data like\ndominator nodes and retained sizes."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of the ",(0,t.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," file"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,t.yg)("inlineCode",{parentName:"li"},"IHeapSnapshot"),">"," | the heap graph representation instance that supports querying\nthe heap"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples"),":")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function (){\n const heapFile = dumpNodeHeapSnapshot();\n const heap = await getFullHeapFromFile(heapFile);\n})();\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/PluginUtils.ts#L554"},"heap-analysis/src/PluginUtils.ts:554"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getheapfromfilefile"},(0,t.yg)("a",{id:"getheapfromfile"}),(0,t.yg)("strong",{parentName:"h3"},"getHeapFromFile"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"file"),")"),(0,t.yg)("p",null,(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"deprecated"))),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,t.yg)("inlineCode",{parentName:"li"},"IHeapSnapshot"),">"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/PluginUtils.ts#L585"},"heap-analysis/src/PluginUtils.ts:585"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getsnapshotdirforanalysisoptions"},(0,t.yg)("a",{id:"getsnapshotdirforanalysis"}),(0,t.yg)("strong",{parentName:"h3"},"getSnapshotDirForAnalysis"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"options"),")"),(0,t.yg)("p",null,"Get the absolute path of the directory holding all the heap snapshot files\npassed to the hosting heap analysis via ",(0,t.yg)("inlineCode",{parentName:"p"},"HeapAnalysisOptions"),"."),(0,t.yg)("p",null,"This API is supposed to be used within the overridden ",(0,t.yg)("inlineCode",{parentName:"p"},"process")," method\nof an ",(0,t.yg)("inlineCode",{parentName:"p"},"BaseAnalysis")," instance."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#heapanalysisoptions"},(0,t.yg)("inlineCode",{parentName:"a"},"HeapAnalysisOptions"))," | this is the auto-generated input passed to all the ",(0,t.yg)("inlineCode",{parentName:"li"},"BaseAnalysis")," instances"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Nullable"),"<",(0,t.yg)("inlineCode",{parentName:"li"},"string"),">"," | the absolute path of the directory"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples:"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport type {HeapAnalysisOptions} from '@memlab/heap-analysis';\nimport {getSnapshotFileForAnalysis, BaseAnalysis} from '@memlab/heap-analysis';\n\nclass ExampleAnalysis extends BaseAnalysis {\n public getCommandName(): string {\n return 'example-analysis';\n }\n\n public getDescription(): string {\n return 'an example analysis for demo';\n }\n\n async process(options: HeapAnalysisOptions): Promise {\n const directory = getSnapshotDirForAnalysis(options);\n }\n}\n")),(0,t.yg)("p",null,"Use the following code to invoke the heap analysis:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new ExampleAnalysis();\n// any .heapsnapshot file recorded by memlab or saved manually from Chrome\nawait analysis.analyzeSnapshotFromFile(snapshotFile);\n")),(0,t.yg)("p",null,"The new heap analysis can also be used with ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#analyze"},"analyze"),", in that case\n",(0,t.yg)("inlineCode",{parentName:"p"},"getSnapshotDirForAnalysis")," use the snapshot directory from\n",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"},"BrowserInteractionResultReader"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/PluginUtils.ts#L466"},"heap-analysis/src/PluginUtils.ts:466"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getsnapshotfileforanalysisoptions"},(0,t.yg)("a",{id:"getsnapshotfileforanalysis"}),(0,t.yg)("strong",{parentName:"h3"},"getSnapshotFileForAnalysis"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"options"),")"),(0,t.yg)("p",null,"Get the heap snapshot file's absolute path passed to the hosting heap\nanalysis via ",(0,t.yg)("inlineCode",{parentName:"p"},"HeapAnalysisOptions"),"."),(0,t.yg)("p",null,"This API is supposed to be used within the overridden ",(0,t.yg)("inlineCode",{parentName:"p"},"process")," method\nof an ",(0,t.yg)("inlineCode",{parentName:"p"},"BaseAnalysis")," instance."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#heapanalysisoptions"},(0,t.yg)("inlineCode",{parentName:"a"},"HeapAnalysisOptions"))," | this is the auto-generated input passed to all the ",(0,t.yg)("inlineCode",{parentName:"li"},"BaseAnalysis")," instances"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of the heap snapshot file"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples:"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport type {HeapAnalysisOptions} from '@memlab/heap-analysis';\nimport {getSnapshotFileForAnalysis, BaseAnalysis} from '@memlab/heap-analysis';\n\nclass ExampleAnalysis extends BaseAnalysis {\n public getCommandName(): string {\n return 'example-analysis';\n }\n\n public getDescription(): string {\n return 'an example analysis for demo';\n }\n\n async process(options: HeapAnalysisOptions): Promise {\n const file = getSnapshotFileForAnalysis(options);\n }\n}\n")),(0,t.yg)("p",null,"Use the following code to invoke the heap analysis:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new ExampleAnalysis();\n// any .heapsnapshot file recorded by memlab or saved manually from Chrome\nawait analysis.analyzeSnapshotFromFile(snapshotFile);\n")),(0,t.yg)("p",null,"The new heap analysis can also be used with ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#analyze"},"analyze"),", in that case\n",(0,t.yg)("inlineCode",{parentName:"p"},"getSnapshotFileForAnalysis")," will use the last heap snapshot in alphanumerically\nascending order from ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"},"BrowserInteractionResultReader"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/PluginUtils.ts#L417"},"heap-analysis/src/PluginUtils.ts:417"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"loadheapsnapshotoptions"},(0,t.yg)("a",{id:"loadheapsnapshot"}),(0,t.yg)("strong",{parentName:"h3"},"loadHeapSnapshot"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"options"),")"),(0,t.yg)("p",null,"Load the heap graph based on the single JavaScript heap snapshot\npassed to the hosting heap analysis via ",(0,t.yg)("inlineCode",{parentName:"p"},"HeapAnalysisOptions"),"."),(0,t.yg)("p",null,"This API is supposed to be used within the ",(0,t.yg)("inlineCode",{parentName:"p"},"process")," implementation\nof an ",(0,t.yg)("inlineCode",{parentName:"p"},"BaseAnalysis")," instance."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#heapanalysisoptions"},(0,t.yg)("inlineCode",{parentName:"a"},"HeapAnalysisOptions"))," | this is the auto-generated input passed to all the ",(0,t.yg)("inlineCode",{parentName:"li"},"BaseAnalysis")," instances"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,t.yg)("inlineCode",{parentName:"li"},"IHeapSnapshot"),">"," | the graph representation of the heap"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples:"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport type {HeapAnalysisOptions} from '@memlab/heap-analysis';\nimport {loadHeapSnapshot, BaseAnalysis} from '@memlab/heap-analysis';\n\nclass ExampleAnalysis extends BaseAnalysis {\n public getCommandName(): string {\n return 'example-analysis';\n }\n\n public getDescription(): string {\n return 'an example analysis for demo';\n }\n\n async process(options: HeapAnalysisOptions): Promise {\n const heap = await loadHeapSnapshot(options);\n // doing heap analysis\n }\n}\n")),(0,t.yg)("p",null,"Use the following code to invoke the heap analysis:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new ExampleAnalysis();\n// any .heapsnapshot file recorded by memlab or saved manually from Chrome\nawait analysis.analyzeSnapshotFromFile(snapshotFile);\n")),(0,t.yg)("p",null,"The new heap analysis can also be used with ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#analyze"},"analyze"),", in that case\n",(0,t.yg)("inlineCode",{parentName:"p"},"loadHeapSnapshot")," will use the last heap snapshot in alphanumerically\nascending order from ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"},"BrowserInteractionResultReader"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/PluginUtils.ts#L520"},"heap-analysis/src/PluginUtils.ts:520"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"snapshotmapreducet1-t2mapcallback-reducecallback-options"},(0,t.yg)("a",{id:"snapshotmapreduce"}),(0,t.yg)("strong",{parentName:"h3"},"snapshotMapReduce"),"<",(0,t.yg)("inlineCode",{parentName:"h3"},"T1"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"T2"),">","(",(0,t.yg)("inlineCode",{parentName:"h3"},"mapCallback"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"reduceCallback"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"options"),")"),(0,t.yg)("p",null,"When a heap analysis is taking multiple heap snapshots as input for memory\nanalysis (e.g., finding which object keeps growing in size in a series of\nheap snapshots), this API could be used to do\n",(0,t.yg)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/MapReduce"},"MapRedue")," on all heap snapshots."),(0,t.yg)("p",null,"This API is supposed to be used within the ",(0,t.yg)("inlineCode",{parentName:"p"},"process")," implementation\nof an ",(0,t.yg)("inlineCode",{parentName:"p"},"BaseAnalysis")," instance that is designed to analyze multiple heap\nsnapshots (as an example, finding which object keeps growing overtime)"),(0,t.yg)("h4",{id:"type-parameters"},"Type parameters"),(0,t.yg)("table",null,(0,t.yg)("thead",{parentName:"table"},(0,t.yg)("tr",{parentName:"thead"},(0,t.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,t.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,t.yg)("tbody",{parentName:"table"},(0,t.yg)("tr",{parentName:"tbody"},(0,t.yg)("td",{parentName:"tr",align:"left"},(0,t.yg)("inlineCode",{parentName:"td"},"T1")),(0,t.yg)("td",{parentName:"tr",align:"left"},"the type of the intermediate result from each map function call")),(0,t.yg)("tr",{parentName:"tbody"},(0,t.yg)("td",{parentName:"tr",align:"left"},(0,t.yg)("inlineCode",{parentName:"td"},"T2")),(0,t.yg)("td",{parentName:"tr",align:"left"},"the type of the final result of the reduce function call")))),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"mapCallback"),": (",(0,t.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"IHeapSnapshot"),", ",(0,t.yg)("inlineCode",{parentName:"li"},"i"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"number"),", ",(0,t.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string"),") => ",(0,t.yg)("inlineCode",{parentName:"li"},"T1")," | the map function in MapReduce, the function will be applied to each heap snapshot"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"reduceCallback"),": (",(0,t.yg)("inlineCode",{parentName:"li"},"results"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"T1"),"[]) => ",(0,t.yg)("inlineCode",{parentName:"li"},"T2")," | the reduce function in MapReduce, the function will take as input all intermediate results from all map function calls"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#heapanalysisoptions"},(0,t.yg)("inlineCode",{parentName:"a"},"HeapAnalysisOptions"))," | this is the auto-generated input passed to all the ",(0,t.yg)("inlineCode",{parentName:"li"},"BaseAnalysis")," instances"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,t.yg)("inlineCode",{parentName:"li"},"T2"),">"," | the return value of your reduce function"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples:"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport type {HeapAnalysisOptions} from '@memlab/heap-analysis';\nimport {snapshotMapReduce, BaseAnalysis} from '@memlab/heap-analysis';\n\nclass ExampleAnalysis extends BaseAnalysis {\n public getCommandName(): string {\n return 'example-analysis';\n }\n\n public getDescription(): string {\n return 'an example analysis for demo';\n }\n\n async process(options: HeapAnalysisOptions): Promise {\n // check if the number of heap objects keeps growing overtime\n const isMonotonicIncreasing = await snapshotMapReduce(\n (heap) => heap.nodes.length,\n (nodeCounts) =>\n nodeCounts[0] < nodeCounts[nodeCounts.length - 1] &&\n nodeCounts.every((count, i) => i === 0 || count >= nodeCounts[i - 1]),\n options,\n );\n }\n}\n")),(0,t.yg)("p",null,"Use the following code to invoke the heap analysis:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new ExampleAnalysis();\n// snapshotDir includes a series of .heapsnapshot files recorded by\n// memlab or saved manually from Chrome, those files will be loaded\n// in alphanumerically ascending order\nawait analysis.analyzeSnapshotsInDirectory(snapshotDir);\n")),(0,t.yg)("p",null,"The new heap analysis can also be used with ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#analyze"},"analyze"),", in that case\n",(0,t.yg)("inlineCode",{parentName:"p"},"snapshotMapReduce")," will use all the heap snapshot in alphanumerically\nascending order from ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"},"BrowserInteractionResultReader"),"."),(0,t.yg)("p",null,(0,t.yg)("strong",{parentName:"p"},"Why not passing in all heap snapshots as an array of ",(0,t.yg)("a",{parentName:"strong",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot"),"s?"),"\nEach heap snapshot could be non-trivial in size, loading them all at once\nmay not be possible."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/PluginUtils.ts#L662"},"heap-analysis/src/PluginUtils.ts:662"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"takenodefullheap"},(0,t.yg)("a",{id:"takenodefullheap"}),(0,t.yg)("strong",{parentName:"h3"},"takeNodeFullHeap"),"()"),(0,t.yg)("p",null,"Take a heap snapshot of the current program state\nand parse it as ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot"),". This\nAPI also calculates some heap analysis meta data\nfor heap analysis. But this also means slower heap parsing\ncomparing with ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#takenodeminimalheap"},"takeNodeMinimalHeap"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"p"},"Promise"),"<",(0,t.yg)("inlineCode",{parentName:"p"},"IHeapSnapshot"),">"," | heap representation with heap analysis meta data.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples:")))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport type {takeNodeFullHeap} from '@memlab/heap-analysis';\n\n(async function () {\n const heap: IHeapSnapshot = await takeNodeFullHeap();\n})();\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/PluginUtils.ts#L577"},"heap-analysis/src/PluginUtils.ts:577"))))))}g.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[9439],{5680:(e,a,n)=>{n.d(a,{xA:()=>m,yg:()=>d});var s=n(6540);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);a&&(s=s.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,s)}return n}function i(e){for(var a=1;a=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(s=0;s=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var o=s.createContext({}),r=function(e){var a=s.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},m=function(e){var a=r(e.components);return s.createElement(o.Provider,{value:a},e.children)},y="mdxType",g={inlineCode:"code",wrapper:function(e){var a=e.children;return s.createElement(s.Fragment,{},a)}},h=s.forwardRef((function(e,a){var n=e.components,t=e.mdxType,l=e.originalType,o=e.parentName,m=p(e,["components","mdxType","originalType","parentName"]),y=r(n),h=t,d=y["".concat(o,".").concat(h)]||y[h]||g[h]||l;return n?s.createElement(d,i(i({ref:a},m),{},{components:n})):s.createElement(d,i({ref:a},m))}));function d(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var l=n.length,i=new Array(l);i[0]=h;var p={};for(var o in a)hasOwnProperty.call(a,o)&&(p[o]=a[o]);p.originalType=e,p[y]="string"==typeof e?e:t,i[1]=p;for(var r=2;r{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>i,default:()=>g,frontMatter:()=>l,metadata:()=>p,toc:()=>r});var s=n(8168),t=(n(6540),n(5680));const l={id:"heap_analysis_src",title:"Package: @memlab/heap-analysis",sidebar_label:"heap-analysis/src",sidebar_position:0,custom_edit_url:null},i=void 0,p={unversionedId:"api/modules/heap_analysis_src",id:"api/modules/heap_analysis_src",title:"Package: @memlab/heap-analysis",description:"Classes",source:"@site/docs/api/modules/heap_analysis_src.md",sourceDirName:"api/modules",slug:"/api/modules/heap_analysis_src",permalink:"/memlab/docs/api/modules/heap_analysis_src",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"heap_analysis_src",title:"Package: @memlab/heap-analysis",sidebar_label:"heap-analysis/src",sidebar_position:0,custom_edit_url:null},sidebar:"sidebar",previous:{title:"core/src",permalink:"/memlab/docs/api/modules/core_src"},next:{title:"ConsoleMode",permalink:"/memlab/docs/api/enums/api_src.ConsoleMode"}},o={},r=[{value:"Classes",id:"classes",level:2},{value:"Type Aliases",id:"type-aliases",level:2},{value:' AnalyzeSnapshotResult: Object',id:"-analyzesnapshotresult-object",level:3},{value:' HeapAnalysisOptions: Object',id:"-heapanalysisoptions-object",level:3},{value:' RunHeapAnalysisOptions: Object',id:"-runheapanalysisoptions-object",level:3},{value:"Functions",id:"functions",level:2},{value:'getDominatorNodes(ids, snapshot)',id:"getdominatornodesids-snapshot",level:3},{value:'getFullHeapFromFile(file)',id:"getfullheapfromfilefile",level:3},{value:'getHeapFromFile(file)',id:"getheapfromfilefile",level:3},{value:'getSnapshotDirForAnalysis(options)',id:"getsnapshotdirforanalysisoptions",level:3},{value:'getSnapshotFileForAnalysis(options)',id:"getsnapshotfileforanalysisoptions",level:3},{value:'loadHeapSnapshot(options)',id:"loadheapsnapshotoptions",level:3},{value:'snapshotMapReduce<T1, T2>(mapCallback, reduceCallback, options)',id:"snapshotmapreducet1-t2mapcallback-reducecallback-options",level:3},{value:"Type parameters",id:"type-parameters",level:4},{value:'takeNodeFullHeap()',id:"takenodefullheap",level:3}],m={toc:r},y="wrapper";function g(e){let{components:a,...n}=e;return(0,t.yg)(y,(0,s.A)({},m,n,{components:a,mdxType:"MDXLayout"}),(0,t.yg)("h2",{id:"classes"},"Classes"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},"BaseAnalysis")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.CollectionsHoldingStaleAnalysis"},"CollectionsHoldingStaleAnalysis")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.DetachedDOMElementAnalysis"},"DetachedDOMElementAnalysis")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.GlobalVariableAnalysis"},"GlobalVariableAnalysis")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.ObjectFanoutAnalysis"},"ObjectFanoutAnalysis")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.ObjectShallowAnalysis"},"ObjectShallowAnalysis")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.ObjectShapeAnalysis"},"ObjectShapeAnalysis")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.ObjectSizeAnalysis"},"ObjectSizeAnalysis")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.ObjectUnboundGrowthAnalysis"},"ObjectUnboundGrowthAnalysis")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.ShapeUnboundGrowthAnalysis"},"ShapeUnboundGrowthAnalysis")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/heap_analysis_src.StringAnalysis"},"StringAnalysis"))),(0,t.yg)("h2",{id:"type-aliases"},"Type Aliases"),(0,t.yg)("h3",{id:"-analyzesnapshotresult-object"},(0,t.yg)("a",{id:"analyzesnapshotresult",name:"analyzesnapshotresult"})," ",(0,t.yg)("strong",{parentName:"h3"},"AnalyzeSnapshotResult"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"Object")),(0,t.yg)("p",null,"This is the return type from calling ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis#analyzesnapshotfromfile"},"analyzeSnapshotFromFile"),"\nor ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis#analyzesnapshotsindirectory"},"analyzeSnapshotsInDirectory"),"."),(0,t.yg)("table",null,(0,t.yg)("thead",{parentName:"table"},(0,t.yg)("tr",{parentName:"thead"},(0,t.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,t.yg)("th",{parentName:"tr",align:"left"},"Type"),(0,t.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,t.yg)("tbody",{parentName:"table"},(0,t.yg)("tr",{parentName:"tbody"},(0,t.yg)("td",{parentName:"tr",align:"left"},(0,t.yg)("inlineCode",{parentName:"td"},"analysisOutputFile")),(0,t.yg)("td",{parentName:"tr",align:"left"},(0,t.yg)("inlineCode",{parentName:"td"},"string")),(0,t.yg)("td",{parentName:"tr",align:"left"},"file path of the console output of the heap analysis call")))),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/PluginUtils.ts#L93"},"heap-analysis/src/PluginUtils.ts:93"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-heapanalysisoptions-object"},(0,t.yg)("a",{id:"heapanalysisoptions",name:"heapanalysisoptions"})," ",(0,t.yg)("strong",{parentName:"h3"},"HeapAnalysisOptions"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"Object")),(0,t.yg)("p",null,"This is the auto-generated arguments passed to all the ",(0,t.yg)("inlineCode",{parentName:"p"},"process")," method\nthat your self-defined heap analysis should implement.\nYou are not supposed to construct instances of this class."),(0,t.yg)("p",null,"For code examples on how this options could be used, see\n",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/heap_analysis_src#getsnapshotfileforanalysis"},"getSnapshotFileForAnalysis"),", ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/heap_analysis_src#loadheapsnapshot"},"loadHeapSnapshot"),",\nor ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/heap_analysis_src#snapshotmapreduce"},"snapshotMapReduce"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/PluginUtils.ts#L70"},"heap-analysis/src/PluginUtils.ts:70"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-runheapanalysisoptions-object"},(0,t.yg)("a",{id:"runheapanalysisoptions",name:"runheapanalysisoptions"})," ",(0,t.yg)("strong",{parentName:"h3"},"RunHeapAnalysisOptions"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"Object")),(0,t.yg)("p",null,"This is the input option for ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis#analyzesnapshotfromfile"},"analyzeSnapshotFromFile"),"\nand ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis#analyzesnapshotsindirectory"},"analyzeSnapshotsInDirectory"),"."),(0,t.yg)("table",null,(0,t.yg)("thead",{parentName:"table"},(0,t.yg)("tr",{parentName:"thead"},(0,t.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,t.yg)("th",{parentName:"tr",align:"left"},"Type"),(0,t.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,t.yg)("tbody",{parentName:"table"},(0,t.yg)("tr",{parentName:"tbody"},(0,t.yg)("td",{parentName:"tr",align:"left"},(0,t.yg)("inlineCode",{parentName:"td"},"workDir?")),(0,t.yg)("td",{parentName:"tr",align:"left"},(0,t.yg)("inlineCode",{parentName:"td"},"string")),(0,t.yg)("td",{parentName:"tr",align:"left"},"specify the working directory to where the intermediate, logging, and output files should be saved")))),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/PluginUtils.ts#L81"},"heap-analysis/src/PluginUtils.ts:81"))))),(0,t.yg)("h2",{id:"functions"},"Functions"),(0,t.yg)("h3",{id:"getdominatornodesids-snapshot"},(0,t.yg)("a",{id:"getdominatornodes"}),(0,t.yg)("strong",{parentName:"h3"},"getDominatorNodes"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"ids"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"snapshot"),")"),(0,t.yg)("p",null,"This API calculate the set of\n",(0,t.yg)("a",{parentName:"p",href:"https://firefox-source-docs.mozilla.org/devtools-user/memory/dominators/index.html"},"dominator nodes"),"\nof the set of input heap objects."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"ids"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Set"),"<",(0,t.yg)("inlineCode",{parentName:"li"},"number"),">"," | Set of ids of heap objects (or nodes)"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"IHeapSnapshot")," | heap loaded from a heap snapshot"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Set"),"<",(0,t.yg)("inlineCode",{parentName:"li"},"number"),">"," | the set of dominator nodes/objects"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples"),":")))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile, getDominatorNodes} from '@memlab/heap-analysis';\n\nclass TestObject {}\n\n(async function () {\n const t1 = new TestObject();\n const t2 = new TestObject();\n\n // dump the heap of this running JavaScript program\n const heapFile = dumpNodeHeapSnapshot();\n const heap = await getFullHeapFromFile(heapFile);\n\n // find the heap node for TestObject\n let nodes = [];\n heap.nodes.forEach(node => {\n if (node.name === 'TestObject' && node.type === 'object') {\n nodes.push(node);\n }\n });\n\n // get the dominator nodes\n const dominatorIds = getDominatorNodes(\n new Set(nodes.map(node => node.id)),\n heap,\n );\n})();\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/PluginUtils.ts#L757"},"heap-analysis/src/PluginUtils.ts:757"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getfullheapfromfilefile"},(0,t.yg)("a",{id:"getfullheapfromfile"}),(0,t.yg)("strong",{parentName:"h3"},"getFullHeapFromFile"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"file"),")"),(0,t.yg)("p",null,"Load and parse a ",(0,t.yg)("inlineCode",{parentName:"p"},".heapsnapshot")," file and calculate meta data like\ndominator nodes and retained sizes."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of the ",(0,t.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," file"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,t.yg)("inlineCode",{parentName:"li"},"IHeapSnapshot"),">"," | the heap graph representation instance that supports querying\nthe heap"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples"),":")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function (){\n const heapFile = dumpNodeHeapSnapshot();\n const heap = await getFullHeapFromFile(heapFile);\n})();\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/PluginUtils.ts#L554"},"heap-analysis/src/PluginUtils.ts:554"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getheapfromfilefile"},(0,t.yg)("a",{id:"getheapfromfile"}),(0,t.yg)("strong",{parentName:"h3"},"getHeapFromFile"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"file"),")"),(0,t.yg)("p",null,(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"deprecated"))),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,t.yg)("inlineCode",{parentName:"li"},"IHeapSnapshot"),">"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/PluginUtils.ts#L585"},"heap-analysis/src/PluginUtils.ts:585"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getsnapshotdirforanalysisoptions"},(0,t.yg)("a",{id:"getsnapshotdirforanalysis"}),(0,t.yg)("strong",{parentName:"h3"},"getSnapshotDirForAnalysis"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"options"),")"),(0,t.yg)("p",null,"Get the absolute path of the directory holding all the heap snapshot files\npassed to the hosting heap analysis via ",(0,t.yg)("inlineCode",{parentName:"p"},"HeapAnalysisOptions"),"."),(0,t.yg)("p",null,"This API is supposed to be used within the overridden ",(0,t.yg)("inlineCode",{parentName:"p"},"process")," method\nof an ",(0,t.yg)("inlineCode",{parentName:"p"},"BaseAnalysis")," instance."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#heapanalysisoptions"},(0,t.yg)("inlineCode",{parentName:"a"},"HeapAnalysisOptions"))," | this is the auto-generated input passed to all the ",(0,t.yg)("inlineCode",{parentName:"li"},"BaseAnalysis")," instances"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Nullable"),"<",(0,t.yg)("inlineCode",{parentName:"li"},"string"),">"," | the absolute path of the directory"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples:"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport type {HeapAnalysisOptions} from '@memlab/heap-analysis';\nimport {getSnapshotFileForAnalysis, BaseAnalysis} from '@memlab/heap-analysis';\n\nclass ExampleAnalysis extends BaseAnalysis {\n public getCommandName(): string {\n return 'example-analysis';\n }\n\n public getDescription(): string {\n return 'an example analysis for demo';\n }\n\n async process(options: HeapAnalysisOptions): Promise {\n const directory = getSnapshotDirForAnalysis(options);\n }\n}\n")),(0,t.yg)("p",null,"Use the following code to invoke the heap analysis:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new ExampleAnalysis();\n// any .heapsnapshot file recorded by memlab or saved manually from Chrome\nawait analysis.analyzeSnapshotFromFile(snapshotFile);\n")),(0,t.yg)("p",null,"The new heap analysis can also be used with ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#analyze"},"analyze"),", in that case\n",(0,t.yg)("inlineCode",{parentName:"p"},"getSnapshotDirForAnalysis")," use the snapshot directory from\n",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"},"BrowserInteractionResultReader"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/PluginUtils.ts#L466"},"heap-analysis/src/PluginUtils.ts:466"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getsnapshotfileforanalysisoptions"},(0,t.yg)("a",{id:"getsnapshotfileforanalysis"}),(0,t.yg)("strong",{parentName:"h3"},"getSnapshotFileForAnalysis"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"options"),")"),(0,t.yg)("p",null,"Get the heap snapshot file's absolute path passed to the hosting heap\nanalysis via ",(0,t.yg)("inlineCode",{parentName:"p"},"HeapAnalysisOptions"),"."),(0,t.yg)("p",null,"This API is supposed to be used within the overridden ",(0,t.yg)("inlineCode",{parentName:"p"},"process")," method\nof an ",(0,t.yg)("inlineCode",{parentName:"p"},"BaseAnalysis")," instance."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#heapanalysisoptions"},(0,t.yg)("inlineCode",{parentName:"a"},"HeapAnalysisOptions"))," | this is the auto-generated input passed to all the ",(0,t.yg)("inlineCode",{parentName:"li"},"BaseAnalysis")," instances"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of the heap snapshot file"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples:"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport type {HeapAnalysisOptions} from '@memlab/heap-analysis';\nimport {getSnapshotFileForAnalysis, BaseAnalysis} from '@memlab/heap-analysis';\n\nclass ExampleAnalysis extends BaseAnalysis {\n public getCommandName(): string {\n return 'example-analysis';\n }\n\n public getDescription(): string {\n return 'an example analysis for demo';\n }\n\n async process(options: HeapAnalysisOptions): Promise {\n const file = getSnapshotFileForAnalysis(options);\n }\n}\n")),(0,t.yg)("p",null,"Use the following code to invoke the heap analysis:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new ExampleAnalysis();\n// any .heapsnapshot file recorded by memlab or saved manually from Chrome\nawait analysis.analyzeSnapshotFromFile(snapshotFile);\n")),(0,t.yg)("p",null,"The new heap analysis can also be used with ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#analyze"},"analyze"),", in that case\n",(0,t.yg)("inlineCode",{parentName:"p"},"getSnapshotFileForAnalysis")," will use the last heap snapshot in alphanumerically\nascending order from ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"},"BrowserInteractionResultReader"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/PluginUtils.ts#L417"},"heap-analysis/src/PluginUtils.ts:417"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"loadheapsnapshotoptions"},(0,t.yg)("a",{id:"loadheapsnapshot"}),(0,t.yg)("strong",{parentName:"h3"},"loadHeapSnapshot"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"options"),")"),(0,t.yg)("p",null,"Load the heap graph based on the single JavaScript heap snapshot\npassed to the hosting heap analysis via ",(0,t.yg)("inlineCode",{parentName:"p"},"HeapAnalysisOptions"),"."),(0,t.yg)("p",null,"This API is supposed to be used within the ",(0,t.yg)("inlineCode",{parentName:"p"},"process")," implementation\nof an ",(0,t.yg)("inlineCode",{parentName:"p"},"BaseAnalysis")," instance."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#heapanalysisoptions"},(0,t.yg)("inlineCode",{parentName:"a"},"HeapAnalysisOptions"))," | this is the auto-generated input passed to all the ",(0,t.yg)("inlineCode",{parentName:"li"},"BaseAnalysis")," instances"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,t.yg)("inlineCode",{parentName:"li"},"IHeapSnapshot"),">"," | the graph representation of the heap"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples:"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport type {HeapAnalysisOptions} from '@memlab/heap-analysis';\nimport {loadHeapSnapshot, BaseAnalysis} from '@memlab/heap-analysis';\n\nclass ExampleAnalysis extends BaseAnalysis {\n public getCommandName(): string {\n return 'example-analysis';\n }\n\n public getDescription(): string {\n return 'an example analysis for demo';\n }\n\n async process(options: HeapAnalysisOptions): Promise {\n const heap = await loadHeapSnapshot(options);\n // doing heap analysis\n }\n}\n")),(0,t.yg)("p",null,"Use the following code to invoke the heap analysis:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new ExampleAnalysis();\n// any .heapsnapshot file recorded by memlab or saved manually from Chrome\nawait analysis.analyzeSnapshotFromFile(snapshotFile);\n")),(0,t.yg)("p",null,"The new heap analysis can also be used with ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#analyze"},"analyze"),", in that case\n",(0,t.yg)("inlineCode",{parentName:"p"},"loadHeapSnapshot")," will use the last heap snapshot in alphanumerically\nascending order from ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"},"BrowserInteractionResultReader"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/PluginUtils.ts#L520"},"heap-analysis/src/PluginUtils.ts:520"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"snapshotmapreducet1-t2mapcallback-reducecallback-options"},(0,t.yg)("a",{id:"snapshotmapreduce"}),(0,t.yg)("strong",{parentName:"h3"},"snapshotMapReduce"),"<",(0,t.yg)("inlineCode",{parentName:"h3"},"T1"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"T2"),">","(",(0,t.yg)("inlineCode",{parentName:"h3"},"mapCallback"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"reduceCallback"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"options"),")"),(0,t.yg)("p",null,"When a heap analysis is taking multiple heap snapshots as input for memory\nanalysis (e.g., finding which object keeps growing in size in a series of\nheap snapshots), this API could be used to do\n",(0,t.yg)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/MapReduce"},"MapRedue")," on all heap snapshots."),(0,t.yg)("p",null,"This API is supposed to be used within the ",(0,t.yg)("inlineCode",{parentName:"p"},"process")," implementation\nof an ",(0,t.yg)("inlineCode",{parentName:"p"},"BaseAnalysis")," instance that is designed to analyze multiple heap\nsnapshots (as an example, finding which object keeps growing overtime)"),(0,t.yg)("h4",{id:"type-parameters"},"Type parameters"),(0,t.yg)("table",null,(0,t.yg)("thead",{parentName:"table"},(0,t.yg)("tr",{parentName:"thead"},(0,t.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,t.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,t.yg)("tbody",{parentName:"table"},(0,t.yg)("tr",{parentName:"tbody"},(0,t.yg)("td",{parentName:"tr",align:"left"},(0,t.yg)("inlineCode",{parentName:"td"},"T1")),(0,t.yg)("td",{parentName:"tr",align:"left"},"the type of the intermediate result from each map function call")),(0,t.yg)("tr",{parentName:"tbody"},(0,t.yg)("td",{parentName:"tr",align:"left"},(0,t.yg)("inlineCode",{parentName:"td"},"T2")),(0,t.yg)("td",{parentName:"tr",align:"left"},"the type of the final result of the reduce function call")))),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"mapCallback"),": (",(0,t.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"IHeapSnapshot"),", ",(0,t.yg)("inlineCode",{parentName:"li"},"i"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"number"),", ",(0,t.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string"),") => ",(0,t.yg)("inlineCode",{parentName:"li"},"T1")," | the map function in MapReduce, the function will be applied to each heap snapshot"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"reduceCallback"),": (",(0,t.yg)("inlineCode",{parentName:"li"},"results"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"T1"),"[]) => ",(0,t.yg)("inlineCode",{parentName:"li"},"T2")," | the reduce function in MapReduce, the function will take as input all intermediate results from all map function calls"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#heapanalysisoptions"},(0,t.yg)("inlineCode",{parentName:"a"},"HeapAnalysisOptions"))," | this is the auto-generated input passed to all the ",(0,t.yg)("inlineCode",{parentName:"li"},"BaseAnalysis")," instances"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,t.yg)("inlineCode",{parentName:"li"},"T2"),">"," | the return value of your reduce function"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples:"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport type {HeapAnalysisOptions} from '@memlab/heap-analysis';\nimport {snapshotMapReduce, BaseAnalysis} from '@memlab/heap-analysis';\n\nclass ExampleAnalysis extends BaseAnalysis {\n public getCommandName(): string {\n return 'example-analysis';\n }\n\n public getDescription(): string {\n return 'an example analysis for demo';\n }\n\n async process(options: HeapAnalysisOptions): Promise {\n // check if the number of heap objects keeps growing overtime\n const isMonotonicIncreasing = await snapshotMapReduce(\n (heap) => heap.nodes.length,\n (nodeCounts) =>\n nodeCounts[0] < nodeCounts[nodeCounts.length - 1] &&\n nodeCounts.every((count, i) => i === 0 || count >= nodeCounts[i - 1]),\n options,\n );\n }\n}\n")),(0,t.yg)("p",null,"Use the following code to invoke the heap analysis:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new ExampleAnalysis();\n// snapshotDir includes a series of .heapsnapshot files recorded by\n// memlab or saved manually from Chrome, those files will be loaded\n// in alphanumerically ascending order\nawait analysis.analyzeSnapshotsInDirectory(snapshotDir);\n")),(0,t.yg)("p",null,"The new heap analysis can also be used with ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#analyze"},"analyze"),", in that case\n",(0,t.yg)("inlineCode",{parentName:"p"},"snapshotMapReduce")," will use all the heap snapshot in alphanumerically\nascending order from ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"},"BrowserInteractionResultReader"),"."),(0,t.yg)("p",null,(0,t.yg)("strong",{parentName:"p"},"Why not passing in all heap snapshots as an array of ",(0,t.yg)("a",{parentName:"strong",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot"),"s?"),"\nEach heap snapshot could be non-trivial in size, loading them all at once\nmay not be possible."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/PluginUtils.ts#L662"},"heap-analysis/src/PluginUtils.ts:662"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"takenodefullheap"},(0,t.yg)("a",{id:"takenodefullheap"}),(0,t.yg)("strong",{parentName:"h3"},"takeNodeFullHeap"),"()"),(0,t.yg)("p",null,"Take a heap snapshot of the current program state\nand parse it as ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot"),". This\nAPI also calculates some heap analysis meta data\nfor heap analysis. But this also means slower heap parsing\ncomparing with ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#takenodeminimalheap"},"takeNodeMinimalHeap"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"p"},"Promise"),"<",(0,t.yg)("inlineCode",{parentName:"p"},"IHeapSnapshot"),">"," | heap representation with heap analysis meta data.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples:")))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport type {takeNodeFullHeap} from '@memlab/heap-analysis';\n\n(async function () {\n const heap: IHeapSnapshot = await takeNodeFullHeap();\n})();\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/PluginUtils.ts#L577"},"heap-analysis/src/PluginUtils.ts:577"))))))}g.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5be78946.84581dc3.js b/assets/js/5be78946.5e73c649.js similarity index 98% rename from assets/js/5be78946.84581dc3.js rename to assets/js/5be78946.5e73c649.js index 3ffcc0bd..ece37e9b 100644 --- a/assets/js/5be78946.84581dc3.js +++ b/assets/js/5be78946.5e73c649.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[8485],{5680:(e,a,n)=>{n.d(a,{xA:()=>p,yg:()=>g});var r=n(6540);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);a&&(r=r.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var a=1;a=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var s=r.createContext({}),c=function(e){var a=r.useContext(s),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},p=function(e){var a=c(e.components);return r.createElement(s.Provider,{value:a},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var a=e.children;return r.createElement(r.Fragment,{},a)}},f=r.forwardRef((function(e,a){var n=e.components,t=e.mdxType,l=e.originalType,s=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),d=c(n),f=t,g=d["".concat(s,".").concat(f)]||d[f]||m[f]||l;return n?r.createElement(g,i(i({ref:a},p),{},{components:n})):r.createElement(g,i({ref:a},p))}));function g(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var l=n.length,i=new Array(l);i[0]=f;var o={};for(var s in a)hasOwnProperty.call(a,s)&&(o[s]=a[s]);o.originalType=e,o[d]="string"==typeof e?e:t,i[1]=o;for(var c=2;c{n.r(a),n.d(a,{assets:()=>s,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>o,toc:()=>c});var r=n(8168),t=(n(6540),n(5680));const l={id:"core_src.ILeakFilter",title:"Interface: ILeakFilter",sidebar_label:"ILeakFilter",custom_edit_url:null},i=void 0,o={unversionedId:"api/interfaces/core_src.ILeakFilter",id:"api/interfaces/core_src.ILeakFilter",title:"Interface: ILeakFilter",description:"The ILeakFilter interface allows you to define a leak detector and",source:"@site/docs/api/interfaces/core_src.ILeakFilter.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/core_src.ILeakFilter",permalink:"/memlab/docs/api/interfaces/core_src.ILeakFilter",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"core_src.ILeakFilter",title:"Interface: ILeakFilter",sidebar_label:"ILeakFilter",custom_edit_url:null},sidebar:"sidebar",previous:{title:"IHeapStringNode",permalink:"/memlab/docs/api/interfaces/core_src.IHeapStringNode"},next:{title:"IScenario",permalink:"/memlab/docs/api/interfaces/core_src.IScenario"}},s={},c=[{value:"Properties",id:"properties",level:2},{value:' Optional beforeLeakFilter: InitLeakFilterCallback',id:"-optional-beforeleakfilter-initleakfiltercallback",level:3},{value:' Optional leakFilter: LeakFilterCallback',id:"-optional-leakfilter-leakfiltercallback",level:3},{value:' Optional retainerReferenceFilter: ReferenceFilterCallback',id:"-optional-retainerreferencefilter-referencefiltercallback",level:3}],p={toc:c},d="wrapper";function m(e){let{components:a,...n}=e;return(0,t.yg)(d,(0,r.A)({},p,n,{components:a,mdxType:"MDXLayout"}),(0,t.yg)("p",null,"The ",(0,t.yg)("inlineCode",{parentName:"p"},"ILeakFilter")," interface allows you to define a leak detector and\ncustomize the leak filtering logic in memlab (instead of using the\nbuilt-in leak filters)."),(0,t.yg)("p",null,"Use the leak filter definition in command line interface to filter\nleaks detected from browser interactions"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-bash"},"memlab run --scenario --leak-filter \n")),(0,t.yg)("p",null,"If you have already run ",(0,t.yg)("inlineCode",{parentName:"p"},"memlab run")," or ",(0,t.yg)("inlineCode",{parentName:"p"},"memlab snapshot")," which saved\nheap snapshot and other meta data on disk, use the following command\nto filter leaks based on those saved heap snapshots (query the default\ndata location by ",(0,t.yg)("inlineCode",{parentName:"p"},"memlab get-default-work-dir"),")."),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-bash"},"memlab find-leaks --leak-filter \n")),(0,t.yg)("p",null,"Here is an example TypeScript file defining a leak filter.\nThe command line interface only accepts compiled JavaScript file.\nYou can also define the leak filter in JavaScript (without the\ntype annotations."),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import {IHeapNode, IHeapSnapshot, HeapNodeIdSet, utils} from '@memlab/core';\n\nfunction initMap(snapshot: IHeapSnapshot): Record {\n const map = Object.create(null);\n snapshot.nodes.forEach(node => {\n if (node.type !== 'string') {\n return;\n }\n const str = utils.getStringNodeValue(node);\n if (str in map) {\n ++map[str];\n } else {\n map[str] = 1;\n }\n });\n return map;\n}\nconst beforeLeakFilter = (snapshot: IHeapSnapshot, _leakedNodeIds: HeapNodeIdSet): void => {\n map = initMap(snapshot);\n};\n\n// duplicated string with size > 1KB as memory leak\nconst leakFilter = (node: IHeapNode): boolean => {\n if (node.type !== 'string' || node.retainedSize < 1000) {\n return false;\n }\n const str = utils.getStringNodeValue(node);\n return map[str] > 1;\n};\n\nexport default {beforeLeakFilter, leakFilter};\n")),(0,t.yg)("h2",{id:"properties"},"Properties"),(0,t.yg)("h3",{id:"-optional-beforeleakfilter-initleakfiltercallback"},(0,t.yg)("a",{id:"beforeleakfilter",name:"beforeleakfilter"})," ",(0,t.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,t.yg)("strong",{parentName:"h3"},"beforeLeakFilter"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#initleakfiltercallback"},(0,t.yg)("inlineCode",{parentName:"a"},"InitLeakFilterCallback"))),(0,t.yg)("p",null,"Lifecycle function callback that is invoked initially once before\nthe subsequent ",(0,t.yg)("inlineCode",{parentName:"p"},"leakFilter")," function calls. This callback could\nbe used to initialize some data stores or any one-off\npreprocessings."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,t.yg)("code",null,(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot"))," | the final heap\nsnapshot taken after all browser interactions are done.\nCheck out ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")," for more APIs that queries the\nheap snapshot."),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"leakedNodeIds"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Set")," | the set of ids of all JS heap objects\nallocated by the ",(0,t.yg)("inlineCode",{parentName:"li"},"action")," call but not released after the ",(0,t.yg)("inlineCode",{parentName:"li"},"back")," call\nin browser."))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-javascript"},"module.exports = {\n beforeLeakFilter: (snapshot, leakedNodeIds) {\n // initialize some data stores\n },\n leakFilter(node, snapshot, leakedNodeIds) {\n // use the data stores\n },\n};\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L428"},"core/src/lib/Types.ts:428"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-optional-leakfilter-leakfiltercallback"},(0,t.yg)("a",{id:"leakfilter",name:"leakfilter"})," ",(0,t.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,t.yg)("strong",{parentName:"h3"},"leakFilter"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#leakfiltercallback"},(0,t.yg)("inlineCode",{parentName:"a"},"LeakFilterCallback"))),(0,t.yg)("p",null,"This callback defines how you want to filter out the\nleaked objects. The callback is called for every node (JS heap\nobject in browser) allocated by the ",(0,t.yg)("inlineCode",{parentName:"p"},"action")," callback, but not\nreleased after the ",(0,t.yg)("inlineCode",{parentName:"p"},"back")," callback. Those objects could be caches\nthat are retained in memory on purpose, or they are memory leaks."),(0,t.yg)("p",null,"This optional callback allows you to define your own algorithm\nto cherry pick memory leaks for specific JS program under test."),(0,t.yg)("p",null,"If this optional callback is not defined, memlab will use its\nbuilt-in leak filter, which considers detached DOM elements\nand unmounted Fiber nodes (detached from React Fiber tree) as\nmemory leaks."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"node"),": ",(0,t.yg)("code",null,(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},"IHeapNode"))," | the heap object\nallocated but not released. This filter callback will be applied\nto each node allocated but not released in the heap snapshot."),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,t.yg)("code",null,(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot"))," | the final heap\nsnapshot taken after all browser interactions are done.\nCheck out ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")," for more APIs that queries the\nheap snapshot."),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"leakedNodeIds"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Set")," | the set of ids of all JS heap objects\nallocated by the ",(0,t.yg)("inlineCode",{parentName:"li"},"action")," call but not released after the ",(0,t.yg)("inlineCode",{parentName:"li"},"back")," call\nin browser."))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": the boolean value indicating whether the given node in\nthe snapshot should be considered as leaked.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-javascript"},"// save as leak-filter.js\nmodule.exports = {\n leakFilter(node, snapshot, leakedNodeIds) {\n // any unreleased node (JS heap object) with 1MB+\n // retained size is considered a memory leak\n return node.retainedSize > 1000000;\n },\n};\n")),(0,t.yg)("p",null,"Use the leak filter definition in command line interface:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-bash"},"memlab find-leaks --leak-filter \n")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-bash"},"memlab run --scenario --leak-filter \n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L480"},"core/src/lib/Types.ts:480"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-optional-retainerreferencefilter-referencefiltercallback"},(0,t.yg)("a",{id:"retainerreferencefilter",name:"retainerreferencefilter"})," ",(0,t.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,t.yg)("strong",{parentName:"h3"},"retainerReferenceFilter"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#referencefiltercallback"},(0,t.yg)("inlineCode",{parentName:"a"},"ReferenceFilterCallback"))),(0,t.yg)("p",null,"Callback that can be used to define a logic to decide whether\na reference should be considered as part of the retainer trace.\nThe callback is called for every reference (edge) in the heap snapshot."),(0,t.yg)("p",null,"For concrete examples, check out ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.ILeakFilter#leakfilter"},"leakFilter"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edge")," : ",(0,t.yg)("code",null,(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},"IHeapEdge"))," | the reference (edge)\nthat is considered for calcualting the retainer trace"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,t.yg)("code",null,(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot"))," | the final heap\nsnapshot taken after all browser interactions are done.\nCheck out ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")," for more APIs that queries the\nheap snapshot."),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"isReferenceUsedByDefault"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"boolean")," | MemLab has its own default\nlogic for whether a reference should be considered as part of the\nretainer trace, if this parameter is true, it means MemLab will\nconsider this reference when calculating the retainer trace."))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": the value indicating whether the given reference should be\nconsidered when calculating the retainer trace. Note that when this\ncallback returns true, the reference will only be considered as a candidate\nfor retainer trace, so it may or may not be included in the retainer trace;\nhowever, if this callback returns false, the reference will be excluded."))),(0,t.yg)("p",null,"Note that by excluding a dominator reference of an object (i.e., an edge\nthat must be traveled through to reach the heap object from GC roots),\nthe object will be considered as unreachable in the heap graph; and\ntherefore, the reference and heap object will not be included in the\nretainer trace detection and retainer size calculation."),(0,t.yg)("p",null,"Please also be aware that some edges like self-referencing edges,\nJS engine's internal edges, and hidden edges should not be considered\nas part of the retainer trace. These edges could make the retainer trace\nunncessarily complex and cause confusion. ",(0,t.yg)("inlineCode",{parentName:"p"},"isReferenceUsedByDefault")," will\nbe ",(0,t.yg)("inlineCode",{parentName:"p"},"false")," for these types of edges."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples"),":")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-javascript"},"// save as leak-filter.js\nmodule.exports = {\n retainerReferenceFilter(edge, _snapshot, _isReferenceUsedByDefault) {\n // exclude react fiber references\n if (edge.name_or_index.toString().startsWith('__reactFiber$')) {\n return false;\n }\n // exclude other references here\n // ...\n return true;\n }\n};\n")),(0,t.yg)("p",null,"Use the leak filter definition in command line interface:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-bash"},"memlab find-leaks --leak-filter \n")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-bash"},"memlab run --scenario --leak-filter \n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L543"},"core/src/lib/Types.ts:543"))))))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[8485],{5680:(e,a,n)=>{n.d(a,{xA:()=>p,yg:()=>g});var r=n(6540);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);a&&(r=r.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var a=1;a=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var s=r.createContext({}),c=function(e){var a=r.useContext(s),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},p=function(e){var a=c(e.components);return r.createElement(s.Provider,{value:a},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var a=e.children;return r.createElement(r.Fragment,{},a)}},f=r.forwardRef((function(e,a){var n=e.components,t=e.mdxType,l=e.originalType,s=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),d=c(n),f=t,g=d["".concat(s,".").concat(f)]||d[f]||m[f]||l;return n?r.createElement(g,i(i({ref:a},p),{},{components:n})):r.createElement(g,i({ref:a},p))}));function g(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var l=n.length,i=new Array(l);i[0]=f;var o={};for(var s in a)hasOwnProperty.call(a,s)&&(o[s]=a[s]);o.originalType=e,o[d]="string"==typeof e?e:t,i[1]=o;for(var c=2;c{n.r(a),n.d(a,{assets:()=>s,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>o,toc:()=>c});var r=n(8168),t=(n(6540),n(5680));const l={id:"core_src.ILeakFilter",title:"Interface: ILeakFilter",sidebar_label:"ILeakFilter",custom_edit_url:null},i=void 0,o={unversionedId:"api/interfaces/core_src.ILeakFilter",id:"api/interfaces/core_src.ILeakFilter",title:"Interface: ILeakFilter",description:"The ILeakFilter interface allows you to define a leak detector and",source:"@site/docs/api/interfaces/core_src.ILeakFilter.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/core_src.ILeakFilter",permalink:"/memlab/docs/api/interfaces/core_src.ILeakFilter",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"core_src.ILeakFilter",title:"Interface: ILeakFilter",sidebar_label:"ILeakFilter",custom_edit_url:null},sidebar:"sidebar",previous:{title:"IHeapStringNode",permalink:"/memlab/docs/api/interfaces/core_src.IHeapStringNode"},next:{title:"IScenario",permalink:"/memlab/docs/api/interfaces/core_src.IScenario"}},s={},c=[{value:"Properties",id:"properties",level:2},{value:' Optional beforeLeakFilter: InitLeakFilterCallback',id:"-optional-beforeleakfilter-initleakfiltercallback",level:3},{value:' Optional leakFilter: LeakFilterCallback',id:"-optional-leakfilter-leakfiltercallback",level:3},{value:' Optional retainerReferenceFilter: ReferenceFilterCallback',id:"-optional-retainerreferencefilter-referencefiltercallback",level:3}],p={toc:c},d="wrapper";function m(e){let{components:a,...n}=e;return(0,t.yg)(d,(0,r.A)({},p,n,{components:a,mdxType:"MDXLayout"}),(0,t.yg)("p",null,"The ",(0,t.yg)("inlineCode",{parentName:"p"},"ILeakFilter")," interface allows you to define a leak detector and\ncustomize the leak filtering logic in memlab (instead of using the\nbuilt-in leak filters)."),(0,t.yg)("p",null,"Use the leak filter definition in command line interface to filter\nleaks detected from browser interactions"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-bash"},"memlab run --scenario --leak-filter \n")),(0,t.yg)("p",null,"If you have already run ",(0,t.yg)("inlineCode",{parentName:"p"},"memlab run")," or ",(0,t.yg)("inlineCode",{parentName:"p"},"memlab snapshot")," which saved\nheap snapshot and other meta data on disk, use the following command\nto filter leaks based on those saved heap snapshots (query the default\ndata location by ",(0,t.yg)("inlineCode",{parentName:"p"},"memlab get-default-work-dir"),")."),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-bash"},"memlab find-leaks --leak-filter \n")),(0,t.yg)("p",null,"Here is an example TypeScript file defining a leak filter.\nThe command line interface only accepts compiled JavaScript file.\nYou can also define the leak filter in JavaScript (without the\ntype annotations."),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import {IHeapNode, IHeapSnapshot, HeapNodeIdSet, utils} from '@memlab/core';\n\nfunction initMap(snapshot: IHeapSnapshot): Record {\n const map = Object.create(null);\n snapshot.nodes.forEach(node => {\n if (node.type !== 'string') {\n return;\n }\n const str = utils.getStringNodeValue(node);\n if (str in map) {\n ++map[str];\n } else {\n map[str] = 1;\n }\n });\n return map;\n}\nconst beforeLeakFilter = (snapshot: IHeapSnapshot, _leakedNodeIds: HeapNodeIdSet): void => {\n map = initMap(snapshot);\n};\n\n// duplicated string with size > 1KB as memory leak\nconst leakFilter = (node: IHeapNode): boolean => {\n if (node.type !== 'string' || node.retainedSize < 1000) {\n return false;\n }\n const str = utils.getStringNodeValue(node);\n return map[str] > 1;\n};\n\nexport default {beforeLeakFilter, leakFilter};\n")),(0,t.yg)("h2",{id:"properties"},"Properties"),(0,t.yg)("h3",{id:"-optional-beforeleakfilter-initleakfiltercallback"},(0,t.yg)("a",{id:"beforeleakfilter",name:"beforeleakfilter"})," ",(0,t.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,t.yg)("strong",{parentName:"h3"},"beforeLeakFilter"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#initleakfiltercallback"},(0,t.yg)("inlineCode",{parentName:"a"},"InitLeakFilterCallback"))),(0,t.yg)("p",null,"Lifecycle function callback that is invoked initially once before\nthe subsequent ",(0,t.yg)("inlineCode",{parentName:"p"},"leakFilter")," function calls. This callback could\nbe used to initialize some data stores or any one-off\npreprocessings."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,t.yg)("code",null,(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot"))," | the final heap\nsnapshot taken after all browser interactions are done.\nCheck out ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")," for more APIs that queries the\nheap snapshot."),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"leakedNodeIds"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Set")," | the set of ids of all JS heap objects\nallocated by the ",(0,t.yg)("inlineCode",{parentName:"li"},"action")," call but not released after the ",(0,t.yg)("inlineCode",{parentName:"li"},"back")," call\nin browser."))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-javascript"},"module.exports = {\n beforeLeakFilter: (snapshot, leakedNodeIds) {\n // initialize some data stores\n },\n leakFilter(node, snapshot, leakedNodeIds) {\n // use the data stores\n },\n};\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L428"},"core/src/lib/Types.ts:428"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-optional-leakfilter-leakfiltercallback"},(0,t.yg)("a",{id:"leakfilter",name:"leakfilter"})," ",(0,t.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,t.yg)("strong",{parentName:"h3"},"leakFilter"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#leakfiltercallback"},(0,t.yg)("inlineCode",{parentName:"a"},"LeakFilterCallback"))),(0,t.yg)("p",null,"This callback defines how you want to filter out the\nleaked objects. The callback is called for every node (JS heap\nobject in browser) allocated by the ",(0,t.yg)("inlineCode",{parentName:"p"},"action")," callback, but not\nreleased after the ",(0,t.yg)("inlineCode",{parentName:"p"},"back")," callback. Those objects could be caches\nthat are retained in memory on purpose, or they are memory leaks."),(0,t.yg)("p",null,"This optional callback allows you to define your own algorithm\nto cherry pick memory leaks for specific JS program under test."),(0,t.yg)("p",null,"If this optional callback is not defined, memlab will use its\nbuilt-in leak filter, which considers detached DOM elements\nand unmounted Fiber nodes (detached from React Fiber tree) as\nmemory leaks."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"node"),": ",(0,t.yg)("code",null,(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},"IHeapNode"))," | the heap object\nallocated but not released. This filter callback will be applied\nto each node allocated but not released in the heap snapshot."),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,t.yg)("code",null,(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot"))," | the final heap\nsnapshot taken after all browser interactions are done.\nCheck out ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")," for more APIs that queries the\nheap snapshot."),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"leakedNodeIds"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Set")," | the set of ids of all JS heap objects\nallocated by the ",(0,t.yg)("inlineCode",{parentName:"li"},"action")," call but not released after the ",(0,t.yg)("inlineCode",{parentName:"li"},"back")," call\nin browser."))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": the boolean value indicating whether the given node in\nthe snapshot should be considered as leaked.")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-javascript"},"// save as leak-filter.js\nmodule.exports = {\n leakFilter(node, snapshot, leakedNodeIds) {\n // any unreleased node (JS heap object) with 1MB+\n // retained size is considered a memory leak\n return node.retainedSize > 1000000;\n },\n};\n")),(0,t.yg)("p",null,"Use the leak filter definition in command line interface:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-bash"},"memlab find-leaks --leak-filter \n")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-bash"},"memlab run --scenario --leak-filter \n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L480"},"core/src/lib/Types.ts:480"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-optional-retainerreferencefilter-referencefiltercallback"},(0,t.yg)("a",{id:"retainerreferencefilter",name:"retainerreferencefilter"})," ",(0,t.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,t.yg)("strong",{parentName:"h3"},"retainerReferenceFilter"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#referencefiltercallback"},(0,t.yg)("inlineCode",{parentName:"a"},"ReferenceFilterCallback"))),(0,t.yg)("p",null,"Callback that can be used to define a logic to decide whether\na reference should be considered as part of the retainer trace.\nThe callback is called for every reference (edge) in the heap snapshot."),(0,t.yg)("p",null,"For concrete examples, check out ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.ILeakFilter#leakfilter"},"leakFilter"),"."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"edge")," : ",(0,t.yg)("code",null,(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},"IHeapEdge"))," | the reference (edge)\nthat is considered for calcualting the retainer trace"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,t.yg)("code",null,(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot"))," | the final heap\nsnapshot taken after all browser interactions are done.\nCheck out ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")," for more APIs that queries the\nheap snapshot."),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"isReferenceUsedByDefault"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"boolean")," | MemLab has its own default\nlogic for whether a reference should be considered as part of the\nretainer trace, if this parameter is true, it means MemLab will\nconsider this reference when calculating the retainer trace."))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": the value indicating whether the given reference should be\nconsidered when calculating the retainer trace. Note that when this\ncallback returns true, the reference will only be considered as a candidate\nfor retainer trace, so it may or may not be included in the retainer trace;\nhowever, if this callback returns false, the reference will be excluded."))),(0,t.yg)("p",null,"Note that by excluding a dominator reference of an object (i.e., an edge\nthat must be traveled through to reach the heap object from GC roots),\nthe object will be considered as unreachable in the heap graph; and\ntherefore, the reference and heap object will not be included in the\nretainer trace detection and retainer size calculation."),(0,t.yg)("p",null,"Please also be aware that some edges like self-referencing edges,\nJS engine's internal edges, and hidden edges should not be considered\nas part of the retainer trace. These edges could make the retainer trace\nunncessarily complex and cause confusion. ",(0,t.yg)("inlineCode",{parentName:"p"},"isReferenceUsedByDefault")," will\nbe ",(0,t.yg)("inlineCode",{parentName:"p"},"false")," for these types of edges."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples"),":")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-javascript"},"// save as leak-filter.js\nmodule.exports = {\n retainerReferenceFilter(edge, _snapshot, _isReferenceUsedByDefault) {\n // exclude react fiber references\n if (edge.name_or_index.toString().startsWith('__reactFiber$')) {\n return false;\n }\n // exclude other references here\n // ...\n return true;\n }\n};\n")),(0,t.yg)("p",null,"Use the leak filter definition in command line interface:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-bash"},"memlab find-leaks --leak-filter \n")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-bash"},"memlab run --scenario --leak-filter \n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L543"},"core/src/lib/Types.ts:543"))))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6b5d7254.4c379e61.js b/assets/js/6b5d7254.bbd8adf9.js similarity index 91% rename from assets/js/6b5d7254.4c379e61.js rename to assets/js/6b5d7254.bbd8adf9.js index 9bd8d7c8..0765b420 100644 --- a/assets/js/6b5d7254.4c379e61.js +++ b/assets/js/6b5d7254.bbd8adf9.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[9548],{5680:(e,a,n)=>{n.d(a,{xA:()=>c,yg:()=>y});var r=n(6540);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);a&&(r=r.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var a=1;a=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var p=r.createContext({}),s=function(e){var a=r.useContext(p),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},c=function(e){var a=s(e.components);return r.createElement(p.Provider,{value:a},e.children)},g="mdxType",d={inlineCode:"code",wrapper:function(e){var a=e.children;return r.createElement(r.Fragment,{},a)}},m=r.forwardRef((function(e,a){var n=e.components,t=e.mdxType,l=e.originalType,p=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),g=s(n),m=t,y=g["".concat(p,".").concat(m)]||g[m]||d[m]||l;return n?r.createElement(y,i(i({ref:a},c),{},{components:n})):r.createElement(y,i({ref:a},c))}));function y(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var l=n.length,i=new Array(l);i[0]=m;var o={};for(var p in a)hasOwnProperty.call(a,p)&&(o[p]=a[p]);o.originalType=e,o[g]="string"==typeof e?e:t,i[1]=o;for(var s=2;s{n.r(a),n.d(a,{assets:()=>p,contentTitle:()=>i,default:()=>d,frontMatter:()=>l,metadata:()=>o,toc:()=>s});var r=n(8168),t=(n(6540),n(5680));const l={id:"core_src.IHeapEdges",title:"Interface: IHeapEdges",sidebar_label:"IHeapEdges",custom_edit_url:null},i=void 0,o={unversionedId:"api/interfaces/core_src.IHeapEdges",id:"api/interfaces/core_src.IHeapEdges",title:"Interface: IHeapEdges",description:"A pseudo array containing all heap graph edges (references to heap objects",source:"@site/docs/api/interfaces/core_src.IHeapEdges.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/core_src.IHeapEdges",permalink:"/memlab/docs/api/interfaces/core_src.IHeapEdges",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"core_src.IHeapEdges",title:"Interface: IHeapEdges",sidebar_label:"IHeapEdges",custom_edit_url:null},sidebar:"sidebar",previous:{title:"IHeapEdge",permalink:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},next:{title:"IHeapLocation",permalink:"/memlab/docs/api/interfaces/core_src.IHeapLocation"}},p={},s=[{value:"Properties",id:"properties",level:2},{value:' length: number',id:"-length-number",level:3},{value:"Methods",id:"methods",level:2},{value:'forEach(callback)',id:"foreachcallback",level:3},{value:'get(index)',id:"getindex",level:3}],c={toc:s},g="wrapper";function d(e){let{components:a,...n}=e;return(0,t.yg)(g,(0,r.A)({},c,n,{components:a,mdxType:"MDXLayout"}),(0,t.yg)("p",null,"A pseudo array containing all heap graph edges (references to heap objects\nin heap). A JS heap could contain millions of references, so memlab uses\na pseudo array as the collection of all the heap edges. The pseudo\narray provides API to query and traverse all heap references."),(0,t.yg)("p",null,(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"readonly"))," modifying this pseudo array is not recommended"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples"),":")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot, IHeapEdges} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n const edges: IHeapEdges = heap.edges;\n edges.length;\n edges.get(0);\n edges.forEach((edge, i) => {\n if (stopIteration) {\n return false;\n }\n });\n})();\n")),(0,t.yg)("h2",{id:"properties"},"Properties"),(0,t.yg)("h3",{id:"-length-number"},(0,t.yg)("a",{id:"length",name:"length"})," ",(0,t.yg)("strong",{parentName:"h3"},"length"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"The total number of edges in heap graph (or JS references in heap\nsnapshot)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1747"},"core/src/lib/Types.ts:1747"))))),(0,t.yg)("h2",{id:"methods"},"Methods"),(0,t.yg)("h3",{id:"foreachcallback"},(0,t.yg)("a",{id:"foreach"}),(0,t.yg)("strong",{parentName:"h3"},"forEach"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"callback"),")"),(0,t.yg)("p",null,"Iterate over all array elements and apply the callback\nto each element in ascending order of element index."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"callback"),": (",(0,t.yg)("inlineCode",{parentName:"li"},"edge"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),", ",(0,t.yg)("inlineCode",{parentName:"li"},"index"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"number"),") => ",(0,t.yg)("inlineCode",{parentName:"li"},"boolean")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"void")," | the callback does not need to return any value, if the callback returns ",(0,t.yg)("inlineCode",{parentName:"li"},"false")," when iterating on element at index ",(0,t.yg)("inlineCode",{parentName:"li"},"i"),", then all elements after ",(0,t.yg)("inlineCode",{parentName:"li"},"i")," won't be iterated."))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"void")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1763"},"core/src/lib/Types.ts:1763"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getindex"},(0,t.yg)("a",{id:"get"}),(0,t.yg)("strong",{parentName:"h3"},"get"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"index"),")"),(0,t.yg)("p",null,"get an ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},"IHeapEdge")," element at the specified index"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"index"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the index of an element in the pseudo array, the index ranges from 0 to array length - 1. Notice that this is not the heap node id."))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | When 0 <= ",(0,t.yg)("inlineCode",{parentName:"p"},"index")," < array.length, this API returns the element\nat the specified index, otherwise it returns ",(0,t.yg)("inlineCode",{parentName:"p"},"null"),".")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Source"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1755"},"core/src/lib/Types.ts:1755"))))))}d.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[9548],{5680:(e,a,n)=>{n.d(a,{xA:()=>c,yg:()=>y});var r=n(6540);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);a&&(r=r.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var a=1;a=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var p=r.createContext({}),s=function(e){var a=r.useContext(p),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},c=function(e){var a=s(e.components);return r.createElement(p.Provider,{value:a},e.children)},g="mdxType",m={inlineCode:"code",wrapper:function(e){var a=e.children;return r.createElement(r.Fragment,{},a)}},d=r.forwardRef((function(e,a){var n=e.components,t=e.mdxType,l=e.originalType,p=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),g=s(n),d=t,y=g["".concat(p,".").concat(d)]||g[d]||m[d]||l;return n?r.createElement(y,i(i({ref:a},c),{},{components:n})):r.createElement(y,i({ref:a},c))}));function y(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var l=n.length,i=new Array(l);i[0]=d;var o={};for(var p in a)hasOwnProperty.call(a,p)&&(o[p]=a[p]);o.originalType=e,o[g]="string"==typeof e?e:t,i[1]=o;for(var s=2;s{n.r(a),n.d(a,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>o,toc:()=>s});var r=n(8168),t=(n(6540),n(5680));const l={id:"core_src.IHeapEdges",title:"Interface: IHeapEdges",sidebar_label:"IHeapEdges",custom_edit_url:null},i=void 0,o={unversionedId:"api/interfaces/core_src.IHeapEdges",id:"api/interfaces/core_src.IHeapEdges",title:"Interface: IHeapEdges",description:"A pseudo array containing all heap graph edges (references to heap objects",source:"@site/docs/api/interfaces/core_src.IHeapEdges.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/core_src.IHeapEdges",permalink:"/memlab/docs/api/interfaces/core_src.IHeapEdges",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"core_src.IHeapEdges",title:"Interface: IHeapEdges",sidebar_label:"IHeapEdges",custom_edit_url:null},sidebar:"sidebar",previous:{title:"IHeapEdge",permalink:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},next:{title:"IHeapLocation",permalink:"/memlab/docs/api/interfaces/core_src.IHeapLocation"}},p={},s=[{value:"Properties",id:"properties",level:2},{value:' length: number',id:"-length-number",level:3},{value:"Methods",id:"methods",level:2},{value:'forEach(callback)',id:"foreachcallback",level:3},{value:'get(index)',id:"getindex",level:3}],c={toc:s},g="wrapper";function m(e){let{components:a,...n}=e;return(0,t.yg)(g,(0,r.A)({},c,n,{components:a,mdxType:"MDXLayout"}),(0,t.yg)("p",null,"A pseudo array containing all heap graph edges (references to heap objects\nin heap). A JS heap could contain millions of references, so memlab uses\na pseudo array as the collection of all the heap edges. The pseudo\narray provides API to query and traverse all heap references."),(0,t.yg)("p",null,(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"readonly"))," modifying this pseudo array is not recommended"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples"),":")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot, IHeapEdges} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n const edges: IHeapEdges = heap.edges;\n edges.length;\n edges.get(0);\n edges.forEach((edge, i) => {\n if (stopIteration) {\n return false;\n }\n });\n})();\n")),(0,t.yg)("h2",{id:"properties"},"Properties"),(0,t.yg)("h3",{id:"-length-number"},(0,t.yg)("a",{id:"length",name:"length"})," ",(0,t.yg)("strong",{parentName:"h3"},"length"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"The total number of edges in heap graph (or JS references in heap\nsnapshot)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1747"},"core/src/lib/Types.ts:1747"))))),(0,t.yg)("h2",{id:"methods"},"Methods"),(0,t.yg)("h3",{id:"foreachcallback"},(0,t.yg)("a",{id:"foreach"}),(0,t.yg)("strong",{parentName:"h3"},"forEach"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"callback"),")"),(0,t.yg)("p",null,"Iterate over all array elements and apply the callback\nto each element in ascending order of element index."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"callback"),": (",(0,t.yg)("inlineCode",{parentName:"li"},"edge"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),", ",(0,t.yg)("inlineCode",{parentName:"li"},"index"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"number"),") => ",(0,t.yg)("inlineCode",{parentName:"li"},"boolean")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"void")," | the callback does not need to return any value, if the callback returns ",(0,t.yg)("inlineCode",{parentName:"li"},"false")," when iterating on element at index ",(0,t.yg)("inlineCode",{parentName:"li"},"i"),", then all elements after ",(0,t.yg)("inlineCode",{parentName:"li"},"i")," won't be iterated."))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"void")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1763"},"core/src/lib/Types.ts:1763"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getindex"},(0,t.yg)("a",{id:"get"}),(0,t.yg)("strong",{parentName:"h3"},"get"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"index"),")"),(0,t.yg)("p",null,"get an ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},"IHeapEdge")," element at the specified index"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"index"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the index of an element in the pseudo array, the index ranges from 0 to array length - 1. Notice that this is not the heap node id."))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapEdge")),">"," | When 0 <= ",(0,t.yg)("inlineCode",{parentName:"p"},"index")," < array.length, this API returns the element\nat the specified index, otherwise it returns ",(0,t.yg)("inlineCode",{parentName:"p"},"null"),".")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Source"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1755"},"core/src/lib/Types.ts:1755"))))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/72eddb53.1a366387.js b/assets/js/72eddb53.d430de75.js similarity index 98% rename from assets/js/72eddb53.1a366387.js rename to assets/js/72eddb53.d430de75.js index b6ed3475..9d1799c9 100644 --- a/assets/js/72eddb53.1a366387.js +++ b/assets/js/72eddb53.d430de75.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[1473],{5680:(e,a,n)=>{n.d(a,{xA:()=>c,yg:()=>g});var t=n(6540);function l(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function s(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function i(e){for(var a=1;a=0||(l[n]=e[n]);return l}(e,a);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}var o=t.createContext({}),p=function(e){var a=t.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},c=function(e){var a=p(e.components);return t.createElement(o.Provider,{value:a},e.children)},y="mdxType",u={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},m=t.forwardRef((function(e,a){var n=e.components,l=e.mdxType,s=e.originalType,o=e.parentName,c=r(e,["components","mdxType","originalType","parentName"]),y=p(n),m=l,g=y["".concat(o,".").concat(m)]||y[m]||u[m]||s;return n?t.createElement(g,i(i({ref:a},c),{},{components:n})):t.createElement(g,i({ref:a},c))}));function g(e,a){var n=arguments,l=a&&a.mdxType;if("string"==typeof e||l){var s=n.length,i=new Array(s);i[0]=m;var r={};for(var o in a)hasOwnProperty.call(a,o)&&(r[o]=a[o]);r.originalType=e,r[y]="string"==typeof e?e:l,i[1]=r;for(var p=2;p{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>i,default:()=>u,frontMatter:()=>s,metadata:()=>r,toc:()=>p});var t=n(8168),l=(n(6540),n(5680));const s={id:"heap_analysis_src.ObjectShallowAnalysis",title:"Class: ObjectShallowAnalysis",sidebar_label:"ObjectShallowAnalysis",custom_edit_url:null},i=void 0,r={unversionedId:"api/classes/heap_analysis_src.ObjectShallowAnalysis",id:"api/classes/heap_analysis_src.ObjectShallowAnalysis",title:"Class: ObjectShallowAnalysis",description:"Hierarchy",source:"@site/docs/api/classes/heap_analysis_src.ObjectShallowAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.ObjectShallowAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectShallowAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.ObjectShallowAnalysis",title:"Class: ObjectShallowAnalysis",sidebar_label:"ObjectShallowAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"ObjectFanoutAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectFanoutAnalysis"},next:{title:"ObjectShapeAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectShapeAnalysis"}},o={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new ObjectShallowAnalysis()',id:"new-objectshallowanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotFromFile(file, options?)',id:"analyzesnapshotfromfilefile-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3},{value:'getTopDuplicatedObjectInCount()',id:"gettopduplicatedobjectincount",level:3}],c={toc:p},y="wrapper";function u(e){let{components:a,...n}=e;return(0,l.yg)(y,(0,t.A)({},c,n,{components:a,mdxType:"MDXLayout"}),(0,l.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("p",{parentName:"li"},(0,l.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},(0,l.yg)("inlineCode",{parentName:"a"},"BaseAnalysis"))),(0,l.yg)("p",{parentName:"li"},"\u21b3 ",(0,l.yg)("strong",{parentName:"p"},(0,l.yg)("inlineCode",{parentName:"strong"},"ObjectShallowAnalysis"))))),(0,l.yg)("h2",{id:"constructors"},"Constructors"),(0,l.yg)("h3",{id:"new-objectshallowanalysis"},(0,l.yg)("a",{id:"new objectshallowanalysis"}),(0,l.yg)("strong",{parentName:"h3"},"new ObjectShallowAnalysis"),"()"),(0,l.yg)("h2",{id:"methods"},"Methods"),(0,l.yg)("h3",{id:"analyzesnapshotfromfilefile-options"},(0,l.yg)("a",{id:"analyzesnapshotfromfile"}),(0,l.yg)("strong",{parentName:"h3"},"analyzeSnapshotFromFile"),"(",(0,l.yg)("inlineCode",{parentName:"h3"},"file"),", ",(0,l.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,l.yg)("p",null,"Run heap analysis for a single heap snapshot file"),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Parameters"),":",(0,l.yg)("ul",{parentName:"li"},(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,l.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of a ",(0,l.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," file."),(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,l.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,l.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Returns"),": ",(0,l.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,l.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,l.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,l.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Example"),":")),(0,l.yg)("pre",null,(0,l.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile);\n// query analysis-specific and structured results\nconst stringPatterns = analysis.getTopDuplicatedStringsInCount();\n")),(0,l.yg)("p",null,"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:"),(0,l.yg)("pre",null,(0,l.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Source"),":",(0,l.yg)("ul",{parentName:"li"},(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/BaseAnalysis.ts#L95"},"heap-analysis/src/BaseAnalysis.ts:95"))))),(0,l.yg)("hr",null),(0,l.yg)("h3",{id:"getcommandname"},(0,l.yg)("a",{id:"getcommandname"}),(0,l.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,l.yg)("p",null,"get CLI command name for this memory analysis;\nuse it with ",(0,l.yg)("inlineCode",{parentName:"p"},"memlab analyze ")," in CLI"),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("p",{parentName:"li"},(0,l.yg)("strong",{parentName:"p"},"Returns"),": ",(0,l.yg)("inlineCode",{parentName:"p"},"string")," | command name")),(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("p",{parentName:"li"},(0,l.yg)("strong",{parentName:"p"},"Source"),":"),(0,l.yg)("ul",{parentName:"li"},(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/plugins/ObjectShallowAnalysis.ts#L65"},"heap-analysis/src/plugins/ObjectShallowAnalysis.ts:65"))))),(0,l.yg)("hr",null),(0,l.yg)("h3",{id:"gettopduplicatedobjectincount"},(0,l.yg)("a",{id:"gettopduplicatedobjectincount"}),(0,l.yg)("strong",{parentName:"h3"},"getTopDuplicatedObjectInCount"),"()"),(0,l.yg)("p",null,"get the top duplicated object in terms of duplicated object count"),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("p",{parentName:"li"},(0,l.yg)("strong",{parentName:"p"},"Returns"),": ",(0,l.yg)("inlineCode",{parentName:"p"},"ObjectRecord"),"[] | an array of the top-duplicated objects' information")),(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("p",{parentName:"li"},(0,l.yg)("strong",{parentName:"p"},"Source"),":"),(0,l.yg)("ul",{parentName:"li"},(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/plugins/ObjectShallowAnalysis.ts#L108"},"heap-analysis/src/plugins/ObjectShallowAnalysis.ts:108"))))))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[1473],{5680:(e,a,n)=>{n.d(a,{xA:()=>c,yg:()=>g});var t=n(6540);function l(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function s(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function i(e){for(var a=1;a=0||(l[n]=e[n]);return l}(e,a);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}var o=t.createContext({}),p=function(e){var a=t.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},c=function(e){var a=p(e.components);return t.createElement(o.Provider,{value:a},e.children)},y="mdxType",u={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},m=t.forwardRef((function(e,a){var n=e.components,l=e.mdxType,s=e.originalType,o=e.parentName,c=r(e,["components","mdxType","originalType","parentName"]),y=p(n),m=l,g=y["".concat(o,".").concat(m)]||y[m]||u[m]||s;return n?t.createElement(g,i(i({ref:a},c),{},{components:n})):t.createElement(g,i({ref:a},c))}));function g(e,a){var n=arguments,l=a&&a.mdxType;if("string"==typeof e||l){var s=n.length,i=new Array(s);i[0]=m;var r={};for(var o in a)hasOwnProperty.call(a,o)&&(r[o]=a[o]);r.originalType=e,r[y]="string"==typeof e?e:l,i[1]=r;for(var p=2;p{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>i,default:()=>u,frontMatter:()=>s,metadata:()=>r,toc:()=>p});var t=n(8168),l=(n(6540),n(5680));const s={id:"heap_analysis_src.ObjectShallowAnalysis",title:"Class: ObjectShallowAnalysis",sidebar_label:"ObjectShallowAnalysis",custom_edit_url:null},i=void 0,r={unversionedId:"api/classes/heap_analysis_src.ObjectShallowAnalysis",id:"api/classes/heap_analysis_src.ObjectShallowAnalysis",title:"Class: ObjectShallowAnalysis",description:"Hierarchy",source:"@site/docs/api/classes/heap_analysis_src.ObjectShallowAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.ObjectShallowAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectShallowAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.ObjectShallowAnalysis",title:"Class: ObjectShallowAnalysis",sidebar_label:"ObjectShallowAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"ObjectFanoutAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectFanoutAnalysis"},next:{title:"ObjectShapeAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectShapeAnalysis"}},o={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new ObjectShallowAnalysis()',id:"new-objectshallowanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotFromFile(file, options?)',id:"analyzesnapshotfromfilefile-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3},{value:'getTopDuplicatedObjectInCount()',id:"gettopduplicatedobjectincount",level:3}],c={toc:p},y="wrapper";function u(e){let{components:a,...n}=e;return(0,l.yg)(y,(0,t.A)({},c,n,{components:a,mdxType:"MDXLayout"}),(0,l.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("p",{parentName:"li"},(0,l.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},(0,l.yg)("inlineCode",{parentName:"a"},"BaseAnalysis"))),(0,l.yg)("p",{parentName:"li"},"\u21b3 ",(0,l.yg)("strong",{parentName:"p"},(0,l.yg)("inlineCode",{parentName:"strong"},"ObjectShallowAnalysis"))))),(0,l.yg)("h2",{id:"constructors"},"Constructors"),(0,l.yg)("h3",{id:"new-objectshallowanalysis"},(0,l.yg)("a",{id:"new objectshallowanalysis"}),(0,l.yg)("strong",{parentName:"h3"},"new ObjectShallowAnalysis"),"()"),(0,l.yg)("h2",{id:"methods"},"Methods"),(0,l.yg)("h3",{id:"analyzesnapshotfromfilefile-options"},(0,l.yg)("a",{id:"analyzesnapshotfromfile"}),(0,l.yg)("strong",{parentName:"h3"},"analyzeSnapshotFromFile"),"(",(0,l.yg)("inlineCode",{parentName:"h3"},"file"),", ",(0,l.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,l.yg)("p",null,"Run heap analysis for a single heap snapshot file"),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Parameters"),":",(0,l.yg)("ul",{parentName:"li"},(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,l.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of a ",(0,l.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," file."),(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,l.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,l.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Returns"),": ",(0,l.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,l.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,l.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,l.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Example"),":")),(0,l.yg)("pre",null,(0,l.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile);\n// query analysis-specific and structured results\nconst stringPatterns = analysis.getTopDuplicatedStringsInCount();\n")),(0,l.yg)("p",null,"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:"),(0,l.yg)("pre",null,(0,l.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("strong",{parentName:"li"},"Source"),":",(0,l.yg)("ul",{parentName:"li"},(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/BaseAnalysis.ts#L95"},"heap-analysis/src/BaseAnalysis.ts:95"))))),(0,l.yg)("hr",null),(0,l.yg)("h3",{id:"getcommandname"},(0,l.yg)("a",{id:"getcommandname"}),(0,l.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,l.yg)("p",null,"get CLI command name for this memory analysis;\nuse it with ",(0,l.yg)("inlineCode",{parentName:"p"},"memlab analyze ")," in CLI"),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("p",{parentName:"li"},(0,l.yg)("strong",{parentName:"p"},"Returns"),": ",(0,l.yg)("inlineCode",{parentName:"p"},"string")," | command name")),(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("p",{parentName:"li"},(0,l.yg)("strong",{parentName:"p"},"Source"),":"),(0,l.yg)("ul",{parentName:"li"},(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/plugins/ObjectShallowAnalysis.ts#L65"},"heap-analysis/src/plugins/ObjectShallowAnalysis.ts:65"))))),(0,l.yg)("hr",null),(0,l.yg)("h3",{id:"gettopduplicatedobjectincount"},(0,l.yg)("a",{id:"gettopduplicatedobjectincount"}),(0,l.yg)("strong",{parentName:"h3"},"getTopDuplicatedObjectInCount"),"()"),(0,l.yg)("p",null,"get the top duplicated object in terms of duplicated object count"),(0,l.yg)("ul",null,(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("p",{parentName:"li"},(0,l.yg)("strong",{parentName:"p"},"Returns"),": ",(0,l.yg)("inlineCode",{parentName:"p"},"ObjectRecord"),"[] | an array of the top-duplicated objects' information")),(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("p",{parentName:"li"},(0,l.yg)("strong",{parentName:"p"},"Source"),":"),(0,l.yg)("ul",{parentName:"li"},(0,l.yg)("li",{parentName:"ul"},(0,l.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/plugins/ObjectShallowAnalysis.ts#L108"},"heap-analysis/src/plugins/ObjectShallowAnalysis.ts:108"))))))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8b21a35a.4757b023.js b/assets/js/8b21a35a.939790e1.js similarity index 95% rename from assets/js/8b21a35a.4757b023.js rename to assets/js/8b21a35a.939790e1.js index de32012f..e397c6f5 100644 --- a/assets/js/8b21a35a.4757b023.js +++ b/assets/js/8b21a35a.939790e1.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[6640],{5680:(e,a,n)=>{n.d(a,{xA:()=>m,yg:()=>u});var t=n(6540);function r(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function i(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function l(e){for(var a=1;a=0||(r[n]=e[n]);return r}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=t.createContext({}),p=function(e){var a=t.useContext(s),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},m=function(e){var a=p(e.components);return t.createElement(s.Provider,{value:a},e.children)},g="mdxType",d={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},y=t.forwardRef((function(e,a){var n=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),g=p(n),y=r,u=g["".concat(s,".").concat(y)]||g[y]||d[y]||i;return n?t.createElement(u,l(l({ref:a},m),{},{components:n})):t.createElement(u,l({ref:a},m))}));function u(e,a){var n=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=y;var o={};for(var s in a)hasOwnProperty.call(a,s)&&(o[s]=a[s]);o.originalType=e,o[g]="string"==typeof e?e:r,l[1]=o;for(var p=2;p{n.r(a),n.d(a,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>p});var t=n(8168),r=(n(6540),n(5680));const i={id:"api_src",title:"Package: @memlab/api",sidebar_label:"api/src",sidebar_position:0,custom_edit_url:null},l=void 0,o={unversionedId:"api/modules/api_src",id:"api/modules/api_src",title:"Package: @memlab/api",description:"Enumerations",source:"@site/docs/api/modules/api_src.md",sourceDirName:"api/modules",slug:"/api/modules/api_src",permalink:"/memlab/docs/api/modules/api_src",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"api_src",title:"Package: @memlab/api",sidebar_label:"api/src",sidebar_position:0,custom_edit_url:null},sidebar:"sidebar",previous:{title:"Table of contents",permalink:"/memlab/docs/api/"},next:{title:"core/src",permalink:"/memlab/docs/api/modules/core_src"}},s={},p=[{value:"Enumerations",id:"enumerations",level:2},{value:"Classes",id:"classes",level:2},{value:"Type Aliases",id:"type-aliases",level:2},{value:' RunOptions: Object',id:"-runoptions-object",level:3},{value:' RunResult: Object',id:"-runresult-object",level:3},{value:"Functions",id:"functions",level:2},{value:'analyze(runResult, heapAnalyzer, args?)',id:"analyzerunresult-heapanalyzer-args",level:3},{value:'findLeaks(runResult, options?)',id:"findleaksrunresult-options",level:3},{value:'findLeaksBySnapshotFilePaths(baselineSnapshot, targetSnapshot, finalSnapshot, options?)',id:"findleaksbysnapshotfilepathsbaselinesnapshot-targetsnapshot-finalsnapshot-options",level:3},{value:'run(options?)',id:"runoptions",level:3},{value:'takeSnapshots(options?)',id:"takesnapshotsoptions",level:3},{value:'warmupAndTakeSnapshots(options?)',id:"warmupandtakesnapshotsoptions",level:3}],m={toc:p},g="wrapper";function d(e){let{components:a,...n}=e;return(0,r.yg)(g,(0,t.A)({},m,n,{components:a,mdxType:"MDXLayout"}),(0,r.yg)("h2",{id:"enumerations"},"Enumerations"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/enums/api_src.ConsoleMode"},"ConsoleMode"))),(0,r.yg)("h2",{id:"classes"},"Classes"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"},"BrowserInteractionResultReader")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/api_src.SnapshotResultReader"},"SnapshotResultReader"))),(0,r.yg)("h2",{id:"type-aliases"},"Type Aliases"),(0,r.yg)("h3",{id:"-runoptions-object"},(0,r.yg)("a",{id:"runoptions",name:"runoptions"})," ",(0,r.yg)("strong",{parentName:"h3"},"RunOptions"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"Object")),(0,r.yg)("p",null,"Options for configuring browser interaction run, all fields are optional"),(0,r.yg)("table",null,(0,r.yg)("thead",{parentName:"table"},(0,r.yg)("tr",{parentName:"thead"},(0,r.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Type"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.yg)("tbody",{parentName:"table"},(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"chromiumBinary?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"string")),(0,r.yg)("td",{parentName:"tr",align:"left"},"if not specified, memlab will use the Chromium binary installed by Puppeteer. Use this option to specify a different binary if Puppeteer does not install the Chromium binary correctly (e.g., in a environtment Docker) or when you may want to use a different version of Chromium binary.")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"consoleMode?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/enums/api_src.ConsoleMode"},(0,r.yg)("inlineCode",{parentName:"a"},"ConsoleMode"))),(0,r.yg)("td",{parentName:"tr",align:"left"},"specifying the terminal output mode, default is ",(0,r.yg)("inlineCode",{parentName:"td"},"default"),". For more details. please check out ",(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/enums/api_src.ConsoleMode"},"ConsoleMode"))),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"cookiesFile?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"string")),(0,r.yg)("td",{parentName:"tr",align:"left"},"the absolute path of cookies file")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"evalInBrowserAfterInitLoad?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"AnyFunction")),(0,r.yg)("td",{parentName:"tr",align:"left"},"function to be evaluated in browser context after the web page initial load. Note that this function is defined in node.js context but it will be evaluated in browser context so the function should not use any closure variables outside of the browser context.")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"scenario?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"IScenario")),(0,r.yg)("td",{parentName:"tr",align:"left"},"test scenario specifying how to interact with browser (for more details view ",(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/interfaces/core_src.IScenario"},"IScenario"),")")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"skipWarmup?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"boolean")),(0,r.yg)("td",{parentName:"tr",align:"left"},"skip the initial page loading warmup for the web application being tested")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"snapshotForEachStep?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"boolean")),(0,r.yg)("td",{parentName:"tr",align:"left"},"if true, take heap snapshot for each interaction step, by default this is false, which means memlab will decide which steps it will take heap snapshots")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"webWorker?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"Optional"),"<",(0,r.yg)("inlineCode",{parentName:"td"},"string"),">"),(0,r.yg)("td",{parentName:"tr",align:"left"},"if this field is provided, it specifies the web worker as the target for heap analysis. For example ",(0,r.yg)("inlineCode",{parentName:"td"},"{webWorker: null}")," means analyzing the heap of the first web worker found. ",(0,r.yg)("inlineCode",{parentName:"td"},"{webWorker: 'workerTitle'}")," means analyzing the heap of the web worker with name: ",(0,r.yg)("inlineCode",{parentName:"td"},"'workerTitle'"),".")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"workDir?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"string")),(0,r.yg)("td",{parentName:"tr",align:"left"},"specify the working directory where you want memlab to dump heap snapshots and other meta data of the test run. If no working directory is provided, memlab will generate a random temp directory under the operating system's default directory for temporary files. Note: It's the caller's responsibility to make sure the specified working directory exists.")))),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/API.ts#L47"},"api/src/API.ts:47"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-runresult-object"},(0,r.yg)("a",{id:"runresult",name:"runresult"})," ",(0,r.yg)("strong",{parentName:"h3"},"RunResult"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"Object")),(0,r.yg)("p",null,"A data structure holding the result of the ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#run"},"run")," API call."),(0,r.yg)("table",null,(0,r.yg)("thead",{parentName:"table"},(0,r.yg)("tr",{parentName:"thead"},(0,r.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Type"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.yg)("tbody",{parentName:"table"},(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"leaks")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"ISerializedInfo"),"[]"),(0,r.yg)("td",{parentName:"tr",align:"left"},"leak traces detected and clustered from the browser interaction")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"runResult")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"},(0,r.yg)("inlineCode",{parentName:"a"},"BrowserInteractionResultReader"))),(0,r.yg)("td",{parentName:"tr",align:"left"},"a utility for reading browser interaction results from disk")))),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/API.ts#L108"},"api/src/API.ts:108"))))),(0,r.yg)("h2",{id:"functions"},"Functions"),(0,r.yg)("h3",{id:"analyzerunresult-heapanalyzer-args"},(0,r.yg)("a",{id:"analyze"}),(0,r.yg)("strong",{parentName:"h3"},"analyze"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"runResult"),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"heapAnalyzer"),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"args?"),")"),(0,r.yg)("p",null,"This API analyzes heap snapshot(s) with a specified heap analysis.\nThis is equivalent to ",(0,r.yg)("inlineCode",{parentName:"p"},"memlab analyze")," in CLI."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Parameters"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"runResult"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"default")," | return value of a browser interaction run"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"heapAnalyzer"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"BaseAnalysis")," | instance of a heap analysis"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"args"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"ParsedArgs")," | other CLI arguments that needs to be passed to the heap analysis"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,r.yg)("inlineCode",{parentName:"li"},"void"),">"," | each analysis may have a different return type, please check out\nthe type definition or the documentation for the ",(0,r.yg)("inlineCode",{parentName:"li"},"process")," method of the\nanalysis class you are using for ",(0,r.yg)("inlineCode",{parentName:"li"},"heapAnalyzer"),"."),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {analyze, takeSnapshots, StringAnalysis} = require('@memlab/api');\n\n(async function () {\n const scenario = {\n url: () => 'https://www.facebook.com',\n };\n const result = await takeSnapshots({scenario});\n const analysis = new StringAnalysis();\n await analyze(result, analysis);\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/API.ts#L328"},"api/src/API.ts:328"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"findleaksrunresult-options"},(0,r.yg)("a",{id:"findleaks"}),(0,r.yg)("strong",{parentName:"h3"},"findLeaks"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"runResult"),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,r.yg)("p",null,"This API finds memory leaks by analyzing heap snapshot(s).\nThis is equivalent to ",(0,r.yg)("inlineCode",{parentName:"p"},"memlab find-leaks")," in CLI."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Parameters"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"runResult"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"default")," | return value of a browser interaction run"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"Object")," | configure memory leak detection run"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"options.consoleMode?"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/enums/api_src.ConsoleMode"},(0,r.yg)("inlineCode",{parentName:"a"},"ConsoleMode"))," | specify the terminal output mode (see ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/enums/api_src.ConsoleMode"},"ConsoleMode"),")"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,r.yg)("inlineCode",{parentName:"li"},"ISerializedInfo"),"[]",">"," | leak traces detected and clustered from the browser interaction"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {findLeaks, takeSnapshots} = require('@memlab/api');\n\n(async function () {\n const scenario = {\n url: () => 'https://www.facebook.com',\n };\n const result = await takeSnapshots({scenario, consoleMode: 'SILENT'});\n const leaks = findLeaks(result, {consoleMode: 'CONTINUOUS_TEST'});\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/API.ts#L256"},"api/src/API.ts:256"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"findleaksbysnapshotfilepathsbaselinesnapshot-targetsnapshot-finalsnapshot-options"},(0,r.yg)("a",{id:"findleaksbysnapshotfilepaths"}),(0,r.yg)("strong",{parentName:"h3"},"findLeaksBySnapshotFilePaths"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"baselineSnapshot"),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"targetSnapshot"),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"finalSnapshot"),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,r.yg)("p",null,"This API finds memory leaks by analyzing specified heap snapshots.\nThis is equivalent to ",(0,r.yg)("inlineCode",{parentName:"p"},"memlab find-leaks")," with\nthe ",(0,r.yg)("inlineCode",{parentName:"p"},"--baseline"),", ",(0,r.yg)("inlineCode",{parentName:"p"},"--target"),", and ",(0,r.yg)("inlineCode",{parentName:"p"},"--final")," flags in CLI."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"baselineSnapshot"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | the file path of the baseline heap snapshot"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"targetSnapshot"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | the file path of the target heap snapshot"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"finalSnapshot"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | the file path of the final heap snapshot"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"Object")," | optionally, you can specify a mode for heap analysis"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"options.consoleMode?"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/enums/api_src.ConsoleMode"},(0,r.yg)("inlineCode",{parentName:"a"},"ConsoleMode"))," | specify the terminal output mode (see ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/enums/api_src.ConsoleMode"},"ConsoleMode"),")"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"options.workDir?"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | specify a working directory (other than the default one)"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.yg)("inlineCode",{parentName:"p"},"ISerializedInfo"),"[]",">"," | leak traces detected and clustered from the browser interaction")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Source"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/API.ts#L284"},"api/src/API.ts:284"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"runoptions"},(0,r.yg)("a",{id:"run"}),(0,r.yg)("strong",{parentName:"h3"},"run"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,r.yg)("p",null,"This API runs browser interaction and find memory leaks triggered in browser\nThis is equivalent to running ",(0,r.yg)("inlineCode",{parentName:"p"},"memlab run")," in CLI.\nThis is also equivalent to warm up, and call ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#takesnapshots"},"takeSnapshots"),"\nand ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#findleaks"},"findLeaks"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Parameters"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/api_src#runoptions"},(0,r.yg)("inlineCode",{parentName:"a"},"RunOptions"))))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/api_src#runresult"},(0,r.yg)("inlineCode",{parentName:"a"},"RunResult")),">"," | memory leaks detected and a utility reading browser\ninteraction results from disk"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {run} = require('@memlab/api');\n\n(async function () {\n const scenario = {\n url: () => 'https://www.facebook.com',\n };\n const {leaks} = await run({scenario});\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/API.ts#L188"},"api/src/API.ts:188"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"takesnapshotsoptions"},(0,r.yg)("a",{id:"takesnapshots"}),(0,r.yg)("strong",{parentName:"h3"},"takeSnapshots"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,r.yg)("p",null,"This API runs E2E interaction and takes heap snapshots.\nThis is equivalent to running ",(0,r.yg)("inlineCode",{parentName:"p"},"memlab snapshot")," in CLI."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Parameters"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/api_src#runoptions"},(0,r.yg)("inlineCode",{parentName:"a"},"RunOptions"))," | configure browser interaction run"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"},(0,r.yg)("inlineCode",{parentName:"a"},"BrowserInteractionResultReader")),">"," | a utility reading browser interaction results from disk"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {takeSnapshots} = require('@memlab/api');\n\n(async function () {\n const scenario = {\n url: () => 'https://www.facebook.com',\n };\n const result = await takeSnapshots({scenario});\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/API.ts#L221"},"api/src/API.ts:221"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"warmupandtakesnapshotsoptions"},(0,r.yg)("a",{id:"warmupandtakesnapshots"}),(0,r.yg)("strong",{parentName:"h3"},"warmupAndTakeSnapshots"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,r.yg)("p",null,"This API warms up web server, runs E2E interaction, and takes heap snapshots.\nThis is equivalent to running ",(0,r.yg)("inlineCode",{parentName:"p"},"memlab warmup-and-snapshot")," in CLI.\nThis is also equivalent to warm up and call ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#takesnapshots"},"takeSnapshots"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Parameters"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/api_src#runoptions"},(0,r.yg)("inlineCode",{parentName:"a"},"RunOptions"))," | configure browser interaction run"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"},(0,r.yg)("inlineCode",{parentName:"a"},"BrowserInteractionResultReader")),">"," | browser interaction results"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {warmupAndTakeSnapshots} = require('@memlab/api');\n\n(async function () {\n const scenario = {\n url: () => 'https://www.facebook.com',\n };\n const result = await warmupAndTakeSnapshots({scenario});\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/API.ts#L151"},"api/src/API.ts:151"))))))}d.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[6640],{5680:(e,a,n)=>{n.d(a,{xA:()=>m,yg:()=>u});var t=n(6540);function r(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function i(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function l(e){for(var a=1;a=0||(r[n]=e[n]);return r}(e,a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=t.createContext({}),p=function(e){var a=t.useContext(s),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},m=function(e){var a=p(e.components);return t.createElement(s.Provider,{value:a},e.children)},g="mdxType",y={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},d=t.forwardRef((function(e,a){var n=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),g=p(n),d=r,u=g["".concat(s,".").concat(d)]||g[d]||y[d]||i;return n?t.createElement(u,l(l({ref:a},m),{},{components:n})):t.createElement(u,l({ref:a},m))}));function u(e,a){var n=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=d;var o={};for(var s in a)hasOwnProperty.call(a,s)&&(o[s]=a[s]);o.originalType=e,o[g]="string"==typeof e?e:r,l[1]=o;for(var p=2;p{n.r(a),n.d(a,{assets:()=>s,contentTitle:()=>l,default:()=>y,frontMatter:()=>i,metadata:()=>o,toc:()=>p});var t=n(8168),r=(n(6540),n(5680));const i={id:"api_src",title:"Package: @memlab/api",sidebar_label:"api/src",sidebar_position:0,custom_edit_url:null},l=void 0,o={unversionedId:"api/modules/api_src",id:"api/modules/api_src",title:"Package: @memlab/api",description:"Enumerations",source:"@site/docs/api/modules/api_src.md",sourceDirName:"api/modules",slug:"/api/modules/api_src",permalink:"/memlab/docs/api/modules/api_src",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"api_src",title:"Package: @memlab/api",sidebar_label:"api/src",sidebar_position:0,custom_edit_url:null},sidebar:"sidebar",previous:{title:"Table of contents",permalink:"/memlab/docs/api/"},next:{title:"core/src",permalink:"/memlab/docs/api/modules/core_src"}},s={},p=[{value:"Enumerations",id:"enumerations",level:2},{value:"Classes",id:"classes",level:2},{value:"Type Aliases",id:"type-aliases",level:2},{value:' RunOptions: Object',id:"-runoptions-object",level:3},{value:' RunResult: Object',id:"-runresult-object",level:3},{value:"Functions",id:"functions",level:2},{value:'analyze(runResult, heapAnalyzer, args?)',id:"analyzerunresult-heapanalyzer-args",level:3},{value:'findLeaks(runResult, options?)',id:"findleaksrunresult-options",level:3},{value:'findLeaksBySnapshotFilePaths(baselineSnapshot, targetSnapshot, finalSnapshot, options?)',id:"findleaksbysnapshotfilepathsbaselinesnapshot-targetsnapshot-finalsnapshot-options",level:3},{value:'run(options?)',id:"runoptions",level:3},{value:'takeSnapshots(options?)',id:"takesnapshotsoptions",level:3},{value:'warmupAndTakeSnapshots(options?)',id:"warmupandtakesnapshotsoptions",level:3}],m={toc:p},g="wrapper";function y(e){let{components:a,...n}=e;return(0,r.yg)(g,(0,t.A)({},m,n,{components:a,mdxType:"MDXLayout"}),(0,r.yg)("h2",{id:"enumerations"},"Enumerations"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/enums/api_src.ConsoleMode"},"ConsoleMode"))),(0,r.yg)("h2",{id:"classes"},"Classes"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"},"BrowserInteractionResultReader")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/api_src.SnapshotResultReader"},"SnapshotResultReader"))),(0,r.yg)("h2",{id:"type-aliases"},"Type Aliases"),(0,r.yg)("h3",{id:"-runoptions-object"},(0,r.yg)("a",{id:"runoptions",name:"runoptions"})," ",(0,r.yg)("strong",{parentName:"h3"},"RunOptions"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"Object")),(0,r.yg)("p",null,"Options for configuring browser interaction run, all fields are optional"),(0,r.yg)("table",null,(0,r.yg)("thead",{parentName:"table"},(0,r.yg)("tr",{parentName:"thead"},(0,r.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Type"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.yg)("tbody",{parentName:"table"},(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"chromiumBinary?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"string")),(0,r.yg)("td",{parentName:"tr",align:"left"},"if not specified, memlab will use the Chromium binary installed by Puppeteer. Use this option to specify a different binary if Puppeteer does not install the Chromium binary correctly (e.g., in a environtment Docker) or when you may want to use a different version of Chromium binary.")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"consoleMode?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/enums/api_src.ConsoleMode"},(0,r.yg)("inlineCode",{parentName:"a"},"ConsoleMode"))),(0,r.yg)("td",{parentName:"tr",align:"left"},"specifying the terminal output mode, default is ",(0,r.yg)("inlineCode",{parentName:"td"},"default"),". For more details. please check out ",(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/enums/api_src.ConsoleMode"},"ConsoleMode"))),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"cookiesFile?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"string")),(0,r.yg)("td",{parentName:"tr",align:"left"},"the absolute path of cookies file")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"evalInBrowserAfterInitLoad?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"AnyFunction")),(0,r.yg)("td",{parentName:"tr",align:"left"},"function to be evaluated in browser context after the web page initial load. Note that this function is defined in node.js context but it will be evaluated in browser context so the function should not use any closure variables outside of the browser context.")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"scenario?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"IScenario")),(0,r.yg)("td",{parentName:"tr",align:"left"},"test scenario specifying how to interact with browser (for more details view ",(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/interfaces/core_src.IScenario"},"IScenario"),")")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"skipWarmup?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"boolean")),(0,r.yg)("td",{parentName:"tr",align:"left"},"skip the initial page loading warmup for the web application being tested")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"snapshotForEachStep?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"boolean")),(0,r.yg)("td",{parentName:"tr",align:"left"},"if true, take heap snapshot for each interaction step, by default this is false, which means memlab will decide which steps it will take heap snapshots")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"webWorker?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"Optional"),"<",(0,r.yg)("inlineCode",{parentName:"td"},"string"),">"),(0,r.yg)("td",{parentName:"tr",align:"left"},"if this field is provided, it specifies the web worker as the target for heap analysis. For example ",(0,r.yg)("inlineCode",{parentName:"td"},"{webWorker: null}")," means analyzing the heap of the first web worker found. ",(0,r.yg)("inlineCode",{parentName:"td"},"{webWorker: 'workerTitle'}")," means analyzing the heap of the web worker with name: ",(0,r.yg)("inlineCode",{parentName:"td"},"'workerTitle'"),".")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"workDir?")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"string")),(0,r.yg)("td",{parentName:"tr",align:"left"},"specify the working directory where you want memlab to dump heap snapshots and other meta data of the test run. If no working directory is provided, memlab will generate a random temp directory under the operating system's default directory for temporary files. Note: It's the caller's responsibility to make sure the specified working directory exists.")))),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/API.ts#L47"},"api/src/API.ts:47"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-runresult-object"},(0,r.yg)("a",{id:"runresult",name:"runresult"})," ",(0,r.yg)("strong",{parentName:"h3"},"RunResult"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"Object")),(0,r.yg)("p",null,"A data structure holding the result of the ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#run"},"run")," API call."),(0,r.yg)("table",null,(0,r.yg)("thead",{parentName:"table"},(0,r.yg)("tr",{parentName:"thead"},(0,r.yg)("th",{parentName:"tr",align:"left"},"Name"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Type"),(0,r.yg)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.yg)("tbody",{parentName:"table"},(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"leaks")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"ISerializedInfo"),"[]"),(0,r.yg)("td",{parentName:"tr",align:"left"},"leak traces detected and clustered from the browser interaction")),(0,r.yg)("tr",{parentName:"tbody"},(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("inlineCode",{parentName:"td"},"runResult")),(0,r.yg)("td",{parentName:"tr",align:"left"},(0,r.yg)("a",{parentName:"td",href:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"},(0,r.yg)("inlineCode",{parentName:"a"},"BrowserInteractionResultReader"))),(0,r.yg)("td",{parentName:"tr",align:"left"},"a utility for reading browser interaction results from disk")))),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/API.ts#L108"},"api/src/API.ts:108"))))),(0,r.yg)("h2",{id:"functions"},"Functions"),(0,r.yg)("h3",{id:"analyzerunresult-heapanalyzer-args"},(0,r.yg)("a",{id:"analyze"}),(0,r.yg)("strong",{parentName:"h3"},"analyze"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"runResult"),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"heapAnalyzer"),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"args?"),")"),(0,r.yg)("p",null,"This API analyzes heap snapshot(s) with a specified heap analysis.\nThis is equivalent to ",(0,r.yg)("inlineCode",{parentName:"p"},"memlab analyze")," in CLI."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Parameters"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"runResult"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"default")," | return value of a browser interaction run"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"heapAnalyzer"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"BaseAnalysis")," | instance of a heap analysis"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"args"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"ParsedArgs")," | other CLI arguments that needs to be passed to the heap analysis"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,r.yg)("inlineCode",{parentName:"li"},"void"),">"," | each analysis may have a different return type, please check out\nthe type definition or the documentation for the ",(0,r.yg)("inlineCode",{parentName:"li"},"process")," method of the\nanalysis class you are using for ",(0,r.yg)("inlineCode",{parentName:"li"},"heapAnalyzer"),"."),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {analyze, takeSnapshots, StringAnalysis} = require('@memlab/api');\n\n(async function () {\n const scenario = {\n url: () => 'https://www.facebook.com',\n };\n const result = await takeSnapshots({scenario});\n const analysis = new StringAnalysis();\n await analyze(result, analysis);\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/API.ts#L328"},"api/src/API.ts:328"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"findleaksrunresult-options"},(0,r.yg)("a",{id:"findleaks"}),(0,r.yg)("strong",{parentName:"h3"},"findLeaks"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"runResult"),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,r.yg)("p",null,"This API finds memory leaks by analyzing heap snapshot(s).\nThis is equivalent to ",(0,r.yg)("inlineCode",{parentName:"p"},"memlab find-leaks")," in CLI."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Parameters"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"runResult"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"default")," | return value of a browser interaction run"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"Object")," | configure memory leak detection run"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"options.consoleMode?"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/enums/api_src.ConsoleMode"},(0,r.yg)("inlineCode",{parentName:"a"},"ConsoleMode"))," | specify the terminal output mode (see ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/enums/api_src.ConsoleMode"},"ConsoleMode"),")"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,r.yg)("inlineCode",{parentName:"li"},"ISerializedInfo"),"[]",">"," | leak traces detected and clustered from the browser interaction"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {findLeaks, takeSnapshots} = require('@memlab/api');\n\n(async function () {\n const scenario = {\n url: () => 'https://www.facebook.com',\n };\n const result = await takeSnapshots({scenario, consoleMode: 'SILENT'});\n const leaks = findLeaks(result, {consoleMode: 'CONTINUOUS_TEST'});\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/API.ts#L256"},"api/src/API.ts:256"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"findleaksbysnapshotfilepathsbaselinesnapshot-targetsnapshot-finalsnapshot-options"},(0,r.yg)("a",{id:"findleaksbysnapshotfilepaths"}),(0,r.yg)("strong",{parentName:"h3"},"findLeaksBySnapshotFilePaths"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"baselineSnapshot"),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"targetSnapshot"),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"finalSnapshot"),", ",(0,r.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,r.yg)("p",null,"This API finds memory leaks by analyzing specified heap snapshots.\nThis is equivalent to ",(0,r.yg)("inlineCode",{parentName:"p"},"memlab find-leaks")," with\nthe ",(0,r.yg)("inlineCode",{parentName:"p"},"--baseline"),", ",(0,r.yg)("inlineCode",{parentName:"p"},"--target"),", and ",(0,r.yg)("inlineCode",{parentName:"p"},"--final")," flags in CLI."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"baselineSnapshot"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | the file path of the baseline heap snapshot"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"targetSnapshot"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | the file path of the target heap snapshot"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"finalSnapshot"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | the file path of the final heap snapshot"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"Object")," | optionally, you can specify a mode for heap analysis"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"options.consoleMode?"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/enums/api_src.ConsoleMode"},(0,r.yg)("inlineCode",{parentName:"a"},"ConsoleMode"))," | specify the terminal output mode (see ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/enums/api_src.ConsoleMode"},"ConsoleMode"),")"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"options.workDir?"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | specify a working directory (other than the default one)"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.yg)("inlineCode",{parentName:"p"},"ISerializedInfo"),"[]",">"," | leak traces detected and clustered from the browser interaction")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Source"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/API.ts#L284"},"api/src/API.ts:284"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"runoptions"},(0,r.yg)("a",{id:"run"}),(0,r.yg)("strong",{parentName:"h3"},"run"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,r.yg)("p",null,"This API runs browser interaction and find memory leaks triggered in browser\nThis is equivalent to running ",(0,r.yg)("inlineCode",{parentName:"p"},"memlab run")," in CLI.\nThis is also equivalent to warm up, and call ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#takesnapshots"},"takeSnapshots"),"\nand ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#findleaks"},"findLeaks"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Parameters"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/api_src#runoptions"},(0,r.yg)("inlineCode",{parentName:"a"},"RunOptions"))))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/api_src#runresult"},(0,r.yg)("inlineCode",{parentName:"a"},"RunResult")),">"," | memory leaks detected and a utility reading browser\ninteraction results from disk"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {run} = require('@memlab/api');\n\n(async function () {\n const scenario = {\n url: () => 'https://www.facebook.com',\n };\n const {leaks} = await run({scenario});\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/API.ts#L188"},"api/src/API.ts:188"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"takesnapshotsoptions"},(0,r.yg)("a",{id:"takesnapshots"}),(0,r.yg)("strong",{parentName:"h3"},"takeSnapshots"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,r.yg)("p",null,"This API runs E2E interaction and takes heap snapshots.\nThis is equivalent to running ",(0,r.yg)("inlineCode",{parentName:"p"},"memlab snapshot")," in CLI."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Parameters"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/api_src#runoptions"},(0,r.yg)("inlineCode",{parentName:"a"},"RunOptions"))," | configure browser interaction run"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"},(0,r.yg)("inlineCode",{parentName:"a"},"BrowserInteractionResultReader")),">"," | a utility reading browser interaction results from disk"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {takeSnapshots} = require('@memlab/api');\n\n(async function () {\n const scenario = {\n url: () => 'https://www.facebook.com',\n };\n const result = await takeSnapshots({scenario});\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/API.ts#L221"},"api/src/API.ts:221"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"warmupandtakesnapshotsoptions"},(0,r.yg)("a",{id:"warmupandtakesnapshots"}),(0,r.yg)("strong",{parentName:"h3"},"warmupAndTakeSnapshots"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,r.yg)("p",null,"This API warms up web server, runs E2E interaction, and takes heap snapshots.\nThis is equivalent to running ",(0,r.yg)("inlineCode",{parentName:"p"},"memlab warmup-and-snapshot")," in CLI.\nThis is also equivalent to warm up and call ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#takesnapshots"},"takeSnapshots"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Parameters"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/api_src#runoptions"},(0,r.yg)("inlineCode",{parentName:"a"},"RunOptions"))," | configure browser interaction run"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"},(0,r.yg)("inlineCode",{parentName:"a"},"BrowserInteractionResultReader")),">"," | browser interaction results"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"const {warmupAndTakeSnapshots} = require('@memlab/api');\n\n(async function () {\n const scenario = {\n url: () => 'https://www.facebook.com',\n };\n const result = await warmupAndTakeSnapshots({scenario});\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/API.ts#L151"},"api/src/API.ts:151"))))))}y.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/95206942.0c281ce3.js b/assets/js/95206942.0d3d356c.js similarity index 98% rename from assets/js/95206942.0c281ce3.js rename to assets/js/95206942.0d3d356c.js index b5f8450b..9373c529 100644 --- a/assets/js/95206942.0c281ce3.js +++ b/assets/js/95206942.0d3d356c.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[2522],{5680:(e,a,n)=>{n.d(a,{xA:()=>y,yg:()=>u});var l=n(6540);function s(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function t(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);a&&(l=l.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,l)}return n}function i(e){for(var a=1;a=0||(s[n]=e[n]);return s}(e,a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);for(l=0;l=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var o=l.createContext({}),p=function(e){var a=l.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},y=function(e){var a=p(e.components);return l.createElement(o.Provider,{value:a},e.children)},c="mdxType",g={inlineCode:"code",wrapper:function(e){var a=e.children;return l.createElement(l.Fragment,{},a)}},m=l.forwardRef((function(e,a){var n=e.components,s=e.mdxType,t=e.originalType,o=e.parentName,y=r(e,["components","mdxType","originalType","parentName"]),c=p(n),m=s,u=c["".concat(o,".").concat(m)]||c[m]||g[m]||t;return n?l.createElement(u,i(i({ref:a},y),{},{components:n})):l.createElement(u,i({ref:a},y))}));function u(e,a){var n=arguments,s=a&&a.mdxType;if("string"==typeof e||s){var t=n.length,i=new Array(t);i[0]=m;var r={};for(var o in a)hasOwnProperty.call(a,o)&&(r[o]=a[o]);r.originalType=e,r[c]="string"==typeof e?e:s,i[1]=r;for(var p=2;p{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>i,default:()=>g,frontMatter:()=>t,metadata:()=>r,toc:()=>p});var l=n(8168),s=(n(6540),n(5680));const t={id:"heap_analysis_src.CollectionsHoldingStaleAnalysis",title:"Class: CollectionsHoldingStaleAnalysis",sidebar_label:"CollectionsHoldingStaleAnalysis",custom_edit_url:null},i=void 0,r={unversionedId:"api/classes/heap_analysis_src.CollectionsHoldingStaleAnalysis",id:"api/classes/heap_analysis_src.CollectionsHoldingStaleAnalysis",title:"Class: CollectionsHoldingStaleAnalysis",description:"Hierarchy",source:"@site/docs/api/classes/heap_analysis_src.CollectionsHoldingStaleAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.CollectionsHoldingStaleAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.CollectionsHoldingStaleAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.CollectionsHoldingStaleAnalysis",title:"Class: CollectionsHoldingStaleAnalysis",sidebar_label:"CollectionsHoldingStaleAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"BaseAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},next:{title:"DetachedDOMElementAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.DetachedDOMElementAnalysis"}},o={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new CollectionsHoldingStaleAnalysis()',id:"new-collectionsholdingstaleanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotFromFile(file, options?)',id:"analyzesnapshotfromfilefile-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3}],y={toc:p},c="wrapper";function g(e){let{components:a,...n}=e;return(0,s.yg)(c,(0,l.A)({},y,n,{components:a,mdxType:"MDXLayout"}),(0,s.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},(0,s.yg)("inlineCode",{parentName:"a"},"BaseAnalysis"))),(0,s.yg)("p",{parentName:"li"},"\u21b3 ",(0,s.yg)("strong",{parentName:"p"},(0,s.yg)("inlineCode",{parentName:"strong"},"CollectionsHoldingStaleAnalysis"))))),(0,s.yg)("h2",{id:"constructors"},"Constructors"),(0,s.yg)("h3",{id:"new-collectionsholdingstaleanalysis"},(0,s.yg)("a",{id:"new collectionsholdingstaleanalysis"}),(0,s.yg)("strong",{parentName:"h3"},"new CollectionsHoldingStaleAnalysis"),"()"),(0,s.yg)("h2",{id:"methods"},"Methods"),(0,s.yg)("h3",{id:"analyzesnapshotfromfilefile-options"},(0,s.yg)("a",{id:"analyzesnapshotfromfile"}),(0,s.yg)("strong",{parentName:"h3"},"analyzeSnapshotFromFile"),"(",(0,s.yg)("inlineCode",{parentName:"h3"},"file"),", ",(0,s.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,s.yg)("p",null,"Run heap analysis for a single heap snapshot file"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Parameters"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of a ",(0,s.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," file."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,s.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,s.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Example"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile);\n// query analysis-specific and structured results\nconst stringPatterns = analysis.getTopDuplicatedStringsInCount();\n")),(0,s.yg)("p",null,"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:"),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/BaseAnalysis.ts#L95"},"heap-analysis/src/BaseAnalysis.ts:95"))))),(0,s.yg)("hr",null),(0,s.yg)("h3",{id:"getcommandname"},(0,s.yg)("a",{id:"getcommandname"}),(0,s.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,s.yg)("p",null,"Get the name of the heap analysis, which is also used to reference\nthe analysis in memlab command-line tool."),(0,s.yg)("p",null,"The following terminal command will initiate with this analysis:\n",(0,s.yg)("inlineCode",{parentName:"p"},"memlab analyze ")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the name of the analysis"),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Examples"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new YourAnalysis();\nconst name = analysis.getCommandName();\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/plugins/CollectionsHoldingStaleAnalysis.ts#L67"},"heap-analysis/src/plugins/CollectionsHoldingStaleAnalysis.ts:67"))))))}g.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[2522],{5680:(e,a,n)=>{n.d(a,{xA:()=>y,yg:()=>u});var l=n(6540);function s(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function t(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);a&&(l=l.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,l)}return n}function i(e){for(var a=1;a=0||(s[n]=e[n]);return s}(e,a);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);for(l=0;l=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var o=l.createContext({}),p=function(e){var a=l.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},y=function(e){var a=p(e.components);return l.createElement(o.Provider,{value:a},e.children)},c="mdxType",g={inlineCode:"code",wrapper:function(e){var a=e.children;return l.createElement(l.Fragment,{},a)}},m=l.forwardRef((function(e,a){var n=e.components,s=e.mdxType,t=e.originalType,o=e.parentName,y=r(e,["components","mdxType","originalType","parentName"]),c=p(n),m=s,u=c["".concat(o,".").concat(m)]||c[m]||g[m]||t;return n?l.createElement(u,i(i({ref:a},y),{},{components:n})):l.createElement(u,i({ref:a},y))}));function u(e,a){var n=arguments,s=a&&a.mdxType;if("string"==typeof e||s){var t=n.length,i=new Array(t);i[0]=m;var r={};for(var o in a)hasOwnProperty.call(a,o)&&(r[o]=a[o]);r.originalType=e,r[c]="string"==typeof e?e:s,i[1]=r;for(var p=2;p{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>i,default:()=>g,frontMatter:()=>t,metadata:()=>r,toc:()=>p});var l=n(8168),s=(n(6540),n(5680));const t={id:"heap_analysis_src.CollectionsHoldingStaleAnalysis",title:"Class: CollectionsHoldingStaleAnalysis",sidebar_label:"CollectionsHoldingStaleAnalysis",custom_edit_url:null},i=void 0,r={unversionedId:"api/classes/heap_analysis_src.CollectionsHoldingStaleAnalysis",id:"api/classes/heap_analysis_src.CollectionsHoldingStaleAnalysis",title:"Class: CollectionsHoldingStaleAnalysis",description:"Hierarchy",source:"@site/docs/api/classes/heap_analysis_src.CollectionsHoldingStaleAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.CollectionsHoldingStaleAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.CollectionsHoldingStaleAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.CollectionsHoldingStaleAnalysis",title:"Class: CollectionsHoldingStaleAnalysis",sidebar_label:"CollectionsHoldingStaleAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"BaseAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},next:{title:"DetachedDOMElementAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.DetachedDOMElementAnalysis"}},o={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new CollectionsHoldingStaleAnalysis()',id:"new-collectionsholdingstaleanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotFromFile(file, options?)',id:"analyzesnapshotfromfilefile-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3}],y={toc:p},c="wrapper";function g(e){let{components:a,...n}=e;return(0,s.yg)(c,(0,l.A)({},y,n,{components:a,mdxType:"MDXLayout"}),(0,s.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},(0,s.yg)("inlineCode",{parentName:"a"},"BaseAnalysis"))),(0,s.yg)("p",{parentName:"li"},"\u21b3 ",(0,s.yg)("strong",{parentName:"p"},(0,s.yg)("inlineCode",{parentName:"strong"},"CollectionsHoldingStaleAnalysis"))))),(0,s.yg)("h2",{id:"constructors"},"Constructors"),(0,s.yg)("h3",{id:"new-collectionsholdingstaleanalysis"},(0,s.yg)("a",{id:"new collectionsholdingstaleanalysis"}),(0,s.yg)("strong",{parentName:"h3"},"new CollectionsHoldingStaleAnalysis"),"()"),(0,s.yg)("h2",{id:"methods"},"Methods"),(0,s.yg)("h3",{id:"analyzesnapshotfromfilefile-options"},(0,s.yg)("a",{id:"analyzesnapshotfromfile"}),(0,s.yg)("strong",{parentName:"h3"},"analyzeSnapshotFromFile"),"(",(0,s.yg)("inlineCode",{parentName:"h3"},"file"),", ",(0,s.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,s.yg)("p",null,"Run heap analysis for a single heap snapshot file"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Parameters"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of a ",(0,s.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," file."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,s.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,s.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Example"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile);\n// query analysis-specific and structured results\nconst stringPatterns = analysis.getTopDuplicatedStringsInCount();\n")),(0,s.yg)("p",null,"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:"),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/BaseAnalysis.ts#L95"},"heap-analysis/src/BaseAnalysis.ts:95"))))),(0,s.yg)("hr",null),(0,s.yg)("h3",{id:"getcommandname"},(0,s.yg)("a",{id:"getcommandname"}),(0,s.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,s.yg)("p",null,"Get the name of the heap analysis, which is also used to reference\nthe analysis in memlab command-line tool."),(0,s.yg)("p",null,"The following terminal command will initiate with this analysis:\n",(0,s.yg)("inlineCode",{parentName:"p"},"memlab analyze ")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the name of the analysis"),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Examples"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new YourAnalysis();\nconst name = analysis.getCommandName();\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/plugins/CollectionsHoldingStaleAnalysis.ts#L67"},"heap-analysis/src/plugins/CollectionsHoldingStaleAnalysis.ts:67"))))))}g.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/95f47cf5.53ed909a.js b/assets/js/95f47cf5.f530608e.js similarity index 98% rename from assets/js/95f47cf5.53ed909a.js rename to assets/js/95f47cf5.f530608e.js index e4cfd1b8..8863b927 100644 --- a/assets/js/95f47cf5.53ed909a.js +++ b/assets/js/95f47cf5.f530608e.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[7130],{5680:(e,a,n)=>{n.d(a,{xA:()=>y,yg:()=>g});var s=n(6540);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);a&&(s=s.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,s)}return n}function i(e){for(var a=1;a=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(s=0;s=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var o=s.createContext({}),p=function(e){var a=s.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},y=function(e){var a=p(e.components);return s.createElement(o.Provider,{value:a},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var a=e.children;return s.createElement(s.Fragment,{},a)}},u=s.forwardRef((function(e,a){var n=e.components,t=e.mdxType,l=e.originalType,o=e.parentName,y=r(e,["components","mdxType","originalType","parentName"]),c=p(n),u=t,g=c["".concat(o,".").concat(u)]||c[u]||m[u]||l;return n?s.createElement(g,i(i({ref:a},y),{},{components:n})):s.createElement(g,i({ref:a},y))}));function g(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var l=n.length,i=new Array(l);i[0]=u;var r={};for(var o in a)hasOwnProperty.call(a,o)&&(r[o]=a[o]);r.originalType=e,r[c]="string"==typeof e?e:t,i[1]=r;for(var p=2;p{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>p});var s=n(8168),t=(n(6540),n(5680));const l={id:"heap_analysis_src.ObjectShapeAnalysis",title:"Class: ObjectShapeAnalysis",sidebar_label:"ObjectShapeAnalysis",custom_edit_url:null},i=void 0,r={unversionedId:"api/classes/heap_analysis_src.ObjectShapeAnalysis",id:"api/classes/heap_analysis_src.ObjectShapeAnalysis",title:"Class: ObjectShapeAnalysis",description:"Hierarchy",source:"@site/docs/api/classes/heap_analysis_src.ObjectShapeAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.ObjectShapeAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectShapeAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.ObjectShapeAnalysis",title:"Class: ObjectShapeAnalysis",sidebar_label:"ObjectShapeAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"ObjectShallowAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectShallowAnalysis"},next:{title:"ObjectSizeAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectSizeAnalysis"}},o={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new ObjectShapeAnalysis()',id:"new-objectshapeanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotFromFile(file, options?)',id:"analyzesnapshotfromfilefile-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3}],y={toc:p},c="wrapper";function m(e){let{components:a,...n}=e;return(0,t.yg)(c,(0,s.A)({},y,n,{components:a,mdxType:"MDXLayout"}),(0,t.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"BaseAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3 ",(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"ObjectShapeAnalysis"))))),(0,t.yg)("h2",{id:"constructors"},"Constructors"),(0,t.yg)("h3",{id:"new-objectshapeanalysis"},(0,t.yg)("a",{id:"new objectshapeanalysis"}),(0,t.yg)("strong",{parentName:"h3"},"new ObjectShapeAnalysis"),"()"),(0,t.yg)("h2",{id:"methods"},"Methods"),(0,t.yg)("h3",{id:"analyzesnapshotfromfilefile-options"},(0,t.yg)("a",{id:"analyzesnapshotfromfile"}),(0,t.yg)("strong",{parentName:"h3"},"analyzeSnapshotFromFile"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"file"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,t.yg)("p",null,"Run heap analysis for a single heap snapshot file"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of a ",(0,t.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," file."),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,t.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,t.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Example"),":")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile);\n// query analysis-specific and structured results\nconst stringPatterns = analysis.getTopDuplicatedStringsInCount();\n")),(0,t.yg)("p",null,"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/BaseAnalysis.ts#L95"},"heap-analysis/src/BaseAnalysis.ts:95"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getcommandname"},(0,t.yg)("a",{id:"getcommandname"}),(0,t.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,t.yg)("p",null,"Get the name of the heap analysis, which is also used to reference\nthe analysis in memlab command-line tool."),(0,t.yg)("p",null,"The following terminal command will initiate with this analysis:\n",(0,t.yg)("inlineCode",{parentName:"p"},"memlab analyze ")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | the name of the analysis"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples"),":")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new YourAnalysis();\nconst name = analysis.getCommandName();\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/plugins/ObjectShapeAnalysis.ts#L28"},"heap-analysis/src/plugins/ObjectShapeAnalysis.ts:28"))))))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[7130],{5680:(e,a,n)=>{n.d(a,{xA:()=>y,yg:()=>g});var s=n(6540);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);a&&(s=s.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,s)}return n}function i(e){for(var a=1;a=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(s=0;s=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var o=s.createContext({}),p=function(e){var a=s.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},y=function(e){var a=p(e.components);return s.createElement(o.Provider,{value:a},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var a=e.children;return s.createElement(s.Fragment,{},a)}},u=s.forwardRef((function(e,a){var n=e.components,t=e.mdxType,l=e.originalType,o=e.parentName,y=r(e,["components","mdxType","originalType","parentName"]),c=p(n),u=t,g=c["".concat(o,".").concat(u)]||c[u]||m[u]||l;return n?s.createElement(g,i(i({ref:a},y),{},{components:n})):s.createElement(g,i({ref:a},y))}));function g(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var l=n.length,i=new Array(l);i[0]=u;var r={};for(var o in a)hasOwnProperty.call(a,o)&&(r[o]=a[o]);r.originalType=e,r[c]="string"==typeof e?e:t,i[1]=r;for(var p=2;p{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>r,toc:()=>p});var s=n(8168),t=(n(6540),n(5680));const l={id:"heap_analysis_src.ObjectShapeAnalysis",title:"Class: ObjectShapeAnalysis",sidebar_label:"ObjectShapeAnalysis",custom_edit_url:null},i=void 0,r={unversionedId:"api/classes/heap_analysis_src.ObjectShapeAnalysis",id:"api/classes/heap_analysis_src.ObjectShapeAnalysis",title:"Class: ObjectShapeAnalysis",description:"Hierarchy",source:"@site/docs/api/classes/heap_analysis_src.ObjectShapeAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.ObjectShapeAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectShapeAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.ObjectShapeAnalysis",title:"Class: ObjectShapeAnalysis",sidebar_label:"ObjectShapeAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"ObjectShallowAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectShallowAnalysis"},next:{title:"ObjectSizeAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectSizeAnalysis"}},o={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new ObjectShapeAnalysis()',id:"new-objectshapeanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotFromFile(file, options?)',id:"analyzesnapshotfromfilefile-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3}],y={toc:p},c="wrapper";function m(e){let{components:a,...n}=e;return(0,t.yg)(c,(0,s.A)({},y,n,{components:a,mdxType:"MDXLayout"}),(0,t.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},(0,t.yg)("inlineCode",{parentName:"a"},"BaseAnalysis"))),(0,t.yg)("p",{parentName:"li"},"\u21b3 ",(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"ObjectShapeAnalysis"))))),(0,t.yg)("h2",{id:"constructors"},"Constructors"),(0,t.yg)("h3",{id:"new-objectshapeanalysis"},(0,t.yg)("a",{id:"new objectshapeanalysis"}),(0,t.yg)("strong",{parentName:"h3"},"new ObjectShapeAnalysis"),"()"),(0,t.yg)("h2",{id:"methods"},"Methods"),(0,t.yg)("h3",{id:"analyzesnapshotfromfilefile-options"},(0,t.yg)("a",{id:"analyzesnapshotfromfile"}),(0,t.yg)("strong",{parentName:"h3"},"analyzeSnapshotFromFile"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"file"),", ",(0,t.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,t.yg)("p",null,"Run heap analysis for a single heap snapshot file"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of a ",(0,t.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," file."),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,t.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,t.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Example"),":")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile);\n// query analysis-specific and structured results\nconst stringPatterns = analysis.getTopDuplicatedStringsInCount();\n")),(0,t.yg)("p",null,"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:"),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/BaseAnalysis.ts#L95"},"heap-analysis/src/BaseAnalysis.ts:95"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getcommandname"},(0,t.yg)("a",{id:"getcommandname"}),(0,t.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,t.yg)("p",null,"Get the name of the heap analysis, which is also used to reference\nthe analysis in memlab command-line tool."),(0,t.yg)("p",null,"The following terminal command will initiate with this analysis:\n",(0,t.yg)("inlineCode",{parentName:"p"},"memlab analyze ")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")," | the name of the analysis"),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples"),":")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new YourAnalysis();\nconst name = analysis.getCommandName();\n")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/plugins/ObjectShapeAnalysis.ts#L28"},"heap-analysis/src/plugins/ObjectShapeAnalysis.ts:28"))))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/98c9c166.ebb42bed.js b/assets/js/98c9c166.ec2e7ca3.js similarity index 91% rename from assets/js/98c9c166.ebb42bed.js rename to assets/js/98c9c166.ec2e7ca3.js index 1f1470f4..5696d5bb 100644 --- a/assets/js/98c9c166.ebb42bed.js +++ b/assets/js/98c9c166.ec2e7ca3.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[984],{5680:(e,n,a)=>{a.d(n,{xA:()=>g,yg:()=>y});var r=a(6540);function t(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function o(e,n){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),a.push.apply(a,r)}return a}function i(e){for(var n=1;n=0||(t[a]=e[a]);return t}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(t[a]=e[a])}return t}var p=r.createContext({}),s=function(e){var n=r.useContext(p),a=n;return e&&(a="function"==typeof e?e(n):i(i({},n),e)),a},g=function(e){var n=s(e.components);return r.createElement(p.Provider,{value:n},e.children)},d="mdxType",c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var a=e.components,t=e.mdxType,o=e.originalType,p=e.parentName,g=l(e,["components","mdxType","originalType","parentName"]),d=s(a),m=t,y=d["".concat(p,".").concat(m)]||d[m]||c[m]||o;return a?r.createElement(y,i(i({ref:n},g),{},{components:a})):r.createElement(y,i({ref:n},g))}));function y(e,n){var a=arguments,t=n&&n.mdxType;if("string"==typeof e||t){var o=a.length,i=new Array(o);i[0]=m;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l[d]="string"==typeof e?e:t,i[1]=l;for(var s=2;s{a.r(n),a.d(n,{assets:()=>p,contentTitle:()=>i,default:()=>c,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var r=a(8168),t=(a(6540),a(5680));const o={id:"core_src.IHeapEdge",title:"Interface: IHeapEdge",sidebar_label:"IHeapEdge",custom_edit_url:null},i=void 0,l={unversionedId:"api/interfaces/core_src.IHeapEdge",id:"api/interfaces/core_src.IHeapEdge",title:"Interface: IHeapEdge",description:"An IHeapEdge instance represents a JS reference in a heap snapshot.",source:"@site/docs/api/interfaces/core_src.IHeapEdge.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/core_src.IHeapEdge",permalink:"/memlab/docs/api/interfaces/core_src.IHeapEdge",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"core_src.IHeapEdge",title:"Interface: IHeapEdge",sidebar_label:"IHeapEdge",custom_edit_url:null},sidebar:"sidebar",previous:{title:"IBrowserInfo",permalink:"/memlab/docs/api/interfaces/core_src.IBrowserInfo"},next:{title:"IHeapEdges",permalink:"/memlab/docs/api/interfaces/core_src.IHeapEdges"}},p={},s=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Properties",id:"properties",level:2},{value:' edgeIndex: number',id:"-edgeindex-number",level:3},{value:' fromNode: IHeapNode',id:"-fromnode-iheapnode",level:3},{value:' is_index: boolean',id:"-is_index-boolean",level:3},{value:' name_or_index: string | number',id:"-name_or_index-string--number",level:3},{value:' snapshot: IHeapSnapshot',id:"-snapshot-iheapsnapshot",level:3},{value:' toNode: IHeapNode',id:"-tonode-iheapnode",level:3},{value:' to_node: number',id:"-to_node-number",level:3},{value:' type: string',id:"-type-string",level:3},{value:"Methods",id:"methods",level:2},{value:'getJSONifyableObject()',id:"getjsonifyableobject",level:3},{value:'toJSONString(...args)',id:"tojsonstringargs",level:3}],g={toc:s},d="wrapper";function c(e){let{components:n,...a}=e;return(0,t.yg)(d,(0,r.A)({},g,a,{components:n,mdxType:"MDXLayout"}),(0,t.yg)("p",null,"An ",(0,t.yg)("inlineCode",{parentName:"p"},"IHeapEdge")," instance represents a JS reference in a heap snapshot.\nA heap snapshot is generally a graph where graph nodes are JS heap objects\nand graph edges are JS references among JS heap objects."),(0,t.yg)("p",null,(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"readonly"))," it is not recommended to modify any ",(0,t.yg)("inlineCode",{parentName:"p"},"IHeapEdge")," instance"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples"),": V8 or hermes heap snapshot can be parsed by the\n",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#getfullheapfromfile"},"getFullHeapFromFile")," API.")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot, IHeapEdge} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n // iterate over each edge (JS reference in heap)\n heap.edges.forEach((edge: IHeapEdge, i: number) => {\n // use the heap edge APIs here\n const nameOrIndex = edge.name_or_index;\n // ...\n });\n})();\n")),(0,t.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("inlineCode",{parentName:"p"},"IHeapEdgeBasic")),(0,t.yg)("p",{parentName:"li"},"\u21b3 ",(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"IHeapEdge"))))),(0,t.yg)("h2",{id:"properties"},"Properties"),(0,t.yg)("h3",{id:"-edgeindex-number"},(0,t.yg)("a",{id:"edgeindex",name:"edgeindex"})," ",(0,t.yg)("strong",{parentName:"h3"},"edgeIndex"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"index of this JS reference inside the ",(0,t.yg)("inlineCode",{parentName:"p"},"edge.snapshot.edges")," pseudo array"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1668"},"core/src/lib/Types.ts:1668"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-fromnode-iheapnode"},(0,t.yg)("a",{id:"fromnode",name:"fromnode"})," ",(0,t.yg)("strong",{parentName:"h3"},"fromNode"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode"))),(0,t.yg)("p",null,"returns an ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},"IHeapNode")," instance representing the hosting\nJS heap object where this reference starts"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1689"},"core/src/lib/Types.ts:1689"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-is_index-boolean"},(0,t.yg)("a",{id:"is\\_index",name:"is\\_index"})," ",(0,t.yg)("strong",{parentName:"h3"},"is","_","index"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"boolean")),(0,t.yg)("p",null,"if ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),", means this is a reference to an array element\nor internal table element (",(0,t.yg)("inlineCode",{parentName:"p"},"edge.name_or_index")," will return a number),\notherwise this is a reference with a string name (",(0,t.yg)("inlineCode",{parentName:"p"},"edge.name_or_index"),"\nwill return a string)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1675"},"core/src/lib/Types.ts:1675"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-name_or_index-string--number"},(0,t.yg)("a",{id:"name\\_or\\_index",name:"name\\_or\\_index"})," ",(0,t.yg)("strong",{parentName:"h3"},"name","_","or","_","index"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"name of the JS reference. If this is a reference to an array element\nor internal table element, it is an numeric index"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1624"},"core/src/lib/Types.ts:1624"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-snapshot-iheapsnapshot"},(0,t.yg)("a",{id:"snapshot",name:"snapshot"})," ",(0,t.yg)("strong",{parentName:"h3"},"snapshot"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot"))),(0,t.yg)("p",null,"get the ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")," containing this JS reference"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1664"},"core/src/lib/Types.ts:1664"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-tonode-iheapnode"},(0,t.yg)("a",{id:"tonode",name:"tonode"})," ",(0,t.yg)("strong",{parentName:"h3"},"toNode"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode"))),(0,t.yg)("p",null,"returns an ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},"IHeapNode")," instance representing the JS heap object\npointed to by this reference"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1684"},"core/src/lib/Types.ts:1684"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-to_node-number"},(0,t.yg)("a",{id:"to\\_node",name:"to\\_node"})," ",(0,t.yg)("strong",{parentName:"h3"},"to","_","node"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"the index of the JS heap object pointed to by this reference"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1679"},"core/src/lib/Types.ts:1679"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-type-string"},(0,t.yg)("a",{id:"type",name:"type"})," ",(0,t.yg)("strong",{parentName:"h3"},"type"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"string")),(0,t.yg)("p",null,"type of the JS reference, all types:\n",(0,t.yg)("inlineCode",{parentName:"p"},"context"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"element"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"property"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"internal"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"hidden"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"shortcut"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"weak")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1629"},"core/src/lib/Types.ts:1629"))))),(0,t.yg)("h2",{id:"methods"},"Methods"),(0,t.yg)("h3",{id:"getjsonifyableobject"},(0,t.yg)("a",{id:"getjsonifyableobject"}),(0,t.yg)("strong",{parentName:"h3"},"getJSONifyableObject"),"()"),(0,t.yg)("p",null,"convert to a concise readable object that can be used for serialization\n(like calling ",(0,t.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)"),")."),(0,t.yg)("p",null,"This API does not contain all the information\ncaptured by the hosting object."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"AnyRecord")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1697"},"core/src/lib/Types.ts:1697"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"tojsonstringargs"},(0,t.yg)("a",{id:"tojsonstring"}),(0,t.yg)("strong",{parentName:"h3"},"toJSONString"),"(...",(0,t.yg)("inlineCode",{parentName:"h3"},"args"),")"),(0,t.yg)("p",null,"convert to a concise readable string output\n(like calling ",(0,t.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)"),")."),(0,t.yg)("p",null,"Note: Please be aware that using ",(0,t.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)")," is\nnot recommended as it will generate a JSON representation of the host\nobject that is too large to be easily readable due to its connections\nto other parts of the data structures within the heap snapshot."),(0,t.yg)("p",null,"This API does not completely serialize all the information\ncaptured by the hosting object."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"...args"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"any"),"[]"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1710"},"core/src/lib/Types.ts:1710"))))))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[984],{5680:(e,n,a)=>{a.d(n,{xA:()=>g,yg:()=>y});var r=a(6540);function t(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function o(e,n){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),a.push.apply(a,r)}return a}function i(e){for(var n=1;n=0||(t[a]=e[a]);return t}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(t[a]=e[a])}return t}var p=r.createContext({}),s=function(e){var n=r.useContext(p),a=n;return e&&(a="function"==typeof e?e(n):i(i({},n),e)),a},g=function(e){var n=s(e.components);return r.createElement(p.Provider,{value:n},e.children)},c="mdxType",m={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},d=r.forwardRef((function(e,n){var a=e.components,t=e.mdxType,o=e.originalType,p=e.parentName,g=l(e,["components","mdxType","originalType","parentName"]),c=s(a),d=t,y=c["".concat(p,".").concat(d)]||c[d]||m[d]||o;return a?r.createElement(y,i(i({ref:n},g),{},{components:a})):r.createElement(y,i({ref:n},g))}));function y(e,n){var a=arguments,t=n&&n.mdxType;if("string"==typeof e||t){var o=a.length,i=new Array(o);i[0]=d;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l[c]="string"==typeof e?e:t,i[1]=l;for(var s=2;s{a.r(n),a.d(n,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var r=a(8168),t=(a(6540),a(5680));const o={id:"core_src.IHeapEdge",title:"Interface: IHeapEdge",sidebar_label:"IHeapEdge",custom_edit_url:null},i=void 0,l={unversionedId:"api/interfaces/core_src.IHeapEdge",id:"api/interfaces/core_src.IHeapEdge",title:"Interface: IHeapEdge",description:"An IHeapEdge instance represents a JS reference in a heap snapshot.",source:"@site/docs/api/interfaces/core_src.IHeapEdge.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/core_src.IHeapEdge",permalink:"/memlab/docs/api/interfaces/core_src.IHeapEdge",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"core_src.IHeapEdge",title:"Interface: IHeapEdge",sidebar_label:"IHeapEdge",custom_edit_url:null},sidebar:"sidebar",previous:{title:"IBrowserInfo",permalink:"/memlab/docs/api/interfaces/core_src.IBrowserInfo"},next:{title:"IHeapEdges",permalink:"/memlab/docs/api/interfaces/core_src.IHeapEdges"}},p={},s=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Properties",id:"properties",level:2},{value:' edgeIndex: number',id:"-edgeindex-number",level:3},{value:' fromNode: IHeapNode',id:"-fromnode-iheapnode",level:3},{value:' is_index: boolean',id:"-is_index-boolean",level:3},{value:' name_or_index: string | number',id:"-name_or_index-string--number",level:3},{value:' snapshot: IHeapSnapshot',id:"-snapshot-iheapsnapshot",level:3},{value:' toNode: IHeapNode',id:"-tonode-iheapnode",level:3},{value:' to_node: number',id:"-to_node-number",level:3},{value:' type: string',id:"-type-string",level:3},{value:"Methods",id:"methods",level:2},{value:'getJSONifyableObject()',id:"getjsonifyableobject",level:3},{value:'toJSONString(...args)',id:"tojsonstringargs",level:3}],g={toc:s},c="wrapper";function m(e){let{components:n,...a}=e;return(0,t.yg)(c,(0,r.A)({},g,a,{components:n,mdxType:"MDXLayout"}),(0,t.yg)("p",null,"An ",(0,t.yg)("inlineCode",{parentName:"p"},"IHeapEdge")," instance represents a JS reference in a heap snapshot.\nA heap snapshot is generally a graph where graph nodes are JS heap objects\nand graph edges are JS references among JS heap objects."),(0,t.yg)("p",null,(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"readonly"))," it is not recommended to modify any ",(0,t.yg)("inlineCode",{parentName:"p"},"IHeapEdge")," instance"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples"),": V8 or hermes heap snapshot can be parsed by the\n",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#getfullheapfromfile"},"getFullHeapFromFile")," API.")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot, IHeapEdge} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n // iterate over each edge (JS reference in heap)\n heap.edges.forEach((edge: IHeapEdge, i: number) => {\n // use the heap edge APIs here\n const nameOrIndex = edge.name_or_index;\n // ...\n });\n})();\n")),(0,t.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("inlineCode",{parentName:"p"},"IHeapEdgeBasic")),(0,t.yg)("p",{parentName:"li"},"\u21b3 ",(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"IHeapEdge"))))),(0,t.yg)("h2",{id:"properties"},"Properties"),(0,t.yg)("h3",{id:"-edgeindex-number"},(0,t.yg)("a",{id:"edgeindex",name:"edgeindex"})," ",(0,t.yg)("strong",{parentName:"h3"},"edgeIndex"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"index of this JS reference inside the ",(0,t.yg)("inlineCode",{parentName:"p"},"edge.snapshot.edges")," pseudo array"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1668"},"core/src/lib/Types.ts:1668"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-fromnode-iheapnode"},(0,t.yg)("a",{id:"fromnode",name:"fromnode"})," ",(0,t.yg)("strong",{parentName:"h3"},"fromNode"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode"))),(0,t.yg)("p",null,"returns an ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},"IHeapNode")," instance representing the hosting\nJS heap object where this reference starts"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1689"},"core/src/lib/Types.ts:1689"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-is_index-boolean"},(0,t.yg)("a",{id:"is\\_index",name:"is\\_index"})," ",(0,t.yg)("strong",{parentName:"h3"},"is","_","index"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"boolean")),(0,t.yg)("p",null,"if ",(0,t.yg)("inlineCode",{parentName:"p"},"true"),", means this is a reference to an array element\nor internal table element (",(0,t.yg)("inlineCode",{parentName:"p"},"edge.name_or_index")," will return a number),\notherwise this is a reference with a string name (",(0,t.yg)("inlineCode",{parentName:"p"},"edge.name_or_index"),"\nwill return a string)"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1675"},"core/src/lib/Types.ts:1675"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-name_or_index-string--number"},(0,t.yg)("a",{id:"name\\_or\\_index",name:"name\\_or\\_index"})," ",(0,t.yg)("strong",{parentName:"h3"},"name","_","or","_","index"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"string")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"name of the JS reference. If this is a reference to an array element\nor internal table element, it is an numeric index"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1624"},"core/src/lib/Types.ts:1624"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-snapshot-iheapsnapshot"},(0,t.yg)("a",{id:"snapshot",name:"snapshot"})," ",(0,t.yg)("strong",{parentName:"h3"},"snapshot"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot"))),(0,t.yg)("p",null,"get the ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")," containing this JS reference"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1664"},"core/src/lib/Types.ts:1664"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-tonode-iheapnode"},(0,t.yg)("a",{id:"tonode",name:"tonode"})," ",(0,t.yg)("strong",{parentName:"h3"},"toNode"),": ",(0,t.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode"))),(0,t.yg)("p",null,"returns an ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},"IHeapNode")," instance representing the JS heap object\npointed to by this reference"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1684"},"core/src/lib/Types.ts:1684"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-to_node-number"},(0,t.yg)("a",{id:"to\\_node",name:"to\\_node"})," ",(0,t.yg)("strong",{parentName:"h3"},"to","_","node"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"the index of the JS heap object pointed to by this reference"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1679"},"core/src/lib/Types.ts:1679"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"-type-string"},(0,t.yg)("a",{id:"type",name:"type"})," ",(0,t.yg)("strong",{parentName:"h3"},"type"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"string")),(0,t.yg)("p",null,"type of the JS reference, all types:\n",(0,t.yg)("inlineCode",{parentName:"p"},"context"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"element"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"property"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"internal"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"hidden"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"shortcut"),", ",(0,t.yg)("inlineCode",{parentName:"p"},"weak")),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1629"},"core/src/lib/Types.ts:1629"))))),(0,t.yg)("h2",{id:"methods"},"Methods"),(0,t.yg)("h3",{id:"getjsonifyableobject"},(0,t.yg)("a",{id:"getjsonifyableobject"}),(0,t.yg)("strong",{parentName:"h3"},"getJSONifyableObject"),"()"),(0,t.yg)("p",null,"convert to a concise readable object that can be used for serialization\n(like calling ",(0,t.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)"),")."),(0,t.yg)("p",null,"This API does not contain all the information\ncaptured by the hosting object."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"AnyRecord")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1697"},"core/src/lib/Types.ts:1697"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"tojsonstringargs"},(0,t.yg)("a",{id:"tojsonstring"}),(0,t.yg)("strong",{parentName:"h3"},"toJSONString"),"(...",(0,t.yg)("inlineCode",{parentName:"h3"},"args"),")"),(0,t.yg)("p",null,"convert to a concise readable string output\n(like calling ",(0,t.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)"),")."),(0,t.yg)("p",null,"Note: Please be aware that using ",(0,t.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)")," is\nnot recommended as it will generate a JSON representation of the host\nobject that is too large to be easily readable due to its connections\nto other parts of the data structures within the heap snapshot."),(0,t.yg)("p",null,"This API does not completely serialize all the information\ncaptured by the hosting object."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"...args"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"any"),"[]"))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"string")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1710"},"core/src/lib/Types.ts:1710"))))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/b53f1d78.11c43043.js b/assets/js/b53f1d78.caf37975.js similarity index 95% rename from assets/js/b53f1d78.11c43043.js rename to assets/js/b53f1d78.caf37975.js index 82361e92..345828aa 100644 --- a/assets/js/b53f1d78.11c43043.js +++ b/assets/js/b53f1d78.caf37975.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[3925],{5680:(e,a,n)=>{n.d(a,{xA:()=>c,yg:()=>y});var t=n(6540);function r(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function o(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function l(e){for(var a=1;a=0||(r[n]=e[n]);return r}(e,a);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=t.createContext({}),p=function(e){var a=t.useContext(s),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},c=function(e){var a=p(e.components);return t.createElement(s.Provider,{value:a},e.children)},g="mdxType",m={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},u=t.forwardRef((function(e,a){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),g=p(n),u=r,y=g["".concat(s,".").concat(u)]||g[u]||m[u]||o;return n?t.createElement(y,l(l({ref:a},c),{},{components:n})):t.createElement(y,l({ref:a},c))}));function y(e,a){var n=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=u;var i={};for(var s in a)hasOwnProperty.call(a,s)&&(i[s]=a[s]);i.originalType=e,i[g]="string"==typeof e?e:r,l[1]=i;for(var p=2;p{n.r(a),n.d(a,{assets:()=>s,contentTitle:()=>l,default:()=>m,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var t=n(8168),r=(n(6540),n(5680));const o={id:"core_src.IHeapLocation",title:"Interface: IHeapLocation",sidebar_label:"IHeapLocation",custom_edit_url:null},l=void 0,i={unversionedId:"api/interfaces/core_src.IHeapLocation",id:"api/interfaces/core_src.IHeapLocation",title:"Interface: IHeapLocation",description:"An IHeapLocation instance contains a source location information",source:"@site/docs/api/interfaces/core_src.IHeapLocation.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/core_src.IHeapLocation",permalink:"/memlab/docs/api/interfaces/core_src.IHeapLocation",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"core_src.IHeapLocation",title:"Interface: IHeapLocation",sidebar_label:"IHeapLocation",custom_edit_url:null},sidebar:"sidebar",previous:{title:"IHeapEdges",permalink:"/memlab/docs/api/interfaces/core_src.IHeapEdges"},next:{title:"IHeapNode",permalink:"/memlab/docs/api/interfaces/core_src.IHeapNode"}},s={},p=[{value:"Properties",id:"properties",level:2},{value:' column: number',id:"-column-number",level:3},{value:' line: number',id:"-line-number",level:3},{value:' node: Nullable<IHeapNode>',id:"-node-nullableiheapnode",level:3},{value:' script_id: number',id:"-script_id-number",level:3},{value:' snapshot: IHeapSnapshot',id:"-snapshot-iheapsnapshot",level:3},{value:"Methods",id:"methods",level:2},{value:'getJSONifyableObject()',id:"getjsonifyableobject",level:3},{value:'toJSONString(...args)',id:"tojsonstringargs",level:3}],c={toc:p},g="wrapper";function m(e){let{components:a,...n}=e;return(0,r.yg)(g,(0,t.A)({},c,n,{components:a,mdxType:"MDXLayout"}),(0,r.yg)("p",null,"An ",(0,r.yg)("inlineCode",{parentName:"p"},"IHeapLocation")," instance contains a source location information\nassociated with a JS heap object.\nA heap snapshot is generally a graph where graph nodes are JS heap objects\nand graph edges are JS references among JS heap objects."),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},(0,r.yg)("inlineCode",{parentName:"strong"},"readonly"))," it is not recommended to modify any ",(0,r.yg)("inlineCode",{parentName:"p"},"IHeapLocation")," instance"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),": V8 or hermes heap snapshot can be parsed by the\n",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#getfullheapfromfile"},"getFullHeapFromFile")," API.")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot, IHeapNode, IHeapLocation} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n // iterate over each node (heap object)\n heap.nodes.forEach((node: IHeapNode, i: number) => {\n const location: Nullable = node.location;\n if (location) {\n // use the location API here\n location.line;\n // ...\n }\n });\n})();\n")),(0,r.yg)("h2",{id:"properties"},"Properties"),(0,r.yg)("h3",{id:"-column-number"},(0,r.yg)("a",{id:"column",name:"column"})," ",(0,r.yg)("strong",{parentName:"h3"},"column"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"number")),(0,r.yg)("p",null,"get the column number"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1594"},"core/src/lib/Types.ts:1594"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-line-number"},(0,r.yg)("a",{id:"line",name:"line"})," ",(0,r.yg)("strong",{parentName:"h3"},"line"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"number")),(0,r.yg)("p",null,"get the line number"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1590"},"core/src/lib/Types.ts:1590"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-node-nullableiheapnode"},(0,r.yg)("a",{id:"node",name:"node"})," ",(0,r.yg)("strong",{parentName:"h3"},"node"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#nullable"},(0,r.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"),(0,r.yg)("p",null,"get the heap object this location this location represents"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1582"},"core/src/lib/Types.ts:1582"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-script_id-number"},(0,r.yg)("a",{id:"script\\_id",name:"script\\_id"})," ",(0,r.yg)("strong",{parentName:"h3"},"script","_","id"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"number")),(0,r.yg)("p",null,"get the script ID of the source file"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1586"},"core/src/lib/Types.ts:1586"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-snapshot-iheapsnapshot"},(0,r.yg)("a",{id:"snapshot",name:"snapshot"})," ",(0,r.yg)("strong",{parentName:"h3"},"snapshot"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot"))),(0,r.yg)("p",null,"get the ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")," containing this location instance"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1578"},"core/src/lib/Types.ts:1578"))))),(0,r.yg)("h2",{id:"methods"},"Methods"),(0,r.yg)("h3",{id:"getjsonifyableobject"},(0,r.yg)("a",{id:"getjsonifyableobject"}),(0,r.yg)("strong",{parentName:"h3"},"getJSONifyableObject"),"()"),(0,r.yg)("p",null,"convert to a concise readable object that can be used for serialization\n(like calling ",(0,r.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)"),")."),(0,r.yg)("p",null,"This API does not contain all the information\ncaptured by the hosting object."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"AnyRecord")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1602"},"core/src/lib/Types.ts:1602"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"tojsonstringargs"},(0,r.yg)("a",{id:"tojsonstring"}),(0,r.yg)("strong",{parentName:"h3"},"toJSONString"),"(...",(0,r.yg)("inlineCode",{parentName:"h3"},"args"),")"),(0,r.yg)("p",null,"convert to a concise readable string output\n(like calling ",(0,r.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)"),")."),(0,r.yg)("p",null,"Note: Please be aware that using ",(0,r.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)")," is\nnot recommended as it will generate a JSON representation of the host\nobject that is too large to be easily readable due to its connections\nto other parts of the data structures within the heap snapshot."),(0,r.yg)("p",null,"This API does not completely serialize all the information\ncaptured by the hosting object."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Parameters"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"...args"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"any"),"[]"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1615"},"core/src/lib/Types.ts:1615"))))))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[3925],{5680:(e,a,n)=>{n.d(a,{xA:()=>c,yg:()=>y});var t=n(6540);function r(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function o(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function l(e){for(var a=1;a=0||(r[n]=e[n]);return r}(e,a);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=t.createContext({}),p=function(e){var a=t.useContext(s),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},c=function(e){var a=p(e.components);return t.createElement(s.Provider,{value:a},e.children)},g="mdxType",m={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},u=t.forwardRef((function(e,a){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),g=p(n),u=r,y=g["".concat(s,".").concat(u)]||g[u]||m[u]||o;return n?t.createElement(y,l(l({ref:a},c),{},{components:n})):t.createElement(y,l({ref:a},c))}));function y(e,a){var n=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=u;var i={};for(var s in a)hasOwnProperty.call(a,s)&&(i[s]=a[s]);i.originalType=e,i[g]="string"==typeof e?e:r,l[1]=i;for(var p=2;p{n.r(a),n.d(a,{assets:()=>s,contentTitle:()=>l,default:()=>m,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var t=n(8168),r=(n(6540),n(5680));const o={id:"core_src.IHeapLocation",title:"Interface: IHeapLocation",sidebar_label:"IHeapLocation",custom_edit_url:null},l=void 0,i={unversionedId:"api/interfaces/core_src.IHeapLocation",id:"api/interfaces/core_src.IHeapLocation",title:"Interface: IHeapLocation",description:"An IHeapLocation instance contains a source location information",source:"@site/docs/api/interfaces/core_src.IHeapLocation.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/core_src.IHeapLocation",permalink:"/memlab/docs/api/interfaces/core_src.IHeapLocation",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"core_src.IHeapLocation",title:"Interface: IHeapLocation",sidebar_label:"IHeapLocation",custom_edit_url:null},sidebar:"sidebar",previous:{title:"IHeapEdges",permalink:"/memlab/docs/api/interfaces/core_src.IHeapEdges"},next:{title:"IHeapNode",permalink:"/memlab/docs/api/interfaces/core_src.IHeapNode"}},s={},p=[{value:"Properties",id:"properties",level:2},{value:' column: number',id:"-column-number",level:3},{value:' line: number',id:"-line-number",level:3},{value:' node: Nullable<IHeapNode>',id:"-node-nullableiheapnode",level:3},{value:' script_id: number',id:"-script_id-number",level:3},{value:' snapshot: IHeapSnapshot',id:"-snapshot-iheapsnapshot",level:3},{value:"Methods",id:"methods",level:2},{value:'getJSONifyableObject()',id:"getjsonifyableobject",level:3},{value:'toJSONString(...args)',id:"tojsonstringargs",level:3}],c={toc:p},g="wrapper";function m(e){let{components:a,...n}=e;return(0,r.yg)(g,(0,t.A)({},c,n,{components:a,mdxType:"MDXLayout"}),(0,r.yg)("p",null,"An ",(0,r.yg)("inlineCode",{parentName:"p"},"IHeapLocation")," instance contains a source location information\nassociated with a JS heap object.\nA heap snapshot is generally a graph where graph nodes are JS heap objects\nand graph edges are JS references among JS heap objects."),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},(0,r.yg)("inlineCode",{parentName:"strong"},"readonly"))," it is not recommended to modify any ",(0,r.yg)("inlineCode",{parentName:"p"},"IHeapLocation")," instance"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),": V8 or hermes heap snapshot can be parsed by the\n",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#getfullheapfromfile"},"getFullHeapFromFile")," API.")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot, IHeapNode, IHeapLocation} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n // iterate over each node (heap object)\n heap.nodes.forEach((node: IHeapNode, i: number) => {\n const location: Nullable = node.location;\n if (location) {\n // use the location API here\n location.line;\n // ...\n }\n });\n})();\n")),(0,r.yg)("h2",{id:"properties"},"Properties"),(0,r.yg)("h3",{id:"-column-number"},(0,r.yg)("a",{id:"column",name:"column"})," ",(0,r.yg)("strong",{parentName:"h3"},"column"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"number")),(0,r.yg)("p",null,"get the column number"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1594"},"core/src/lib/Types.ts:1594"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-line-number"},(0,r.yg)("a",{id:"line",name:"line"})," ",(0,r.yg)("strong",{parentName:"h3"},"line"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"number")),(0,r.yg)("p",null,"get the line number"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1590"},"core/src/lib/Types.ts:1590"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-node-nullableiheapnode"},(0,r.yg)("a",{id:"node",name:"node"})," ",(0,r.yg)("strong",{parentName:"h3"},"node"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#nullable"},(0,r.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"),(0,r.yg)("p",null,"get the heap object this location this location represents"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1582"},"core/src/lib/Types.ts:1582"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-script_id-number"},(0,r.yg)("a",{id:"script\\_id",name:"script\\_id"})," ",(0,r.yg)("strong",{parentName:"h3"},"script","_","id"),": ",(0,r.yg)("inlineCode",{parentName:"h3"},"number")),(0,r.yg)("p",null,"get the script ID of the source file"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1586"},"core/src/lib/Types.ts:1586"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-snapshot-iheapsnapshot"},(0,r.yg)("a",{id:"snapshot",name:"snapshot"})," ",(0,r.yg)("strong",{parentName:"h3"},"snapshot"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapSnapshot"))),(0,r.yg)("p",null,"get the ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")," containing this location instance"),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1578"},"core/src/lib/Types.ts:1578"))))),(0,r.yg)("h2",{id:"methods"},"Methods"),(0,r.yg)("h3",{id:"getjsonifyableobject"},(0,r.yg)("a",{id:"getjsonifyableobject"}),(0,r.yg)("strong",{parentName:"h3"},"getJSONifyableObject"),"()"),(0,r.yg)("p",null,"convert to a concise readable object that can be used for serialization\n(like calling ",(0,r.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)"),")."),(0,r.yg)("p",null,"This API does not contain all the information\ncaptured by the hosting object."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"AnyRecord")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1602"},"core/src/lib/Types.ts:1602"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"tojsonstringargs"},(0,r.yg)("a",{id:"tojsonstring"}),(0,r.yg)("strong",{parentName:"h3"},"toJSONString"),"(...",(0,r.yg)("inlineCode",{parentName:"h3"},"args"),")"),(0,r.yg)("p",null,"convert to a concise readable string output\n(like calling ",(0,r.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)"),")."),(0,r.yg)("p",null,"Note: Please be aware that using ",(0,r.yg)("inlineCode",{parentName:"p"},"JSON.stringify(node, ...args)")," is\nnot recommended as it will generate a JSON representation of the host\nobject that is too large to be easily readable due to its connections\nto other parts of the data structures within the heap snapshot."),(0,r.yg)("p",null,"This API does not completely serialize all the information\ncaptured by the hosting object."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Parameters"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"...args"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"any"),"[]"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1615"},"core/src/lib/Types.ts:1615"))))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c90dd339.f50c64ca.js b/assets/js/c90dd339.ee738292.js similarity index 95% rename from assets/js/c90dd339.f50c64ca.js rename to assets/js/c90dd339.ee738292.js index cc7d1399..64c94aba 100644 --- a/assets/js/c90dd339.f50c64ca.js +++ b/assets/js/c90dd339.ee738292.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[1456],{5680:(e,a,n)=>{n.d(a,{xA:()=>m,yg:()=>y});var t=n(6540);function r(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function o(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function l(e){for(var a=1;a=0||(r[n]=e[n]);return r}(e,a);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=t.createContext({}),i=function(e){var a=t.useContext(s),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},m=function(e){var a=i(e.components);return t.createElement(s.Provider,{value:a},e.children)},c="mdxType",g={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},d=t.forwardRef((function(e,a){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,m=p(e,["components","mdxType","originalType","parentName"]),c=i(n),d=r,y=c["".concat(s,".").concat(d)]||c[d]||g[d]||o;return n?t.createElement(y,l(l({ref:a},m),{},{components:n})):t.createElement(y,l({ref:a},m))}));function y(e,a){var n=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=d;var p={};for(var s in a)hasOwnProperty.call(a,s)&&(p[s]=a[s]);p.originalType=e,p[c]="string"==typeof e?e:r,l[1]=p;for(var i=2;i{n.r(a),n.d(a,{assets:()=>s,contentTitle:()=>l,default:()=>g,frontMatter:()=>o,metadata:()=>p,toc:()=>i});var t=n(8168),r=(n(6540),n(5680));const o={id:"core_src.IHeapSnapshot",title:"Interface: IHeapSnapshot",sidebar_label:"IHeapSnapshot",custom_edit_url:null},l=void 0,p={unversionedId:"api/interfaces/core_src.IHeapSnapshot",id:"api/interfaces/core_src.IHeapSnapshot",title:"Interface: IHeapSnapshot",description:"A heap snapshot is generally a graph where graph nodes are JS heap objects",source:"@site/docs/api/interfaces/core_src.IHeapSnapshot.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/core_src.IHeapSnapshot",permalink:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"core_src.IHeapSnapshot",title:"Interface: IHeapSnapshot",sidebar_label:"IHeapSnapshot",custom_edit_url:null},sidebar:"sidebar",previous:{title:"IHeapNodes",permalink:"/memlab/docs/api/interfaces/core_src.IHeapNodes"},next:{title:"IHeapStringNode",permalink:"/memlab/docs/api/interfaces/core_src.IHeapStringNode"}},s={},i=[{value:"Properties",id:"properties",level:2},{value:' edges: IHeapEdges',id:"-edges-iheapedges",level:3},{value:' nodes: IHeapNodes',id:"-nodes-iheapnodes",level:3},{value:"Methods",id:"methods",level:2},{value:'getAnyObjectWithClassName(className)',id:"getanyobjectwithclassnameclassname",level:3},{value:'getNodeById(id)',id:"getnodebyidid",level:3},{value:'getNodesByIdSet(ids)',id:"getnodesbyidsetids",level:3},{value:'getNodesByIds(ids)',id:"getnodesbyidsids",level:3},{value:'hasObjectWithClassName(className)',id:"hasobjectwithclassnameclassname",level:3},{value:'hasObjectWithPropertyName(nameOrIndex)',id:"hasobjectwithpropertynamenameorindex",level:3},{value:'hasObjectWithTag(tag)',id:"hasobjectwithtagtag",level:3}],m={toc:i},c="wrapper";function g(e){let{components:a,...n}=e;return(0,r.yg)(c,(0,t.A)({},m,n,{components:a,mdxType:"MDXLayout"}),(0,r.yg)("p",null,"A heap snapshot is generally a graph where graph nodes are JS heap objects\nand graph edges are JS references among JS heap objects. For more details\non the structure of nodes and edges in the heap graph, check out\n",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},"IHeapNode")," and ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},"IHeapEdge"),"."),(0,r.yg)("h2",{id:"properties"},"Properties"),(0,r.yg)("h3",{id:"-edges-iheapedges"},(0,r.yg)("a",{id:"edges",name:"edges"})," ",(0,r.yg)("strong",{parentName:"h3"},"edges"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapEdges"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapEdges"))),(0,r.yg)("p",null,"A pseudo array containing all heap graph edges (references to heap objects\nin heap). A JS heap could contain millions of references, so memlab uses\na pseudo array as the collection of all the heap edges. The pseudo\narray provides API to query and traverse all heap references."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot, IHeapEdge} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n // get the total number of heap references\n heap.edges.length;\n\n heap.edges.forEach((edge: IHeapEdge) => {\n // traverse each reference in the heap\n });\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1332"},"core/src/lib/Types.ts:1332"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-nodes-iheapnodes"},(0,r.yg)("a",{id:"nodes",name:"nodes"})," ",(0,r.yg)("strong",{parentName:"h3"},"nodes"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapNodes"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapNodes"))),(0,r.yg)("p",null,"A pseudo array containing all heap graph nodes (JS objects in heap).\nA JS heap could contain millions of heap objects, so memlab uses\na pseudo array as the collection of all the heap objects. The pseudo\narray provides API to query and traverse all heap objects."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot, IHeapNode} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n // get the total number of heap objects\n heap.nodes.length;\n\n heap.nodes.forEach((node: IHeapNode) => {\n // traverse each heap object\n });\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1306"},"core/src/lib/Types.ts:1306"))))),(0,r.yg)("h2",{id:"methods"},"Methods"),(0,r.yg)("h3",{id:"getanyobjectwithclassnameclassname"},(0,r.yg)("a",{id:"getanyobjectwithclassname"}),(0,r.yg)("strong",{parentName:"h3"},"getAnyObjectWithClassName"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"className"),")"),(0,r.yg)("p",null,"Search for the heap and get one of the JS object instances with\na specified constructor name (if there is any)."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"className"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | The constructor name of the object instance"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,r.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | a handle pointing to any one of the object instances, returns\n",(0,r.yg)("inlineCode",{parentName:"p"},"null")," if no such object exists in the heap.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport {takeNodeMinimalHeap} from '@memlab/core';\n\nclass TestObject {\n public arr1 = [1, 2, 3];\n public arr2 = ['1', '2', '3'];\n}\n\n(async function () {\n const obj = new TestObject();\n // get a heap snapshot of the current program state\n const heap: IHeapSnapshot = await takeNodeMinimalHeap();\n\n const node = heap.getAnyObjectWithClassName('TestObject');\n console.log(node?.name); // should be 'TestObject'\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1473"},"core/src/lib/Types.ts:1473"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"getnodebyidid"},(0,r.yg)("a",{id:"getnodebyid"}),(0,r.yg)("strong",{parentName:"h3"},"getNodeById"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"id"),")"),(0,r.yg)("p",null,"If you have the id of a heap node (JS object in heap), use this API\nto get an ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},"IHeapNode")," associated with the id."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"id"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"number")," | id of the heap node (JS object in heap) you would like to query"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,r.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the API returns ",(0,r.yg)("inlineCode",{parentName:"p"},"null")," if no heap object has the specified id.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n const node = heap.getNodeById(351);\n node?.id; // should be 351\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1354"},"core/src/lib/Types.ts:1354"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"getnodesbyidsetids"},(0,r.yg)("a",{id:"getnodesbyidset"}),(0,r.yg)("strong",{parentName:"h3"},"getNodesByIdSet"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"ids"),")"),(0,r.yg)("p",null,"Given a set of ids of heap nodes (JS objects in heap), use this API\nto get a set of those heap nodes."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"ids"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"Set"),"<",(0,r.yg)("inlineCode",{parentName:"li"},"number"),">"," | id set of the heap nodes (JS objects in heap) you would like to query"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"Set"),"<",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | a set of those heap nodes. The set will only include\nnodes that are found in the heap. If none of the input ids are found,\nthis API will return an empty set.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n // suppose 1000 is not a valid id in the heap\n const set = heap.getNodesByIdSet(new Set([1, 2, 1000, 3]));\n set // should be Set([node1, node2, node3])\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1406"},"core/src/lib/Types.ts:1406"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"getnodesbyidsids"},(0,r.yg)("a",{id:"getnodesbyids"}),(0,r.yg)("strong",{parentName:"h3"},"getNodesByIds"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"ids"),")"),(0,r.yg)("p",null,"Given an array of ids of heap nodes (JS objects in heap), use this API\nto get an array of those heap nodes."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"ids"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"number"),"[] | id array of the heap nodes (JS objects in heap) you would like to query"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,r.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">","[] | an array of those heap nodes. The return array will preserve the\norder of the input array. If an id is not found in the heap, the\ncorresponding element in the return array will be ",(0,r.yg)("inlineCode",{parentName:"p"},"null"),".")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n // suppose 1000 is not a valid id in the heap\n const nodes = heap.getNodesByIds([1, 2, 1000, 3]);\n nodes // should be [node1, node2, null, node3]\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1380"},"core/src/lib/Types.ts:1380"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"hasobjectwithclassnameclassname"},(0,r.yg)("a",{id:"hasobjectwithclassname"}),(0,r.yg)("strong",{parentName:"h3"},"hasObjectWithClassName"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"className"),")"),(0,r.yg)("p",null,"Search for the heap and check if there is any JS object instance with\na specified constructor name."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"className"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | The constructor name of the object instance"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"boolean")," | ",(0,r.yg)("inlineCode",{parentName:"p"},"true")," if there is at least one such object in the heap")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),": you can write a jest unit test with memory assertions:"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"// save as example.test.ts\nimport type {IHeapSnapshot, Nullable} from '@memlab/core';\nimport {config, takeNodeMinimalHeap} from '@memlab/core';\n\nclass TestObject {\n public arr1 = [1, 2, 3];\n public arr2 = ['1', '2', '3'];\n}\n\ntest('memory test with heap assertion', async () => {\n config.muteConsole = true; // no console output\n\n let obj: Nullable = new TestObject();\n // get a heap snapshot of the current program state\n let heap: IHeapSnapshot = await takeNodeMinimalHeap();\n\n // call some function that may add references to obj\n rabbitHole(obj)\n\n expect(heap.hasObjectWithClassName('TestObject')).toBe(true);\n obj = null;\n\n heap = await takeNodeMinimalHeap();\n // if rabbitHole does not have any side effect that\n // adds new references to obj, then obj can be GCed\n expect(heap.hasObjectWithClassName('TestObject')).toBe(false);\n\n}, 30000);\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1445"},"core/src/lib/Types.ts:1445"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"hasobjectwithpropertynamenameorindex"},(0,r.yg)("a",{id:"hasobjectwithpropertyname"}),(0,r.yg)("strong",{parentName:"h3"},"hasObjectWithPropertyName"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"nameOrIndex"),")"),(0,r.yg)("p",null,"Search for the heap and check if there is any JS object instance with\na specified property name."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"nameOrIndex"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,r.yg)("inlineCode",{parentName:"li"},"number")," | The property name (string) or element index (number) on the object instance"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"boolean")," | returns ",(0,r.yg)("inlineCode",{parentName:"p"},"true")," if there is at least one such object in the heap")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const object = {'memlab-test-heap-property': 'memlab-test-heap-value'};\n\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n // should be true\n console.log(heap.hasObjectWithPropertyName('memlab-test-heap-property'));\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1499"},"core/src/lib/Types.ts:1499"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"hasobjectwithtagtag"},(0,r.yg)("a",{id:"hasobjectwithtag"}),(0,r.yg)("strong",{parentName:"h3"},"hasObjectWithTag"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"tag"),")"),(0,r.yg)("p",null,"Search for the heap and check if there is any JS object instance with\na marker tagged by ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#tagobject"},"tagObject"),"."),(0,r.yg)("p",null,"The ",(0,r.yg)("inlineCode",{parentName:"p"},"tagObject")," API does not modify the object instance in any way\n(e.g., no additional or hidden properties added to the tagged object)."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Parameters"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"tag"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | marker name on the object instances tagged by ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#tagobject"},"tagObject")))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"boolean")," | returns ",(0,r.yg)("inlineCode",{parentName:"li"},"true")," if there is at least one such object in the heap")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot, AnyValue} from '@memlab/core';\nimport {config, takeNodeMinimalHeap, tagObject} from '@memlab/core';\n\ntest('memory test', async () => {\n config.muteConsole = true;\n const o1: AnyValue = {};\n let o2: AnyValue = {};\n\n // tag o1 with marker: \"memlab-mark-1\", does not modify o1 in any way\n tagObject(o1, 'memlab-mark-1');\n // tag o2 with marker: \"memlab-mark-2\", does not modify o2 in any way\n tagObject(o2, 'memlab-mark-2');\n\n o2 = null;\n\n const heap: IHeapSnapshot = await takeNodeMinimalHeap();\n\n // expect object with marker \"memlab-mark-1\" exists\n expect(heap.hasObjectWithTag('memlab-mark-1')).toBe(true);\n\n // expect object with marker \"memlab-mark-2\" can be GCed\n expect(heap.hasObjectWithTag('memlab-mark-2')).toBe(false);\n\n}, 30000);\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1537"},"core/src/lib/Types.ts:1537"))))))}g.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[1456],{5680:(e,a,n)=>{n.d(a,{xA:()=>m,yg:()=>d});var t=n(6540);function r(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function o(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function l(e){for(var a=1;a=0||(r[n]=e[n]);return r}(e,a);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=t.createContext({}),i=function(e){var a=t.useContext(s),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},m=function(e){var a=i(e.components);return t.createElement(s.Provider,{value:a},e.children)},c="mdxType",g={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},y=t.forwardRef((function(e,a){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,m=p(e,["components","mdxType","originalType","parentName"]),c=i(n),y=r,d=c["".concat(s,".").concat(y)]||c[y]||g[y]||o;return n?t.createElement(d,l(l({ref:a},m),{},{components:n})):t.createElement(d,l({ref:a},m))}));function d(e,a){var n=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=y;var p={};for(var s in a)hasOwnProperty.call(a,s)&&(p[s]=a[s]);p.originalType=e,p[c]="string"==typeof e?e:r,l[1]=p;for(var i=2;i{n.r(a),n.d(a,{assets:()=>s,contentTitle:()=>l,default:()=>g,frontMatter:()=>o,metadata:()=>p,toc:()=>i});var t=n(8168),r=(n(6540),n(5680));const o={id:"core_src.IHeapSnapshot",title:"Interface: IHeapSnapshot",sidebar_label:"IHeapSnapshot",custom_edit_url:null},l=void 0,p={unversionedId:"api/interfaces/core_src.IHeapSnapshot",id:"api/interfaces/core_src.IHeapSnapshot",title:"Interface: IHeapSnapshot",description:"A heap snapshot is generally a graph where graph nodes are JS heap objects",source:"@site/docs/api/interfaces/core_src.IHeapSnapshot.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/core_src.IHeapSnapshot",permalink:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"core_src.IHeapSnapshot",title:"Interface: IHeapSnapshot",sidebar_label:"IHeapSnapshot",custom_edit_url:null},sidebar:"sidebar",previous:{title:"IHeapNodes",permalink:"/memlab/docs/api/interfaces/core_src.IHeapNodes"},next:{title:"IHeapStringNode",permalink:"/memlab/docs/api/interfaces/core_src.IHeapStringNode"}},s={},i=[{value:"Properties",id:"properties",level:2},{value:' edges: IHeapEdges',id:"-edges-iheapedges",level:3},{value:' nodes: IHeapNodes',id:"-nodes-iheapnodes",level:3},{value:"Methods",id:"methods",level:2},{value:'getAnyObjectWithClassName(className)',id:"getanyobjectwithclassnameclassname",level:3},{value:'getNodeById(id)',id:"getnodebyidid",level:3},{value:'getNodesByIdSet(ids)',id:"getnodesbyidsetids",level:3},{value:'getNodesByIds(ids)',id:"getnodesbyidsids",level:3},{value:'hasObjectWithClassName(className)',id:"hasobjectwithclassnameclassname",level:3},{value:'hasObjectWithPropertyName(nameOrIndex)',id:"hasobjectwithpropertynamenameorindex",level:3},{value:'hasObjectWithTag(tag)',id:"hasobjectwithtagtag",level:3}],m={toc:i},c="wrapper";function g(e){let{components:a,...n}=e;return(0,r.yg)(c,(0,t.A)({},m,n,{components:a,mdxType:"MDXLayout"}),(0,r.yg)("p",null,"A heap snapshot is generally a graph where graph nodes are JS heap objects\nand graph edges are JS references among JS heap objects. For more details\non the structure of nodes and edges in the heap graph, check out\n",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},"IHeapNode")," and ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},"IHeapEdge"),"."),(0,r.yg)("h2",{id:"properties"},"Properties"),(0,r.yg)("h3",{id:"-edges-iheapedges"},(0,r.yg)("a",{id:"edges",name:"edges"})," ",(0,r.yg)("strong",{parentName:"h3"},"edges"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapEdges"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapEdges"))),(0,r.yg)("p",null,"A pseudo array containing all heap graph edges (references to heap objects\nin heap). A JS heap could contain millions of references, so memlab uses\na pseudo array as the collection of all the heap edges. The pseudo\narray provides API to query and traverse all heap references."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot, IHeapEdge} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n // get the total number of heap references\n heap.edges.length;\n\n heap.edges.forEach((edge: IHeapEdge) => {\n // traverse each reference in the heap\n });\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1332"},"core/src/lib/Types.ts:1332"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-nodes-iheapnodes"},(0,r.yg)("a",{id:"nodes",name:"nodes"})," ",(0,r.yg)("strong",{parentName:"h3"},"nodes"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/interfaces/core_src.IHeapNodes"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapNodes"))),(0,r.yg)("p",null,"A pseudo array containing all heap graph nodes (JS objects in heap).\nA JS heap could contain millions of heap objects, so memlab uses\na pseudo array as the collection of all the heap objects. The pseudo\narray provides API to query and traverse all heap objects."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot, IHeapNode} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n // get the total number of heap objects\n heap.nodes.length;\n\n heap.nodes.forEach((node: IHeapNode) => {\n // traverse each heap object\n });\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1306"},"core/src/lib/Types.ts:1306"))))),(0,r.yg)("h2",{id:"methods"},"Methods"),(0,r.yg)("h3",{id:"getanyobjectwithclassnameclassname"},(0,r.yg)("a",{id:"getanyobjectwithclassname"}),(0,r.yg)("strong",{parentName:"h3"},"getAnyObjectWithClassName"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"className"),")"),(0,r.yg)("p",null,"Search for the heap and get one of the JS object instances with\na specified constructor name (if there is any)."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"className"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | The constructor name of the object instance"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,r.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | a handle pointing to any one of the object instances, returns\n",(0,r.yg)("inlineCode",{parentName:"p"},"null")," if no such object exists in the heap.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport {takeNodeMinimalHeap} from '@memlab/core';\n\nclass TestObject {\n public arr1 = [1, 2, 3];\n public arr2 = ['1', '2', '3'];\n}\n\n(async function () {\n const obj = new TestObject();\n // get a heap snapshot of the current program state\n const heap: IHeapSnapshot = await takeNodeMinimalHeap();\n\n const node = heap.getAnyObjectWithClassName('TestObject');\n console.log(node?.name); // should be 'TestObject'\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1473"},"core/src/lib/Types.ts:1473"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"getnodebyidid"},(0,r.yg)("a",{id:"getnodebyid"}),(0,r.yg)("strong",{parentName:"h3"},"getNodeById"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"id"),")"),(0,r.yg)("p",null,"If you have the id of a heap node (JS object in heap), use this API\nto get an ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},"IHeapNode")," associated with the id."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"id"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"number")," | id of the heap node (JS object in heap) you would like to query"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,r.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | the API returns ",(0,r.yg)("inlineCode",{parentName:"p"},"null")," if no heap object has the specified id.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n const node = heap.getNodeById(351);\n node?.id; // should be 351\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1354"},"core/src/lib/Types.ts:1354"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"getnodesbyidsetids"},(0,r.yg)("a",{id:"getnodesbyidset"}),(0,r.yg)("strong",{parentName:"h3"},"getNodesByIdSet"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"ids"),")"),(0,r.yg)("p",null,"Given a set of ids of heap nodes (JS objects in heap), use this API\nto get a set of those heap nodes."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"ids"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"Set"),"<",(0,r.yg)("inlineCode",{parentName:"li"},"number"),">"," | id set of the heap nodes (JS objects in heap) you would like to query"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"Set"),"<",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | a set of those heap nodes. The set will only include\nnodes that are found in the heap. If none of the input ids are found,\nthis API will return an empty set.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n // suppose 1000 is not a valid id in the heap\n const set = heap.getNodesByIdSet(new Set([1, 2, 1000, 3]));\n set // should be Set([node1, node2, node3])\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1406"},"core/src/lib/Types.ts:1406"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"getnodesbyidsids"},(0,r.yg)("a",{id:"getnodesbyids"}),(0,r.yg)("strong",{parentName:"h3"},"getNodesByIds"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"ids"),")"),(0,r.yg)("p",null,"Given an array of ids of heap nodes (JS objects in heap), use this API\nto get an array of those heap nodes."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"ids"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"number"),"[] | id array of the heap nodes (JS objects in heap) you would like to query"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,r.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,r.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">","[] | an array of those heap nodes. The return array will preserve the\norder of the input array. If an id is not found in the heap, the\ncorresponding element in the return array will be ",(0,r.yg)("inlineCode",{parentName:"p"},"null"),".")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n // suppose 1000 is not a valid id in the heap\n const nodes = heap.getNodesByIds([1, 2, 1000, 3]);\n nodes // should be [node1, node2, null, node3]\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1380"},"core/src/lib/Types.ts:1380"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"hasobjectwithclassnameclassname"},(0,r.yg)("a",{id:"hasobjectwithclassname"}),(0,r.yg)("strong",{parentName:"h3"},"hasObjectWithClassName"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"className"),")"),(0,r.yg)("p",null,"Search for the heap and check if there is any JS object instance with\na specified constructor name."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"className"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | The constructor name of the object instance"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"boolean")," | ",(0,r.yg)("inlineCode",{parentName:"p"},"true")," if there is at least one such object in the heap")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),": you can write a jest unit test with memory assertions:"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"// save as example.test.ts\nimport type {IHeapSnapshot, Nullable} from '@memlab/core';\nimport {config, takeNodeMinimalHeap} from '@memlab/core';\n\nclass TestObject {\n public arr1 = [1, 2, 3];\n public arr2 = ['1', '2', '3'];\n}\n\ntest('memory test with heap assertion', async () => {\n config.muteConsole = true; // no console output\n\n let obj: Nullable = new TestObject();\n // get a heap snapshot of the current program state\n let heap: IHeapSnapshot = await takeNodeMinimalHeap();\n\n // call some function that may add references to obj\n rabbitHole(obj)\n\n expect(heap.hasObjectWithClassName('TestObject')).toBe(true);\n obj = null;\n\n heap = await takeNodeMinimalHeap();\n // if rabbitHole does not have any side effect that\n // adds new references to obj, then obj can be GCed\n expect(heap.hasObjectWithClassName('TestObject')).toBe(false);\n\n}, 30000);\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1445"},"core/src/lib/Types.ts:1445"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"hasobjectwithpropertynamenameorindex"},(0,r.yg)("a",{id:"hasobjectwithpropertyname"}),(0,r.yg)("strong",{parentName:"h3"},"hasObjectWithPropertyName"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"nameOrIndex"),")"),(0,r.yg)("p",null,"Search for the heap and check if there is any JS object instance with\na specified property name."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"nameOrIndex"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," ","|"," ",(0,r.yg)("inlineCode",{parentName:"li"},"number")," | The property name (string) or element index (number) on the object instance"))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"p"},"boolean")," | returns ",(0,r.yg)("inlineCode",{parentName:"p"},"true")," if there is at least one such object in the heap")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const object = {'memlab-test-heap-property': 'memlab-test-heap-value'};\n\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n // should be true\n console.log(heap.hasObjectWithPropertyName('memlab-test-heap-property'));\n})();\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1499"},"core/src/lib/Types.ts:1499"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"hasobjectwithtagtag"},(0,r.yg)("a",{id:"hasobjectwithtag"}),(0,r.yg)("strong",{parentName:"h3"},"hasObjectWithTag"),"(",(0,r.yg)("inlineCode",{parentName:"h3"},"tag"),")"),(0,r.yg)("p",null,"Search for the heap and check if there is any JS object instance with\na marker tagged by ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#tagobject"},"tagObject"),"."),(0,r.yg)("p",null,"The ",(0,r.yg)("inlineCode",{parentName:"p"},"tagObject")," API does not modify the object instance in any way\n(e.g., no additional or hidden properties added to the tagged object)."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Parameters"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"tag"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | marker name on the object instances tagged by ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#tagobject"},"tagObject")))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"boolean")," | returns ",(0,r.yg)("inlineCode",{parentName:"li"},"true")," if there is at least one such object in the heap")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot, AnyValue} from '@memlab/core';\nimport {config, takeNodeMinimalHeap, tagObject} from '@memlab/core';\n\ntest('memory test', async () => {\n config.muteConsole = true;\n const o1: AnyValue = {};\n let o2: AnyValue = {};\n\n // tag o1 with marker: \"memlab-mark-1\", does not modify o1 in any way\n tagObject(o1, 'memlab-mark-1');\n // tag o2 with marker: \"memlab-mark-2\", does not modify o2 in any way\n tagObject(o2, 'memlab-mark-2');\n\n o2 = null;\n\n const heap: IHeapSnapshot = await takeNodeMinimalHeap();\n\n // expect object with marker \"memlab-mark-1\" exists\n expect(heap.hasObjectWithTag('memlab-mark-1')).toBe(true);\n\n // expect object with marker \"memlab-mark-2\" can be GCed\n expect(heap.hasObjectWithTag('memlab-mark-2')).toBe(false);\n\n}, 30000);\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1537"},"core/src/lib/Types.ts:1537"))))))}g.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e012388a.6146abb3.js b/assets/js/e012388a.341930e2.js similarity index 92% rename from assets/js/e012388a.6146abb3.js rename to assets/js/e012388a.341930e2.js index 5c9156b5..ba555bc0 100644 --- a/assets/js/e012388a.6146abb3.js +++ b/assets/js/e012388a.341930e2.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[8953],{5680:(e,a,n)=>{n.d(a,{xA:()=>c,yg:()=>y});var r=n(6540);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function o(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);a&&(r=r.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var a=1;a=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var p=r.createContext({}),s=function(e){var a=r.useContext(p),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},c=function(e){var a=s(e.components);return r.createElement(p.Provider,{value:a},e.children)},d="mdxType",m={inlineCode:"code",wrapper:function(e){var a=e.children;return r.createElement(r.Fragment,{},a)}},g=r.forwardRef((function(e,a){var n=e.components,t=e.mdxType,o=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),d=s(n),g=t,y=d["".concat(p,".").concat(g)]||d[g]||m[g]||o;return n?r.createElement(y,l(l({ref:a},c),{},{components:n})):r.createElement(y,l({ref:a},c))}));function y(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var o=n.length,l=new Array(o);l[0]=g;var i={};for(var p in a)hasOwnProperty.call(a,p)&&(i[p]=a[p]);i.originalType=e,i[d]="string"==typeof e?e:t,l[1]=i;for(var s=2;s{n.r(a),n.d(a,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>o,metadata:()=>i,toc:()=>s});var r=n(8168),t=(n(6540),n(5680));const o={id:"core_src.IHeapNodes",title:"Interface: IHeapNodes",sidebar_label:"IHeapNodes",custom_edit_url:null},l=void 0,i={unversionedId:"api/interfaces/core_src.IHeapNodes",id:"api/interfaces/core_src.IHeapNodes",title:"Interface: IHeapNodes",description:"A pseudo array containing all heap graph nodes (JS objects",source:"@site/docs/api/interfaces/core_src.IHeapNodes.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/core_src.IHeapNodes",permalink:"/memlab/docs/api/interfaces/core_src.IHeapNodes",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"core_src.IHeapNodes",title:"Interface: IHeapNodes",sidebar_label:"IHeapNodes",custom_edit_url:null},sidebar:"sidebar",previous:{title:"IHeapNode",permalink:"/memlab/docs/api/interfaces/core_src.IHeapNode"},next:{title:"IHeapSnapshot",permalink:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"}},p={},s=[{value:"Properties",id:"properties",level:2},{value:' length: number',id:"-length-number",level:3},{value:"Methods",id:"methods",level:2},{value:'forEach(callback)',id:"foreachcallback",level:3},{value:'get(index)',id:"getindex",level:3}],c={toc:s},d="wrapper";function m(e){let{components:a,...n}=e;return(0,t.yg)(d,(0,r.A)({},c,n,{components:a,mdxType:"MDXLayout"}),(0,t.yg)("p",null,"A pseudo array containing all heap graph nodes (JS objects\nin heap). A JS heap could contain millions of objects, so memlab uses\na pseudo array as the collection of all the heap nodes. The pseudo\narray provides API to query and traverse all heap objects."),(0,t.yg)("p",null,(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"readonly"))," modifying this pseudo array is not recommended"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples"),":")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot, IHeapNodes} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n const nodes: IHeapNodes = heap.nodes;\n nodes.length;\n nodes.get(0);\n nodes.forEach((node, i) => {\n if (stopIteration) {\n return false;\n }\n });\n})();\n")),(0,t.yg)("h2",{id:"properties"},"Properties"),(0,t.yg)("h3",{id:"-length-number"},(0,t.yg)("a",{id:"length",name:"length"})," ",(0,t.yg)("strong",{parentName:"h3"},"length"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"The total number of nodes in heap graph (or JS objects in heap\nsnapshot)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2263"},"core/src/lib/Types.ts:2263"))))),(0,t.yg)("h2",{id:"methods"},"Methods"),(0,t.yg)("h3",{id:"foreachcallback"},(0,t.yg)("a",{id:"foreach"}),(0,t.yg)("strong",{parentName:"h3"},"forEach"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"callback"),")"),(0,t.yg)("p",null,"Iterate over all array elements and apply the callback\nto each element in ascending order of element index."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"callback"),": (",(0,t.yg)("inlineCode",{parentName:"li"},"node"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),", ",(0,t.yg)("inlineCode",{parentName:"li"},"index"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"number"),") => ",(0,t.yg)("inlineCode",{parentName:"li"},"boolean")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"void")," | the callback does not need to return any value, if the callback returns ",(0,t.yg)("inlineCode",{parentName:"li"},"false")," when iterating on element at index ",(0,t.yg)("inlineCode",{parentName:"li"},"i"),", then all elements after ",(0,t.yg)("inlineCode",{parentName:"li"},"i")," won't be iterated."))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"void")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2279"},"core/src/lib/Types.ts:2279"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getindex"},(0,t.yg)("a",{id:"get"}),(0,t.yg)("strong",{parentName:"h3"},"get"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"index"),")"),(0,t.yg)("p",null,"get an ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},"IHeapNode")," element at the specified index"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"index"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the index of an element in the pseudo array, the index ranges from 0 to array length - 1. Notice that this is not the heap node id."))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | When 0 <= ",(0,t.yg)("inlineCode",{parentName:"p"},"index")," < array.length, this API returns the element\nat the specified index, otherwise it returns ",(0,t.yg)("inlineCode",{parentName:"p"},"null"),".")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Source"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L2271"},"core/src/lib/Types.ts:2271"))))))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[8953],{5680:(e,a,n)=>{n.d(a,{xA:()=>c,yg:()=>y});var r=n(6540);function t(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function o(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);a&&(r=r.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var a=1;a=0||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var p=r.createContext({}),s=function(e){var a=r.useContext(p),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},c=function(e){var a=s(e.components);return r.createElement(p.Provider,{value:a},e.children)},m="mdxType",d={inlineCode:"code",wrapper:function(e){var a=e.children;return r.createElement(r.Fragment,{},a)}},g=r.forwardRef((function(e,a){var n=e.components,t=e.mdxType,o=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),m=s(n),g=t,y=m["".concat(p,".").concat(g)]||m[g]||d[g]||o;return n?r.createElement(y,l(l({ref:a},c),{},{components:n})):r.createElement(y,l({ref:a},c))}));function y(e,a){var n=arguments,t=a&&a.mdxType;if("string"==typeof e||t){var o=n.length,l=new Array(o);l[0]=g;var i={};for(var p in a)hasOwnProperty.call(a,p)&&(i[p]=a[p]);i.originalType=e,i[m]="string"==typeof e?e:t,l[1]=i;for(var s=2;s{n.r(a),n.d(a,{assets:()=>p,contentTitle:()=>l,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>s});var r=n(8168),t=(n(6540),n(5680));const o={id:"core_src.IHeapNodes",title:"Interface: IHeapNodes",sidebar_label:"IHeapNodes",custom_edit_url:null},l=void 0,i={unversionedId:"api/interfaces/core_src.IHeapNodes",id:"api/interfaces/core_src.IHeapNodes",title:"Interface: IHeapNodes",description:"A pseudo array containing all heap graph nodes (JS objects",source:"@site/docs/api/interfaces/core_src.IHeapNodes.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/core_src.IHeapNodes",permalink:"/memlab/docs/api/interfaces/core_src.IHeapNodes",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"core_src.IHeapNodes",title:"Interface: IHeapNodes",sidebar_label:"IHeapNodes",custom_edit_url:null},sidebar:"sidebar",previous:{title:"IHeapNode",permalink:"/memlab/docs/api/interfaces/core_src.IHeapNode"},next:{title:"IHeapSnapshot",permalink:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"}},p={},s=[{value:"Properties",id:"properties",level:2},{value:' length: number',id:"-length-number",level:3},{value:"Methods",id:"methods",level:2},{value:'forEach(callback)',id:"foreachcallback",level:3},{value:'get(index)',id:"getindex",level:3}],c={toc:s},m="wrapper";function d(e){let{components:a,...n}=e;return(0,t.yg)(m,(0,r.A)({},c,n,{components:a,mdxType:"MDXLayout"}),(0,t.yg)("p",null,"A pseudo array containing all heap graph nodes (JS objects\nin heap). A JS heap could contain millions of objects, so memlab uses\na pseudo array as the collection of all the heap nodes. The pseudo\narray provides API to query and traverse all heap objects."),(0,t.yg)("p",null,(0,t.yg)("strong",{parentName:"p"},(0,t.yg)("inlineCode",{parentName:"strong"},"readonly"))," modifying this pseudo array is not recommended"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Examples"),":")),(0,t.yg)("pre",null,(0,t.yg)("code",{parentName:"pre",className:"language-typescript"},"import type {IHeapSnapshot, IHeapNodes} from '@memlab/core';\nimport {dumpNodeHeapSnapshot} from '@memlab/core';\nimport {getFullHeapFromFile} from '@memlab/heap-analysis';\n\n(async function () {\n const heapFile = dumpNodeHeapSnapshot();\n const heap: IHeapSnapshot = await getFullHeapFromFile(heapFile);\n\n const nodes: IHeapNodes = heap.nodes;\n nodes.length;\n nodes.get(0);\n nodes.forEach((node, i) => {\n if (stopIteration) {\n return false;\n }\n });\n})();\n")),(0,t.yg)("h2",{id:"properties"},"Properties"),(0,t.yg)("h3",{id:"-length-number"},(0,t.yg)("a",{id:"length",name:"length"})," ",(0,t.yg)("strong",{parentName:"h3"},"length"),": ",(0,t.yg)("inlineCode",{parentName:"h3"},"number")),(0,t.yg)("p",null,"The total number of nodes in heap graph (or JS objects in heap\nsnapshot)."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2263"},"core/src/lib/Types.ts:2263"))))),(0,t.yg)("h2",{id:"methods"},"Methods"),(0,t.yg)("h3",{id:"foreachcallback"},(0,t.yg)("a",{id:"foreach"}),(0,t.yg)("strong",{parentName:"h3"},"forEach"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"callback"),")"),(0,t.yg)("p",null,"Iterate over all array elements and apply the callback\nto each element in ascending order of element index."),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Parameters"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"callback"),": (",(0,t.yg)("inlineCode",{parentName:"li"},"node"),": ",(0,t.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),", ",(0,t.yg)("inlineCode",{parentName:"li"},"index"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"number"),") => ",(0,t.yg)("inlineCode",{parentName:"li"},"boolean")," ","|"," ",(0,t.yg)("inlineCode",{parentName:"li"},"void")," | the callback does not need to return any value, if the callback returns ",(0,t.yg)("inlineCode",{parentName:"li"},"false")," when iterating on element at index ",(0,t.yg)("inlineCode",{parentName:"li"},"i"),", then all elements after ",(0,t.yg)("inlineCode",{parentName:"li"},"i")," won't be iterated."))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Returns"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"void")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("strong",{parentName:"li"},"Source"),":",(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2279"},"core/src/lib/Types.ts:2279"))))),(0,t.yg)("hr",null),(0,t.yg)("h3",{id:"getindex"},(0,t.yg)("a",{id:"get"}),(0,t.yg)("strong",{parentName:"h3"},"get"),"(",(0,t.yg)("inlineCode",{parentName:"h3"},"index"),")"),(0,t.yg)("p",null,"get an ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},"IHeapNode")," element at the specified index"),(0,t.yg)("ul",null,(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("inlineCode",{parentName:"li"},"index"),": ",(0,t.yg)("inlineCode",{parentName:"li"},"number")," | the index of an element in the pseudo array, the index ranges from 0 to array length - 1. Notice that this is not the heap node id."))),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Returns"),": ",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/core_src#nullable"},(0,t.yg)("inlineCode",{parentName:"a"},"Nullable")),"<",(0,t.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},(0,t.yg)("inlineCode",{parentName:"a"},"IHeapNode")),">"," | When 0 <= ",(0,t.yg)("inlineCode",{parentName:"p"},"index")," < array.length, this API returns the element\nat the specified index, otherwise it returns ",(0,t.yg)("inlineCode",{parentName:"p"},"null"),".")),(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("p",{parentName:"li"},(0,t.yg)("strong",{parentName:"p"},"Source"),":"),(0,t.yg)("ul",{parentName:"li"},(0,t.yg)("li",{parentName:"ul"},(0,t.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L2271"},"core/src/lib/Types.ts:2271"))))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e4c6f3cc.d050fdd8.js b/assets/js/e4c6f3cc.e363ffaf.js similarity index 97% rename from assets/js/e4c6f3cc.d050fdd8.js rename to assets/js/e4c6f3cc.e363ffaf.js index 20714554..80b71ba8 100644 --- a/assets/js/e4c6f3cc.d050fdd8.js +++ b/assets/js/e4c6f3cc.e363ffaf.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[9600],{5680:(e,a,n)=>{n.d(a,{xA:()=>y,yg:()=>g});var t=n(6540);function s(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function r(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function l(e){for(var a=1;a=0||(s[n]=e[n]);return s}(e,a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var o=t.createContext({}),p=function(e){var a=t.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},y=function(e){var a=p(e.components);return t.createElement(o.Provider,{value:a},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},h=t.forwardRef((function(e,a){var n=e.components,s=e.mdxType,r=e.originalType,o=e.parentName,y=i(e,["components","mdxType","originalType","parentName"]),u=p(n),h=s,g=u["".concat(o,".").concat(h)]||u[h]||c[h]||r;return n?t.createElement(g,l(l({ref:a},y),{},{components:n})):t.createElement(g,l({ref:a},y))}));function g(e,a){var n=arguments,s=a&&a.mdxType;if("string"==typeof e||s){var r=n.length,l=new Array(r);l[0]=h;var i={};for(var o in a)hasOwnProperty.call(a,o)&&(i[o]=a[o]);i.originalType=e,i[u]="string"==typeof e?e:s,l[1]=i;for(var p=2;p{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>l,default:()=>c,frontMatter:()=>r,metadata:()=>i,toc:()=>p});var t=n(8168),s=(n(6540),n(5680));const r={id:"heap_analysis_src.ShapeUnboundGrowthAnalysis",title:"Class: ShapeUnboundGrowthAnalysis",sidebar_label:"ShapeUnboundGrowthAnalysis",custom_edit_url:null},l=void 0,i={unversionedId:"api/classes/heap_analysis_src.ShapeUnboundGrowthAnalysis",id:"api/classes/heap_analysis_src.ShapeUnboundGrowthAnalysis",title:"Class: ShapeUnboundGrowthAnalysis",description:"Hierarchy",source:"@site/docs/api/classes/heap_analysis_src.ShapeUnboundGrowthAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.ShapeUnboundGrowthAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ShapeUnboundGrowthAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.ShapeUnboundGrowthAnalysis",title:"Class: ShapeUnboundGrowthAnalysis",sidebar_label:"ShapeUnboundGrowthAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"ObjectUnboundGrowthAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectUnboundGrowthAnalysis"},next:{title:"StringAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.StringAnalysis"}},o={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new ShapeUnboundGrowthAnalysis()',id:"new-shapeunboundgrowthanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotsInDirectory(directory, options?)',id:"analyzesnapshotsindirectorydirectory-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3},{value:'getShapesWithUnboundGrowth()',id:"getshapeswithunboundgrowth",level:3}],y={toc:p},u="wrapper";function c(e){let{components:a,...n}=e;return(0,s.yg)(u,(0,t.A)({},y,n,{components:a,mdxType:"MDXLayout"}),(0,s.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},(0,s.yg)("inlineCode",{parentName:"a"},"BaseAnalysis"))),(0,s.yg)("p",{parentName:"li"},"\u21b3 ",(0,s.yg)("strong",{parentName:"p"},(0,s.yg)("inlineCode",{parentName:"strong"},"ShapeUnboundGrowthAnalysis"))))),(0,s.yg)("h2",{id:"constructors"},"Constructors"),(0,s.yg)("h3",{id:"new-shapeunboundgrowthanalysis"},(0,s.yg)("a",{id:"new shapeunboundgrowthanalysis"}),(0,s.yg)("strong",{parentName:"h3"},"new ShapeUnboundGrowthAnalysis"),"()"),(0,s.yg)("h2",{id:"methods"},"Methods"),(0,s.yg)("h3",{id:"analyzesnapshotsindirectorydirectory-options"},(0,s.yg)("a",{id:"analyzesnapshotsindirectory"}),(0,s.yg)("strong",{parentName:"h3"},"analyzeSnapshotsInDirectory"),"(",(0,s.yg)("inlineCode",{parentName:"h3"},"directory"),", ",(0,s.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,s.yg)("p",null,"Run heap analysis for a series of heap snapshot files"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Parameters"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"directory"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of the directory holding a series of ",(0,s.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," files, all snapshot files will be loaded and analyzed in the alphanumerically ascending order of those snapshot file names."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,s.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,s.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Example"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new ShapeUnboundGrowthAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotsInDirectory(snapshotDirectory);\n// query analysis-specific and structured results\nconst shapes = analysis.getShapesWithUnboundGrowth();\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new ShapeUnboundGrowthAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotsInDirectory(snapshotDirectory, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/BaseAnalysis.ts#L148"},"heap-analysis/src/BaseAnalysis.ts:148"))))),(0,s.yg)("hr",null),(0,s.yg)("h3",{id:"getcommandname"},(0,s.yg)("a",{id:"getcommandname"}),(0,s.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,s.yg)("p",null,"Get the name of the heap analysis, which is also used to reference\nthe analysis in memlab command-line tool."),(0,s.yg)("p",null,"The following terminal command will initiate with this analysis:\n",(0,s.yg)("inlineCode",{parentName:"p"},"memlab analyze ")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the name of the analysis"),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Examples"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new YourAnalysis();\nconst name = analysis.getCommandName();\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/plugins/ShapeUnboundGrowthAnalysis.ts#L43"},"heap-analysis/src/plugins/ShapeUnboundGrowthAnalysis.ts:43"))))),(0,s.yg)("hr",null),(0,s.yg)("h3",{id:"getshapeswithunboundgrowth"},(0,s.yg)("a",{id:"getshapeswithunboundgrowth"}),(0,s.yg)("strong",{parentName:"h3"},"getShapesWithUnboundGrowth"),"()"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"ShapeSummary"),"[]"),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/plugins/ShapeUnboundGrowthAnalysis.ts#L71"},"heap-analysis/src/plugins/ShapeUnboundGrowthAnalysis.ts:71"))))))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[9600],{5680:(e,a,n)=>{n.d(a,{xA:()=>y,yg:()=>g});var t=n(6540);function s(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function r(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function l(e){for(var a=1;a=0||(s[n]=e[n]);return s}(e,a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var o=t.createContext({}),p=function(e){var a=t.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):l(l({},a),e)),n},y=function(e){var a=p(e.components);return t.createElement(o.Provider,{value:a},e.children)},u="mdxType",c={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},h=t.forwardRef((function(e,a){var n=e.components,s=e.mdxType,r=e.originalType,o=e.parentName,y=i(e,["components","mdxType","originalType","parentName"]),u=p(n),h=s,g=u["".concat(o,".").concat(h)]||u[h]||c[h]||r;return n?t.createElement(g,l(l({ref:a},y),{},{components:n})):t.createElement(g,l({ref:a},y))}));function g(e,a){var n=arguments,s=a&&a.mdxType;if("string"==typeof e||s){var r=n.length,l=new Array(r);l[0]=h;var i={};for(var o in a)hasOwnProperty.call(a,o)&&(i[o]=a[o]);i.originalType=e,i[u]="string"==typeof e?e:s,l[1]=i;for(var p=2;p{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>l,default:()=>c,frontMatter:()=>r,metadata:()=>i,toc:()=>p});var t=n(8168),s=(n(6540),n(5680));const r={id:"heap_analysis_src.ShapeUnboundGrowthAnalysis",title:"Class: ShapeUnboundGrowthAnalysis",sidebar_label:"ShapeUnboundGrowthAnalysis",custom_edit_url:null},l=void 0,i={unversionedId:"api/classes/heap_analysis_src.ShapeUnboundGrowthAnalysis",id:"api/classes/heap_analysis_src.ShapeUnboundGrowthAnalysis",title:"Class: ShapeUnboundGrowthAnalysis",description:"Hierarchy",source:"@site/docs/api/classes/heap_analysis_src.ShapeUnboundGrowthAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.ShapeUnboundGrowthAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ShapeUnboundGrowthAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.ShapeUnboundGrowthAnalysis",title:"Class: ShapeUnboundGrowthAnalysis",sidebar_label:"ShapeUnboundGrowthAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"ObjectUnboundGrowthAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectUnboundGrowthAnalysis"},next:{title:"StringAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.StringAnalysis"}},o={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new ShapeUnboundGrowthAnalysis()',id:"new-shapeunboundgrowthanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotsInDirectory(directory, options?)',id:"analyzesnapshotsindirectorydirectory-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3},{value:'getShapesWithUnboundGrowth()',id:"getshapeswithunboundgrowth",level:3}],y={toc:p},u="wrapper";function c(e){let{components:a,...n}=e;return(0,s.yg)(u,(0,t.A)({},y,n,{components:a,mdxType:"MDXLayout"}),(0,s.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},(0,s.yg)("inlineCode",{parentName:"a"},"BaseAnalysis"))),(0,s.yg)("p",{parentName:"li"},"\u21b3 ",(0,s.yg)("strong",{parentName:"p"},(0,s.yg)("inlineCode",{parentName:"strong"},"ShapeUnboundGrowthAnalysis"))))),(0,s.yg)("h2",{id:"constructors"},"Constructors"),(0,s.yg)("h3",{id:"new-shapeunboundgrowthanalysis"},(0,s.yg)("a",{id:"new shapeunboundgrowthanalysis"}),(0,s.yg)("strong",{parentName:"h3"},"new ShapeUnboundGrowthAnalysis"),"()"),(0,s.yg)("h2",{id:"methods"},"Methods"),(0,s.yg)("h3",{id:"analyzesnapshotsindirectorydirectory-options"},(0,s.yg)("a",{id:"analyzesnapshotsindirectory"}),(0,s.yg)("strong",{parentName:"h3"},"analyzeSnapshotsInDirectory"),"(",(0,s.yg)("inlineCode",{parentName:"h3"},"directory"),", ",(0,s.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,s.yg)("p",null,"Run heap analysis for a series of heap snapshot files"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Parameters"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"directory"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of the directory holding a series of ",(0,s.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," files, all snapshot files will be loaded and analyzed in the alphanumerically ascending order of those snapshot file names."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,s.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,s.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Example"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new ShapeUnboundGrowthAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotsInDirectory(snapshotDirectory);\n// query analysis-specific and structured results\nconst shapes = analysis.getShapesWithUnboundGrowth();\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new ShapeUnboundGrowthAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotsInDirectory(snapshotDirectory, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/BaseAnalysis.ts#L148"},"heap-analysis/src/BaseAnalysis.ts:148"))))),(0,s.yg)("hr",null),(0,s.yg)("h3",{id:"getcommandname"},(0,s.yg)("a",{id:"getcommandname"}),(0,s.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,s.yg)("p",null,"Get the name of the heap analysis, which is also used to reference\nthe analysis in memlab command-line tool."),(0,s.yg)("p",null,"The following terminal command will initiate with this analysis:\n",(0,s.yg)("inlineCode",{parentName:"p"},"memlab analyze ")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the name of the analysis"),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Examples"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new YourAnalysis();\nconst name = analysis.getCommandName();\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/plugins/ShapeUnboundGrowthAnalysis.ts#L43"},"heap-analysis/src/plugins/ShapeUnboundGrowthAnalysis.ts:43"))))),(0,s.yg)("hr",null),(0,s.yg)("h3",{id:"getshapeswithunboundgrowth"},(0,s.yg)("a",{id:"getshapeswithunboundgrowth"}),(0,s.yg)("strong",{parentName:"h3"},"getShapesWithUnboundGrowth"),"()"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"ShapeSummary"),"[]"),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/plugins/ShapeUnboundGrowthAnalysis.ts#L71"},"heap-analysis/src/plugins/ShapeUnboundGrowthAnalysis.ts:71"))))))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f40f92ec.613fb13e.js b/assets/js/f40f92ec.f5f4649c.js similarity index 95% rename from assets/js/f40f92ec.613fb13e.js rename to assets/js/f40f92ec.f5f4649c.js index 0e657253..4f29e136 100644 --- a/assets/js/f40f92ec.613fb13e.js +++ b/assets/js/f40f92ec.f5f4649c.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[346],{5680:(e,t,a)=>{a.d(t,{xA:()=>u,yg:()=>d});var r=a(6540);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function s(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var i=r.createContext({}),p=function(e){var t=r.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},u=function(e){var t=p(e.components);return r.createElement(i.Provider,{value:t},e.children)},g="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,l=e.originalType,i=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),g=p(a),m=n,d=g["".concat(i,".").concat(m)]||g[m]||c[m]||l;return a?r.createElement(d,s(s({ref:t},u),{},{components:a})):r.createElement(d,s({ref:t},u))}));function d(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=a.length,s=new Array(l);s[0]=m;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[g]="string"==typeof e?e:n,s[1]=o;for(var p=2;p{a.r(t),a.d(t,{assets:()=>i,contentTitle:()=>s,default:()=>c,frontMatter:()=>l,metadata:()=>o,toc:()=>p});var r=a(8168),n=(a(6540),a(5680));const l={id:"api_src.BrowserInteractionResultReader",title:"Class: BrowserInteractionResultReader",sidebar_label:"BrowserInteractionResultReader",custom_edit_url:null},s=void 0,o={unversionedId:"api/classes/api_src.BrowserInteractionResultReader",id:"api/classes/api_src.BrowserInteractionResultReader",title:"Class: BrowserInteractionResultReader",description:"A utility entity to read all generated files from",source:"@site/docs/api/classes/api_src.BrowserInteractionResultReader.md",sourceDirName:"api/classes",slug:"/api/classes/api_src.BrowserInteractionResultReader",permalink:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"api_src.BrowserInteractionResultReader",title:"Class: BrowserInteractionResultReader",sidebar_label:"BrowserInteractionResultReader",custom_edit_url:null},sidebar:"sidebar",previous:{title:"ConsoleMode",permalink:"/memlab/docs/api/enums/api_src.ConsoleMode"},next:{title:"SnapshotResultReader",permalink:"/memlab/docs/api/classes/api_src.SnapshotResultReader"}},i={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Methods",id:"methods",level:2},{value:'cleanup()',id:"cleanup",level:3},{value:'getConsoleBackupFile()',id:"getconsolebackupfile",level:3},{value:'getInteractionSteps()',id:"getinteractionsteps",level:3},{value:'getRootDirectory()',id:"getrootdirectory",level:3},{value:'getRunMetaInfo()',id:"getrunmetainfo",level:3},{value:'getSnapshotFileDir()',id:"getsnapshotfiledir",level:3},{value:'getSnapshotFiles()',id:"getsnapshotfiles",level:3},{value:'Static from(workDir?)',id:"static-fromworkdir",level:3}],u={toc:p},g="wrapper";function c(e){let{components:t,...a}=e;return(0,n.yg)(g,(0,r.A)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,n.yg)("p",null,"A utility entity to read all generated files from\nthe directory holding the data and results from the\nlast MemLab browser interaction run"),(0,n.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("p",{parentName:"li"},(0,n.yg)("inlineCode",{parentName:"p"},"default")),(0,n.yg)("p",{parentName:"li"},"\u21b3 ",(0,n.yg)("strong",{parentName:"p"},(0,n.yg)("inlineCode",{parentName:"strong"},"BrowserInteractionResultReader"))))),(0,n.yg)("h2",{id:"methods"},"Methods"),(0,n.yg)("h3",{id:"cleanup"},(0,n.yg)("a",{id:"cleanup"}),(0,n.yg)("strong",{parentName:"h3"},"cleanup"),"()"),(0,n.yg)("p",null,"clean up data/files generated from the memlab browser interaction run"),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Returns"),": ",(0,n.yg)("inlineCode",{parentName:"li"},"void")," | no return value"),(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Examples"),":")),(0,n.yg)("pre",null,(0,n.yg)("code",{parentName:"pre",className:"language-javascript"},"const {takeSnapshots} = require('@memlab/api');\n\n(async function () {\n const scenario = { url: () => 'https://www.npmjs.com'};\n const result = await takeSnapshots({scenario});\n\n // delete all data/files generated by takeSnapshots\n result.cleanup();\n})();\n")),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Source"),":",(0,n.yg)("ul",{parentName:"li"},(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/result-reader/BaseResultReader.ts#L122"},"api/src/result-reader/BaseResultReader.ts:122"))))),(0,n.yg)("hr",null),(0,n.yg)("h3",{id:"getconsolebackupfile"},(0,n.yg)("a",{id:"getconsolebackupfile"}),(0,n.yg)("strong",{parentName:"h3"},"getConsoleBackupFile"),"()"),(0,n.yg)("p",null,"This method gets the backup file of the console output."),(0,n.yg)("p",null,"The memlab CLI commands (e.g., ",(0,n.yg)("inlineCode",{parentName:"p"},"memlab find-leaks"),") outputs a\nnon-structured string representation for easy reading, while the\nAPIs (e.g., ",(0,n.yg)("code",null,(0,n.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#findleaks"},"findLeaks")),") return structured leaks\nrepresentation that is handy for post-processing. If you need to\nobtain all the string output from the CLI in the current working directory,\nyou can read them from the CLI output backup file returned by this method."),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Returns"),": ",(0,n.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of the backup file"),(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Examples"),":")),(0,n.yg)("pre",null,(0,n.yg)("code",{parentName:"pre",className:"language-javascript"},"const {takeSnapshots, findLeaks} = require('@memlab/api');\n\n(async function () {\n const scenario = { url: () => 'https://www.npmjs.com'};\n const result = await takeSnapshots({scenario});\n const leaks = await findLeaks(result);\n\n // get the console output backup file\n const consoleBackupFile = result.getConsoleBackupFile();\n})();\n")),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Source"),":",(0,n.yg)("ul",{parentName:"li"},(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/result-reader/BaseResultReader.ts#L102"},"api/src/result-reader/BaseResultReader.ts:102"))))),(0,n.yg)("hr",null),(0,n.yg)("h3",{id:"getinteractionsteps"},(0,n.yg)("a",{id:"getinteractionsteps"}),(0,n.yg)("strong",{parentName:"h3"},"getInteractionSteps"),"()"),(0,n.yg)("p",null,"browser interaction step sequence"),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Returns"),": ",(0,n.yg)("inlineCode",{parentName:"li"},"E2EStepInfo"),"[] | an array of browser interaction step information"),(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Examples"),":")),(0,n.yg)("pre",null,(0,n.yg)("code",{parentName:"pre",className:"language-javascript"},"const {takeSnapshots} = require('@memlab/api');\n\n(async function () {\n const scenario = { url: () => 'https://www.npmjs.com'};\n const result = await takeSnapshots({scenario});\n\n const steps = result.getInteractionSteps();\n // print each browser interaction's name and JavaScript heap size (in bytes)\n steps.forEach(step => console.log(step.name, step.JSHeapUsedSize))\n})();\n")),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Source"),":",(0,n.yg)("ul",{parentName:"li"},(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/result-reader/BrowserInteractionResultReader.ts#L106"},"api/src/result-reader/BrowserInteractionResultReader.ts:106"))))),(0,n.yg)("hr",null),(0,n.yg)("h3",{id:"getrootdirectory"},(0,n.yg)("a",{id:"getrootdirectory"}),(0,n.yg)("strong",{parentName:"h3"},"getRootDirectory"),"()"),(0,n.yg)("p",null,"get the directory where the data and generated files of\nthe memlab run were stored"),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Returns"),": ",(0,n.yg)("inlineCode",{parentName:"li"},"string")," | absolute path of the directory"),(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Examples"),":")),(0,n.yg)("pre",null,(0,n.yg)("code",{parentName:"pre",className:"language-javascript"},"const {takeSnapshots} = require('@memlab/api');\n\n(async function () {\n const scenario = { url: () => 'https://www.npmjs.com'};\n const result = await takeSnapshots({scenario});\n\n // get the directory that stores all the files\n // generated from the takeSnapshots call\n const dataDir = result.getRootDirectory();\n})();\n")),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Source"),":",(0,n.yg)("ul",{parentName:"li"},(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/result-reader/BaseResultReader.ts#L72"},"api/src/result-reader/BaseResultReader.ts:72"))))),(0,n.yg)("hr",null),(0,n.yg)("h3",{id:"getrunmetainfo"},(0,n.yg)("a",{id:"getrunmetainfo"}),(0,n.yg)("strong",{parentName:"h3"},"getRunMetaInfo"),"()"),(0,n.yg)("p",null,"general meta data of the browser interaction run"),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Returns"),": ",(0,n.yg)("inlineCode",{parentName:"li"},"RunMetaInfo")," | meta data about the entire browser interaction"),(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Examples"),":")),(0,n.yg)("pre",null,(0,n.yg)("code",{parentName:"pre",className:"language-javascript"},"const {takeSnapshots} = require('@memlab/api');\n\n(async function () {\n const scenario = { url: () => 'https://www.npmjs.com'};\n const result = await takeSnapshots({scenario});\n\n const metaInfo = result.getRunMetaInfo();\n // print all browser web console output\n console.log(metaInfo.browserInfo._consoleMessages.join('\\n'));\n})();\n")),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Source"),":",(0,n.yg)("ul",{parentName:"li"},(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/result-reader/BrowserInteractionResultReader.ts#L131"},"api/src/result-reader/BrowserInteractionResultReader.ts:131"))))),(0,n.yg)("hr",null),(0,n.yg)("h3",{id:"getsnapshotfiledir"},(0,n.yg)("a",{id:"getsnapshotfiledir"}),(0,n.yg)("strong",{parentName:"h3"},"getSnapshotFileDir"),"()"),(0,n.yg)("p",null,"get the directory holding all snapshot files"),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Returns"),": ",(0,n.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of the directory"),(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Examples"),":")),(0,n.yg)("pre",null,(0,n.yg)("code",{parentName:"pre",className:"language-javascript"},"const {takeSnapshots} = require('@memlab/api');\n\n(async function () {\n const scenario = { url: () => 'https://www.npmjs.com'};\n const result = await takeSnapshots({scenario});\n\n // get the absolute path the directory holding all snapshot files\n const files = result.getSnapshotFileDir();\n})();\n")),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Source"),":",(0,n.yg)("ul",{parentName:"li"},(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/result-reader/BrowserInteractionResultReader.ts#L84"},"api/src/result-reader/BrowserInteractionResultReader.ts:84"))))),(0,n.yg)("hr",null),(0,n.yg)("h3",{id:"getsnapshotfiles"},(0,n.yg)("a",{id:"getsnapshotfiles"}),(0,n.yg)("strong",{parentName:"h3"},"getSnapshotFiles"),"()"),(0,n.yg)("p",null,"get all snapshot files generated from last memlab browser interaction"),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Returns"),": ",(0,n.yg)("inlineCode",{parentName:"li"},"string"),"[] | an array of snapshot file's absolute path"),(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Examples"),":")),(0,n.yg)("pre",null,(0,n.yg)("code",{parentName:"pre",className:"language-javascript"},"const {takeSnapshots} = require('@memlab/api');\n\n(async function () {\n const scenario = { url: () => 'https://www.npmjs.com'};\n const result = await takeSnapshots({scenario});\n\n // get absolute paths of all snapshot files\n const files = result.getSnapshotFiles();\n})();\n")),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Source"),":",(0,n.yg)("ul",{parentName:"li"},(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/result-reader/BrowserInteractionResultReader.ts#L59"},"api/src/result-reader/BrowserInteractionResultReader.ts:59"))))),(0,n.yg)("hr",null),(0,n.yg)("h3",{id:"static-fromworkdir"},(0,n.yg)("a",{id:"from"}),(0,n.yg)("inlineCode",{parentName:"h3"},"Static")," ",(0,n.yg)("strong",{parentName:"h3"},"from"),"(",(0,n.yg)("inlineCode",{parentName:"h3"},"workDir?"),")"),(0,n.yg)("p",null,"build a result reader from a data directory where the data\nand generated files of a memlab run were stored"),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("p",{parentName:"li"},(0,n.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,n.yg)("ul",{parentName:"li"},(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("inlineCode",{parentName:"li"},"workDir"),": ",(0,n.yg)("inlineCode",{parentName:"li"},"string")," | ",(0,n.yg)("inlineCode",{parentName:"li"},"''")," | absolute path of the data directory"))),(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("p",{parentName:"li"},(0,n.yg)("strong",{parentName:"p"},"Returns"),": ",(0,n.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"},(0,n.yg)("inlineCode",{parentName:"a"},"BrowserInteractionResultReader"))," | the ResultReader instance")),(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("p",{parentName:"li"},(0,n.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,n.yg)("pre",null,(0,n.yg)("code",{parentName:"pre",className:"language-javascript"},"const {BrowserInteractionResultReader} = require('@memlab/api');\n\nconst dataDir = '/tmp/memlab'; // where the last memlab run stores results\nconst reader = BrowserInteractionResultReader.from(dataDir);\nreader.cleanup(); // clean up the results\n")),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Source"),":",(0,n.yg)("ul",{parentName:"li"},(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/api/src/result-reader/BrowserInteractionResultReader.ts#L39"},"api/src/result-reader/BrowserInteractionResultReader.ts:39"))))))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[346],{5680:(e,t,a)=>{a.d(t,{xA:()=>u,yg:()=>y});var r=a(6540);function n(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function s(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var i=r.createContext({}),p=function(e){var t=r.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},u=function(e){var t=p(e.components);return r.createElement(i.Provider,{value:t},e.children)},g="mdxType",c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var a=e.components,n=e.mdxType,l=e.originalType,i=e.parentName,u=o(e,["components","mdxType","originalType","parentName"]),g=p(a),m=n,y=g["".concat(i,".").concat(m)]||g[m]||c[m]||l;return a?r.createElement(y,s(s({ref:t},u),{},{components:a})):r.createElement(y,s({ref:t},u))}));function y(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var l=a.length,s=new Array(l);s[0]=m;var o={};for(var i in t)hasOwnProperty.call(t,i)&&(o[i]=t[i]);o.originalType=e,o[g]="string"==typeof e?e:n,s[1]=o;for(var p=2;p{a.r(t),a.d(t,{assets:()=>i,contentTitle:()=>s,default:()=>c,frontMatter:()=>l,metadata:()=>o,toc:()=>p});var r=a(8168),n=(a(6540),a(5680));const l={id:"api_src.BrowserInteractionResultReader",title:"Class: BrowserInteractionResultReader",sidebar_label:"BrowserInteractionResultReader",custom_edit_url:null},s=void 0,o={unversionedId:"api/classes/api_src.BrowserInteractionResultReader",id:"api/classes/api_src.BrowserInteractionResultReader",title:"Class: BrowserInteractionResultReader",description:"A utility entity to read all generated files from",source:"@site/docs/api/classes/api_src.BrowserInteractionResultReader.md",sourceDirName:"api/classes",slug:"/api/classes/api_src.BrowserInteractionResultReader",permalink:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"api_src.BrowserInteractionResultReader",title:"Class: BrowserInteractionResultReader",sidebar_label:"BrowserInteractionResultReader",custom_edit_url:null},sidebar:"sidebar",previous:{title:"ConsoleMode",permalink:"/memlab/docs/api/enums/api_src.ConsoleMode"},next:{title:"SnapshotResultReader",permalink:"/memlab/docs/api/classes/api_src.SnapshotResultReader"}},i={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Methods",id:"methods",level:2},{value:'cleanup()',id:"cleanup",level:3},{value:'getConsoleBackupFile()',id:"getconsolebackupfile",level:3},{value:'getInteractionSteps()',id:"getinteractionsteps",level:3},{value:'getRootDirectory()',id:"getrootdirectory",level:3},{value:'getRunMetaInfo()',id:"getrunmetainfo",level:3},{value:'getSnapshotFileDir()',id:"getsnapshotfiledir",level:3},{value:'getSnapshotFiles()',id:"getsnapshotfiles",level:3},{value:'Static from(workDir?)',id:"static-fromworkdir",level:3}],u={toc:p},g="wrapper";function c(e){let{components:t,...a}=e;return(0,n.yg)(g,(0,r.A)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,n.yg)("p",null,"A utility entity to read all generated files from\nthe directory holding the data and results from the\nlast MemLab browser interaction run"),(0,n.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("p",{parentName:"li"},(0,n.yg)("inlineCode",{parentName:"p"},"default")),(0,n.yg)("p",{parentName:"li"},"\u21b3 ",(0,n.yg)("strong",{parentName:"p"},(0,n.yg)("inlineCode",{parentName:"strong"},"BrowserInteractionResultReader"))))),(0,n.yg)("h2",{id:"methods"},"Methods"),(0,n.yg)("h3",{id:"cleanup"},(0,n.yg)("a",{id:"cleanup"}),(0,n.yg)("strong",{parentName:"h3"},"cleanup"),"()"),(0,n.yg)("p",null,"clean up data/files generated from the memlab browser interaction run"),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Returns"),": ",(0,n.yg)("inlineCode",{parentName:"li"},"void")," | no return value"),(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Examples"),":")),(0,n.yg)("pre",null,(0,n.yg)("code",{parentName:"pre",className:"language-javascript"},"const {takeSnapshots} = require('@memlab/api');\n\n(async function () {\n const scenario = { url: () => 'https://www.npmjs.com'};\n const result = await takeSnapshots({scenario});\n\n // delete all data/files generated by takeSnapshots\n result.cleanup();\n})();\n")),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Source"),":",(0,n.yg)("ul",{parentName:"li"},(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/result-reader/BaseResultReader.ts#L122"},"api/src/result-reader/BaseResultReader.ts:122"))))),(0,n.yg)("hr",null),(0,n.yg)("h3",{id:"getconsolebackupfile"},(0,n.yg)("a",{id:"getconsolebackupfile"}),(0,n.yg)("strong",{parentName:"h3"},"getConsoleBackupFile"),"()"),(0,n.yg)("p",null,"This method gets the backup file of the console output."),(0,n.yg)("p",null,"The memlab CLI commands (e.g., ",(0,n.yg)("inlineCode",{parentName:"p"},"memlab find-leaks"),") outputs a\nnon-structured string representation for easy reading, while the\nAPIs (e.g., ",(0,n.yg)("code",null,(0,n.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#findleaks"},"findLeaks")),") return structured leaks\nrepresentation that is handy for post-processing. If you need to\nobtain all the string output from the CLI in the current working directory,\nyou can read them from the CLI output backup file returned by this method."),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Returns"),": ",(0,n.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of the backup file"),(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Examples"),":")),(0,n.yg)("pre",null,(0,n.yg)("code",{parentName:"pre",className:"language-javascript"},"const {takeSnapshots, findLeaks} = require('@memlab/api');\n\n(async function () {\n const scenario = { url: () => 'https://www.npmjs.com'};\n const result = await takeSnapshots({scenario});\n const leaks = await findLeaks(result);\n\n // get the console output backup file\n const consoleBackupFile = result.getConsoleBackupFile();\n})();\n")),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Source"),":",(0,n.yg)("ul",{parentName:"li"},(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/result-reader/BaseResultReader.ts#L102"},"api/src/result-reader/BaseResultReader.ts:102"))))),(0,n.yg)("hr",null),(0,n.yg)("h3",{id:"getinteractionsteps"},(0,n.yg)("a",{id:"getinteractionsteps"}),(0,n.yg)("strong",{parentName:"h3"},"getInteractionSteps"),"()"),(0,n.yg)("p",null,"browser interaction step sequence"),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Returns"),": ",(0,n.yg)("inlineCode",{parentName:"li"},"E2EStepInfo"),"[] | an array of browser interaction step information"),(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Examples"),":")),(0,n.yg)("pre",null,(0,n.yg)("code",{parentName:"pre",className:"language-javascript"},"const {takeSnapshots} = require('@memlab/api');\n\n(async function () {\n const scenario = { url: () => 'https://www.npmjs.com'};\n const result = await takeSnapshots({scenario});\n\n const steps = result.getInteractionSteps();\n // print each browser interaction's name and JavaScript heap size (in bytes)\n steps.forEach(step => console.log(step.name, step.JSHeapUsedSize))\n})();\n")),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Source"),":",(0,n.yg)("ul",{parentName:"li"},(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/result-reader/BrowserInteractionResultReader.ts#L106"},"api/src/result-reader/BrowserInteractionResultReader.ts:106"))))),(0,n.yg)("hr",null),(0,n.yg)("h3",{id:"getrootdirectory"},(0,n.yg)("a",{id:"getrootdirectory"}),(0,n.yg)("strong",{parentName:"h3"},"getRootDirectory"),"()"),(0,n.yg)("p",null,"get the directory where the data and generated files of\nthe memlab run were stored"),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Returns"),": ",(0,n.yg)("inlineCode",{parentName:"li"},"string")," | absolute path of the directory"),(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Examples"),":")),(0,n.yg)("pre",null,(0,n.yg)("code",{parentName:"pre",className:"language-javascript"},"const {takeSnapshots} = require('@memlab/api');\n\n(async function () {\n const scenario = { url: () => 'https://www.npmjs.com'};\n const result = await takeSnapshots({scenario});\n\n // get the directory that stores all the files\n // generated from the takeSnapshots call\n const dataDir = result.getRootDirectory();\n})();\n")),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Source"),":",(0,n.yg)("ul",{parentName:"li"},(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/result-reader/BaseResultReader.ts#L72"},"api/src/result-reader/BaseResultReader.ts:72"))))),(0,n.yg)("hr",null),(0,n.yg)("h3",{id:"getrunmetainfo"},(0,n.yg)("a",{id:"getrunmetainfo"}),(0,n.yg)("strong",{parentName:"h3"},"getRunMetaInfo"),"()"),(0,n.yg)("p",null,"general meta data of the browser interaction run"),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Returns"),": ",(0,n.yg)("inlineCode",{parentName:"li"},"RunMetaInfo")," | meta data about the entire browser interaction"),(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Examples"),":")),(0,n.yg)("pre",null,(0,n.yg)("code",{parentName:"pre",className:"language-javascript"},"const {takeSnapshots} = require('@memlab/api');\n\n(async function () {\n const scenario = { url: () => 'https://www.npmjs.com'};\n const result = await takeSnapshots({scenario});\n\n const metaInfo = result.getRunMetaInfo();\n // print all browser web console output\n console.log(metaInfo.browserInfo._consoleMessages.join('\\n'));\n})();\n")),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Source"),":",(0,n.yg)("ul",{parentName:"li"},(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/result-reader/BrowserInteractionResultReader.ts#L131"},"api/src/result-reader/BrowserInteractionResultReader.ts:131"))))),(0,n.yg)("hr",null),(0,n.yg)("h3",{id:"getsnapshotfiledir"},(0,n.yg)("a",{id:"getsnapshotfiledir"}),(0,n.yg)("strong",{parentName:"h3"},"getSnapshotFileDir"),"()"),(0,n.yg)("p",null,"get the directory holding all snapshot files"),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Returns"),": ",(0,n.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of the directory"),(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Examples"),":")),(0,n.yg)("pre",null,(0,n.yg)("code",{parentName:"pre",className:"language-javascript"},"const {takeSnapshots} = require('@memlab/api');\n\n(async function () {\n const scenario = { url: () => 'https://www.npmjs.com'};\n const result = await takeSnapshots({scenario});\n\n // get the absolute path the directory holding all snapshot files\n const files = result.getSnapshotFileDir();\n})();\n")),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Source"),":",(0,n.yg)("ul",{parentName:"li"},(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/result-reader/BrowserInteractionResultReader.ts#L84"},"api/src/result-reader/BrowserInteractionResultReader.ts:84"))))),(0,n.yg)("hr",null),(0,n.yg)("h3",{id:"getsnapshotfiles"},(0,n.yg)("a",{id:"getsnapshotfiles"}),(0,n.yg)("strong",{parentName:"h3"},"getSnapshotFiles"),"()"),(0,n.yg)("p",null,"get all snapshot files generated from last memlab browser interaction"),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Returns"),": ",(0,n.yg)("inlineCode",{parentName:"li"},"string"),"[] | an array of snapshot file's absolute path"),(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Examples"),":")),(0,n.yg)("pre",null,(0,n.yg)("code",{parentName:"pre",className:"language-javascript"},"const {takeSnapshots} = require('@memlab/api');\n\n(async function () {\n const scenario = { url: () => 'https://www.npmjs.com'};\n const result = await takeSnapshots({scenario});\n\n // get absolute paths of all snapshot files\n const files = result.getSnapshotFiles();\n})();\n")),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Source"),":",(0,n.yg)("ul",{parentName:"li"},(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/result-reader/BrowserInteractionResultReader.ts#L59"},"api/src/result-reader/BrowserInteractionResultReader.ts:59"))))),(0,n.yg)("hr",null),(0,n.yg)("h3",{id:"static-fromworkdir"},(0,n.yg)("a",{id:"from"}),(0,n.yg)("inlineCode",{parentName:"h3"},"Static")," ",(0,n.yg)("strong",{parentName:"h3"},"from"),"(",(0,n.yg)("inlineCode",{parentName:"h3"},"workDir?"),")"),(0,n.yg)("p",null,"build a result reader from a data directory where the data\nand generated files of a memlab run were stored"),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("p",{parentName:"li"},(0,n.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,n.yg)("ul",{parentName:"li"},(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("inlineCode",{parentName:"li"},"workDir"),": ",(0,n.yg)("inlineCode",{parentName:"li"},"string")," | ",(0,n.yg)("inlineCode",{parentName:"li"},"''")," | absolute path of the data directory"))),(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("p",{parentName:"li"},(0,n.yg)("strong",{parentName:"p"},"Returns"),": ",(0,n.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader"},(0,n.yg)("inlineCode",{parentName:"a"},"BrowserInteractionResultReader"))," | the ResultReader instance")),(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("p",{parentName:"li"},(0,n.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,n.yg)("pre",null,(0,n.yg)("code",{parentName:"pre",className:"language-javascript"},"const {BrowserInteractionResultReader} = require('@memlab/api');\n\nconst dataDir = '/tmp/memlab'; // where the last memlab run stores results\nconst reader = BrowserInteractionResultReader.from(dataDir);\nreader.cleanup(); // clean up the results\n")),(0,n.yg)("ul",null,(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("strong",{parentName:"li"},"Source"),":",(0,n.yg)("ul",{parentName:"li"},(0,n.yg)("li",{parentName:"ul"},(0,n.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/api/src/result-reader/BrowserInteractionResultReader.ts#L39"},"api/src/result-reader/BrowserInteractionResultReader.ts:39"))))))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f8599c11.7647fd3b.js b/assets/js/f8599c11.72edf3b6.js similarity index 97% rename from assets/js/f8599c11.7647fd3b.js rename to assets/js/f8599c11.72edf3b6.js index 05da3373..ef21e64e 100644 --- a/assets/js/f8599c11.7647fd3b.js +++ b/assets/js/f8599c11.72edf3b6.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[233],{5680:(e,a,n)=>{n.d(a,{xA:()=>y,yg:()=>g});var t=n(6540);function s(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function i(e){for(var a=1;a=0||(s[n]=e[n]);return s}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var o=t.createContext({}),p=function(e){var a=t.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},y=function(e){var a=p(e.components);return t.createElement(o.Provider,{value:a},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},m=t.forwardRef((function(e,a){var n=e.components,s=e.mdxType,l=e.originalType,o=e.parentName,y=r(e,["components","mdxType","originalType","parentName"]),c=p(n),m=s,g=c["".concat(o,".").concat(m)]||c[m]||u[m]||l;return n?t.createElement(g,i(i({ref:a},y),{},{components:n})):t.createElement(g,i({ref:a},y))}));function g(e,a){var n=arguments,s=a&&a.mdxType;if("string"==typeof e||s){var l=n.length,i=new Array(l);i[0]=m;var r={};for(var o in a)hasOwnProperty.call(a,o)&&(r[o]=a[o]);r.originalType=e,r[c]="string"==typeof e?e:s,i[1]=r;for(var p=2;p{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>i,default:()=>u,frontMatter:()=>l,metadata:()=>r,toc:()=>p});var t=n(8168),s=(n(6540),n(5680));const l={id:"heap_analysis_src.ObjectFanoutAnalysis",title:"Class: ObjectFanoutAnalysis",sidebar_label:"ObjectFanoutAnalysis",custom_edit_url:null},i=void 0,r={unversionedId:"api/classes/heap_analysis_src.ObjectFanoutAnalysis",id:"api/classes/heap_analysis_src.ObjectFanoutAnalysis",title:"Class: ObjectFanoutAnalysis",description:"Hierarchy",source:"@site/docs/api/classes/heap_analysis_src.ObjectFanoutAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.ObjectFanoutAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectFanoutAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.ObjectFanoutAnalysis",title:"Class: ObjectFanoutAnalysis",sidebar_label:"ObjectFanoutAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"GlobalVariableAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.GlobalVariableAnalysis"},next:{title:"ObjectShallowAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectShallowAnalysis"}},o={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new ObjectFanoutAnalysis()',id:"new-objectfanoutanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotFromFile(file, options?)',id:"analyzesnapshotfromfilefile-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3}],y={toc:p},c="wrapper";function u(e){let{components:a,...n}=e;return(0,s.yg)(c,(0,t.A)({},y,n,{components:a,mdxType:"MDXLayout"}),(0,s.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},(0,s.yg)("inlineCode",{parentName:"a"},"BaseAnalysis"))),(0,s.yg)("p",{parentName:"li"},"\u21b3 ",(0,s.yg)("strong",{parentName:"p"},(0,s.yg)("inlineCode",{parentName:"strong"},"ObjectFanoutAnalysis"))))),(0,s.yg)("h2",{id:"constructors"},"Constructors"),(0,s.yg)("h3",{id:"new-objectfanoutanalysis"},(0,s.yg)("a",{id:"new objectfanoutanalysis"}),(0,s.yg)("strong",{parentName:"h3"},"new ObjectFanoutAnalysis"),"()"),(0,s.yg)("h2",{id:"methods"},"Methods"),(0,s.yg)("h3",{id:"analyzesnapshotfromfilefile-options"},(0,s.yg)("a",{id:"analyzesnapshotfromfile"}),(0,s.yg)("strong",{parentName:"h3"},"analyzeSnapshotFromFile"),"(",(0,s.yg)("inlineCode",{parentName:"h3"},"file"),", ",(0,s.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,s.yg)("p",null,"Run heap analysis for a single heap snapshot file"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Parameters"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of a ",(0,s.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," file."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,s.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,s.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Example"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile);\n// query analysis-specific and structured results\nconst stringPatterns = analysis.getTopDuplicatedStringsInCount();\n")),(0,s.yg)("p",null,"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:"),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/BaseAnalysis.ts#L95"},"heap-analysis/src/BaseAnalysis.ts:95"))))),(0,s.yg)("hr",null),(0,s.yg)("h3",{id:"getcommandname"},(0,s.yg)("a",{id:"getcommandname"}),(0,s.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,s.yg)("p",null,"Get the name of the heap analysis, which is also used to reference\nthe analysis in memlab command-line tool."),(0,s.yg)("p",null,"The following terminal command will initiate with this analysis:\n",(0,s.yg)("inlineCode",{parentName:"p"},"memlab analyze ")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the name of the analysis"),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Examples"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new YourAnalysis();\nconst name = analysis.getCommandName();\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/heap-analysis/src/plugins/ObjectFanoutAnalysis.ts#L22"},"heap-analysis/src/plugins/ObjectFanoutAnalysis.ts:22"))))))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[233],{5680:(e,a,n)=>{n.d(a,{xA:()=>y,yg:()=>g});var t=n(6540);function s(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function i(e){for(var a=1;a=0||(s[n]=e[n]);return s}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var o=t.createContext({}),p=function(e){var a=t.useContext(o),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},y=function(e){var a=p(e.components);return t.createElement(o.Provider,{value:a},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},m=t.forwardRef((function(e,a){var n=e.components,s=e.mdxType,l=e.originalType,o=e.parentName,y=r(e,["components","mdxType","originalType","parentName"]),c=p(n),m=s,g=c["".concat(o,".").concat(m)]||c[m]||u[m]||l;return n?t.createElement(g,i(i({ref:a},y),{},{components:n})):t.createElement(g,i({ref:a},y))}));function g(e,a){var n=arguments,s=a&&a.mdxType;if("string"==typeof e||s){var l=n.length,i=new Array(l);i[0]=m;var r={};for(var o in a)hasOwnProperty.call(a,o)&&(r[o]=a[o]);r.originalType=e,r[c]="string"==typeof e?e:s,i[1]=r;for(var p=2;p{n.r(a),n.d(a,{assets:()=>o,contentTitle:()=>i,default:()=>u,frontMatter:()=>l,metadata:()=>r,toc:()=>p});var t=n(8168),s=(n(6540),n(5680));const l={id:"heap_analysis_src.ObjectFanoutAnalysis",title:"Class: ObjectFanoutAnalysis",sidebar_label:"ObjectFanoutAnalysis",custom_edit_url:null},i=void 0,r={unversionedId:"api/classes/heap_analysis_src.ObjectFanoutAnalysis",id:"api/classes/heap_analysis_src.ObjectFanoutAnalysis",title:"Class: ObjectFanoutAnalysis",description:"Hierarchy",source:"@site/docs/api/classes/heap_analysis_src.ObjectFanoutAnalysis.md",sourceDirName:"api/classes",slug:"/api/classes/heap_analysis_src.ObjectFanoutAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectFanoutAnalysis",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"heap_analysis_src.ObjectFanoutAnalysis",title:"Class: ObjectFanoutAnalysis",sidebar_label:"ObjectFanoutAnalysis",custom_edit_url:null},sidebar:"sidebar",previous:{title:"GlobalVariableAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.GlobalVariableAnalysis"},next:{title:"ObjectShallowAnalysis",permalink:"/memlab/docs/api/classes/heap_analysis_src.ObjectShallowAnalysis"}},o={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:'new ObjectFanoutAnalysis()',id:"new-objectfanoutanalysis",level:3},{value:"Methods",id:"methods",level:2},{value:'analyzeSnapshotFromFile(file, options?)',id:"analyzesnapshotfromfilefile-options",level:3},{value:'getCommandName()',id:"getcommandname",level:3}],y={toc:p},c="wrapper";function u(e){let{components:a,...n}=e;return(0,s.yg)(c,(0,t.A)({},y,n,{components:a,mdxType:"MDXLayout"}),(0,s.yg)("h2",{id:"hierarchy"},"Hierarchy"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("p",{parentName:"li"},(0,s.yg)("a",{parentName:"p",href:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis"},(0,s.yg)("inlineCode",{parentName:"a"},"BaseAnalysis"))),(0,s.yg)("p",{parentName:"li"},"\u21b3 ",(0,s.yg)("strong",{parentName:"p"},(0,s.yg)("inlineCode",{parentName:"strong"},"ObjectFanoutAnalysis"))))),(0,s.yg)("h2",{id:"constructors"},"Constructors"),(0,s.yg)("h3",{id:"new-objectfanoutanalysis"},(0,s.yg)("a",{id:"new objectfanoutanalysis"}),(0,s.yg)("strong",{parentName:"h3"},"new ObjectFanoutAnalysis"),"()"),(0,s.yg)("h2",{id:"methods"},"Methods"),(0,s.yg)("h3",{id:"analyzesnapshotfromfilefile-options"},(0,s.yg)("a",{id:"analyzesnapshotfromfile"}),(0,s.yg)("strong",{parentName:"h3"},"analyzeSnapshotFromFile"),"(",(0,s.yg)("inlineCode",{parentName:"h3"},"file"),", ",(0,s.yg)("inlineCode",{parentName:"h3"},"options?"),")"),(0,s.yg)("p",null,"Run heap analysis for a single heap snapshot file"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Parameters"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"file"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the absolute path of a ",(0,s.yg)("inlineCode",{parentName:"li"},".heapsnapshot")," file."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("inlineCode",{parentName:"li"},"options"),": ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#runheapanalysisoptions"},(0,s.yg)("inlineCode",{parentName:"a"},"RunHeapAnalysisOptions"))," | optional configuration for the heap analysis run"))),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"Promise"),"<",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},(0,s.yg)("inlineCode",{parentName:"a"},"AnalyzeSnapshotResult")),">"," | this API returns ",(0,s.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/heap_analysis_src#analyzesnapshotresult"},"AnalyzeSnapshotResult"),", which contains\nthe logging file of analysis console output. Alternatively, to get more\nstructured analysis results, check out the documentation of the hosting\nheap analysis class and call the analysis-specific API to get results\nafter calling this method."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Example"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile);\n// query analysis-specific and structured results\nconst stringPatterns = analysis.getTopDuplicatedStringsInCount();\n")),(0,s.yg)("p",null,"Additionally, you can specify a working directory to where\nthe intermediate, logging, and final output files will be dumped:"),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new StringAnalysis();\n// analysis console output is saved in result.analysisOutputFile\n// which is inside the specified working directory\nconst result = await analysis.analyzeSnapshotFromFile(snapshotFile, {\n // if the specified directory doesn't exist, memlab will create it\n workDir: '/tmp/your/work/dir',\n});\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/BaseAnalysis.ts#L95"},"heap-analysis/src/BaseAnalysis.ts:95"))))),(0,s.yg)("hr",null),(0,s.yg)("h3",{id:"getcommandname"},(0,s.yg)("a",{id:"getcommandname"}),(0,s.yg)("strong",{parentName:"h3"},"getCommandName"),"()"),(0,s.yg)("p",null,"Get the name of the heap analysis, which is also used to reference\nthe analysis in memlab command-line tool."),(0,s.yg)("p",null,"The following terminal command will initiate with this analysis:\n",(0,s.yg)("inlineCode",{parentName:"p"},"memlab analyze ")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Returns"),": ",(0,s.yg)("inlineCode",{parentName:"li"},"string")," | the name of the analysis"),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Examples"),":")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-typescript"},"const analysis = new YourAnalysis();\nconst name = analysis.getCommandName();\n")),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"Source"),":",(0,s.yg)("ul",{parentName:"li"},(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/heap-analysis/src/plugins/ObjectFanoutAnalysis.ts#L22"},"heap-analysis/src/plugins/ObjectFanoutAnalysis.ts:22"))))))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/fc5c0a35.8eda2a00.js b/assets/js/fc5c0a35.219bb6e2.js similarity index 96% rename from assets/js/fc5c0a35.8eda2a00.js rename to assets/js/fc5c0a35.219bb6e2.js index 62950f7b..363f0c1d 100644 --- a/assets/js/fc5c0a35.8eda2a00.js +++ b/assets/js/fc5c0a35.219bb6e2.js @@ -1 +1 @@ -"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[9539],{5680:(e,a,n)=>{n.d(a,{xA:()=>s,yg:()=>y});var t=n(6540);function r(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function i(e){for(var a=1;a=0||(r[n]=e[n]);return r}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=t.createContext({}),p=function(e){var a=t.useContext(c),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},s=function(e){var a=p(e.components);return t.createElement(c.Provider,{value:a},e.children)},g="mdxType",m={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},d=t.forwardRef((function(e,a){var n=e.components,r=e.mdxType,l=e.originalType,c=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),g=p(n),d=r,y=g["".concat(c,".").concat(d)]||g[d]||m[d]||l;return n?t.createElement(y,i(i({ref:a},s),{},{components:n})):t.createElement(y,i({ref:a},s))}));function y(e,a){var n=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=d;var o={};for(var c in a)hasOwnProperty.call(a,c)&&(o[c]=a[c]);o.originalType=e,o[g]="string"==typeof e?e:r,i[1]=o;for(var p=2;p{n.r(a),n.d(a,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>o,toc:()=>p});var t=n(8168),r=(n(6540),n(5680));const l={id:"core_src.IScenario",title:"Interface: IScenario",sidebar_label:"IScenario",custom_edit_url:null},i=void 0,o={unversionedId:"api/interfaces/core_src.IScenario",id:"api/interfaces/core_src.IScenario",title:"Interface: IScenario",description:"Test scenario specifies how you want a E2E test to interact with a web browser.",source:"@site/docs/api/interfaces/core_src.IScenario.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/core_src.IScenario",permalink:"/memlab/docs/api/interfaces/core_src.IScenario",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"core_src.IScenario",title:"Interface: IScenario",sidebar_label:"IScenario",custom_edit_url:null},sidebar:"sidebar",previous:{title:"ILeakFilter",permalink:"/memlab/docs/api/interfaces/core_src.ILeakFilter"}},c={},p=[{value:"Properties",id:"properties",level:2},{value:' Optional action: InteractionsCallback',id:"-optional-action-interactionscallback",level:3},{value:' Optional back: InteractionsCallback',id:"-optional-back-interactionscallback",level:3},{value:' Optional beforeInitialPageLoad: InteractionsCallback',id:"-optional-beforeinitialpageload-interactionscallback",level:3},{value:' Optional beforeLeakFilter: InitLeakFilterCallback',id:"-optional-beforeleakfilter-initleakfiltercallback",level:3},{value:' Optional isPageLoaded: CheckPageLoadCallback',id:"-optional-ispageloaded-checkpageloadcallback",level:3},{value:' Optional leakFilter: LeakFilterCallback',id:"-optional-leakfilter-leakfiltercallback",level:3},{value:' Optional retainerReferenceFilter: ReferenceFilterCallback',id:"-optional-retainerreferencefilter-referencefiltercallback",level:3},{value:' Optional setup: InteractionsCallback',id:"-optional-setup-interactionscallback",level:3},{value:"Methods",id:"methods",level:2},{value:'Optional cookies()',id:"optional-cookies",level:3},{value:'Optional repeat()',id:"optional-repeat",level:3},{value:'url()',id:"url",level:3}],s={toc:p},g="wrapper";function m(e){let{components:a,...n}=e;return(0,r.yg)(g,(0,t.A)({},s,n,{components:a,mdxType:"MDXLayout"}),(0,r.yg)("p",null,"Test scenario specifies how you want a E2E test to interact with a web browser.\nThe test scenario can be saved as a ",(0,r.yg)("inlineCode",{parentName:"p"},".js")," file and passed to the ",(0,r.yg)("inlineCode",{parentName:"p"},"memlab\nrun --scenario")," command:"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"// save as test.js and use in terminal:\n// $ memlab run --scenario test.js\n\nmodule.exports = {\n url: () => 'https://www.npmjs.com/',\n action: async () => ... ,\n back: async () => ... ,\n cookies: () => ... , // optional\n repeat: () => ... , // optional\n ...\n};\n")),(0,r.yg)("p",null,"The test scenario instance can also be passed to the\n",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#run"},"run")," API exported by ",(0,r.yg)("inlineCode",{parentName:"p"},"@memlab/api"),"."),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"const {run} = require('@memlab/api');\n\n(async function () {\n const scenario = {\n url: () => 'https://www.facebook.com',\n action: async () => ... ,\n back: async () => ... ,\n cookies: () => ... , // optional\n repeat: () => ... , // optional\n ...\n };\n const leaks = await run({scenario});\n})();\n")),(0,r.yg)("h2",{id:"properties"},"Properties"),(0,r.yg)("h3",{id:"-optional-action-interactionscallback"},(0,r.yg)("a",{id:"action",name:"action"})," ",(0,r.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,r.yg)("strong",{parentName:"h3"},"action"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#interactionscallback"},(0,r.yg)("inlineCode",{parentName:"a"},"InteractionsCallback"))),(0,r.yg)("p",null,(0,r.yg)("inlineCode",{parentName:"p"},"action")," is the callback function that defines the interaction\nwhere you want to trigger memory leaks after the initial page load.\nAll JS objects in browser allocated by the browser interactions triggered\nfrom the ",(0,r.yg)("inlineCode",{parentName:"p"},"action")," callback will be candidates for memory leak filtering."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"page"),": ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"))," | the puppeteer\n",(0,r.yg)("a",{parentName:"li",href:"https://pptr.dev/api/puppeteer.page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page")),"\nobject, which provides APIs to interact with the web browser. To import\nthis type, check out ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"),"."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"const scenario = {\n url: () => 'https://www.npmjs.com/',\n action: async (page) => {\n await page.click('a[href=\"/link\"]');\n },\n back: async (page) => {\n await page.click('a[href=\"/back\"]');\n },\n}\n\nmodule.exports = scenario;\n")),(0,r.yg)("p",null,"Note: always clean up external puppeteer references to JS objects\nin the browser context."),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"const scenario = {\n url: () => 'https://www.npmjs.com/',\n action: async (page) => {\n const elements = await page.$x(\"//button[contains(., 'Text in Button')]\");\n const [button] = elements;\n if (button) {\n await button.click();\n }\n // dispose external references to JS objects in browser context\n await promise.all(elements.map(e => e.dispose()));\n },\n back: async (page) => ... ,\n}\n\nmodule.exports = scenario;\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L841"},"core/src/lib/Types.ts:841"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-optional-back-interactionscallback"},(0,r.yg)("a",{id:"back",name:"back"})," ",(0,r.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,r.yg)("strong",{parentName:"h3"},"back"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#interactionscallback"},(0,r.yg)("inlineCode",{parentName:"a"},"InteractionsCallback"))),(0,r.yg)("p",null,(0,r.yg)("inlineCode",{parentName:"p"},"back")," is the callback function that specifies how memlab should\nback/revert the ",(0,r.yg)("inlineCode",{parentName:"p"},"action")," callback. Think of it as an undo action."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"page"),": ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"))," | the puppeteer\n",(0,r.yg)("a",{parentName:"li",href:"https://pptr.dev/api/puppeteer.page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page")),"\nobject, which provides APIs to interact with the web browser. To import\nthis type, check out ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"),"."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"const scenario = {\n url: () => 'https://www.npmjs.com/',\n action: async (page) => {\n await page.click('a[href=\"/link\"]');\n },\n back: async (page) => {\n await page.click('a[href=\"/back\"]');\n },\n}\n")),(0,r.yg)("p",null,"Check out ",(0,r.yg)("a",{parentName:"p",href:"/docs/how-memlab-works"},"this page")," on why\nmemlab needs to undo/revert the ",(0,r.yg)("inlineCode",{parentName:"p"},"action")," callback."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L867"},"core/src/lib/Types.ts:867"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-optional-beforeinitialpageload-interactionscallback"},(0,r.yg)("a",{id:"beforeinitialpageload",name:"beforeinitialpageload"})," ",(0,r.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,r.yg)("strong",{parentName:"h3"},"beforeInitialPageLoad"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#interactionscallback"},(0,r.yg)("inlineCode",{parentName:"a"},"InteractionsCallback"))),(0,r.yg)("p",null,(0,r.yg)("inlineCode",{parentName:"p"},"beforeInitialPageLoad")," is the callback function that will be called only\nonce before the initial page load. This callback can be used to set up\nthe HTTP headers or to prepare data before loading the web page."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"page"),": ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"))," | the puppeteer\n",(0,r.yg)("a",{parentName:"li",href:"https://pptr.dev/api/puppeteer.page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page")),"\nobject, which provides APIs to interact with the web browser. To import\nthis type, check out ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"),"."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"const scenario = {\n url: () => 'https://www.npmjs.com/',\n beforeInitialPageLoad: async (page) => {\n // before the initial page load\n },\n action: async (page) => {\n await page.click('a[href=\"/link\"]');\n },\n back: async (page) => {\n await page.click('a[href=\"/back\"]');\n },\n}\n\nmodule.exports = scenario;\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L745"},"core/src/lib/Types.ts:745"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-optional-beforeleakfilter-initleakfiltercallback"},(0,r.yg)("a",{id:"beforeleakfilter",name:"beforeleakfilter"})," ",(0,r.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,r.yg)("strong",{parentName:"h3"},"beforeLeakFilter"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#initleakfiltercallback"},(0,r.yg)("inlineCode",{parentName:"a"},"InitLeakFilterCallback"))),(0,r.yg)("p",null,"Lifecycle function callback that is invoked initially once before\nthe subsequent ",(0,r.yg)("inlineCode",{parentName:"p"},"leakFilter")," function calls. This callback could\nbe used to initialize some data stores or to any one-off\npreprocessings."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot"))," | the final heap\nsnapshot taken after all browser interactions are done.\nCheck out ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")," for more APIs that queries the\nheap snapshot."),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"leakedNodeIds"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"Set")," | the set of ids of all JS heap objects\nallocated by the ",(0,r.yg)("inlineCode",{parentName:"li"},"action")," call but not released after the ",(0,r.yg)("inlineCode",{parentName:"li"},"back")," call\nin browser."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"module.exports = {\n url: () => ... ,\n action: async (page) => ... ,\n back: async (page) => ... ,\n beforeLeakFilter: (snapshot, leakedNodeIds) {\n // initialize some data stores\n },\n};\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L953"},"core/src/lib/Types.ts:953"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-optional-ispageloaded-checkpageloadcallback"},(0,r.yg)("a",{id:"ispageloaded",name:"ispageloaded"})," ",(0,r.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,r.yg)("strong",{parentName:"h3"},"isPageLoaded"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#checkpageloadcallback"},(0,r.yg)("inlineCode",{parentName:"a"},"CheckPageLoadCallback"))),(0,r.yg)("p",null,"Optional callback function that checks if the web page is loaded\nfor the initial page load and subsequent browser interactions."),(0,r.yg)("p",null,"If this callback is not provided, memlab by default\nconsiders a navigation to be finished when there are no network\nconnections for at least 500ms."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"page"),": ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"))," | the puppeteer\n",(0,r.yg)("a",{parentName:"li",href:"https://pptr.dev/api/puppeteer.page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page")),"\nobject, which provides APIs to interact with the web browser. To import\nthis type, check out ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"),"."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": a boolean value, if it returns ",(0,r.yg)("inlineCode",{parentName:"p"},"true"),", memlab will consider\nthe navigation completes, if it returns ",(0,r.yg)("inlineCode",{parentName:"p"},"false"),", memlab will keep calling\nthis callback until it returns ",(0,r.yg)("inlineCode",{parentName:"p"},"true"),". This is an async callback, you can\nalso ",(0,r.yg)("inlineCode",{parentName:"p"},"await")," and returns ",(0,r.yg)("inlineCode",{parentName:"p"},"true")," until some async logic is resolved.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"module.exports = {\n url: () => ... ,\n action: async (page) => ... ,\n back: async (page) => ... ,\n isPageLoaded: async (page) => {\n await page.waitForNavigation({\n // consider navigation to be finished when there are\n // no more than 2 network connections for at least 500 ms.\n waitUntil: 'networkidle2',\n // Maximum navigation time in milliseconds\n timeout: 5000,\n });\n return true;\n },\n};\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L925"},"core/src/lib/Types.ts:925"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-optional-leakfilter-leakfiltercallback"},(0,r.yg)("a",{id:"leakfilter",name:"leakfilter"})," ",(0,r.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,r.yg)("strong",{parentName:"h3"},"leakFilter"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#leakfiltercallback"},(0,r.yg)("inlineCode",{parentName:"a"},"LeakFilterCallback"))),(0,r.yg)("p",null,"This callback defines how you want to filter out the\nleaked objects. The callback is called for every node (JS heap\nobject in browser) allocated by the ",(0,r.yg)("inlineCode",{parentName:"p"},"action")," callback, but not\nreleased after the ",(0,r.yg)("inlineCode",{parentName:"p"},"back")," callback. Those objects could be caches\nthat are retained in memory on purpose, or they are memory leaks."),(0,r.yg)("p",null,"This optional callback allows you to define your own algorithm\nto cherry pick memory leaks for specific JS program under test."),(0,r.yg)("p",null,"If this optional callback is not defined, memlab will use its\nbuilt-in leak filter, which considers detached DOM elements\nand unmounted Fiber nodes (detached from React Fiber tree) as\nmemory leaks."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"node"),": ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},"IHeapNode"))," | the heap object\nallocated but not released. This filter callback will be applied\nto each node allocated but not released in the heap snapshot."),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot"))," | the final heap\nsnapshot taken after all browser interactions are done.\nCheck out ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")," for more APIs that queries the\nheap snapshot."),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"leakedNodeIds"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"Set")," | the set of ids of all JS heap objects\nallocated by the ",(0,r.yg)("inlineCode",{parentName:"li"},"action")," call but not released after the ",(0,r.yg)("inlineCode",{parentName:"li"},"back")," call\nin browser."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": the boolean value indicating whether the given node in\nthe snapshot should be considered as leaked.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"module.exports = {\n url: () => ... ,\n action: async (page) => ... ,\n back: async (page) => ... ,\n leakFilter(node, snapshot, leakedNodeIds) {\n // any unreleased node (JS heap object) with 1MB+\n // retained size is considered a memory leak\n return node.retainedSize > 1000000;\n },\n};\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L998"},"core/src/lib/Types.ts:998"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-optional-retainerreferencefilter-referencefiltercallback"},(0,r.yg)("a",{id:"retainerreferencefilter",name:"retainerreferencefilter"})," ",(0,r.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,r.yg)("strong",{parentName:"h3"},"retainerReferenceFilter"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#referencefiltercallback"},(0,r.yg)("inlineCode",{parentName:"a"},"ReferenceFilterCallback"))),(0,r.yg)("p",null,"Callback that can be used to define a logic to decide whether\na reference should be considered as part of the retainer trace.\nThe callback is called for every reference (edge) in the heap snapshot."),(0,r.yg)("p",null,"For concrete examples, check out ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IScenario#leakfilter"},"leakFilter"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"edge")," : ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},"IHeapEdge"))," | the reference (edge)\nthat is considered for calcualting the retainer trace"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot"))," | the heap snapshot\ntaken after all browser interactions are done.\nCheck out ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")," for more APIs that queries the\nheap snapshot."),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"isReferenceUsedByDefault"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"boolean")," | MemLab has its own default\nlogic for whether a reference should be considered as part of the\nretainer trace, if this parameter is true, it means MemLab will\nconsider this reference when calculating the retainer trace."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": the value indicating whether the given reference should be\nconsidered when calculating the retainer trace. Note that when this\ncallback returns true, the reference will only be considered as a candidate\nfor retainer trace, so it may or may not be included in the retainer trace;\nhowever, if this callback returns false, the reference will be excluded."))),(0,r.yg)("p",null,"Note that by excluding a dominator reference of an object (i.e., an edge\nthat must be traveled through to reach the heap object from GC roots),\nthe object will be considered as unreachable in the heap graph; and\ntherefore, the reference and heap object will not be included in the\nretainer trace detection and retainer size calculation."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"// save as leak-filter.js\nmodule.exports = {\n retainerReferenceFilter(edge, _snapshot, _leakedNodeIds) {\n // exclude react fiber references\n if (edge.name_or_index.toString().startsWith('__reactFiber$')) {\n return false;\n }\n return true;\n }\n};\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L1044"},"core/src/lib/Types.ts:1044"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-optional-setup-interactionscallback"},(0,r.yg)("a",{id:"setup",name:"setup"})," ",(0,r.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,r.yg)("strong",{parentName:"h3"},"setup"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#interactionscallback"},(0,r.yg)("inlineCode",{parentName:"a"},"InteractionsCallback"))),(0,r.yg)("p",null,(0,r.yg)("inlineCode",{parentName:"p"},"setup")," is the callback function that will be called only once\nafter the initial page load. This callback can be used to log in\nif you have to (we recommend using ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IScenario#cookies"},"cookies"),")\nor to prepare data before the ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IScenario#action"},"action")," call."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"page"),": ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"))," | the puppeteer\n",(0,r.yg)("a",{parentName:"li",href:"https://pptr.dev/api/puppeteer.page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page")),"\nobject, which provides APIs to interact with the web browser. To import\nthis type, check out ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"),"."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"const scenario = {\n url: () => 'https://www.npmjs.com/',\n setup: async (page) => {\n // log in or prepare data for the interaction\n },\n action: async (page) => {\n await page.click('a[href=\"/link\"]');\n },\n back: async (page) => {\n await page.click('a[href=\"/back\"]');\n },\n}\n\nmodule.exports = scenario;\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L794"},"core/src/lib/Types.ts:794"))))),(0,r.yg)("h2",{id:"methods"},"Methods"),(0,r.yg)("h3",{id:"optional-cookies"},(0,r.yg)("a",{id:"cookies"}),(0,r.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,r.yg)("strong",{parentName:"h3"},"cookies"),"()"),(0,r.yg)("p",null,"If the page you are running memlab against requires authentication or\nspecific cookie(s) to be set, you can pass them as\na list of ",(0,r.yg)("inlineCode",{parentName:"p"},"")," tuples."),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"Note"),": please make sure that you provide the correct ",(0,r.yg)("inlineCode",{parentName:"p"},"domain")," field for\nthe cookies tuples. If no ",(0,r.yg)("inlineCode",{parentName:"p"},"domain")," field is specified, memlab will try\nto fill in a domain based on the ",(0,r.yg)("inlineCode",{parentName:"p"},"url")," callback.\nFor example, when the ",(0,r.yg)("inlineCode",{parentName:"p"},"domain")," field is absent,\nmemlab will auto fill in ",(0,r.yg)("inlineCode",{parentName:"p"},".facebook.com")," as domain base\non the initial page load's url: ",(0,r.yg)("inlineCode",{parentName:"p"},"https://www.facebook.com/"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#cookies"},(0,r.yg)("inlineCode",{parentName:"a"},"Cookies"))," | cookie list"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"const scenario = {\n url: () => 'https://www.facebook.com/',\n cookies: () => [\n {name:'cm_j', value: 'none', domain: '.facebook.com'},\n {name:'datr', value: 'yJvIY...', domain: '.facebook.com'},\n {name:'c_user', value: '8917...', domain: '.facebook.com'},\n {name:'xs', value: '95:9WQ...', domain: '.facebook.com'},\n // ...\n ],\n};\n\nmodule.exports = scenario;\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L715"},"core/src/lib/Types.ts:715"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"optional-repeat"},(0,r.yg)("a",{id:"repeat"}),(0,r.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,r.yg)("strong",{parentName:"h3"},"repeat"),"()"),(0,r.yg)("p",null,"Specifies how many ",(0,r.yg)("strong",{parentName:"p"},"extra")," ",(0,r.yg)("inlineCode",{parentName:"p"},"action")," and ",(0,r.yg)("inlineCode",{parentName:"p"},"back")," actions performed\nby memlab."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": a number value specifies the number of extra actions.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"module.exports = {\n url: () => ... ,\n action: async (page) => ... ,\n back: async (page) => ... ,\n // browser interaction: two additional [ action -> back ]\n // init-load -> action -> back -> action -> back -> action -> back\n repeat: () => 2,\n};\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"number")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L886"},"core/src/lib/Types.ts:886"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"url"},(0,r.yg)("a",{id:"url"}),(0,r.yg)("strong",{parentName:"h3"},"url"),"()"),(0,r.yg)("p",null,"String value of the initial url of the page."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | the string value of the initial url"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"const scenario = {\n url: () => 'https://www.npmjs.com/',\n};\n\nmodule.exports = scenario;\n")),(0,r.yg)("p",null,"If a test scenario only specifies the ",(0,r.yg)("inlineCode",{parentName:"p"},"url")," callback (without the ",(0,r.yg)("inlineCode",{parentName:"p"},"action"),"\ncallback), memlab will try to detect memory leaks from the initial page\nload. All objects allocated by the initial page load will be candidates\nfor memory leak filtering."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/4f6de3d/packages/core/src/lib/Types.ts#L763"},"core/src/lib/Types.ts:763"))))))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[9539],{5680:(e,a,n)=>{n.d(a,{xA:()=>s,yg:()=>d});var t=n(6540);function r(e,a,n){return a in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function l(e,a){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),n.push.apply(n,t)}return n}function i(e){for(var a=1;a=0||(r[n]=e[n]);return r}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=t.createContext({}),p=function(e){var a=t.useContext(c),n=a;return e&&(n="function"==typeof e?e(a):i(i({},a),e)),n},s=function(e){var a=p(e.components);return t.createElement(c.Provider,{value:a},e.children)},g="mdxType",m={inlineCode:"code",wrapper:function(e){var a=e.children;return t.createElement(t.Fragment,{},a)}},y=t.forwardRef((function(e,a){var n=e.components,r=e.mdxType,l=e.originalType,c=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),g=p(n),y=r,d=g["".concat(c,".").concat(y)]||g[y]||m[y]||l;return n?t.createElement(d,i(i({ref:a},s),{},{components:n})):t.createElement(d,i({ref:a},s))}));function d(e,a){var n=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=y;var o={};for(var c in a)hasOwnProperty.call(a,c)&&(o[c]=a[c]);o.originalType=e,o[g]="string"==typeof e?e:r,i[1]=o;for(var p=2;p{n.r(a),n.d(a,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>o,toc:()=>p});var t=n(8168),r=(n(6540),n(5680));const l={id:"core_src.IScenario",title:"Interface: IScenario",sidebar_label:"IScenario",custom_edit_url:null},i=void 0,o={unversionedId:"api/interfaces/core_src.IScenario",id:"api/interfaces/core_src.IScenario",title:"Interface: IScenario",description:"Test scenario specifies how you want a E2E test to interact with a web browser.",source:"@site/docs/api/interfaces/core_src.IScenario.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/core_src.IScenario",permalink:"/memlab/docs/api/interfaces/core_src.IScenario",draft:!1,editUrl:null,tags:[],version:"current",frontMatter:{id:"core_src.IScenario",title:"Interface: IScenario",sidebar_label:"IScenario",custom_edit_url:null},sidebar:"sidebar",previous:{title:"ILeakFilter",permalink:"/memlab/docs/api/interfaces/core_src.ILeakFilter"}},c={},p=[{value:"Properties",id:"properties",level:2},{value:' Optional action: InteractionsCallback',id:"-optional-action-interactionscallback",level:3},{value:' Optional back: InteractionsCallback',id:"-optional-back-interactionscallback",level:3},{value:' Optional beforeInitialPageLoad: InteractionsCallback',id:"-optional-beforeinitialpageload-interactionscallback",level:3},{value:' Optional beforeLeakFilter: InitLeakFilterCallback',id:"-optional-beforeleakfilter-initleakfiltercallback",level:3},{value:' Optional isPageLoaded: CheckPageLoadCallback',id:"-optional-ispageloaded-checkpageloadcallback",level:3},{value:' Optional leakFilter: LeakFilterCallback',id:"-optional-leakfilter-leakfiltercallback",level:3},{value:' Optional retainerReferenceFilter: ReferenceFilterCallback',id:"-optional-retainerreferencefilter-referencefiltercallback",level:3},{value:' Optional setup: InteractionsCallback',id:"-optional-setup-interactionscallback",level:3},{value:"Methods",id:"methods",level:2},{value:'Optional cookies()',id:"optional-cookies",level:3},{value:'Optional repeat()',id:"optional-repeat",level:3},{value:'url()',id:"url",level:3}],s={toc:p},g="wrapper";function m(e){let{components:a,...n}=e;return(0,r.yg)(g,(0,t.A)({},s,n,{components:a,mdxType:"MDXLayout"}),(0,r.yg)("p",null,"Test scenario specifies how you want a E2E test to interact with a web browser.\nThe test scenario can be saved as a ",(0,r.yg)("inlineCode",{parentName:"p"},".js")," file and passed to the ",(0,r.yg)("inlineCode",{parentName:"p"},"memlab\nrun --scenario")," command:"),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"// save as test.js and use in terminal:\n// $ memlab run --scenario test.js\n\nmodule.exports = {\n url: () => 'https://www.npmjs.com/',\n action: async () => ... ,\n back: async () => ... ,\n cookies: () => ... , // optional\n repeat: () => ... , // optional\n ...\n};\n")),(0,r.yg)("p",null,"The test scenario instance can also be passed to the\n",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/modules/api_src#run"},"run")," API exported by ",(0,r.yg)("inlineCode",{parentName:"p"},"@memlab/api"),"."),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"const {run} = require('@memlab/api');\n\n(async function () {\n const scenario = {\n url: () => 'https://www.facebook.com',\n action: async () => ... ,\n back: async () => ... ,\n cookies: () => ... , // optional\n repeat: () => ... , // optional\n ...\n };\n const leaks = await run({scenario});\n})();\n")),(0,r.yg)("h2",{id:"properties"},"Properties"),(0,r.yg)("h3",{id:"-optional-action-interactionscallback"},(0,r.yg)("a",{id:"action",name:"action"})," ",(0,r.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,r.yg)("strong",{parentName:"h3"},"action"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#interactionscallback"},(0,r.yg)("inlineCode",{parentName:"a"},"InteractionsCallback"))),(0,r.yg)("p",null,(0,r.yg)("inlineCode",{parentName:"p"},"action")," is the callback function that defines the interaction\nwhere you want to trigger memory leaks after the initial page load.\nAll JS objects in browser allocated by the browser interactions triggered\nfrom the ",(0,r.yg)("inlineCode",{parentName:"p"},"action")," callback will be candidates for memory leak filtering."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"page"),": ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"))," | the puppeteer\n",(0,r.yg)("a",{parentName:"li",href:"https://pptr.dev/api/puppeteer.page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page")),"\nobject, which provides APIs to interact with the web browser. To import\nthis type, check out ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"),"."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"const scenario = {\n url: () => 'https://www.npmjs.com/',\n action: async (page) => {\n await page.click('a[href=\"/link\"]');\n },\n back: async (page) => {\n await page.click('a[href=\"/back\"]');\n },\n}\n\nmodule.exports = scenario;\n")),(0,r.yg)("p",null,"Note: always clean up external puppeteer references to JS objects\nin the browser context."),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"const scenario = {\n url: () => 'https://www.npmjs.com/',\n action: async (page) => {\n const elements = await page.$x(\"//button[contains(., 'Text in Button')]\");\n const [button] = elements;\n if (button) {\n await button.click();\n }\n // dispose external references to JS objects in browser context\n await promise.all(elements.map(e => e.dispose()));\n },\n back: async (page) => ... ,\n}\n\nmodule.exports = scenario;\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L841"},"core/src/lib/Types.ts:841"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-optional-back-interactionscallback"},(0,r.yg)("a",{id:"back",name:"back"})," ",(0,r.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,r.yg)("strong",{parentName:"h3"},"back"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#interactionscallback"},(0,r.yg)("inlineCode",{parentName:"a"},"InteractionsCallback"))),(0,r.yg)("p",null,(0,r.yg)("inlineCode",{parentName:"p"},"back")," is the callback function that specifies how memlab should\nback/revert the ",(0,r.yg)("inlineCode",{parentName:"p"},"action")," callback. Think of it as an undo action."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"page"),": ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"))," | the puppeteer\n",(0,r.yg)("a",{parentName:"li",href:"https://pptr.dev/api/puppeteer.page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page")),"\nobject, which provides APIs to interact with the web browser. To import\nthis type, check out ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"),"."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"const scenario = {\n url: () => 'https://www.npmjs.com/',\n action: async (page) => {\n await page.click('a[href=\"/link\"]');\n },\n back: async (page) => {\n await page.click('a[href=\"/back\"]');\n },\n}\n")),(0,r.yg)("p",null,"Check out ",(0,r.yg)("a",{parentName:"p",href:"/docs/how-memlab-works"},"this page")," on why\nmemlab needs to undo/revert the ",(0,r.yg)("inlineCode",{parentName:"p"},"action")," callback."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L867"},"core/src/lib/Types.ts:867"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-optional-beforeinitialpageload-interactionscallback"},(0,r.yg)("a",{id:"beforeinitialpageload",name:"beforeinitialpageload"})," ",(0,r.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,r.yg)("strong",{parentName:"h3"},"beforeInitialPageLoad"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#interactionscallback"},(0,r.yg)("inlineCode",{parentName:"a"},"InteractionsCallback"))),(0,r.yg)("p",null,(0,r.yg)("inlineCode",{parentName:"p"},"beforeInitialPageLoad")," is the callback function that will be called only\nonce before the initial page load. This callback can be used to set up\nthe HTTP headers or to prepare data before loading the web page."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"page"),": ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"))," | the puppeteer\n",(0,r.yg)("a",{parentName:"li",href:"https://pptr.dev/api/puppeteer.page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page")),"\nobject, which provides APIs to interact with the web browser. To import\nthis type, check out ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"),"."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"const scenario = {\n url: () => 'https://www.npmjs.com/',\n beforeInitialPageLoad: async (page) => {\n // before the initial page load\n },\n action: async (page) => {\n await page.click('a[href=\"/link\"]');\n },\n back: async (page) => {\n await page.click('a[href=\"/back\"]');\n },\n}\n\nmodule.exports = scenario;\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L745"},"core/src/lib/Types.ts:745"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-optional-beforeleakfilter-initleakfiltercallback"},(0,r.yg)("a",{id:"beforeleakfilter",name:"beforeleakfilter"})," ",(0,r.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,r.yg)("strong",{parentName:"h3"},"beforeLeakFilter"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#initleakfiltercallback"},(0,r.yg)("inlineCode",{parentName:"a"},"InitLeakFilterCallback"))),(0,r.yg)("p",null,"Lifecycle function callback that is invoked initially once before\nthe subsequent ",(0,r.yg)("inlineCode",{parentName:"p"},"leakFilter")," function calls. This callback could\nbe used to initialize some data stores or to any one-off\npreprocessings."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot"))," | the final heap\nsnapshot taken after all browser interactions are done.\nCheck out ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")," for more APIs that queries the\nheap snapshot."),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"leakedNodeIds"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"Set")," | the set of ids of all JS heap objects\nallocated by the ",(0,r.yg)("inlineCode",{parentName:"li"},"action")," call but not released after the ",(0,r.yg)("inlineCode",{parentName:"li"},"back")," call\nin browser."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"module.exports = {\n url: () => ... ,\n action: async (page) => ... ,\n back: async (page) => ... ,\n beforeLeakFilter: (snapshot, leakedNodeIds) {\n // initialize some data stores\n },\n};\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L953"},"core/src/lib/Types.ts:953"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-optional-ispageloaded-checkpageloadcallback"},(0,r.yg)("a",{id:"ispageloaded",name:"ispageloaded"})," ",(0,r.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,r.yg)("strong",{parentName:"h3"},"isPageLoaded"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#checkpageloadcallback"},(0,r.yg)("inlineCode",{parentName:"a"},"CheckPageLoadCallback"))),(0,r.yg)("p",null,"Optional callback function that checks if the web page is loaded\nfor the initial page load and subsequent browser interactions."),(0,r.yg)("p",null,"If this callback is not provided, memlab by default\nconsiders a navigation to be finished when there are no network\nconnections for at least 500ms."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"page"),": ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"))," | the puppeteer\n",(0,r.yg)("a",{parentName:"li",href:"https://pptr.dev/api/puppeteer.page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page")),"\nobject, which provides APIs to interact with the web browser. To import\nthis type, check out ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"),"."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": a boolean value, if it returns ",(0,r.yg)("inlineCode",{parentName:"p"},"true"),", memlab will consider\nthe navigation completes, if it returns ",(0,r.yg)("inlineCode",{parentName:"p"},"false"),", memlab will keep calling\nthis callback until it returns ",(0,r.yg)("inlineCode",{parentName:"p"},"true"),". This is an async callback, you can\nalso ",(0,r.yg)("inlineCode",{parentName:"p"},"await")," and returns ",(0,r.yg)("inlineCode",{parentName:"p"},"true")," until some async logic is resolved.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"module.exports = {\n url: () => ... ,\n action: async (page) => ... ,\n back: async (page) => ... ,\n isPageLoaded: async (page) => {\n await page.waitForNavigation({\n // consider navigation to be finished when there are\n // no more than 2 network connections for at least 500 ms.\n waitUntil: 'networkidle2',\n // Maximum navigation time in milliseconds\n timeout: 5000,\n });\n return true;\n },\n};\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L925"},"core/src/lib/Types.ts:925"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-optional-leakfilter-leakfiltercallback"},(0,r.yg)("a",{id:"leakfilter",name:"leakfilter"})," ",(0,r.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,r.yg)("strong",{parentName:"h3"},"leakFilter"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#leakfiltercallback"},(0,r.yg)("inlineCode",{parentName:"a"},"LeakFilterCallback"))),(0,r.yg)("p",null,"This callback defines how you want to filter out the\nleaked objects. The callback is called for every node (JS heap\nobject in browser) allocated by the ",(0,r.yg)("inlineCode",{parentName:"p"},"action")," callback, but not\nreleased after the ",(0,r.yg)("inlineCode",{parentName:"p"},"back")," callback. Those objects could be caches\nthat are retained in memory on purpose, or they are memory leaks."),(0,r.yg)("p",null,"This optional callback allows you to define your own algorithm\nto cherry pick memory leaks for specific JS program under test."),(0,r.yg)("p",null,"If this optional callback is not defined, memlab will use its\nbuilt-in leak filter, which considers detached DOM elements\nand unmounted Fiber nodes (detached from React Fiber tree) as\nmemory leaks."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"node"),": ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapNode"},"IHeapNode"))," | the heap object\nallocated but not released. This filter callback will be applied\nto each node allocated but not released in the heap snapshot."),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot"))," | the final heap\nsnapshot taken after all browser interactions are done.\nCheck out ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")," for more APIs that queries the\nheap snapshot."),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"leakedNodeIds"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"Set")," | the set of ids of all JS heap objects\nallocated by the ",(0,r.yg)("inlineCode",{parentName:"li"},"action")," call but not released after the ",(0,r.yg)("inlineCode",{parentName:"li"},"back")," call\nin browser."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": the boolean value indicating whether the given node in\nthe snapshot should be considered as leaked.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"module.exports = {\n url: () => ... ,\n action: async (page) => ... ,\n back: async (page) => ... ,\n leakFilter(node, snapshot, leakedNodeIds) {\n // any unreleased node (JS heap object) with 1MB+\n // retained size is considered a memory leak\n return node.retainedSize > 1000000;\n },\n};\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L998"},"core/src/lib/Types.ts:998"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-optional-retainerreferencefilter-referencefiltercallback"},(0,r.yg)("a",{id:"retainerreferencefilter",name:"retainerreferencefilter"})," ",(0,r.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,r.yg)("strong",{parentName:"h3"},"retainerReferenceFilter"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#referencefiltercallback"},(0,r.yg)("inlineCode",{parentName:"a"},"ReferenceFilterCallback"))),(0,r.yg)("p",null,"Callback that can be used to define a logic to decide whether\na reference should be considered as part of the retainer trace.\nThe callback is called for every reference (edge) in the heap snapshot."),(0,r.yg)("p",null,"For concrete examples, check out ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IScenario#leakfilter"},"leakFilter"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"edge")," : ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapEdge"},"IHeapEdge"))," | the reference (edge)\nthat is considered for calcualting the retainer trace"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"snapshot"),": ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot"))," | the heap snapshot\ntaken after all browser interactions are done.\nCheck out ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot"},"IHeapSnapshot")," for more APIs that queries the\nheap snapshot."),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"isReferenceUsedByDefault"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"boolean")," | MemLab has its own default\nlogic for whether a reference should be considered as part of the\nretainer trace, if this parameter is true, it means MemLab will\nconsider this reference when calculating the retainer trace."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": the value indicating whether the given reference should be\nconsidered when calculating the retainer trace. Note that when this\ncallback returns true, the reference will only be considered as a candidate\nfor retainer trace, so it may or may not be included in the retainer trace;\nhowever, if this callback returns false, the reference will be excluded."))),(0,r.yg)("p",null,"Note that by excluding a dominator reference of an object (i.e., an edge\nthat must be traveled through to reach the heap object from GC roots),\nthe object will be considered as unreachable in the heap graph; and\ntherefore, the reference and heap object will not be included in the\nretainer trace detection and retainer size calculation."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-javascript"},"// save as leak-filter.js\nmodule.exports = {\n retainerReferenceFilter(edge, _snapshot, _leakedNodeIds) {\n // exclude react fiber references\n if (edge.name_or_index.toString().startsWith('__reactFiber$')) {\n return false;\n }\n return true;\n }\n};\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L1044"},"core/src/lib/Types.ts:1044"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"-optional-setup-interactionscallback"},(0,r.yg)("a",{id:"setup",name:"setup"})," ",(0,r.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,r.yg)("strong",{parentName:"h3"},"setup"),": ",(0,r.yg)("a",{parentName:"h3",href:"/memlab/docs/api/modules/core_src#interactionscallback"},(0,r.yg)("inlineCode",{parentName:"a"},"InteractionsCallback"))),(0,r.yg)("p",null,(0,r.yg)("inlineCode",{parentName:"p"},"setup")," is the callback function that will be called only once\nafter the initial page load. This callback can be used to log in\nif you have to (we recommend using ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IScenario#cookies"},"cookies"),")\nor to prepare data before the ",(0,r.yg)("a",{parentName:"p",href:"/memlab/docs/api/interfaces/core_src.IScenario#action"},"action")," call."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Parameters"),":"),(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("inlineCode",{parentName:"li"},"page"),": ",(0,r.yg)("code",null,(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"))," | the puppeteer\n",(0,r.yg)("a",{parentName:"li",href:"https://pptr.dev/api/puppeteer.page"},(0,r.yg)("inlineCode",{parentName:"a"},"Page")),"\nobject, which provides APIs to interact with the web browser. To import\nthis type, check out ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#page"},"Page"),"."))),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"const scenario = {\n url: () => 'https://www.npmjs.com/',\n setup: async (page) => {\n // log in or prepare data for the interaction\n },\n action: async (page) => {\n await page.click('a[href=\"/link\"]');\n },\n back: async (page) => {\n await page.click('a[href=\"/back\"]');\n },\n}\n\nmodule.exports = scenario;\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L794"},"core/src/lib/Types.ts:794"))))),(0,r.yg)("h2",{id:"methods"},"Methods"),(0,r.yg)("h3",{id:"optional-cookies"},(0,r.yg)("a",{id:"cookies"}),(0,r.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,r.yg)("strong",{parentName:"h3"},"cookies"),"()"),(0,r.yg)("p",null,"If the page you are running memlab against requires authentication or\nspecific cookie(s) to be set, you can pass them as\na list of ",(0,r.yg)("inlineCode",{parentName:"p"},"")," tuples."),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"Note"),": please make sure that you provide the correct ",(0,r.yg)("inlineCode",{parentName:"p"},"domain")," field for\nthe cookies tuples. If no ",(0,r.yg)("inlineCode",{parentName:"p"},"domain")," field is specified, memlab will try\nto fill in a domain based on the ",(0,r.yg)("inlineCode",{parentName:"p"},"url")," callback.\nFor example, when the ",(0,r.yg)("inlineCode",{parentName:"p"},"domain")," field is absent,\nmemlab will auto fill in ",(0,r.yg)("inlineCode",{parentName:"p"},".facebook.com")," as domain base\non the initial page load's url: ",(0,r.yg)("inlineCode",{parentName:"p"},"https://www.facebook.com/"),"."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("a",{parentName:"li",href:"/memlab/docs/api/modules/core_src#cookies"},(0,r.yg)("inlineCode",{parentName:"a"},"Cookies"))," | cookie list"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"const scenario = {\n url: () => 'https://www.facebook.com/',\n cookies: () => [\n {name:'cm_j', value: 'none', domain: '.facebook.com'},\n {name:'datr', value: 'yJvIY...', domain: '.facebook.com'},\n {name:'c_user', value: '8917...', domain: '.facebook.com'},\n {name:'xs', value: '95:9WQ...', domain: '.facebook.com'},\n // ...\n ],\n};\n\nmodule.exports = scenario;\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L715"},"core/src/lib/Types.ts:715"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"optional-repeat"},(0,r.yg)("a",{id:"repeat"}),(0,r.yg)("inlineCode",{parentName:"h3"},"Optional")," ",(0,r.yg)("strong",{parentName:"h3"},"repeat"),"()"),(0,r.yg)("p",null,"Specifies how many ",(0,r.yg)("strong",{parentName:"p"},"extra")," ",(0,r.yg)("inlineCode",{parentName:"p"},"action")," and ",(0,r.yg)("inlineCode",{parentName:"p"},"back")," actions performed\nby memlab."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Returns"),": a number value specifies the number of extra actions.")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("p",{parentName:"li"},(0,r.yg)("strong",{parentName:"p"},"Examples"),":"))),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"module.exports = {\n url: () => ... ,\n action: async (page) => ... ,\n back: async (page) => ... ,\n // browser interaction: two additional [ action -> back ]\n // init-load -> action -> back -> action -> back -> action -> back\n repeat: () => 2,\n};\n")),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"number")),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L886"},"core/src/lib/Types.ts:886"))))),(0,r.yg)("hr",null),(0,r.yg)("h3",{id:"url"},(0,r.yg)("a",{id:"url"}),(0,r.yg)("strong",{parentName:"h3"},"url"),"()"),(0,r.yg)("p",null,"String value of the initial url of the page."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Returns"),": ",(0,r.yg)("inlineCode",{parentName:"li"},"string")," | the string value of the initial url"),(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Examples"),":")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-typescript"},"const scenario = {\n url: () => 'https://www.npmjs.com/',\n};\n\nmodule.exports = scenario;\n")),(0,r.yg)("p",null,"If a test scenario only specifies the ",(0,r.yg)("inlineCode",{parentName:"p"},"url")," callback (without the ",(0,r.yg)("inlineCode",{parentName:"p"},"action"),"\ncallback), memlab will try to detect memory leaks from the initial page\nload. All objects allocated by the initial page load will be candidates\nfor memory leak filtering."),(0,r.yg)("ul",null,(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("strong",{parentName:"li"},"Source"),":",(0,r.yg)("ul",{parentName:"li"},(0,r.yg)("li",{parentName:"ul"},(0,r.yg)("a",{parentName:"li",href:"https://github.com/facebook/memlab/blob/91f182b/packages/core/src/lib/Types.ts#L763"},"core/src/lib/Types.ts:763"))))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/main.0eb61cf8.js b/assets/js/main.0eb61cf8.js deleted file mode 100644 index c46a4bd0..00000000 --- a/assets/js/main.0eb61cf8.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see main.0eb61cf8.js.LICENSE.txt */ -(self.webpackChunkmemlab_website=self.webpackChunkmemlab_website||[]).push([[8792],{3219:(e,t,n)=>{"use strict";n.d(t,{Bc:()=>g,E8:()=>$n,a1:()=>qn});var r=n(6540);n(961);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}(e,t)||d(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||d(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){if(e){if("string"==typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function R(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function L(e){for(var t=1;t=3||2===n&&r>=4||1===n&&r>=10);function o(t,n,r){if(a&&void 0!==r){var o=r[0].__autocomplete_algoliaCredentials,i={"X-Algolia-Application-Id":o.appId,"X-Algolia-API-Key":o.apiKey};e.apply(void 0,[t].concat(I(n),[{headers:i}]))}else e.apply(void 0,[t].concat(I(n)))}return{init:function(t,n){e("init",{appId:t,apiKey:n})},setUserToken:function(t){e("setUserToken",t)},clickedObjectIDsAfterSearch:function(){for(var e=arguments.length,t=new Array(e),n=0;n0&&o("clickedObjectIDsAfterSearch",M(t),t[0].items)},clickedObjectIDs:function(){for(var e=arguments.length,t=new Array(e),n=0;n0&&o("clickedObjectIDs",M(t),t[0].items)},clickedFilters:function(){for(var t=arguments.length,n=new Array(t),r=0;r0&&e.apply(void 0,["clickedFilters"].concat(n))},convertedObjectIDsAfterSearch:function(){for(var e=arguments.length,t=new Array(e),n=0;n0&&o("convertedObjectIDsAfterSearch",M(t),t[0].items)},convertedObjectIDs:function(){for(var e=arguments.length,t=new Array(e),n=0;n0&&o("convertedObjectIDs",M(t),t[0].items)},convertedFilters:function(){for(var t=arguments.length,n=new Array(t),r=0;r0&&e.apply(void 0,["convertedFilters"].concat(n))},viewedObjectIDs:function(){for(var e=arguments.length,t=new Array(e),n=0;n0&&t.reduce((function(e,t){var n=t.items,r=N(t,T);return[].concat(I(e),I(function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20,n=[],r=0;r0&&e.apply(void 0,["viewedFilters"].concat(n))}}}function B(e){var t=e.items.reduce((function(e,t){var n;return e[t.__autocomplete_indexName]=(null!==(n=e[t.__autocomplete_indexName])&&void 0!==n?n:[]).concat(t),e}),{});return Object.keys(t).map((function(e){return{index:e,items:t[e],algoliaSource:["autocomplete"]}}))}function U(e){return e.objectID&&e.__autocomplete_indexName&&e.__autocomplete_queryID}function z(e){return z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},z(e)}function q(e){return function(e){if(Array.isArray(e))return $(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return $(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&K({onItemsChange:r,items:n,insights:l,state:t}))}}),0);return{name:"aa.algoliaInsightsPlugin",subscribe:function(e){var t=e.setContext,n=e.onSelect,r=e.onActive;i("addAlgoliaAgent","insights-plugin"),t({algoliaInsightsPlugin:{__algoliaSearchParameters:{clickAnalytics:!0},insights:l}}),n((function(e){var t=e.item,n=e.state,r=e.event;U(t)&&a({state:n,event:r,insights:l,item:t,insightsEvents:[G({eventName:"Item Selected"},x({item:t,items:s.current}))]})})),r((function(e){var t=e.item,n=e.state,r=e.event;U(t)&&o({state:n,event:r,insights:l,item:t,insightsEvents:[G({eventName:"Item Active"},x({item:t,items:s.current}))]})}))},onStateChange:function(e){var t=e.state;c({state:t})},__autocomplete_pluginOptions:e}}function Y(e,t){var n=t;return{then:function(t,r){return Y(e.then(J(t,n,e),J(r,n,e)),n)},catch:function(t){return Y(e.catch(J(t,n,e)),n)},finally:function(t){return t&&n.onCancelList.push(t),Y(e.finally(J(t&&function(){return n.onCancelList=[],t()},n,e)),n)},cancel:function(){n.isCanceled=!0;var e=n.onCancelList;n.onCancelList=[],e.forEach((function(e){e()}))},isCanceled:function(){return!0===n.isCanceled}}}function X(e){return Y(e,{isCanceled:!1,onCancelList:[]})}function J(e,t,n){return e?function(n){return t.isCanceled?n:e(n)}:n}function Z(e,t,n,r){if(!n)return null;if(e<0&&(null===t||null!==r&&0===t))return n+e;var a=(null===t?-1:t)+e;return a<=-1||a>=n?null===r?null:0:a}function ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function te(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0},reshape:function(e){return e.sources}},e),{},{id:null!==(n=e.id)&&void 0!==n?n:"autocomplete-".concat(w++),plugins:a,initialState:ge({activeItemId:null,query:"",completion:null,collections:[],isOpen:!1,status:"idle",context:{}},e.initialState),onStateChange:function(t){var n;null===(n=e.onStateChange)||void 0===n||n.call(e,t),a.forEach((function(e){var n;return null===(n=e.onStateChange)||void 0===n?void 0:n.call(e,t)}))},onSubmit:function(t){var n;null===(n=e.onSubmit)||void 0===n||n.call(e,t),a.forEach((function(e){var n;return null===(n=e.onSubmit)||void 0===n?void 0:n.call(e,t)}))},onReset:function(t){var n;null===(n=e.onReset)||void 0===n||n.call(e,t),a.forEach((function(e){var n;return null===(n=e.onReset)||void 0===n?void 0:n.call(e,t)}))},getSources:function(n){return Promise.all([].concat(function(e){return function(e){if(Array.isArray(e))return me(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return me(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?me(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(a.map((function(e){return e.getSources}))),[e.getSources]).filter(Boolean).map((function(e){return function(e,t){var n=[];return Promise.resolve(e(t)).then((function(e){return Promise.all(e.filter((function(e){return Boolean(e)})).map((function(e){if(e.sourceId,n.includes(e.sourceId))throw new Error("[Autocomplete] The `sourceId` ".concat(JSON.stringify(e.sourceId)," is not unique."));n.push(e.sourceId);var t={getItemInputValue:function(e){return e.state.query},getItemUrl:function(){},onSelect:function(e){(0,e.setIsOpen)(!1)},onActive:_,onResolve:_};Object.keys(t).forEach((function(e){t[e].__default=!0}));var r=te(te({},t),e);return Promise.resolve(r)})))}))}(e,n)}))).then((function(e){return y(e)})).then((function(e){return e.map((function(e){return ge(ge({},e),{},{onSelect:function(n){e.onSelect(n),t.forEach((function(e){var t;return null===(t=e.onSelect)||void 0===t?void 0:t.call(e,n)}))},onActive:function(n){e.onActive(n),t.forEach((function(e){var t;return null===(t=e.onActive)||void 0===t?void 0:t.call(e,n)}))},onResolve:function(n){e.onResolve(n),t.forEach((function(e){var t;return null===(t=e.onResolve)||void 0===t?void 0:t.call(e,n)}))}})}))}))},navigator:ge({navigate:function(e){var t=e.itemUrl;r.location.assign(t)},navigateNewTab:function(e){var t=e.itemUrl,n=r.open(t,"_blank","noopener");null==n||n.focus()},navigateNewWindow:function(e){var t=e.itemUrl;r.open(t,"_blank","noopener")}},e.navigator)})}function ye(e){return ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ye(e)}function we(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Se(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,De);Be&&a.environment.clearTimeout(Be);var c=s.setCollections,u=s.setIsOpen,d=s.setQuery,f=s.setActiveItemId,p=s.setStatus;if(d(o),f(a.defaultActiveItemId),!o&&!1===a.openOnFocus){var m,h=l.getState().collections.map((function(e){return Re(Re({},e),{},{items:[]})}));p("idle"),c(h),u(null!==(m=r.isOpen)&&void 0!==m?m:a.shouldPanelOpen({state:l.getState()}));var g=X(Ue(h).then((function(){return Promise.resolve()})));return l.pendingRequests.add(g)}p("loading"),Be=a.environment.setTimeout((function(){p("stalled")}),a.stallThreshold);var b=X(Ue(a.getSources(Re({query:o,refresh:i,state:l.getState()},s)).then((function(e){return Promise.all(e.map((function(e){return Promise.resolve(e.getItems(Re({query:o,refresh:i,state:l.getState()},s))).then((function(t){return function(e,t,n){if(a=e,Boolean(null==a?void 0:a.execute)){var r="algolia"===e.requesterId?Object.assign.apply(Object,[{}].concat(Ae(Object.keys(n.context).map((function(e){var t;return null===(t=n.context[e])||void 0===t?void 0:t.__algoliaSearchParameters}))))):{};return Oe(Oe({},e),{},{requests:e.queries.map((function(n){return{query:"algolia"===e.requesterId?Oe(Oe({},n),{},{params:Oe(Oe({},r),n.params)}):n,sourceId:t,transformResponse:e.transformResponse}}))})}var a;return{items:e,sourceId:t}}(t,e.sourceId,l.getState())}))}))).then(Pe).then((function(t){return function(e,t,n){return t.map((function(t){var r,a=e.filter((function(e){return e.sourceId===t.sourceId})),o=a.map((function(e){return e.items})),i=a[0].transformResponse,l=i?i({results:r=o,hits:r.map((function(e){return e.hits})).filter(Boolean),facetHits:r.map((function(e){var t;return null===(t=e.facetHits)||void 0===t?void 0:t.map((function(e){return{label:e.value,count:e.count,_highlightResult:{label:{value:e.highlighted}}}}))})).filter(Boolean)}):o;return t.onResolve({source:t,results:o,items:l,state:n.getState()}),l.every(Boolean),'The `getItems` function from source "'.concat(t.sourceId,'" must return an array of items but returned ').concat(JSON.stringify(void 0),".\n\nDid you forget to return items?\n\nSee: https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/sources/#param-getitems"),{source:t,items:l}}))}(t,e,l)})).then((function(e){return function(e){var t=e.props,n=e.state,r=e.collections.reduce((function(e,t){return Se(Se({},e),{},Ee({},t.source.sourceId,Se(Se({},t.source),{},{getItems:function(){return y(t.items)}})))}),{}),a=t.plugins.reduce((function(e,t){return t.reshape?t.reshape(e):e}),{sourcesBySourceId:r,state:n}).sourcesBySourceId;return y(t.reshape({sourcesBySourceId:a,sources:Object.values(a),state:n})).filter(Boolean).map((function(e){return{source:e,items:e.getItems()}}))}({collections:e,props:a,state:l.getState()})}))})))).then((function(e){var n;p("idle"),c(e);var d=a.shouldPanelOpen({state:l.getState()});u(null!==(n=r.isOpen)&&void 0!==n?n:a.openOnFocus&&!o&&d||d);var f=ae(l.getState());if(null!==l.getState().activeItemId&&f){var m=f.item,h=f.itemInputValue,g=f.itemUrl,b=f.source;b.onActive(Re({event:t,item:m,itemInputValue:h,itemUrl:g,refresh:i,source:b,state:l.getState()},s))}})).finally((function(){p("idle"),Be&&a.environment.clearTimeout(Be)}));return l.pendingRequests.add(b)}function qe(e){return qe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qe(e)}var $e=["event","props","refresh","store"];function He(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ge(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function ot(e){var t=e.props,n=e.refresh,r=e.store,a=at(e,Ke),o=function(e,t){return void 0!==t?"".concat(e,"-").concat(t):e};return{getEnvironmentProps:function(e){var n=e.inputElement,a=e.formElement,o=e.panelElement;function i(e){!r.getState().isOpen&&r.pendingRequests.isEmpty()||e.target===n||!1===[a,o].some((function(t){return(n=t)===(r=e.target)||n.contains(r);var n,r}))&&(r.dispatch("blur",null),t.debug||r.pendingRequests.cancelAll())}return nt({onTouchStart:i,onMouseDown:i,onTouchMove:function(e){!1!==r.getState().isOpen&&n===t.environment.document.activeElement&&e.target!==n&&n.blur()}},at(e,Qe))},getRootProps:function(e){return nt({role:"combobox","aria-expanded":r.getState().isOpen,"aria-haspopup":"listbox","aria-owns":r.getState().isOpen?"".concat(t.id,"-list"):void 0,"aria-labelledby":"".concat(t.id,"-label")},e)},getFormProps:function(e){return e.inputElement,nt({action:"",noValidate:!0,role:"search",onSubmit:function(o){var i;o.preventDefault(),t.onSubmit(nt({event:o,refresh:n,state:r.getState()},a)),r.dispatch("submit",null),null===(i=e.inputElement)||void 0===i||i.blur()},onReset:function(o){var i;o.preventDefault(),t.onReset(nt({event:o,refresh:n,state:r.getState()},a)),r.dispatch("reset",null),null===(i=e.inputElement)||void 0===i||i.focus()}},at(e,Ye))},getLabelProps:function(e){var n=e||{},r=n.sourceIndex,a=at(n,Je);return nt({htmlFor:"".concat(o(t.id,r),"-input"),id:"".concat(o(t.id,r),"-label")},a)},getInputProps:function(e){var o;function i(e){(t.openOnFocus||Boolean(r.getState().query))&&ze(nt({event:e,props:t,query:r.getState().completion||r.getState().query,refresh:n,store:r},a)),r.dispatch("focus",null)}var l=e||{},s=(l.inputElement,l.maxLength),c=void 0===s?512:s,u=at(l,Xe),d=ae(r.getState()),f=function(e){return Boolean(e&&e.match(oe))}((null===(o=t.environment.navigator)||void 0===o?void 0:o.userAgent)||""),p=null!=d&&d.itemUrl&&!f?"go":"search";return nt({"aria-autocomplete":"both","aria-activedescendant":r.getState().isOpen&&null!==r.getState().activeItemId?"".concat(t.id,"-item-").concat(r.getState().activeItemId):void 0,"aria-controls":r.getState().isOpen?"".concat(t.id,"-list"):void 0,"aria-labelledby":"".concat(t.id,"-label"),value:r.getState().completion||r.getState().query,id:"".concat(t.id,"-input"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",enterKeyHint:p,spellCheck:"false",autoFocus:t.autoFocus,placeholder:t.placeholder,maxLength:c,type:"search",onChange:function(e){ze(nt({event:e,props:t,query:e.currentTarget.value.slice(0,c),refresh:n,store:r},a))},onKeyDown:function(e){!function(e){var t=e.event,n=e.props,r=e.refresh,a=e.store,o=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,$e);if("ArrowUp"===t.key||"ArrowDown"===t.key){var i=function(){var e=n.environment.document.getElementById("".concat(n.id,"-item-").concat(a.getState().activeItemId));e&&(e.scrollIntoViewIfNeeded?e.scrollIntoViewIfNeeded(!1):e.scrollIntoView(!1))},l=function(){var e=ae(a.getState());if(null!==a.getState().activeItemId&&e){var n=e.item,i=e.itemInputValue,l=e.itemUrl,s=e.source;s.onActive(Ge({event:t,item:n,itemInputValue:i,itemUrl:l,refresh:r,source:s,state:a.getState()},o))}};t.preventDefault(),!1===a.getState().isOpen&&(n.openOnFocus||Boolean(a.getState().query))?ze(Ge({event:t,props:n,query:a.getState().query,refresh:r,store:a},o)).then((function(){a.dispatch(t.key,{nextActiveItemId:n.defaultActiveItemId}),l(),setTimeout(i,0)})):(a.dispatch(t.key,{}),l(),i())}else if("Escape"===t.key)t.preventDefault(),a.dispatch(t.key,null),a.pendingRequests.cancelAll();else if("Tab"===t.key)a.dispatch("blur",null),a.pendingRequests.cancelAll();else if("Enter"===t.key){if(null===a.getState().activeItemId||a.getState().collections.every((function(e){return 0===e.items.length})))return void(n.debug||a.pendingRequests.cancelAll());t.preventDefault();var s=ae(a.getState()),c=s.item,u=s.itemInputValue,d=s.itemUrl,f=s.source;if(t.metaKey||t.ctrlKey)void 0!==d&&(f.onSelect(Ge({event:t,item:c,itemInputValue:u,itemUrl:d,refresh:r,source:f,state:a.getState()},o)),n.navigator.navigateNewTab({itemUrl:d,item:c,state:a.getState()}));else if(t.shiftKey)void 0!==d&&(f.onSelect(Ge({event:t,item:c,itemInputValue:u,itemUrl:d,refresh:r,source:f,state:a.getState()},o)),n.navigator.navigateNewWindow({itemUrl:d,item:c,state:a.getState()}));else if(t.altKey);else{if(void 0!==d)return f.onSelect(Ge({event:t,item:c,itemInputValue:u,itemUrl:d,refresh:r,source:f,state:a.getState()},o)),void n.navigator.navigate({itemUrl:d,item:c,state:a.getState()});ze(Ge({event:t,nextState:{isOpen:!1},props:n,query:u,refresh:r,store:a},o)).then((function(){f.onSelect(Ge({event:t,item:c,itemInputValue:u,itemUrl:d,refresh:r,source:f,state:a.getState()},o))}))}}}(nt({event:e,props:t,refresh:n,store:r},a))},onFocus:i,onBlur:_,onClick:function(n){e.inputElement!==t.environment.document.activeElement||r.getState().isOpen||i(n)}},u)},getPanelProps:function(e){return nt({onMouseDown:function(e){e.preventDefault()},onMouseLeave:function(){r.dispatch("mouseleave",null)}},e)},getListProps:function(e){var n=e||{},r=n.sourceIndex,a=at(n,Ze);return nt({role:"listbox","aria-labelledby":"".concat(o(t.id,r),"-label"),id:"".concat(o(t.id,r),"-list")},a)},getItemProps:function(e){var i=e.item,l=e.source,s=e.sourceIndex,c=at(e,et);return nt({id:"".concat(o(t.id,s),"-item-").concat(i.__autocomplete_id),role:"option","aria-selected":r.getState().activeItemId===i.__autocomplete_id,onMouseMove:function(e){if(i.__autocomplete_id!==r.getState().activeItemId){r.dispatch("mousemove",i.__autocomplete_id);var t=ae(r.getState());if(null!==r.getState().activeItemId&&t){var o=t.item,l=t.itemInputValue,s=t.itemUrl,c=t.source;c.onActive(nt({event:e,item:o,itemInputValue:l,itemUrl:s,refresh:n,source:c,state:r.getState()},a))}}},onMouseDown:function(e){e.preventDefault()},onClick:function(e){var o=l.getItemInputValue({item:i,state:r.getState()}),s=l.getItemUrl({item:i,state:r.getState()});(s?Promise.resolve():ze(nt({event:e,nextState:{isOpen:!1},props:t,query:o,refresh:n,store:r},a))).then((function(){l.onSelect(nt({event:e,item:i,itemInputValue:o,itemUrl:s,refresh:n,source:l,state:r.getState()},a))}))}},c)}}}function it(e){return it="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},it(e)}function lt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function st(e){for(var t=1;t0&&r.createElement("div",{className:"DocSearch-NoResults-Prefill-List"},r.createElement("p",{className:"DocSearch-Help"},c,":"),r.createElement("ul",null,h.slice(0,3).reduce((function(e,t){return[].concat(u(e),[r.createElement("li",{key:t},r.createElement("button",{className:"DocSearch-Prefill",key:t,type:"button",onClick:function(){a.setQuery(t.toLowerCase()+" "),a.refresh(),a.inputRef.current.focus()}},t))])}),[]))),a.getMissingResultsUrl&&r.createElement("p",{className:"DocSearch-Help"},"".concat(f," "),r.createElement("a",{href:a.getMissingResultsUrl({query:a.state.query}),target:"_blank",rel:"noopener noreferrer"},m)))}var Ut=["hit","attribute","tagName"];function zt(e,t){return t.split(".").reduce((function(e,t){return null!=e&&e[t]?e[t]:null}),e)}function qt(e){var t=e.hit,n=e.attribute,a=e.tagName,i=void 0===a?"span":a,l=s(e,Ut);return(0,r.createElement)(i,o(o({},l),{},{dangerouslySetInnerHTML:{__html:zt(t,"_snippetResult.".concat(n,".value"))||zt(t,n)}}))}function $t(e){return e.collection&&0!==e.collection.items.length?r.createElement("section",{className:"DocSearch-Hits"},r.createElement("div",{className:"DocSearch-Hit-source"},e.title),r.createElement("ul",e.getListProps(),e.collection.items.map((function(t,n){return r.createElement(Ht,l({key:[e.title,t.objectID].join(":"),item:t,index:n},e))})))):null}function Ht(e){var t=e.item,n=e.index,a=e.renderIcon,o=e.renderAction,i=e.getItemProps,s=e.onItemClick,u=e.collection,d=e.hitComponent,f=c(r.useState(!1),2),p=f[0],m=f[1],h=c(r.useState(!1),2),g=h[0],b=h[1],v=r.useRef(null),y=d;return r.createElement("li",l({className:["DocSearch-Hit",t.__docsearch_parent&&"DocSearch-Hit--Child",p&&"DocSearch-Hit--deleting",g&&"DocSearch-Hit--favoriting"].filter(Boolean).join(" "),onTransitionEnd:function(){v.current&&v.current()}},i({item:t,source:u.source,onClick:function(e){s(t,e)}})),r.createElement(y,{hit:t},r.createElement("div",{className:"DocSearch-Hit-Container"},a({item:t,index:n}),t.hierarchy[t.type]&&"lvl1"===t.type&&r.createElement("div",{className:"DocSearch-Hit-content-wrapper"},r.createElement(qt,{className:"DocSearch-Hit-title",hit:t,attribute:"hierarchy.lvl1"}),t.content&&r.createElement(qt,{className:"DocSearch-Hit-path",hit:t,attribute:"content"})),t.hierarchy[t.type]&&("lvl2"===t.type||"lvl3"===t.type||"lvl4"===t.type||"lvl5"===t.type||"lvl6"===t.type)&&r.createElement("div",{className:"DocSearch-Hit-content-wrapper"},r.createElement(qt,{className:"DocSearch-Hit-title",hit:t,attribute:"hierarchy.".concat(t.type)}),r.createElement(qt,{className:"DocSearch-Hit-path",hit:t,attribute:"hierarchy.lvl1"})),"content"===t.type&&r.createElement("div",{className:"DocSearch-Hit-content-wrapper"},r.createElement(qt,{className:"DocSearch-Hit-title",hit:t,attribute:"content"}),r.createElement(qt,{className:"DocSearch-Hit-path",hit:t,attribute:"hierarchy.lvl1"})),o({item:t,runDeleteTransition:function(e){m(!0),v.current=e},runFavoriteTransition:function(e){b(!0),v.current=e}}))))}function Gt(e,t,n){return e.reduce((function(e,r){var a=t(r);return e.hasOwnProperty(a)||(e[a]=[]),e[a].length<(n||5)&&e[a].push(r),e}),{})}function Vt(e){return e}function Wt(e){return 1===e.button||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}function Kt(){}var Qt=/(|<\/mark>)/g,Yt=RegExp(Qt.source);function Xt(e){var t,n,r=e;if(!r.__docsearch_parent&&!e._highlightResult)return e.hierarchy.lvl0;var a=((r.__docsearch_parent?null===(t=r.__docsearch_parent)||void 0===t||null===(t=t._highlightResult)||void 0===t||null===(t=t.hierarchy)||void 0===t?void 0:t.lvl0:null===(n=e._highlightResult)||void 0===n||null===(n=n.hierarchy)||void 0===n?void 0:n.lvl0)||{}).value;return a&&Yt.test(a)?a.replace(Qt,""):a}function Jt(e){return r.createElement("div",{className:"DocSearch-Dropdown-Container"},e.state.collections.map((function(t){if(0===t.items.length)return null;var n=Xt(t.items[0]);return r.createElement($t,l({},e,{key:t.source.sourceId,title:n,collection:t,renderIcon:function(e){var n,a=e.item,o=e.index;return r.createElement(r.Fragment,null,a.__docsearch_parent&&r.createElement("svg",{className:"DocSearch-Hit-Tree",viewBox:"0 0 24 54"},r.createElement("g",{stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"},a.__docsearch_parent!==(null===(n=t.items[o+1])||void 0===n?void 0:n.__docsearch_parent)?r.createElement("path",{d:"M8 6v21M20 27H8.3"}):r.createElement("path",{d:"M8 6v42M20 27H8.3"}))),r.createElement("div",{className:"DocSearch-Hit-icon"},r.createElement(It,{type:a.type})))},renderAction:function(){return r.createElement("div",{className:"DocSearch-Hit-action"},r.createElement(Tt,null))}}))})),e.resultsFooterComponent&&r.createElement("section",{className:"DocSearch-HitsFooter"},r.createElement(e.resultsFooterComponent,{state:e.state})))}var Zt=["translations"];function en(e){var t=e.translations,n=void 0===t?{}:t,a=s(e,Zt),o=n.recentSearchesTitle,i=void 0===o?"Recent":o,c=n.noRecentSearchesText,u=void 0===c?"No recent searches":c,d=n.saveRecentSearchButtonTitle,f=void 0===d?"Save this search":d,p=n.removeRecentSearchButtonTitle,m=void 0===p?"Remove this search from history":p,h=n.favoriteSearchesTitle,g=void 0===h?"Favorite":h,b=n.removeFavoriteSearchButtonTitle,v=void 0===b?"Remove this search from favorites":b;return"idle"===a.state.status&&!1===a.hasCollections?a.disableUserPersonalization?null:r.createElement("div",{className:"DocSearch-StartScreen"},r.createElement("p",{className:"DocSearch-Help"},u)):!1===a.hasCollections?null:r.createElement("div",{className:"DocSearch-Dropdown-Container"},r.createElement($t,l({},a,{title:i,collection:a.state.collections[0],renderIcon:function(){return r.createElement("div",{className:"DocSearch-Hit-icon"},r.createElement(At,null))},renderAction:function(e){var t=e.item,n=e.runFavoriteTransition,o=e.runDeleteTransition;return r.createElement(r.Fragment,null,r.createElement("div",{className:"DocSearch-Hit-action"},r.createElement("button",{className:"DocSearch-Hit-action-button",title:f,type:"submit",onClick:function(e){e.preventDefault(),e.stopPropagation(),n((function(){a.favoriteSearches.add(t),a.recentSearches.remove(t),a.refresh()}))}},r.createElement(Rt,null))),r.createElement("div",{className:"DocSearch-Hit-action"},r.createElement("button",{className:"DocSearch-Hit-action-button",title:m,type:"submit",onClick:function(e){e.preventDefault(),e.stopPropagation(),o((function(){a.recentSearches.remove(t),a.refresh()}))}},r.createElement(Ct,null))))}})),r.createElement($t,l({},a,{title:g,collection:a.state.collections[1],renderIcon:function(){return r.createElement("div",{className:"DocSearch-Hit-icon"},r.createElement(Rt,null))},renderAction:function(e){var t=e.item,n=e.runDeleteTransition;return r.createElement("div",{className:"DocSearch-Hit-action"},r.createElement("button",{className:"DocSearch-Hit-action-button",title:v,type:"submit",onClick:function(e){e.preventDefault(),e.stopPropagation(),n((function(){a.favoriteSearches.remove(t),a.refresh()}))}},r.createElement(Ct,null)))}})))}var tn=["translations"],nn=r.memo((function(e){var t=e.translations,n=void 0===t?{}:t,a=s(e,tn);if("error"===a.state.status)return r.createElement(Mt,{translations:null==n?void 0:n.errorScreen});var o=a.state.collections.some((function(e){return e.items.length>0}));return a.state.query?!1===o?r.createElement(Bt,l({},a,{translations:null==n?void 0:n.noResultsScreen})):r.createElement(Jt,a):r.createElement(en,l({},a,{hasCollections:o,translations:null==n?void 0:n.startScreen}))}),(function(e,t){return"loading"===t.state.status||"stalled"===t.state.status})),rn=["translations"];function an(e){var t=e.translations,n=void 0===t?{}:t,a=s(e,rn),o=n.resetButtonTitle,i=void 0===o?"Clear the query":o,c=n.resetButtonAriaLabel,u=void 0===c?"Clear the query":c,d=n.cancelButtonText,f=void 0===d?"Cancel":d,p=n.cancelButtonAriaLabel,h=void 0===p?"Cancel":p,g=n.searchInputLabel,b=void 0===g?"Search":g,v=a.getFormProps({inputElement:a.inputRef.current}).onReset;return r.useEffect((function(){a.autoFocus&&a.inputRef.current&&a.inputRef.current.focus()}),[a.autoFocus,a.inputRef]),r.useEffect((function(){a.isFromSelection&&a.inputRef.current&&a.inputRef.current.select()}),[a.isFromSelection,a.inputRef]),r.createElement(r.Fragment,null,r.createElement("form",{className:"DocSearch-Form",onSubmit:function(e){e.preventDefault()},onReset:v},r.createElement("label",l({className:"DocSearch-MagnifierLabel"},a.getLabelProps()),r.createElement(m,null),r.createElement("span",{className:"DocSearch-VisuallyHiddenForAccessibility"},b)),r.createElement("div",{className:"DocSearch-LoadingIndicator"},r.createElement(xt,null)),r.createElement("input",l({className:"DocSearch-Input",ref:a.inputRef},a.getInputProps({inputElement:a.inputRef.current,autoFocus:a.autoFocus,maxLength:64}))),r.createElement("button",{type:"reset",title:i,className:"DocSearch-Reset","aria-label":u,hidden:!a.state.query},r.createElement(Ct,null))),r.createElement("button",{className:"DocSearch-Cancel",type:"reset","aria-label":h,onClick:a.onClose},f))}var on=["_highlightResult","_snippetResult"];function ln(e){var t=e.key,n=e.limit,r=void 0===n?5:n,a=function(e){return!1===function(){var e="__TEST_KEY__";try{return localStorage.setItem(e,""),localStorage.removeItem(e),!0}catch(e){return!1}}()?{setItem:function(){},getItem:function(){return[]}}:{setItem:function(t){return window.localStorage.setItem(e,JSON.stringify(t))},getItem:function(){var t=window.localStorage.getItem(e);return t?JSON.parse(t):[]}}}(t),o=a.getItem().slice(0,r);return{add:function(e){var t=e,n=(t._highlightResult,t._snippetResult,s(t,on)),i=o.findIndex((function(e){return e.objectID===n.objectID}));i>-1&&o.splice(i,1),o.unshift(n),o=o.slice(0,r),a.setItem(o)},remove:function(e){o=o.filter((function(t){return t.objectID!==e.objectID})),a.setItem(o)},getAll:function(){return o}}}function sn(e){const t=`algoliasearch-client-js-${e.key}`;let n;const r=()=>(void 0===n&&(n=e.localStorage||window.localStorage),n),a=()=>JSON.parse(r().getItem(t)||"{}"),o=e=>{r().setItem(t,JSON.stringify(e))};return{get:(t,n,r={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>{(()=>{const t=e.timeToLive?1e3*e.timeToLive:null,n=a(),r=Object.fromEntries(Object.entries(n).filter((([,e])=>void 0!==e.timestamp)));if(o(r),!t)return;const i=Object.fromEntries(Object.entries(r).filter((([,e])=>{const n=(new Date).getTime();return!(e.timestamp+tPromise.all([e?e.value:n(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||r.miss(e)]))).then((([e])=>e)),set:(e,n)=>Promise.resolve().then((()=>{const o=a();return o[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:n},r().setItem(t,JSON.stringify(o)),n})),delete:e=>Promise.resolve().then((()=>{const n=a();delete n[JSON.stringify(e)],r().setItem(t,JSON.stringify(n))})),clear:()=>Promise.resolve().then((()=>{r().removeItem(t)}))}}function cn(e){const t=[...e.caches],n=t.shift();return void 0===n?{get:(e,t,n={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,n.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,r,a={miss:()=>Promise.resolve()})=>n.get(e,r,a).catch((()=>cn({caches:t}).get(e,r,a))),set:(e,r)=>n.set(e,r).catch((()=>cn({caches:t}).set(e,r))),delete:e=>n.delete(e).catch((()=>cn({caches:t}).delete(e))),clear:()=>n.clear().catch((()=>cn({caches:t}).clear()))}}function un(e={serializable:!0}){let t={};return{get(n,r,a={miss:()=>Promise.resolve()}){const o=JSON.stringify(n);if(o in t)return Promise.resolve(e.serializable?JSON.parse(t[o]):t[o]);const i=r(),l=a&&a.miss||(()=>Promise.resolve());return i.then((e=>l(e))).then((()=>i))},set:(n,r)=>(t[JSON.stringify(n)]=e.serializable?JSON.stringify(r):r,Promise.resolve(r)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}function dn(e){let t=e.length-1;for(;t>0;t--){const n=Math.floor(Math.random()*(t+1)),r=e[t];e[t]=e[n],e[n]=r}return e}function fn(e,t){return t?(Object.keys(t).forEach((n=>{e[n]=t[n](e)})),e):e}function pn(e,...t){let n=0;return e.replace(/%s/g,(()=>encodeURIComponent(t[n++])))}const mn={WithinQueryParameters:0,WithinHeaders:1};function hn(e,t){const n=e||{},r=n.data||{};return Object.keys(n).forEach((e=>{-1===["timeout","headers","queryParameters","data","cacheable"].indexOf(e)&&(r[e]=n[e])})),{data:Object.entries(r).length>0?r:void 0,timeout:n.timeout||t,headers:n.headers||{},queryParameters:n.queryParameters||{},cacheable:n.cacheable}}const gn={Read:1,Write:2,Any:3},bn=1,vn=3;function yn(e,t=bn){return{...e,status:t,lastUpdate:Date.now()}}function wn(e){return"string"==typeof e?{protocol:"https",url:e,accept:gn.Any}:{protocol:e.protocol||"https",url:e.url,accept:e.accept||gn.Any}}const Sn="GET",En="POST";function kn(e,t,n,r){const a=[],o=function(e,t){if(e.method===Sn||void 0===e.data&&void 0===t.data)return;const n=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(n)}(n,r),i=function(e,t){const n={...e.headers,...t.headers},r={};return Object.keys(n).forEach((e=>{const t=n[e];r[e.toLowerCase()]=t})),r}(e,r),l=n.method,s=n.method!==Sn?{}:{...n.data,...r.data},c={"x-algolia-agent":e.userAgent.value,...e.queryParameters,...s,...r.queryParameters};let u=0;const d=(t,s)=>{const f=t.pop();if(void 0===f)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:An(a)};const p={data:o,headers:i,method:l,url:On(f,n.path,c),connectTimeout:s(u,e.timeouts.connect),responseTimeout:s(u,r.timeout)},m=e=>{const n={request:p,response:e,host:f,triesLeft:t.length};return a.push(n),n},h={onSuccess:e=>function(e){try{return JSON.parse(e.content)}catch(t){throw function(e,t){return{name:"DeserializationError",message:e,response:t}}(t.message,e)}}(e),onRetry(n){const r=m(n);return n.isTimedOut&&u++,Promise.all([e.logger.info("Retryable failure",Cn(r)),e.hostsCache.set(f,yn(f,n.isTimedOut?vn:2))]).then((()=>d(t,s)))},onFail(e){throw m(e),function({content:e,status:t},n){let r=e;try{r=JSON.parse(e).message}catch(e){}return function(e,t,n){return{name:"ApiError",message:e,status:t,transporterStackTrace:n}}(r,t,n)}(e,An(a))}};return e.requester.send(p).then((e=>((e,t)=>(e=>{const t=e.status;return e.isTimedOut||(({isTimedOut:e,status:t})=>!e&&!~~t)(e)||2!=~~(t/100)&&4!=~~(t/100)})(e)?t.onRetry(e):(({status:e})=>2==~~(e/100))(e)?t.onSuccess(e):t.onFail(e))(e,h)))};return function(e,t){return Promise.all(t.map((t=>e.get(t,(()=>Promise.resolve(yn(t))))))).then((e=>{const n=e.filter((e=>function(e){return e.status===bn||Date.now()-e.lastUpdate>12e4}(e))),r=e.filter((e=>function(e){return e.status===vn&&Date.now()-e.lastUpdate<=12e4}(e))),a=[...n,...r];return{getTimeout:(e,t)=>(0===r.length&&0===e?1:r.length+3+e)*t,statelessHosts:a.length>0?a.map((e=>wn(e))):t}}))}(e.hostsCache,t).then((e=>d([...e.statelessHosts].reverse(),e.getTimeout)))}function _n(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const n=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(n)&&(t.value=`${t.value}${n}`),t}};return t}function On(e,t,n){const r=xn(n);let a=`${e.protocol}://${e.url}/${"/"===t.charAt(0)?t.substr(1):t}`;return r.length&&(a+=`?${r}`),a}function xn(e){return Object.keys(e).map((t=>{return pn("%s=%s",t,(n=e[t],"[object Object]"===Object.prototype.toString.call(n)||"[object Array]"===Object.prototype.toString.call(n)?JSON.stringify(e[t]):e[t]));var n})).join("&")}function An(e){return e.map((e=>Cn(e)))}function Cn(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}const Tn=e=>{const t=e.appId,n=function(e,t,n){const r={"x-algolia-api-key":n,"x-algolia-application-id":t};return{headers:()=>e===mn.WithinHeaders?r:{},queryParameters:()=>e===mn.WithinQueryParameters?r:{}}}(void 0!==e.authMode?e.authMode:mn.WithinHeaders,t,e.apiKey),r=function(e){const{hostsCache:t,logger:n,requester:r,requestsCache:a,responsesCache:o,timeouts:i,userAgent:l,hosts:s,queryParameters:c,headers:u}=e,d={hostsCache:t,logger:n,requester:r,requestsCache:a,responsesCache:o,timeouts:i,userAgent:l,headers:u,queryParameters:c,hosts:s.map((e=>wn(e))),read(e,t){const n=hn(t,d.timeouts.read),r=()=>kn(d,d.hosts.filter((e=>!!(e.accept&gn.Read))),e,n);if(!0!==(void 0!==n.cacheable?n.cacheable:e.cacheable))return r();const a={request:e,mappedRequestOptions:n,transporter:{queryParameters:d.queryParameters,headers:d.headers}};return d.responsesCache.get(a,(()=>d.requestsCache.get(a,(()=>d.requestsCache.set(a,r()).then((e=>Promise.all([d.requestsCache.delete(a),e])),(e=>Promise.all([d.requestsCache.delete(a),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>d.responsesCache.set(a,e)})},write:(e,t)=>kn(d,d.hosts.filter((e=>!!(e.accept&gn.Write))),e,hn(t,d.timeouts.write))};return d}({hosts:[{url:`${t}-dsn.algolia.net`,accept:gn.Read},{url:`${t}.algolia.net`,accept:gn.Write}].concat(dn([{url:`${t}-1.algolianet.com`},{url:`${t}-2.algolianet.com`},{url:`${t}-3.algolianet.com`}])),...e,headers:{...n.headers(),"content-type":"application/x-www-form-urlencoded",...e.headers},queryParameters:{...n.queryParameters(),...e.queryParameters}}),a={transporter:r,appId:t,addAlgoliaAgent(e,t){r.userAgent.add({segment:e,version:t})},clearCache:()=>Promise.all([r.requestsCache.clear(),r.responsesCache.clear()]).then((()=>{}))};return fn(a,e.methods)},Pn=e=>(t,n)=>t.method===Sn?e.transporter.read(t,n):e.transporter.write(t,n),In=e=>(t,n={})=>fn({transporter:e.transporter,appId:e.appId,indexName:t},n.methods),Dn=e=>(t,n)=>{const r=t.map((e=>({...e,params:xn(e.params||{})})));return e.transporter.read({method:En,path:"1/indexes/*/queries",data:{requests:r},cacheable:!0},n)},Nn=e=>(t,n)=>Promise.all(t.map((t=>{const{facetName:r,facetQuery:a,...o}=t.params;return In(e)(t.indexName,{methods:{searchForFacetValues:jn}}).searchForFacetValues(r,a,{...n,...o})}))),Rn=e=>(t,n,r)=>e.transporter.read({method:En,path:pn("1/answers/%s/prediction",e.indexName),data:{query:t,queryLanguages:n},cacheable:!0},r),Ln=e=>(t,n)=>e.transporter.read({method:En,path:pn("1/indexes/%s/query",e.indexName),data:{query:t},cacheable:!0},n),jn=e=>(t,n,r)=>e.transporter.read({method:En,path:pn("1/indexes/%s/facets/%s/query",e.indexName,t),data:{facetQuery:n},cacheable:!0},r),Mn=1,Fn=2,Bn=3;function Un(e,t,n){const r={appId:e,apiKey:t,timeouts:{connect:1,read:2,write:30},requester:{send:e=>new Promise((t=>{const n=new XMLHttpRequest;n.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>n.setRequestHeader(t,e.headers[t])));const r=(e,r)=>setTimeout((()=>{n.abort(),t({status:0,content:r,isTimedOut:!0})}),1e3*e),a=r(e.connectTimeout,"Connection timeout");let o;n.onreadystatechange=()=>{n.readyState>n.OPENED&&void 0===o&&(clearTimeout(a),o=r(e.responseTimeout,"Socket timeout"))},n.onerror=()=>{0===n.status&&(clearTimeout(a),clearTimeout(o),t({content:n.responseText||"Network request failed",status:n.status,isTimedOut:!1}))},n.onload=()=>{clearTimeout(a),clearTimeout(o),t({content:n.responseText,status:n.status,isTimedOut:!1})},n.send(e.data)}))},logger:(a=Bn,{debug:(e,t)=>(Mn>=a&&console.debug(e,t),Promise.resolve()),info:(e,t)=>(Fn>=a&&console.info(e,t),Promise.resolve()),error:(e,t)=>(console.error(e,t),Promise.resolve())}),responsesCache:un(),requestsCache:un({serializable:!1}),hostsCache:cn({caches:[sn({key:`4.19.1-${e}`}),un()]}),userAgent:_n("4.19.1").add({segment:"Browser",version:"lite"}),authMode:mn.WithinQueryParameters};var a;return Tn({...r,...n,methods:{search:Dn,searchForFacetValues:Nn,multipleQueries:Dn,multipleSearchForFacetValues:Nn,customRequest:Pn,initIndex:e=>t=>In(e)(t,{methods:{search:Ln,searchForFacetValues:jn,findAnswers:Rn}})}})}Un.version="4.19.1";var zn=["footer","searchBox"];function qn(e){var t=e.appId,n=e.apiKey,a=e.indexName,i=e.placeholder,u=void 0===i?"Search docs":i,d=e.searchParameters,f=e.maxResultsPerGroup,p=e.onClose,m=void 0===p?Kt:p,h=e.transformItems,g=void 0===h?Vt:h,b=e.hitComponent,v=void 0===b?Ot:b,y=e.resultsFooterComponent,w=void 0===y?function(){return null}:y,S=e.navigator,E=e.initialScrollY,k=void 0===E?0:E,_=e.transformSearchClient,O=void 0===_?Vt:_,x=e.disableUserPersonalization,A=void 0!==x&&x,C=e.initialQuery,T=void 0===C?"":C,P=e.translations,I=void 0===P?{}:P,D=e.getMissingResultsUrl,N=e.insights,R=void 0!==N&&N,L=I.footer,j=I.searchBox,M=s(I,zn),F=c(r.useState({query:"",collections:[],completion:null,context:{},isOpen:!1,activeItemId:null,status:"idle"}),2),B=F[0],U=F[1],z=r.useRef(null),q=r.useRef(null),$=r.useRef(null),H=r.useRef(null),G=r.useRef(null),V=r.useRef(10),W=r.useRef("undefined"!=typeof window?window.getSelection().toString().slice(0,64):"").current,K=r.useRef(T||W).current,Q=function(e,t,n){return r.useMemo((function(){var r=Un(e,t);return r.addAlgoliaAgent("docsearch","3.6.1"),!1===/docsearch.js \(.*\)/.test(r.transporter.userAgent.value)&&r.addAlgoliaAgent("docsearch-react","3.6.1"),n(r)}),[e,t,n])}(t,n,O),Y=r.useRef(ln({key:"__DOCSEARCH_FAVORITE_SEARCHES__".concat(a),limit:10})).current,X=r.useRef(ln({key:"__DOCSEARCH_RECENT_SEARCHES__".concat(a),limit:0===Y.getAll().length?7:4})).current,J=r.useCallback((function(e){if(!A){var t="content"===e.type?e.__docsearch_parent:e;t&&-1===Y.getAll().findIndex((function(e){return e.objectID===t.objectID}))&&X.add(t)}}),[Y,X,A]),Z=r.useCallback((function(e){if(B.context.algoliaInsightsPlugin&&e.__autocomplete_id){var t=e,n={eventName:"Item Selected",index:t.__autocomplete_indexName,items:[t],positions:[e.__autocomplete_id],queryID:t.__autocomplete_queryID};B.context.algoliaInsightsPlugin.insights.clickedObjectIDsAfterSearch(n)}}),[B.context.algoliaInsightsPlugin]),ee=r.useMemo((function(){return St({id:"docsearch",defaultActiveItemId:0,placeholder:u,openOnFocus:!0,initialState:{query:K,context:{searchSuggestions:[]}},insights:R,navigator:S,onStateChange:function(e){U(e.state)},getSources:function(e){var r=e.query,i=e.state,l=e.setContext,s=e.setStatus;if(!r)return A?[]:[{sourceId:"recentSearches",onSelect:function(e){var t=e.item,n=e.event;J(t),Wt(n)||m()},getItemUrl:function(e){return e.item.url},getItems:function(){return X.getAll()}},{sourceId:"favoriteSearches",onSelect:function(e){var t=e.item,n=e.event;J(t),Wt(n)||m()},getItemUrl:function(e){return e.item.url},getItems:function(){return Y.getAll()}}];var c=Boolean(R);return Q.search([{query:r,indexName:a,params:o({attributesToRetrieve:["hierarchy.lvl0","hierarchy.lvl1","hierarchy.lvl2","hierarchy.lvl3","hierarchy.lvl4","hierarchy.lvl5","hierarchy.lvl6","content","type","url"],attributesToSnippet:["hierarchy.lvl1:".concat(V.current),"hierarchy.lvl2:".concat(V.current),"hierarchy.lvl3:".concat(V.current),"hierarchy.lvl4:".concat(V.current),"hierarchy.lvl5:".concat(V.current),"hierarchy.lvl6:".concat(V.current),"content:".concat(V.current)],snippetEllipsisText:"\u2026",highlightPreTag:"",highlightPostTag:"",hitsPerPage:20,clickAnalytics:c},d)}]).catch((function(e){throw"RetryError"===e.name&&s("error"),e})).then((function(e){var r=e.results[0],s=r.hits,u=r.nbHits,d=Gt(s,(function(e){return Xt(e)}),f);i.context.searchSuggestions.length0&&(re(),G.current&&G.current.focus())}),[K,re]),r.useEffect((function(){function e(){if(q.current){var e=.01*window.innerHeight;q.current.style.setProperty("--docsearch-vh","".concat(e,"px"))}}return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]),r.createElement("div",l({ref:z},ne({"aria-expanded":!0}),{className:["DocSearch","DocSearch-Container","stalled"===B.status&&"DocSearch-Container--Stalled","error"===B.status&&"DocSearch-Container--Errored"].filter(Boolean).join(" "),role:"button",tabIndex:0,onMouseDown:function(e){e.target===e.currentTarget&&m()}}),r.createElement("div",{className:"DocSearch-Modal",ref:q},r.createElement("header",{className:"DocSearch-SearchBar",ref:$},r.createElement(an,l({},ee,{state:B,autoFocus:0===K.length,inputRef:G,isFromSelection:Boolean(K)&&K===W,translations:j,onClose:m}))),r.createElement("div",{className:"DocSearch-Dropdown",ref:H},r.createElement(nn,l({},ee,{indexName:a,state:B,hitComponent:v,resultsFooterComponent:w,disableUserPersonalization:A,recentSearches:X,favoriteSearches:Y,inputRef:G,translations:M,getMissingResultsUrl:D,onItemClick:function(e,t){Z(e),J(e),Wt(t)||m()}}))),r.createElement("footer",{className:"DocSearch-Footer"},r.createElement(_t,{translations:L}))))}function $n(e){var t=e.isOpen,n=e.onOpen,a=e.onClose,o=e.onInput,i=e.searchButtonRef;r.useEffect((function(){function e(e){var r;(27===e.keyCode&&t||"k"===(null===(r=e.key)||void 0===r?void 0:r.toLowerCase())&&(e.metaKey||e.ctrlKey)||!function(e){var t=e.target,n=t.tagName;return t.isContentEditable||"INPUT"===n||"SELECT"===n||"TEXTAREA"===n}(e)&&"/"===e.key&&!t)&&(e.preventDefault(),t?a():document.body.classList.contains("DocSearch--active")||document.body.classList.contains("DocSearch--active")||n()),i&&i.current===document.activeElement&&o&&/[a-zA-Z0-9]/.test(String.fromCharCode(e.keyCode))&&o(e)}return window.addEventListener("keydown",e),function(){window.removeEventListener("keydown",e)}}),[t,n,a,o,i])}},8328:(e,t,n)=>{"use strict";n.d(t,{A:()=>p});var r=n(6540),a=n(8168),o=n(3259),i=n.n(o),l=n(4054);const s={"015e0bf7":[()=>n.e(2775).then(n.bind(n,3635)),"@site/docs/api/classes/heap_analysis_src.StringAnalysis.md",3635],"086eefc4":[()=>n.e(6192).then(n.bind(n,473)),"@site/docs/api/classes/api_src.SnapshotResultReader.md",473],"0d63082f":[()=>n.e(5214).then(n.bind(n,6835)),"@site/docs/api/classes/heap_analysis_src.BaseAnalysis.md",6835],"0e384e19":[()=>n.e(3976).then(n.bind(n,8386)),"@site/docs/intro.md",8386],"0ee6ea57":[()=>n.e(4573).then(n.bind(n,1471)),"@site/docs/api/interfaces/core_src.IHeapNode.md",1471],17896441:[()=>Promise.all([n.e(1869),n.e(2329),n.e(2025),n.e(8401)]).then(n.bind(n,2384)),"@theme/DocItem",2384],"1a4e3797":[()=>Promise.all([n.e(1869),n.e(2138)]).then(n.bind(n,6996)),"@theme/SearchPage",6996],"1a5ddf9d":[()=>n.e(2871).then(n.bind(n,3179)),"@site/docs/guides/03-find-leak.md",3179],"1bb76b7a":[()=>n.e(2915).then(n.bind(n,1835)),"@site/docs/api/classes/heap_analysis_src.ObjectUnboundGrowthAnalysis.md",1835],"1be78505":[()=>Promise.all([n.e(1869),n.e(8714)]).then(n.bind(n,8067)),"@theme/DocPage",8067],"1df93b7f":[()=>Promise.all([n.e(1869),n.e(5491),n.e(4583)]).then(n.bind(n,7379)),"@site/src/pages/index.tsx",7379],"1f391b9e":[()=>Promise.all([n.e(1869),n.e(2329),n.e(2025),n.e(6061)]).then(n.bind(n,7973)),"@theme/MDXPage",7973],"226aeb7c":[()=>n.e(5427).then(n.t.bind(n,1966,19)),"/home/runner/work/memlab/memlab/website/.docusaurus/docusaurus-plugin-content-docs/default/plugin-route-context-module-100.json",1966],"26eba521":[()=>n.e(6571).then(n.bind(n,7167)),"@site/docs/api/modules/core_src.md",7167],"27652c34":[()=>n.e(8417).then(n.bind(n,7806)),"@site/docs/api/interfaces/core_src.IHeapStringNode.md",7806],"2a2a772b":[()=>n.e(1901).then(n.bind(n,5462)),"@site/docs/cli/CLI-commands.md",5462],"2d8affd8":[()=>n.e(8032).then(n.bind(n,4711)),"@site/docs/api/enums/api_src.ConsoleMode.md",4711],"2ecac66d":[()=>n.e(1797).then(n.bind(n,4236)),"@site/docs/api/classes/heap_analysis_src.DetachedDOMElementAnalysis.md",4236],"3531de3b":[()=>n.e(9477).then(n.bind(n,205)),"@site/docs/api/interfaces/core_src.IBrowserInfo.md",205],"38ea947a":[()=>n.e(9063).then(n.bind(n,3745)),"@site/src/pages/under-construction.md",3745],"3b8c55ea":[()=>n.e(6803).then(n.bind(n,3414)),"@site/docs/installation.md",3414],"44ba4ae6":[()=>n.e(8796).then(n.bind(n,4976)),"@site/docs/how-memlab-works.md",4976],"4527bbe9":[()=>n.e(2625).then(n.bind(n,5573)),"@site/docs/api/classes/heap_analysis_src.GlobalVariableAnalysis.md",5573],"5a17db6f":[()=>n.e(8807).then(n.bind(n,540)),"@site/docs/api/classes/heap_analysis_src.ObjectSizeAnalysis.md",540],"5b1d4bc5":[()=>n.e(9439).then(n.bind(n,513)),"@site/docs/api/modules/heap_analysis_src.md",513],"5be78946":[()=>n.e(8485).then(n.bind(n,8652)),"@site/docs/api/interfaces/core_src.ILeakFilter.md",8652],"5e82d739":[()=>Promise.all([n.e(1869),n.e(2329),n.e(4612)]).then(n.bind(n,2078)),"@site/docs/guides/01-detached-dom.mdx",2078],"5e8c322a":[()=>n.e(594).then(n.bind(n,4583)),"@site/docs/api/index.md",4583],"5e9f5e1a":[()=>Promise.resolve().then(n.bind(n,4784)),"@generated/docusaurus.config",4784],"6b5d7254":[()=>n.e(9548).then(n.bind(n,45)),"@site/docs/api/interfaces/core_src.IHeapEdges.md",45],"72eddb53":[()=>n.e(1473).then(n.bind(n,8345)),"@site/docs/api/classes/heap_analysis_src.ObjectShallowAnalysis.md",8345],"8b21a35a":[()=>n.e(6640).then(n.bind(n,1416)),"@site/docs/api/modules/api_src.md",1416],"8ea95162":[()=>Promise.all([n.e(1869),n.e(2329),n.e(3474)]).then(n.bind(n,1208)),"@site/docs/guides/02-detect-oversized-object.mdx",1208],"935f2afb":[()=>n.e(8581).then(n.t.bind(n,5610,19)),"~docs/default/version-current-metadata-prop-751.json",5610],95206942:[()=>n.e(2522).then(n.bind(n,3485)),"@site/docs/api/classes/heap_analysis_src.CollectionsHoldingStaleAnalysis.md",3485],"95f47cf5":[()=>n.e(7130).then(n.bind(n,6960)),"@site/docs/api/classes/heap_analysis_src.ObjectShapeAnalysis.md",6960],"98c9c166":[()=>n.e(984).then(n.bind(n,2182)),"@site/docs/api/interfaces/core_src.IHeapEdge.md",2182],a3bf9775:[()=>n.e(211).then(n.t.bind(n,7757,19)),"/home/runner/work/memlab/memlab/website/.docusaurus/docusaurus-theme-search-algolia/default/plugin-route-context-module-100.json",7757],a7a28a68:[()=>n.e(7029).then(n.t.bind(n,4061,19)),"/home/runner/work/memlab/memlab/website/.docusaurus/docusaurus-plugin-content-pages/default/plugin-route-context-module-100.json",4061],b53f1d78:[()=>n.e(3925).then(n.bind(n,9760)),"@site/docs/api/interfaces/core_src.IHeapLocation.md",9760],c90dd339:[()=>n.e(1456).then(n.bind(n,9511)),"@site/docs/api/interfaces/core_src.IHeapSnapshot.md",9511],d589d3a7:[()=>n.e(7924).then(n.bind(n,380)),"@site/docs/getting-started.md",380],e012388a:[()=>n.e(8953).then(n.bind(n,3938)),"@site/docs/api/interfaces/core_src.IHeapNodes.md",3938],e4c6f3cc:[()=>n.e(9600).then(n.bind(n,9135)),"@site/docs/api/classes/heap_analysis_src.ShapeUnboundGrowthAnalysis.md",9135],eb14f245:[()=>n.e(2076).then(n.bind(n,6077)),"@site/docs/guides/04-continuous-test.md",6077],f40f92ec:[()=>n.e(346).then(n.bind(n,8857)),"@site/docs/api/classes/api_src.BrowserInteractionResultReader.md",8857],f6f71b0f:[()=>n.e(9901).then(n.bind(n,4369)),"@site/docs/guides/05-integrate-with-E2E-frameworks.md",4369],f8599c11:[()=>n.e(233).then(n.bind(n,4534)),"@site/docs/api/classes/heap_analysis_src.ObjectFanoutAnalysis.md",4534],fc5c0a35:[()=>n.e(9539).then(n.bind(n,9319)),"@site/docs/api/interfaces/core_src.IScenario.md",9319]};function c(e){let{error:t,retry:n,pastDelay:a}=e;return t?r.createElement("div",{style:{textAlign:"center",color:"#fff",backgroundColor:"#fa383e",borderColor:"#fa383e",borderStyle:"solid",borderRadius:"0.25rem",borderWidth:"1px",boxSizing:"border-box",display:"block",padding:"1rem",flex:"0 0 50%",marginLeft:"25%",marginRight:"25%",marginTop:"5rem",maxWidth:"50%",width:"100%"}},r.createElement("p",null,String(t)),r.createElement("div",null,r.createElement("button",{type:"button",onClick:n},"Retry"))):a?r.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"}},r.createElement("svg",{id:"loader",style:{width:128,height:110,position:"absolute",top:"calc(100vh - 64%)"},viewBox:"0 0 45 45",xmlns:"http://www.w3.org/2000/svg",stroke:"#61dafb"},r.createElement("g",{fill:"none",fillRule:"evenodd",transform:"translate(1 1)",strokeWidth:"2"},r.createElement("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0"},r.createElement("animate",{attributeName:"r",begin:"1.5s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-opacity",begin:"1.5s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-width",begin:"1.5s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})),r.createElement("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0"},r.createElement("animate",{attributeName:"r",begin:"3s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-opacity",begin:"3s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-width",begin:"3s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})),r.createElement("circle",{cx:"22",cy:"22",r:"8"},r.createElement("animate",{attributeName:"r",begin:"0s",dur:"1.5s",values:"6;1;2;3;4;5;6",calcMode:"linear",repeatCount:"indefinite"}))))):null}var u=n(6921),d=n(3102);function f(e,t){if("*"===e)return i()({loading:c,loader:()=>n.e(1774).then(n.bind(n,1774)),modules:["@theme/NotFound"],webpack:()=>[1774],render(e,t){const n=e.default;return r.createElement(d.W,{value:{plugin:{name:"native",id:"default"}}},r.createElement(n,t))}});const o=l[`${e}-${t}`],f={},p=[],m=[],h=(0,u.A)(o);return Object.entries(h).forEach((e=>{let[t,n]=e;const r=s[n];r&&(f[t]=r[0],p.push(r[1]),m.push(r[2]))})),i().Map({loading:c,loader:f,modules:p,webpack:()=>m,render(t,n){const i=JSON.parse(JSON.stringify(o));Object.entries(t).forEach((t=>{let[n,r]=t;const a=r.default;if(!a)throw new Error(`The page component at ${e} doesn't have a default export. This makes it impossible to render anything. Consider default-exporting a React component.`);"object"!=typeof a&&"function"!=typeof a||Object.keys(r).filter((e=>"default"!==e)).forEach((e=>{a[e]=r[e]}));let o=i;const l=n.split(".");l.slice(0,-1).forEach((e=>{o=o[e]})),o[l[l.length-1]]=a}));const l=i.__comp;delete i.__comp;const s=i.__context;return delete i.__context,r.createElement(d.W,{value:s},r.createElement(l,(0,a.A)({},i,n)))}})}const p=[{path:"/memlab/search",component:f("/memlab/search","9cb"),exact:!0},{path:"/memlab/under-construction",component:f("/memlab/under-construction","92a"),exact:!0},{path:"/memlab/docs",component:f("/memlab/docs","175"),routes:[{path:"/memlab/docs/api/",component:f("/memlab/docs/api/","308"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/classes/api_src.BrowserInteractionResultReader",component:f("/memlab/docs/api/classes/api_src.BrowserInteractionResultReader","433"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/classes/api_src.SnapshotResultReader",component:f("/memlab/docs/api/classes/api_src.SnapshotResultReader","f6c"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis",component:f("/memlab/docs/api/classes/heap_analysis_src.BaseAnalysis","cae"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/classes/heap_analysis_src.CollectionsHoldingStaleAnalysis",component:f("/memlab/docs/api/classes/heap_analysis_src.CollectionsHoldingStaleAnalysis","2a5"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/classes/heap_analysis_src.DetachedDOMElementAnalysis",component:f("/memlab/docs/api/classes/heap_analysis_src.DetachedDOMElementAnalysis","18b"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/classes/heap_analysis_src.GlobalVariableAnalysis",component:f("/memlab/docs/api/classes/heap_analysis_src.GlobalVariableAnalysis","0a7"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/classes/heap_analysis_src.ObjectFanoutAnalysis",component:f("/memlab/docs/api/classes/heap_analysis_src.ObjectFanoutAnalysis","4bf"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/classes/heap_analysis_src.ObjectShallowAnalysis",component:f("/memlab/docs/api/classes/heap_analysis_src.ObjectShallowAnalysis","d8e"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/classes/heap_analysis_src.ObjectShapeAnalysis",component:f("/memlab/docs/api/classes/heap_analysis_src.ObjectShapeAnalysis","f65"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/classes/heap_analysis_src.ObjectSizeAnalysis",component:f("/memlab/docs/api/classes/heap_analysis_src.ObjectSizeAnalysis","fb4"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/classes/heap_analysis_src.ObjectUnboundGrowthAnalysis",component:f("/memlab/docs/api/classes/heap_analysis_src.ObjectUnboundGrowthAnalysis","a44"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/classes/heap_analysis_src.ShapeUnboundGrowthAnalysis",component:f("/memlab/docs/api/classes/heap_analysis_src.ShapeUnboundGrowthAnalysis","283"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/classes/heap_analysis_src.StringAnalysis",component:f("/memlab/docs/api/classes/heap_analysis_src.StringAnalysis","ef6"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/enums/api_src.ConsoleMode",component:f("/memlab/docs/api/enums/api_src.ConsoleMode","9de"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/interfaces/core_src.IBrowserInfo",component:f("/memlab/docs/api/interfaces/core_src.IBrowserInfo","4ba"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/interfaces/core_src.IHeapEdge",component:f("/memlab/docs/api/interfaces/core_src.IHeapEdge","26a"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/interfaces/core_src.IHeapEdges",component:f("/memlab/docs/api/interfaces/core_src.IHeapEdges","d0e"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/interfaces/core_src.IHeapLocation",component:f("/memlab/docs/api/interfaces/core_src.IHeapLocation","0e3"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/interfaces/core_src.IHeapNode",component:f("/memlab/docs/api/interfaces/core_src.IHeapNode","8bb"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/interfaces/core_src.IHeapNodes",component:f("/memlab/docs/api/interfaces/core_src.IHeapNodes","123"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/interfaces/core_src.IHeapSnapshot",component:f("/memlab/docs/api/interfaces/core_src.IHeapSnapshot","c89"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/interfaces/core_src.IHeapStringNode",component:f("/memlab/docs/api/interfaces/core_src.IHeapStringNode","1a5"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/interfaces/core_src.ILeakFilter",component:f("/memlab/docs/api/interfaces/core_src.ILeakFilter","e20"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/interfaces/core_src.IScenario",component:f("/memlab/docs/api/interfaces/core_src.IScenario","b01"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/modules/api_src",component:f("/memlab/docs/api/modules/api_src","e99"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/modules/core_src",component:f("/memlab/docs/api/modules/core_src","7fe"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/api/modules/heap_analysis_src",component:f("/memlab/docs/api/modules/heap_analysis_src","531"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/cli/CLI-commands",component:f("/memlab/docs/cli/CLI-commands","2df"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/getting-started",component:f("/memlab/docs/getting-started","f0e"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/guides/guides-detached-dom",component:f("/memlab/docs/guides/guides-detached-dom","dba"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/guides/guides-detect-oversized-object",component:f("/memlab/docs/guides/guides-detect-oversized-object","507"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/guides/guides-find-leaks",component:f("/memlab/docs/guides/guides-find-leaks","407"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/guides/integrate-with-e2e-frameworks",component:f("/memlab/docs/guides/integrate-with-e2e-frameworks","2c6"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/guides/integration-and-file-structure",component:f("/memlab/docs/guides/integration-and-file-structure","a4b"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/how-memlab-works",component:f("/memlab/docs/how-memlab-works","530"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/installation",component:f("/memlab/docs/installation","d98"),exact:!0,sidebar:"sidebar"},{path:"/memlab/docs/intro",component:f("/memlab/docs/intro","a4c"),exact:!0,sidebar:"sidebar"}]},{path:"/memlab/",component:f("/memlab/","82d"),exact:!0},{path:"*",component:f("*")}]},6125:(e,t,n)=>{"use strict";n.d(t,{o:()=>a,x:()=>o});var r=n(6540);const a=r.createContext(!1);function o(e){let{children:t}=e;const[n,o]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{o(!0)}),[]),r.createElement(a.Provider,{value:n},t)}},5660:(e,t,n)=>{"use strict";var r=n(6540),a=n(961),o=n(4625),i=n(545),l=n(8193);const s=[n(119),n(6134),n(435),n(6294),n(1043),n(1911)];var c=n(8328),u=n(6347),d=n(2831);function f(e){let{children:t}=e;return r.createElement(r.Fragment,null,t)}var p=n(8168),m=n(5260),h=n(4586),g=n(6025),b=n(2131),v=n(6342),y=n(4090),w=n(9024),S=n(2967),E=n(1463);function k(){const{i18n:{defaultLocale:e,localeConfigs:t}}=(0,h.A)(),n=(0,b.o)();return r.createElement(m.A,null,Object.entries(t).map((e=>{let[t,{htmlLang:a}]=e;return r.createElement("link",{key:t,rel:"alternate",href:n.createUrl({locale:t,fullyQualified:!0}),hrefLang:a})})),r.createElement("link",{rel:"alternate",href:n.createUrl({locale:e,fullyQualified:!0}),hrefLang:"x-default"}))}function _(e){let{permalink:t}=e;const{siteConfig:{url:n}}=(0,h.A)(),a=function(){const{siteConfig:{url:e}}=(0,h.A)(),{pathname:t}=(0,u.zy)();return e+(0,g.A)(t)}(),o=t?`${n}${t}`:a;return r.createElement(m.A,null,r.createElement("meta",{property:"og:url",content:o}),r.createElement("link",{rel:"canonical",href:o}))}function O(){const{i18n:{currentLocale:e}}=(0,h.A)(),{metadata:t,image:n}=(0,v.p)();return r.createElement(r.Fragment,null,r.createElement(m.A,null,r.createElement("meta",{name:"twitter:card",content:"summary_large_image"}),r.createElement("body",{className:y.w})),n&&r.createElement(w.be,{image:n}),r.createElement(_,null),r.createElement(k,null),r.createElement(E.A,{tag:S.Cy,locale:e}),r.createElement(m.A,null,t.map(((e,t)=>r.createElement("meta",(0,p.A)({key:t},e))))))}const x=new Map;function A(e){if(x.has(e.pathname))return{...e,pathname:x.get(e.pathname)};if((0,d.u)(c.A,e.pathname).some((e=>{let{route:t}=e;return!0===t.exact})))return x.set(e.pathname,e.pathname),e;const t=e.pathname.trim().replace(/(?:\/index)?\.html$/,"")||"/";return x.set(e.pathname,t),{...e,pathname:t}}var C=n(6125),T=n(6337);function P(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{const r=t.default?.[e]??t[e];return r?.(...n)}));return()=>a.forEach((e=>e?.()))}const I=function(e){let{children:t,location:n,previousLocation:a}=e;return(0,r.useLayoutEffect)((()=>{a!==n&&(a&&function(e){const{hash:t}=e;if(t){const e=decodeURIComponent(t.substring(1)),n=document.getElementById(e);n?.scrollIntoView()}else window.scrollTo(0,0)}(n),P("onRouteDidUpdate",{previousLocation:a,location:n}))}),[a,n]),t};function D(e){const t=(0,d.u)(c.A,e);return Promise.all(t.map((e=>e.route.component.preload?.())))}class N extends r.Component{previousLocation;routeUpdateCleanupCb;constructor(e){super(e),this.previousLocation=null,this.routeUpdateCleanupCb=l.A.canUseDOM?P("onRouteUpdate",{previousLocation:null,location:this.props.location}):()=>{},this.state={nextRouteHasLoaded:!0}}shouldComponentUpdate(e,t){if(e.location===this.props.location)return t.nextRouteHasLoaded;const n=e.location;return this.previousLocation=this.props.location,this.setState({nextRouteHasLoaded:!1}),this.routeUpdateCleanupCb=P("onRouteUpdate",{previousLocation:this.previousLocation,location:n}),D(n.pathname).then((()=>{this.routeUpdateCleanupCb(),this.setState({nextRouteHasLoaded:!0})})).catch((e=>console.warn(e))),!1}render(){const{children:e,location:t}=this.props;return r.createElement(I,{previousLocation:this.previousLocation,location:t},r.createElement(u.qh,{location:t,render:()=>e}))}}const R=N,L="docusaurus-base-url-issue-banner-container",j="docusaurus-base-url-issue-banner",M="docusaurus-base-url-issue-banner-suggestion-container",F="__DOCUSAURUS_INSERT_BASEURL_BANNER";function B(e){return`\nwindow['${F}'] = true;\n\ndocument.addEventListener('DOMContentLoaded', maybeInsertBanner);\n\nfunction maybeInsertBanner() {\n var shouldInsert = window['${F}'];\n shouldInsert && insertBanner();\n}\n\nfunction insertBanner() {\n var bannerContainer = document.getElementById('${L}');\n if (!bannerContainer) {\n return;\n }\n var bannerHtml = ${JSON.stringify(function(e){return`\n
\n

Your Docusaurus site did not load properly.

\n

A very common reason is a wrong site baseUrl configuration.

\n

Current configured baseUrl = ${e} ${"/"===e?" (default value)":""}

\n

We suggest trying baseUrl =

\n
\n`}(e)).replace(/{window[F]=!1}),[]),r.createElement(r.Fragment,null,!l.A.canUseDOM&&r.createElement(m.A,null,r.createElement("script",null,B(e))),r.createElement("div",{id:L}))}function z(){const{siteConfig:{baseUrl:e,baseUrlIssueBanner:t}}=(0,h.A)(),{pathname:n}=(0,u.zy)();return t&&n===e?r.createElement(U,null):null}function q(){const{siteConfig:{favicon:e,title:t},i18n:{currentLocale:n,localeConfigs:a}}=(0,h.A)(),o=(0,g.A)(e),{htmlLang:i,direction:l}=a[n];return r.createElement(m.A,null,r.createElement("html",{lang:i,dir:l}),r.createElement("title",null,t),r.createElement("meta",{property:"og:title",content:t}),e&&r.createElement("link",{rel:"icon",href:o}))}var $=n(7489);function H(){const e=(0,d.v)(c.A),t=(0,u.zy)();return r.createElement($.A,null,r.createElement(T.l,null,r.createElement(C.x,null,r.createElement(f,null,r.createElement(q,null),r.createElement(O,null),r.createElement(z,null),r.createElement(R,{location:A(t)},e)))))}var G=n(4054);const V=function(e){try{return document.createElement("link").relList.supports(e)}catch{return!1}}("prefetch")?function(e){return new Promise(((t,n)=>{if("undefined"==typeof document)return void n();const r=document.createElement("link");r.setAttribute("rel","prefetch"),r.setAttribute("href",e),r.onload=()=>t(),r.onerror=()=>n();const a=document.getElementsByTagName("head")[0]??document.getElementsByName("script")[0]?.parentNode;a?.appendChild(r)}))}:function(e){return new Promise(((t,n)=>{const r=new XMLHttpRequest;r.open("GET",e,!0),r.withCredentials=!0,r.onload=()=>{200===r.status?t():n()},r.send(null)}))};var W=n(6921);const K=new Set,Q=new Set,Y=()=>navigator.connection?.effectiveType.includes("2g")||navigator.connection?.saveData,X={prefetch(e){if(!(e=>!Y()&&!Q.has(e)&&!K.has(e))(e))return!1;K.add(e);const t=(0,d.u)(c.A,e).flatMap((e=>{return t=e.route.path,Object.entries(G).filter((e=>{let[n]=e;return n.replace(/-[^-]+$/,"")===t})).flatMap((e=>{let[,t]=e;return Object.values((0,W.A)(t))}));var t}));return Promise.all(t.map((e=>{const t=n.gca(e);return t&&!t.includes("undefined")?V(t).catch((()=>{})):Promise.resolve()})))},preload:e=>!!(e=>!Y()&&!Q.has(e))(e)&&(Q.add(e),D(e))},J=Object.freeze(X);if(l.A.canUseDOM){window.docusaurus=J;const e=a.hydrate;D(window.location.pathname).then((()=>{e(r.createElement(i.vd,null,r.createElement(o.Kd,null,r.createElement(H,null))),document.getElementById("__docusaurus"))}))}},6337:(e,t,n)=>{"use strict";n.d(t,{o:()=>u,l:()=>d});var r=n(6540),a=n(4784),o=n(9568);const i=JSON.parse('{"defaultLocale":"en","locales":["en"],"currentLocale":"en","localeConfigs":{"en":{"label":"English","direction":"ltr","htmlLang":"en","calendar":"gregory"}}}');var l=n(2654);const s=JSON.parse('{"docusaurusVersion":"2.0.0-beta.21","siteVersion":"1.0.0","pluginVersions":{"docusaurus-plugin-content-docs":{"type":"package","name":"@docusaurus/plugin-content-docs","version":"2.0.0-beta.21"},"docusaurus-plugin-content-blog":{"type":"package","name":"@docusaurus/plugin-content-blog","version":"2.0.0-beta.21"},"docusaurus-plugin-content-pages":{"type":"package","name":"@docusaurus/plugin-content-pages","version":"2.0.0-beta.21"},"docusaurus-plugin-sitemap":{"type":"package","name":"@docusaurus/plugin-sitemap","version":"2.0.0-beta.21"},"docusaurus-theme-classic":{"type":"package","name":"@docusaurus/theme-classic","version":"2.0.0-beta.21"},"docusaurus-theme-search-algolia":{"type":"package","name":"@docusaurus/theme-search-algolia","version":"2.0.0-beta.21"},"docusaurus-plugin-typedoc":{"type":"package","name":"@memlab/memlab-docusaurus-plugin-typedoc","version":"0.17.9"},"docusaurus-plugin-google-gtag":{"type":"package","name":"@docusaurus/plugin-google-gtag","version":"2.0.0-beta.21"}}}'),c={siteConfig:a.default,siteMetadata:s,globalData:o,i18n:i,codeTranslations:l},u=r.createContext(c);function d(e){let{children:t}=e;return r.createElement(u.Provider,{value:c},t)}},7489:(e,t,n)=>{"use strict";n.d(t,{A:()=>u});var r=n(6540),a=n(8193),o=n(5260),i=n(8916);function l(e){let{error:t,tryAgain:n}=e;return r.createElement("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",height:"50vh",width:"100%",fontSize:"20px"}},r.createElement("h1",null,"This page crashed."),r.createElement("p",null,t.message),r.createElement("button",{type:"button",onClick:n},"Try again"))}function s(e){let{error:t,tryAgain:n}=e;return r.createElement(u,{fallback:()=>r.createElement(l,{error:t,tryAgain:n})},r.createElement(o.A,null,r.createElement("title",null,"Page Error")),r.createElement(i.A,null,r.createElement(l,{error:t,tryAgain:n})))}const c=e=>r.createElement(s,e);class u extends r.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){a.A.canUseDOM&&this.setState({error:e})}render(){const{children:e}=this.props,{error:t}=this.state;if(t){const e={error:t,tryAgain:()=>this.setState({error:null})};return(this.props.fallback??c)(e)}return e??null}}},8193:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});const r=!("undefined"==typeof window||!window.document||!window.document.createElement),a={canUseDOM:r,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseIntersectionObserver:r&&"IntersectionObserver"in window,canUseViewport:r&&!!window.screen}},5260:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(6540),a=n(545);function o(e){return r.createElement(a.mg,e)}},5489:(e,t,n)=>{"use strict";n.d(t,{A:()=>p});var r=n(8168),a=n(6540),o=n(4625),i=n(440),l=n(4586),s=n(6654),c=n(8193);const u=a.createContext({collectLink:()=>{}});var d=n(6025);function f(e,t){let{isNavLink:n,to:f,href:p,activeClassName:m,isActive:h,"data-noBrokenLinkCheck":g,autoAddBaseUrl:b=!0,...v}=e;const{siteConfig:{trailingSlash:y,baseUrl:w}}=(0,l.A)(),{withBaseUrl:S}=(0,d.h)(),E=(0,a.useContext)(u),k=(0,a.useRef)(null);(0,a.useImperativeHandle)(t,(()=>k.current));const _=f||p;const O=(0,s.A)(_),x=_?.replace("pathname://","");let A=void 0!==x?(C=x,b&&(e=>e.startsWith("/"))(C)?S(C):C):void 0;var C;A&&O&&(A=(0,i.applyTrailingSlash)(A,{trailingSlash:y,baseUrl:w}));const T=(0,a.useRef)(!1),P=n?o.k2:o.N_,I=c.A.canUseIntersectionObserver,D=(0,a.useRef)();(0,a.useEffect)((()=>(!I&&O&&null!=A&&window.docusaurus.prefetch(A),()=>{I&&D.current&&D.current.disconnect()})),[D,A,I,O]);const N=A?.startsWith("#")??!1,R=!A||!O||N;return R||g||E.collectLink(A),R?a.createElement("a",(0,r.A)({ref:k,href:A},_&&!O&&{target:"_blank",rel:"noopener noreferrer"},v)):a.createElement(P,(0,r.A)({},v,{onMouseEnter:()=>{T.current||null==A||(window.docusaurus.preload(A),T.current=!0)},innerRef:e=>{k.current=e,I&&e&&O&&(D.current=new window.IntersectionObserver((t=>{t.forEach((t=>{e===t.target&&(t.isIntersecting||t.intersectionRatio>0)&&(D.current.unobserve(e),D.current.disconnect(),null!=A&&window.docusaurus.prefetch(A))}))})),D.current.observe(e))},to:A},n&&{isActive:h,activeClassName:m}))}const p=a.forwardRef(f)},1312:(e,t,n)=>{"use strict";n.d(t,{A:()=>s,T:()=>l});var r=n(6540);function a(e,t){const n=e.split(/(\{\w+\})/).map(((e,n)=>{if(n%2==1){const n=t?.[e.slice(1,-1)];if(void 0!==n)return n}return e}));return n.some((e=>(0,r.isValidElement)(e)))?n.map(((e,t)=>(0,r.isValidElement)(e)?r.cloneElement(e,{key:t}):e)).filter((e=>""!==e)):n.join("")}var o=n(2654);function i(e){let{id:t,message:n}=e;if(void 0===t&&void 0===n)throw new Error("Docusaurus translation declarations must have at least a translation id or a default translation message");return o[t??n]??n??t}function l(e,t){let{message:n,id:r}=e;return a(i({message:n,id:r}),t)}function s(e){let{children:t,id:n,values:o}=e;if(t&&"string"!=typeof t)throw console.warn("Illegal children",t),new Error("The Docusaurus component only accept simple string values");const l=i({message:t,id:n});return r.createElement(r.Fragment,null,a(l,o))}},7065:(e,t,n)=>{"use strict";n.d(t,{W:()=>r});const r="default"},6654:(e,t,n)=>{"use strict";function r(e){return/^(?:\w*:|\/\/)/.test(e)}function a(e){return void 0!==e&&!r(e)}n.d(t,{A:()=>a,z:()=>r})},6025:(e,t,n)=>{"use strict";n.d(t,{A:()=>i,h:()=>o});var r=n(4586),a=n(6654);function o(){const{siteConfig:{baseUrl:e,url:t}}=(0,r.A)();return{withBaseUrl:(n,r)=>function(e,t,n,r){let{forcePrependBaseUrl:o=!1,absolute:i=!1}=void 0===r?{}:r;if(!n||n.startsWith("#")||(0,a.z)(n))return n;if(o)return t+n.replace(/^\//,"");if(n===t.replace(/\/$/,""))return t;const l=n.startsWith(t)?n:t+n.replace(/^\//,"");return i?e+l:l}(t,e,n,r)}}function i(e,t){void 0===t&&(t={});const{withBaseUrl:n}=o();return n(e,t)}},4586:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(6540),a=n(6337);function o(){return(0,r.useContext)(a.o)}},2303:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(6540),a=n(6125);function o(){return(0,r.useContext)(a.o)}},6921:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});const r=e=>"object"==typeof e&&!!e&&Object.keys(e).length>0;function a(e){const t={};return function e(n,a){Object.entries(n).forEach((n=>{let[o,i]=n;const l=a?`${a}.${o}`:o;r(i)?e(i,l):t[l]=i}))}(e),t}},3102:(e,t,n)=>{"use strict";n.d(t,{W:()=>o,o:()=>a});var r=n(6540);const a=r.createContext(null);function o(e){let{children:t,value:n}=e;const o=r.useContext(a),i=(0,r.useMemo)((()=>function(e){let{parent:t,value:n}=e;if(!t){if(!n)throw new Error("Unexpected: no Docusaurus route context found");if(!("plugin"in n))throw new Error("Unexpected: Docusaurus topmost route context has no `plugin` attribute");return n}const r={...t.data,...n?.data};return{plugin:t.plugin,data:r}}({parent:o,value:n})),[o,n]);return r.createElement(a.Provider,{value:i},t)}},4070:(e,t,n)=>{"use strict";n.d(t,{zK:()=>b,vT:()=>p,gk:()=>m,Gy:()=>d,HW:()=>v,ht:()=>f,r7:()=>g,jh:()=>h});var r=n(6347),a=n(4586),o=n(7065);function i(e,t){void 0===t&&(t={});const n=function(){const{globalData:e}=(0,a.A)();return e}()[e];if(!n&&t.failfast)throw new Error(`Docusaurus plugin global data not found for "${e}" plugin.`);return n}const l=e=>e.versions.find((e=>e.isLast));function s(e,t){const n=l(e);return[...e.versions.filter((e=>e!==n)),n].find((e=>!!(0,r.B6)(t,{path:e.path,exact:!1,strict:!1})))}function c(e,t){const n=s(e,t),a=n?.docs.find((e=>!!(0,r.B6)(t,{path:e.path,exact:!0,strict:!1})));return{activeVersion:n,activeDoc:a,alternateDocVersions:a?function(t){const n={};return e.versions.forEach((e=>{e.docs.forEach((r=>{r.id===t&&(n[e.name]=r)}))})),n}(a.id):{}}}const u={},d=()=>i("docusaurus-plugin-content-docs")??u,f=e=>function(e,t,n){void 0===t&&(t=o.W),void 0===n&&(n={});const r=i(e),a=r?.[t];if(!a&&n.failfast)throw new Error(`Docusaurus plugin global data not found for "${e}" plugin with id "${t}".`);return a}("docusaurus-plugin-content-docs",e,{failfast:!0});function p(e){void 0===e&&(e={});const t=d(),{pathname:n}=(0,r.zy)();return function(e,t,n){void 0===n&&(n={});const a=Object.entries(e).sort(((e,t)=>t[1].path.localeCompare(e[1].path))).find((e=>{let[,n]=e;return!!(0,r.B6)(t,{path:n.path,exact:!1,strict:!1})})),o=a?{pluginId:a[0],pluginData:a[1]}:void 0;if(!o&&n.failfast)throw new Error(`Can't find active docs plugin for "${t}" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: ${Object.values(e).map((e=>e.path)).join(", ")}`);return o}(t,n,e)}function m(e){void 0===e&&(e={});const t=p(e),{pathname:n}=(0,r.zy)();if(!t)return;return{activePlugin:t,activeVersion:s(t.pluginData,n)}}function h(e){return f(e).versions}function g(e){const t=f(e);return l(t)}function b(e){const t=f(e),{pathname:n}=(0,r.zy)();return c(t,n)}function v(e){const t=f(e),{pathname:n}=(0,r.zy)();return function(e,t){const n=l(e);return{latestDocSuggestion:c(e,t).alternateDocVersions[n.name],latestVersionSuggestion:n}}(t,n)}},1911:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>o});var r=n(9568);const{trackingID:a}=r["docusaurus-plugin-google-gtag"].default,o={onRouteDidUpdate(e){let{location:t,previousLocation:n}=e;n&&t.pathname!==n.pathname&&setTimeout((()=>{window.gtag("config",a,{page_path:t.pathname,page_title:document.title}),window.gtag("event","page_view",{page_title:document.title,page_location:window.location.href,page_path:t.pathname})}))}}},6294:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>o});var r=n(5947),a=n.n(r);a().configure({showSpinner:!1});const o={onRouteUpdate(e){let{location:t,previousLocation:n}=e;if(n&&t.pathname!==n.pathname){const e=window.setTimeout((()=>{a().start()}),200);return()=>window.clearTimeout(e)}},onRouteDidUpdate(){a().done()}}},6134:(e,t,n)=>{"use strict";var r=n(1258),a=n(4784);!function(e){const{themeConfig:{prism:t}}=a.default,{additionalLanguages:r}=t;globalThis.Prism=e,r.forEach((e=>{n(8692)(`./prism-${e}`)})),delete globalThis.Prism}(r.A)},2523:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(6540);const a={iconExternalLink:"iconExternalLink_lCJq"};function o(e){let{width:t=13.5,height:n=13.5}=e;return r.createElement("svg",{width:t,height:n,"aria-hidden":"true",viewBox:"0 0 24 24",className:a.iconExternalLink},r.createElement("path",{fill:"currentColor",d:"M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"}))}},8916:(e,t,n)=>{"use strict";n.d(t,{A:()=>ct});var r=n(6540),a=n(53),o=n(7489),i=n(4090),l=n(9024),s=n(7559),c=n(1312),u=n(6347),d=n(5062);function f(e){e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")}const p={skipToContent:"skipToContent_fXgn"};function m(){const{containerRef:e,handleSkip:t}=function(){const e=(0,r.useRef)(null),{action:t}=(0,u.W6)(),n=(0,r.useCallback)((e=>{e.preventDefault();const t=document.querySelector("main:first-of-type")??document.querySelector(`.${s.G.wrapper.main}`);t&&f(t)}),[]);return(0,d.$)((n=>{let{location:r}=n;e.current&&!r.hash&&"PUSH"===t&&f(e.current)})),{containerRef:e,handleSkip:n}}();return r.createElement("div",{ref:e,role:"region"},r.createElement("a",{href:"#",className:p.skipToContent,onClick:t},r.createElement(c.A,{id:"theme.common.skipToMainContent",description:"The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation"},"Skip to main content")))}var h=n(5041),g=n(6342),b=n(8168);function v(e){let{width:t=21,height:n=21,color:a="currentColor",strokeWidth:o=1.2,className:i,...l}=e;return r.createElement("svg",(0,b.A)({viewBox:"0 0 15 15",width:t,height:n},l),r.createElement("g",{stroke:a,strokeWidth:o},r.createElement("path",{d:"M.75.75l13.5 13.5M14.25.75L.75 14.25"})))}const y={announcementBar:"announcementBar_mb4j",announcementBarPlaceholder:"announcementBarPlaceholder_vyr4",announcementBarClose:"announcementBarClose_gvF7",announcementBarContent:"announcementBarContent_xLdY"};function w(){const{isActive:e,close:t}=(0,h.Mj)(),{announcementBar:n}=(0,g.p)();if(!e)return null;const{content:o,backgroundColor:i,textColor:l,isCloseable:s}=n;return r.createElement("div",{className:y.announcementBar,style:{backgroundColor:i,color:l},role:"banner"},s&&r.createElement("div",{className:y.announcementBarPlaceholder}),r.createElement("div",{className:y.announcementBarContent,dangerouslySetInnerHTML:{__html:o}}),s?r.createElement("button",{type:"button",className:(0,a.A)("clean-btn close",y.announcementBarClose),onClick:t,"aria-label":(0,c.T)({id:"theme.AnnouncementBar.closeButtonAriaLabel",message:"Close",description:"The ARIA label for close button of announcement bar"})},r.createElement(v,{width:14,height:14,strokeWidth:3.1})):null)}var S=n(9876),E=n(3104);var k=n(9532),_=n(5600);const O=r.createContext(null);function x(e){let{children:t}=e;const n=function(){const e=(0,S.M)(),t=(0,_.YL)(),[n,a]=(0,r.useState)(!1),o=null!==t.component,i=(0,k.ZC)(o);return(0,r.useEffect)((()=>{o&&!i&&a(!0)}),[o,i]),(0,r.useEffect)((()=>{o?e.shown||a(!0):a(!1)}),[e.shown,o]),(0,r.useMemo)((()=>[n,a]),[n])}();return r.createElement(O.Provider,{value:n},t)}function A(e){if(e.component){const t=e.component;return r.createElement(t,e.props)}}function C(){const e=(0,r.useContext)(O);if(!e)throw new k.dV("NavbarSecondaryMenuDisplayProvider");const[t,n]=e,a=(0,r.useCallback)((()=>n(!1)),[n]),o=(0,_.YL)();return(0,r.useMemo)((()=>({shown:t,hide:a,content:A(o)})),[a,o,t])}function T(e){let{header:t,primaryMenu:n,secondaryMenu:o}=e;const{shown:i}=C();return r.createElement("div",{className:"navbar-sidebar"},t,r.createElement("div",{className:(0,a.A)("navbar-sidebar__items",{"navbar-sidebar__items--show-secondary":i})},r.createElement("div",{className:"navbar-sidebar__item menu"},n),r.createElement("div",{className:"navbar-sidebar__item menu"},o)))}var P=n(5293),I=n(2303);function D(e){return r.createElement("svg",(0,b.A)({viewBox:"0 0 24 24",width:24,height:24},e),r.createElement("path",{fill:"currentColor",d:"M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"}))}function N(e){return r.createElement("svg",(0,b.A)({viewBox:"0 0 24 24",width:24,height:24},e),r.createElement("path",{fill:"currentColor",d:"M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"}))}const R={toggle:"toggle_vylO",toggleButton:"toggleButton_gllP",darkToggleIcon:"darkToggleIcon_wfgR",lightToggleIcon:"lightToggleIcon_pyhR",toggleButtonDisabled:"toggleButtonDisabled_aARS"};function L(e){let{className:t,value:n,onChange:o}=e;const i=(0,I.A)(),l=(0,c.T)({message:"Switch between dark and light mode (currently {mode})",id:"theme.colorToggle.ariaLabel",description:"The ARIA label for the navbar color mode toggle"},{mode:"dark"===n?(0,c.T)({message:"dark mode",id:"theme.colorToggle.ariaLabel.mode.dark",description:"The name for the dark color mode"}):(0,c.T)({message:"light mode",id:"theme.colorToggle.ariaLabel.mode.light",description:"The name for the light color mode"})});return r.createElement("div",{className:(0,a.A)(R.toggle,t)},r.createElement("button",{className:(0,a.A)("clean-btn",R.toggleButton,!i&&R.toggleButtonDisabled),type:"button",onClick:()=>o("dark"===n?"light":"dark"),disabled:!i,title:l,"aria-label":l},r.createElement(D,{className:(0,a.A)(R.toggleIcon,R.lightToggleIcon)}),r.createElement(N,{className:(0,a.A)(R.toggleIcon,R.darkToggleIcon)})))}const j=r.memo(L);function M(e){let{className:t}=e;const n=(0,g.p)().colorMode.disableSwitch,{colorMode:a,setColorMode:o}=(0,P.G)();return n?null:r.createElement(j,{className:t,value:a,onChange:o})}var F=n(3465);function B(){return r.createElement(F.A,{className:"navbar__brand",imageClassName:"navbar__logo",titleClassName:"navbar__title text--truncate"})}function U(){const e=(0,S.M)();return r.createElement("button",{type:"button",className:"clean-btn navbar-sidebar__close",onClick:()=>e.toggle()},r.createElement(v,{color:"var(--ifm-color-emphasis-600)"}))}function z(){return r.createElement("div",{className:"navbar-sidebar__brand"},r.createElement(B,null),r.createElement(M,{className:"margin-right--md"}),r.createElement(U,null))}var q=n(5489),$=n(6025),H=n(6654),G=n(1252),V=n(2523);function W(e){let{activeBasePath:t,activeBaseRegex:n,to:a,href:o,label:i,html:l,isDropdownLink:s,prependBaseUrlToHref:c,...u}=e;const d=(0,$.A)(a),f=(0,$.A)(t),p=(0,$.A)(o,{forcePrependBaseUrl:!0}),m=i&&o&&!(0,H.A)(o),h=l?{dangerouslySetInnerHTML:{__html:l}}:{children:r.createElement(r.Fragment,null,i,m&&r.createElement(V.A,s&&{width:12,height:12}))};return o?r.createElement(q.A,(0,b.A)({href:c?p:o},u,h)):r.createElement(q.A,(0,b.A)({to:d,isNavLink:!0},(t||n)&&{isActive:(e,t)=>n?(0,G.G)(n,t.pathname):t.pathname.startsWith(f)},u,h))}function K(e){let{className:t,isDropdownItem:n=!1,...o}=e;const i=r.createElement(W,(0,b.A)({className:(0,a.A)(n?"dropdown__link":"navbar__item navbar__link",t),isDropdownLink:n},o));return n?r.createElement("li",null,i):i}function Q(e){let{className:t,isDropdownItem:n,...o}=e;return r.createElement("li",{className:"menu__list-item"},r.createElement(W,(0,b.A)({className:(0,a.A)("menu__link",t)},o)))}function Y(e){let{mobile:t=!1,position:n,...a}=e;const o=t?Q:K;return r.createElement(o,(0,b.A)({},a,{activeClassName:a.activeClassName??(t?"menu__link--active":"navbar__link--active")}))}var X=n(9169),J=n(4586);var Z=n(1422);function ee(e,t){return e.some((e=>function(e,t){return!!(0,X.ys)(e.to,t)||!!(0,G.G)(e.activeBaseRegex,t)||!(!e.activeBasePath||!t.startsWith(e.activeBasePath))}(e,t)))}function te(e){let{items:t,position:n,className:o,onClick:i,...l}=e;const s=(0,r.useRef)(null),[c,u]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{const e=e=>{s.current&&!s.current.contains(e.target)&&u(!1)};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}}),[s]),r.createElement("div",{ref:s,className:(0,a.A)("navbar__item","dropdown","dropdown--hoverable",{"dropdown--right":"right"===n,"dropdown--show":c})},r.createElement(W,(0,b.A)({"aria-haspopup":"true","aria-expanded":c,role:"button",href:l.to?void 0:"#",className:(0,a.A)("navbar__link",o)},l,{onClick:l.to?void 0:e=>e.preventDefault(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),u(!c))}}),l.children??l.label),r.createElement("ul",{className:"dropdown__menu"},t.map(((e,n)=>r.createElement(_e,(0,b.A)({isDropdownItem:!0,onKeyDown:e=>{if(n===t.length-1&&"Tab"===e.key){e.preventDefault(),u(!1);const t=s.current.nextElementSibling;if(t){(t instanceof HTMLAnchorElement?t:t.querySelector("a")).focus()}}},activeClassName:"dropdown__link--active"},e,{key:n}))))))}function ne(e){let{items:t,className:n,position:o,onClick:i,...l}=e;const s=function(){const{siteConfig:{baseUrl:e}}=(0,J.A)(),{pathname:t}=(0,u.zy)();return t.replace(e,"/")}(),c=ee(t,s),{collapsed:d,toggleCollapsed:f,setCollapsed:p}=(0,Z.u)({initialState:()=>!c});return(0,r.useEffect)((()=>{c&&p(!c)}),[s,c,p]),r.createElement("li",{className:(0,a.A)("menu__list-item",{"menu__list-item--collapsed":d})},r.createElement(W,(0,b.A)({role:"button",className:(0,a.A)("menu__link menu__link--sublist menu__link--sublist-caret",n)},l,{onClick:e=>{e.preventDefault(),f()}}),l.children??l.label),r.createElement(Z.N,{lazy:!0,as:"ul",className:"menu__list",collapsed:d},t.map(((e,t)=>r.createElement(_e,(0,b.A)({mobile:!0,isDropdownItem:!0,onClick:i,activeClassName:"menu__link--active"},e,{key:t}))))))}function re(e){let{mobile:t=!1,...n}=e;const a=t?ne:te;return r.createElement(a,n)}var ae=n(2131);function oe(e){let{width:t=20,height:n=20,...a}=e;return r.createElement("svg",(0,b.A)({viewBox:"0 0 24 24",width:t,height:n,"aria-hidden":!0},a),r.createElement("path",{fill:"currentColor",d:"M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"}))}const ie="iconLanguage_nlXk";var le=n(961),se=n(5260),ce=n(4255),ue=n(3219),de=n(2967);let fe=null;function pe(e){let{hit:t,children:n}=e;return r.createElement(q.A,{to:t.url},n)}function me(e){let{state:t,onClose:n}=e;const{generateSearchPageLink:a}=(0,ce.n)();return r.createElement(q.A,{to:a(t.query),onClick:n},r.createElement(c.A,{id:"theme.SearchBar.seeAll",values:{count:t.context.nbHits}},"See all {count} results"))}function he(e){let{contextualSearch:t,externalUrlRegex:a,...o}=e;const{siteMetadata:i}=(0,J.A)(),l=function(){const{locale:e,tags:t}=(0,de.af)();return[`language:${e}`,t.map((e=>`docusaurus_tag:${e}`))]}(),s=o.searchParameters?.facetFilters??[],d=t?function(e,t){const n=e=>"string"==typeof e?[e]:e;return[...n(e),...n(t)]}(l,s):s,f={...o.searchParameters,facetFilters:d},{withBaseUrl:p}=(0,$.h)(),m=(0,u.W6)(),h=(0,r.useRef)(null),g=(0,r.useRef)(null),[v,y]=(0,r.useState)(!1),[w,S]=(0,r.useState)(void 0),E=(0,r.useCallback)((()=>fe?Promise.resolve():Promise.all([n.e(8158).then(n.bind(n,8158)),Promise.all([n.e(1869),n.e(8913)]).then(n.bind(n,8913)),Promise.all([n.e(1869),n.e(5049)]).then(n.bind(n,5049))]).then((e=>{let[{DocSearchModal:t}]=e;fe=t}))),[]),k=(0,r.useCallback)((()=>{E().then((()=>{h.current=document.createElement("div"),document.body.insertBefore(h.current,document.body.firstChild),y(!0)}))}),[E,y]),_=(0,r.useCallback)((()=>{y(!1),h.current?.remove()}),[y]),O=(0,r.useCallback)((e=>{E().then((()=>{y(!0),S(e.key)}))}),[E,y,S]),x=(0,r.useRef)({navigate(e){let{itemUrl:t}=e;(0,G.G)(a,t)?window.location.href=t:m.push(t)}}).current,A=(0,r.useRef)((e=>e.map((e=>{if((0,G.G)(a,e.url))return e;const t=new URL(e.url);return{...e,url:p(`${t.pathname}${t.hash}`)}})))).current,C=(0,r.useMemo)((()=>e=>r.createElement(me,(0,b.A)({},e,{onClose:_}))),[_]),T=(0,r.useCallback)((e=>(e.addAlgoliaAgent("docusaurus",i.docusaurusVersion),e)),[i.docusaurusVersion]);(0,ue.E8)({isOpen:v,onOpen:k,onClose:_,onInput:O,searchButtonRef:g});const P=(0,c.T)({id:"theme.SearchBar.label",message:"Search",description:"The ARIA label and placeholder for search button"});return r.createElement(r.Fragment,null,r.createElement(se.A,null,r.createElement("link",{rel:"preconnect",href:`https://${o.appId}-dsn.algolia.net`,crossOrigin:"anonymous"})),r.createElement(ue.Bc,{onTouchStart:E,onFocus:E,onMouseOver:E,onClick:k,ref:g,translations:{buttonText:P,buttonAriaLabel:P}}),v&&fe&&h.current&&(0,le.createPortal)(r.createElement(fe,(0,b.A)({onClose:_,initialScrollY:window.scrollY,initialQuery:w,navigator:x,transformItems:A,hitComponent:pe,transformSearchClient:T},o.searchPagePath&&{resultsFooterComponent:C},o,{searchParameters:f})),h.current))}function ge(){const{siteConfig:e}=(0,J.A)();return r.createElement(he,e.themeConfig.algolia)}const be={searchBox:"searchBox_ZlJk"};function ve(e){let{children:t,className:n}=e;return r.createElement("div",{className:(0,a.A)(n,be.searchBox)},t)}var ye=n(4070),we=n(1754);var Se=n(5597);const Ee=e=>e.docs.find((t=>t.id===e.mainDocId));const ke={default:Y,localeDropdown:function(e){let{mobile:t,dropdownItemsBefore:n,dropdownItemsAfter:a,...o}=e;const{i18n:{currentLocale:i,locales:l,localeConfigs:s}}=(0,J.A)(),u=(0,ae.o)(),d=[...n,...l.map((e=>{const n=`pathname://${u.createUrl({locale:e,fullyQualified:!1})}`;return{label:s[e].label,to:n,target:"_self",autoAddBaseUrl:!1,className:e===i?t?"menu__link--active":"dropdown__link--active":""}})),...a],f=t?(0,c.T)({message:"Languages",id:"theme.navbar.mobileLanguageDropdown.label",description:"The label for the mobile language switcher dropdown"}):s[i].label;return r.createElement(re,(0,b.A)({},o,{mobile:t,label:r.createElement(r.Fragment,null,r.createElement(oe,{className:ie}),f),items:d}))},search:function(e){let{mobile:t,className:n}=e;return t?null:r.createElement(ve,{className:n},r.createElement(ge,null))},dropdown:re,html:function(e){let{value:t,className:n,mobile:o=!1,isDropdownItem:i=!1}=e;const l=i?"li":"div";return r.createElement(l,{className:(0,a.A)({navbar__item:!o&&!i,"menu__list-item":o},n),dangerouslySetInnerHTML:{__html:t}})},doc:function(e){let{docId:t,label:n,docsPluginId:a,...o}=e;const{activeDoc:i}=(0,ye.zK)(a),l=(0,we.QB)(t,a);return null===l?null:r.createElement(Y,(0,b.A)({exact:!0},o,{isActive:()=>i?.path===l.path||!!i?.sidebar&&i.sidebar===l.sidebar,label:n??l.id,to:l.path}))},docSidebar:function(e){let{sidebarId:t,label:n,docsPluginId:a,...o}=e;const{activeDoc:i}=(0,ye.zK)(a),l=(0,we.fW)(t,a).link;if(!l)throw new Error(`DocSidebarNavbarItem: Sidebar with ID "${t}" doesn't have anything to be linked to.`);return r.createElement(Y,(0,b.A)({exact:!0},o,{isActive:()=>i?.sidebar===t,label:n??l.label,to:l.path}))},docsVersion:function(e){let{label:t,to:n,docsPluginId:a,...o}=e;const i=(0,we.Vd)(a)[0],l=t??i.label,s=n??(e=>e.docs.find((t=>t.id===e.mainDocId)))(i).path;return r.createElement(Y,(0,b.A)({},o,{label:l,to:s}))},docsVersionDropdown:function(e){let{mobile:t,docsPluginId:n,dropdownActiveClassDisabled:a,dropdownItemsBefore:o,dropdownItemsAfter:i,...l}=e;const s=(0,ye.zK)(n),u=(0,ye.jh)(n),{savePreferredVersionName:d}=(0,Se.g1)(n),f=[...o,...u.map((e=>{const t=s.alternateDocVersions[e.name]??Ee(e);return{label:e.label,to:t.path,isActive:()=>e===s.activeVersion,onClick:()=>d(e.name)}})),...i],p=(0,we.Vd)(n)[0],m=t&&f.length>1?(0,c.T)({id:"theme.navbar.mobileVersionsDropdown.label",message:"Versions",description:"The label for the navbar versions dropdown on mobile view"}):p.label,h=t&&f.length>1?void 0:Ee(p).path;return f.length<=1?r.createElement(Y,(0,b.A)({},l,{mobile:t,label:m,to:h,isActive:a?()=>!1:void 0})):r.createElement(re,(0,b.A)({},l,{mobile:t,label:m,to:h,items:f,isActive:a?()=>!1:void 0}))}};function _e(e){let{type:t,...n}=e;const a=function(e,t){return e&&"default"!==e?e:"items"in t?"dropdown":"default"}(t,n),o=ke[a];if(!o)throw new Error(`No NavbarItem component found for type "${t}".`);return r.createElement(o,n)}function Oe(){const e=(0,S.M)(),t=(0,g.p)().navbar.items;return r.createElement("ul",{className:"menu__list"},t.map(((t,n)=>r.createElement(_e,(0,b.A)({mobile:!0},t,{onClick:()=>e.toggle(),key:n})))))}function xe(e){return r.createElement("button",(0,b.A)({},e,{type:"button",className:"clean-btn navbar-sidebar__back"}),r.createElement(c.A,{id:"theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel",description:"The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)"},"\u2190 Back to main menu"))}function Ae(){const e=0===(0,g.p)().navbar.items.length,t=C();return r.createElement(r.Fragment,null,!e&&r.createElement(xe,{onClick:()=>t.hide()}),t.content)}function Ce(){const e=(0,S.M)();var t;return void 0===(t=e.shown)&&(t=!0),(0,r.useEffect)((()=>(document.body.style.overflow=t?"hidden":"visible",()=>{document.body.style.overflow="visible"})),[t]),e.shouldRender?r.createElement(T,{header:r.createElement(z,null),primaryMenu:r.createElement(Oe,null),secondaryMenu:r.createElement(Ae,null)}):null}const Te={navbarHideable:"navbarHideable_m1mJ",navbarHidden:"navbarHidden_jGov"};function Pe(e){return r.createElement("div",(0,b.A)({role:"presentation"},e,{className:(0,a.A)("navbar-sidebar__backdrop",e.className)}))}function Ie(e){let{children:t}=e;const{navbar:{hideOnScroll:n,style:o}}=(0,g.p)(),i=(0,S.M)(),{navbarRef:l,isNavbarVisible:s}=function(e){const[t,n]=(0,r.useState)(e),a=(0,r.useRef)(!1),o=(0,r.useRef)(0),i=(0,r.useCallback)((e=>{null!==e&&(o.current=e.getBoundingClientRect().height)}),[]);return(0,E.Mq)(((t,r)=>{let{scrollY:i}=t;if(!e)return;if(i=l?n(!1):i+c{if(e)return t.location.hash?(a.current=!0,void n(!1)):void n(!0)})),{navbarRef:i,isNavbarVisible:t}}(n);return r.createElement("nav",{ref:l,className:(0,a.A)("navbar","navbar--fixed-top",n&&[Te.navbarHideable,!s&&Te.navbarHidden],{"navbar--dark":"dark"===o,"navbar--primary":"primary"===o,"navbar-sidebar--show":i.shown})},t,r.createElement(Pe,{onClick:i.toggle}),r.createElement(Ce,null))}const De="right";function Ne(e){let{children:t}=e;return r.createElement(_.y_,null,r.createElement(S.e,null,r.createElement(x,null,t)))}function Re(e){let{width:t=30,height:n=30,className:a,...o}=e;return r.createElement("svg",(0,b.A)({className:a,width:t,height:n,viewBox:"0 0 30 30","aria-hidden":"true"},o),r.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M4 7h22M4 15h22M4 23h22"}))}function Le(){const e=(0,S.M)();return r.createElement("button",{onClick:e.toggle,onKeyDown:e.toggle,"aria-label":"Navigation bar toggle",className:"navbar__toggle clean-btn",type:"button",tabIndex:0},r.createElement(Re,null))}const je={colorModeToggle:"colorModeToggle_DEke"};function Me(e){let{items:t}=e;return r.createElement(r.Fragment,null,t.map(((e,t)=>r.createElement(_e,(0,b.A)({},e,{key:t})))))}function Fe(e){let{left:t,right:n}=e;return r.createElement("div",{className:"navbar__inner"},r.createElement("div",{className:"navbar__items"},t),r.createElement("div",{className:"navbar__items navbar__items--right"},n))}function Be(){const e=(0,S.M)(),t=(0,g.p)().navbar.items,[n,a]=function(e){function t(e){return"left"===(e.position??De)}return[e.filter(t),e.filter((e=>!t(e)))]}(t),o=t.find((e=>"search"===e.type));return r.createElement(Fe,{left:r.createElement(r.Fragment,null,!e.disabled&&r.createElement(Le,null),r.createElement(B,null),r.createElement(Me,{items:n})),right:r.createElement(r.Fragment,null,r.createElement(Me,{items:a}),r.createElement(M,{className:je.colorModeToggle}),!o&&r.createElement(ve,null,r.createElement(ge,null)))})}function Ue(){return r.createElement(Ie,null,r.createElement(Be,null))}function ze(e){let{item:t}=e;const{to:n,href:a,label:o,prependBaseUrlToHref:i,...l}=t,s=(0,$.A)(n),c=(0,$.A)(a,{forcePrependBaseUrl:!0});return r.createElement(q.A,(0,b.A)({className:"footer__link-item"},a?{href:i?c:a}:{to:s},l),o,a&&!(0,H.A)(a)&&r.createElement(V.A,null))}function qe(e){let{item:t}=e;return t.html?r.createElement("li",{className:"footer__item",dangerouslySetInnerHTML:{__html:t.html}}):r.createElement("li",{key:t.href??t.to,className:"footer__item"},r.createElement(ze,{item:t}))}function $e(e){let{column:t}=e;return r.createElement("div",{className:"col footer__col"},r.createElement("div",{className:"footer__title"},t.title),r.createElement("ul",{className:"footer__items clean-list"},t.items.map(((e,t)=>r.createElement(qe,{key:t,item:e})))))}function He(e){let{columns:t}=e;return r.createElement("div",{className:"row footer__links"},t.map(((e,t)=>r.createElement($e,{key:t,column:e}))))}function Ge(){return r.createElement("span",{className:"footer__link-separator"},"\xb7")}function Ve(e){let{item:t}=e;return t.html?r.createElement("span",{className:"footer__link-item",dangerouslySetInnerHTML:{__html:t.html}}):r.createElement(ze,{item:t})}function We(e){let{links:t}=e;return r.createElement("div",{className:"footer__links text--center"},r.createElement("div",{className:"footer__links"},t.map(((e,n)=>r.createElement(r.Fragment,{key:n},r.createElement(Ve,{item:e}),t.length!==n+1&&r.createElement(Ge,null))))))}function Ke(e){let{links:t}=e;return function(e){return"title"in e[0]}(t)?r.createElement(He,{columns:t}):r.createElement(We,{links:t})}var Qe=n(1653);const Ye={footerLogoLink:"footerLogoLink_BH7S"};function Xe(e){let{logo:t}=e;const{withBaseUrl:n}=(0,$.h)(),a={light:n(t.src),dark:n(t.srcDark??t.src)};return r.createElement(Qe.A,{className:"footer__logo",alt:t.alt,sources:a,width:t.width,height:t.height})}function Je(e){let{logo:t}=e;return t.href?r.createElement(q.A,{href:t.href,className:Ye.footerLogoLink},r.createElement(Xe,{logo:t})):r.createElement(Xe,{logo:t})}function Ze(e){let{copyright:t}=e;return r.createElement("div",{className:"footer__copyright",dangerouslySetInnerHTML:{__html:t}})}function et(e){let{style:t,links:n,logo:o,copyright:i}=e;return r.createElement("footer",{className:(0,a.A)("footer",{"footer--dark":"dark"===t})},r.createElement("div",{className:"container container-fluid"},n,(o||i)&&r.createElement("div",{className:"footer__bottom text--center"},o&&r.createElement("div",{className:"margin-bottom--sm"},o),i)))}function tt(){const{footer:e}=(0,g.p)();if(!e)return null;const{copyright:t,links:n,logo:a,style:o}=e;return r.createElement(et,{style:o,links:n&&n.length>0&&r.createElement(Ke,{links:n}),logo:a&&r.createElement(Je,{logo:a}),copyright:t&&r.createElement(Ze,{copyright:t})})}const nt=r.memo(tt);var rt=n(9466);const at="docusaurus.tab.",ot=r.createContext(void 0);function it(e){let{children:t}=e;const n=function(){const[e,t]=(0,r.useState)({}),n=(0,r.useCallback)(((e,t)=>{(0,rt.W)(`${at}${e}`).set(t)}),[]);(0,r.useEffect)((()=>{try{const e={};(0,rt.E)().forEach((t=>{if(t.startsWith(at)){const n=t.substring(at.length);e[n]=(0,rt.W)(t).get()}})),t(e)}catch(e){console.error(e)}}),[]);const a=(0,r.useCallback)(((e,r)=>{t((t=>({...t,[e]:r}))),n(e,r)}),[n]);return(0,r.useMemo)((()=>({tabGroupChoices:e,setTabGroupChoices:a})),[e,a])}();return r.createElement(ot.Provider,{value:n},t)}function lt(e){let{children:t}=e;return r.createElement(P.a,null,r.createElement(h.oq,null,r.createElement(it,null,r.createElement(E.Tv,null,r.createElement(Se.VQ,null,r.createElement(l.Jx,null,r.createElement(Ne,null,t)))))))}function st(e){let{error:t,tryAgain:n}=e;return r.createElement("main",{className:"container margin-vert--xl"},r.createElement("div",{className:"row"},r.createElement("div",{className:"col col--6 col--offset-3"},r.createElement("h1",{className:"hero__title"},r.createElement(c.A,{id:"theme.ErrorPageContent.title",description:"The title of the fallback page when the page crashed"},"This page crashed.")),r.createElement("p",null,t.message),r.createElement("div",null,r.createElement("button",{type:"button",onClick:n},r.createElement(c.A,{id:"theme.ErrorPageContent.tryAgain",description:"The label of the button to try again when the page crashed"},"Try again"))))))}function ct(e){const{children:t,noFooter:n,wrapperClassName:c,title:u,description:d}=e;return(0,i.J)(),r.createElement(lt,null,r.createElement(l.be,{title:u,description:d}),r.createElement(m,null),r.createElement(w,null),r.createElement(Ue,null),r.createElement("div",{className:(0,a.A)(s.G.wrapper.main,c)},r.createElement(o.A,{fallback:e=>r.createElement(st,e)},t)),!n&&r.createElement(nt,null))}},3465:(e,t,n)=>{"use strict";n.d(t,{A:()=>u});var r=n(8168),a=n(6540),o=n(5489),i=n(6025),l=n(4586),s=n(6342),c=n(1653);function u(e){const{siteConfig:{title:t}}=(0,l.A)(),{navbar:{title:n,logo:u={src:""}}}=(0,s.p)(),{imageClassName:d,titleClassName:f,...p}=e,m=(0,i.A)(u.href||"/"),h={light:(0,i.A)(u.src),dark:(0,i.A)(u.srcDark||u.src)},g=a.createElement(c.A,{sources:h,height:u.height,width:u.width,alt:u.alt||n||t});return a.createElement(o.A,(0,r.A)({to:m},p,u.target&&{target:u.target}),u.src&&(d?a.createElement("div",{className:d},g):g),null!=n&&a.createElement("b",{className:f},n))}},1463:(e,t,n)=>{"use strict";n.d(t,{A:()=>o});var r=n(6540),a=n(5260);function o(e){let{locale:t,version:n,tag:o}=e;const i=t;return r.createElement(a.A,null,t&&r.createElement("meta",{name:"docusaurus_locale",content:t}),n&&r.createElement("meta",{name:"docusaurus_version",content:n}),o&&r.createElement("meta",{name:"docusaurus_tag",content:o}),i&&r.createElement("meta",{name:"docsearch:language",content:i}),n&&r.createElement("meta",{name:"docsearch:version",content:n}),o&&r.createElement("meta",{name:"docsearch:docusaurus_tag",content:o}))}},1653:(e,t,n)=>{"use strict";n.d(t,{A:()=>c});var r=n(8168),a=n(6540),o=n(53),i=n(2303),l=n(5293);const s={themedImage:"themedImage_ToTc","themedImage--light":"themedImage--light_HNdA","themedImage--dark":"themedImage--dark_i4oU"};function c(e){const t=(0,i.A)(),{colorMode:n}=(0,l.G)(),{sources:c,className:u,alt:d,...f}=e,p=t?"dark"===n?["dark"]:["light"]:["light","dark"];return a.createElement(a.Fragment,null,p.map((e=>a.createElement("img",(0,r.A)({key:e,src:c[e],alt:d,className:(0,o.A)(s.themedImage,s[`themedImage--${e}`],u)},f)))))}},1422:(e,t,n)=>{"use strict";n.d(t,{N:()=>h,u:()=>l});var r=n(8168),a=n(6540),o=n(8193);const i="ease-in-out";function l(e){let{initialState:t}=e;const[n,r]=(0,a.useState)(t??!1),o=(0,a.useCallback)((()=>{r((e=>!e))}),[]);return{collapsed:n,setCollapsed:r,toggleCollapsed:o}}const s={display:"none",overflow:"hidden",height:"0px"},c={display:"block",overflow:"visible",height:"auto"};function u(e,t){const n=t?s:c;e.style.display=n.display,e.style.overflow=n.overflow,e.style.height=n.height}function d(e){let{collapsibleRef:t,collapsed:n,animation:r}=e;const o=(0,a.useRef)(!1);(0,a.useEffect)((()=>{const e=t.current;function a(){const t=e.scrollHeight,n=r?.duration??function(e){const t=e/36;return Math.round(10*(4+15*t**.25+t/5))}(t);return{transition:`height ${n}ms ${r?.easing??i}`,height:`${t}px`}}function l(){const t=a();e.style.transition=t.transition,e.style.height=t.height}if(!o.current)return u(e,n),void(o.current=!0);return e.style.willChange="height",function(){const t=requestAnimationFrame((()=>{n?(l(),requestAnimationFrame((()=>{e.style.height=s.height,e.style.overflow=s.overflow}))):(e.style.display="block",requestAnimationFrame((()=>{l()})))}));return()=>cancelAnimationFrame(t)}()}),[t,n,r])}function f(e){if(!o.A.canUseDOM)return e?s:c}function p(e){let{as:t="div",collapsed:n,children:r,animation:o,onCollapseTransitionEnd:i,className:l,disableSSRStyle:s}=e;const c=(0,a.useRef)(null);return d({collapsibleRef:c,collapsed:n,animation:o}),a.createElement(t,{ref:c,style:s?void 0:f(n),onTransitionEnd:e=>{"height"===e.propertyName&&(u(c.current,n),i?.(n))},className:l},r)}function m(e){let{collapsed:t,...n}=e;const[o,i]=(0,a.useState)(!t),[l,s]=(0,a.useState)(t);return(0,a.useLayoutEffect)((()=>{t||i(!0)}),[t]),(0,a.useLayoutEffect)((()=>{o&&s(t)}),[o,t]),o?a.createElement(p,(0,r.A)({},n,{collapsed:l})):null}function h(e){let{lazy:t,...n}=e;const r=t?m:p;return a.createElement(r,n)}},5041:(e,t,n)=>{"use strict";n.d(t,{Mj:()=>m,oq:()=>p});var r=n(6540),a=n(2303),o=n(9466),i=n(9532),l=n(6342);const s=(0,o.W)("docusaurus.announcement.dismiss"),c=(0,o.W)("docusaurus.announcement.id"),u=()=>"true"===s.get(),d=e=>s.set(String(e)),f=r.createContext(null);function p(e){let{children:t}=e;const n=function(){const{announcementBar:e}=(0,l.p)(),t=(0,a.A)(),[n,o]=(0,r.useState)((()=>!!t&&u()));(0,r.useEffect)((()=>{o(u())}),[]);const i=(0,r.useCallback)((()=>{d(!0),o(!0)}),[]);return(0,r.useEffect)((()=>{if(!e)return;const{id:t}=e;let n=c.get();"annoucement-bar"===n&&(n="announcement-bar");const r=t!==n;c.set(t),r&&d(!1),!r&&u()||o(!1)}),[e]),(0,r.useMemo)((()=>({isActive:!!e&&!n,close:i})),[e,n,i])}();return r.createElement(f.Provider,{value:n},t)}function m(){const e=(0,r.useContext)(f);if(!e)throw new i.dV("AnnouncementBarProvider");return e}},5293:(e,t,n)=>{"use strict";n.d(t,{G:()=>g,a:()=>h});var r=n(6540),a=n(8193),o=n(9532),i=n(9466),l=n(6342);const s=r.createContext(void 0),c="theme",u=(0,i.W)(c),d={light:"light",dark:"dark"},f=e=>e===d.dark?d.dark:d.light,p=e=>a.A.canUseDOM?f(document.documentElement.getAttribute("data-theme")):f(e),m=e=>{u.set(f(e))};function h(e){let{children:t}=e;const n=function(){const{colorMode:{defaultMode:e,disableSwitch:t,respectPrefersColorScheme:n}}=(0,l.p)(),[a,o]=(0,r.useState)(p(e));(0,r.useEffect)((()=>{t&&u.del()}),[t]);const i=(0,r.useCallback)((function(t,r){void 0===r&&(r={});const{persist:a=!0}=r;t?(o(t),a&&m(t)):(o(n?window.matchMedia("(prefers-color-scheme: dark)").matches?d.dark:d.light:e),u.del())}),[n,e]);(0,r.useEffect)((()=>{document.documentElement.setAttribute("data-theme",f(a))}),[a]),(0,r.useEffect)((()=>{if(t)return;const e=e=>{if(e.key!==c)return;const t=u.get();null!==t&&i(f(t))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)}),[t,i]);const s=(0,r.useRef)(!1);return(0,r.useEffect)((()=>{if(t&&!n)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>{window.matchMedia("print").matches||s.current?s.current=window.matchMedia("print").matches:i(null)};return e.addListener(r),()=>e.removeListener(r)}),[i,t,n]),(0,r.useMemo)((()=>({colorMode:a,setColorMode:i,get isDarkTheme(){return a===d.dark},setLightTheme(){i(d.light)},setDarkTheme(){i(d.dark)}})),[a,i])}();return r.createElement(s.Provider,{value:n},t)}function g(){const e=(0,r.useContext)(s);if(null==e)throw new o.dV("ColorModeProvider","Please see https://docusaurus.io/docs/api/themes/configuration#use-color-mode.");return e}},5597:(e,t,n)=>{"use strict";n.d(t,{VQ:()=>g,XK:()=>y,g1:()=>v});var r=n(6540),a=n(4070),o=n(7065),i=n(6342),l=n(1754),s=n(9532),c=n(9466);const u=e=>`docs-preferred-version-${e}`,d={save:(e,t,n)=>{(0,c.W)(u(e),{persistence:t}).set(n)},read:(e,t)=>(0,c.W)(u(e),{persistence:t}).get(),clear:(e,t)=>{(0,c.W)(u(e),{persistence:t}).del()}},f=e=>Object.fromEntries(e.map((e=>[e,{preferredVersionName:null}])));const p=r.createContext(null);function m(){const e=(0,a.Gy)(),t=(0,i.p)().docs.versionPersistence,n=(0,r.useMemo)((()=>Object.keys(e)),[e]),[o,l]=(0,r.useState)((()=>f(n)));(0,r.useEffect)((()=>{l(function(e){let{pluginIds:t,versionPersistence:n,allDocsData:r}=e;function a(e){const t=d.read(e,n);return r[e].versions.some((e=>e.name===t))?{preferredVersionName:t}:(d.clear(e,n),{preferredVersionName:null})}return Object.fromEntries(t.map((e=>[e,a(e)])))}({allDocsData:e,versionPersistence:t,pluginIds:n}))}),[e,t,n]);return[o,(0,r.useMemo)((()=>({savePreferredVersion:function(e,n){d.save(e,t,n),l((t=>({...t,[e]:{preferredVersionName:n}})))}})),[t])]}function h(e){let{children:t}=e;const n=m();return r.createElement(p.Provider,{value:n},t)}function g(e){let{children:t}=e;return l.C5?r.createElement(h,null,t):t}function b(){const e=(0,r.useContext)(p);if(!e)throw new s.dV("DocsPreferredVersionContextProvider");return e}function v(e){void 0===e&&(e=o.W);const t=(0,a.ht)(e),[n,i]=b(),{preferredVersionName:l}=n[e];return{preferredVersion:t.versions.find((e=>e.name===l))??null,savePreferredVersionName:(0,r.useCallback)((t=>{i.savePreferredVersion(e,t)}),[i,e])}}function y(){const e=(0,a.Gy)(),[t]=b();function n(n){const r=e[n],{preferredVersionName:a}=t[n];return r.versions.find((e=>e.name===a))??null}const r=Object.keys(e);return Object.fromEntries(r.map((e=>[e,n(e)])))}},6588:(e,t,n)=>{"use strict";n.d(t,{V:()=>l,t:()=>s});var r=n(6540),a=n(9532);const o=Symbol("EmptyContext"),i=r.createContext(o);function l(e){let{children:t,name:n,items:a}=e;const o=(0,r.useMemo)((()=>n&&a?{name:n,items:a}:null),[n,a]);return r.createElement(i.Provider,{value:o},t)}function s(){const e=(0,r.useContext)(i);if(e===o)throw new a.dV("DocsSidebarProvider");return e}},9876:(e,t,n)=>{"use strict";n.d(t,{e:()=>f,M:()=>p});var r=n(6540),a=n(5600),o=n(4581),i=n(6347),l=n(9532);function s(e){!function(e){const{block:t}=(0,i.W6)(),n=(0,l.qd)(e);(0,r.useEffect)((()=>t(((e,t)=>n(e,t)))),[t,n])}(((t,n)=>{if("POP"===n)return e(t,n)}))}var c=n(6342);const u=r.createContext(void 0);function d(){const e=function(){const e=(0,a.YL)(),{items:t}=(0,c.p)().navbar;return 0===t.length&&!e.component}(),t=(0,o.l)(),n=!e&&"mobile"===t,[i,l]=(0,r.useState)(!1);s((()=>{if(i)return l(!1),!1}));const u=(0,r.useCallback)((()=>{l((e=>!e))}),[]);return(0,r.useEffect)((()=>{"desktop"===t&&l(!1)}),[t]),(0,r.useMemo)((()=>({disabled:e,shouldRender:n,toggle:u,shown:i})),[e,n,u,i])}function f(e){let{children:t}=e;const n=d();return r.createElement(u.Provider,{value:n},t)}function p(){const e=r.useContext(u);if(void 0===e)throw new l.dV("NavbarMobileSidebarProvider");return e}},5600:(e,t,n)=>{"use strict";n.d(t,{GX:()=>s,YL:()=>l,y_:()=>i});var r=n(6540),a=n(9532);const o=r.createContext(null);function i(e){let{children:t}=e;const n=(0,r.useState)({component:null,props:null});return r.createElement(o.Provider,{value:n},t)}function l(){const e=(0,r.useContext)(o);if(!e)throw new a.dV("NavbarSecondaryMenuContentProvider");return e[0]}function s(e){let{component:t,props:n}=e;const i=(0,r.useContext)(o);if(!i)throw new a.dV("NavbarSecondaryMenuContentProvider");const[,l]=i,s=(c=n,(0,r.useMemo)((()=>c),[...Object.keys(c),...Object.values(c)]));var c;return(0,r.useEffect)((()=>{l({component:t,props:s})}),[l,t,s]),(0,r.useEffect)((()=>()=>l({component:null,props:null})),[l]),null}},4090:(e,t,n)=>{"use strict";n.d(t,{w:()=>a,J:()=>o});var r=n(6540);const a="navigation-with-keyboard";function o(){(0,r.useEffect)((()=>{function e(e){"keydown"===e.type&&"Tab"===e.key&&document.body.classList.add(a),"mousedown"===e.type&&document.body.classList.remove(a)}return document.addEventListener("keydown",e),document.addEventListener("mousedown",e),()=>{document.body.classList.remove(a),document.removeEventListener("keydown",e),document.removeEventListener("mousedown",e)}}),[])}},4255:(e,t,n)=>{"use strict";n.d(t,{n:()=>l});var r=n(6540),a=n(6347),o=n(4586);const i="q";function l(){const e=(0,a.W6)(),{siteConfig:{baseUrl:t}}=(0,o.A)(),[n,l]=(0,r.useState)("");(0,r.useEffect)((()=>{const e=new URLSearchParams(window.location.search).get(i)??"";l(e)}),[]);return{searchQuery:n,setSearchQuery:(0,r.useCallback)((t=>{const n=new URLSearchParams(window.location.search);t?n.set(i,t):n.delete(i),e.replace({search:n.toString()}),l(t)}),[e]),generateSearchPageLink:(0,r.useCallback)((e=>`${t}search?${i}=${encodeURIComponent(e)}`),[t])}}},4581:(e,t,n)=>{"use strict";n.d(t,{l:()=>c});var r=n(6540),a=n(8193);const o={desktop:"desktop",mobile:"mobile",ssr:"ssr"},i=996;function l(){return a.A.canUseDOM?window.innerWidth>i?o.desktop:o.mobile:o.ssr}const s=!1;function c(){const[e,t]=(0,r.useState)((()=>s?"ssr":l()));return(0,r.useEffect)((()=>{function e(){t(l())}const n=s?window.setTimeout(e,1e3):void 0;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e),clearTimeout(n)}}),[]),e}},7559:(e,t,n)=>{"use strict";n.d(t,{G:()=>r});const r={page:{blogListPage:"blog-list-page",blogPostPage:"blog-post-page",blogTagsListPage:"blog-tags-list-page",blogTagPostListPage:"blog-tags-post-list-page",docsDocPage:"docs-doc-page",docsTagsListPage:"docs-tags-list-page",docsTagDocListPage:"docs-tags-doc-list-page",mdxPage:"mdx-page"},wrapper:{main:"main-wrapper",blogPages:"blog-wrapper",docsPages:"docs-wrapper",mdxPages:"mdx-wrapper"},common:{editThisPage:"theme-edit-this-page",lastUpdated:"theme-last-updated",backToTopButton:"theme-back-to-top-button",codeBlock:"theme-code-block"},layout:{},docs:{docVersionBanner:"theme-doc-version-banner",docVersionBadge:"theme-doc-version-badge",docBreadcrumbs:"theme-doc-breadcrumbs",docMarkdown:"theme-doc-markdown",docTocMobile:"theme-doc-toc-mobile",docTocDesktop:"theme-doc-toc-desktop",docFooter:"theme-doc-footer",docFooterTagsRow:"theme-doc-footer-tags-row",docFooterEditMetaRow:"theme-doc-footer-edit-meta-row",docSidebarContainer:"theme-doc-sidebar-container",docSidebarMenu:"theme-doc-sidebar-menu",docSidebarItemCategory:"theme-doc-sidebar-item-category",docSidebarItemLink:"theme-doc-sidebar-item-link",docSidebarItemCategoryLevel:e=>`theme-doc-sidebar-item-category-level-${e}`,docSidebarItemLinkLevel:e=>`theme-doc-sidebar-item-link-level-${e}`},blog:{}}},1754:(e,t,n)=>{"use strict";n.d(t,{_o:()=>f,w8:()=>h,C5:()=>d,mz:()=>w,Vd:()=>b,QB:()=>y,fW:()=>v,OF:()=>g});var r=n(6540),a=n(6347),o=n(2831),i=n(4070),l=n(5597),s=n(6588);function c(e){return Array.from(new Set(e))}var u=n(9169);const d=!!i.Gy;function f(e){if(e.href)return e.href;for(const t of e.items){if("link"===t.type)return t.href;if("category"===t.type){const e=f(t);if(e)return e}}}const p=(e,t)=>void 0!==e&&(0,u.ys)(e,t),m=(e,t)=>e.some((e=>h(e,t)));function h(e,t){return"link"===e.type?p(e.href,t):"category"===e.type&&(p(e.href,t)||m(e.items,t))}function g(){const e=(0,s.t)(),{pathname:t}=(0,a.zy)(),n=(0,i.vT)()?.pluginData.breadcrumbs;if(!1===n||!e)return null;const r=[];return function e(n){for(const a of n)if("category"===a.type&&((0,u.ys)(a.href,t)||e(a.items))||"link"===a.type&&(0,u.ys)(a.href,t))return r.push(a),!0;return!1}(e.items),r.reverse()}function b(e){const{activeVersion:t}=(0,i.zK)(e),{preferredVersion:n}=(0,l.g1)(e),a=(0,i.r7)(e);return(0,r.useMemo)((()=>c([t,n,a].filter(Boolean))),[t,n,a])}function v(e,t){const n=b(t);return(0,r.useMemo)((()=>{const t=n.flatMap((e=>e.sidebars?Object.entries(e.sidebars):[])),r=t.find((t=>t[0]===e));if(!r)throw new Error(`Can't find any sidebar with id "${e}" in version${n.length>1?"s":""} ${n.map((e=>e.name)).join(", ")}".\n Available sidebar ids are:\n - ${Object.keys(t).join("\n- ")}`);return r[1]}),[e,n])}function y(e,t){const n=b(t);return(0,r.useMemo)((()=>{const t=n.flatMap((e=>e.docs)),r=t.find((t=>t.id===e));if(!r){if(n.flatMap((e=>e.draftIds)).includes(e))return null;throw new Error(`DocNavbarItem: couldn't find any doc with id "${e}" in version${n.length>1?"s":""} ${n.map((e=>e.name)).join(", ")}".\nAvailable doc ids are:\n- ${c(t.map((e=>e.id))).join("\n- ")}`)}return r}),[e,n])}function w(e){let{route:t,versionMetadata:n}=e;const r=(0,a.zy)(),i=t.routes,l=i.find((e=>(0,a.B6)(r.pathname,e)));if(!l)return null;const s=l.sidebar,c=s?n.docsSidebars[s]:void 0;return{docElement:(0,o.v)(i,{versionMetadata:n}),sidebarName:s,sidebarItems:c}}},481:(e,t,n)=>{"use strict";n.d(t,{s:()=>a});var r=n(4586);function a(e){const{siteConfig:t}=(0,r.A)(),{title:n,titleDelimiter:a}=t;return e?.trim().length?`${e.trim()} ${a} ${n}`:n}},9024:(e,t,n)=>{"use strict";n.d(t,{e3:()=>f,be:()=>u,Jx:()=>p});var r=n(6540),a=n(53),o=n(5260),i=n(3102);function l(){const e=r.useContext(i.o);if(!e)throw new Error("Unexpected: no Docusaurus route context found");return e}var s=n(6025),c=n(481);function u(e){let{title:t,description:n,keywords:a,image:i,children:l}=e;const u=(0,c.s)(t),{withBaseUrl:d}=(0,s.h)(),f=i?d(i,{absolute:!0}):void 0;return r.createElement(o.A,null,t&&r.createElement("title",null,u),t&&r.createElement("meta",{property:"og:title",content:u}),n&&r.createElement("meta",{name:"description",content:n}),n&&r.createElement("meta",{property:"og:description",content:n}),a&&r.createElement("meta",{name:"keywords",content:Array.isArray(a)?a.join(","):a}),f&&r.createElement("meta",{property:"og:image",content:f}),f&&r.createElement("meta",{name:"twitter:image",content:f}),l)}const d=r.createContext(void 0);function f(e){let{className:t,children:n}=e;const i=r.useContext(d),l=(0,a.A)(i,t);return r.createElement(d.Provider,{value:l},r.createElement(o.A,null,r.createElement("html",{className:l})),n)}function p(e){let{children:t}=e;const n=l(),o=`plugin-${n.plugin.name.replace(/docusaurus-(?:plugin|theme)-(?:content-)?/gi,"")}`;const i=`plugin-id-${n.plugin.id}`;return r.createElement(f,{className:(0,a.A)(o,i)},t)}},9532:(e,t,n)=>{"use strict";n.d(t,{ZC:()=>i,dV:()=>l,qd:()=>o});var r=n(6540);const a=n(8193).A.canUseDOM?r.useLayoutEffect:r.useEffect;function o(e){const t=(0,r.useRef)(e);return a((()=>{t.current=e}),[e]),(0,r.useCallback)((function(){return t.current(...arguments)}),[])}function i(e){const t=(0,r.useRef)();return a((()=>{t.current=e})),t.current}class l extends Error{constructor(e,t){super(),this.name="ReactContextError",this.message=`Hook ${this.stack?.split("\n")[1]?.match(/at (?:\w+\.)?(?\w+)/)?.groups.name??""} is called outside the <${e}>. ${t??""}`}}},1252:(e,t,n)=>{"use strict";function r(e,t){return void 0!==e&&void 0!==t&&new RegExp(e,"gi").test(t)}n.d(t,{G:()=>r})},9169:(e,t,n)=>{"use strict";n.d(t,{Dt:()=>l,ys:()=>i});var r=n(6540),a=n(8328),o=n(4586);function i(e,t){const n=e=>(!e||e.endsWith("/")?e:`${e}/`)?.toLowerCase();return n(e)===n(t)}function l(){const{baseUrl:e}=(0,o.A)().siteConfig;return(0,r.useMemo)((()=>function(e){let{baseUrl:t,routes:n}=e;function r(e){return e.path===t&&!0===e.exact}function a(e){return e.path===t&&!e.exact}return function e(t){if(0===t.length)return;return t.find(r)||e(t.filter(a).flatMap((e=>e.routes??[])))}(n)}({routes:a.A,baseUrl:e})),[e])}},3104:(e,t,n)=>{"use strict";n.d(t,{Mq:()=>d,Tv:()=>s,gk:()=>f});var r=n(6540),a=n(8193),o=n(2303),i=n(9532);const l=r.createContext(void 0);function s(e){let{children:t}=e;const n=function(){const e=(0,r.useRef)(!0);return(0,r.useMemo)((()=>({scrollEventsEnabledRef:e,enableScrollEvents:()=>{e.current=!0},disableScrollEvents:()=>{e.current=!1}})),[])}();return r.createElement(l.Provider,{value:n},t)}function c(){const e=(0,r.useContext)(l);if(null==e)throw new i.dV("ScrollControllerProvider");return e}const u=()=>a.A.canUseDOM?{scrollX:window.pageXOffset,scrollY:window.pageYOffset}:null;function d(e,t){void 0===t&&(t=[]);const{scrollEventsEnabledRef:n}=c(),a=(0,r.useRef)(u()),o=(0,i.qd)(e);(0,r.useEffect)((()=>{const e=()=>{if(!n.current)return;const e=u();o(e,a.current),a.current=e},t={passive:!0};return e(),window.addEventListener("scroll",e,t),()=>window.removeEventListener("scroll",e,t)}),[o,n,...t])}function f(){const e=(0,r.useRef)(null),t=(0,o.A)()&&"smooth"===getComputedStyle(document.documentElement).scrollBehavior;return{startScroll:n=>{e.current=t?function(e){return window.scrollTo({top:e,behavior:"smooth"}),()=>{}}(n):function(e){let t=null;const n=document.documentElement.scrollTop>e;return function r(){const a=document.documentElement.scrollTop;(n&&a>e||!n&&at&&cancelAnimationFrame(t)}(n)},cancelScroll:()=>e.current?.()}}},2967:(e,t,n)=>{"use strict";n.d(t,{Cy:()=>i,af:()=>s,tU:()=>l});var r=n(4070),a=n(4586),o=n(5597);const i="default";function l(e,t){return`docs-${e}-${t}`}function s(){const{i18n:e}=(0,a.A)(),t=(0,r.Gy)(),n=(0,r.gk)(),s=(0,o.XK)();const c=[i,...Object.keys(t).map((function(e){const r=n?.activePlugin.pluginId===e?n.activeVersion:void 0,a=s[e],o=t[e].versions.find((e=>e.isLast));return l(e,(r??a??o).name)}))];return{locale:e.currentLocale,tags:c}}},9466:(e,t,n)=>{"use strict";n.d(t,{E:()=>s,W:()=>l});const r="localStorage";function a(e){if(void 0===e&&(e=r),"undefined"==typeof window)throw new Error("Browser storage is not available on Node.js/Docusaurus SSR process.");if("none"===e)return null;try{return window[e]}catch(n){return t=n,o||(console.warn("Docusaurus browser storage is not available.\nPossible reasons: running Docusaurus in an iframe, in an incognito browser session, or using too strict browser privacy settings.",t),o=!0),null}var t}let o=!1;const i={get:()=>null,set:()=>{},del:()=>{}};function l(e,t){if("undefined"==typeof window)return function(e){function t(){throw new Error(`Illegal storage API usage for storage key "${e}".\nDocusaurus storage APIs are not supposed to be called on the server-rendering process.\nPlease only call storage APIs in effects and event handlers.`)}return{get:t,set:t,del:t}}(e);const n=a(t?.persistence);return null===n?i:{get:()=>{try{return n.getItem(e)}catch(t){return console.error(`Docusaurus storage error, can't get key=${e}`,t),null}},set:t=>{try{n.setItem(e,t)}catch(r){console.error(`Docusaurus storage error, can't set ${e}=${t}`,r)}},del:()=>{try{n.removeItem(e)}catch(t){console.error(`Docusaurus storage error, can't delete key=${e}`,t)}}}}function s(e){void 0===e&&(e=r);const t=a(e);if(!t)return[];const n=[];for(let r=0;r{"use strict";n.d(t,{o:()=>o});var r=n(4586),a=n(6347);function o(){const{siteConfig:{baseUrl:e,url:t},i18n:{defaultLocale:n,currentLocale:o}}=(0,r.A)(),{pathname:i}=(0,a.zy)(),l=o===n?e:e.replace(`/${o}/`,"/"),s=i.replace(e,"");return{createUrl:function(e){let{locale:r,fullyQualified:a}=e;return`${a?t:""}${function(e){return e===n?`${l}`:`${l}${e}/`}(r)}${s}`}}}},5062:(e,t,n)=>{"use strict";n.d(t,{$:()=>i});var r=n(6540),a=n(6347),o=n(9532);function i(e){const t=(0,a.zy)(),n=(0,o.ZC)(t),i=(0,o.qd)(e);(0,r.useEffect)((()=>{n&&t!==n&&i({location:t,previousLocation:n})}),[i,t,n])}},6342:(e,t,n)=>{"use strict";n.d(t,{p:()=>a});var r=n(4586);function a(){return(0,r.A)().siteConfig.themeConfig}},2983:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){const{trailingSlash:n,baseUrl:r}=t;if(e.startsWith("#"))return e;if(void 0===n)return e;const[a]=e.split(/[#?]/),o="/"===a||a===r?a:(i=a,n?function(e){return e.endsWith("/")?e:`${e}/`}(i):function(e){return e.endsWith("/")?e.slice(0,-1):e}(i));var i;return e.replace(a,o)}},440:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.applyTrailingSlash=t.blogPostContainerID=void 0,t.blogPostContainerID="post-content";var a=n(2983);Object.defineProperty(t,"applyTrailingSlash",{enumerable:!0,get:function(){return r(a).default}})},53:(e,t,n)=>{"use strict";function r(e){var t,n,a="";if("string"==typeof e||"number"==typeof e)a+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;ta});const a=function(){for(var e,t,n=0,a="";n{"use strict";n.d(t,{zR:()=>w,TM:()=>x,yJ:()=>p,sC:()=>C,AO:()=>f});var r=n(8168);function a(e){return"/"===e.charAt(0)}function o(e,t){for(var n=t,r=n+1,a=e.length;r=0;f--){var p=i[f];"."===p?o(i,f):".."===p?(o(i,f),d++):d&&(o(i,f),d--)}if(!c)for(;d--;d)i.unshift("..");!c||""===i[0]||i[0]&&a(i[0])||i.unshift("");var m=i.join("/");return n&&"/"!==m.substr(-1)&&(m+="/"),m};var l=n(1561);function s(e){return"/"===e.charAt(0)?e:"/"+e}function c(e){return"/"===e.charAt(0)?e.substr(1):e}function u(e,t){return function(e,t){return 0===e.toLowerCase().indexOf(t.toLowerCase())&&-1!=="/?#".indexOf(e.charAt(t.length))}(e,t)?e.substr(t.length):e}function d(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e}function f(e){var t=e.pathname,n=e.search,r=e.hash,a=t||"/";return n&&"?"!==n&&(a+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(a+="#"===r.charAt(0)?r:"#"+r),a}function p(e,t,n,a){var o;"string"==typeof e?(o=function(e){var t=e||"/",n="",r="",a=t.indexOf("#");-1!==a&&(r=t.substr(a),t=t.substr(0,a));var o=t.indexOf("?");return-1!==o&&(n=t.substr(o),t=t.substr(0,o)),{pathname:t,search:"?"===n?"":n,hash:"#"===r?"":r}}(e),o.state=t):(void 0===(o=(0,r.A)({},e)).pathname&&(o.pathname=""),o.search?"?"!==o.search.charAt(0)&&(o.search="?"+o.search):o.search="",o.hash?"#"!==o.hash.charAt(0)&&(o.hash="#"+o.hash):o.hash="",void 0!==t&&void 0===o.state&&(o.state=t));try{o.pathname=decodeURI(o.pathname)}catch(l){throw l instanceof URIError?new URIError('Pathname "'+o.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):l}return n&&(o.key=n),a?o.pathname?"/"!==o.pathname.charAt(0)&&(o.pathname=i(o.pathname,a.pathname)):o.pathname=a.pathname:o.pathname||(o.pathname="/"),o}function m(){var e=null;var t=[];return{setPrompt:function(t){return e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,n,r,a){if(null!=e){var o="function"==typeof e?e(t,n):e;"string"==typeof o?"function"==typeof r?r(o,a):a(!0):a(!1!==o)}else a(!0)},appendListener:function(e){var n=!0;function r(){n&&e.apply(void 0,arguments)}return t.push(r),function(){n=!1,t=t.filter((function(e){return e!==r}))}},notifyListeners:function(){for(var e=arguments.length,n=new Array(e),r=0;rt?n.splice(t,n.length-t,a):n.push(a),d({action:r,location:a,index:t,entries:n})}}))},replace:function(e,t){var r="REPLACE",a=p(e,t,h(),w.location);u.confirmTransitionTo(a,r,n,(function(e){e&&(w.entries[w.index]=a,d({action:r,location:a}))}))},go:y,goBack:function(){y(-1)},goForward:function(){y(1)},canGo:function(e){var t=w.index+e;return t>=0&&t{"use strict";var r=n(4363),a={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function s(e){return r.isMemo(e)?i:l[e.$$typeof]||a}l[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l[r.Memo]=i;var c=Object.defineProperty,u=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,p=Object.getPrototypeOf,m=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(m){var a=p(n);a&&a!==m&&e(t,a,r)}var i=u(n);d&&(i=i.concat(d(n)));for(var l=s(t),h=s(n),g=0;g{"use strict";e.exports=function(e,t,n,r,a,o,i,l){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,a,o,i,l],u=0;(s=new Error(t.replace(/%s/g,(function(){return c[u++]})))).name="Invariant Violation"}throw s.framesToPop=1,s}}},4634:e=>{e.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},435:(e,t,n)=>{"use strict";n.r(t)},119:(e,t,n)=>{"use strict";n.r(t)},1043:(e,t,n)=>{"use strict";n.r(t)},5947:function(e,t,n){var r,a;r=function(){var e,t,n={version:"0.2.0"},r=n.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'
'};function a(e,t,n){return en?n:e}function o(e){return 100*(-1+e)}function i(e,t,n){var a;return(a="translate3d"===r.positionUsing?{transform:"translate3d("+o(e)+"%,0,0)"}:"translate"===r.positionUsing?{transform:"translate("+o(e)+"%,0)"}:{"margin-left":o(e)+"%"}).transition="all "+t+"ms "+n,a}n.configure=function(e){var t,n;for(t in e)void 0!==(n=e[t])&&e.hasOwnProperty(t)&&(r[t]=n);return this},n.status=null,n.set=function(e){var t=n.isStarted();e=a(e,r.minimum,1),n.status=1===e?null:e;var o=n.render(!t),c=o.querySelector(r.barSelector),u=r.speed,d=r.easing;return o.offsetWidth,l((function(t){""===r.positionUsing&&(r.positionUsing=n.getPositioningCSS()),s(c,i(e,u,d)),1===e?(s(o,{transition:"none",opacity:1}),o.offsetWidth,setTimeout((function(){s(o,{transition:"all "+u+"ms linear",opacity:0}),setTimeout((function(){n.remove(),t()}),u)}),u)):setTimeout(t,u)})),this},n.isStarted=function(){return"number"==typeof n.status},n.start=function(){n.status||n.set(0);var e=function(){setTimeout((function(){n.status&&(n.trickle(),e())}),r.trickleSpeed)};return r.trickle&&e(),this},n.done=function(e){return e||n.status?n.inc(.3+.5*Math.random()).set(1):this},n.inc=function(e){var t=n.status;return t?("number"!=typeof e&&(e=(1-t)*a(Math.random()*t,.1,.95)),t=a(t+e,0,.994),n.set(t)):n.start()},n.trickle=function(){return n.inc(Math.random()*r.trickleRate)},e=0,t=0,n.promise=function(r){return r&&"resolved"!==r.state()?(0===t&&n.start(),e++,t++,r.always((function(){0==--t?(e=0,n.done()):n.set((e-t)/e)})),this):this},n.render=function(e){if(n.isRendered())return document.getElementById("nprogress");u(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=r.template;var a,i=t.querySelector(r.barSelector),l=e?"-100":o(n.status||0),c=document.querySelector(r.parent);return s(i,{transition:"all 0 linear",transform:"translate3d("+l+"%,0,0)"}),r.showSpinner||(a=t.querySelector(r.spinnerSelector))&&p(a),c!=document.body&&u(c,"nprogress-custom-parent"),c.appendChild(t),t},n.remove=function(){d(document.documentElement,"nprogress-busy"),d(document.querySelector(r.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&p(e)},n.isRendered=function(){return!!document.getElementById("nprogress")},n.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective"in e?"translate3d":t+"Transform"in e?"translate":"margin"};var l=function(){var e=[];function t(){var n=e.shift();n&&n(t)}return function(n){e.push(n),1==e.length&&t()}}(),s=function(){var e=["Webkit","O","Moz","ms"],t={};function n(e){return e.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(e,t){return t.toUpperCase()}))}function r(t){var n=document.body.style;if(t in n)return t;for(var r,a=e.length,o=t.charAt(0).toUpperCase()+t.slice(1);a--;)if((r=e[a]+o)in n)return r;return t}function a(e){return e=n(e),t[e]||(t[e]=r(e))}function o(e,t,n){t=a(t),e.style[t]=n}return function(e,t){var n,r,a=arguments;if(2==a.length)for(n in t)void 0!==(r=t[n])&&t.hasOwnProperty(n)&&o(e,n,r);else o(e,a[1],a[2])}}();function c(e,t){return("string"==typeof e?e:f(e)).indexOf(" "+t+" ")>=0}function u(e,t){var n=f(e),r=n+t;c(n,t)||(e.className=r.substring(1))}function d(e,t){var n,r=f(e);c(e,t)&&(n=r.replace(" "+t+" "," "),e.className=n.substring(1,n.length-1))}function f(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function p(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return n},void 0===(a="function"==typeof r?r.call(t,n,t,e):r)||(e.exports=a)},5228:e=>{"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(a){return!1}}()?Object.assign:function(e,a){for(var o,i,l=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),s=1;s{"use strict";n.d(t,{A:()=>o});var r=function(){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,t=0,n={},r={util:{encode:function e(t){return t instanceof a?new a(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/=d.reach);k+=E.value.length,E=E.next){var _=E.value;if(t.length>e.length)return;if(!(_ instanceof a)){var O,x=1;if(v){if(!(O=o(S,k,e,b))||O.index>=e.length)break;var A=O.index,C=O.index+O[0].length,T=k;for(T+=E.value.length;A>=T;)T+=(E=E.next).value.length;if(k=T-=E.value.length,E.value instanceof a)continue;for(var P=E;P!==t.tail&&(Td.reach&&(d.reach=R);var L=E.prev;if(D&&(L=s(t,L,D),k+=D.length),c(t,L,x),E=s(t,L,new a(f,g?r.tokenize(I,g):I,y,I)),N&&s(t,E,N),x>1){var j={cause:f+","+m,reach:R};i(e,t,n,E.prev,k,j),d&&j.reach>d.reach&&(d.reach=j.reach)}}}}}}function l(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function s(e,t,n){var r=t.next,a={value:n,prev:t,next:r};return t.next=a,r.prev=a,e.length++,a}function c(e,t,n){for(var r=t.next,a=0;a"+o.content+""},r}(),a=r;r.default=r,a.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},a.languages.markup.tag.inside["attr-value"].inside.entity=a.languages.markup.entity,a.languages.markup.doctype.inside["internal-subset"].inside=a.languages.markup,a.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(a.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:a.languages[t]},n.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:a.languages[t]};var o={};o[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},a.languages.insertBefore("markup","cdata",o)}}),Object.defineProperty(a.languages.markup.tag,"addAttribute",{value:function(e,t){a.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:a.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),a.languages.html=a.languages.markup,a.languages.mathml=a.languages.markup,a.languages.svg=a.languages.markup,a.languages.xml=a.languages.extend("markup",{}),a.languages.ssml=a.languages.xml,a.languages.atom=a.languages.xml,a.languages.rss=a.languages.xml,function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:n,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var a=["comment","function-name","for-or-select","assign-left","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],o=r.variable[1].inside,i=0;i]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},a.languages.c=a.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),a.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),a.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},a.languages.c.string],char:a.languages.c.char,comment:a.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:a.languages.c}}}}),a.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete a.languages.c.boolean,function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!)\w+(?:\s*\.\s*\w+)*\b/.source.replace(//g,(function(){return t.source}));e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//g,(function(){return t.source}))),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/(?:\s*:\s*)?|:\s*/.source.replace(//g,(function(){return n}))+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(a),function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(a),function(e){var t,n=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css.selector={pattern:e.languages.css.selector.pattern,lookbehind:!0,inside:t={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-\w]+/,id:/#[-\w]+/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+n.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,lookbehind:!0},"attr-value":[n,{pattern:/(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,punctuation:/[(),]/}},e.languages.css.atrule.inside["selector-function-argument"].inside=t,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,lookbehind:!0}});var r={pattern:/(\b\d+)(?:%|[a-z]+(?![\w-]))/,lookbehind:!0},a={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#[\da-f]{3,8}\b/i,alias:"color"},color:[{pattern:/(^|[^\w-])(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)(?![\w-])/i,lookbehind:!0},{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:r,number:a,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:r,number:a})}(a),a.languages.javascript=a.languages.extend("clike",{"class-name":[a.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),a.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,a.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:a.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:a.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:a.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:a.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:a.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),a.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:a.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),a.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),a.languages.markup&&(a.languages.markup.tag.addInlined("script","javascript"),a.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),a.languages.js=a.languages.javascript,function(e){var t=/#(?!\{).+/,n={pattern:/#\{[^}]+\}/,alias:"variable"};e.languages.coffeescript=e.languages.extend("javascript",{comment:t,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:n}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),e.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:t,interpolation:n}}}),e.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:"punctuation"},script:{pattern:/[\s\S]+/,alias:"language-javascript",inside:e.languages.javascript}}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:"string"},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string",inside:{interpolation:n}}]}),e.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete e.languages.coffeescript["template-string"],e.languages.coffee=e.languages.coffeescript}(a),function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+n.source+"(?:[ \t]+"+t.source+")?|"+t.source+"(?:[ \t]+"+n.source+")?)",a=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-])(?:[ \t]*(?:(?![#:])|:))*/.source.replace(//g,(function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source})),o=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function i(e,t){t=(t||"").replace(/m/g,"")+"m";var n=/([:\-,[{]\s*(?:\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<>/g,(function(){return r})).replace(/<>/g,(function(){return e}));return RegExp(n,t)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<>/g,(function(){return r}))),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\s*:\s)/.source.replace(/<>/g,(function(){return r})).replace(/<>/g,(function(){return"(?:"+a+"|"+o+")"}))),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:i(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:i(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:i(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:i(o),lookbehind:!0,greedy:!0},number:{pattern:i(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(a),function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(//g,(function(){return t})),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,a=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,(function(){return r})),o=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+a+o+"(?:"+a+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+a+o+")(?:"+a+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+a+")"+o+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+a+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(t){["url","bold","italic","strike","code-snippet"].forEach((function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])}))})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var n=0,r=t.length;n",quot:'"'},s=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(a),a.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:a.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},a.hooks.add("after-tokenize",(function(e){if("graphql"===e.language)for(var t=e.tokens.filter((function(e){return"string"!=typeof e&&"comment"!==e.type&&"scalar"!==e.type})),n=0;n0)){var l=f(/^\{$/,/^\}$/);if(-1===l)continue;for(var s=n;s=0&&p(c,"variable-input")}}}}function u(e){return t[n+e]}function d(e,t){t=t||0;for(var n=0;n?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t=e.languages.javascript["template-string"],n=t.pattern.source,r=t.inside.interpolation,a=r.inside["interpolation-punctuation"],o=r.pattern.source;function i(t,r){if(e.languages[t])return{pattern:RegExp("((?:"+r+")\\s*)"+n),lookbehind:!0,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},"embedded-code":{pattern:/[\s\S]+/,alias:t}}}}function l(e,t){return"___"+t.toUpperCase()+"_"+e+"___"}function s(t,n,r){var a={code:t,grammar:n,language:r};return e.hooks.run("before-tokenize",a),a.tokens=e.tokenize(a.code,a.grammar),e.hooks.run("after-tokenize",a),a.tokens}function c(t){var n={};n["interpolation-punctuation"]=a;var o=e.tokenize(t,n);if(3===o.length){var i=[1,1];i.push.apply(i,s(o[1],e.languages.javascript,"javascript")),o.splice.apply(o,i)}return new e.Token("interpolation",o,r.alias,t)}function u(t,n,r){var a=e.tokenize(t,{interpolation:{pattern:RegExp(o),lookbehind:!0}}),i=0,u={},d=s(a.map((function(e){if("string"==typeof e)return e;for(var n,a=e.content;-1!==t.indexOf(n=l(i++,r)););return u[n]=a,n})).join(""),n,r),f=Object.keys(u);return i=0,function e(t){for(var n=0;n=f.length)return;var r=t[n];if("string"==typeof r||"string"==typeof r.content){var a=f[i],o="string"==typeof r?r:r.content,l=o.indexOf(a);if(-1!==l){++i;var s=o.substring(0,l),d=c(u[a]),p=o.substring(l+a.length),m=[];if(s&&m.push(s),m.push(d),p){var h=[p];e(h),m.push.apply(m,h)}"string"==typeof r?(t.splice.apply(t,[n,1].concat(m)),n+=m.length-1):r.content=m}}else{var g=r.content;Array.isArray(g)?e(g):e([g])}}}(d),new e.Token(r,d,"language-"+r,t)}e.languages.javascript["template-string"]=[i("css",/\b(?:styled(?:\([^)]*\))?(?:\s*\.\s*\w+(?:\([^)]*\))*)*|css(?:\s*\.\s*(?:global|resolve))?|createGlobalStyle|keyframes)/.source),i("html",/\bhtml|\.\s*(?:inner|outer)HTML\s*\+?=/.source),i("svg",/\bsvg/.source),i("markdown",/\b(?:markdown|md)/.source),i("graphql",/\b(?:gql|graphql(?:\s*\.\s*experimental)?)/.source),i("sql",/\bsql/.source),t].filter(Boolean);var d={javascript:!0,js:!0,typescript:!0,ts:!0,jsx:!0,tsx:!0};function f(e){return"string"==typeof e?e:Array.isArray(e)?e.map(f).join(""):f(e.content)}e.hooks.add("after-tokenize",(function(t){t.language in d&&function t(n){for(var r=0,a=n.length;r]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript}(a),function(e){function t(e,t){return RegExp(e.replace(//g,(function(){return/(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/.source})),t)}e.languages.insertBefore("javascript","function-variable",{"method-variable":{pattern:RegExp("(\\.\\s*)"+e.languages.javascript["function-variable"].pattern.source),lookbehind:!0,alias:["function-variable","method","function","property-access"]}}),e.languages.insertBefore("javascript","function",{method:{pattern:RegExp("(\\.\\s*)"+e.languages.javascript.function.source),lookbehind:!0,alias:["function","property-access"]}}),e.languages.insertBefore("javascript","constant",{"known-class-name":[{pattern:/\b(?:(?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|(?:Weak)?(?:Map|Set)|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|WebAssembly)\b/,alias:"class-name"},{pattern:/\b(?:[A-Z]\w*)Error\b/,alias:"class-name"}]}),e.languages.insertBefore("javascript","keyword",{imports:{pattern:t(/(\bimport\b\s*)(?:(?:\s*,\s*(?:\*\s*as\s+|\{[^{}]*\}))?|\*\s*as\s+|\{[^{}]*\})(?=\s*\bfrom\b)/.source),lookbehind:!0,inside:e.languages.javascript},exports:{pattern:t(/(\bexport\b\s*)(?:\*(?:\s*as\s+)?(?=\s*\bfrom\b)|\{[^{}]*\})/.source),lookbehind:!0,inside:e.languages.javascript}}),e.languages.javascript.keyword.unshift({pattern:/\b(?:as|default|export|from|import)\b/,alias:"module"},{pattern:/\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,alias:"control-flow"},{pattern:/\bnull\b/,alias:["null","nil"]},{pattern:/\bundefined\b/,alias:"nil"}),e.languages.insertBefore("javascript","operator",{spread:{pattern:/\.{3}/,alias:"operator"},arrow:{pattern:/=>/,alias:"operator"}}),e.languages.insertBefore("javascript","punctuation",{"property-access":{pattern:t(/(\.\s*)#?/.source),lookbehind:!0},"maybe-class-name":{pattern:/(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,lookbehind:!0},dom:{pattern:/\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/,alias:"variable"},console:{pattern:/\bconsole(?=\s*\.)/,alias:"class-name"}});for(var n=["function","function-variable","method","method-variable","property-access"],r=0;r*\.{3}(?:[^{}]|)*\})/.source;function o(e,t){return e=e.replace(//g,(function(){return n})).replace(//g,(function(){return r})).replace(//g,(function(){return a})),RegExp(e,t)}a=o(a).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=o(/<\/?(?:[\w.:-]+(?:+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|))?|))**\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:o(//.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:o(/=/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var i=function(e){return e?"string"==typeof e?e:"string"==typeof e.content?e.content:e.content.map(i).join(""):""},l=function(t){for(var n=[],r=0;r0&&n[n.length-1].tagName===i(a.content[0].content[1])&&n.pop():"/>"===a.content[a.content.length-1].content||n.push({tagName:i(a.content[0].content[1]),openedBraces:0}):n.length>0&&"punctuation"===a.type&&"{"===a.content?n[n.length-1].openedBraces++:n.length>0&&n[n.length-1].openedBraces>0&&"punctuation"===a.type&&"}"===a.content?n[n.length-1].openedBraces--:o=!0),(o||"string"==typeof a)&&n.length>0&&0===n[n.length-1].openedBraces){var s=i(a);r0&&("string"==typeof t[r-1]||"plain-text"===t[r-1].type)&&(s=i(t[r-1])+s,t.splice(r-1,1),r--),t[r]=new e.Token("plain-text",s,null,s)}a.content&&"string"!=typeof a.content&&l(a.content)}};e.hooks.add("after-tokenize",(function(e){"jsx"!==e.language&&"tsx"!==e.language||l(e.tokens)}))}(a),function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(t).forEach((function(n){var r=t[n],a=[];/^\w+$/.test(n)||a.push(/\w+/.exec(n)[0]),"diff"===n&&a.push("bold"),e.languages.diff[n]={pattern:RegExp("^(?:["+r+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:a,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}})),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})}(a),a.languages.git={comment:/^#.*/m,deleted:/^[-\u2013].*/m,inserted:/^\+.*/m,string:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s--?\w+/}},coord:/^@@.*@@$/m,"commit-sha1":/^commit \w{40}$/m},a.languages.go=a.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),a.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete a.languages.go["class-name"],function(e){function t(e,t){return"___"+e.toUpperCase()+t+"___"}Object.defineProperties(e.languages["markup-templating"]={},{buildPlaceholders:{value:function(n,r,a,o){if(n.language===r){var i=n.tokenStack=[];n.code=n.code.replace(a,(function(e){if("function"==typeof o&&!o(e))return e;for(var a,l=i.length;-1!==n.code.indexOf(a=t(r,l));)++l;return i[l]=e,a})),n.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(n,r){if(n.language===r&&n.tokenStack){n.grammar=e.languages[r];var a=0,o=Object.keys(n.tokenStack);!function i(l){for(var s=0;s=o.length);s++){var c=l[s];if("string"==typeof c||c.content&&"string"==typeof c.content){var u=o[a],d=n.tokenStack[u],f="string"==typeof c?c:c.content,p=t(r,u),m=f.indexOf(p);if(m>-1){++a;var h=f.substring(0,m),g=new e.Token(r,e.tokenize(d,n.grammar),"language-"+r,d),b=f.substring(m+p.length),v=[];h&&v.push.apply(v,i([h])),v.push(g),b&&v.push.apply(v,i([b])),"string"==typeof c?l.splice.apply(l,[s,1].concat(v)):c.content=v}}else c.content&&i(c.content)}return l}(n.tokens)}}}})}(a),function(e){e.languages.handlebars={comment:/\{\{![\s\S]*?\}\}/,delimiter:{pattern:/^\{\{\{?|\}\}\}?$/,alias:"punctuation"},string:/(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][+-]?\d+)?/,boolean:/\b(?:false|true)\b/,block:{pattern:/^(\s*(?:~\s*)?)[#\/]\S+?(?=\s*(?:~\s*)?$|\s)/,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/,variable:/[\s\S]+/}},punctuation:/[!"#%&':()*+,.\/;<=>@\[\\\]^`{|}~]/,variable:/[^!"#%&'()*+,\/;<=>@\[\\\]^`{|}~\s]+/},e.hooks.add("before-tokenize",(function(t){e.languages["markup-templating"].buildPlaceholders(t,"handlebars",/\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/g)})),e.hooks.add("after-tokenize",(function(t){e.languages["markup-templating"].tokenizePlaceholders(t,"handlebars")})),e.languages.hbs=e.languages.handlebars}(a),a.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},a.languages.webmanifest=a.languages.json,a.languages.less=a.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/}),a.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}}),a.languages.makefile={comment:{pattern:/(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,lookbehind:!0},string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"builtin-target":{pattern:/\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,alias:"builtin"},target:{pattern:/^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,alias:"symbol",inside:{variable:/\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/}},variable:/\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,keyword:/-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,function:{pattern:/(\()(?:abspath|addsuffix|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:list|s)?)(?=[ \t])/,lookbehind:!0},operator:/(?:::|[?:+!])?=|[|@]/,punctuation:/[:;(){}]/},a.languages.objectivec=a.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete a.languages.objectivec["class-name"],a.languages.objc=a.languages.objectivec,a.languages.ocaml={comment:{pattern:/\(\*[\s\S]*?\*\)/,greedy:!0},char:{pattern:/'(?:[^\\\r\n']|\\(?:.|[ox]?[0-9a-f]{1,3}))'/i,greedy:!0},string:[{pattern:/"(?:\\(?:[\s\S]|\r\n)|[^\\\r\n"])*"/,greedy:!0},{pattern:/\{([a-z_]*)\|[\s\S]*?\|\1\}/,greedy:!0}],number:[/\b(?:0b[01][01_]*|0o[0-7][0-7_]*)\b/i,/\b0x[a-f0-9][a-f0-9_]*(?:\.[a-f0-9_]*)?(?:p[+-]?\d[\d_]*)?(?!\w)/i,/\b\d[\d_]*(?:\.[\d_]*)?(?:e[+-]?\d[\d_]*)?(?!\w)/i],directive:{pattern:/\B#\w+/,alias:"property"},label:{pattern:/\B~\w+/,alias:"property"},"type-variable":{pattern:/\B'\w+/,alias:"function"},variant:{pattern:/`\w+/,alias:"symbol"},keyword:/\b(?:as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|match|method|module|mutable|new|nonrec|object|of|open|private|rec|sig|struct|then|to|try|type|val|value|virtual|when|where|while|with)\b/,boolean:/\b(?:false|true)\b/,"operator-like-punctuation":{pattern:/\[[<>|]|[>|]\]|\{<|>\}/,alias:"punctuation"},operator:/\.[.~]|:[=>]|[=<>@^|&+\-*\/$%!?~][!$%&*+\-.\/:<=>?@^|~]*|\b(?:and|asr|land|lor|lsl|lsr|lxor|mod|or)\b/,punctuation:/;;|::|[(){}\[\].,:;#]|\b_\b/},a.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},a.languages.python["string-interpolation"].inside.interpolation.inside.rest=a.languages.python,a.languages.py=a.languages.python,a.languages.reason=a.languages.extend("clike",{string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,greedy:!0},"class-name":/\b[A-Z]\w*/,keyword:/\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,operator:/\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/}),a.languages.insertBefore("reason","class-name",{char:{pattern:/'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,greedy:!0},constructor:/\b[A-Z]\w*\b(?!\s*\.)/,label:{pattern:/\b[a-z]\w*(?=::)/,alias:"symbol"}}),delete a.languages.reason.function,function(e){e.languages.sass=e.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),e.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete e.languages.sass.atrule;var t=/\$[-\w]+|#\{\$[-\w]+\}/,n=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}];e.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:t,operator:n}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:t,operator:n,important:e.languages.sass.important}}}),delete e.languages.sass.property,delete e.languages.sass.important,e.languages.insertBefore("sass","punctuation",{selector:{pattern:/^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,lookbehind:!0,greedy:!0}})}(a),a.languages.scss=a.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),a.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),a.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),a.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),a.languages.scss.atrule.inside.rest=a.languages.scss,function(e){var t={pattern:/(\b\d+)(?:%|[a-z]+)/,lookbehind:!0},n={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0},r={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},url:{pattern:/\burl\((["']?).*?\1\)/i,greedy:!0},string:{pattern:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,greedy:!0},interpolation:null,func:null,important:/\B!(?:important|optional)\b/i,keyword:{pattern:/(^|\s+)(?:(?:else|for|if|return|unless)(?=\s|$)|@[\w-]+)/,lookbehind:!0},hexcode:/#[\da-f]{3,6}/i,color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:t,number:n,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:t,boolean:/\b(?:false|true)\b/,operator:[/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.{2,3}|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],number:n,punctuation:/[{}()\[\];:,]/};r.interpolation={pattern:/\{[^\r\n}:]+\}/,alias:"variable",inside:{delimiter:{pattern:/^\{|\}$/,alias:"punctuation"},rest:r}},r.func={pattern:/[\w-]+\([^)]*\).*/,inside:{function:/^[^(]+/,rest:r}},e.languages.stylus={"atrule-declaration":{pattern:/(^[ \t]*)@.+/m,lookbehind:!0,inside:{atrule:/^@[\w-]+/,rest:r}},"variable-declaration":{pattern:/(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:\{[^{}]*\}|\S.*|$)/m,lookbehind:!0,inside:{variable:/^\S+/,rest:r}},statement:{pattern:/(^[ \t]*)(?:else|for|if|return|unless)[ \t].+/m,lookbehind:!0,inside:{keyword:/^\S+/,rest:r}},"property-declaration":{pattern:/((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)(?!\s)[^{\r\n]*(?:;|[^{\r\n,]$(?!(?:\r?\n|\r)(?:\{|\2[ \t])))/m,lookbehind:!0,inside:{property:{pattern:/^[^\s:]+/,inside:{interpolation:r.interpolation}},rest:r}},selector:{pattern:/(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t])))/m,lookbehind:!0,inside:{interpolation:r.interpolation,comment:r.comment,punctuation:/[{},]/}},func:r.func,string:r.string,comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0,greedy:!0},interpolation:r.interpolation,punctuation:/[{}()\[\];:.]/}}(a),function(e){var t=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend("jsx",t),delete e.languages.tsx.parameter,delete e.languages.tsx["literal-property"];var n=e.languages.tsx.tag;n.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+n.pattern.source+")",n.pattern.flags),n.lookbehind=!0}(a),a.languages.wasm={comment:[/\(;[\s\S]*?;\)/,{pattern:/;;.*/,greedy:!0}],string:{pattern:/"(?:\\[\s\S]|[^"\\])*"/,greedy:!0},keyword:[{pattern:/\b(?:align|offset)=/,inside:{operator:/=/}},{pattern:/\b(?:(?:f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|neg?|nearest|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|sqrt|store(?:8|16|32)?|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))?|memory\.(?:grow|size))\b/,inside:{punctuation:/\./}},/\b(?:anyfunc|block|br(?:_if|_table)?|call(?:_indirect)?|data|drop|elem|else|end|export|func|get_(?:global|local)|global|if|import|local|loop|memory|module|mut|nop|offset|param|result|return|select|set_(?:global|local)|start|table|tee_local|then|type|unreachable)\b/],variable:/\$[\w!#$%&'*+\-./:<=>?@\\^`|~]+/,number:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/,punctuation:/[()]/};const o=a},6969:e=>{e.exports&&(e.exports={core:{meta:{path:"components/prism-core.js",option:"mandatory"},core:"Core"},themes:{meta:{path:"themes/{id}.css",link:"index.html?theme={id}",exclusive:!0},prism:{title:"Default",option:"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{title:"Okaidia",owner:"ocodia"},"prism-twilight":{title:"Twilight",owner:"remybach"},"prism-coy":{title:"Coy",owner:"tshedor"},"prism-solarizedlight":{title:"Solarized Light",owner:"hectormatos2011 "},"prism-tomorrow":{title:"Tomorrow Night",owner:"Rosey"}},languages:{meta:{path:"components/prism-{id}",noCSS:!0,examplesPath:"examples/prism-{id}",addCheckAll:!0},markup:{title:"Markup",alias:["html","xml","svg","mathml","ssml","atom","rss"],aliasTitles:{html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",atom:"Atom",rss:"RSS"},option:"default"},css:{title:"CSS",option:"default",modify:"markup"},clike:{title:"C-like",option:"default"},javascript:{title:"JavaScript",require:"clike",modify:"markup",optional:"regex",alias:"js",option:"default"},abap:{title:"ABAP",owner:"dellagustin"},abnf:{title:"ABNF",owner:"RunDevelopment"},actionscript:{title:"ActionScript",require:"javascript",modify:"markup",owner:"Golmote"},ada:{title:"Ada",owner:"Lucretia"},agda:{title:"Agda",owner:"xy-ren"},al:{title:"AL",owner:"RunDevelopment"},antlr4:{title:"ANTLR4",alias:"g4",owner:"RunDevelopment"},apacheconf:{title:"Apache Configuration",owner:"GuiTeK"},apex:{title:"Apex",require:["clike","sql"],owner:"RunDevelopment"},apl:{title:"APL",owner:"ngn"},applescript:{title:"AppleScript",owner:"Golmote"},aql:{title:"AQL",owner:"RunDevelopment"},arduino:{title:"Arduino",require:"cpp",alias:"ino",owner:"dkern"},arff:{title:"ARFF",owner:"Golmote"},armasm:{title:"ARM Assembly",alias:"arm-asm",owner:"RunDevelopment"},arturo:{title:"Arturo",alias:"art",optional:["bash","css","javascript","markup","markdown","sql"],owner:"drkameleon"},asciidoc:{alias:"adoc",title:"AsciiDoc",owner:"Golmote"},aspnet:{title:"ASP.NET (C#)",require:["markup","csharp"],owner:"nauzilus"},asm6502:{title:"6502 Assembly",owner:"kzurawel"},asmatmel:{title:"Atmel AVR Assembly",owner:"cerkit"},autohotkey:{title:"AutoHotkey",owner:"aviaryan"},autoit:{title:"AutoIt",owner:"Golmote"},avisynth:{title:"AviSynth",alias:"avs",owner:"Zinfidel"},"avro-idl":{title:"Avro IDL",alias:"avdl",owner:"RunDevelopment"},awk:{title:"AWK",alias:"gawk",aliasTitles:{gawk:"GAWK"},owner:"RunDevelopment"},bash:{title:"Bash",alias:["sh","shell"],aliasTitles:{sh:"Shell",shell:"Shell"},owner:"zeitgeist87"},basic:{title:"BASIC",owner:"Golmote"},batch:{title:"Batch",owner:"Golmote"},bbcode:{title:"BBcode",alias:"shortcode",aliasTitles:{shortcode:"Shortcode"},owner:"RunDevelopment"},bbj:{title:"BBj",owner:"hyyan"},bicep:{title:"Bicep",owner:"johnnyreilly"},birb:{title:"Birb",require:"clike",owner:"Calamity210"},bison:{title:"Bison",require:"c",owner:"Golmote"},bnf:{title:"BNF",alias:"rbnf",aliasTitles:{rbnf:"RBNF"},owner:"RunDevelopment"},bqn:{title:"BQN",owner:"yewscion"},brainfuck:{title:"Brainfuck",owner:"Golmote"},brightscript:{title:"BrightScript",owner:"RunDevelopment"},bro:{title:"Bro",owner:"wayward710"},bsl:{title:"BSL (1C:Enterprise)",alias:"oscript",aliasTitles:{oscript:"OneScript"},owner:"Diversus23"},c:{title:"C",require:"clike",owner:"zeitgeist87"},csharp:{title:"C#",require:"clike",alias:["cs","dotnet"],owner:"mvalipour"},cpp:{title:"C++",require:"c",owner:"zeitgeist87"},cfscript:{title:"CFScript",require:"clike",alias:"cfc",owner:"mjclemente"},chaiscript:{title:"ChaiScript",require:["clike","cpp"],owner:"RunDevelopment"},cil:{title:"CIL",owner:"sbrl"},cilkc:{title:"Cilk/C",require:"c",alias:"cilk-c",owner:"OpenCilk"},cilkcpp:{title:"Cilk/C++",require:"cpp",alias:["cilk-cpp","cilk"],owner:"OpenCilk"},clojure:{title:"Clojure",owner:"troglotit"},cmake:{title:"CMake",owner:"mjrogozinski"},cobol:{title:"COBOL",owner:"RunDevelopment"},coffeescript:{title:"CoffeeScript",require:"javascript",alias:"coffee",owner:"R-osey"},concurnas:{title:"Concurnas",alias:"conc",owner:"jasontatton"},csp:{title:"Content-Security-Policy",owner:"ScottHelme"},cooklang:{title:"Cooklang",owner:"ahue"},coq:{title:"Coq",owner:"RunDevelopment"},crystal:{title:"Crystal",require:"ruby",owner:"MakeNowJust"},"css-extras":{title:"CSS Extras",require:"css",modify:"css",owner:"milesj"},csv:{title:"CSV",owner:"RunDevelopment"},cue:{title:"CUE",owner:"RunDevelopment"},cypher:{title:"Cypher",owner:"RunDevelopment"},d:{title:"D",require:"clike",owner:"Golmote"},dart:{title:"Dart",require:"clike",owner:"Golmote"},dataweave:{title:"DataWeave",owner:"machaval"},dax:{title:"DAX",owner:"peterbud"},dhall:{title:"Dhall",owner:"RunDevelopment"},diff:{title:"Diff",owner:"uranusjr"},django:{title:"Django/Jinja2",require:"markup-templating",alias:"jinja2",owner:"romanvm"},"dns-zone-file":{title:"DNS zone file",owner:"RunDevelopment",alias:"dns-zone"},docker:{title:"Docker",alias:"dockerfile",owner:"JustinBeckwith"},dot:{title:"DOT (Graphviz)",alias:"gv",optional:"markup",owner:"RunDevelopment"},ebnf:{title:"EBNF",owner:"RunDevelopment"},editorconfig:{title:"EditorConfig",owner:"osipxd"},eiffel:{title:"Eiffel",owner:"Conaclos"},ejs:{title:"EJS",require:["javascript","markup-templating"],owner:"RunDevelopment",alias:"eta",aliasTitles:{eta:"Eta"}},elixir:{title:"Elixir",owner:"Golmote"},elm:{title:"Elm",owner:"zwilias"},etlua:{title:"Embedded Lua templating",require:["lua","markup-templating"],owner:"RunDevelopment"},erb:{title:"ERB",require:["ruby","markup-templating"],owner:"Golmote"},erlang:{title:"Erlang",owner:"Golmote"},"excel-formula":{title:"Excel Formula",alias:["xlsx","xls"],owner:"RunDevelopment"},fsharp:{title:"F#",require:"clike",owner:"simonreynolds7"},factor:{title:"Factor",owner:"catb0t"},false:{title:"False",owner:"edukisto"},"firestore-security-rules":{title:"Firestore security rules",require:"clike",owner:"RunDevelopment"},flow:{title:"Flow",require:"javascript",owner:"Golmote"},fortran:{title:"Fortran",owner:"Golmote"},ftl:{title:"FreeMarker Template Language",require:"markup-templating",owner:"RunDevelopment"},gml:{title:"GameMaker Language",alias:"gamemakerlanguage",require:"clike",owner:"LiarOnce"},gap:{title:"GAP (CAS)",owner:"RunDevelopment"},gcode:{title:"G-code",owner:"RunDevelopment"},gdscript:{title:"GDScript",owner:"RunDevelopment"},gedcom:{title:"GEDCOM",owner:"Golmote"},gettext:{title:"gettext",alias:"po",owner:"RunDevelopment"},gherkin:{title:"Gherkin",owner:"hason"},git:{title:"Git",owner:"lgiraudel"},glsl:{title:"GLSL",require:"c",owner:"Golmote"},gn:{title:"GN",alias:"gni",owner:"RunDevelopment"},"linker-script":{title:"GNU Linker Script",alias:"ld",owner:"RunDevelopment"},go:{title:"Go",require:"clike",owner:"arnehormann"},"go-module":{title:"Go module",alias:"go-mod",owner:"RunDevelopment"},gradle:{title:"Gradle",require:"clike",owner:"zeabdelkhalek-badido18"},graphql:{title:"GraphQL",optional:"markdown",owner:"Golmote"},groovy:{title:"Groovy",require:"clike",owner:"robfletcher"},haml:{title:"Haml",require:"ruby",optional:["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],owner:"Golmote"},handlebars:{title:"Handlebars",require:"markup-templating",alias:["hbs","mustache"],aliasTitles:{mustache:"Mustache"},owner:"Golmote"},haskell:{title:"Haskell",alias:"hs",owner:"bholst"},haxe:{title:"Haxe",require:"clike",optional:"regex",owner:"Golmote"},hcl:{title:"HCL",owner:"outsideris"},hlsl:{title:"HLSL",require:"c",owner:"RunDevelopment"},hoon:{title:"Hoon",owner:"matildepark"},http:{title:"HTTP",optional:["csp","css","hpkp","hsts","javascript","json","markup","uri"],owner:"danielgtaylor"},hpkp:{title:"HTTP Public-Key-Pins",owner:"ScottHelme"},hsts:{title:"HTTP Strict-Transport-Security",owner:"ScottHelme"},ichigojam:{title:"IchigoJam",owner:"BlueCocoa"},icon:{title:"Icon",owner:"Golmote"},"icu-message-format":{title:"ICU Message Format",owner:"RunDevelopment"},idris:{title:"Idris",alias:"idr",owner:"KeenS",require:"haskell"},ignore:{title:".ignore",owner:"osipxd",alias:["gitignore","hgignore","npmignore"],aliasTitles:{gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore"}},inform7:{title:"Inform 7",owner:"Golmote"},ini:{title:"Ini",owner:"aviaryan"},io:{title:"Io",owner:"AlesTsurko"},j:{title:"J",owner:"Golmote"},java:{title:"Java",require:"clike",owner:"sherblot"},javadoc:{title:"JavaDoc",require:["markup","java","javadoclike"],modify:"java",optional:"scala",owner:"RunDevelopment"},javadoclike:{title:"JavaDoc-like",modify:["java","javascript","php"],owner:"RunDevelopment"},javastacktrace:{title:"Java stack trace",owner:"RunDevelopment"},jexl:{title:"Jexl",owner:"czosel"},jolie:{title:"Jolie",require:"clike",owner:"thesave"},jq:{title:"JQ",owner:"RunDevelopment"},jsdoc:{title:"JSDoc",require:["javascript","javadoclike","typescript"],modify:"javascript",optional:["actionscript","coffeescript"],owner:"RunDevelopment"},"js-extras":{title:"JS Extras",require:"javascript",modify:"javascript",optional:["actionscript","coffeescript","flow","n4js","typescript"],owner:"RunDevelopment"},json:{title:"JSON",alias:"webmanifest",aliasTitles:{webmanifest:"Web App Manifest"},owner:"CupOfTea696"},json5:{title:"JSON5",require:"json",owner:"RunDevelopment"},jsonp:{title:"JSONP",require:"json",owner:"RunDevelopment"},jsstacktrace:{title:"JS stack trace",owner:"sbrl"},"js-templates":{title:"JS Templates",require:"javascript",modify:"javascript",optional:["css","css-extras","graphql","markdown","markup","sql"],owner:"RunDevelopment"},julia:{title:"Julia",owner:"cdagnino"},keepalived:{title:"Keepalived Configure",owner:"dev-itsheng"},keyman:{title:"Keyman",owner:"mcdurdin"},kotlin:{title:"Kotlin",alias:["kt","kts"],aliasTitles:{kts:"Kotlin Script"},require:"clike",owner:"Golmote"},kumir:{title:"KuMir (\u041a\u0443\u041c\u0438\u0440)",alias:"kum",owner:"edukisto"},kusto:{title:"Kusto",owner:"RunDevelopment"},latex:{title:"LaTeX",alias:["tex","context"],aliasTitles:{tex:"TeX",context:"ConTeXt"},owner:"japborst"},latte:{title:"Latte",require:["clike","markup-templating","php"],owner:"nette"},less:{title:"Less",require:"css",optional:"css-extras",owner:"Golmote"},lilypond:{title:"LilyPond",require:"scheme",alias:"ly",owner:"RunDevelopment"},liquid:{title:"Liquid",require:"markup-templating",owner:"cinhtau"},lisp:{title:"Lisp",alias:["emacs","elisp","emacs-lisp"],owner:"JuanCaicedo"},livescript:{title:"LiveScript",owner:"Golmote"},llvm:{title:"LLVM IR",owner:"porglezomp"},log:{title:"Log file",optional:"javastacktrace",owner:"RunDevelopment"},lolcode:{title:"LOLCODE",owner:"Golmote"},lua:{title:"Lua",owner:"Golmote"},magma:{title:"Magma (CAS)",owner:"RunDevelopment"},makefile:{title:"Makefile",owner:"Golmote"},markdown:{title:"Markdown",require:"markup",optional:"yaml",alias:"md",owner:"Golmote"},"markup-templating":{title:"Markup templating",require:"markup",owner:"Golmote"},mata:{title:"Mata",owner:"RunDevelopment"},matlab:{title:"MATLAB",owner:"Golmote"},maxscript:{title:"MAXScript",owner:"RunDevelopment"},mel:{title:"MEL",owner:"Golmote"},mermaid:{title:"Mermaid",owner:"RunDevelopment"},metafont:{title:"METAFONT",owner:"LaeriExNihilo"},mizar:{title:"Mizar",owner:"Golmote"},mongodb:{title:"MongoDB",owner:"airs0urce",require:"javascript"},monkey:{title:"Monkey",owner:"Golmote"},moonscript:{title:"MoonScript",alias:"moon",owner:"RunDevelopment"},n1ql:{title:"N1QL",owner:"TMWilds"},n4js:{title:"N4JS",require:"javascript",optional:"jsdoc",alias:"n4jsd",owner:"bsmith-n4"},"nand2tetris-hdl":{title:"Nand To Tetris HDL",owner:"stephanmax"},naniscript:{title:"Naninovel Script",owner:"Elringus",alias:"nani"},nasm:{title:"NASM",owner:"rbmj"},neon:{title:"NEON",owner:"nette"},nevod:{title:"Nevod",owner:"nezaboodka"},nginx:{title:"nginx",owner:"volado"},nim:{title:"Nim",owner:"Golmote"},nix:{title:"Nix",owner:"Golmote"},nsis:{title:"NSIS",owner:"idleberg"},objectivec:{title:"Objective-C",require:"c",alias:"objc",owner:"uranusjr"},ocaml:{title:"OCaml",owner:"Golmote"},odin:{title:"Odin",owner:"edukisto"},opencl:{title:"OpenCL",require:"c",modify:["c","cpp"],owner:"Milania1"},openqasm:{title:"OpenQasm",alias:"qasm",owner:"RunDevelopment"},oz:{title:"Oz",owner:"Golmote"},parigp:{title:"PARI/GP",owner:"Golmote"},parser:{title:"Parser",require:"markup",owner:"Golmote"},pascal:{title:"Pascal",alias:"objectpascal",aliasTitles:{objectpascal:"Object Pascal"},owner:"Golmote"},pascaligo:{title:"Pascaligo",owner:"DefinitelyNotAGoat"},psl:{title:"PATROL Scripting Language",owner:"bertysentry"},pcaxis:{title:"PC-Axis",alias:"px",owner:"RunDevelopment"},peoplecode:{title:"PeopleCode",alias:"pcode",owner:"RunDevelopment"},perl:{title:"Perl",owner:"Golmote"},php:{title:"PHP",require:"markup-templating",owner:"milesj"},phpdoc:{title:"PHPDoc",require:["php","javadoclike"],modify:"php",owner:"RunDevelopment"},"php-extras":{title:"PHP Extras",require:"php",modify:"php",owner:"milesj"},"plant-uml":{title:"PlantUML",alias:"plantuml",owner:"RunDevelopment"},plsql:{title:"PL/SQL",require:"sql",owner:"Golmote"},powerquery:{title:"PowerQuery",alias:["pq","mscript"],owner:"peterbud"},powershell:{title:"PowerShell",owner:"nauzilus"},processing:{title:"Processing",require:"clike",owner:"Golmote"},prolog:{title:"Prolog",owner:"Golmote"},promql:{title:"PromQL",owner:"arendjr"},properties:{title:".properties",owner:"Golmote"},protobuf:{title:"Protocol Buffers",require:"clike",owner:"just-boris"},pug:{title:"Pug",require:["markup","javascript"],optional:["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],owner:"Golmote"},puppet:{title:"Puppet",owner:"Golmote"},pure:{title:"Pure",optional:["c","cpp","fortran"],owner:"Golmote"},purebasic:{title:"PureBasic",require:"clike",alias:"pbfasm",owner:"HeX0R101"},purescript:{title:"PureScript",require:"haskell",alias:"purs",owner:"sriharshachilakapati"},python:{title:"Python",alias:"py",owner:"multipetros"},qsharp:{title:"Q#",require:"clike",alias:"qs",owner:"fedonman"},q:{title:"Q (kdb+ database)",owner:"Golmote"},qml:{title:"QML",require:"javascript",owner:"RunDevelopment"},qore:{title:"Qore",require:"clike",owner:"temnroegg"},r:{title:"R",owner:"Golmote"},racket:{title:"Racket",require:"scheme",alias:"rkt",owner:"RunDevelopment"},cshtml:{title:"Razor C#",alias:"razor",require:["markup","csharp"],optional:["css","css-extras","javascript","js-extras"],owner:"RunDevelopment"},jsx:{title:"React JSX",require:["markup","javascript"],optional:["jsdoc","js-extras","js-templates"],owner:"vkbansal"},tsx:{title:"React TSX",require:["jsx","typescript"]},reason:{title:"Reason",require:"clike",owner:"Golmote"},regex:{title:"Regex",owner:"RunDevelopment"},rego:{title:"Rego",owner:"JordanSh"},renpy:{title:"Ren'py",alias:"rpy",owner:"HyuchiaDiego"},rescript:{title:"ReScript",alias:"res",owner:"vmarcosp"},rest:{title:"reST (reStructuredText)",owner:"Golmote"},rip:{title:"Rip",owner:"ravinggenius"},roboconf:{title:"Roboconf",owner:"Golmote"},robotframework:{title:"Robot Framework",alias:"robot",owner:"RunDevelopment"},ruby:{title:"Ruby",require:"clike",alias:"rb",owner:"samflores"},rust:{title:"Rust",owner:"Golmote"},sas:{title:"SAS",optional:["groovy","lua","sql"],owner:"Golmote"},sass:{title:"Sass (Sass)",require:"css",optional:"css-extras",owner:"Golmote"},scss:{title:"Sass (SCSS)",require:"css",optional:"css-extras",owner:"MoOx"},scala:{title:"Scala",require:"java",owner:"jozic"},scheme:{title:"Scheme",owner:"bacchus123"},"shell-session":{title:"Shell session",require:"bash",alias:["sh-session","shellsession"],owner:"RunDevelopment"},smali:{title:"Smali",owner:"RunDevelopment"},smalltalk:{title:"Smalltalk",owner:"Golmote"},smarty:{title:"Smarty",require:"markup-templating",optional:"php",owner:"Golmote"},sml:{title:"SML",alias:"smlnj",aliasTitles:{smlnj:"SML/NJ"},owner:"RunDevelopment"},solidity:{title:"Solidity (Ethereum)",alias:"sol",require:"clike",owner:"glachaud"},"solution-file":{title:"Solution file",alias:"sln",owner:"RunDevelopment"},soy:{title:"Soy (Closure Template)",require:"markup-templating",owner:"Golmote"},sparql:{title:"SPARQL",require:"turtle",owner:"Triply-Dev",alias:"rq"},"splunk-spl":{title:"Splunk SPL",owner:"RunDevelopment"},sqf:{title:"SQF: Status Quo Function (Arma 3)",require:"clike",owner:"RunDevelopment"},sql:{title:"SQL",owner:"multipetros"},squirrel:{title:"Squirrel",require:"clike",owner:"RunDevelopment"},stan:{title:"Stan",owner:"RunDevelopment"},stata:{title:"Stata Ado",require:["mata","java","python"],owner:"RunDevelopment"},iecst:{title:"Structured Text (IEC 61131-3)",owner:"serhioromano"},stylus:{title:"Stylus",owner:"vkbansal"},supercollider:{title:"SuperCollider",alias:"sclang",owner:"RunDevelopment"},swift:{title:"Swift",owner:"chrischares"},systemd:{title:"Systemd configuration file",owner:"RunDevelopment"},"t4-templating":{title:"T4 templating",owner:"RunDevelopment"},"t4-cs":{title:"T4 Text Templates (C#)",require:["t4-templating","csharp"],alias:"t4",owner:"RunDevelopment"},"t4-vb":{title:"T4 Text Templates (VB)",require:["t4-templating","vbnet"],owner:"RunDevelopment"},tap:{title:"TAP",owner:"isaacs",require:"yaml"},tcl:{title:"Tcl",owner:"PeterChaplin"},tt2:{title:"Template Toolkit 2",require:["clike","markup-templating"],owner:"gflohr"},textile:{title:"Textile",require:"markup",optional:"css",owner:"Golmote"},toml:{title:"TOML",owner:"RunDevelopment"},tremor:{title:"Tremor",alias:["trickle","troy"],owner:"darach",aliasTitles:{trickle:"trickle",troy:"troy"}},turtle:{title:"Turtle",alias:"trig",aliasTitles:{trig:"TriG"},owner:"jakubklimek"},twig:{title:"Twig",require:"markup-templating",owner:"brandonkelly"},typescript:{title:"TypeScript",require:"javascript",optional:"js-templates",alias:"ts",owner:"vkbansal"},typoscript:{title:"TypoScript",alias:"tsconfig",aliasTitles:{tsconfig:"TSConfig"},owner:"dkern"},unrealscript:{title:"UnrealScript",alias:["uscript","uc"],owner:"RunDevelopment"},uorazor:{title:"UO Razor Script",owner:"jaseowns"},uri:{title:"URI",alias:"url",aliasTitles:{url:"URL"},owner:"RunDevelopment"},v:{title:"V",require:"clike",owner:"taggon"},vala:{title:"Vala",require:"clike",optional:"regex",owner:"TemplarVolk"},vbnet:{title:"VB.Net",require:"basic",owner:"Bigsby"},velocity:{title:"Velocity",require:"markup",owner:"Golmote"},verilog:{title:"Verilog",owner:"a-rey"},vhdl:{title:"VHDL",owner:"a-rey"},vim:{title:"vim",owner:"westonganger"},"visual-basic":{title:"Visual Basic",alias:["vb","vba"],aliasTitles:{vba:"VBA"},owner:"Golmote"},warpscript:{title:"WarpScript",owner:"RunDevelopment"},wasm:{title:"WebAssembly",owner:"Golmote"},"web-idl":{title:"Web IDL",alias:"webidl",owner:"RunDevelopment"},wgsl:{title:"WGSL",owner:"Dr4gonthree"},wiki:{title:"Wiki markup",require:"markup",owner:"Golmote"},wolfram:{title:"Wolfram language",alias:["mathematica","nb","wl"],aliasTitles:{mathematica:"Mathematica",nb:"Mathematica Notebook"},owner:"msollami"},wren:{title:"Wren",owner:"clsource"},xeora:{title:"Xeora",require:"markup",alias:"xeoracube",aliasTitles:{xeoracube:"XeoraCube"},owner:"freakmaxi"},"xml-doc":{title:"XML doc (.net)",require:"markup",modify:["csharp","fsharp","vbnet"],owner:"RunDevelopment"},xojo:{title:"Xojo (REALbasic)",owner:"Golmote"},xquery:{title:"XQuery",require:"markup",owner:"Golmote"},yaml:{title:"YAML",alias:"yml",owner:"hason"},yang:{title:"YANG",owner:"RunDevelopment"},zig:{title:"Zig",owner:"RunDevelopment"}},plugins:{meta:{path:"plugins/{id}/prism-{id}",link:"plugins/{id}/"},"line-highlight":{title:"Line Highlight",description:"Highlights specific lines and/or line ranges."},"line-numbers":{title:"Line Numbers",description:"Line number at the beginning of code lines.",owner:"kuba-kubula"},"show-invisibles":{title:"Show Invisibles",description:"Show hidden characters such as tabs and line breaks.",optional:["autolinker","data-uri-highlight"]},autolinker:{title:"Autolinker",description:"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},wpd:{title:"WebPlatform Docs",description:'Makes tokens link to WebPlatform.org documentation. The links open in a new tab.'},"custom-class":{title:"Custom Class",description:"This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.",owner:"dvkndn",noCSS:!0},"file-highlight":{title:"File Highlight",description:"Fetch external files and highlight them with Prism. Used on the Prism website itself.",noCSS:!0},"show-language":{title:"Show Language",description:"Display the highlighted language in code blocks (inline code does not show the label).",owner:"nauzilus",noCSS:!0,require:"toolbar"},"jsonp-highlight":{title:"JSONP Highlight",description:"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).",noCSS:!0,owner:"nauzilus"},"highlight-keywords":{title:"Highlight Keywords",description:"Adds special CSS classes for each keyword for fine-grained highlighting.",owner:"vkbansal",noCSS:!0},"remove-initial-line-feed":{title:"Remove initial line feed",description:"Removes the initial line feed in code blocks.",owner:"Golmote",noCSS:!0},"inline-color":{title:"Inline color",description:"Adds a small inline preview for colors in style sheets.",require:"css-extras",owner:"RunDevelopment"},previewers:{title:"Previewers",description:"Previewers for angles, colors, gradients, easing and time.",require:"css-extras",owner:"Golmote"},autoloader:{title:"Autoloader",description:"Automatically loads the needed languages to highlight the code blocks.",owner:"Golmote",noCSS:!0},"keep-markup":{title:"Keep Markup",description:"Prevents custom markup from being dropped out during highlighting.",owner:"Golmote",optional:"normalize-whitespace",noCSS:!0},"command-line":{title:"Command Line",description:"Display a command line with a prompt and, optionally, the output/response from the commands.",owner:"chriswells0"},"unescaped-markup":{title:"Unescaped Markup",description:"Write markup without having to escape anything."},"normalize-whitespace":{title:"Normalize Whitespace",description:"Supports multiple operations to normalize whitespace in code blocks.",owner:"zeitgeist87",optional:"unescaped-markup",noCSS:!0},"data-uri-highlight":{title:"Data-URI Highlight",description:"Highlights data-URI contents.",owner:"Golmote",noCSS:!0},toolbar:{title:"Toolbar",description:"Attach a toolbar for plugins to easily register buttons on the top of a code block.",owner:"mAAdhaTTah"},"copy-to-clipboard":{title:"Copy to Clipboard Button",description:"Add a button that copies the code block to the clipboard when clicked.",owner:"mAAdhaTTah",require:"toolbar",noCSS:!0},"download-button":{title:"Download Button",description:"A button in the toolbar of a code block adding a convenient way to download a code file.",owner:"Golmote",require:"toolbar",noCSS:!0},"match-braces":{title:"Match braces",description:"Highlights matching braces.",owner:"RunDevelopment"},"diff-highlight":{title:"Diff Highlight",description:"Highlights the code inside diff blocks.",owner:"RunDevelopment",require:"diff"},"filter-highlight-all":{title:"Filter highlightAll",description:"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.",owner:"RunDevelopment",noCSS:!0},treeview:{title:"Treeview",description:"A language with special styles to highlight file system tree structures.",owner:"Golmote"}}})},8722:(e,t,n)=>{const r=n(6969),a=n(8380),o=new Set;function i(e){void 0===e?e=Object.keys(r.languages).filter((e=>"meta"!=e)):Array.isArray(e)||(e=[e]);const t=[...o,...Object.keys(Prism.languages)];a(r,e,t).load((e=>{if(!(e in r.languages))return void(i.silent||console.warn("Language does not exist: "+e));const t="./prism-"+e;delete n.c[n(3157).resolve(t)],delete Prism.languages[e],n(3157)(t),o.add(e)}))}i.silent=!1,e.exports=i},8692:(e,t,n)=>{var r={"./":8722};function a(e){var t=o(e);return n(t)}function o(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}a.keys=function(){return Object.keys(r)},a.resolve=o,e.exports=a,a.id=8692},3157:(e,t,n)=>{var r={"./":8722};function a(e){var t=o(e);return n(t)}function o(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}a.keys=function(){return Object.keys(r)},a.resolve=o,e.exports=a,a.id=3157},8380:e=>{"use strict";var t=function(){var e=function(){};function t(e,t){Array.isArray(e)?e.forEach(t):null!=e&&t(e,0)}function n(e){for(var t={},n=0,r=e.length;n "));var l={},s=e[r];if(s){function c(t){if(!(t in e))throw new Error(r+" depends on an unknown component "+t);if(!(t in l))for(var i in a(t,o),l[t]=!0,n[t])l[i]=!0}t(s.require,c),t(s.optional,c),t(s.modify,c)}n[r]=l,o.pop()}}return function(e){var t=n[e];return t||(a(e,r),t=n[e]),t}}function a(e){for(var t in e)return!0;return!1}return function(o,i,l){var s=function(e){var t={};for(var n in e){var r=e[n];for(var a in r)if("meta"!=a){var o=r[a];t[a]="string"==typeof o?{title:o}:o}}return t}(o),c=function(e){var n;return function(r){if(r in e)return r;if(!n)for(var a in n={},e){var o=e[a];t(o&&o.alias,(function(t){if(t in n)throw new Error(t+" cannot be alias for both "+a+" and "+n[t]);if(t in e)throw new Error(t+" cannot be alias of "+a+" because it is a component.");n[t]=a}))}return n[r]||r}}(s);i=i.map(c),l=(l||[]).map(c);var u=n(i),d=n(l);i.forEach((function e(n){var r=s[n];t(r&&r.require,(function(t){t in d||(u[t]=!0,e(t))}))}));for(var f,p=r(s),m=u;a(m);){for(var h in f={},m){var g=s[h];t(g&&g.modify,(function(e){e in d&&(f[e]=!0)}))}for(var b in d)if(!(b in u))for(var v in p(b))if(v in u){f[b]=!0;break}for(var y in m=f)u[y]=!0}var w={getIds:function(){var e=[];return w.load((function(t){e.push(t)})),e},load:function(t,n){return function(t,n,r,a){var o=a?a.series:void 0,i=a?a.parallel:e,l={},s={};function c(e){if(e in l)return l[e];s[e]=!0;var a,u=[];for(var d in t(e))d in n&&u.push(d);if(0===u.length)a=r(e);else{var f=i(u.map((function(e){var t=c(e);return delete s[e],t})));o?a=o(f,(function(){return r(e)})):r(e)}return l[e]=a}for(var u in n)c(u);var d=[];for(var f in s)d.push(l[f]);return i(d)}(p,u,t,n)}};return w}}();e.exports=t},2694:(e,t,n)=>{"use strict";var r=n(6925);function a(){}function o(){}o.resetWarningCache=a,e.exports=function(){function e(e,t,n,a,o,i){if(i!==r){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:a};return n.PropTypes=n,n}},5556:(e,t,n)=>{e.exports=n(2694)()},6925:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},2551:(e,t,n)=>{"use strict";var r=n(6540),a=n(5228),o=n(9982);function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n