//
// Copyright (C) Microsoft. All rights reserved.
//
// canvasChartControl.ts
var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    (function (Controls) {
        (function (Charting) {
            (function (ChartViewType) {
                ChartViewType._map = [];
                ChartViewType._map[0] = "Scale";
                ChartViewType.Scale = 0;
                ChartViewType._map[1] = "Expand";
                ChartViewType.Expand = 1;
                ChartViewType._map[2] = "Roll";
                ChartViewType.Roll = 2;
                ChartViewType._map[3] = "Fixed";
                ChartViewType.Fixed = 3;
            })(Charting.ChartViewType || (Charting.ChartViewType = {}));
            var ChartViewType = Charting.ChartViewType;
            (function (SeriesRenderType) {
                SeriesRenderType._map = [];
                SeriesRenderType.Points = 1;
                SeriesRenderType.Line = 2;
                SeriesRenderType.PointsAndLine = SeriesRenderType.Points | SeriesRenderType.Line;
                SeriesRenderType.VerticalLines = 4;
                SeriesRenderType.Triangles = 8;
            })(Charting.SeriesRenderType || (Charting.SeriesRenderType = {}));
            var SeriesRenderType = Charting.SeriesRenderType;
            (function (SeriesOrderType) {
                SeriesOrderType._map = [];
                SeriesOrderType._map[0] = "Sort";
                SeriesOrderType.Sort = 0;
                SeriesOrderType._map[1] = "Remove";
                SeriesOrderType.Remove = 1;
            })(Charting.SeriesOrderType || (Charting.SeriesOrderType = {}));
            var SeriesOrderType = Charting.SeriesOrderType;
            var ChartColorType;
            (function (ChartColorType) {
                ChartColorType._map = [];
                ChartColorType._map[0] = "Background";
                ChartColorType.Background = 0;
                ChartColorType._map[1] = "Foreground";
                ChartColorType.Foreground = 1;
                ChartColorType._map[2] = "Grid";
                ChartColorType.Grid = 2;
                ChartColorType._map[3] = "LegendBackground";
                ChartColorType.LegendBackground = 3;
                ChartColorType._map[4] = "ViewSelection";
                ChartColorType.ViewSelection = 4;
                ChartColorType._map[5] = "ViewSelectionOutside";
                ChartColorType.ViewSelectionOutside = 5;
            })(ChartColorType || (ChartColorType = {}));
            var ChartFontType;
            (function (ChartFontType) {
                ChartFontType._map = [];
                ChartFontType._map[0] = "Foreground";
                ChartFontType.Foreground = 0;
            })(ChartFontType || (ChartFontType = {}));
            var Point2d = (function () {
                function Point2d(x, y) {
                    this.x = x;
                    this.y = y;
                }
                return Point2d;
            })();            
            var Point2dWithData = (function (_super) {
                __extends(Point2dWithData, _super);
                function Point2dWithData(x, y, data) {
                                _super.call(this, x, y);
                    this.data = data;
                }
                return Point2dWithData;
            })(Point2d);            
            var Point2dRendered = (function (_super) {
                __extends(Point2dRendered, _super);
                function Point2dRendered(x, y, isInView, seriesIndex) {
                                _super.call(this, x, y);
                    this.isInView = isInView;
                    this.seriesIndex = seriesIndex;
                }
                return Point2dRendered;
            })(Point2d);            
            var Padding = (function () {
                function Padding(left, top, right, bottom) {
                    this.left = left;
                    this.top = top;
                    this.right = right;
                    this.bottom = bottom;
                }
                return Padding;
            })();            
            var Rect = (function (_super) {
                __extends(Rect, _super);
                function Rect(left, top, right, bottom) {
                                _super.call(this, left, top, right, bottom);
                    if(this.left > this.right || this.top > this.bottom) {
                        throw "Invalid rectange size";
                    }
                }
                Object.defineProperty(Rect.prototype, "width", {
                    get: function () {
                        return this.right - this.left;
                    },
                    enumerable: true,
                    configurable: true
                });
                Object.defineProperty(Rect.prototype, "height", {
                    get: function () {
                        return this.bottom - this.top;
                    },
                    enumerable: true,
                    configurable: true
                });
                return Rect;
            })(Padding);            
            var MinMax = (function () {
                function MinMax(min, max) {
                    this.min = min;
                    this.max = max;
                }
                return MinMax;
            })();            
            var ChartSeries = (function () {
                function ChartSeries(index, legendText, seriesRenderType) {
                    this._lineColorString = "#FF0000";
                    this._lineFillColorString = "#FF0000";
                    this._pointColorString = "#FF0000";
                    this._pointStrokeColorString = "#FF0000";
                    this.index = index;
                    this.legendText = legendText;
                    this.seriesRenderType = seriesRenderType;
                    this.data = [];
                    switch(index) {
                        case 0:
                            this._lineColorString = "rgb(180, 180, 255)";
                            this._lineFillColorString = "rgba(200, 200, 255, 0.3)";
                            this._pointColorString = "rgb(0, 0, 255)";
                            this._pointStrokeColorString = "rgb(0, 0, 0)";
                            break;
                        case 1:
                            this._lineColorString = "rgb(255, 180, 180)";
                            this._lineFillColorString = "rgba(255, 200, 200, 0.3)";
                            this._pointColorString = "rgb(255, 0, 0)";
                            this._pointStrokeColorString = "rgb(0, 0, 0)";
                            break;
                        case 2:
                            this._lineColorString = "rgb(180, 200, 100)";
                            this._lineFillColorString = "rgba(200, 255, 200, 0.3)";
                            this._pointColorString = "rgb(0, 200, 0)";
                            this._pointStrokeColorString = "rgb(0, 0, 0)";
                            break;
                        case 3:
                            this._lineColorString = "rgb(180, 255, 255)";
                            this._lineFillColorString = "rgba(200, 255, 255, 0.3)";
                            this._pointColorString = "rgb(0, 255, 255)";
                            this._pointStrokeColorString = "rgb(0, 0, 0)";
                            break;
                        case 4:
                            this._lineColorString = "rgb(255, 255, 180)";
                            this._lineFillColorString = "rgba(255, 255, 200, 0.3)";
                            this._pointColorString = "rgb(255, 255, 0)";
                            this._pointStrokeColorString = "rgb(0, 0, 0)";
                            break;
                        default:
                            break;
                    }
                }
                Object.defineProperty(ChartSeries.prototype, "lineColor", {
                    get: function () {
                        return this._lineColorString;
                    },
                    enumerable: true,
                    configurable: true
                });
                Object.defineProperty(ChartSeries.prototype, "lineFillColor", {
                    get: function () {
                        return this._lineFillColorString;
                    },
                    enumerable: true,
                    configurable: true
                });
                Object.defineProperty(ChartSeries.prototype, "pointColor", {
                    get: function () {
                        return this._pointColorString;
                    },
                    enumerable: true,
                    configurable: true
                });
                Object.defineProperty(ChartSeries.prototype, "pointStrokeColor", {
                    get: function () {
                        return this._pointStrokeColorString;
                    },
                    enumerable: true,
                    configurable: true
                });
                return ChartSeries;
            })();            
            var CanvasChartControl = (function (_super) {
                __extends(CanvasChartControl, _super);
                function CanvasChartControl(containerId) {
                                _super.call(this, "CanvasChartTemplate");
                    this._chartInitialStartSet = false;
                    this._chartAxisPadding = new Padding(50, 40, 5, 5);
                    this._chartAxisCount = 5;
                    this._chartAxisIncreaseRatio = 1.5;
                    this._chartDrawFill = true;
                    this._chartOverviewPadding = 4;
                    this._chartViewOverview = false;
                    this._chartViewX = 0;
                    this._chartViewWidth = 60;
                    this._chartViewType = ChartViewType.Roll;
                    this._gridX = new MinMax(0, 0);
                    this._gridY = new MinMax(0, 0);
                    this._gridRange = new Point2d(0, 0);
                    this._triangleSize = 7;
                    this._containerId = containerId;
                    this._series = [];
                    this._container = document.getElementById(this._containerId);
                    if(this._container !== null) {
                        this._container.appendChild(this.rootElement);
                        this._canvas = this.findElement("mainCanvas");
                        this._context = this._canvas.getContext("2d");
                        if(!this._container.runtimeStyle.position || this._container.runtimeStyle.position === "static") {
                            this._container.style.position = "relative";
                        }
                        window.addEventListener("resize", this.onResize.bind(this));
                        this.onResize(null);
                    } else {
                        throw "An element with id " + this._containerId + " could not be found";
                    }
                }
                CanvasChartControl.prototype.onResize = function (event) {
                    if(this._container.clientWidth > 0 && this._container.clientHeight > 0) {
                        this._canvas.width = this._container.clientWidth;
                        this._canvas.height = this._container.clientHeight;
                        this._chartWidth = this._canvas.width - this._chartAxisPadding.right;
                        this._chartHeight = this._canvas.height - this._chartAxisPadding.bottom;
                        this.drawChart();
                    }
                };
                CanvasChartControl.prototype.getColor = function (colorId) {
                    switch(colorId) {
                        case ChartColorType.Background:
                            return "rgb(255, 255, 255)";
                        case ChartColorType.Foreground:
                            return "rgb(0, 0, 0)";
                        case ChartColorType.Grid:
                            return "rgb(200, 200, 200)";
                        case ChartColorType.LegendBackground:
                            return "rgba(250, 250, 250, 0.75)";
                        case ChartColorType.ViewSelection:
                            return "rgb(120, 120, 120)";
                        case ChartColorType.ViewSelectionOutside:
                            return "rgba(255, 255, 255, 0.6)";
                    }
                    return "rgb(255, 0, 0)";
                };
                CanvasChartControl.prototype.getFontString = function (fontId) {
                    switch(fontId) {
                        case ChartFontType.Foreground:
                            return "7.5pt \"Segoe UI\", Arial, sans-serif";
                    }
                    return "7.5pt \"Segoe UI\", Arial, sans-serif";
                };
                CanvasChartControl.prototype.getYCoord = function (y, top, height) {
                    return top + ((this._gridY.max - y) / this._gridRange.y) * height;
                };
                CanvasChartControl.prototype.drawXAxesValue = function (value, offsetY) {
                    this._context.save();
                    this._context.fillStyle = this.getColor(ChartColorType.Foreground);
                    this._context.font = this.getFontString(ChartFontType.Foreground);
                    this._context.fillText("" + value.toFixed(2), this._chartAxisPadding.left - 5, this._chartAxisPadding.top + offsetY + 1.5);
                    this._context.restore();
                };
                CanvasChartControl.prototype.drawChartBackground = function () {
                    this._context.fillStyle = this.getColor(ChartColorType.Background);
                    this._context.fillRect(0, 0, this._canvas.width, this._canvas.height);
                };
                CanvasChartControl.prototype.drawChartAxes = function (chartRect) {
                    this._context.fillStyle = this.getColor(ChartColorType.Grid);
                    this._context.strokeStyle = this.getColor(ChartColorType.Grid);
                    this._context.textAlign = "right";
                    var step = (this._gridRange.y / this._chartAxisCount);
                    this.drawXAxesValue(this._gridY.max, 0);
                    for(var i = 1; i < this._chartAxisCount; i++) {
                        var y = ((step * i) / this._gridRange.y) * chartRect.height;
                        var lineY = chartRect.top + Math.floor(y) + 0.5;
                        this._context.beginPath();
                        this._context.moveTo(chartRect.left, lineY);
                        this._context.lineTo(chartRect.left + chartRect.width, lineY);
                        this._context.stroke();
                        this.drawXAxesValue(this._gridY.max - (step * i), y);
                    }
                    this.drawXAxesValue(this._gridY.min, chartRect.height);
                };
                CanvasChartControl.prototype.drawChartBorder = function (chartRect) {
                    this._context.fillStyle = "transparent";
                    this._context.strokeStyle = this.getColor(ChartColorType.Foreground);
                    this._context.strokeRect(chartRect.left - 0.5, chartRect.top - 0.5, chartRect.width, chartRect.height);
                };
                CanvasChartControl.prototype.drawChartLegend = function (chartRect) {
                    if(!this._legendDiv) {
                        this._legendDiv = document.createElement("div");
                        this._legendDiv.className = "chartLegend";
                        this._legendDiv.style.position = "absolute";
                        this._legendDiv.style.right = "20px";
                        this._legendDiv.style.bottom = (this._canvas.height - chartRect.bottom + 10) + "px";
                        this._legendDiv.style.backgroundColor = this.getColor(ChartColorType.LegendBackground);
                        this._legendDiv.style.color = this.getColor(ChartColorType.Foreground);
                        this._legendDiv.style.padding = "2px 5px 2px 5px";
                        this._legendDiv.style.font = this.getFontString(ChartFontType.Foreground);
                        this._legendDiv.style.borderRadius = "3px";
                        if(this._container !== null) {
                            this._container.appendChild(this._legendDiv);
                        }
                    }
                    if(this._legendDiv.children.length !== this._series.length) {
                        for(var i = 0; i < this._series.length; i++) {
                            var seriesDiv = document.createElement("div");
                            seriesDiv.className = "chartLegendSeries";
                            var colorSpan = document.createElement("span");
                            colorSpan.style.display = "inline-block";
                            colorSpan.style.width = "16px";
                            colorSpan.style.height = "10px";
                            colorSpan.style.margin = "0 4px 2px 0";
                            colorSpan.style.verticalAlign = "middle";
                            colorSpan.style.border = "solid " + this._series[i].lineColor + " 1px";
                            if(this._series[i].seriesRenderType & SeriesRenderType.Line) {
                                colorSpan.style.backgroundColor = this._series[i].lineFillColor;
                            }
                            var innerColorSpan = document.createElement("span");
                            innerColorSpan.style.display = "inline-block";
                            innerColorSpan.style.width = "12px";
                            innerColorSpan.style.height = "8px";
                            innerColorSpan.style.margin = "0 0 10px 1px";
                            innerColorSpan.style.verticalAlign = "middle";
                            innerColorSpan.style.backgroundColor = this._series[i].pointColor;
                            colorSpan.appendChild(innerColorSpan);
                            seriesDiv.appendChild(colorSpan);
                            var textSpan = document.createElement("span");
                            textSpan.innerText = this._series[i].legendText;
                            seriesDiv.appendChild(textSpan);
                            this._legendDiv.appendChild(seriesDiv);
                        }
                    }
                };
                CanvasChartControl.prototype.drawChartType = function (chartViewType, chartRect, isOverview) {
                    var renderedPoints = new Array();
                    for(var seriesIndex = 0; seriesIndex < this._series.length; seriesIndex++) {
                        var series = this._series[seriesIndex];
                        var seriesPoints = series.data;
                        if(seriesPoints.length > 0) {
                            var startIndex = 0;
                            var endIndex = seriesPoints.length - 1;
                            var startX = 0;
                            var rangeX = 0;
                            switch(chartViewType) {
                                case ChartViewType.Scale:
                                    startX = this._gridX.min;
                                    rangeX = this._gridRange.x;
                                    break;
                                case ChartViewType.Expand:
                                    startX = this._gridX.min;
                                    rangeX = Math.max(this._gridRange.x, this._chartViewWidth);
                                    break;
                                case ChartViewType.Fixed:
                                    startX = this._chartViewX;
                                    rangeX = this._chartViewWidth;
                                    break;
                                case ChartViewType.Roll:
                                    this._chartViewX = Math.max(this._gridX.max - this._chartViewWidth, this._gridX.min);
                                    startX = this._chartViewX;
                                    rangeX = this._chartViewWidth;
                                    break;
                            }
                            var endX = startX + rangeX;
                            var scaleX = chartRect.width / rangeX;
                            var x = 0;
                            var y = 0;
                            var startPoint = seriesPoints[startIndex];
                            var hasMovedToStart = false;
                            this._context.save();
                            this._context.beginPath();
                            this._context.rect(chartRect.left, chartRect.top, chartRect.width, chartRect.height);
                            this._context.clip();
                            this._context.fillStyle = series.lineFillColor;
                            this._context.strokeStyle = series.lineColor;
                            this._context.beginPath();
                            for(var i = startIndex; i <= endIndex; i++) {
                                var point = seriesPoints[i];
                                var pointInView = (point.x >= startX && point.x <= endX);
                                var requiresDrawing = pointInView;
                                if(!requiresDrawing) {
                                    if((point.x < startX && i < endIndex && seriesPoints[i + 1].x > startX) || (point.x > endX && i > 0 && seriesPoints[i - 1].x < endX)) {
                                        requiresDrawing = true;
                                    }
                                }
                                if(requiresDrawing) {
                                    x = chartRect.left + (point.x - startX) * scaleX;
                                    y = this.getYCoord(point.y, chartRect.top, chartRect.height);
                                    if(!hasMovedToStart) {
                                        this._context.moveTo(x, this.getYCoord(0, chartRect.top, chartRect.height));
                                        hasMovedToStart = true;
                                    }
                                    if(series.seriesRenderType & SeriesRenderType.Line) {
                                        this._context.lineTo(x, y);
                                    }
                                    renderedPoints.push({
                                        x: x,
                                        y: y,
                                        isInView: pointInView,
                                        seriesIndex: seriesIndex
                                    });
                                }
                            }
                            if(series.seriesRenderType & SeriesRenderType.Line) {
                                if(this._chartDrawFill) {
                                    var y = this.getYCoord(0, chartRect.top, chartRect.height);
                                    this._context.lineTo(x, y);
                                    this._context.closePath();
                                    this._context.fill();
                                } else {
                                    this._context.stroke();
                                }
                                if(this._chartDrawFill) {
                                    this._context.lineWidth = (chartRect.height < 100 ? 1 : 2);
                                    this._context.strokeStyle = series.lineColor;
                                    this._context.beginPath();
                                    for(var i = 0; i < renderedPoints.length; i++) {
                                        var rp = renderedPoints[i];
                                        if(i === 0) {
                                            this._context.moveTo(rp.x, Math.round(rp.y) - 0.5);
                                        }
                                        this._context.lineTo(rp.x, Math.round(rp.y) - 0.5);
                                    }
                                    this._context.stroke();
                                }
                            }
                            this._context.restore();
                        }
                    }
                    this.drawChartBorder(chartRect);
                    var overviewStartX = chartRect.left + (this._chartViewX - this._gridX.min) * scaleX;
                    var overviewEndX = overviewStartX + Math.min(this._chartViewWidth * scaleX, chartRect.width);
                    var seriesIndexForColor = -1;
                    for(var i = 0; i < renderedPoints.length; i++) {
                        if(renderedPoints[i].isInView) {
                            var si = renderedPoints[i].seriesIndex;
                            if(seriesIndexForColor !== si) {
                                this._context.fillStyle = this._series[si].pointColor;
                                this._context.strokeStyle = this._series[si].pointStrokeColor;
                                seriesIndexForColor = si;
                            }
                            if(this._series[si].seriesRenderType & SeriesRenderType.Points) {
                                this._context.beginPath();
                                this._context.arc(renderedPoints[i].x - 0.5, renderedPoints[i].y - 0.5, 3, 0, Math.PI * 2);
                                this._context.fill();
                            }
                            if(this._series[si].seriesRenderType & SeriesRenderType.VerticalLines) {
                                this._context.beginPath();
                                this._context.rect(Math.round(renderedPoints[i].x), chartRect.top, 1, chartRect.height);
                                this._context.fill();
                            }
                            if(this._series[si].seriesRenderType & SeriesRenderType.Triangles) {
                                this._context.beginPath();
                                this._context.moveTo(renderedPoints[i].x, chartRect.bottom - 2 * this._triangleSize);
                                this._context.lineTo(renderedPoints[i].x - this._triangleSize, chartRect.bottom);
                                this._context.lineTo(renderedPoints[i].x + this._triangleSize, chartRect.bottom);
                                this._context.lineTo(renderedPoints[i].x, chartRect.bottom - 2 * this._triangleSize);
                                this._context.closePath();
                                this._context.fill();
                            }
                        }
                    }
                };
                CanvasChartControl.prototype.drawChartViewSelection = function (chartRect) {
                    var padding = this._chartOverviewPadding;
                    var doublePadding = padding * 2;
                    var scaleX = (chartRect.width / this._gridRange.x);
                    var x = (this._chartViewX - this._gridX.min) * scaleX;
                    var y = chartRect.top - padding;
                    var w = Math.min(this._chartViewWidth * scaleX, chartRect.width);
                    var h = chartRect.height + doublePadding;
                    this._context.fillStyle = this.getColor(ChartColorType.ViewSelectionOutside);
                    this._context.fillRect(chartRect.left - padding, y, Math.max(x, 0), h);
                    this._context.fillRect(chartRect.left + x + w + padding, y, Math.max(chartRect.width - (x + w), 0), h);
                    var snappedX = Math.floor(chartRect.left + x - padding) - 0.5;
                    var snappedY = Math.floor(chartRect.top - padding) - 0.5;
                    var snappedW = Math.ceil(w + doublePadding);
                    var snappedH = Math.ceil(chartRect.height + doublePadding);
                    this._context.save();
                    this._context.strokeStyle = this.getColor(ChartColorType.ViewSelection);
                    this._context.lineWidth = 1;
                    this._context.strokeRect(snappedX, snappedY, snappedW, snappedH);
                    this._context.restore();
                };
                CanvasChartControl.prototype.drawChart = function () {
                    if(this._chartViewType === ChartViewType.Scale || this._chartViewType === ChartViewType.Expand) {
                        this._chartViewX = this._gridX.min;
                        this._chartViewWidth = Math.max(this._gridRange.x, this._chartViewWidth);
                    }
                    this.drawChartBackground();
                    var chartRect = new Rect(this._chartAxisPadding.left, this._chartAxisPadding.top, this._chartWidth, this._chartHeight - (this._chartViewOverview ? 40 : 0));
                    this.drawChartAxes(chartRect);
                    this.drawChartType(this._chartViewType, chartRect, false);
                    this.drawChartLegend(chartRect);
                    if(this._chartViewOverview) {
                        chartRect.top += chartRect.height + 10;
                        chartRect.bottom = chartRect.top + 30;
                        this.drawChartType(ChartViewType.Expand, chartRect, true);
                        this.drawChartViewSelection(chartRect);
                    }
                };
                CanvasChartControl.prototype.calculateRange = function (point) {
                    if(this._gridX.max < point.x) {
                        this._gridX.max = point.x;
                    }
                    if(this._gridX.min > point.x) {
                        this._gridX.min = point.x;
                    }
                    if(this._gridY.min > point.y) {
                        this._gridY.min = Math.floor((point.y * this._chartAxisIncreaseRatio) / this._chartAxisCount) * this._chartAxisCount;
                    }
                    if(this._gridY.max < point.y) {
                        this._gridY.max = Math.ceil((point.y * this._chartAxisIncreaseRatio) / this._chartAxisCount) * this._chartAxisCount;
                    }
                    this._gridRange.x = this._gridX.max - this._gridX.min;
                    this._gridRange.y = this._gridY.max - this._gridY.min;
                };
                CanvasChartControl.prototype.setViewType = function (viewType, viewStartX, viewWidth, viewHeight) {
                    if(viewStartX < this._gridX.min) {
                        viewStartX = this._gridX.min;
                    }
                    this._chartViewType = viewType;
                    this._chartViewX = viewStartX;
                    this._chartViewWidth = viewWidth;
                    if(typeof viewHeight === "number") {
                        this._gridY.max = viewHeight;
                        this._gridRange.y = viewHeight;
                    }
                    this.drawChart();
                };
                CanvasChartControl.prototype.addSeries = function (legendText, seriesRenderType) {
                    var newSeries = new ChartSeries(this._series.length, legendText, seriesRenderType);
                    this._series.push(newSeries);
                    var filledLines = 0;
                    for(var i = 0; i < this._series.length; i++) {
                        if(this._series[i].seriesRenderType & SeriesRenderType.Line) {
                            filledLines++;
                            if(filledLines >= 2) {
                                this._chartDrawFill = false;
                                break;
                            }
                        }
                    }
                    return this._series.length - 1;
                };
                CanvasChartControl.prototype.addPointToSeries = function (seriesIndex, x, y, tooltip, orderType, skipRender) {
                    if (typeof orderType === "undefined") { orderType = SeriesOrderType.Sort; }
                    if(seriesIndex >= 0 && seriesIndex < this._series.length) {
                        var newPoint = new Point2dWithData(x, y, tooltip);
                        var seriesData = this._series[seriesIndex].data;
                        seriesData.push(newPoint);
                        if(newPoint.x < this._gridX.max) {
                            switch(orderType) {
                                case SeriesOrderType.Remove:
                                    for(var deleteIndex = seriesData.length - 2; deleteIndex >= 0; deleteIndex--) {
                                        if(seriesData[deleteIndex].x < x) {
                                            break;
                                        }
                                    }
                                    deleteIndex++;
                                    seriesData.splice(deleteIndex, seriesData.length - deleteIndex - 1);
                                    this._gridX.max = newPoint.x;
                                    break;
                                case SeriesOrderType.Sort:
                                default:
                                    seriesData.sort(function (a, b) {
                                        return a.x - b.x;
                                    });
                                    break;
                            }
                        }
                        if(!this._chartInitialStartSet) {
                            this._chartInitialStartSet = true;
                            this._gridX.min = newPoint.x;
                            this._chartViewX = newPoint.x;
                        }
                        this.calculateRange(newPoint);
                        if(!skipRender) {
                            this.drawChart();
                        }
                    }
                };
                return CanvasChartControl;
            })(Common.Controls.TemplateControl);
            Charting.CanvasChartControl = CanvasChartControl;            
        })(Controls.Charting || (Controls.Charting = {}));
        var Charting = Controls.Charting;
    })(MemoryAnalyzer.Controls || (MemoryAnalyzer.Controls = {}));
    var Controls = MemoryAnalyzer.Controls;
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=canvasChartControl.js.map

// componentModel.ts
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    (function (Controls) {
        var ObservableViewModel = (function () {
            function ObservableViewModel() {
                this._propertyChangedObservers = [];
            }
            ObservableViewModel.prototype.registerPropertyChanged = function (observer) {
                this._propertyChangedObservers.push(observer);
            };
            ObservableViewModel.prototype.removePropertyChanged = function (observer) {
                var index = this._propertyChangedObservers.indexOf(observer);
                if(index >= 0) {
                    this._propertyChangedObservers = this._propertyChangedObservers.splice(index, 1);
                }
            };
            ObservableViewModel.prototype.raisePropertyChanged = function (propertyName) {
                for(var i = 0; i < this._propertyChangedObservers.length; i++) {
                    this._propertyChangedObservers[i].onPropertyChanged(propertyName);
                }
            };
            return ObservableViewModel;
        })();
        Controls.ObservableViewModel = ObservableViewModel;        
        (function (NotifyCollectionChangedAction) {
            NotifyCollectionChangedAction._map = [];
            NotifyCollectionChangedAction._map[0] = "Add";
            NotifyCollectionChangedAction.Add = 0;
            NotifyCollectionChangedAction._map[1] = "Reset";
            NotifyCollectionChangedAction.Reset = 1;
        })(Controls.NotifyCollectionChangedAction || (Controls.NotifyCollectionChangedAction = {}));
        var NotifyCollectionChangedAction = Controls.NotifyCollectionChangedAction;
        var NotifyCollectionChangedEventArgs = (function () {
            function NotifyCollectionChangedEventArgs(action, newItems, newStartingIndex, oldItems, oldStartingIndex) {
                this._action = action;
                this._newItems = newItems;
                this._newStartingIndex = newStartingIndex;
                this._oldItems = oldItems;
                this._oldStartingIndex = oldStartingIndex;
            }
            Object.defineProperty(NotifyCollectionChangedEventArgs.prototype, "action", {
                get: function () {
                    return this._action;
                },
                enumerable: true,
                configurable: true
            });
            Object.defineProperty(NotifyCollectionChangedEventArgs.prototype, "newItems", {
                get: function () {
                    return this._newItems;
                },
                enumerable: true,
                configurable: true
            });
            Object.defineProperty(NotifyCollectionChangedEventArgs.prototype, "newStartingIndex", {
                get: function () {
                    return this._newStartingIndex;
                },
                enumerable: true,
                configurable: true
            });
            Object.defineProperty(NotifyCollectionChangedEventArgs.prototype, "oldItems", {
                get: function () {
                    return this._oldItems;
                },
                enumerable: true,
                configurable: true
            });
            Object.defineProperty(NotifyCollectionChangedEventArgs.prototype, "oldStartingIndex", {
                get: function () {
                    return this._oldStartingIndex;
                },
                enumerable: true,
                configurable: true
            });
            return NotifyCollectionChangedEventArgs;
        })();
        Controls.NotifyCollectionChangedEventArgs = NotifyCollectionChangedEventArgs;        
        var ObservableCollection = (function () {
            function ObservableCollection() {
                this._items = [];
                this._collectionChangedObservers = [];
            }
            ObservableCollection.prototype.registerCollectionChanged = function (observer) {
                this._collectionChangedObservers.push(observer);
            };
            ObservableCollection.prototype.removeCollectionChanged = function (observer) {
                var index = this._collectionChangedObservers.indexOf(observer);
                if(index >= 0) {
                    this._collectionChangedObservers = this._collectionChangedObservers.splice(index, 1);
                }
            };
            ObservableCollection.prototype.add = function (item) {
                this._items.push(item);
                var args = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, [
                    item
                ], this._items.length - 1, [], 0);
                this.onCollectionChanged(args);
            };
            ObservableCollection.prototype.clear = function () {
                var oldItems = this._items;
                this._items = [];
                var args = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset, [], 0, oldItems, oldItems.length - 1);
                this.onCollectionChanged(args);
            };
            ObservableCollection.prototype.getItem = function (index) {
                return this._items[index];
            };
            Object.defineProperty(ObservableCollection.prototype, "length", {
                get: function () {
                    return this._items.length;
                },
                enumerable: true,
                configurable: true
            });
            ObservableCollection.prototype.onCollectionChanged = function (eventArgs) {
                for(var i = 0; i < this._collectionChangedObservers.length; i++) {
                    this._collectionChangedObservers[i].onCollectionChanged(eventArgs);
                }
            };
            return ObservableCollection;
        })();
        Controls.ObservableCollection = ObservableCollection;        
    })(MemoryAnalyzer.Controls || (MemoryAnalyzer.Controls = {}));
    var Controls = MemoryAnalyzer.Controls;
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=componentModel.js.map

// contentControl.ts
var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    (function (Controls) {
        var ContentControl = (function (_super) {
            __extends(ContentControl, _super);
            function ContentControl() {
                        _super.call(this);
            }
            Object.defineProperty(ContentControl.prototype, "content", {
                get: function () {
                    return this._content;
                },
                set: function (newContent) {
                    if(this._content !== newContent) {
                        if(this._content) {
                            this.removeChild(this._content);
                        }
                        this._content = newContent;
                        this.appendChild(this._content);
                        this.onContentChanged();
                    }
                },
                enumerable: true,
                configurable: true
            });
            ContentControl.prototype.appendChild = function (child) {
                if(this.rootElement.children.length != 0) {
                    throw new Error(Plugin.Resources.getErrorString("JSPerf.1016"));
                }
                _super.prototype.appendChild.call(this, child);
            };
            ContentControl.prototype.onContentChanged = function () {
            };
            return ContentControl;
        })(Common.Controls.Control);
        Controls.ContentControl = ContentControl;        
    })(MemoryAnalyzer.Controls || (MemoryAnalyzer.Controls = {}));
    var Controls = MemoryAnalyzer.Controls;
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=contentControl.js.map

// gridSplitterControl.ts
var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    (function (Controls) {
        (function (GridSplitterDirection) {
            GridSplitterDirection._map = [];
            GridSplitterDirection._map[0] = "Horizontal";
            GridSplitterDirection.Horizontal = 0;
            GridSplitterDirection._map[1] = "Vertical";
            GridSplitterDirection.Vertical = 1;
        })(Controls.GridSplitterDirection || (Controls.GridSplitterDirection = {}));
        var GridSplitterDirection = Controls.GridSplitterDirection;
        var GridSplitterControl = (function (_super) {
            __extends(GridSplitterControl, _super);
            function GridSplitterControl(splitterElement, minSize, scrollableContainer, callback) {
                        _super.call(this, splitterElement);
                this._direction = null;
                this._minSize = (typeof minSize === "number" && minSize > 0) ? minSize : GridSplitterControl._gridSplitterDefaultMinSize;
                this._scrollableContainer = scrollableContainer;
                this._callback = callback;
                if(!this.rootElement.contains(GridSplitterControl._gridSplitterClass)) {
                    this.rootElement.classList.add(GridSplitterControl._gridSplitterClass);
                }
                this._resizerDisplay = document.createElement("div");
                this._resizerDisplay.className = GridSplitterControl._gridSplitterClass + " " + GridSplitterControl._gridSplitterResizerClass;
                this._resizerDisplay.style.position = "relative";
                this._resizerDisplay.style.display = "none";
                this.rootElement.appendChild(this._resizerDisplay);
                this.rootElement.addEventListener("mousedown", this.onMouseDown.bind(this));
            }
            GridSplitterControl._gridSplitterClass = "gridSplitter";
            GridSplitterControl._gridSplitterResizerClass = "gridSplitter-Resizer";
            GridSplitterControl._gridSplitterVerticalClass = "gridSplitter-Vertical";
            GridSplitterControl._gridSplitterHorizontalClass = "gridSplitter-Horizontal";
            GridSplitterControl._gridSplitterDefaultMinSize = 100;
            Object.defineProperty(GridSplitterControl.prototype, "direction", {
                get: function () {
                    if(this._direction === null) {
                        this._direction = this.getSplitterDirection();
                    }
                    return this._direction;
                },
                enumerable: true,
                configurable: true
            });
            Object.defineProperty(GridSplitterControl.prototype, "gridCSS", {
                get: function () {
                    if(!this._gridCSS) {
                        this._gridCSS = this.getParentGridCSS();
                    }
                    return this._gridCSS;
                },
                enumerable: true,
                configurable: true
            });
            GridSplitterControl.prototype.getSplitterDirection = function () {
                var direction;
                if(this.rootElement.classList.contains(GridSplitterControl._gridSplitterVerticalClass)) {
                    direction = GridSplitterDirection.Vertical;
                } else if(this.rootElement.classList.contains(GridSplitterControl._gridSplitterHorizontalClass)) {
                    direction = GridSplitterDirection.Horizontal;
                } else {
                    if(this.rootElement.clientWidth > this.rootElement.clientHeight) {
                        direction = GridSplitterDirection.Vertical;
                    } else {
                        direction = GridSplitterDirection.Horizontal;
                    }
                }
                if(direction == GridSplitterDirection.Vertical) {
                    this._gridIndex = parseInt(this.rootElement.currentStyle.msGridRow, 10) - 1;
                    this._resizerDisplay.className += " " + GridSplitterControl._gridSplitterClass + "-Vertical";
                } else {
                    this._gridIndex = parseInt(this.rootElement.currentStyle.msGridColumn, 10) - 1;
                    this._resizerDisplay.className += " " + GridSplitterControl._gridSplitterClass + "-Horizontal";
                }
                return direction;
            };
            GridSplitterControl.prototype.getParentGridCSS = function () {
                if(this.direction === GridSplitterDirection.Vertical) {
                    return this.rootElement.parentElement.currentStyle.msGridRows;
                } else {
                    return this.rootElement.parentElement.currentStyle.msGridColumns;
                }
            };
            GridSplitterControl.prototype.calculateGridInfo = function () {
                this._gridCSS = this.getParentGridCSS();
                if(!this._gridCSS) {
                    throw new Error(Plugin.Resources.getErrorString("JSPerf.1019"));
                }
                this._gridCSSParts = this._gridCSS.split(" ");
                if(this._gridCSSParts.length >= this._gridIndex && this._gridIndex > 0) {
                    var previous = this._gridCSSParts[this._gridIndex - 1];
                    var current = this._gridCSSParts[this._gridIndex];
                    if(previous.indexOf("fr") === -1 || current.indexOf("fr") === -1) {
                        throw new Error(Plugin.Resources.getErrorString("JSPerf.1020"));
                    }
                    this._gridCSSTotal = (parseFloat(previous) + parseFloat(current));
                } else {
                    throw new Error(Plugin.Resources.getErrorString("JSPerf.1021"));
                }
            };
            GridSplitterControl.prototype.onMouseMove = function (e) {
                var mousePosition = (this.direction === GridSplitterDirection.Vertical ? e.pageY : e.pageX);
                var previous = this.rootElement.previousElementSibling;
                var next = this.rootElement.nextElementSibling;
                var min = 0;
                var max = 0;
                if(this.direction === GridSplitterDirection.Vertical) {
                    min = previous.offsetTop + this._minSize;
                    max = next.offsetTop + next.offsetHeight - this._minSize;
                } else {
                    min = previous.offsetLeft + this._minSize;
                    max = next.offsetLeft + next.offsetWidth - this._minSize;
                }
                if(!this._scrollableContainer) {
                    var scrollOffset = this._scrollableContainer.scrollTop;
                    min -= scrollOffset;
                    max -= scrollOffset;
                }
                var newPostion = mousePosition;
                if(mousePosition < min) {
                    newPostion = min;
                } else if(mousePosition > max) {
                    newPostion = max;
                }
                this._endPosition = newPostion;
                var displayPosition = newPostion - this._startPosition;
                if(this.direction === GridSplitterDirection.Vertical) {
                    this._resizerDisplay.style.top = displayPosition + "px";
                } else {
                    this._resizerDisplay.style.left = displayPosition + "px";
                }
                e.stopImmediatePropagation();
                e.preventDefault();
            };
            GridSplitterControl.prototype.onMouseUp = function (e) {
                this._resizerDisplay.style.display = "none";
                this.rootElement.style.removeProperty("background-color");
                document.body.style.cursor = this._previousCursor;
                var sizePrevious = 0;
                var sizeCurrent = 0;
                if(this.direction === GridSplitterDirection.Vertical) {
                    sizePrevious = this.rootElement.previousElementSibling.clientHeight;
                    sizeCurrent = this.rootElement.nextElementSibling.clientHeight;
                } else {
                    sizePrevious = this.rootElement.previousElementSibling.clientWidth;
                    sizeCurrent = this.rootElement.nextElementSibling.clientWidth;
                }
                var changeInPosition = (this._endPosition - this._startPosition);
                var ratioCurrent = (sizeCurrent - changeInPosition) / (sizePrevious + sizeCurrent);
                if(ratioCurrent > 0 && ratioCurrent < 1) {
                    var newSizePrevious = (1 - ratioCurrent) * this._gridCSSTotal;
                    var newSizeCurrent = ratioCurrent * this._gridCSSTotal;
                    var newGridCSS = "";
                    for(var i = 0; i < this._gridCSSParts.length; i++) {
                        if(i === this._gridIndex - 1) {
                            newGridCSS += newSizePrevious + "fr";
                        } else if(i === this._gridIndex) {
                            newGridCSS += newSizeCurrent + "fr";
                        } else {
                            newGridCSS += this._gridCSSParts[i];
                        }
                        if(i < this._gridCSSParts.length - 1) {
                            newGridCSS += " ";
                        }
                    }
                    if(this.direction === GridSplitterDirection.Vertical) {
                        this.rootElement.parentElement.style.msGridRows = newGridCSS;
                    } else {
                        this.rootElement.parentElement.style.msGridColumns = newGridCSS;
                    }
                    this._gridCSS = newGridCSS;
                    if(this._callback && typeof (this._callback) == "function") {
                        this._callback();
                    }
                }
                document.removeEventListener("mousemove", this._mouseMoveListener, true);
                document.removeEventListener("mouseup", this._mouseUpListener, true);
                e.stopImmediatePropagation();
                e.preventDefault();
            };
            GridSplitterControl.prototype.onMouseDown = function (e) {
                this.calculateGridInfo();
                this._previousCursor = document.body.style.cursor;
                document.body.style.cursor = this.rootElement.currentStyle.cursor;
                this._startPosition = (this.direction === GridSplitterDirection.Vertical ? e.pageY : e.pageX);
                this.rootElement.style.backgroundColor = "transparent";
                this._resizerDisplay.style.display = "block";
                this._resizerDisplay.style.top = "0";
                this._resizerDisplay.style.left = "0";
                this._mouseMoveListener = this.onMouseMove.bind(this);
                this._mouseUpListener = this.onMouseUp.bind(this);
                document.addEventListener("mousemove", this._mouseMoveListener, true);
                document.addEventListener("mouseup", this._mouseUpListener, true);
                e.stopImmediatePropagation();
                e.preventDefault();
            };
            return GridSplitterControl;
        })(Common.Controls.Control);
        Controls.GridSplitterControl = GridSplitterControl;        
    })(MemoryAnalyzer.Controls || (MemoryAnalyzer.Controls = {}));
    var Controls = MemoryAnalyzer.Controls;
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=gridSplitterControl.js.map

// tabControl.ts
var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    (function (Controls) {
        var TabControl = (function (_super) {
            __extends(TabControl, _super);
            function TabControl() {
                        _super.call(this);
                this._items = [];
                this.setTemplateFromHTML('<div class="tabControl">' + '   <div class="tabHeader">' + '       <div id="beforeBarContainer" class="beforeBarContainer"></div>' + '       <nav id="tabBarContainer" class="tabBarContainer">' + '        <ul class="tabBar"></ul>' + '       </nav>' + '       <div id="afterBarContainer" class="afterBarContainer"></div>' + '   </div>' + '   <div class="tabContentPane"></div>' + '</div>');
                this._barPanel = new Common.Controls.Control(this.rootElement.getElementsByClassName("tabBar")[0]);
                this._contentPane = new Common.Controls.Control(this.rootElement.getElementsByClassName("tabContentPane")[0]);
                this.beforeBarContainer = new Common.Controls.Control(this.rootElement.getElementsByClassName("beforeBarContainer")[0]);
                this.afterBarContainer = new Common.Controls.Control(this.rootElement.getElementsByClassName("afterBarContainer")[0]);
                this._tabBarContainer = this.findElement("tabBarContainer");
            }
            Object.defineProperty(TabControl.prototype, "tabsLeftAligned", {
                get: function () {
                    return this._tabBarContainer.classList.contains("tabBarContainerLeftAlign");
                },
                set: function (v) {
                    if(v) {
                        this._tabBarContainer.classList.add("tabBarContainerLeftAlign");
                    } else {
                        this._tabBarContainer.classList.remove("tabBarContainerLeftAlign");
                    }
                },
                enumerable: true,
                configurable: true
            });
            TabControl.prototype.addTab = function (tabItem) {
                this._items.push(tabItem);
                tabItem.ownerTabControl = this;
                this._barPanel.appendChild(tabItem.header);
                this._contentPane.appendChild(tabItem);
                if(!this._selectedItem) {
                    this.selectedItem = tabItem;
                }
            };
            TabControl.prototype.removeTab = function (tabItem) {
                var indexOfItem = this._items.indexOf(tabItem);
                if(indexOfItem < 0) {
                    return;
                }
                if(this.selectedItem === tabItem) {
                    this.selectedItem = null;
                }
                this._items.splice(indexOfItem, 1);
                var newSelectedItemIndex = Math.min(this._items.length - 1, indexOfItem);
                if(newSelectedItemIndex >= 0) {
                    this.selectedItem = this._items[newSelectedItemIndex];
                }
                this._barPanel.removeChild(tabItem.header);
                this._contentPane.removeChild(tabItem);
                tabItem.ownerTabControl = null;
            };
            TabControl.prototype.containsTab = function (tabItem) {
                return this._items.indexOf(tabItem) >= 0;
            };
            TabControl.prototype.getTab = function (index) {
                return this._items[index];
            };
            TabControl.prototype.length = function () {
                return this._items.length;
            };
            Object.defineProperty(TabControl.prototype, "selectedItem", {
                get: function () {
                    return this._selectedItem;
                },
                set: function (tabItem) {
                    if(this._selectedItem !== tabItem) {
                        if(!this.containsTab(tabItem)) {
                            return;
                        }
                        if(this._selectedItem) {
                            this._selectedItem.active = false;
                        }
                        this._selectedItem = tabItem;
                        if(this._selectedItem) {
                            this._selectedItem.active = true;
                        }
                        if(this.selectedItemChanged) {
                            this.selectedItemChanged();
                        }
                    }
                },
                enumerable: true,
                configurable: true
            });
            TabControl.prototype.onTabItemSelected = function (item) {
                this.selectedItem = item;
            };
            return TabControl;
        })(Common.Controls.TemplateControl);
        Controls.TabControl = TabControl;        
    })(MemoryAnalyzer.Controls || (MemoryAnalyzer.Controls = {}));
    var Controls = MemoryAnalyzer.Controls;
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=tabControl.js.map

// tabItem.ts
var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    (function (Controls) {
        var TabItem = (function (_super) {
            __extends(TabItem, _super);
            function TabItem() {
                        _super.call(this);
                this.header = new Common.Controls.Control(document.createElement("li"));
                this.header.rootElement.onclick = this.onHeaderClicked.bind(this);
                this.header.rootElement.setAttribute("tabindex", "2");
                this.header.rootElement.addEventListener("keydown", this.onKeyDown.bind(this));
                this.rootElement.className = "tabItemContent";
            }
            Object.defineProperty(TabItem.prototype, "ownerTabControl", {
                get: function () {
                    return this._ownerTabControl;
                },
                set: function (v) {
                    if(this._ownerTabControl !== v) {
                        if(this._ownerTabControl && v) {
                            throw new Error(Plugin.Resources.getErrorString("JSPerf.1022"));
                        }
                        this._ownerTabControl = v;
                    }
                },
                enumerable: true,
                configurable: true
            });
            Object.defineProperty(TabItem.prototype, "active", {
                get: function () {
                    return this._active;
                },
                set: function (v) {
                    if(this._active !== v) {
                        this._active = v;
                        this.header.rootElement.classList.toggle("active");
                        this.rootElement.classList.toggle("active");
                        this.onActiveChanged();
                    }
                },
                enumerable: true,
                configurable: true
            });
            Object.defineProperty(TabItem.prototype, "title", {
                get: function () {
                    return this.header.rootElement.innerText;
                },
                set: function (v) {
                    this.header.rootElement.innerText = v;
                },
                enumerable: true,
                configurable: true
            });
            Object.defineProperty(TabItem.prototype, "tooltipString", {
                get: function () {
                    return this.header.rootElement.getAttribute("data-plugin-vs-tooltip");
                },
                set: function (v) {
                    var tooltip = {
                        content: v
                    };
                    this.header.rootElement.setAttribute("data-plugin-vs-tooltip", JSON.stringify(tooltip));
                },
                enumerable: true,
                configurable: true
            });
            TabItem.prototype.onActiveChanged = function () {
            };
            TabItem.prototype.onHeaderClicked = function () {
                if(this.ownerTabControl) {
                    this.ownerTabControl.selectedItem = this;
                }
                MemoryAnalyzer.Program.onIdle();
            };
            TabItem.prototype.onKeyDown = function (e) {
                if(e.keyCode === Common.KeyCodes.ENTER || e.keyCode === Common.KeyCodes.SPACE) {
                    this.onHeaderClicked();
                }
            };
            return TabItem;
        })(Controls.ContentControl);
        Controls.TabItem = TabItem;        
    })(MemoryAnalyzer.Controls || (MemoryAnalyzer.Controls = {}));
    var Controls = MemoryAnalyzer.Controls;
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=tabItem.js.map

// menuControl.ts
var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    (function (Controls) {
        var MenuItem = (function () {
            function MenuItem(itemText, ownerControl, canToggle, initialState) {
                if (typeof canToggle === "undefined") { canToggle = false; }
                if (typeof initialState === "undefined") { initialState = false; }
                this.element = document.createElement("li");
                if(canToggle) {
                    this._toggleIcon = document.createElement("img");
                    this.element.appendChild(this._toggleIcon);
                    this._toggleIcon.className = "menuToggleIcon";
                    this._toggleIcon.src = Plugin.Theme.getValue("image-checkmark");
                    this.toggled = initialState;
                    this.element.addEventListener("DOMAttrModified", this.onAriaCheckedModified.bind(this));
                }
                var span = document.createElement("span");
                this.element.appendChild(span);
                span.innerText = itemText;
            }
            Object.defineProperty(MenuItem.prototype, "toggled", {
                get: function () {
                    return this._toggled;
                },
                set: function (v) {
                    this._toggled = v;
                    if(this._toggled) {
                        this._toggleIcon.classList.remove("hiddenCheckMark");
                        this.element.setAttribute("aria-checked", "true");
                    } else {
                        this._toggleIcon.classList.add("hiddenCheckMark");
                        this.element.setAttribute("aria-checked", "false");
                    }
                },
                enumerable: true,
                configurable: true
            });
            MenuItem.prototype.onAriaCheckedModified = function (event) {
                if(event.attrName === "aria-checked") {
                    var checked = event.newValue === "true";
                    if(this.toggled !== checked) {
                        this.toggled = checked;
                    }
                }
            };
            return MenuItem;
        })();
        Controls.MenuItem = MenuItem;        
        var MenuControl = (function (_super) {
            __extends(MenuControl, _super);
            function MenuControl(target) {
                var _this = this;
                        _super.call(this);
                this._target = target;
                this._isVisible = false;
                this.setTemplateFromHTML("<ul id=\"menuControl\" class=\"menuControl\" role=\"menu\"></ul>");
                this._listElement = this.findElement("menuControl");
                this._listElement.setAttribute("aria-hidden", "true");
                this._closeMenuFunction = this.closeMenu.bind(this);
                document.body.addEventListener("keydown", function (e) {
                    if(e.keyCode === Common.KeyCodes.ESCAPE) {
                        _this.closeMenu();
                    }
                });
                target.onclick = this.showMenu.bind(this);
                target.onkeydown = function (e) {
                    if(e.keyCode === Common.KeyCodes.ENTER || e.keyCode === Common.KeyCodes.SPACE) {
                        if(!_this._isVisible) {
                            _this.showMenu();
                        } else {
                            _this.closeMenu();
                        }
                    }
                };
                target.appendChild(this._listElement);
                target.setAttribute("role", "button");
                target.setAttribute("aria-haspopup", "true");
                target.setAttribute("aria-owns", this._listElement.id.toString());
                target.addEventListener("keydown", function (e) {
                    if((e.keyCode === Common.KeyCodes.ARROW_DOWN) && (_this._isVisible)) {
                        (_this._listElement.firstElementChild).focus();
                    }
                });
            }
            MenuControl.prototype.addToggleItem = function (itemText, itemCallback, initialState, tabIndex) {
                if (typeof initialState === "undefined") { initialState = false; }
                if (typeof tabIndex === "undefined") { tabIndex = 0; }
                var menuItem = new MenuItem(itemText, this, true, initialState);
                this._listElement.appendChild(menuItem.element);
                menuItem.element.tabIndex = tabIndex;
                menuItem.element.setAttribute("role", "menuitemcheckbox");
                menuItem.element.onclick = (function (e) {
                    menuItem.toggled = itemCallback(e);
                    e.stopImmediatePropagation();
                });
                menuItem.element.onkeydown = function (e) {
                    if(e.keyCode === Common.KeyCodes.ENTER || e.keyCode === Common.KeyCodes.SPACE) {
                        menuItem.toggled = itemCallback(e);
                        e.stopImmediatePropagation();
                    } else if(e.keyCode === Common.KeyCodes.ARROW_UP) {
                        if(menuItem.element.previousElementSibling) {
                            (menuItem.element.previousElementSibling).focus();
                        }
                        e.stopImmediatePropagation();
                    } else if(e.keyCode === Common.KeyCodes.ARROW_DOWN) {
                        if(menuItem.element.nextElementSibling) {
                            (menuItem.element.nextElementSibling).focus();
                        }
                        e.stopImmediatePropagation();
                    }
                };
                this._target.disabled = false;
            };
            MenuControl.totalOffsetLeft = function totalOffsetLeft(elem) {
                var offsetLeft = 0;
                do {
                    if(!isNaN(elem.offsetLeft)) {
                        offsetLeft += elem.offsetLeft;
                    }
                }while(elem = elem.offsetParent);
                return offsetLeft;
            };
            MenuControl.totalOffsetTop = function totalOffsetTop(elem) {
                var offsetTop = 0;
                do {
                    if(!isNaN(elem.offsetTop)) {
                        offsetTop += elem.offsetTop;
                    }
                }while(elem = elem.offsetParent);
                return offsetTop;
            };
            MenuControl.prototype.showMenu = function (e) {
                var _this = this;
                if(!this._isVisible) {
                    this._listElement.style.display = "block";
                    this._listElement.setAttribute("aria-hidden", "false");
                    this.setMenuPosition();
                    this._target.classList.add("menuControlActive");
                    window.setImmediate(function () {
                        document.body.addEventListener("click", _this._closeMenuFunction);
                        window.addEventListener("resize", _this._closeMenuFunction);
                    });
                    this._isVisible = true;
                }
            };
            MenuControl.prototype.closeMenu = function () {
                if(this._isVisible) {
                    this._listElement.style.display = "none";
                    this._listElement.setAttribute("aria-hidden", "true");
                    this._target.classList.remove("menuControlActive");
                    document.body.removeEventListener("click", this._closeMenuFunction);
                    window.removeEventListener("resize", this._closeMenuFunction);
                    this._isVisible = false;
                }
            };
            MenuControl.prototype.setMenuPosition = function () {
                this._listElement.style.left = "0px";
                this._listElement.style.top = "0px";
                var targetTotalOffsetLeft = MenuControl.totalOffsetLeft(this._target);
                var targetTotalOffsetTop = MenuControl.totalOffsetTop(this._target);
                var listElementZeroOffsetLeft = MenuControl.totalOffsetLeft(this._listElement);
                var listElementZeroOffsetTop = MenuControl.totalOffsetTop(this._listElement);
                var left = targetTotalOffsetLeft;
                var right = left + this._listElement.offsetWidth;
                if(right > window.innerWidth) {
                    var newRight = targetTotalOffsetLeft + this._target.offsetWidth;
                    var newLeft = newRight - this._listElement.offsetWidth;
                    if(newLeft >= 0) {
                        left = newLeft;
                        right = newRight;
                    }
                }
                this._listElement.style.left = left - listElementZeroOffsetLeft + "px";
                var top = targetTotalOffsetTop + this._target.offsetHeight;
                var bottom = top + this._listElement.offsetHeight;
                if(bottom > window.innerHeight) {
                    var newBottom = targetTotalOffsetTop;
                    var newTop = bottom - this._listElement.offsetHeight;
                    if(newTop >= 0) {
                        top = newTop;
                        bottom = newBottom;
                    }
                }
                this._listElement.style.top = top - listElementZeroOffsetTop + "px";
            };
            return MenuControl;
        })(Common.Controls.TemplateControl);
        Controls.MenuControl = MenuControl;        
    })(MemoryAnalyzer.Controls || (MemoryAnalyzer.Controls = {}));
    var Controls = MemoryAnalyzer.Controls;
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=menuControl.js.map

// internalFeedback.ts
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    (function (Extensions) {
        "use strict";
        var InternalFeedbackProxy = (function () {
            function InternalFeedbackProxy() {
                this._proxy = Plugin.Utilities.JSONMarshaler.attachToPublishedObject("Microsoft.VisualStudio.WebClient.Diagnostics.PerformanceToolHost.Package.Extensions.InternalFeedback", {
                }, true);
            }
            InternalFeedbackProxy.instance = new InternalFeedbackProxy();
            InternalFeedbackProxy.prototype.isEnabled = function () {
                return this._proxy._call("isEnabled");
            };
            InternalFeedbackProxy.prototype.sendData = function (showDialog, titleText, feedbackText, viewName, trace, sessionFilePath) {
                return this._proxy._call("sendData", showDialog, titleText, feedbackText, viewName, trace, sessionFilePath);
            };
            return InternalFeedbackProxy;
        })();
        Extensions.InternalFeedbackProxy = InternalFeedbackProxy;        
        var NoOperationInternalFeedback = (function () {
            function NoOperationInternalFeedback() { }
            NoOperationInternalFeedback.prototype.isEnabled = function () {
                return Plugin.Promise.as(false);
            };
            NoOperationInternalFeedback.prototype.sendData = function (showDialog, titleText, feedbackText, viewName, trace, sessionFilePath) {
                return Plugin.Promise.as(null);
            };
            return NoOperationInternalFeedback;
        })();
        Extensions.NoOperationInternalFeedback = NoOperationInternalFeedback;        
    })(MemoryAnalyzer.Extensions || (MemoryAnalyzer.Extensions = {}));
    var Extensions = MemoryAnalyzer.Extensions;
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=internalFeedback.js.map

// session.ts
var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    (function (Extensions) {
        "use strict";
        (function (SessionType) {
            SessionType._map = [];
            SessionType.session = 0;
            SessionType.snapshot = 1;
            SessionType.snapshotDiff = 2;
        })(Extensions.SessionType || (Extensions.SessionType = {}));
        var SessionType = Extensions.SessionType;
        var Session = (function () {
            function Session() {
                this._snapshotId = 1;
            }
            Session.prototype.getNewSnapshotRelativePath = function () {
                return "snapshot" + (this._snapshotId++) + ".snapjs";
            };
            return Session;
        })();
        Extensions.Session = Session;        
        var HostSessionProxy = (function (_super) {
            __extends(HostSessionProxy, _super);
            function HostSessionProxy() {
                        _super.call(this);
                this._sessionProxy = Plugin.Utilities.JSONMarshaler.attachToPublishedObject("Microsoft.VisualStudio.WebClient.Diagnostics.PerformanceToolHost.Package.Extensions.Session", {
                }, true);
            }
            HostSessionProxy.prototype.addViewTypeEventListener = function (callback) {
                this._sessionProxy.addEventListener("viewtypechange", callback);
            };
            HostSessionProxy.prototype.getSessionInfo = function () {
                return this._sessionProxy._call("getSessionInfo");
            };
            HostSessionProxy.prototype.openSnapshotDetails = function (relativePath, targetView, tabName, sortProperty) {
                return this._sessionProxy._call("openSnapshotDetails", relativePath, targetView, tabName, sortProperty);
            };
            HostSessionProxy.prototype.openSnapshotDiff = function (relativePaths, targetView, tabName, sortProperty) {
                return this._sessionProxy._call("openSnapshotDiff", relativePaths, targetView, tabName, sortProperty);
            };
            HostSessionProxy.prototype.save = function (addToProject) {
                return this._sessionProxy._call("save", addToProject);
            };
            return HostSessionProxy;
        })(Session);
        Extensions.HostSessionProxy = HostSessionProxy;        
        var LocalSession = (function (_super) {
            __extends(LocalSession, _super);
            function LocalSession() {
                        _super.call(this);
                this._sessionInfo = {
                    filePaths: [],
                    isOffline: false,
                    sessionType: SessionType.session,
                    sortProperty: "",
                    storageId: LocalSession.getUniqueStorageId(),
                    targetView: ""
                };
            }
            LocalSession.prototype.addViewTypeEventListener = function (callback) {
            };
            LocalSession.prototype.getSessionInfo = function () {
                return Plugin.Promise.as(this._sessionInfo);
            };
            LocalSession.prototype.openSnapshotDetails = function (relativePath, targetView, tabName, sortProperty) {
                var _this = this;
                return new Plugin.Promise(function (completed, error) {
                    completed({
                        filePaths: [
                            relativePath
                        ],
                        isOffline: true,
                        sessionType: SessionType.snapshot,
                        sortProperty: sortProperty,
                        storageId: _this._sessionInfo.storageId,
                        targetView: targetView
                    });
                });
            };
            LocalSession.prototype.openSnapshotDiff = function (relativePaths, targetView, tabName, sortProperty) {
                var _this = this;
                return new Plugin.Promise(function (completed, error) {
                    completed({
                        filePaths: relativePaths,
                        isOffline: true,
                        sessionType: SessionType.snapshotDiff,
                        sortProperty: sortProperty,
                        storageId: _this._sessionInfo.storageId,
                        targetView: targetView
                    });
                });
            };
            LocalSession.prototype.save = function (addToProject) {
                return new Plugin.Promise(function (completed, error) {
                });
            };
            LocalSession.getUniqueStorageId = function getUniqueStorageId() {
                return Math.floor(Math.random() * 2821109907455).toString(36) + "." + Math.floor(Math.random() * 46655).toString(36);
            };
            return LocalSession;
        })(Session);
        Extensions.LocalSession = LocalSession;        
    })(MemoryAnalyzer.Extensions || (MemoryAnalyzer.Extensions = {}));
    var Extensions = MemoryAnalyzer.Extensions;
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=session.js.map

// userSettings.ts
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    (function (Extensions) {
        "use strict";
        var UserSettingsProxy = (function () {
            function UserSettingsProxy() { }
            UserSettingsProxy.prototype.getUserSettings = function () {
                return new Plugin.Promise(function (completed) {
                    Plugin.Settings.get("JavaScriptPerfTools").done(function (result) {
                        completed(result);
                    }, function (error) {
                        completed({
                        });
                    });
                }, null);
            };
            return UserSettingsProxy;
        })();
        Extensions.UserSettingsProxy = UserSettingsProxy;        
    })(MemoryAnalyzer.Extensions || (MemoryAnalyzer.Extensions = {}));
    var Extensions = MemoryAnalyzer.Extensions;
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=userSettings.js.map

// errorFormatter.ts
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    var ErrorFormatter = (function () {
        function ErrorFormatter() { }
        ErrorFormatter.format = function format(error) {
            if(MemoryAnalyzer.Program.userSettings.showDetailedErrors) {
                var message = "Error description:  " + (error.message || (error).description);
                if((error).number) {
                    message += "\r\nError number:  " + (error).number;
                }
                if((error).stack) {
                    message += "\r\nError stack:  " + (error).stack;
                }
                return message;
            } else {
                return (error.message || (error).description);
            }
        };
        return ErrorFormatter;
    })();
    MemoryAnalyzer.ErrorFormatter = ErrorFormatter;    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=errorFormatter.js.map

// formattingHelpers.ts
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    var FormattingHelpers = (function () {
        function FormattingHelpers() { }
        FormattingHelpers.getPrettyPrintSize = function getPrettyPrintSize(bytes) {
            var size = 0;
            var unitAbbreviation;
            if(Math.abs(bytes) > (1024 * 1024 * 1024)) {
                size = bytes / (1024 * 1024 * 1024);
                unitAbbreviation = Plugin.Resources.getString("GigabyteUnits");
            } else if(Math.abs(bytes) > (1024 * 1024)) {
                size = bytes / (1024 * 1024);
                unitAbbreviation = Plugin.Resources.getString("MegabyteUnits");
            } else if(Math.abs(bytes) > 1024) {
                size = bytes / 1024;
                unitAbbreviation = Plugin.Resources.getString("KilobyteUnits");
            } else {
                size = bytes;
                unitAbbreviation = Plugin.Resources.getString("ByteUnits");
            }
            return FormattingHelpers.getDecimalLocaleString(parseFloat(size.toFixed(2)), true) + " " + unitAbbreviation;
        };
        FormattingHelpers.zeroPad = function zeroPad(stringToPad, newLength, padLeft) {
            for(var i = stringToPad.length; i < newLength; i++) {
                stringToPad = (padLeft ? ("0" + stringToPad) : (stringToPad + "0"));
            }
            return stringToPad;
        };
        FormattingHelpers.getDecimalLocaleString = function getDecimalLocaleString(numberToConvert, includeGroupSeparators) {
            if(numberToConvert < 0) {
                numberToConvert = numberToConvert * -1;
            }
            var numberString = numberToConvert.toString();
            var split = numberString.split(/e/i);
            numberString = split[0];
            var exponent = (split.length > 1 ? parseInt(split[1], 10) : 0);
            split = numberString.split('.');
            numberString = split[0];
            var right = split.length > 1 ? split[1] : "";
            if(exponent > 0) {
                right = FormattingHelpers.zeroPad(right, exponent, false);
                numberString += right.slice(0, exponent);
                right = right.substr(exponent);
            } else if(exponent < 0) {
                exponent = -exponent;
                numberString = FormattingHelpers.zeroPad(numberString, exponent + 1, true);
                right = numberString.slice(-exponent, numberString.length) + right;
                numberString = numberString.slice(0, -exponent);
            }
            var nf = Plugin.Culture.NumberFormat;
            if(!nf) {
                nf = {
                    numberDecimalSeparator: ".",
                    numberGroupSizes: [
                        3
                    ],
                    numberGroupSeparator: ","
                };
            }
            if(right.length > 0) {
                right = nf.numberDecimalSeparator + right;
            }
            if(includeGroupSeparators === true) {
                var groupSizes = nf.numberGroupSizes, sep = nf.numberGroupSeparator, curSize = groupSizes[0], curGroupIndex = 1, stringIndex = numberString.length - 1, ret = "";
                while(stringIndex >= 0) {
                    if(curSize === 0 || curSize > stringIndex) {
                        if(ret.length > 0) {
                            return numberString.slice(0, stringIndex + 1) + sep + ret + right;
                        } else {
                            return numberString.slice(0, stringIndex + 1) + right;
                        }
                    }
                    if(ret.length > 0) {
                        ret = numberString.slice(stringIndex - curSize + 1, stringIndex + 1) + sep + ret;
                    } else {
                        ret = numberString.slice(stringIndex - curSize + 1, stringIndex + 1);
                    }
                    stringIndex -= curSize;
                    if(curGroupIndex < groupSizes.length) {
                        curSize = groupSizes[curGroupIndex];
                        curGroupIndex++;
                    }
                }
                return numberString.slice(0, stringIndex + 1) + sep + ret + right;
            } else {
                return numberString + right;
            }
        };
        return FormattingHelpers;
    })();
    MemoryAnalyzer.FormattingHelpers = FormattingHelpers;    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=formattingHelpers.js.map

// heapObject.ts
var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    (function (ExternalObjectKind) {
        ExternalObjectKind._map = [];
        ExternalObjectKind.Default = 1;
        ExternalObjectKind.Unknown = 2;
        ExternalObjectKind.Dispatch = 3;
    })(MemoryAnalyzer.ExternalObjectKind || (MemoryAnalyzer.ExternalObjectKind = {}));
    var ExternalObjectKind = MemoryAnalyzer.ExternalObjectKind;
    (function (WinRTObjectKind) {
        WinRTObjectKind._map = [];
        WinRTObjectKind.Instance = 1;
        WinRTObjectKind.RuntimeClass = 2;
        WinRTObjectKind.Delegate = 3;
        WinRTObjectKind.Namespace = 4;
    })(MemoryAnalyzer.WinRTObjectKind || (MemoryAnalyzer.WinRTObjectKind = {}));
    var WinRTObjectKind = MemoryAnalyzer.WinRTObjectKind;
    (function (HeapObjectFlags) {
        HeapObjectFlags._map = [];
        HeapObjectFlags.ExternalOffset = 0;
        HeapObjectFlags.ExternalMask = 7;
        HeapObjectFlags.WinRtOffset = 3;
        HeapObjectFlags.WinRtMask = 7;
        HeapObjectFlags.IsNew = 1 << 6;
        HeapObjectFlags.IsRoot = 1 << 7;
        HeapObjectFlags.IsSiteClosed = 1 << 8;
        HeapObjectFlags.IsBuiltIn = 1 << 9;
        HeapObjectFlags.IsMarkup = 1 << 10;
        HeapObjectFlags.IsSizeApproximate = 1 << 11;
        HeapObjectFlags.IsChanged = 1 << 12;
        HeapObjectFlags.IsDetachedDomNode = 1 << 13;
        HeapObjectFlags.IsWinJsDisposable = 1 << 14;
        HeapObjectFlags.IsAdded = 1 << 15;
        HeapObjectFlags.IsBaseline = 1 << 16;
    })(MemoryAnalyzer.HeapObjectFlags || (MemoryAnalyzer.HeapObjectFlags = {}));
    var HeapObjectFlags = MemoryAnalyzer.HeapObjectFlags;
    var MaskOperations = (function () {
        function MaskOperations() { }
        MaskOperations.getValue = function getValue(input, offset, mask) {
            return (input >> offset) & mask;
        };
        MaskOperations.setValue = function setValue(input, newValue, offset, mask) {
            return (~(mask << offset) & input) | ((newValue & mask) << offset);
        };
        MaskOperations.isFlagSet = function isFlagSet(input, flag) {
            return (input & flag) !== 0 ? true : false;
        };
        MaskOperations.setFlag = function setFlag(input, newValue, flag) {
            return newValue ? (input | flag) : (input & (~flag));
        };
        return MaskOperations;
    })();
    MemoryAnalyzer.MaskOperations = MaskOperations;    
    var NamedHeapObject = (function () {
        function NamedHeapObject(node, displayObjectIDs) {
            this._innerObj = node.object;
            this._hasChildren = node.hasChildren;
            this.name = this.initName(node.name, displayObjectIDs);
            if(this.isAdded) {
                this._diffOperation = Plugin.Resources.getString("DiffColumnOperationAdded");
            } else if(this.isChanged) {
                this._diffOperation = Plugin.Resources.getString("DiffColumnOperationModified");
            } else {
                this._diffOperation = Plugin.Resources.getString("DiffColumnOperationUnchanged");
                if(this.isBaseline) {
                    this._diffOperation += " (" + Plugin.Resources.getString("Baseline") + ")";
                }
            }
        }
        Object.defineProperty(NamedHeapObject.prototype, "id", {
            get: function () {
                return this.objectId;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "flags", {
            get: function () {
                return this._innerObj.flags;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "kind", {
            get: function () {
                return this._innerObj.kind;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "objectId", {
            get: function () {
                return this._innerObj.objectId;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "retainedSize", {
            get: function () {
                return this._innerObj.retainedSize;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "size", {
            get: function () {
                return this._innerObj.size;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "type", {
            get: function () {
                return this._innerObj.type;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "value", {
            get: function () {
                return this._innerObj.value;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "diffOperation", {
            get: function () {
                return this._diffOperation;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "sizeDiff", {
            get: function () {
                return this._innerObj.sizeDiff;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "retainedSizeDiff", {
            get: function () {
                return this._innerObj.retainedSizeDiff;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "hasChildren", {
            get: function () {
                return this._hasChildren;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "isDetachedDomNode", {
            get: function () {
                var val = MaskOperations.isFlagSet(this._innerObj.flags, HeapObjectFlags.IsDetachedDomNode);
                return val;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "isSizeApproximate", {
            get: function () {
                var val = MaskOperations.isFlagSet(this._innerObj.flags, HeapObjectFlags.IsSizeApproximate);
                return val;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "isNew", {
            get: function () {
                var val = MaskOperations.isFlagSet(this._innerObj.flags, HeapObjectFlags.IsNew);
                return val;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "isRoot", {
            get: function () {
                var val = MaskOperations.isFlagSet(this._innerObj.flags, HeapObjectFlags.IsRoot);
                return val;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "isSiteClosed", {
            get: function () {
                var val = MaskOperations.isFlagSet(this._innerObj.flags, HeapObjectFlags.IsSiteClosed);
                return val;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "isBuiltIn", {
            get: function () {
                var val = MaskOperations.isFlagSet(this._innerObj.flags, HeapObjectFlags.IsBuiltIn);
                return val;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "external", {
            get: function () {
                var val = MaskOperations.getValue(this._innerObj.flags, HeapObjectFlags.ExternalOffset, HeapObjectFlags.ExternalMask);
                return val;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "winrt", {
            get: function () {
                var val = MaskOperations.getValue(this._innerObj.flags, HeapObjectFlags.WinRtOffset, HeapObjectFlags.WinRtMask);
                return val;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "isMarkup", {
            get: function () {
                var val = MaskOperations.isFlagSet(this._innerObj.flags, HeapObjectFlags.IsMarkup);
                return val;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "isAdded", {
            get: function () {
                var val = MaskOperations.isFlagSet(this._innerObj.flags, HeapObjectFlags.IsAdded);
                return val;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "isBaseline", {
            get: function () {
                var val = MaskOperations.isFlagSet(this._innerObj.flags, HeapObjectFlags.IsBaseline);
                return val;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "isChanged", {
            get: function () {
                var val = MaskOperations.isFlagSet(this._innerObj.flags, HeapObjectFlags.IsChanged);
                return val;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NamedHeapObject.prototype, "isWinJsDisposable", {
            get: function () {
                var val = MaskOperations.isFlagSet(this._innerObj.flags, HeapObjectFlags.IsWinJsDisposable);
                return val;
            },
            enumerable: true,
            configurable: true
        });
        NamedHeapObject.prototype.initName = function (nameOverride, displayObjectIDs) {
            var name = "";
            if(typeof nameOverride !== "undefined") {
                name += nameOverride;
            }
            if(this.winrt) {
                switch(this.winrt) {
                    case 2:
                        name += "{Runtime Class} ";
                        break;
                    case 3:
                        name += "{Delegate} ";
                        break;
                    case 4:
                        name += "{Namespace} ";
                        break;
                }
            }
            if(this.external) {
                if(name) {
                    name += ": ";
                } else {
                    name = "";
                }
                var externalPostfix = "External";
                switch(this.external) {
                    case 2:
                        externalPostfix += " IUnknown";
                        break;
                    case 3:
                        externalPostfix += " IDispatch";
                        break;
                }
                name += externalPostfix;
            }
            if(typeof this.value !== "undefined") {
                if(name) {
                    name += " = ";
                } else {
                    name = "";
                }
                var isString = typeof (this.value) === "string";
                if(isString) {
                    name += "\"";
                }
                name += this.value;
                if(isString) {
                    name += "\"";
                }
            }
            if(name === "" && this.type) {
                name += "(" + this.type + ") ";
            }
            if(displayObjectIDs && this.objectId) {
                name += " @" + this.objectId;
            }
            return name;
        };
        return NamedHeapObject;
    })();
    MemoryAnalyzer.NamedHeapObject = NamedHeapObject;    
    var ReferenceDataObject = (function (_super) {
        __extends(ReferenceDataObject, _super);
        function ReferenceDataObject(innerObj, displayObjectIDs, parentObjectId, nodeId) {
            if (typeof nodeId === "undefined") { nodeId = 0; }
                _super.call(this, innerObj, displayObjectIDs);
            this.nodeId = nodeId;
            this.parentObjectId = parentObjectId;
        }
        return ReferenceDataObject;
    })(NamedHeapObject);
    MemoryAnalyzer.ReferenceDataObject = ReferenceDataObject;    
    var TypeDataObject = (function () {
        function TypeDataObject(objectHeapType) {
            this.objectHeapType = objectHeapType;
            this._name = this.objectHeapType.type;
            if(this.isAdded) {
                this._diffOperation = Plugin.Resources.getString("DiffColumnOperationAdded");
            } else if(this.isChanged) {
                this._diffOperation = Plugin.Resources.getString("DiffColumnOperationModified");
            }
        }
        Object.defineProperty(TypeDataObject.prototype, "isAdded", {
            get: function () {
                return false;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(TypeDataObject.prototype, "isBaseline", {
            get: function () {
                return false;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(TypeDataObject.prototype, "isChanged", {
            get: function () {
                return this.objectHeapType.hasModifiedChildren;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(TypeDataObject.prototype, "id", {
            get: function () {
                return this.objectHeapType.type;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(TypeDataObject.prototype, "isDetachedDomNode", {
            get: function () {
                return false;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(TypeDataObject.prototype, "name", {
            get: function () {
                return this._name;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(TypeDataObject.prototype, "retainedSize", {
            get: function () {
                return 0;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(TypeDataObject.prototype, "size", {
            get: function () {
                return this.objectHeapType.size;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(TypeDataObject.prototype, "isSizeApproximate", {
            get: function () {
                return false;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(TypeDataObject.prototype, "isNew", {
            get: function () {
                return true;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(TypeDataObject.prototype, "type", {
            get: function () {
                return this.objectHeapType.type;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(TypeDataObject.prototype, "isBuiltIn", {
            get: function () {
                return false;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(TypeDataObject.prototype, "childrenCount", {
            get: function () {
                return this.objectHeapType.childrenCount;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(TypeDataObject.prototype, "childrenCountDiff", {
            get: function () {
                return this.objectHeapType.childrenCountDiff;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(TypeDataObject.prototype, "hasChildren", {
            get: function () {
                return this.objectHeapType.childrenCount > 0;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(TypeDataObject.prototype, "diffOperation", {
            get: function () {
                return this._diffOperation;
            },
            enumerable: true,
            configurable: true
        });
        return TypeDataObject;
    })();
    MemoryAnalyzer.TypeDataObject = TypeDataObject;    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=heapObject.js.map

// snapshot.ts
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    var Snapshot = (function () {
        function Snapshot(snapshotData, isDiff) {
            this._snapshotData = snapshotData;
            this._isDiff = isDiff;
        }
        Object.defineProperty(Snapshot.prototype, "isDiff", {
            get: function () {
                return this._isDiff;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(Snapshot.prototype, "hasDetachedDomNodes", {
            get: function () {
                return this._snapshotData.hasDetachedDomNodes();
            },
            enumerable: true,
            configurable: true
        });
        Snapshot.prototype.getAllObjects = function (filter, sorter, startIndex, maxResult) {
            if (typeof startIndex === "undefined") { startIndex = 0; }
            if (typeof maxResult === "undefined") { maxResult = -1; }
            return this._snapshotData.getDominators(startIndex, maxResult, filter.filterString, filter).then(function (dataSet) {
                var objNodes = dataSet.result;
                var ret = [];
                for(var i = 0; i < objNodes.length; i++) {
                    var objNode = objNodes[i];
                    var namedHeapObject = new MemoryAnalyzer.NamedHeapObject(objNode, filter.displayObjectIDs);
                    ret.push(namedHeapObject);
                }
                ret.sort(sorter.sortComparer);
                return {
                    items: ret,
                    totalCount: dataSet.totalCount
                };
            });
        };
        Snapshot.prototype.getAllRootObjects = function (filter, sorter) {
            var dataSet = this._snapshotData.getRootObjects(filter);
            var objNodes = dataSet.result;
            var ret = [];
            for(var i = 0; i < objNodes.length; i++) {
                var objNode = objNodes[i];
                var namedHeapObject = new MemoryAnalyzer.NamedHeapObject(objNode, filter.displayObjectIDs);
                ret.push(namedHeapObject);
            }
            ret.sort(sorter.sortComparer);
            return {
                items: ret,
                totalCount: dataSet.totalCount
            };
        };
        Snapshot.prototype.getAllTypes = function (filter, sorter) {
            return this._snapshotData.getTypes(filter.filterString, (filter)).then(function (types) {
                var ret = [];
                for(var i = 0; i < types.length; i++) {
                    var typeNode = types[i];
                    var typeDataObject = new MemoryAnalyzer.TypeDataObject(typeNode);
                    ret.push(typeDataObject);
                }
                ret.sort(sorter.sortComparer);
                return {
                    items: ret,
                    totalCount: ret.length
                };
            });
        };
        Snapshot.prototype.getAllChildrenForObjectOrType = function (id, filter, sorter, startIndex, maxResult) {
            if (typeof startIndex === "undefined") { startIndex = 0; }
            if (typeof maxResult === "undefined") { maxResult = -1; }
            var objectId = parseInt(id);
            if(!isNaN(objectId)) {
                return this.getAllChildrenForObject(objectId, filter, sorter, startIndex, maxResult);
            } else {
                return this.getAllObjectsByType(id, filter, sorter, startIndex, maxResult);
            }
        };
        Snapshot.prototype.getAllObjectsByType = function (typeName, filter, sorter, startIndex, maxResult) {
            if (typeof startIndex === "undefined") { startIndex = 0; }
            if (typeof maxResult === "undefined") { maxResult = -1; }
            var dataSet = this._snapshotData.getObjectsByType(typeName, startIndex, maxResult, filter);
            var objNodes = dataSet.result;
            var ret = [];
            for(var i = 0; i < objNodes.length; i++) {
                var objNode = objNodes[i];
                var namedHeapObject = new MemoryAnalyzer.NamedHeapObject(objNode, filter.displayObjectIDs);
                ret.push(namedHeapObject);
            }
            ret.sort(sorter.sortComparer);
            return {
                items: ret,
                totalCount: dataSet.totalCount
            };
        };
        Snapshot.prototype.getAllChildrenForObject = function (objectId, filter, sorter, startIndex, maxResult) {
            if (typeof startIndex === "undefined") { startIndex = 0; }
            if (typeof maxResult === "undefined") { maxResult = -1; }
            var dataSet = this._snapshotData.getChildrenForObject(objectId, startIndex, maxResult, filter);
            var objNodes = dataSet.result;
            var ret = [];
            for(var i = 0; i < objNodes.length; i++) {
                var objNode = objNodes[i];
                var namedHeapObject = new MemoryAnalyzer.NamedHeapObject(objNode, filter.displayObjectIDs);
                ret.push(namedHeapObject);
            }
            ret.sort(sorter.sortComparer);
            return {
                items: ret,
                totalCount: dataSet.totalCount
            };
        };
        Snapshot.prototype.getRetainedDescendants = function (objectId, filter, sorter, startIndex, maxResult) {
            if (typeof startIndex === "undefined") { startIndex = 0; }
            if (typeof maxResult === "undefined") { maxResult = -1; }
            var dataSet = this._snapshotData.getRetainedDescendants(objectId, startIndex, maxResult, filter);
            var objNodes = dataSet.result;
            var ret = [];
            for(var i = 0; i < objNodes.length; i++) {
                var objNode = objNodes[i];
                var namedHeapObject = new MemoryAnalyzer.NamedHeapObject(objNode, filter.displayObjectIDs);
                ret.push(namedHeapObject);
            }
            ret.sort(sorter.sortComparer);
            return {
                items: ret,
                totalCount: dataSet.totalCount
            };
        };
        Snapshot.prototype.getReferenceTreeItems = function (rootObjectId, objectId, nodeId, sorter, displayObjectIds, includeCircularReferences) {
            var dataSet = this._snapshotData.getReferenceTreeItems(rootObjectId, objectId, nodeId, includeCircularReferences);
            var objNodes = dataSet.result;
            var ret = [];
            for(var i = 0; i < objNodes.length; i++) {
                var objNode = objNodes[i];
                var namedHeapObject = new MemoryAnalyzer.ReferenceDataObject(objNode, displayObjectIds, objNode.parentId, objNode.nodeId);
                ret.push(namedHeapObject);
            }
            ret.sort(sorter.sortComparer);
            return {
                items: ret,
                totalCount: dataSet.totalCount
            };
        };
        Snapshot.prototype.getPathToRoot = function (objectId, filter, parentObjectId) {
            return this._snapshotData.getPathToRoot(objectId, parentObjectId, filter);
        };
        return Snapshot;
    })();
    MemoryAnalyzer.Snapshot = Snapshot;    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=snapshot.js.map

// snapshotDataSource.ts
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    (function (DataViewType) {
        DataViewType._map = [];
        DataViewType._map[0] = "dominators";
        DataViewType.dominators = 0;
        DataViewType._map[1] = "types";
        DataViewType.types = 1;
        DataViewType._map[2] = "roots";
        DataViewType.roots = 2;
    })(MemoryAnalyzer.DataViewType || (MemoryAnalyzer.DataViewType = {}));
    var DataViewType = MemoryAnalyzer.DataViewType;
    (function (SortOrderType) {
        SortOrderType._map = [];
        SortOrderType._map[0] = "ascending";
        SortOrderType.ascending = 0;
        SortOrderType._map[1] = "descending";
        SortOrderType.descending = 1;
    })(MemoryAnalyzer.SortOrderType || (MemoryAnalyzer.SortOrderType = {}));
    var SortOrderType = MemoryAnalyzer.SortOrderType;
    var SnapshotDataSource = (function () {
        function SnapshotDataSource() { }
        SnapshotDataSource.getDataSource = function getDataSource(viewType, snapshot) {
            switch(viewType) {
                case DataViewType.roots:
                    return new SnapshotRootDataSource(snapshot);
                case DataViewType.types:
                    return new SnapshotTypeDataSource(snapshot);
                case DataViewType.dominators:
                    return new SnapshotDominatorDataSource(snapshot);
                default: {
                    throw new Error(Plugin.Resources.getErrorString("JSPerf.1002"));
                }
            }
        };
        return SnapshotDataSource;
    })();
    MemoryAnalyzer.SnapshotDataSource = SnapshotDataSource;    
    var SnapshotRootDataSource = (function () {
        function SnapshotRootDataSource(snapshot) {
            this.snapshot = snapshot;
        }
        SnapshotRootDataSource.prototype.getRootHeapDataTreeItem = function (filter, sorter, startIndex, maxResult) {
            return Plugin.Promise.as(this.snapshot.getAllRootObjects(filter, sorter));
        };
        SnapshotRootDataSource.prototype.getHeapDataTreeItem = function (filter, sorter, parentId, startIndex, maxResult) {
            return this.snapshot.getAllChildrenForObject(parentId, filter, sorter, startIndex, maxResult);
        };
        SnapshotRootDataSource.prototype.getReferenceTreeItems = function (rootObjectId, objectId, nodeId, sorter, displayObjectIds, includeCircularReferences, startIndex, maxResult) {
            return this.snapshot.getReferenceTreeItems(rootObjectId, objectId, nodeId, sorter, displayObjectIds, includeCircularReferences);
        };
        SnapshotRootDataSource.prototype.getAvailableFields = function () {
            var fields = [];
            fields.push("name");
            fields.push("type");
            if(this.snapshot.isDiff) {
                fields.push("diffOperation");
            }
            fields.push("size");
            fields.push("isDetachedDomNode");
            if(this.snapshot.isDiff) {
                fields.push("sizeDiff");
            }
            fields.push("retainedSize");
            if(this.snapshot.isDiff) {
                fields.push("retainedSizeDiff");
            }
            return fields;
        };
        SnapshotRootDataSource.prototype.getAvailableFieldsForReferenceTree = function () {
            return this.getAvailableFields();
        };
        Object.defineProperty(SnapshotRootDataSource.prototype, "hasDetachedDomNodes", {
            get: function () {
                return this.snapshot.hasDetachedDomNodes;
            },
            enumerable: true,
            configurable: true
        });
        return SnapshotRootDataSource;
    })();    
    var SnapshotTypeDataSource = (function () {
        function SnapshotTypeDataSource(snapshot) {
            this.snapshot = snapshot;
        }
        SnapshotTypeDataSource.prototype.getRootHeapDataTreeItem = function (filter, sorter, startIndex, maxResult) {
            return this.snapshot.getAllTypes(filter, sorter);
        };
        SnapshotTypeDataSource.prototype.getHeapDataTreeItem = function (filter, sorter, parentId, startIndex, maxResult) {
            return this.snapshot.getAllChildrenForObjectOrType(parentId, filter, sorter, startIndex, maxResult);
        };
        SnapshotTypeDataSource.prototype.getReferenceTreeItems = function (rootObjectId, objectId, nodeId, sorter, displayObjectIds, includeCircularReferences, startIndex, maxResult) {
            return this.snapshot.getReferenceTreeItems(rootObjectId, objectId, nodeId, sorter, displayObjectIds, includeCircularReferences);
        };
        SnapshotTypeDataSource.prototype.getAvailableFields = function () {
            var fields = [];
            fields.push("name");
            if(this.snapshot.isDiff) {
                fields.push("diffOperation");
            }
            fields.push("size");
            fields.push("isDetachedDomNode");
            if(this.snapshot.isDiff) {
                fields.push("sizeDiff");
            }
            fields.push("retainedSize");
            if(this.snapshot.isDiff) {
                fields.push("retainedSizeDiff");
            }
            fields.push("childrenCount");
            if(this.snapshot.isDiff) {
                fields.push("childrenCountDiff");
            }
            return fields;
        };
        SnapshotTypeDataSource.prototype.getAvailableFieldsForReferenceTree = function () {
            var fields = [];
            fields.push("name");
            fields.push("type");
            if(this.snapshot.isDiff) {
                fields.push("diffOperation");
            }
            fields.push("size");
            if(this.snapshot.isDiff) {
                fields.push("sizeDiff");
            }
            fields.push("retainedSize");
            return fields;
        };
        Object.defineProperty(SnapshotTypeDataSource.prototype, "hasDetachedDomNodes", {
            get: function () {
                return this.snapshot.hasDetachedDomNodes;
            },
            enumerable: true,
            configurable: true
        });
        return SnapshotTypeDataSource;
    })();    
    var SnapshotDominatorDataSource = (function () {
        function SnapshotDominatorDataSource(snapshot) {
            this.snapshot = snapshot;
        }
        SnapshotDominatorDataSource.prototype.getRootHeapDataTreeItem = function (filter, sorter, startIndex, maxResult) {
            return this.snapshot.getAllObjects(filter, sorter, startIndex, maxResult);
        };
        SnapshotDominatorDataSource.prototype.getHeapDataTreeItem = function (filter, sorter, parentId, startIndex, maxResult) {
            return this.snapshot.getRetainedDescendants(parentId, filter, sorter, startIndex, maxResult);
        };
        SnapshotDominatorDataSource.prototype.getReferenceTreeItems = function (rootObjectId, objectId, nodeId, sorter, displayObjectIds, includeCircularReferences, startIndex, maxResult) {
            return this.snapshot.getReferenceTreeItems(rootObjectId, objectId, nodeId, sorter, displayObjectIds, includeCircularReferences);
        };
        SnapshotDominatorDataSource.prototype.getAvailableFields = function () {
            var fields = [];
            fields.push("name");
            fields.push("type");
            if(this.snapshot.isDiff) {
                fields.push("diffOperation");
            }
            fields.push("size");
            fields.push("isDetachedDomNode");
            if(this.snapshot.isDiff) {
                fields.push("sizeDiff");
            }
            fields.push("retainedSize");
            if(this.snapshot.isDiff) {
                fields.push("retainedSizeDiff");
            }
            return fields;
        };
        SnapshotDominatorDataSource.prototype.getAvailableFieldsForReferenceTree = function () {
            return this.getAvailableFields();
        };
        Object.defineProperty(SnapshotDominatorDataSource.prototype, "hasDetachedDomNodes", {
            get: function () {
                return this.snapshot.hasDetachedDomNodes;
            },
            enumerable: true,
            configurable: true
        });
        return SnapshotDominatorDataSource;
    })();    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=snapshotDataSource.js.map

// snapshotDataView.ts
var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    var TreeInfo = (function () {
        function TreeInfo(gridData, expandStates, toggleFunction, loadMoreFunction) {
            this.gridData = gridData;
            this.expandStates = expandStates;
            this.toggleFunction = toggleFunction;
            this.loadMoreFunction = loadMoreFunction;
        }
        return TreeInfo;
    })();
    MemoryAnalyzer.TreeInfo = TreeInfo;    
    var GridContextMenuData = (function () {
        function GridContextMenuData(view, objectId, parentObjectId) {
            this.view = view;
            this.objectId = objectId;
            this.parentObjectId = parentObjectId;
        }
        return GridContextMenuData;
    })();
    MemoryAnalyzer.GridContextMenuData = GridContextMenuData;    
    var SnapshotDataViewController = (function () {
        function SnapshotDataViewController(viewType, snapshot, viewSwitcher, displayObjectIDs, showBuiltIns, displayCircularReferences) {
            this.viewType = viewType;
            this._dataSource = MemoryAnalyzer.SnapshotDataSource.getDataSource(viewType, snapshot);
            this._viewSwitcher = viewSwitcher;
            this.model = new SnapshotDataViewModel(this.viewType, snapshot.isDiff);
            this.model.displayCircularReferences = displayCircularReferences;
            this.model.displayObjectIDs = displayObjectIDs;
            this.model.showBuiltIns = showBuiltIns;
            this.model.showUnknownTypes = MemoryAnalyzer.Program.userSettings.showUnknownTypes;
            this.model.showUnknownSizes = MemoryAnalyzer.Program.userSettings.showUnknownSizes;
            this.view = new SnapshotDataView(this, this.model);
            Notifications.notify(MemoryAnalyzer.MemoryNotifications.SnapshotDataViewReady, {
                viewModel: this.model,
                snapshotDataSource: this._dataSource
            });
        }
        Object.defineProperty(SnapshotDataViewController.prototype, "displayCircularReferences", {
            get: function () {
                return this.model.displayCircularReferences;
            },
            set: function (value) {
                this.model.displayCircularReferences = value;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotDataViewController.prototype, "displayObjectIDs", {
            get: function () {
                return this.model.displayObjectIDs;
            },
            set: function (value) {
                this.model.displayObjectIDs = value;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotDataViewController.prototype, "filterString", {
            get: function () {
                return this.model.filterString;
            },
            set: function (value) {
                this.model.filterString = value;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotDataViewController.prototype, "showBuiltIns", {
            get: function () {
                return this.model.showBuiltIns;
            },
            set: function (value) {
                this.model.showBuiltIns = value;
            },
            enumerable: true,
            configurable: true
        });
        SnapshotDataViewController.prototype.setSnapshotDataSource = function () {
            this.model.snapshotDataSource = this._dataSource;
            this.view.refreshGrids();
        };
        SnapshotDataViewController.prototype.showPathToRoot = function (objectId, parentObjectId) {
            this._viewSwitcher.switchToDataView(MemoryAnalyzer.DataViewType.roots);
            this._viewSwitcher.currentDataView.showPathToRoot(objectId, parentObjectId);
        };
        Object.defineProperty(SnapshotDataViewController.prototype, "currentDataView", {
            get: function () {
                return this._viewSwitcher.currentDataView;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotDataViewController.prototype, "isTextFilterSupported", {
            get: function () {
                return this.viewType !== MemoryAnalyzer.DataViewType.roots;
            },
            enumerable: true,
            configurable: true
        });
        return SnapshotDataViewController;
    })();
    MemoryAnalyzer.SnapshotDataViewController = SnapshotDataViewController;    
    var SnapshotDataViewModel = (function (_super) {
        __extends(SnapshotDataViewModel, _super);
        function SnapshotDataViewModel(viewType, isDiff) {
            if (typeof isDiff === "undefined") { isDiff = false; }
                _super.call(this);
            this.viewType = viewType;
            this._isDiff = isDiff;
        }
        Object.defineProperty(SnapshotDataViewModel.prototype, "hasDetachedDomNodes", {
            get: function () {
                return this._snapshotDataSource.hasDetachedDomNodes;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotDataViewModel.prototype, "showBuiltIns", {
            get: function () {
                return this._showBuiltIns;
            },
            set: function (v) {
                if(this._showBuiltIns !== v) {
                    this._showBuiltIns = v;
                    this.raisePropertyChanged("showBuiltIns");
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotDataViewModel.prototype, "displayCircularReferences", {
            get: function () {
                return this._displayCircularReferences;
            },
            set: function (v) {
                if(this._displayCircularReferences !== v) {
                    this._displayCircularReferences = v;
                    this.raisePropertyChanged("displayCircularReferences");
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotDataViewModel.prototype, "displayObjectIDs", {
            get: function () {
                return this._displayObjectIDs;
            },
            set: function (v) {
                if(this._displayObjectIDs !== v) {
                    this._displayObjectIDs = v;
                    this.raisePropertyChanged("displayObjectIDs");
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotDataViewModel.prototype, "showUnknownTypes", {
            get: function () {
                return this._showUnknownTypes;
            },
            set: function (v) {
                if(this._showUnknownTypes !== v) {
                    this._showUnknownTypes = v;
                    this.raisePropertyChanged("showUnknownTypes");
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotDataViewModel.prototype, "showUnknownSizes", {
            get: function () {
                return this._showUnknownSizes;
            },
            set: function (v) {
                if(this._showUnknownSizes !== v) {
                    this._showUnknownSizes = v;
                    this.raisePropertyChanged("showUnknownSizes");
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotDataViewModel.prototype, "filterString", {
            get: function () {
                return this._filterString;
            },
            set: function (v) {
                if(this._filterString !== v) {
                    this._filterString = v;
                    this.raisePropertyChanged("filterString");
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotDataViewModel.prototype, "snapshotDataSource", {
            get: function () {
                return this._snapshotDataSource;
            },
            set: function (v) {
                if(this._snapshotDataSource !== v) {
                    this._snapshotDataSource = v;
                    this.raisePropertyChanged("snapshotDataSource");
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotDataViewModel.prototype, "isDiff", {
            get: function () {
                return this._isDiff;
            },
            set: function (v) {
                if(this._isDiff !== v) {
                    this._isDiff = v;
                    this.raisePropertyChanged("isDiff");
                }
            },
            enumerable: true,
            configurable: true
        });
        return SnapshotDataViewModel;
    })(MemoryAnalyzer.Controls.ObservableViewModel);
    MemoryAnalyzer.SnapshotDataViewModel = SnapshotDataViewModel;    
    var SnapshotDataView = (function (_super) {
        __extends(SnapshotDataView, _super);
        function SnapshotDataView(controller, model, sortProperty) {
                _super.call(this, "SnapshotDataViewTemplate");
            this._fieldNameToColumnMapMainGrid = {
            };
            this._fieldNameToColumnMapReferenceGrid = {
            };
            this._controller = controller;
            this._model = model;
            this._model.registerPropertyChanged(this);
            this._referenceViewContainer = this.findElement("referenceViewContainer");
            this._snapshotGridContainer = this.findElement("snapshotGridContainer");
            this._reachedItemsCapMessageContainer = this.findElement("reachedItemsCapMessageContainer");
            this.findElement("referenceGraphTitleLabel").innerText = Plugin.Resources.getString("ReferenceGraph");
            this._snapshotViewGridSplitter = new MemoryAnalyzer.Controls.GridSplitterControl(this.findElement("snapshotViewGridSplitter"), null, this.findElement("snapshotScrollableContainer"), this.refreshGrids.bind(this));
            if(!SnapshotDataView._gridContextMenu) {
                var showInRootsViewMenuItem = {
                    callback: SnapshotDataView.onShowInRootsViewCommand,
                    label: Plugin.Resources.getString("ShowInRootsViewLabel"),
                    type: Plugin.ContextMenu.MenuItemType.command
                };
                SnapshotDataView._gridContextMenu = Plugin.ContextMenu.create([
                    showInRootsViewMenuItem
                ]);
            }
            if(sortProperty) {
                this._sortOrder = new Common.Controls.Grid.SortOrderInfo(sortProperty, "desc");
            } else if(this._model.isDiff) {
                if(this._model.viewType === MemoryAnalyzer.DataViewType.types) {
                    this._sortOrder = new Common.Controls.Grid.SortOrderInfo("childrenCountDiff", "desc");
                } else {
                    this._sortOrder = new Common.Controls.Grid.SortOrderInfo("retainedSizeDiff", "desc");
                }
            } else if(this._model.viewType === MemoryAnalyzer.DataViewType.types) {
                this._sortOrder = new Common.Controls.Grid.SortOrderInfo("childrenCount", "desc");
            } else {
                this._sortOrder = new Common.Controls.Grid.SortOrderInfo("retainedSize", "desc");
            }
            this._sortOrderForReferences = new Common.Controls.Grid.SortOrderInfo("retainedSize", "desc");
            this.uiUpdateSnapshotDataSource();
        }
        SnapshotDataView._RootsLoadCap = 2000;
        SnapshotDataView._ChildrenLoadCap = 2000;
        SnapshotDataView.prototype.onPropertyChanged = function (propertyName) {
            switch(propertyName) {
                case "isDiff":
                case "showBuiltIns":
                case "showUnknownTypes":
                case "showUnknownSizes":
                case "snapshotDataSource":
                case "filterString":
                case "displayCircularReferences":
                case "displayObjectIDs":
                    this.uiUpdateSnapshotDataSource();
                    break;
            }
        };
        SnapshotDataView.prototype.refreshGrids = function () {
            if(this._grid) {
                this._grid.layout();
            }
            if(this._gridReference) {
                this._gridReference.layout();
            }
        };
        SnapshotDataView.prototype.showPathToRoot = function (objectId, parentObjectId) {
            var _this = this;
            var path = this._model.snapshotDataSource.snapshot.getPathToRoot(objectId, this.getFilter(), parentObjectId);
            if(path && path.length > 0) {
                var pathFromRoot = path.reverse();
                var dataSource = (this._grid)._dataSource;
                var expandStates = this._grid.getExpandStates();
                var dataSourceIndex = 0;
                for(var pathIndex = 0; pathIndex < pathFromRoot.length; pathIndex++) {
                    for(; dataSourceIndex < dataSource.length; dataSourceIndex++) {
                        if(dataSource[dataSourceIndex].objectId === pathFromRoot[pathIndex]) {
                            if(pathIndex === pathFromRoot.length - 1) {
                                this._grid.setSelectedDataIndex(dataSourceIndex);
                            } else {
                                if(expandStates[dataSourceIndex] < 0) {
                                    this._grid.expandNode(dataSourceIndex);
                                }
                                dataSourceIndex++;
                            }
                            break;
                        } else {
                            if(expandStates[dataSourceIndex] !== 0) {
                                dataSourceIndex += Math.abs(expandStates[dataSourceIndex]) - 1;
                            }
                        }
                    }
                }
                this._grid.layout();
                window.setImmediate(function () {
                    _this._grid.setFocusToSelectedRow();
                });
            }
        };
        SnapshotDataView.prototype.sortBy = function (sortProperty, sortOrder) {
            this._sortOrder.index = sortProperty;
            this._sortOrder.order = sortOrder;
            this.updateTree();
        };
        SnapshotDataView.prototype.onGridContextMenu = function (grid, e) {
            if(this._model.viewType !== MemoryAnalyzer.DataViewType.roots || grid === this._gridReference) {
                var dataIndex = grid.getSelectedDataIndex();
                var foundRow = false;
                var menuX = e.pageX;
                var menuY = e.pageY;
                if(e.clientX === 0 && e.clientY === 0) {
                    foundRow = (dataIndex > -1);
                    var row = grid.getRowInfo(dataIndex).row;
                    if(row) {
                        var rect = row.getBoundingClientRect();
                        menuX = Math.round(rect.left + (rect.width / 4));
                        menuY = Math.round(rect.top + (rect.height / 2));
                    } else {
                        foundRow = false;
                    }
                } else {
                    var clickedElement = document.elementFromPoint(e.clientX, e.clientY);
                    while(clickedElement) {
                        if(clickedElement && clickedElement.classList) {
                            if(clickedElement.classList.contains("grid-row")) {
                                foundRow = true;
                                break;
                            } else if(clickedElement.classList.contains("grid-canvas")) {
                                break;
                            }
                        }
                        clickedElement = clickedElement.parentElement;
                    }
                }
                if(foundRow) {
                    var objectId = -1;
                    if(typeof dataIndex === "number" && dataIndex >= 0) {
                        var obj = grid.getRowData(dataIndex);
                        if(!(obj instanceof MemoryAnalyzer.TypeDataObject)) {
                            objectId = obj.objectId;
                        }
                    }
                    if(objectId >= 0) {
                        if(SnapshotDataView._gridContextMenu) {
                            SnapshotDataView._gridContextMenuData = new GridContextMenuData(this, objectId, obj.parentObjectId);
                            SnapshotDataView._gridContextMenu.show(menuX, menuY);
                        }
                    } else {
                        SnapshotDataView._gridContextMenuData = null;
                    }
                }
            }
            e.preventDefault();
            e.stopImmediatePropagation();
            return false;
        };
        SnapshotDataView.prototype.uiUpdateAll = function () {
            this.uiUpdateSnapshotDataSource();
        };
        SnapshotDataView.prototype.uiUpdateSnapshotDataSource = function () {
            if(this._model.snapshotDataSource) {
                var isDiff = this._model.snapshotDataSource.snapshot.isDiff;
                this._fieldNameToColumnMapMainGrid = SnapshotDataView.populateFieldNameToColumnMap(isDiff);
                this._fieldNameToColumnMapReferenceGrid = SnapshotDataView.populateFieldNameToColumnMap(isDiff);
            }
            this._referenceViewContainer.style.display = "none";
            this.updateTree();
        };
        SnapshotDataView.prototype.getFilter = function () {
            return {
                displayObjectIDs: this._model.displayObjectIDs,
                showBuiltIns: this._model.showBuiltIns,
                showUnknownTypes: this._model.showUnknownTypes,
                showUnknownSizes: this._model.showUnknownSizes,
                filterString: this._model.filterString
            };
        };
        SnapshotDataView.prototype.getSorter = function () {
            return {
                sortProperty: this._sortOrder.index,
                sortOrder: this._sortOrder.order === "asc" ? MemoryAnalyzer.SortOrderType.ascending : MemoryAnalyzer.SortOrderType.descending,
                sortComparer: SnapshotDataView.getSortComparer(this._sortOrder, this._fieldNameToColumnMapMainGrid)
            };
        };
        SnapshotDataView.prototype.getSorterForReferences = function () {
            return {
                sortProperty: this._sortOrderForReferences.index,
                sortOrder: this._sortOrderForReferences.order === "asc" ? MemoryAnalyzer.SortOrderType.ascending : MemoryAnalyzer.SortOrderType.descending,
                sortComparer: SnapshotDataView.getSortComparer(this._sortOrderForReferences, this._fieldNameToColumnMapReferenceGrid)
            };
        };
        SnapshotDataView.prototype.updateTree = function () {
            var _this = this;
            if(!this._model.snapshotDataSource) {
                return;
            }
            if(this._rootQueryPromise) {
                MemoryAnalyzer.Program.traceWriter.raiseEvent(Common.TraceEvents.Memory_DisplayFirstLevelSnapshotData_Stop);
                this._rootQueryPromise.cancel();
            }
            MemoryAnalyzer.Program.traceWriter.raiseEvent(Common.TraceEvents.Memory_DisplayFirstLevelSnapshotData_Start);
            this._rootQueryPromise = this._model.snapshotDataSource.getRootHeapDataTreeItem(this.getFilter(), this.getSorter(), 0, SnapshotDataView._RootsLoadCap);
            this._rootQueryPromise.done(function (dataSet) {
                var roots = dataSet.items;
                var ariaDescription;
                if(dataSet.totalCount > dataSet.items.length) {
                    _this._reachedItemsCapMessageContainer.style.display = "block";
                    ariaDescription = Plugin.Resources.getString("ReachedItemsCapMessage", MemoryAnalyzer.FormattingHelpers.getDecimalLocaleString(dataSet.items.length, true), MemoryAnalyzer.FormattingHelpers.getDecimalLocaleString(dataSet.totalCount, true));
                    _this._reachedItemsCapMessageContainer.innerText = ariaDescription;
                } else {
                    _this._reachedItemsCapMessageContainer.style.display = "none";
                }
                var treeInfo = _this.getTreeInfo(roots, function (item, startIndex, maxResult) {
                    return _this._model.snapshotDataSource.getHeapDataTreeItem(_this.getFilter(), _this.getSorter(), item.id, startIndex, maxResult);
                });
                var columns = _this.getColumnInfoForMainGrid(_this._model.snapshotDataSource.getAvailableFields());
                var gridOptions = new Common.Controls.Grid.GridOptions(treeInfo.toggleFunction, treeInfo.loadMoreFunction, columns, [
                    _this._sortOrder
                ], null, _this.notifyRowSelected.bind(_this));
                gridOptions.disableRightClickSelection = false;
                if(!_this._grid) {
                    if(_this._model.hasDetachedDomNodes) {
                        var gutterIcon = {
                            cssClass: "",
                            index: "",
                            gutterIconCssCallback: SnapshotDataView.getWarningCss
                        };
                        gridOptions.gutter.backgroundColor = Plugin.Theme.getValue("plugin-background-color");
                        gridOptions.gutter.icon = gutterIcon;
                        gridOptions.gutter.headerClickSortColumn = _this._fieldNameToColumnMapMainGrid["isDetachedDomNode"];
                        gridOptions.gutter.getTooltip = _this.detachedDomNodeTooltip.bind(_this);
                    }
                    _this._grid = _this.createGrid(treeInfo.gridData, treeInfo.expandStates, gridOptions, _this._snapshotGridContainer);
                    _this._grid.getElement().tabIndex = 4;
                    _this._grid.getElement().addEventListener("sort", _this.sortCompleted.bind(_this));
                    _this._grid.getElement().addEventListener("sortStarted", _this.sortStarted.bind(_this));
                    _this._grid.getElement().addEventListener("selectionchanged", _this.onGridSelectionChanged.bind(_this));
                    _this._grid.setAriaDescription(ariaDescription);
                } else {
                    _this._grid.setDataSource(treeInfo.gridData, treeInfo.expandStates, gridOptions.columns, gridOptions.sortOrders);
                    _this._grid.setAriaDescription(ariaDescription);
                }
                MemoryAnalyzer.Program.traceWriter.raiseEvent(Common.TraceEvents.Memory_DisplayFirstLevelSnapshotData_Stop);
            });
        };
        SnapshotDataView.prototype.detachedDomNodeTooltip = function (dataIndex, dataSource) {
            var originalItem = dataSource[dataIndex];
            if(originalItem.isDetachedDomNode) {
                if(originalItem.isWinJsDisposable) {
                    return Plugin.Resources.getString("DetachedDomNodeDisposableTooltip");
                } else {
                    return Plugin.Resources.getString("DetachedDomNodeTooltip");
                }
            } else {
                return null;
            }
        };
        SnapshotDataView.prototype.onGridSelectionChanged = function (args) {
            var item;
            var customArgs = args.customData[0];
            if(customArgs.selectedCount === 1) {
                var dataIndex = customArgs.selectedRows[customArgs.selectedIndex];
                if(typeof dataIndex !== "undefined") {
                    item = this._grid.getRowData(dataIndex);
                }
            }
            this.showReferences(item);
        };
        SnapshotDataView.prototype.notifyRowSelected = function () {
            Notifications.notify(MemoryAnalyzer.MemoryNotifications.DetailsViewRowSelected);
        };
        SnapshotDataView.prototype.showReferences = function (item) {
            var _this = this;
            var items;
            if(item && item.id && !isNaN(item.id)) {
                items = this._model.snapshotDataSource.getReferenceTreeItems(item.id, item.id, 0, this.getSorterForReferences(), this._model.displayObjectIDs, this._model.displayCircularReferences, 0, -1).items;
            }
            if(!items || items.length === 0) {
                this._referenceViewContainer.style.display = "none";
                return;
            }
            var rootItemId = item.id;
            var treeInfo = this.getTreeInfo(items, function (parentItem, startIndex, maxResult) {
                return _this._model.snapshotDataSource.getReferenceTreeItems(rootItemId, (parentItem).parentObjectId, (parentItem).nodeId, _this.getSorterForReferences(), _this._model.displayObjectIDs, _this._model.displayCircularReferences, 0, -1);
            });
            var columns = this.getColumnInfoForReferenceGrid(this._model.snapshotDataSource.getAvailableFieldsForReferenceTree());
            var gridOptions = new Common.Controls.Grid.GridOptions(treeInfo.toggleFunction, treeInfo.loadMoreFunction, columns, [
                this._sortOrderForReferences
            ], null, this.notifyRowSelected.bind(this));
            gridOptions.disableRightClickSelection = false;
            gridOptions.ariaTitle = Plugin.Resources.getString("ReferenceGraph");
            if(!this._gridReference) {
                if(this._model.hasDetachedDomNodes) {
                    var gutterIcon = {
                        cssClass: "",
                        index: "",
                        gutterIconCssCallback: SnapshotDataView.getWarningCss
                    };
                    gridOptions.gutter.backgroundColor = Plugin.Theme.getValue("plugin-perftools-detail-pane");
                    gridOptions.gutter.icon = gutterIcon;
                    gridOptions.gutter.headerClickSortColumn = this._fieldNameToColumnMapMainGrid["isDetachedDomNode"];
                    gridOptions.gutter.getTooltip = this.detachedDomNodeTooltip.bind(this);
                }
                this._gridReference = this.createGrid(treeInfo.gridData, treeInfo.expandStates, gridOptions, this._referenceViewContainer);
                this._gridReference.getElement().tabIndex = 4;
                this._gridReference.getElement().addEventListener("sort", this.sortCompletedForReferences.bind(this));
            } else {
                this._gridReference.setDataSource(treeInfo.gridData, treeInfo.expandStates, gridOptions.columns, gridOptions.sortOrders);
                this._gridReference.updateGetChildDataCallback(treeInfo.toggleFunction);
            }
            this._referenceViewContainer.style.removeProperty("display");
            if(items.length === 1 && items[0].hasChildren) {
                this._gridReference.expandNode(0);
            }
        };
        SnapshotDataView.prototype.getMoreText = function (totalLoaded, totalCount, capCount) {
            var hasMoreText;
            if(totalLoaded < totalCount) {
                var toLoadCount = Math.min(capCount, totalCount - totalLoaded);
                hasMoreText = Plugin.Resources.getString("ChildrenLoadNext", MemoryAnalyzer.FormattingHelpers.getDecimalLocaleString(toLoadCount, true));
            }
            return hasMoreText;
        };
        SnapshotDataView.prototype.getTreeInfo = function (roots, getChildren) {
            var _this = this;
            var rowsAndExpandStates = this.getPlaceholderRowsAndExpandStates(roots);
            var items = rowsAndExpandStates.itemsWithPlaceholders;
            var expandStates = rowsAndExpandStates.expandStates;
            var toggleFunction = function (parentTreeItem, complete) {
                var dataSet = getChildren(parentTreeItem, 0, SnapshotDataView._ChildrenLoadCap);
                var hasMoreText = _this.getMoreText(dataSet.items.length, dataSet.totalCount, SnapshotDataView._ChildrenLoadCap);
                if(hasMoreText) {
                    (parentTreeItem).nextStartIndex = dataSet.items.length;
                }
                complete(_this.getPlaceholderRowsAndExpandStates(dataSet.items), hasMoreText);
            };
            var loadMoreFunction = function (parentTreeItem, complete) {
                var startIndex = (parentTreeItem).nextStartIndex;
                if(!startIndex) {
                    return;
                }
                var dataSet = getChildren(parentTreeItem, startIndex, SnapshotDataView._ChildrenLoadCap);
                var hasMoreText = _this.getMoreText(startIndex + dataSet.items.length, dataSet.totalCount, SnapshotDataView._ChildrenLoadCap);
                if(hasMoreText) {
                    (parentTreeItem).nextStartIndex = startIndex + dataSet.items.length;
                }
                complete(_this.getPlaceholderRowsAndExpandStates(dataSet.items), hasMoreText);
            };
            return new TreeInfo(items, expandStates, toggleFunction, loadMoreFunction);
        };
        SnapshotDataView.prototype.getPlaceholderRowsAndExpandStates = function (roots) {
            var items = [];
            var placeHolderRow = {
                name: "",
                value: "",
                isPlaceholder: true
            };
            var expandStates = [];
            for(var i = 0; roots && i < roots.length; i++) {
                items.push(roots[i]);
                if(roots[i].hasChildren) {
                    expandStates.push(-1);
                    items.push(placeHolderRow);
                    expandStates.push(0);
                } else {
                    expandStates.push(0);
                }
            }
            return {
                itemsWithPlaceholders: items,
                expandStates: expandStates
            };
        };
        SnapshotDataView.prototype.createGrid = function (gridData, expandStates, gridOptions, container) {
            container.innerHTML = "";
            var grid = new Common.Controls.Grid.GridControl(container, gridOptions);
            grid.setDataSource(gridData, expandStates, gridOptions.columns, gridOptions.sortOrders);
            container.addEventListener("contextmenu", this.onGridContextMenu.bind(this, grid));
            container.addEventListener("keydown", this.onKeyDown.bind(this));
            return grid;
        };
        SnapshotDataView.prototype.getColumnInfo = function (fieldNames, fieldNamesToColumnInfo) {
            var columnInfo = [];
            for(var i = 0; i < fieldNames.length; i++) {
                if(fieldNamesToColumnInfo.hasOwnProperty(fieldNames[i])) {
                    columnInfo.push(fieldNamesToColumnInfo[fieldNames[i]]);
                } else {
                    throw new Error(Plugin.Resources.getErrorString("JSPerf.1003"));
                }
            }
            return columnInfo;
        };
        SnapshotDataView.prototype.getColumnInfoForMainGrid = function (fieldNames) {
            return this.getColumnInfo(fieldNames, this._fieldNameToColumnMapMainGrid);
        };
        SnapshotDataView.prototype.getColumnInfoForReferenceGrid = function (fieldNames) {
            return this.getColumnInfo(fieldNames, this._fieldNameToColumnMapReferenceGrid);
        };
        SnapshotDataView.prototype.onKeyDown = function (e) {
            if(e.keyCode === Common.KeyCodes.F10 && e.shiftKey) {
                var evt = document.createEvent("MouseEvent");
                evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
                this.onGridContextMenu(this._grid, evt);
            }
        };
        SnapshotDataView.prototype.sortCompleted = function (event) {
            var customData = event.customData[0];
            this._sortOrder = customData.sortOrder[0];
            MemoryAnalyzer.Program.onIdle();
            MemoryAnalyzer.Program.traceWriter.raiseEvent(Common.TraceEvents.Memory_GridSort_Stop);
        };
        SnapshotDataView.prototype.sortStarted = function (event) {
            MemoryAnalyzer.Program.traceWriter.raiseEvent(Common.TraceEvents.Memory_GridSort_Start);
        };
        SnapshotDataView.prototype.sortCompletedForReferences = function (event) {
            var customData = event.customData[0];
            this._sortOrderForReferences = customData.sortOrder[0];
        };
        SnapshotDataView.getSortComparer = function getSortComparer(sortOrder, fieldNameToColumnMap) {
            var column = fieldNameToColumnMap[sortOrder.index], comparer = column.comparer, isAsc = sortOrder.order === "asc";
            return function (v1, v2) {
                var result = comparer(column, sortOrder.order, v1, v2);
                return isAsc ? result : -result;
            };
        };
        SnapshotDataView.getWarningCss = function getWarningCss(dataIndex, dataSource) {
            var item = dataSource[dataIndex];
            if(item.isDetachedDomNode) {
                return "detachedDomNodeWarning";
            }
        };
        SnapshotDataView.populateFieldNameToColumnMap = function populateFieldNameToColumnMap(isDiff) {
            var fieldNameToColumnMap = {
            };
            fieldNameToColumnMap["name"] = new Common.Controls.Grid.ColumnInfo("name", Plugin.Resources.getString("Identifiers"), Plugin.Resources.getString("IdentifiersTooltip"), 350, true, null, isDiff ? SnapshotDataView.getDiffNameCellCSSClass : null, SnapshotDataView.columnComparerForStrings, true);
            fieldNameToColumnMap["type"] = new Common.Controls.Grid.ColumnInfo("type", Plugin.Resources.getString("Type"), Plugin.Resources.getString("TypeTooltip"), 150, true, null, isDiff ? SnapshotDataView.getDiffNameCellCSSClass : null, SnapshotDataView.columnComparerForStrings);
            fieldNameToColumnMap["diffOperation"] = new Common.Controls.Grid.ColumnInfo("diffOperation", Plugin.Resources.getString("DiffColumnOperationHeader"), Plugin.Resources.getString("DiffColumnOperationHeader"), 100, true, null, SnapshotDataView.getDiffNameCellCSSClass, SnapshotDataView.columnComparerForStrings);
            fieldNameToColumnMap["size"] = new Common.Controls.Grid.ColumnInfo("size", Plugin.Resources.getString("Size"), Plugin.Resources.getString("SizeTooltip"), 100, true, SnapshotDataView.formatSize, null, SnapshotDataView.columnComparerForNumbers);
            fieldNameToColumnMap["retainedSize"] = new Common.Controls.Grid.ColumnInfo("retainedSize", Plugin.Resources.getString("RetainedSize"), Plugin.Resources.getString("RetainedSizeTooltip"), 100, true, SnapshotDataView.formatRetainedSize, null, SnapshotDataView.columnComparerForNumbers);
            fieldNameToColumnMap["childrenCount"] = new Common.Controls.Grid.ColumnInfo("childrenCount", Plugin.Resources.getString("Count"), Plugin.Resources.getString("CountTooltip"), 50, true, SnapshotDataView.formatChildrenCount, null, SnapshotDataView.columnComparerForNumbers);
            fieldNameToColumnMap["sizeDiff"] = new Common.Controls.Grid.ColumnInfo("sizeDiff", Plugin.Resources.getString("SizeDiff"), Plugin.Resources.getString("SizeDiffTooltip"), 100, true, SnapshotDataView.formatSizeDiff, null, SnapshotDataView.columnComparerForNumbers);
            fieldNameToColumnMap["retainedSizeDiff"] = new Common.Controls.Grid.ColumnInfo("retainedSizeDiff", Plugin.Resources.getString("RetainedSizeDiff"), Plugin.Resources.getString("RetainedSizeDiffTooltip"), 150, true, SnapshotDataView.formatRetainedSizeDiff, null, SnapshotDataView.columnComparerForNumbers);
            fieldNameToColumnMap["childrenCountDiff"] = new Common.Controls.Grid.ColumnInfo("childrenCountDiff", Plugin.Resources.getString("CountDiff"), Plugin.Resources.getString("CountDiffTooltip"), 100, true, SnapshotDataView.formatChildrenCountDiff, null, SnapshotDataView.columnComparerForNumbers);
            fieldNameToColumnMap["isDetachedDomNode"] = new Common.Controls.Grid.ColumnInfo("isDetachedDomNode", "", "", 0, true, null, null, SnapshotDataView.columnComparerForStrings);
            fieldNameToColumnMap["isDetachedDomNode"].hidden = true;
            fieldNameToColumnMap["name"].hasMoreColumn = true;
            return fieldNameToColumnMap;
        };
        SnapshotDataView.columnComparerForNumbers = function columnComparerForNumbers(column, order, rowA, rowB) {
            var n1 = rowA[column.index] || 0, n2 = rowB[column.index] || 0;
            return n1 - n2;
        };
        SnapshotDataView.columnComparerForStrings = function columnComparerForStrings(column, order, rowA, rowB) {
            return SnapshotDataView.naturalSort(rowA[column.index], rowB[column.index]);
        };
        SnapshotDataView.naturalSort = function naturalSort(a, b) {
            var regexSortGroup = /(\d+)|(\D+)/g;
            var aGroups = String(a).toLowerCase().match(regexSortGroup);
            var bGroups = String(b).toLowerCase().match(regexSortGroup);
            while(aGroups.length > 0 && bGroups.length > 0) {
                var aFront = aGroups.shift();
                var bFront = bGroups.shift();
                var aAsDigit = parseInt(aFront, 10);
                var bAsDigit = parseInt(bFront, 10);
                if(isNaN(aAsDigit) && isNaN(bAsDigit)) {
                    if(aFront !== bFront) {
                        return (aFront > bFront ? 1 : -1);
                    }
                } else if(isNaN(aAsDigit)) {
                    return 1;
                } else if(isNaN(bAsDigit)) {
                    return -1;
                } else {
                    if(aAsDigit !== bAsDigit) {
                        return (aAsDigit - bAsDigit);
                    }
                }
            }
            return aGroups.length - bGroups.length;
        };
        SnapshotDataView.onShowInRootsViewCommand = function onShowInRootsViewCommand() {
            if(SnapshotDataView._gridContextMenuData && SnapshotDataView._gridContextMenuData.view) {
                SnapshotDataView._gridContextMenuData.view._controller.showPathToRoot(SnapshotDataView._gridContextMenuData.objectId, SnapshotDataView._gridContextMenuData.parentObjectId);
                SnapshotDataView._gridContextMenuData = null;
            }
        };
        SnapshotDataView.formatChildrenCount = function formatChildrenCount(dataIndex, columnIndex, columnOrder, dataSource, isForTooltip) {
            var originalItem = dataSource[dataIndex];
            if(originalItem.childrenCount) {
                return MemoryAnalyzer.FormattingHelpers.getDecimalLocaleString(originalItem.childrenCount, true);
            } else {
                return "";
            }
        };
        SnapshotDataView.formatChildrenCountDiff = function formatChildrenCountDiff(dataIndex, columnIndex, columnOrder, dataSource, isForTooltip) {
            var originalItem = dataSource[dataIndex];
            if(originalItem.childrenCountDiff) {
                return (originalItem.childrenCountDiff > 0 ? "+" : "-") + MemoryAnalyzer.FormattingHelpers.getDecimalLocaleString(originalItem.childrenCountDiff, true);
            } else {
                return "";
            }
        };
        SnapshotDataView.formatSize = function formatSize(dataIndex, columnIndex, columnOrder, dataSource, isForTooltip) {
            var originalItem = dataSource[dataIndex];
            if(originalItem.size) {
                var text = MemoryAnalyzer.FormattingHelpers.getPrettyPrintSize(originalItem.size) + (originalItem.isSizeApproximate ? "*" : " ");
                if(isForTooltip && originalItem.isSizeApproximate) {
                    text = Plugin.Resources.getString("ApproximateSizeTooltip", text);
                }
                return text;
            } else {
                return "";
            }
        };
        SnapshotDataView.formatRetainedSize = function formatRetainedSize(dataIndex, columnIndex, columnOrder, dataSource, isForTooltip) {
            var namedHeapObject = dataSource[dataIndex];
            if(namedHeapObject.retainedSize) {
                return MemoryAnalyzer.FormattingHelpers.getPrettyPrintSize(namedHeapObject.retainedSize);
            } else {
                return "";
            }
        };
        SnapshotDataView.formatRetainedSizeDiff = function formatRetainedSizeDiff(dataIndex, columnIndex, columnOrder, dataSource, isForTooltip) {
            var namedHeapObject = dataSource[dataIndex];
            if(namedHeapObject.retainedSizeDiff) {
                return (namedHeapObject.retainedSizeDiff > 0 ? "+" : "-") + MemoryAnalyzer.FormattingHelpers.getPrettyPrintSize(Math.abs(namedHeapObject.retainedSizeDiff));
            } else {
                return "";
            }
        };
        SnapshotDataView.formatSizeDiff = function formatSizeDiff(dataIndex, columnIndex, columnOrder, dataSource, isForTooltip) {
            var namedHeapObject = dataSource[dataIndex];
            if(namedHeapObject.sizeDiff) {
                return (namedHeapObject.sizeDiff > 0 ? "+" : "-") + MemoryAnalyzer.FormattingHelpers.getPrettyPrintSize(Math.abs(namedHeapObject.sizeDiff));
            } else {
                return "";
            }
        };
        SnapshotDataView.getDiffNameCellCSSClass = function getDiffNameCellCSSClass(dataIndex, columnIndex, columnOrder, dataSource) {
            var item = dataSource[dataIndex];
            if(item.isAdded) {
                return "diffAddedObject";
            } else if(item.isChanged) {
                return "diffModifiedObject";
            }
            return null;
        };
        return SnapshotDataView;
    })(Common.Controls.TemplateControl);
    MemoryAnalyzer.SnapshotDataView = SnapshotDataView;    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=snapshotDataView.js.map

// snapshotDataViewTab.ts
var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    var SnapshotDataViewTab = (function (_super) {
        __extends(SnapshotDataViewTab, _super);
        function SnapshotDataViewTab(snapshotDataViewController) {
                _super.call(this);
            this._snapshotDataViewController = snapshotDataViewController;
            this.title = Plugin.Resources.getString(Common.Enum.GetName(MemoryAnalyzer.DataViewType, this._snapshotDataViewController.model.viewType));
            this.tooltipString = Plugin.Resources.getString(Common.Enum.GetName(MemoryAnalyzer.DataViewType, this._snapshotDataViewController.model.viewType) + "Tooltip");
            this.content = this._snapshotDataViewController.view;
        }
        Object.defineProperty(SnapshotDataViewTab.prototype, "controller", {
            get: function () {
                return this._snapshotDataViewController;
            },
            enumerable: true,
            configurable: true
        });
        SnapshotDataViewTab.prototype.onActiveChanged = function () {
            if(this.active) {
                this._snapshotDataViewController.setSnapshotDataSource();
            }
        };
        return SnapshotDataViewTab;
    })(MemoryAnalyzer.Controls.TabItem);
    MemoryAnalyzer.SnapshotDataViewTab = SnapshotDataViewTab;    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=snapshotDataViewTab.js.map

// snapshotDiffController.ts
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    var SnapshotDiffController = (function () {
        function SnapshotDiffController(storageId) {
            this._storageId = storageId;
            this.model = new MemoryAnalyzer.SnapshotViewModel();
            this.model.progressText = Plugin.Resources.getString("GeneratingComparisonView");
            this.view = new MemoryAnalyzer.SnapshotView(this, this.model);
        }
        Object.defineProperty(SnapshotDiffController.prototype, "currentDataViewController", {
            get: function () {
                return this.view.currentDataViewController;
            },
            enumerable: true,
            configurable: true
        });
        SnapshotDiffController.prototype.getSnapshotDataViewController = function (viewType) {
            var controller = new MemoryAnalyzer.SnapshotDataViewController(viewType, this.model.snapshot, this.view, this.model.displayObjectIDs, this.model.showBuiltIns, this.model.displayCircularReferences);
            return controller;
        };
        SnapshotDiffController.prototype.diffSnapshots = function (storageId, relativePaths, targetView, sortProperty) {
            var _this = this;
            this.setTargetView(targetView, sortProperty);
            var snapshotPaths = [];
            for(var i = 0; i < relativePaths.length; i++) {
                var path = MemoryAnalyzer.Program.shell.getSnapshotFullPath(storageId, relativePaths[i]);
                snapshotPaths.push(path);
            }
            MemoryAnalyzer.Program.memoryAnalyzerData.processSnapshotDiff(snapshotPaths).done(this.onDiffCompleted.bind(this), this.onDiffFailed.bind(this), function (progress) {
                _this.model.progressText = Plugin.Resources.getString(progress.stringId);
                _this.model.progressValue = progress.percentage;
            });
        };
        SnapshotDiffController.prototype.setTargetView = function (targetView, sortProperty) {
            this.model.targetView = targetView;
            this.model.sortProperty = sortProperty;
        };
        SnapshotDiffController.prototype.onDiffCompleted = function (snapshotData) {
            var snapshot = new MemoryAnalyzer.Snapshot(snapshotData, true);
            this.model.snapshot = snapshot;
            MemoryAnalyzer.Program.onIdle();
        };
        SnapshotDiffController.prototype.onDiffFailed = function (error) {
            this.model.latestSnapshotError = error;
            MemoryAnalyzer.Program.onIdle();
        };
        return SnapshotDiffController;
    })();
    MemoryAnalyzer.SnapshotDiffController = SnapshotDiffController;    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=snapshotDiffController.js.map

// snapshotFile.ts
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    var SnapshotFile = (function () {
        function SnapshotFile(storageId, relativePath) {
            this.storageId = storageId;
            this.relativePath = relativePath;
        }
        return SnapshotFile;
    })();
    MemoryAnalyzer.SnapshotFile = SnapshotFile;    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=snapshotFile.js.map

// snapshotSummary.ts
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    var SnapshotSummary = (function () {
        function SnapshotSummary(snapshotDataSummary, snapshotFile, timeTaken, id) {
            this.detachedDomNodeCount = snapshotDataSummary.detachedDomNodeCount;
            this.id = id;
            this.objectsCount = snapshotDataSummary.objectsCount;
            this.processPrivateBytes = snapshotDataSummary.privateBytes.toString();
            this.pointerSize = snapshotDataSummary.pointerSize;
            this.screenshotData = snapshotDataSummary.base64Image;
            this.snapshotFile = snapshotFile;
            this.statsAddedObjects = snapshotDataSummary.statsAddedObjects;
            this.statsDeletedObjects = snapshotDataSummary.statsDeletedObjects;
            this.taken = timeTaken;
            this.totalObjectSize = snapshotDataSummary.totalObjectSize;
        }
        Object.defineProperty(SnapshotSummary, "fileExtension", {
            get: function () {
                return ".snapshotsummary";
            },
            enumerable: true,
            configurable: true
        });
        SnapshotSummary.prototype.save = function (completed, failed) {
            var _this = this;
            var summaryRelativePath = this.snapshotFile.relativePath + SnapshotSummary.fileExtension;
            Plugin.Storage.createFile(this.snapshotFile.storageId + "\\" + summaryRelativePath, {
                access: Plugin.Storage.FileAccess.write,
                encoding: "UTF-8",
                persistence: Plugin.Storage.FilePersistence.temporary,
                type: Plugin.Storage.FileType.text
            }).done(function (file) {
                file.write(JSON.stringify(_this)).done(function () {
                    file.close();
                    completed();
                }, function (error) {
                    file.close();
                    if(failed) {
                        failed(error);
                    }
                });
            }, function (error) {
                if(failed) {
                    failed(error);
                }
            });
        };
        SnapshotSummary.load = function load(storageId, relativePath, completed, failed) {
            var stream;
            var snapshotSummary;
            Plugin.Storage.openFile(storageId + "\\" + relativePath, {
                access: Plugin.Storage.FileAccess.read,
                encoding: "UTF-8",
                persistence: Plugin.Storage.FilePersistence.temporary,
                type: Plugin.Storage.FileType.text
            }).then(function (file) {
                stream = file;
                return file.read();
            }).then(function (snapshotResultString) {
                snapshotSummary = JSON.parse(snapshotResultString);
                snapshotSummary.snapshotFile.storageId = storageId;
                return stream.close();
            }).done(function () {
                completed(snapshotSummary);
            }, function (error) {
                if(failed) {
                    failed(error);
                }
            });
        };
        return SnapshotSummary;
    })();
    MemoryAnalyzer.SnapshotSummary = SnapshotSummary;    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=snapshotSummary.js.map

// snapshotTab.ts
var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    var SnapshotTab = (function (_super) {
        __extends(SnapshotTab, _super);
        function SnapshotTab(controller) {
                _super.call(this);
            this._snapshotViewController = controller;
            this.content = controller.view;
        }
        SnapshotTab.prototype.onActiveChanged = function () {
            if(this.active) {
                var currentDataView = this._snapshotViewController.view.currentDataView;
                if(currentDataView) {
                    currentDataView.refreshGrids();
                }
            }
        };
        return SnapshotTab;
    })(MemoryAnalyzer.Controls.TabItem);
    MemoryAnalyzer.SnapshotTab = SnapshotTab;    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=snapshotTab.js.map

// snapshotTileView.ts
var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    var SnapshotTileViewModel = (function () {
        function SnapshotTileViewModel(summary, snapshotSummaryCollection) {
            this._summary = summary;
            this._snapshotSummaryCollection = snapshotSummaryCollection;
        }
        Object.defineProperty(SnapshotTileViewModel.prototype, "summaryData", {
            get: function () {
                return this._summary;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotTileViewModel.prototype, "timeTaken", {
            get: function () {
                var date = new Date(this._summary.taken);
                return "(" + date.toLocaleTimeString() + ")";
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotTileViewModel.prototype, "detachedDomNodeCount", {
            get: function () {
                return this._summary.detachedDomNodeCount;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotTileViewModel.prototype, "processPrivateBytes", {
            get: function () {
                return MemoryAnalyzer.FormattingHelpers.getPrettyPrintSize(parseInt(this.summaryData.processPrivateBytes));
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotTileViewModel.prototype, "totalObjectSize", {
            get: function () {
                return MemoryAnalyzer.FormattingHelpers.getPrettyPrintSize(this.summaryData.totalObjectSize);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotTileViewModel.prototype, "objectsCount", {
            get: function () {
                return this.summaryData.objectsCount;
            },
            enumerable: true,
            configurable: true
        });
        SnapshotTileViewModel.prototype.getComparableSnapshots = function () {
            var result = [];
            var currentSnapshotDate = this._summary.taken;
            for(var i = 0; i < this._snapshotSummaryCollection.length; i++) {
                var snapshot = this._snapshotSummaryCollection.getItem(i);
                if(snapshot.id !== this._summary.id) {
                    result.push(snapshot);
                }
            }
            result = result.sort(function (a, b) {
                return a.id - b.id;
            });
            return result;
        };
        return SnapshotTileViewModel;
    })();
    MemoryAnalyzer.SnapshotTileViewModel = SnapshotTileViewModel;    
    var SnapshotTileView = (function (_super) {
        __extends(SnapshotTileView, _super);
        function SnapshotTileView(controller, model) {
                _super.call(this, "SnapshotTileTemplate");
            this._controller = controller;
            this._model = model;
            this._tileContextMenuItems = [];
            this._snapshotTile = this.findElement("snapshotTile");
            this._comparableSnapshots = this._model.getComparableSnapshots();
            this._tileHeader = this.findElement("snapshotTileHeader");
            this.findElement("snapshotTileTitle").innerText = Plugin.Resources.getString("SnapshotNumber", this._model.summaryData.id);
            if(this._model.summaryData.screenshotData) {
                var imgHolder = this.findElement("snapshotTileImage");
                imgHolder.src = "data:image/jpeg;base64," + this._model.summaryData.screenshotData.replace(/\r\n/g, "");
                imgHolder.alt = Plugin.Resources.getString("Screenshot");
            }
            var objectsCountText = MemoryAnalyzer.FormattingHelpers.getDecimalLocaleString(this._model.objectsCount, true);
            this.findElement("snapshotTakenDate").innerText = this._model.timeTaken;
            this.findElement("heapSizeLink").innerText = this._model.totalObjectSize;
            this.findElement("objectsCountLink").innerText = Plugin.Resources.getString("ObjectsCount", objectsCountText);
            this.findElement("heapSizeLink").setAttribute("data-plugin-vs-tooltip", Plugin.Resources.getString("HeapSizeLinkTooltip"));
            this.findElement("objectsCountLink").setAttribute("data-plugin-vs-tooltip", Plugin.Resources.getString("ObjectsCountLinkTooltip"));
            this.setupSizeDiff(this.findElement("heapDiffLink"), this.findElement("heapDiffIndicatorIcon"));
            this.setupCountDiff(this.findElement("objectsDiffLink"), this.findElement("objectDiffIndicatorIcon"));
            this.findElement("heapSizeLink").onclick = this.onSizeClick.bind(this);
            this.findElement("objectsCountLink").onclick = this.onObjectCountClick.bind(this);
            this.findElement("heapDiffLink").onclick = this.onDiffClick.bind(this);
            this.findElement("objectsDiffLink").onclick = this.onObjectDiffClick.bind(this);
            if(model.detachedDomNodeCount > 0) {
                var detachedDomNodeCount = this.findElement("snapshotTileDetachedDomNodeCount");
                detachedDomNodeCount.innerText = model.detachedDomNodeCount.toString();
                detachedDomNodeCount.setAttribute("data-plugin-vs-tooltip", Plugin.Resources.getString("PotentialIssuesTooltip"));
                detachedDomNodeCount.setAttribute("aria-label", Plugin.Resources.getString("PotentialIssuesTooltip"));
                detachedDomNodeCount.onclick = this.onDetachedDomNodesClick.bind(this);
                this.findElement("snapshotTileDetachedDomNodeInfo").style.visibility = "visible";
            }
            var links = this.findElementsByClassName("BPT-FileLink");
            for(var linkIndex = 0; linkIndex < links.length; linkIndex++) {
                var linkElement = links[linkIndex];
                (function (link) {
                    link.onkeydown = function (e) {
                        if((e.keyCode === Common.KeyCodes.ENTER || e.keyCode === Common.KeyCodes.SPACE) && !e.ctrlKey && !e.altKey && !e.shiftKey) {
                            link.click();
                        }
                    };
                })(linkElement);
            }
            this.populateContextMenu();
        }
        SnapshotTileView.prototype.onCollectionChanged = function (eventArgs) {
            if(eventArgs.action === MemoryAnalyzer.Controls.NotifyCollectionChangedAction.Add) {
                var newSummary = eventArgs.newItems[0];
                if(this._model.summaryData.id !== newSummary.id) {
                    var contextMenuItem = {
                        callback: this.diffTo.bind(this, newSummary.id),
                        label: Plugin.Resources.getString("SnapshotNumber", newSummary.id),
                        type: Plugin.ContextMenu.MenuItemType.command
                    };
                    this._tileContextMenuItems.push(contextMenuItem);
                }
                this.createContextMenu();
            }
        };
        SnapshotTileView.prototype.setFocus = function () {
            this._tileHeader.focus();
        };
        SnapshotTileView.prototype.createContextMenu = function () {
            if(this._tileContextMenu) {
                this._tileContextMenu.detach(this._snapshotTile);
            }
            if(this._tileContextMenuItems.length > 0) {
                var compareToMenuItem = {
                    callback: function () {
                    },
                    label: Plugin.Resources.getString("CompareTo"),
                    submenu: this._tileContextMenuItems,
                    type: Plugin.ContextMenu.MenuItemType.command
                };
                this._tileContextMenu = Plugin.ContextMenu.create([
                    compareToMenuItem
                ]);
                this._tileContextMenu.attach(this._snapshotTile);
            }
        };
        SnapshotTileView.prototype.populateContextMenu = function () {
            this._comparableSnapshots = this._model.getComparableSnapshots();
            for(var i = 0; i < this._comparableSnapshots.length; i++) {
                var comparable = this._comparableSnapshots[i];
                var contextMenuItem = {
                    callback: this.diffTo.bind(this, comparable.id),
                    label: Plugin.Resources.getString("SnapshotNumber", comparable.id),
                    type: Plugin.ContextMenu.MenuItemType.command
                };
                this._tileContextMenuItems.push(contextMenuItem);
            }
            this.createContextMenu();
        };
        SnapshotTileView.prototype.setupSizeDiff = function (element, iconElement) {
            var toSnapshot = this._comparableSnapshots[this._model.summaryData.id - 2];
            if(toSnapshot) {
                var size = (this._model.summaryData.totalObjectSize - toSnapshot.totalObjectSize);
                if(size > 0) {
                    iconElement.classList.add("heapIncreaseIcon");
                } else if(size < 0) {
                    iconElement.classList.add("heapDecreaseIcon");
                }
                if(size === 0) {
                    element.innerText = Plugin.Resources.getString("NoDiff");
                } else {
                    element.innerText = (size > 0 ? "+" : "-") + MemoryAnalyzer.FormattingHelpers.getPrettyPrintSize(size);
                    element.setAttribute("data-plugin-vs-tooltip", Plugin.Resources.getString("HeapSizeDiffLinkTooltip"));
                }
            } else {
                element.classList.remove("BPT-FileLink");
                element.classList.add("baselineText");
                element.innerText = Plugin.Resources.getString("Baseline");
                element.tabIndex = -1;
            }
        };
        SnapshotTileView.prototype.setupCountDiff = function (element, iconElement) {
            if(this._comparableSnapshots.length >= 1) {
                var addedCount = this._model.summaryData.statsAddedObjects;
                var deletedCount = this._model.summaryData.statsDeletedObjects;
                var delta = addedCount - deletedCount;
                if(delta > 0) {
                    iconElement.classList.add("heapIncreaseIcon");
                } else if(delta < 0) {
                    iconElement.classList.add("heapDecreaseIcon");
                }
                if(addedCount === 0 && deletedCount === 0) {
                    element.innerText = Plugin.Resources.getString("NoDiff");
                } else {
                    var diffText;
                    diffText = "+" + MemoryAnalyzer.FormattingHelpers.getDecimalLocaleString(addedCount, true) + " / " + "-" + MemoryAnalyzer.FormattingHelpers.getDecimalLocaleString(deletedCount, true);
                    element.innerText = diffText;
                    element.setAttribute("data-plugin-vs-tooltip", Plugin.Resources.getString("ObjectsCountDiffLinkTooltip"));
                }
            } else {
                element.classList.remove("BPT-FileLink");
                element.classList.add("baselineText");
                element.innerText = Plugin.Resources.getString("Baseline");
                element.tabIndex = -1;
            }
        };
        SnapshotTileView.prototype.onDetachedDomNodesClick = function (e) {
            this._controller.viewSnapshot(this._model.summaryData.id, "Dominators", "isDetachedDomNode");
        };
        SnapshotTileView.prototype.onSizeClick = function (e) {
            this._controller.viewSnapshot(this._model.summaryData.id, "Dominators", "retainedSize");
        };
        SnapshotTileView.prototype.onObjectCountClick = function (e) {
            this._controller.viewSnapshot(this._model.summaryData.id, "Types", "childrenCount");
        };
        SnapshotTileView.prototype.diffTo = function (id) {
            this._controller.compareSnapshots(this._model.summaryData.id, id, "Dominators", "retainedSize");
        };
        SnapshotTileView.prototype.onDiffClick = function (e) {
            var toSnapshot = this._comparableSnapshots[this._model.summaryData.id - 2];
            if(toSnapshot) {
                this._controller.compareSnapshots(this._model.summaryData.id, toSnapshot.id, "Dominators", "retainedSizeDiff");
            }
        };
        SnapshotTileView.prototype.onObjectDiffClick = function (e, target) {
            var toSnapshot = this._comparableSnapshots[this._model.summaryData.id - 2];
            if(toSnapshot) {
                this._controller.compareSnapshots(this._model.summaryData.id, toSnapshot.id, "Types", "childrenCountDiff");
            }
        };
        return SnapshotTileView;
    })(Common.Controls.TemplateControl);
    MemoryAnalyzer.SnapshotTileView = SnapshotTileView;    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=snapshotTileView.js.map

// snapshotView.ts
var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    var SnapshotViewController = (function () {
        function SnapshotViewController(storageId) {
            this._storageId = storageId;
            this.model = new SnapshotViewModel();
            this.model.progressText = Plugin.Resources.getString("ProcessingSnapshot");
            this.view = new SnapshotView(this, this.model);
        }
        Object.defineProperty(SnapshotViewController.prototype, "currentDataViewController", {
            get: function () {
                return this.view.currentDataViewController;
            },
            enumerable: true,
            configurable: true
        });
        SnapshotViewController.prototype.getSnapshotDataViewController = function (viewType) {
            return new MemoryAnalyzer.SnapshotDataViewController(viewType, this.model.snapshot, this.view, this.model.displayObjectIDs, this.model.showBuiltIns, this.model.displayCircularReferences);
        };
        SnapshotViewController.prototype.giveFeedback = function () {
            var _this = this;
            MemoryAnalyzer.Program.internalFeedback.isEnabled().done(function (enabled) {
                if(enabled) {
                    var viewTypeName = "";
                    if(_this.view.currentDataViewController) {
                        viewTypeName = Common.Enum.GetName(MemoryAnalyzer.DataViewType, _this.view.currentDataViewController.viewType);
                    }
                    MemoryAnalyzer.Program.shell.save(false).done(function (fileLocation) {
                        MemoryAnalyzer.Program.internalFeedback.sendData(true, "", "", viewTypeName, "", fileLocation);
                    });
                }
            });
        };
        SnapshotViewController.prototype.loadSnapshot = function (storageId, relativePaths, targetView, sortProperty) {
            if(!relativePaths || relativePaths.length !== 1) {
                throw new Error(Plugin.Resources.getErrorString("JSPerf.1012"));
            }
            this.setTargetView(targetView, sortProperty);
            var snapshotPath = MemoryAnalyzer.Program.shell.getSnapshotFullPath(storageId, relativePaths[0]);
            MemoryAnalyzer.Program.memoryAnalyzerData.processSnapshot(snapshotPath).done(this.onSnapshotProcessingCompleted.bind(this), this.onSnapshotProcessingFailed.bind(this));
        };
        SnapshotViewController.prototype.setTargetView = function (targetView, sortProperty) {
            this.model.targetView = targetView;
            this.model.sortProperty = sortProperty;
        };
        SnapshotViewController.prototype.onSnapshotProcessingCompleted = function (snapshotData) {
            var snapshot = new MemoryAnalyzer.Snapshot(snapshotData, false);
            this.model.snapshot = snapshot;
            MemoryAnalyzer.Program.onIdle();
        };
        SnapshotViewController.prototype.onSnapshotProcessingFailed = function (error) {
            if(!error) {
                throw new Error(Plugin.Resources.getErrorString("JSPerf.1013"));
            }
            this.model.latestSnapshotError = error;
            MemoryAnalyzer.Program.onIdle();
        };
        SnapshotViewController.prototype.onSnapshotProgress = function (progress) {
            this.model.progressText = Plugin.Resources.getString(progress.stringId);
            this.model.progressValue = progress.percentage;
        };
        return SnapshotViewController;
    })();
    MemoryAnalyzer.SnapshotViewController = SnapshotViewController;    
    var SnapshotViewModel = (function (_super) {
        __extends(SnapshotViewModel, _super);
        function SnapshotViewModel() {
                _super.call(this);
            this._displayCircularReferences = false;
            this._displayObjectIDs = false;
            this._latestSnapshotError = null;
            this._showBuiltIns = false;
        }
        Object.defineProperty(SnapshotViewModel.prototype, "displayCircularReferences", {
            get: function () {
                return this._displayCircularReferences;
            },
            set: function (v) {
                if(this._displayCircularReferences !== v) {
                    this._displayCircularReferences = v;
                    this.raisePropertyChanged("displayCircularReferences");
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotViewModel.prototype, "displayObjectIDs", {
            get: function () {
                return this._displayObjectIDs;
            },
            set: function (v) {
                if(this._displayObjectIDs !== v) {
                    this._displayObjectIDs = v;
                    this.raisePropertyChanged("displayObjectIDs");
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotViewModel.prototype, "filterString", {
            get: function () {
                return this._filterString;
            },
            set: function (v) {
                if(this._filterString !== v) {
                    MemoryAnalyzer.Program.traceWriter.raiseEvent(Common.TraceEvents.Memory_GridFilterUIResponse_Start);
                    this._filterString = v;
                    this.raisePropertyChanged("filterString");
                    MemoryAnalyzer.Program.traceWriter.raiseEvent(Common.TraceEvents.Memory_GridFilterUIResponse_Stop);
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotViewModel.prototype, "latestSnapshotError", {
            get: function () {
                return this._latestSnapshotError;
            },
            set: function (v) {
                if(this._latestSnapshotError !== v) {
                    this._latestSnapshotError = v;
                    this.raisePropertyChanged("latestSnapshotError");
                    MemoryAnalyzer.Program.reportError(v, "SnapshotProcessingFailure");
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotViewModel.prototype, "progressText", {
            get: function () {
                return this._progressText;
            },
            set: function (v) {
                if(this._progressText !== v) {
                    this._progressText = v;
                    this.raisePropertyChanged("progressText");
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotViewModel.prototype, "progressValue", {
            get: function () {
                return this._progressValue;
            },
            set: function (v) {
                if(this._progressValue !== v) {
                    this._progressValue = v;
                    this.raisePropertyChanged("progressValue");
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotViewModel.prototype, "showBuiltIns", {
            get: function () {
                return this._showBuiltIns;
            },
            set: function (v) {
                if(this._showBuiltIns !== v) {
                    this._showBuiltIns = v;
                    this.raisePropertyChanged("showBuiltIns");
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotViewModel.prototype, "snapshot", {
            get: function () {
                return this._snapshot;
            },
            set: function (v) {
                if(this._snapshot !== v) {
                    this._snapshot = v;
                    this.raisePropertyChanged("snapshot");
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotViewModel.prototype, "sortProperty", {
            get: function () {
                return this._sortProperty;
            },
            set: function (v) {
                this._sortProperty = v;
                this.raisePropertyChanged("sortProperty");
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotViewModel.prototype, "targetView", {
            get: function () {
                return this._targetView;
            },
            set: function (v) {
                if(this._targetView !== v) {
                    this._targetView = v;
                    this.raisePropertyChanged("targetView");
                }
            },
            enumerable: true,
            configurable: true
        });
        return SnapshotViewModel;
    })(MemoryAnalyzer.Controls.ObservableViewModel);
    MemoryAnalyzer.SnapshotViewModel = SnapshotViewModel;    
    var SnapshotView = (function (_super) {
        __extends(SnapshotView, _super);
        function SnapshotView(controller, model) {
                _super.call(this, "SnapshotTabTemplate");
            this._controller = controller;
            this._model = model;
            this._snapshotAnalysisView = new SnapshotAnalysisView(this._controller, this._model);
            this._model.registerPropertyChanged(this);
            this._snapshotDataNavigation = new Common.Controls.Control(this.findElement("snapshotDataNavigation"));
            this._snapshotProcessingProgressDiv = this.findElement("snapshotProcessingProgressDiv");
            this._progressText = this.findElement("progressText");
            this._progressBar = this.findElement("progressBar");
            this._snapshotProcessingError = this.findElement("snapshotProcessingError");
            this._snapshotProcessingErrorMsg = this.findElement("snapshotProcessingErrorMsg");
            this.findElement("snapshotProcessingErrorLabel").innerText = Plugin.Resources.getString("ErrorWhileProcessing");
            this.uiUpdateViews();
            this.updateProgress();
        }
        Object.defineProperty(SnapshotView.prototype, "currentDataView", {
            get: function () {
                var currentTab = this.currentDataViewTab;
                if(currentTab) {
                    return currentTab.content;
                }
                return null;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotView.prototype, "currentDataViewController", {
            get: function () {
                var currentTab = this.currentDataViewTab;
                if(currentTab) {
                    return currentTab.controller;
                }
                return null;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SnapshotView.prototype, "currentDataViewTab", {
            get: function () {
                if(this._tabControl && this._tabControl.selectedItem) {
                    return this._tabControl.selectedItem;
                }
                return null;
            },
            enumerable: true,
            configurable: true
        });
        SnapshotView.prototype.switchToDataView = function (viewType) {
            this._tabControl.selectedItem = this._tabControl.getTab(viewType);
        };
        SnapshotView.prototype.onPropertyChanged = function (propertyName) {
            var _this = this;
            switch(propertyName) {
                case "displayCircularReferences":
                    this.forEachTab(function (tab) {
                        tab.controller.displayCircularReferences = _this._model.displayCircularReferences;
                    });
                    break;
                case "displayObjectIDs":
                    this.forEachTab(function (tab) {
                        tab.controller.displayObjectIDs = _this._model.displayObjectIDs;
                    });
                    break;
                case "filterString":
                    if(this.currentDataViewController) {
                        this.currentDataViewController.filterString = this._model.filterString;
                    }
                    break;
                case "latestSnapshotError":
                    this.updateSnapshotError();
                    break;
                case "progressText":
                case "progressValue":
                    this.updateProgress();
                    break;
                case "showBuiltIns":
                    this.forEachTab(function (tab) {
                        tab.controller.showBuiltIns = _this._model.showBuiltIns;
                    });
                    break;
                case "snapshot":
                    this.uiUpdateViews();
                    break;
                case "sortProperty":
                    this.updateSort();
                    break;
                case "targetView":
                    this.updateTargetView();
                    break;
            }
        };
        SnapshotView.prototype.forEachTab = function (action) {
            for(var i = 0; i < this._tabControl.length(); i++) {
                var tab = this._tabControl.getTab(i);
                action(tab);
            }
        };
        SnapshotView.prototype.updateProgress = function () {
            if(this._model.progressText) {
                this._progressText.innerText = this._model.progressText;
            }
            if(this._model.progressValue) {
                this._progressBar.value = this._model.progressValue;
            }
        };
        SnapshotView.prototype.updateTargetView = function () {
            if(this._tabControl) {
                var title = this._model.targetView;
                for(var i = 0; i < this._tabControl.length(); i++) {
                    var tabItem = this._tabControl.getTab(i);
                    if(tabItem.title === title) {
                        this._tabControl.selectedItem = tabItem;
                    }
                }
            }
        };
        SnapshotView.prototype.updateSort = function () {
            if(this.currentDataView) {
                this.currentDataView.sortBy(this._model.sortProperty, "desc");
            }
        };
        SnapshotView.prototype.updateSnapshotError = function () {
            var error = this._model.latestSnapshotError;
            if(error) {
                this.showProgress(false);
                this._snapshotProcessingErrorMsg.innerText = MemoryAnalyzer.ErrorFormatter.format(error);
                this._snapshotProcessingError.style.display = "block";
            } else {
                this._snapshotProcessingErrorMsg.innerText = "";
                this._snapshotProcessingError.style.display = "none";
            }
        };
        SnapshotView.prototype.getNewTab = function (dataViewType) {
            return new MemoryAnalyzer.SnapshotDataViewTab(this._controller.getSnapshotDataViewController(dataViewType));
        };
        SnapshotView.prototype.uiUpdateViews = function () {
            var _this = this;
            this.updateSnapshotError();
            if(this._tabControl) {
                for(var i = 0; i < this._tabControl.length(); i++) {
                    var tabToRemove = this._tabControl.getTab(i);
                }
                this._snapshotDataNavigation.removeChild(this._tabControl);
            }
            if(this._model.snapshot) {
                this._snapshotDataNavigation.rootElement.classList.remove("snapshotDataNavigationHidden");
                this.showProgress(false);
                this._tabControl = new MemoryAnalyzer.Controls.TabControl();
                this._tabControl.tabsLeftAligned = true;
                this._tabControl.afterBarContainer.appendChild(this._snapshotAnalysisView);
                var dataViewTypes = Common.Enum.GetValues(MemoryAnalyzer.DataViewType);
                for(var i = 0; i < dataViewTypes.length; i++) {
                    var dataViewType = dataViewTypes[i];
                    var tabItem = this.getNewTab(dataViewType);
                    this._tabControl.addTab(tabItem);
                }
                this.updateTargetView();
                this.updateSort();
                this._snapshotAnalysisView.onTabChanged();
                this._tabControl.selectedItemChanged = function () {
                    _this._model.targetView = _this._tabControl.selectedItem.title;
                    _this._snapshotAnalysisView.onTabChanged();
                };
                this._snapshotDataNavigation.appendChild(this._tabControl);
                Plugin.VS.Internal.CodeMarkers.fire(MemoryAnalyzer.CodeMarkerValues.perfBrowserTools_MemoryAnalyzerViewLoaded);
            } else {
                this._snapshotDataNavigation.rootElement.classList.add("snapshotDataNavigationHidden");
                this.showProgress(true);
            }
        };
        SnapshotView.prototype.showProgress = function (show) {
            if(show) {
                this._snapshotProcessingProgressDiv.classList.remove("snapshotProcessingProgressDivHidden");
            } else {
                this._snapshotProcessingProgressDiv.classList.add("snapshotProcessingProgressDivHidden");
            }
        };
        return SnapshotView;
    })(Common.Controls.TemplateControl);
    MemoryAnalyzer.SnapshotView = SnapshotView;    
    var SnapshotAnalysisView = (function (_super) {
        __extends(SnapshotAnalysisView, _super);
        function SnapshotAnalysisView(controller, model) {
            var _this = this;
                _super.call(this, "AnalysisTemplate");
            this._controller = controller;
            this._model = model;
            this._model.displayObjectIDs = MemoryAnalyzer.Program.userSettings.displayObjectIDs;
            this._model.showBuiltIns = MemoryAnalyzer.Program.userSettings.showBuiltIns;
            var giveFeedbackButton = this.findElement("giveFeedbackButton");
            giveFeedbackButton.classList.add("hidden");
            MemoryAnalyzer.Program.internalFeedback.isEnabled().done(function (isEnabled) {
                if(isEnabled) {
                    giveFeedbackButton.classList.remove("hidden");
                    giveFeedbackButton.addEventListener("click", _this.onGiveFeedbackClick.bind(_this));
                }
            });
            this._filterInput = this.findElement("filterInput");
            this._filterInput.placeholder = Plugin.Resources.getString("IdentifierFilter");
            this._filterInput.setAttribute("aria-label", Plugin.Resources.getString("IdentifierFilter"));
            this._filterInput.disabled = true;
            this._filterInput.classList.add("hidden");
            this._filterInput.onkeyup = function (e) {
                if(e.keyCode === Common.KeyCodes.ESCAPE) {
                    _this._filterInput.value = "";
                    _this._model.filterString = _this._filterInput.value;
                }
            };
            this._filterInput.oninput = function () {
                clearTimeout(_this._filterResponseTimeoutHandle);
                _this._filterResponseTimeoutHandle = setTimeout(function () {
                    _this._model.filterString = _this._filterInput.value;
                }, 200);
            };
            var settingsMenuButton = this.findElement("settingsMenuButton");
            settingsMenuButton.setAttribute("data-plugin-vs-tooltip", Plugin.Resources.getString("SettingsMenuButtonTooltipText"));
            settingsMenuButton.setAttribute("aria-label", Plugin.Resources.getString("SettingsMenuButtonTooltipText"));
            this._settingsMenu = new MemoryAnalyzer.Controls.MenuControl(settingsMenuButton);
            this._settingsMenu.addToggleItem(Plugin.Resources.getString("ShowBuiltIns"), this.toggleShowBuiltins.bind(this), this._model.showBuiltIns, 3);
            this._settingsMenu.addToggleItem(Plugin.Resources.getString("DisplayObjectIDs"), this.toggleDisplayObjectIDs.bind(this), this._model.displayObjectIDs, 3);
            this._settingsMenu.addToggleItem(Plugin.Resources.getString("DisplayCircularReferences"), this.toggleDisplayCircularReferences.bind(this), this._model.displayCircularReferences, 3);
        }
        SnapshotAnalysisView.prototype.onTabChanged = function () {
            var currentViewController = this._controller.currentDataViewController;
            if(currentViewController && currentViewController.isTextFilterSupported) {
                this._filterInput.disabled = false;
                this._filterInput.classList.remove("hidden");
                this._filterInput.value = currentViewController.filterString || "";
                this._filterInput.focus();
            } else {
                this._filterInput.disabled = true;
                this._filterInput.classList.add("hidden");
            }
        };
        SnapshotAnalysisView.prototype.onGiveFeedbackClick = function (e) {
            this._controller.giveFeedback();
        };
        SnapshotAnalysisView.prototype.toggleShowBuiltins = function () {
            this._model.showBuiltIns = !this._model.showBuiltIns;
            return this._model.showBuiltIns;
        };
        SnapshotAnalysisView.prototype.toggleDisplayCircularReferences = function () {
            this._model.displayCircularReferences = !this._model.displayCircularReferences;
            return this._model.displayCircularReferences;
        };
        SnapshotAnalysisView.prototype.toggleDisplayObjectIDs = function () {
            this._model.displayObjectIDs = !this._model.displayObjectIDs;
            return this._model.displayObjectIDs;
        };
        return SnapshotAnalysisView;
    })(Common.Controls.TemplateControl);
    MemoryAnalyzer.SnapshotAnalysisView = SnapshotAnalysisView;    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=snapshotView.js.map

// summaryTab.ts
var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    var SummaryTab = (function (_super) {
        __extends(SummaryTab, _super);
        function SummaryTab(summaryViewController) {
                _super.call(this);
            this.title = Plugin.Resources.getString("Summary").toLocaleUpperCase();
            this.tooltipString = Plugin.Resources.getString("SummaryTabTooltip");
            this.content = summaryViewController.view;
        }
        return SummaryTab;
    })(MemoryAnalyzer.Controls.TabItem);
    MemoryAnalyzer.SummaryTab = SummaryTab;    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=summaryTab.js.map

// summaryView.ts
var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    var SummaryViewController = (function () {
        function SummaryViewController(memoryAnalyzer, storageId, isOffline) {
            this._screenshotHeight = 150;
            this._screenshotKeepAspectRatio = true;
            this._screenshotWidth = 200;
            this._memoryAnalyzer = memoryAnalyzer;
            this._storageId = storageId;
            this.model = new SummaryViewModel(isOffline);
            this.view = new SummaryView(this, this.model);
        }
        SummaryViewController._nextIdentifier = 0;
        SummaryViewController._snapshotChunkSize = 32768;
        SummaryViewController.prototype.giveFeedback = function () {
            MemoryAnalyzer.Program.internalFeedback.isEnabled().done(function (enabled) {
                if(enabled) {
                    MemoryAnalyzer.Program.shell.save(false).done(function (fileLocation) {
                        MemoryAnalyzer.Program.internalFeedback.sendData(true, "", "", "", "", fileLocation);
                    });
                }
            });
        };
        SummaryViewController.prototype.loadExistingSnapshots = function () {
            var _this = this;
            var fileExtension = ".snapjs" + MemoryAnalyzer.SnapshotSummary.fileExtension;
            var snapshotSummaries = [];
            var snapshotCount = 0;
            Plugin.Storage.getFileList(this._storageId, Plugin.Storage.FilePersistence.temporary).done(function (files) {
                files = files.filter(function (file) {
                    return file.slice(-fileExtension.length) === fileExtension;
                });
                for(var i = 0; i < files.length; i++) {
                    MemoryAnalyzer.SnapshotSummary.load(_this._storageId, files[i], function (snapshotNumber, snapshotSummary) {
                        snapshotSummaries.push(snapshotSummary);
                        snapshotCount++;
                        if(snapshotCount === files.length) {
                            snapshotSummaries = snapshotSummaries.sort(function (a, b) {
                                return a.id - b.id;
                            });
                            for(var snapshot = 0; snapshot < snapshotSummaries.length; snapshot++) {
                                this.model.snapshotSummaryCollection.add(snapshotSummaries[snapshot]);
                            }
                        }
                    }.bind(_this, i), _this.onSnapshotFailed.bind(_this));
                }
                Plugin.VS.Internal.CodeMarkers.fire(MemoryAnalyzer.CodeMarkerValues.perfBrowserTools_MemoryAnalyzerViewLoaded);
                MemoryAnalyzer.Program.onIdle();
            }, this.onSnapshotFailed.bind(this));
        };
        SummaryViewController.prototype.save = function () {
            if(this.model.snapshotSummaryCollection.length > 0) {
                return MemoryAnalyzer.Program.shell.save(true);
            }
            return Plugin.Promise.as(null);
        };
        SummaryViewController.prototype.startGraphCollectorSession = function () {
            var _this = this;
            if(!MemoryAnalyzer.Program.shell.isGraphCollectionSupported) {
                return;
            }
            if(!this._graphCollectorSession) {
                MemoryAnalyzer.Program.shell.startGraphCollection().done(function (newSession) {
                    _this._graphCollectorSession = newSession;
                    _this.model.graphCollectorSession = newSession;
                    _this.view.startGraph();
                }, function (err) {
                    MemoryAnalyzer.Program.reportError(err, Plugin.Resources.getErrorString("JSPerf.1064"));
                });
            }
        };
        SummaryViewController.prototype.stopGraphCollectorSession = function () {
            if(this._graphCollectorSession) {
                this._graphCollectorSession.stop();
                this._graphCollectorSession = null;
                this.view.stopGraph();
                if(this.model.snapshotSummaryCollection.length === 0) {
                    this.view.removeExistingGraph();
                }
            }
        };
        SummaryViewController.prototype.takeSnapshot = function () {
            var _this = this;
            if(!this.model.isTakeSnapshotEnabled) {
                return;
            }
            this.model.isTakingSnapshot = true;
            MemoryAnalyzer.Program.traceWriter.raiseEvent(Common.TraceEvents.Memory_TakeSnapshot_Start);
            MemoryAnalyzer.Program.shell.createSnapshot().done(function (fileAndPath) {
                var args = [
                    SummaryViewController._snapshotChunkSize, 
                    _this._screenshotWidth, 
                    _this._screenshotHeight, 
                    _this._screenshotKeepAspectRatio
                ];
                var takeSnapshotCommand = new MemoryAnalyzer.TakeSnapshotCommand(args, fileAndPath.file);
                takeSnapshotCommand.completedHandler = function () {
                    var previousSnapshotPath;
                    if(_this.model.snapshotSummaryCollection.length > 0) {
                        var snapshotSummary = _this.model.snapshotSummaryCollection.getItem(_this.model.snapshotSummaryCollection.length - 1);
                        if(snapshotSummary) {
                            previousSnapshotPath = snapshotSummary.snapshotFile.relativePath;
                        }
                    }
                    return fileAndPath.file.close().done(function () {
                        return _this.onSnapshotResult(fileAndPath.relativePath, previousSnapshotPath);
                    });
                };
                takeSnapshotCommand.errorHandler = function (error) {
                    return fileAndPath.file.close().done(function () {
                        return _this.onSnapshotFailed(error);
                    });
                };
                _this._memoryAnalyzer.callProxy(takeSnapshotCommand);
                MemoryAnalyzer.Program.traceWriter.raiseEvent(Common.TraceEvents.Memory_TakeSnapshot_Stop);
            }, this.onSnapshotFailed.bind(this));
        };
        SummaryViewController.prototype.cancelPendingSnapshots = function () {
            if(this._snapshotSummaryPromise) {
                this._snapshotSummaryPromise.cancel();
                this._snapshotSummaryPromise = null;
            }
        };
        SummaryViewController.prototype.viewSnapshot = function (snapshotId, target, sortProperty) {
            var foundSnapshotSummary = this.getSnapshotSummary(snapshotId);
            if(foundSnapshotSummary) {
                MemoryAnalyzer.Program.traceWriter.raiseEvent(Common.TraceEvents.Memory_ViewSnapshot_Start);
                this._memoryAnalyzer.showSnapshotTab(foundSnapshotSummary.snapshotFile.relativePath, target, Plugin.Resources.getString("SnapshotNumber", foundSnapshotSummary.id), sortProperty).done(function () {
                    MemoryAnalyzer.Program.traceWriter.raiseEvent(Common.TraceEvents.Memory_ViewSnapshot_Stop);
                });
            }
        };
        SummaryViewController.prototype.compareSnapshots = function (lastSnapshotId, firstSnapshotId, target, sortProperty) {
            MemoryAnalyzer.Program.traceWriter.raiseEvent(Common.TraceEvents.Memory_CompareSnapshot_Start);
            if(lastSnapshotId < firstSnapshotId) {
                var tempId = lastSnapshotId;
                lastSnapshotId = firstSnapshotId;
                firstSnapshotId = tempId;
            }
            var snapshotsInfo = [];
            var lastSnapshotInfo = this.getSnapshotSummary(lastSnapshotId);
            var firstSnapshotInfo = this.getSnapshotSummary(firstSnapshotId);
            if(lastSnapshotInfo && firstSnapshotInfo) {
                for(var i = 0; i < this.model.snapshotSummaryCollection.length; i++) {
                    var s = this.model.snapshotSummaryCollection.getItem(i);
                    if(s.taken >= firstSnapshotInfo.taken && s.taken <= lastSnapshotInfo.taken) {
                        snapshotsInfo.push(s);
                    }
                }
                snapshotsInfo = snapshotsInfo.sort(function (a, b) {
                    return a.taken - b.taken;
                });
            }
            var snapshotFiles = [];
            for(var i = 0; i < snapshotsInfo.length; i++) {
                snapshotFiles.push(snapshotsInfo[i].snapshotFile.relativePath);
            }
            this._memoryAnalyzer.showDiffSnapshotTab(snapshotFiles, target, Plugin.Resources.getString("SnapshotNumberDiff", lastSnapshotId, firstSnapshotId), sortProperty).done(function () {
                MemoryAnalyzer.Program.traceWriter.raiseEvent(Common.TraceEvents.Memory_CompareSnapshot_Stop);
            });
        };
        SummaryViewController.prototype.setScreenshotSize = function (targetWidth, targetHeight, keepAspectRatio) {
            this._screenshotWidth = targetWidth;
            this._screenshotHeight = targetHeight;
            this._screenshotKeepAspectRatio = keepAspectRatio;
        };
        SummaryViewController.prototype.createTileView = function (snapshotSummary) {
            var model = new MemoryAnalyzer.SnapshotTileViewModel(snapshotSummary, this.model.snapshotSummaryCollection);
            var view = new MemoryAnalyzer.SnapshotTileView(this, model);
            this.model.snapshotSummaryCollection.registerCollectionChanged(view);
            return view;
        };
        SummaryViewController.prototype.reset = function () {
            SummaryViewController._nextIdentifier = 0;
            this.model.snapshotSummaryCollection.clear();
            MemoryAnalyzer.Program.onIdle();
        };
        SummaryViewController.prototype.removeExistingGraph = function () {
            this.view.removeExistingGraph();
        };
        SummaryViewController.prototype.getSnapshotSummary = function (snapshotId) {
            var foundSnapshotSummary = null;
            for(var i = 0; i < this.model.snapshotSummaryCollection.length; i++) {
                var snapshotSummary = this.model.snapshotSummaryCollection.getItem(i);
                if(snapshotSummary.id === snapshotId) {
                    foundSnapshotSummary = snapshotSummary;
                    break;
                }
            }
            return foundSnapshotSummary;
        };
        SummaryViewController.prototype.onSnapshotResult = function (relativePath, prevSnapshotRelativePath) {
            var _this = this;
            var timeTaken = new Date().getTime();
            var snapshotPath = MemoryAnalyzer.Program.shell.getSnapshotFullPath(this._storageId, relativePath);
            var prevSnapshotPath;
            if(prevSnapshotRelativePath) {
                prevSnapshotPath = MemoryAnalyzer.Program.shell.getSnapshotFullPath(this._storageId, prevSnapshotRelativePath);
            }
            this._snapshotSummaryPromise = MemoryAnalyzer.Program.memoryAnalyzerData.processSnapshotSummary(snapshotPath, prevSnapshotPath).then(function (snapshotSummary) {
                _this._snapshotSummaryPromise = null;
                _this.onSnapshotCompleted(relativePath, snapshotSummary, timeTaken);
            }, function (err) {
                _this._snapshotSummaryPromise = null;
                _this.onSnapshotFailed(err);
            });
        };
        SummaryViewController.prototype.onSnapshotCompleted = function (relativePath, snapshotSummary, timeTaken) {
            if(!snapshotSummary) {
                throw new Error(Plugin.Resources.getErrorString("JSPerf.1014"));
            }
            var id = ++SummaryViewController._nextIdentifier;
            var summary = new MemoryAnalyzer.SnapshotSummary(snapshotSummary, new MemoryAnalyzer.SnapshotFile(this._storageId, relativePath), timeTaken, id);
            this.model.snapshotSummaryCollection.add(summary);
            this.model.isTakingSnapshot = false;
            if(window.console && window.console.log) {
                window.console.log("Snapshot taken: " + summary.objectsCount + " objects.");
            }
            summary.save(function () {
                Notifications.notify(MemoryAnalyzer.MemoryNotifications.OnSnapshotProcessingCompleted, summary);
                Plugin.VS.Internal.CodeMarkers.fire(MemoryAnalyzer.CodeMarkerValues.perfBrowserTools_MemoryAnalyzerIdle);
            }, this.onSnapshotFailed.bind(this));
        };
        SummaryViewController.prototype.onSnapshotFailed = function (error) {
            if(!error) {
                throw new Error(Plugin.Resources.getErrorString("JSPerf.1015"));
            }
            error.message = Plugin.Resources.getString("SnapshotCreationFailed", error.message);
            this.model.latestSnapshotError = error;
            this.model.isTakingSnapshot = false;
            MemoryAnalyzer.Program.onIdle();
        };
        return SummaryViewController;
    })();
    MemoryAnalyzer.SummaryViewController = SummaryViewController;    
    var SummaryViewModel = (function (_super) {
        __extends(SummaryViewModel, _super);
        function SummaryViewModel(isOffline) {
                _super.call(this);
            this._warningMessage = "";
            this._latestSnapshotError = null;
            this._isTakingSnapshot = false;
            this._isAttached = false;
            this._isRunning = true;
            this._isOffline = true;
            this._isStartProfilingPromptVisible = true;
            this._isTargetCompatible = true;
            this._isOffline = isOffline;
            this._snapshotSummaryCollection = new MemoryAnalyzer.Controls.ObservableCollection();
        }
        Object.defineProperty(SummaryViewModel.prototype, "isStartEnabled", {
            get: function () {
                return ((this.isOffline && (this.isTargetCompatible || this._snapshotSummaryCollection.length > 0)) || this.isStartProfilingPromptVisible) && this.isAttached && this.isRunning;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SummaryViewModel.prototype, "isStopEnabled", {
            get: function () {
                return !this.isOffline && this.isAttached && this.isRunning;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SummaryViewModel.prototype, "snapshotSummaryCollection", {
            get: function () {
                return this._snapshotSummaryCollection;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SummaryViewModel.prototype, "isTakeSnapshotEnabled", {
            get: function () {
                return !this.isOffline && this.isAttached && this.isRunning && !this.isTakingSnapshot && this.isTargetCompatible;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SummaryViewModel.prototype, "isOffline", {
            get: function () {
                return this._isOffline;
            },
            set: function (v) {
                if(this._isOffline !== v) {
                    this._isOffline = v;
                    if(this._isOffline) {
                        this.isTakingSnapshot = false;
                    }
                    this.raisePropertyChanged("isOffline");
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SummaryViewModel.prototype, "warningMessage", {
            get: function () {
                return this._warningMessage;
            },
            set: function (v) {
                if(this._warningMessage !== v) {
                    this._warningMessage = v;
                    this.raisePropertyChanged("warningMessage");
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SummaryViewModel.prototype, "latestSnapshotError", {
            get: function () {
                return this._latestSnapshotError;
            },
            set: function (v) {
                if(this._latestSnapshotError !== v) {
                    this._latestSnapshotError = v;
                    this.raisePropertyChanged("latestSnapshotError");
                    MemoryAnalyzer.Program.reportError(v, "SnapshotCapturingFailure");
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SummaryViewModel.prototype, "isTakingSnapshot", {
            get: function () {
                return this._isTakingSnapshot;
            },
            set: function (v) {
                if(this._isTakingSnapshot !== v) {
                    this._isTakingSnapshot = v;
                    this.raisePropertyChanged("isTakingSnapshot");
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SummaryViewModel.prototype, "isAttached", {
            get: function () {
                return this._isAttached;
            },
            set: function (v) {
                if(this._isAttached !== v) {
                    this._isAttached = v;
                    this.raisePropertyChanged("isAttached");
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SummaryViewModel.prototype, "isRunning", {
            get: function () {
                return this._isRunning;
            },
            set: function (v) {
                if(this._isRunning !== v) {
                    this._isRunning = v;
                    this.raisePropertyChanged("isRunning");
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SummaryViewModel.prototype, "isTargetCompatible", {
            get: function () {
                return this._isTargetCompatible;
            },
            set: function (v) {
                if(this._isTargetCompatible !== v) {
                    this._isTargetCompatible = v;
                    this.raisePropertyChanged("isTargetCompatible");
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SummaryViewModel.prototype, "isStartProfilingPromptVisible", {
            get: function () {
                return this._isStartProfilingPromptVisible;
            },
            set: function (v) {
                if(this._isStartProfilingPromptVisible !== v) {
                    this._isStartProfilingPromptVisible = v;
                    this.raisePropertyChanged("isStartProfilingPromptVisible");
                }
            },
            enumerable: true,
            configurable: true
        });
        SummaryViewModel.prototype.getGraphUpdates = function (updateCallback) {
            this.graphCollectorSession.getGraphDataUpdate("Heap").done(function (data) {
                if(!data || data.length === 0) {
                    return;
                }
                var newPoints = [];
                newPoints.push({
                    Timestamp: data[0].timestamp,
                    Value: data[0].value,
                    ToolTip: null,
                    CustomData: null
                });
                var updatedSeries = [
                    {
                        DataSource: {
                            CounterId: SummaryView.PrivateBytesCounterId
                        },
                        NewPoints: newPoints
                    }
                ];
                var updateEventArgs = {
                    Timestamp: data[0].timestamp,
                    UpdatedSeries: updatedSeries
                };
                updateCallback(updateEventArgs);
            }, function (err) {
                MemoryAnalyzer.Program.reportError(err, Plugin.Resources.getErrorString("JSPerf.1062"));
            });
            this.graphCollectorSession.getGraphDataUpdate("performancemark").done(function (data) {
                if(!data || data.length === 0) {
                    return;
                }
                var newPoints = [];
                var maxTimestamp = data[0].timestamp;
                for(var i = 0; i < data.length; i++) {
                    maxTimestamp = Math.max(maxTimestamp, data[i].timestamp);
                    newPoints.push({
                        Timestamp: data[i].timestamp,
                        Value: data[i].value,
                        ToolTip: data[i].toolTip,
                        CustomData: null
                    });
                }
                var updatedSeries = [
                    {
                        DataSource: {
                            CounterId: SummaryView.ProfilerMarkCounterId
                        },
                        NewPoints: newPoints
                    }
                ];
                var updateEventArgs = {
                    Timestamp: maxTimestamp,
                    UpdatedSeries: updatedSeries
                };
                updateCallback(updateEventArgs);
            }, function (err) {
                MemoryAnalyzer.Program.reportError(err, Plugin.Resources.getErrorString("JSPerf.1063"));
            });
        };
        return SummaryViewModel;
    })(MemoryAnalyzer.Controls.ObservableViewModel);
    MemoryAnalyzer.SummaryViewModel = SummaryViewModel;    
    var SummaryView = (function (_super) {
        __extends(SummaryView, _super);
        function SummaryView(controller, model) {
            var _this = this;
                _super.call(this, "SummaryTabTemplate");
            this._graphUpdateDelayMilliseconds = 100;
            this._screenshotWidth = 280;
            this._screenshotHeight = 160;
            this._screenshotKeepAspectRatio = true;
            this._controller = controller;
            this._model = model;
            this._model.registerPropertyChanged(this);
            this._model.snapshotSummaryCollection.registerCollectionChanged(this);
            this._heapGraphContainer = this.findElement("heapOverviewGraph");
            this._tilesContainer = this.findElement("tilesContainer");
            this._warningSection = this.findElement("warningSection");
            this._onSnapshotClickHandler = this.onSnapshotClick.bind(this);
            var giveFeedbackButton = this.findElement("giveFeedbackButton_Summary");
            giveFeedbackButton.classList.add("hidden");
            MemoryAnalyzer.Program.internalFeedback.isEnabled().done(function (isEnabled) {
                if(isEnabled) {
                    giveFeedbackButton.classList.remove("hidden");
                    giveFeedbackButton.addEventListener("click", _this.onGiveFeedbackClick.bind(_this));
                }
            });
            this._takeSnapshotTile = this.findElement("takeSnapshotTile");
            if(this._model.isOffline) {
                this._takeSnapshotTile.style.display = "none";
            } else {
                this._snapshotError = this.findElement("snapshotError");
                this._snapshotErrorMsg = this.findElement("snapshotErrorMsg");
                this._snapshotProgress = this.findElement("takeSnapshotProgress");
                this._snapshotButton = this.findElement("takeSnapshotButton");
                this._snapshotLabel = this.findElement("takeSnapshotLabel");
                this._snapshotIcon = this.findElement("takeSnapshotIcon");
                this._snapshotLabel.innerText = Plugin.Resources.getString("TakeSnapshot");
                this._snapshotProgress.innerText = Plugin.Resources.getString("Loading");
                this.toggleProgress(this._model.isTakingSnapshot);
                this.toggleAttached(this._model.isAttached);
                this.updateTakeSnapshotButton();
                this._snapshotButton.addEventListener("click", this._onSnapshotClickHandler);
            }
            this._controller.setScreenshotSize(this._screenshotWidth, this._screenshotHeight, this._screenshotKeepAspectRatio);
        }
        SummaryView.PrivateBytesCounterId = "PrivateBytes";
        SummaryView.ProfilerMarkCounterId = "performancemark";
        SummaryView.prototype.onPropertyChanged = function (propertyName) {
            switch(propertyName) {
                case "warningMessage":
                    this.showWarningMessage(this._model.warningMessage);
                    break;
                case "latestSnapshotError":
                    this.showSnapshotError(this._model.latestSnapshotError);
                    break;
                case "isTakingSnapshot":
                    this.toggleProgress(this._model.isTakingSnapshot);
                    this.updateTakeSnapshotButton();
                    break;
                case "isAttached":
                case "isTargetCompatible":
                    this.toggleAttached(this._model.isAttached);
                    this.updateTakeSnapshotButton();
                    break;
                case "isRunning":
                    this.toggleRunning(this._model.isOffline, this._model.isAttached, this._model.isRunning);
                    this.updateTakeSnapshotButton();
                    break;
                case "isOffline":
                    this.toggleOffline(this._model.isOffline, this._model.isAttached, this._model.isRunning);
                    this.updateTakeSnapshotButton();
                    break;
            }
        };
        SummaryView.prototype.onCollectionChanged = function (eventArgs) {
            switch(eventArgs.action) {
                case MemoryAnalyzer.Controls.NotifyCollectionChangedAction.Add:
                    this.createTile(eventArgs.newItems[0]);
                    break;
                case MemoryAnalyzer.Controls.NotifyCollectionChangedAction.Reset:
                    this.removeSnapshotTiles();
                    break;
            }
        };
        SummaryView.prototype.refreshGraph = function () {
            if(this._graphRenderer) {
                this._graphRenderer.refresh();
            }
        };
        SummaryView.prototype.removeExistingGraph = function () {
            if(this._graphRenderer) {
                this._graphRenderer.deinitialize();
            }
            this._heapGraphContainer.innerHTML = "";
            this._heapGraphContainer.style.display = "none";
        };
        SummaryView.prototype.startGraph = function () {
            var _this = this;
            var qpcStartTime = Plugin.F12.getQpcTime();
            var qpcFrequency = Plugin.F12.getQpcFrequency();
            this.removeExistingGraph();
            var jsonConfig = {
                Series: [
                    {
                        SeriesType: "Line",
                        Legend: Plugin.Resources.getString("HubGraphHeapLegend"),
                        DataSource: {
                            CounterId: SummaryView.PrivateBytesCounterId
                        }
                    }, 
                    {
                        SeriesType: "Mark",
                        Legend: "",
                        DataSource: {
                            CounterId: SummaryView.ProfilerMarkCounterId
                        }
                    }
                ],
                MinValue: 0,
                MaxValue: 100,
                Unit: "",
                Units: [
                    {
                        Unit: Plugin.Resources.getString("ByteUnits"),
                        FromValue: Number.MIN_VALUE,
                        ToValue: 1023,
                        Divider: 1,
                        Decimals: 1
                    }, 
                    {
                        Unit: Plugin.Resources.getString("KilobyteUnits"),
                        FromValue: Number.MIN_VALUE,
                        ToValue: 1048575,
                        Divider: 1024,
                        Decimals: 1
                    }, 
                    {
                        Unit: Plugin.Resources.getString("MegabyteUnits"),
                        FromValue: Number.MIN_VALUE,
                        ToValue: 1073741823,
                        Divider: 1048576,
                        Decimals: 1
                    }, 
                    {
                        Unit: Plugin.Resources.getString("GigabyteUnits"),
                        FromValue: Number.MIN_VALUE,
                        ToValue: Number.MAX_VALUE,
                        Divider: 1073741824,
                        Decimals: 1
                    }
                ],
                Axes: null
            };
            var liveGraphConfig = {
                Title: Plugin.Resources.getString("GraphTitle"),
                Description: "",
                JsonConfiguration: JSON.stringify(jsonConfig)
            };
            var liveConfig = {
                GraphConfigurations: [
                    liveGraphConfig
                ],
                WindowsZoomLevel: {
                    X: 1,
                    Y: 1
                },
                QpcTimeProperties: {
                    CollectionStartTime: qpcStartTime,
                    Frequency: qpcFrequency
                }
            };
            var dataManager = {
                getConfigurations: function (configCallback) {
                    configCallback(liveConfig);
                },
                dataUpdate: function (dataUpdateCallback) {
                    _this._graphUpdateIntervalId = window.setInterval(function () {
                        return _this._model.getGraphUpdates(dataUpdateCallback);
                    }, _this._graphUpdateDelayMilliseconds);
                }
            };
            var rendererArgs = {
                swimlane: {
                    leftScale: {
                        isVisible: true,
                        width: 40
                    },
                    rightScale: {
                        isVisible: true,
                        width: 40
                    },
                    graph: {
                        height: 88
                    },
                    minSelectionWidthInPixels: 10,
                    isSelectionEnabled: false,
                    isZoomEnabled: false
                },
                isToolbarRequired: false,
                dataManager: dataManager,
                containerId: this._heapGraphContainer.id
            };
            this._graphRenderer = new Microsoft.VisualStudio.DiagnosticsHub.LiveRenderer(rendererArgs);
            this._graphRenderer.execute();
            this._heapGraphContainer.style.display = "-ms-grid";
        };
        SummaryView.prototype.stopGraph = function () {
            window.clearInterval(this._graphUpdateIntervalId);
        };
        SummaryView.prototype.onGiveFeedbackClick = function (e) {
            this._controller.giveFeedback();
        };
        SummaryView.prototype.createTile = function (snapshotSummary) {
            var newTile = this._controller.createTileView(snapshotSummary);
            this._tilesContainer.insertBefore(newTile.rootElement, this._takeSnapshotTile);
            newTile.rootElement.scrollIntoView(true);
            newTile.setFocus();
        };
        SummaryView.prototype.removeSnapshotTiles = function () {
            while(this._tilesContainer.hasChildNodes()) {
                this._tilesContainer.removeChild(this._tilesContainer.firstChild);
            }
            this._tilesContainer.appendChild(this._takeSnapshotTile);
        };
        SummaryView.prototype.toggleAttached = function (isAttached) {
            if(!isAttached) {
                this._controller.cancelPendingSnapshots();
            }
        };
        SummaryView.prototype.toggleOffline = function (isOffline, isAttached, isRunning) {
            this._takeSnapshotTile.style.display = isOffline ? "none" : "block";
            if(!isOffline && isAttached && isRunning) {
                this._controller.startGraphCollectorSession();
            } else {
                this._controller.stopGraphCollectorSession();
            }
        };
        SummaryView.prototype.toggleProgress = function (show) {
            if(this._snapshotProgress && this._snapshotError) {
                if(show) {
                    this._snapshotLabel.style.display = "none";
                    this._snapshotIcon.style.display = "none";
                    this._snapshotProgress.style.display = "block";
                    this._snapshotError.style.display = "none";
                    this._snapshotButton.setAttribute("aria-label", Plugin.Resources.getString("Loading"));
                } else {
                    this._snapshotLabel.style.display = "";
                    this._snapshotIcon.style.display = "";
                    this._snapshotProgress.style.display = "none";
                    this._snapshotButton.setAttribute("aria-label", Plugin.Resources.getString("TakeSnapshot"));
                }
            }
        };
        SummaryView.prototype.toggleRunning = function (isOffline, isAttached, isRunning) {
            if(!isOffline && isAttached && isRunning) {
                this._controller.startGraphCollectorSession();
            } else {
                this._controller.stopGraphCollectorSession();
            }
        };
        SummaryView.prototype.showSnapshotError = function (error) {
            if(this._snapshotErrorMsg && this._snapshotError) {
                if(error) {
                    this._snapshotErrorMsg.innerText = MemoryAnalyzer.ErrorFormatter.format(error);
                    this._snapshotError.style.display = "block";
                } else {
                    this._snapshotErrorMsg.innerText = "";
                    this._snapshotError.style.display = "none";
                }
            }
        };
        SummaryView.prototype.showWarningMessage = function (warning) {
            if(!this._warningSection) {
                return;
            }
            if(warning) {
                this._warningSection.innerHTML = warning;
                this._warningSection.style.display = "inline";
            } else {
                this._warningSection.innerHTML = "";
                this._warningSection.style.display = "none";
            }
        };
        SummaryView.prototype.onSnapshotClick = function (e) {
            this._controller.takeSnapshot();
        };
        SummaryView.prototype.updateTakeSnapshotButton = function () {
            if(this._snapshotButton) {
                if(this._model.isTakeSnapshotEnabled) {
                    this._snapshotButton.classList.remove("disabled");
                    this._snapshotButton.disabled = false;
                } else {
                    if(!this._model.isTakingSnapshot) {
                        this._snapshotButton.classList.add("disabled");
                    }
                    this._snapshotButton.disabled = true;
                }
            }
        };
        return SummaryView;
    })(Common.Controls.TemplateControl);
    MemoryAnalyzer.SummaryView = SummaryView;    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=summaryView.js.map

// CodeMarkerValues.ts
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    (function (CodeMarkerValues) {
        CodeMarkerValues._map = [];
        CodeMarkerValues.perfBrowserTools_MemoryAnalyzerViewLoaded = 23589;
        CodeMarkerValues.perfBrowserTools_MemoryAnalyzerIdle = 23590;
        CodeMarkerValues.perfBrowserTools_MemoryAnalyzerWindowClose = 23591;
        CodeMarkerValues.perfBrowserTools_MemoryAnalyzerSessionEnd = 23592;
    })(MemoryAnalyzer.CodeMarkerValues || (MemoryAnalyzer.CodeMarkerValues = {}));
    var CodeMarkerValues = MemoryAnalyzer.CodeMarkerValues;
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=CodeMarkerValues.js.map

// memoryNotifications.ts
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    var MemoryNotifications = (function () {
        function MemoryNotifications() { }
        MemoryNotifications.Idle = "MemoryNotifications.Idle";
        MemoryNotifications.WindowClose = "MemoryNotifications.WindowClose";
        MemoryNotifications.SessionEnd = "MemoryNotifications.SessionEnd";
        MemoryNotifications.DetailsViewRowSelected = "MemoryNotifications.DetailsViewRowSelected";
        MemoryNotifications.OnSnapshotProcessingCompleted = "MemoryNotifications.OnSnapshotProcessingCompleted";
        MemoryNotifications.SnapshotDataViewReady = "MemoryNotifications.SnapshotDataViewReady";
        return MemoryNotifications;
    })();
    MemoryAnalyzer.MemoryNotifications = MemoryNotifications;    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=memoryNotifications.js.map

// diagnosticsToolWindow.ts
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    
    var DiagnosticsToolWindowController = (function () {
        function DiagnosticsToolWindowController(isOffline, diagSession) {
            var _this = this;
            this._callbacks = {
            };
            this._pendingMessages = [];
            this._pendingTimeout = null;
            this._listeningToMessages = true;
            this._diagnosticSession = diagSession;
            if(!isOffline) {
                this.DiagnosticSession.addEventListener("break", this.onBreakCallback.bind(this));
                this.DiagnosticSession.addEventListener("run", this.onRunCallback.bind(this));
                this.DiagnosticSession.addEventListener("detach", this.onDetachCallback.bind(this));
                this.DiagnosticSession.addEventListener("connect", this.onConnectCallback.bind(this));
                this.DiagnosticSession.addEventListener("attach", this.onAttachCallback.bind(this));
                window.setImmediate(function () {
                    if(!_this._isAttached) {
                        _this.DiagnosticSession.isAttached().done(function (isAttached) {
                            if(isAttached) {
                                _this.onAttachCallback();
                            } else {
                                _this.showWarning(Plugin.Resources.getString("WarningNotAttached"));
                            }
                        }, function (err) {
                            _this.showWarning(Plugin.Resources.getString("WarningNotAttached"));
                        });
                    }
                });
            }
        }
        DiagnosticsToolWindowController._uid = 0;
        Object.defineProperty(DiagnosticsToolWindowController.prototype, "DiagnosticSession", {
            get: function () {
                return this._diagnosticSession;
            },
            enumerable: true,
            configurable: true
        });
        DiagnosticsToolWindowController.prototype.onAttach = function () {
        };
        DiagnosticsToolWindowController.prototype.onDetach = function () {
        };
        DiagnosticsToolWindowController.prototype.onBreak = function () {
        };
        DiagnosticsToolWindowController.prototype.onRun = function () {
        };
        DiagnosticsToolWindowController.prototype.onConnect = function (port) {
        };
        DiagnosticsToolWindowController.prototype.onMessage = function (data) {
        };
        DiagnosticsToolWindowController.prototype.onHandshake = function (connectionInfo) {
        };
        DiagnosticsToolWindowController.prototype.showWarning = function (message) {
        };
        DiagnosticsToolWindowController.prototype.callProxy = function (command) {
            var _this = this;
            var uidString = DiagnosticsToolWindowController.getUid();
            if(command.executedHandler) {
                this._callbacks[uidString] = {
                    command: command,
                    callback: command.executedHandler,
                    deleteAfterCallback: true
                };
            }
            var newArgs = [];
            if(command.args) {
                for(var i = 0; i < command.args.length; i++) {
                    var arg = command.args[i];
                    newArgs.push(arg);
                }
            }
            if(command.dataReceivedHandler) {
                var callbackUid = DiagnosticsToolWindowController.getUid();
                this._callbacks[callbackUid] = {
                    command: command,
                    callback: command.dataReceivedHandler,
                    deleteAfterCallback: false
                };
                newArgs.push({
                    uid: callbackUid,
                    type: "callback"
                });
            }
            var jsonObj = {
                uid: uidString,
                command: command.name,
                args: newArgs
            };
            var sendMessageToRemote = function (message) {
                if(_this._remotePort) {
                    _this._remotePort.postMessage(message);
                }
            };
            this._pendingMessages.push(jsonObj);
            if(!this._pendingTimeout) {
                this._pendingTimeout = window.setImmediate(function () {
                    var message = JSON.stringify(_this._pendingMessages);
                    _this._pendingMessages = [];
                    _this._pendingTimeout = null;
                    sendMessageToRemote(message);
                });
            }
        };
        DiagnosticsToolWindowController.prototype.startListeningToMessages = function () {
            this._listeningToMessages = true;
        };
        DiagnosticsToolWindowController.prototype.stopListeningToMessages = function () {
            this._listeningToMessages = false;
        };
        DiagnosticsToolWindowController.getUid = function getUid() {
            return "uid" + (DiagnosticsToolWindowController._uid++).toString(36);
        };
        DiagnosticsToolWindowController.prototype.fireCallbacks = function (data) {
            var msgs = JSON.parse(data);
            for(var i = 0; i < msgs.length; i++) {
                var obj = msgs[i];
                var callback = this._callbacks[obj.uid];
                if(callback) {
                    if(obj.args !== undefined) {
                        callback.callback.apply(this, obj.args);
                    }
                    if(callback.deleteAfterCallback || callback.command.hasCompleted) {
                        delete this._callbacks[obj.uid];
                    }
                } else if(obj.uid === "scriptError") {
                    Plugin.Diagnostics.reportError(obj.args[0].message, obj.args[0].file, obj.args[0].line, obj.args[0].additionalInfo);
                }
            }
        };
        DiagnosticsToolWindowController.prototype.onAttachCallback = function () {
            if(!this._isAttached) {
                this._isAttached = true;
                this.showWarning(null);
                this.onAttach();
            }
        };
        DiagnosticsToolWindowController.prototype.onDetachCallback = function () {
            this._remotePort = null;
            this._callbacks = {
            };
            this._pendingMessages = [];
            this._pendingTimeout = null;
            this._isAttached = false;
            this.showWarning(Plugin.Resources.getString("WarningNotAttached"));
            this.onDetach();
        };
        DiagnosticsToolWindowController.prototype.onBreakCallback = function () {
            this.onBreak();
        };
        DiagnosticsToolWindowController.prototype.onRunCallback = function () {
            this.onRun();
        };
        DiagnosticsToolWindowController.prototype.onMessageCallback = function (args) {
            var _this = this;
            var data = args.data;
            var isHandshake = this.processHandshakeMessage(data);
            if(this._listeningToMessages) {
                if(data === "DocumentNotYetReady") {
                    window.setTimeout(function () {
                        _this._remotePort.postMessage("InitializeDocument");
                    }, 100);
                } else if(!isHandshake) {
                    this.fireCallbacks(data);
                }
                this.onMessage(data);
            }
        };
        DiagnosticsToolWindowController.prototype.onConnectCallback = function (port) {
            this._remotePort = port;
            this._remotePort.addEventListener("message", this.onMessageCallback.bind(this));
            this.onConnect(port);
        };
        DiagnosticsToolWindowController.prototype.processHandshakeMessage = function (data) {
            if(data.substr(0, 10) === "Handshake:") {
                var connectionInfo = JSON.parse(data.substring(10));
                this.onHandshake(connectionInfo);
                return true;
            }
            return false;
        };
        return DiagnosticsToolWindowController;
    })();
    MemoryAnalyzer.DiagnosticsToolWindowController = DiagnosticsToolWindowController;    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=diagnosticsToolWindow.js.map

// memoryAnalyzer.ts
var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var DiagnosticsHub = Microsoft.VisualStudio.DiagnosticsHub;
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    var MemoryAnalyzerController = (function (_super) {
        __extends(MemoryAnalyzerController, _super);
        function MemoryAnalyzerController(sessionInfo, diagSession) {
                _super.call(this, sessionInfo.isOffline, diagSession);
            var isOffline = sessionInfo.isOffline;
            this._summaryViewController = new MemoryAnalyzer.SummaryViewController(this, sessionInfo.storageId, isOffline);
            if(isOffline) {
                this._view = new MemoryAnalyzer.SummaryTab(this.summaryViewController);
                this.summaryViewController.loadExistingSnapshots();
            } else {
                this._view = new MemoryAnalyzerView(this);
                this.initCommands();
                var hubSession = DiagnosticsHub.getCurrentSession();
                if(hubSession) {
                    hubSession.addStateChangedEventListener(this.onDiagnosticsHubStateChanged.bind(this, hubSession));
                }
            }
        }
        Object.defineProperty(MemoryAnalyzerController.prototype, "summaryViewController", {
            get: function () {
                return this._summaryViewController;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(MemoryAnalyzerController.prototype, "view", {
            get: function () {
                return this._view;
            },
            enumerable: true,
            configurable: true
        });
        MemoryAnalyzerController.prototype.clearSummaryTab = function () {
            this._summaryViewController.reset();
        };
        MemoryAnalyzerController.prototype.goOffline = function () {
            if(!this._summaryViewController.model.isOffline) {
                this.stopListeningToMessages();
                this._summaryViewController.model.isOffline = true;
            }
        };
        MemoryAnalyzerController.prototype.goOnline = function () {
            if(this._summaryViewController.model.isOffline) {
                this.startListeningToMessages();
                this._summaryViewController.model.isOffline = false;
            }
        };
        MemoryAnalyzerController.prototype.removeExistingGraph = function () {
            this._summaryViewController.removeExistingGraph();
        };
        MemoryAnalyzerController.prototype.takeSnapshot = function () {
            this._summaryViewController.takeSnapshot();
        };
        MemoryAnalyzerController.prototype.showWarning = function (message) {
            if(this._summaryViewController) {
                this._summaryViewController.model.warningMessage = message;
            }
        };
        MemoryAnalyzerController.prototype.onAttach = function () {
            this.DiagnosticSession.loadScriptInProc("../Common/RemoteHelpers.js");
            this.DiagnosticSession.loadScriptInProc("Remote.js");
        };
        MemoryAnalyzerController.prototype.onDetach = function () {
            this._summaryViewController.model.isAttached = false;
            this.goOffline();
        };
        MemoryAnalyzerController.prototype.onBreak = function () {
            this._summaryViewController.model.isRunning = false;
        };
        MemoryAnalyzerController.prototype.onRun = function () {
            this._summaryViewController.model.isRunning = true;
        };
        MemoryAnalyzerController.prototype.onHandshake = function (connectionInfo) {
            this._summaryViewController.model.isAttached = true;
            if(connectionInfo.docMode < Common.Constants.minimumRequiredDocumentMode) {
                if(!this._summaryViewController.model.isOffline) {
                    this.showWarning(MemoryAnalyzer.Program.shell.getHostSpecificString("WarningIncompatibleStandardsMode"));
                }
                this._summaryViewController.model.isTargetCompatible = false;
            } else {
                MemoryAnalyzer.Program.traceWriter.raiseEvent(Common.TraceEvents.Memory_ToolReady_Start);
                if(!this._summaryViewController.model.isOffline) {
                    this.showWarning(null);
                }
                this._summaryViewController.model.isTargetCompatible = true;
                this._summaryViewController.model.isTakingSnapshot = false;
                if(!this._summaryViewController.model.isOffline) {
                    this._summaryViewController.reset();
                    MemoryAnalyzer.Program.shell.closeAllSnapshots();
                } else if(this._summaryViewController.model.snapshotSummaryCollection.length === 0) {
                    this._summaryViewController.reset();
                    MemoryAnalyzer.Program.shell.closeAllSnapshots();
                    MemoryAnalyzer.Program.shell.resetView();
                }
                var command = new MemoryAnalyzer.RegisterConsoleCallbacksCommand(this.consoleNotifyCallback);
                this.callProxy(command);
                MemoryAnalyzer.Program.traceWriter.raiseEvent(Common.TraceEvents.Memory_ToolReady_Stop);
            }
        };
        MemoryAnalyzerController.prototype.showSnapshotTab = function (relativePath, targetView, tabName, sortProperty) {
            if(!relativePath) {
                return Plugin.Promise.as(null);
            }
            return MemoryAnalyzer.Program.shell.openSnapshot(relativePath, targetView, tabName, sortProperty);
        };
        MemoryAnalyzerController.prototype.showDiffSnapshotTab = function (snapshotNames, targetView, tabName, sortProperty) {
            if(!snapshotNames || snapshotNames.length < 2) {
                return Plugin.Promise.as(null);
            }
            return MemoryAnalyzer.Program.shell.openSnapshotDiff(snapshotNames, targetView, tabName, sortProperty);
            ;
        };
        MemoryAnalyzerController.prototype.updateCommandState = function () {
            if(Plugin.VS && Plugin.VS.Commands) {
                Plugin.VS.Commands.setStates({
                    command: this._takeSnapshotCommand,
                    enabled: this.canTakeSnapshot(),
                    visible: this.canShowTakeSnapshot()
                });
            }
        };
        MemoryAnalyzerController.prototype.consoleNotifyCallback = function (args) {
            if(!this.summaryViewController.model.isTargetCompatible) {
                return;
            }
            var functionId = args.notifyType;
            var data = args.message;
            if(functionId === "takeHeapSnapshot") {
                this.takeSnapshot();
            }
        };
        MemoryAnalyzerController.prototype.canTakeSnapshot = function () {
            var summaryModel = this._summaryViewController.model;
            return summaryModel.isAttached && summaryModel.isRunning && !summaryModel.isTakingSnapshot && !summaryModel.isOffline;
        };
        MemoryAnalyzerController.prototype.canShowTakeSnapshot = function () {
            var summaryModel = this._summaryViewController.model;
            return summaryModel.isAttached && summaryModel.isRunning && !summaryModel.isOffline;
        };
        MemoryAnalyzerController.prototype.initCommands = function () {
            if(Plugin.VS && Plugin.VS.Commands) {
                this._takeSnapshotCommand = Plugin.VS.Commands.bindCommand({
                    name: "takesnapshotcommand",
                    onexecute: this.onTakeSnapshotCommand.bind(this),
                    enabled: this.canTakeSnapshot(),
                    visible: this.canShowTakeSnapshot()
                });
            }
        };
        MemoryAnalyzerController.prototype.onDiagnosticsHubStateChanged = function (hubSession, args) {
            if(args.previousState === DiagnosticsHub.SessionState.CollectionStarted && args.currentState === DiagnosticsHub.SessionState.CollectionFinishing) {
                hubSession.removeStateChangedEventListener(this.onDiagnosticsHubStateChanged.bind(this, hubSession));
                var eventCompleteDeferral = args.getDeferral();
                var onSaveCompleted = function () {
                    Notifications.notify(MemoryAnalyzer.MemoryNotifications.SessionEnd);
                    MemoryAnalyzer.Program.fireCodeMarker(MemoryAnalyzer.CodeMarkerValues.perfBrowserTools_MemoryAnalyzerSessionEnd);
                    eventCompleteDeferral.complete();
                };
                this._summaryViewController.save().done(onSaveCompleted, onSaveCompleted);
            }
        };
        MemoryAnalyzerController.prototype.onTakeSnapshotCommand = function () {
            this.takeSnapshot();
        };
        return MemoryAnalyzerController;
    })(MemoryAnalyzer.DiagnosticsToolWindowController);
    MemoryAnalyzer.MemoryAnalyzerController = MemoryAnalyzerController;    
    var MemoryAnalyzerView = (function (_super) {
        __extends(MemoryAnalyzerView, _super);
        function MemoryAnalyzerView(controller) {
                _super.call(this);
            this._controller = controller;
            this.title = Plugin.Resources.getString("Summary").toLocaleUpperCase();
            this.tooltipString = Plugin.Resources.getString("SummaryTabTooltip");
            this.content = new MemoryAnalyzer.SummaryTab(this._controller.summaryViewController);
            this._controller.summaryViewController.model.registerPropertyChanged(this);
        }
        MemoryAnalyzerView.prototype.onPropertyChanged = function (propertyName) {
            var model = this._controller.summaryViewController.model;
            switch(propertyName) {
                case "isTakingSnapshot":
                case "isAttached":
                case "isRunning":
                case "isOffline":
                    this._controller.updateCommandState();
                    break;
            }
        };
        MemoryAnalyzerView.prototype.onActiveChanged = function () {
            if(this.active) {
                var summaryView = this._controller.summaryViewController.view;
                if(summaryView) {
                    summaryView.refreshGraph();
                }
            }
        };
        return MemoryAnalyzerView;
    })(MemoryAnalyzer.Controls.TabItem);
    MemoryAnalyzer.MemoryAnalyzerView = MemoryAnalyzerView;    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=memoryAnalyzer.js.map

// memoryAnalyzerData.ts
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    (function (Data) {
        "use strict";
        var MemoryAnalyzerData = (function () {
            function MemoryAnalyzerData(memoryAnalyzerProxy) {
                this._proxy = memoryAnalyzerProxy;
                if(!this._proxy) {
                    throw new Error(Plugin.Resources.getErrorString("JSPerf.1065"));
                }
            }
            MemoryAnalyzerData.prototype.processSnapshotSummary = function (snapshotFile, prevSnapshotFile) {
                if (typeof prevSnapshotFile === "undefined") { prevSnapshotFile = ""; }
                var _this = this;
                return new Plugin.Promise(function (completed, error) {
                    _this._proxy.processSnapshotSummary(snapshotFile, prevSnapshotFile, function (localSnapshotSummary) {
                        completed(localSnapshotSummary);
                    }, function (hr) {
                        if(error) {
                            error(MemoryAnalyzerData.GetErrorFromHr(hr));
                        }
                    }, function () {
                    });
                });
            };
            MemoryAnalyzerData.prototype.processSnapshot = function (snapshotFile) {
                var _this = this;
                return new Plugin.Promise(function (completed, error, progress) {
                    _this._proxy.processSnapshot(snapshotFile, function (proxy) {
                        completed(new SnapshotData(proxy));
                    }, function (hr) {
                        if(error) {
                            error(MemoryAnalyzerData.GetErrorFromHr(hr));
                        }
                    }, function (progValue) {
                        if(progress) {
                            progress(progValue);
                        }
                    });
                });
            };
            MemoryAnalyzerData.prototype.processSnapshotDiff = function (snapshotFiles) {
                var _this = this;
                return new Plugin.Promise(function (completed, error, progress) {
                    _this._proxy.processSnapshotDiff(snapshotFiles, function (proxy) {
                        completed(new SnapshotData(proxy));
                    }, function (hr) {
                        if(error) {
                            error(MemoryAnalyzerData.GetErrorFromHr(hr));
                        }
                    }, function (progValue) {
                        if(progress) {
                            progress(progValue);
                        }
                    });
                });
            };
            MemoryAnalyzerData.GetErrorFromHr = function GetErrorFromHr(hr) {
                if(hr < 0) {
                    hr = 0xFFFFFFFF + hr + 1;
                }
                switch(hr) {
                    case 0x8007000E:
                    case 0x89790008:
                        return new Error(Plugin.Resources.getString("ERRoutOfMemory"));
                    case 0x89790001:
                        return new Error(Plugin.Resources.getString("ERRbadHexDigit"));
                    case 0x89790002:
                        return new Error(Plugin.Resources.getString("ERRbadNumber"));
                    case 0x89790003:
                        return new Error(Plugin.Resources.getString("ERRillegalChar"));
                    case 0x89790005:
                        return new Error(Plugin.Resources.getString("ERRnoColon"));
                    case 0x89790006:
                        return new Error(Plugin.Resources.getString("ERRnoRbrack"));
                    case 0x89790007:
                        return new Error(Plugin.Resources.getString("ERRnoRcurly"));
                    case 0x89790009:
                        return new Error(Plugin.Resources.getString("ERRnoStrEnd"));
                    case 0x8979000a:
                        return new Error(Plugin.Resources.getString("ERRsyntax"));
                    case 0x8979000c:
                        return new Error(Plugin.Resources.getString("ERRmissingObjectId"));
                    case 0x8979000d:
                        return new Error(Plugin.Resources.getString("ERRinvalidObjectID"));
                }
                return new Error(Plugin.Resources.getString("ERRunknownError", "0x" + hr.toString(16).toUpperCase()));
            };
            return MemoryAnalyzerData;
        })();
        Data.MemoryAnalyzerData = MemoryAnalyzerData;        
        var SnapshotData = (function () {
            function SnapshotData(proxy) {
                this._heapObjectCache = {
                };
                this._proxy = proxy;
                if(!this._proxy) {
                    throw new Error(Plugin.Resources.getErrorString("JSPerf.1066"));
                }
            }
            SnapshotData.prototype.getChildrenForObject = function (objectId, startIndex, maxResult, filter) {
                if (typeof startIndex === "undefined") { startIndex = 0; }
                if (typeof maxResult === "undefined") { maxResult = -1; }
                filter = this.getFilter(filter);
                var dataSet = this._proxy.getChildrenForObject(objectId, startIndex, maxResult, filter.showBuiltIns, filter.showUnknownSizes, filter.showUnknownTypes);
                this.performObjectCaching(dataSet);
                return dataSet;
            };
            SnapshotData.prototype.getDominators = function (startIndex, maxResult, textFilter, filter) {
                if (typeof startIndex === "undefined") { startIndex = 0; }
                if (typeof maxResult === "undefined") { maxResult = -1; }
                if (typeof textFilter === "undefined") { textFilter = ""; }
                var _this = this;
                var requestId;
                return new Plugin.Promise(function (completed, error) {
                    requestId = _this._proxy.getDominators(startIndex, maxResult, textFilter, filter.showBuiltIns, filter.showUnknownSizes, filter.showUnknownTypes, function (dataSetArg) {
                        _this.performObjectCaching(dataSetArg);
                        completed(dataSetArg);
                    }, function (hr) {
                        if(error) {
                            error(MemoryAnalyzerData.GetErrorFromHr(hr));
                        }
                    });
                }, function () {
                    if(typeof requestId !== "undefined") {
                        _this._proxy.cancelRequest(requestId);
                    }
                });
            };
            SnapshotData.prototype.getObjectsByType = function (type, startIndex, maxResult, filter) {
                if (typeof startIndex === "undefined") { startIndex = 0; }
                if (typeof maxResult === "undefined") { maxResult = -1; }
                filter = this.getFilter(filter);
                var dataSet = this._proxy.getObjectsByType(type, startIndex, maxResult, filter.showBuiltIns, filter.showUnknownSizes, filter.showUnknownTypes);
                this.performObjectCaching(dataSet);
                return dataSet;
            };
            SnapshotData.prototype.getPathToRoot = function (objectId, parentObjectId, filter) {
                if (typeof parentObjectId === "undefined") { parentObjectId = 0; }
                filter = this.getFilter(filter);
                return this._proxy.getPathToRoot(objectId, parentObjectId, filter.showBuiltIns, filter.showUnknownSizes, filter.showUnknownTypes);
            };
            SnapshotData.prototype.getRootObjects = function (filter) {
                filter = this.getFilter(filter);
                var dataSet = this._proxy.getRootObjects(filter.showBuiltIns, filter.showUnknownSizes, filter.showUnknownTypes);
                this.performObjectCaching(dataSet);
                return dataSet;
            };
            SnapshotData.prototype.getTypes = function (textFilter, filter) {
                if (typeof textFilter === "undefined") { textFilter = ""; }
                var _this = this;
                filter = this.getFilter(filter);
                var requestId;
                return new Plugin.Promise(function (completed, error) {
                    requestId = _this._proxy.getTypes(textFilter, filter.showBuiltIns, filter.showUnknownSizes, filter.showUnknownTypes, function (typesArg) {
                        completed(typesArg);
                    }, function (hr) {
                        if(error) {
                            error(MemoryAnalyzerData.GetErrorFromHr(hr));
                        }
                    });
                }, function () {
                    if(typeof requestId !== "undefined") {
                        _this._proxy.cancelRequest(requestId);
                    }
                });
            };
            SnapshotData.prototype.getRetainedDescendants = function (objectId, startIndex, maxResult, filter) {
                if (typeof startIndex === "undefined") { startIndex = 0; }
                if (typeof maxResult === "undefined") { maxResult = -1; }
                filter = this.getFilter(filter);
                var dataSet = this._proxy.getRetainedDescendants(objectId, startIndex, maxResult, filter.showBuiltIns, filter.showUnknownSizes, filter.showUnknownTypes);
                this.performObjectCaching(dataSet);
                return dataSet;
            };
            SnapshotData.prototype.getReferenceTreeItems = function (rootObjectId, objectId, nodeId, includeCircularReferences) {
                var dataSet = this._proxy.getReferenceTreeItems(rootObjectId, objectId, nodeId || 0, includeCircularReferences);
                this.performObjectCaching(dataSet);
                return dataSet;
            };
            SnapshotData.prototype.hasDetachedDomNodes = function () {
                return this._proxy.hasDetachedDomNodes();
            };
            SnapshotData.prototype.getFilter = function (filter) {
                var newFilter = {
                };
                filter = filter || {
                };
                newFilter.showBuiltIns = filter.showBuiltIns || false;
                newFilter.showUnknownSizes = filter.showUnknownSizes || false;
                newFilter.showUnknownTypes = filter.showUnknownTypes || false;
                return newFilter;
            };
            SnapshotData.prototype.performObjectCaching = function (dataSet) {
                var nodes = dataSet.result;
                if(nodes && nodes.length > 0) {
                    for(var i = 0; i < nodes.length; i++) {
                        var node = nodes[i];
                        if(typeof node.object !== "undefined") {
                            var obj = node.object;
                            this._heapObjectCache[obj.objectId] = obj;
                        } else if(typeof node.objectId !== "undefined") {
                            node.object = this._heapObjectCache[node.objectId];
                        }
                    }
                }
            };
            return SnapshotData;
        })();
        Data.SnapshotData = SnapshotData;        
    })(MemoryAnalyzer.Data || (MemoryAnalyzer.Data = {}));
    var Data = MemoryAnalyzer.Data;
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=memoryAnalyzerData.js.map

// memoryAnalyzerShell.ts
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    var MemoryAnalyzerShell = (function () {
        function MemoryAnalyzerShell(session) {
            this._session = session;
        }
        Object.defineProperty(MemoryAnalyzerShell.prototype, "session", {
            get: function () {
                return this._session;
            },
            enumerable: true,
            configurable: true
        });
        MemoryAnalyzerShell.prototype.createSnapshot = function () {
            var _this = this;
            return new Plugin.Promise(function (completed, failed) {
                _this._session.getSessionInfo().then(function (sessionInfo) {
                    var relativePath = _this._session.getNewSnapshotRelativePath();
                    var filePath = sessionInfo.storageId + "\\" + relativePath;
                    return Plugin.Storage.openFile(filePath, {
                        access: Plugin.Storage.FileAccess.write,
                        encoding: "UTF-8",
                        mode: Plugin.Storage.FileMode.append,
                        persistence: Plugin.Storage.FilePersistence.temporary,
                        type: Plugin.Storage.FileType.text
                    }).then(function (file) {
                        completed({
                            file: file,
                            relativePath: relativePath
                        });
                    }, function (error) {
                        if(failed) {
                            failed(error);
                        }
                    });
                }, function (error) {
                    if(failed) {
                        failed(error);
                    }
                });
            });
        };
        MemoryAnalyzerShell.prototype.save = function (addToProject) {
            return this._session.save(addToProject);
        };
        return MemoryAnalyzerShell;
    })();
    MemoryAnalyzer.MemoryAnalyzerShell = MemoryAnalyzerShell;    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=memoryAnalyzerShell.js.map

// memoryAnalyzerShell.vs.ts
var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    var VsMemoryAnalyzerShell = (function (_super) {
        __extends(VsMemoryAnalyzerShell, _super);
        function VsMemoryAnalyzerShell(session, sessionInfo) {
                _super.call(this, session);
            this.session.addViewTypeEventListener(this.onViewTypeChange.bind(this));
            this._sessionInfo = sessionInfo;
        }
        VsMemoryAnalyzerShell.prototype.closeAllSnapshots = function () {
            return Plugin.Promise.as(null);
        };
        VsMemoryAnalyzerShell.prototype.getHostSpecificString = function (resourceId) {
            var args = [];
            for (var _i = 0; _i < (arguments.length - 1); _i++) {
                args[_i] = arguments[_i + 1];
            }
            return Plugin.Resources.getString(resourceId + "VS", args);
        };
        VsMemoryAnalyzerShell.prototype.getSnapshotFullPath = function (storageId, relativePath) {
            return "%temp%\\ScriptedHost\\" + storageId + "\\" + relativePath;
        };
        VsMemoryAnalyzerShell.prototype.initializeView = function () {
            switch(this._sessionInfo.sessionType) {
                case MemoryAnalyzer.Extensions.SessionType.session:
                    var diagSession = new MemoryAnalyzer.Diagnostics.HubDiagnosticSession();
                    this._view = new VsMemoryAnalyzerShellSessionView(this._sessionInfo, diagSession);
                    break;
                case MemoryAnalyzer.Extensions.SessionType.snapshot:
                    this._view = new VsMemoryAnalyzerShellSnapshotView(this._sessionInfo);
                    break;
                case MemoryAnalyzer.Extensions.SessionType.snapshotDiff:
                    this._view = new VsMemoryAnalyzerShellSnapshotDiffView(this._sessionInfo);
                    break;
                default:
                    throw new Error(Plugin.Resources.getErrorString("JSPerf.1000"));
            }
        };
        VsMemoryAnalyzerShell.prototype.isGraphCollectionSupported = function () {
            return false;
        };
        VsMemoryAnalyzerShell.prototype.openSnapshot = function (relativePath, targetView, tabName, sortProperty) {
            return this.session.openSnapshotDetails(relativePath, targetView, tabName, sortProperty);
        };
        VsMemoryAnalyzerShell.prototype.openSnapshotDiff = function (relativePaths, targetView, tabName, sortProperty) {
            return this.session.openSnapshotDiff(relativePaths, targetView, tabName, sortProperty);
        };
        VsMemoryAnalyzerShell.prototype.resetView = function () {
        };
        VsMemoryAnalyzerShell.prototype.startGraphCollection = function () {
            MemoryAnalyzer.Program.reportError(new Error("not implemented"), "startGraphCollection is not implemented");
            return null;
        };
        VsMemoryAnalyzerShell.prototype.onViewTypeChange = function (args) {
            this._view.changeViewType(args.viewType, args.sortProperty);
        };
        return VsMemoryAnalyzerShell;
    })(MemoryAnalyzer.MemoryAnalyzerShell);
    MemoryAnalyzer.VsMemoryAnalyzerShell = VsMemoryAnalyzerShell;    
    var VsMemoryAnalyzerShellSessionView = (function (_super) {
        __extends(VsMemoryAnalyzerShellSessionView, _super);
        function VsMemoryAnalyzerShellSessionView(sessionInfo, diagSession) {
                _super.call(this, document.getElementById('mainContainer'));
            this._controller = new MemoryAnalyzer.MemoryAnalyzerController(sessionInfo, diagSession);
            this.appendChild(this._controller.view);
            Plugin.addEventListener("close", this.onClose.bind(this));
        }
        VsMemoryAnalyzerShellSessionView.prototype.changeViewType = function (viewType) {
        };
        VsMemoryAnalyzerShellSessionView.prototype.onClose = function () {
            this._controller.goOffline();
        };
        return VsMemoryAnalyzerShellSessionView;
    })(Common.Controls.Control);
    MemoryAnalyzer.VsMemoryAnalyzerShellSessionView = VsMemoryAnalyzerShellSessionView;    
    var VsMemoryAnalyzerShellSnapshotView = (function (_super) {
        __extends(VsMemoryAnalyzerShellSnapshotView, _super);
        function VsMemoryAnalyzerShellSnapshotView(sessionInfo) {
                _super.call(this, document.getElementById('mainContainer'));
            var controller = new MemoryAnalyzer.SnapshotViewController(sessionInfo.storageId);
            controller.loadSnapshot(sessionInfo.storageId, sessionInfo.filePaths, sessionInfo.targetView, sessionInfo.sortProperty);
            this._controller = controller;
            this._snapshotTab = new MemoryAnalyzer.SnapshotTab(controller);
            this.appendChild(this._snapshotTab);
        }
        VsMemoryAnalyzerShellSnapshotView.prototype.changeViewType = function (viewType, sortProperty) {
            this._controller.setTargetView(viewType, sortProperty);
        };
        return VsMemoryAnalyzerShellSnapshotView;
    })(Common.Controls.Control);
    MemoryAnalyzer.VsMemoryAnalyzerShellSnapshotView = VsMemoryAnalyzerShellSnapshotView;    
    var VsMemoryAnalyzerShellSnapshotDiffView = (function (_super) {
        __extends(VsMemoryAnalyzerShellSnapshotDiffView, _super);
        function VsMemoryAnalyzerShellSnapshotDiffView(sessionInfo) {
                _super.call(this, document.getElementById('mainContainer'));
            var diffController = new MemoryAnalyzer.SnapshotDiffController(sessionInfo.storageId);
            diffController.diffSnapshots(sessionInfo.storageId, sessionInfo.filePaths, sessionInfo.targetView, sessionInfo.sortProperty);
            this._diffController = diffController;
            this._snapshotTab = new MemoryAnalyzer.SnapshotTab(diffController);
            this.appendChild(this._snapshotTab);
        }
        VsMemoryAnalyzerShellSnapshotDiffView.prototype.changeViewType = function (viewType, sortType) {
            this._diffController.setTargetView(viewType, sortType);
        };
        return VsMemoryAnalyzerShellSnapshotDiffView;
    })(Common.Controls.Control);
    MemoryAnalyzer.VsMemoryAnalyzerShellSnapshotDiffView = VsMemoryAnalyzerShellSnapshotDiffView;    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=memoryAnalyzerShell.vs.js.map

// memoryAnalyzerShell.f12.ts
var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    var F12MemoryAnalyzerShell = (function (_super) {
        __extends(F12MemoryAnalyzerShell, _super);
        function F12MemoryAnalyzerShell(externalObj, session, sessionInfo) {
            var _this = this;
                _super.call(this, session);
            this._openedDocs = {
            };
            var diagSession = new MemoryAnalyzer.Diagnostics.F12DiagnosticsSession(externalObj);
            var controller = new MemoryAnalyzer.MemoryAnalyzerController(sessionInfo, diagSession);
            this._controller = controller;
            var external = (window.external);
            external.addEventListener("closing", function () {
                _this.closeAllSnapshots();
                MemoryAnalyzer.Program.etwDataCollector.stopCollection();
            });
        }
        F12MemoryAnalyzerShell.prototype.closeAllSnapshots = function () {
            for(var tabName in this._openedDocs) {
                if(this._openedDocs.hasOwnProperty(tabName)) {
                    this._view.removeDoc(this._openedDocs[tabName]);
                }
            }
            this._openedDocs = {
            };
            var filesPaths = [];
            var summaries = this._controller.summaryViewController.model.snapshotSummaryCollection;
            for(var i = 0; i < summaries.length; ++i) {
                var summary = summaries.getItem(i);
                var snapshotFile = summary.snapshotFile;
                var filePath = this.getSnapshotFullPath(snapshotFile.storageId, snapshotFile.relativePath);
                filesPaths.push(filePath);
                filesPaths.push(filePath + MemoryAnalyzer.SnapshotSummary.fileExtension);
            }
            this._controller.clearSummaryTab();
            while(filesPaths.length > 0) {
                var filesPath = filesPaths.pop();
                Plugin.F12.deleteFile(filesPath);
            }
            return Plugin.Promise.as(null);
        };
        F12MemoryAnalyzerShell.prototype.getHostSpecificString = function (resourceId) {
            var args = [];
            for (var _i = 0; _i < (arguments.length - 1); _i++) {
                args[_i] = arguments[_i + 1];
            }
            return Plugin.Resources.getString(resourceId + "F12", args);
        };
        F12MemoryAnalyzerShell.prototype.getSnapshotFullPath = function (storageId, relativePath) {
            return "%temp%\\Microsoft\\F12\\perftools\\memory\\" + storageId + "\\" + relativePath;
        };
        F12MemoryAnalyzerShell.prototype.initializeView = function () {
            this._view = new F12MemoryAnalyzerShellView(this._controller);
        };
        F12MemoryAnalyzerShell.prototype.isGraphCollectionSupported = function () {
            return true;
        };
        F12MemoryAnalyzerShell.prototype.openSnapshot = function (relativePath, targetView, tabName, sortProperty) {
            var _this = this;
            tabName = tabName.toLocaleUpperCase();
            return this.session.openSnapshotDetails(relativePath, targetView, tabName, sortProperty).then(function (newSessionInfo) {
                var doc = _this._openedDocs[tabName];
                if(!doc) {
                    var controller = new MemoryAnalyzer.SnapshotViewController(newSessionInfo.storageId);
                    controller.loadSnapshot(newSessionInfo.storageId, newSessionInfo.filePaths, newSessionInfo.targetView, newSessionInfo.sortProperty);
                    doc = {
                        controller: controller,
                        sessionInfo: newSessionInfo,
                        title: tabName,
                        view: new MemoryAnalyzer.SnapshotTab(controller)
                    };
                    doc.view.title = tabName;
                    _this._openedDocs[tabName] = doc;
                }
                doc.controller.setTargetView(newSessionInfo.targetView, newSessionInfo.sortProperty);
                _this._view.addOrActivateDoc(doc);
                return Plugin.Promise.as(null);
            });
        };
        F12MemoryAnalyzerShell.prototype.openSnapshotDiff = function (relativePaths, targetView, tabName, sortProperty) {
            var _this = this;
            tabName = tabName.toLocaleUpperCase();
            return this.session.openSnapshotDiff(relativePaths, targetView, tabName, sortProperty).then(function (newSessionInfo) {
                var doc = _this._openedDocs[tabName];
                if(!doc) {
                    var diffController = new MemoryAnalyzer.SnapshotDiffController(newSessionInfo.storageId);
                    diffController.diffSnapshots(newSessionInfo.storageId, newSessionInfo.filePaths, newSessionInfo.targetView, newSessionInfo.sortProperty);
                    doc = {
                        controller: diffController,
                        sessionInfo: newSessionInfo,
                        title: tabName,
                        view: new MemoryAnalyzer.SnapshotTab(diffController)
                    };
                    doc.view.title = tabName;
                    _this._openedDocs[tabName] = doc;
                }
                doc.controller.setTargetView(newSessionInfo.targetView, newSessionInfo.sortProperty);
                _this._view.addOrActivateDoc(doc);
                return Plugin.Promise.as(null);
            });
        };
        F12MemoryAnalyzerShell.prototype.resetView = function () {
            this._view.resetView();
        };
        F12MemoryAnalyzerShell.prototype.startGraphCollection = function () {
            return MemoryAnalyzer.Program.etwDataCollector.startSession("JavaScriptCollectionAgent.dll", "{37012E99-CDE8-4D9F-B228-CF98BC27B424}");
        };
        return F12MemoryAnalyzerShell;
    })(MemoryAnalyzer.MemoryAnalyzerShell);
    MemoryAnalyzer.F12MemoryAnalyzerShell = F12MemoryAnalyzerShell;    
    var F12MemoryAnalyzerShellView = (function (_super) {
        __extends(F12MemoryAnalyzerShellView, _super);
        function F12MemoryAnalyzerShellView(memAnalyzerController) {
                _super.call(this, "f12ViewTemplate");
            this._controller = memAnalyzerController;
            this._isProfiling = false;
            var title = this.findElement("title");
            title.innerText = Plugin.Resources.getString("F12ToolTitle");
            title.setAttribute("aria-label", Plugin.Resources.getString("F12ToolTitle"));
            this._startButton = this.findElement("startToolbarButton");
            this._stopButton = this.findElement("stopToolbarButton");
            this._takeSnapshotButton = this.findElement("takeSnapshotToolbarButton");
            Common.ButtonHelpers.setupButton(this._startButton, "F12StartButtonTooltip", this.onStartClick.bind(this));
            Common.ButtonHelpers.setupButton(this._stopButton, "F12StopButtonTooltip", this.onStopClick.bind(this));
            Common.ButtonHelpers.setupButton(this._takeSnapshotButton, "F12SnapshotButtonTooltip", this.onTakeSnapshotClick.bind(this));
            this._startProfilingLink = this.findElement("startProfilingMessage");
            this._startProfilingLink.innerText = Plugin.Resources.getString("F12StartProfilingMessage");
            this._startProfilingLink.addEventListener("click", this.onStartClick.bind(this));
            this._model = memAnalyzerController.summaryViewController.model;
            this._model.registerPropertyChanged(this);
            this._model.isOffline = true;
            this._model.isRunning = !Plugin.F12.Debugger.getIsAtBreakpoint();
            this._tabControl = new MemoryAnalyzer.Controls.TabControl();
            this._tabControl.tabsLeftAligned = true;
            this._tabControl.addTab(this._controller.view);
            this._startProfilingPrompt = this.findElement("startProfilingPrompt");
            this.updateStartProfilingPrompt();
            this.findElement("tabContainer").appendChild(this._tabControl.rootElement);
            var parentContainer = document.getElementById('mainContainer');
            parentContainer.appendChild(this.rootElement);
        }
        F12MemoryAnalyzerShellView.prototype.addOrActivateDoc = function (doc) {
            if(!this._tabControl.containsTab(doc.view)) {
                this._tabControl.addTab(doc.view);
            }
            this._tabControl.selectedItem = doc.view;
        };
        F12MemoryAnalyzerShellView.prototype.onPropertyChanged = function (propertyName) {
            switch(propertyName) {
                case "isTakingSnapshot":
                case "isAttached":
                case "isRunning":
                case "isOffline":
                case "isTargetCompatible":
                    this.updateUIState();
                    break;
                case "isStartProfilingPromptVisible":
                    this.updateStartProfilingPrompt();
                    break;
            }
            if(propertyName === "isOffline" && this._model.isOffline && this._isProfiling) {
                Plugin.F12.Profiler.notifyOnStopProfiling();
                this._isProfiling = false;
            }
        };
        F12MemoryAnalyzerShellView.prototype.removeDoc = function (doc) {
            this._tabControl.removeTab(doc.view);
        };
        F12MemoryAnalyzerShellView.prototype.resetView = function () {
            this._model.isStartProfilingPromptVisible = true;
        };
        F12MemoryAnalyzerShellView.prototype.onStartClick = function (event) {
            if(this._controller && this._model.isOffline && Common.ButtonHelpers.isValidEvent(event)) {
                MemoryAnalyzer.Program.shell.closeAllSnapshots();
                if(this._model.isTargetCompatible) {
                    MemoryAnalyzer.Program.traceWriter.raiseEvent(Common.TraceEvents.Memory_ToolReady_Start);
                    Plugin.F12.Profiler.notifyOnStartProfiling();
                    this._isProfiling = true;
                    this._controller.showWarning(null);
                    this._controller.goOnline();
                    MemoryAnalyzer.Program.traceWriter.raiseEvent(Common.TraceEvents.Memory_ToolReady_Stop);
                } else {
                    this._controller.showWarning(MemoryAnalyzer.Program.shell.getHostSpecificString("WarningIncompatibleStandardsMode"));
                    this._controller.summaryViewController.removeExistingGraph();
                }
                this._model.isStartProfilingPromptVisible = false;
                this.updateUIState();
            }
        };
        F12MemoryAnalyzerShellView.prototype.onStopClick = function (event) {
            if(this._controller && !this._model.isOffline && Common.ButtonHelpers.isValidEvent(event)) {
                Plugin.F12.Profiler.notifyOnStopProfiling();
                this._isProfiling = false;
                this._controller.showWarning(null);
                this._controller.goOffline();
                if(this._model.snapshotSummaryCollection.length === 0) {
                    this.resetView();
                }
                this.updateUIState();
            }
        };
        F12MemoryAnalyzerShellView.prototype.onTakeSnapshotClick = function (event) {
            if(this._controller && Common.ButtonHelpers.isValidEvent(event)) {
                this._controller.takeSnapshot();
                this.updateUIState();
            }
        };
        F12MemoryAnalyzerShellView.prototype.setButtonState = function (startEnabled, stopEnabled, takeSnapshotEnabled) {
            Common.ButtonHelpers.changeButtonStatus(this._startButton, startEnabled);
            Common.ButtonHelpers.changeButtonStatus(this._stopButton, stopEnabled);
            Common.ButtonHelpers.changeButtonStatus(this._takeSnapshotButton, takeSnapshotEnabled);
        };
        F12MemoryAnalyzerShellView.prototype.updateStartProfilingPrompt = function () {
            this._startProfilingPrompt.style.display = this._model.isStartProfilingPromptVisible ? "" : "none";
            this._tabControl.rootElement.style.display = this._model.isStartProfilingPromptVisible ? "none" : "";
        };
        F12MemoryAnalyzerShellView.prototype.updateUIState = function () {
            this._startProfilingLink.style.display = this._model.isStartEnabled ? "" : "none";
            this.setButtonState(this._model.isStartEnabled, this._model.isStopEnabled, this._model.isTakeSnapshotEnabled);
            if(!this._model.isRunning) {
                Plugin.F12.ErrorDisplay.show(Plugin.Resources.getString("MemoryDisabledAtBreakpoint"));
            } else {
                Plugin.F12.ErrorDisplay.close();
            }
        };
        return F12MemoryAnalyzerShellView;
    })(Common.Controls.TemplateControl);
    MemoryAnalyzer.F12MemoryAnalyzerShellView = F12MemoryAnalyzerShellView;    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=memoryAnalyzerShell.f12.js.map

// Program.ts
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    (function (HostType) {
        HostType._map = [];
        HostType._map[0] = "VS";
        HostType.VS = 0;
        HostType._map[1] = "F12";
        HostType.F12 = 1;
        HostType._map[2] = "Test";
        HostType.Test = 2;
    })(MemoryAnalyzer.HostType || (MemoryAnalyzer.HostType = {}));
    var HostType = MemoryAnalyzer.HostType;
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=Program.js.map

// Program.main.ts
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    var ProgramMain = (function () {
        function ProgramMain() {
            this._traceWriter = new Common.DefaultTraceWriter();
        }
        Object.defineProperty(ProgramMain.prototype, "etwDataCollector", {
            get: function () {
                return this._etwDataCollector;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(ProgramMain.prototype, "hostType", {
            get: function () {
                return this._hostType;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(ProgramMain.prototype, "internalFeedback", {
            get: function () {
                return this._internalFeedback;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(ProgramMain.prototype, "memoryAnalyzerData", {
            get: function () {
                return this._memoryAnalyzerData;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(ProgramMain.prototype, "shell", {
            get: function () {
                return this._shell;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(ProgramMain.prototype, "traceWriter", {
            get: function () {
                return this._traceWriter;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(ProgramMain.prototype, "userSettings", {
            get: function () {
                return this._userSettings;
            },
            enumerable: true,
            configurable: true
        });
        ProgramMain.prototype.fireCodeMarker = function (codeMarker) {
            Plugin.VS.Internal.CodeMarkers.fire(codeMarker);
        };
        ProgramMain.prototype.main = function () {
            var _this = this;
            if(window.parent && (window.parent).getExternalObj) {
                this._externalObj = (window.parent).getExternalObj();
            } else if(window.external) {
                this._externalObj = window.external;
            }
            if(Plugin.F12) {
                this._hostType = MemoryAnalyzer.HostType.F12;
            } else {
                this._hostType = MemoryAnalyzer.HostType.VS;
            }
            Plugin.addEventListener("pluginready", function () {
                var session;
                var diagSession;
                var memAnalyzerProxy;
                var perfTrace;
                Plugin.Tooltip.defaultTooltipContentToHTML = false;
                switch(_this.hostType) {
                    case MemoryAnalyzer.HostType.VS:
                        session = new MemoryAnalyzer.Extensions.HostSessionProxy();
                        _this._internalFeedback = new MemoryAnalyzer.Extensions.InternalFeedbackProxy();
                        memAnalyzerProxy = Plugin.VS.Utilities.createExternalObject("MemoryAnalyzerExtension", "{81ACDD7F-96B1-46DC-8971-424AABD93C69}");
                        perfTrace = Plugin.VS.Utilities.createExternalObject("PerformanceTraceExtension", "{D76A409F-7234-4B71-9BFD-DEF3DC4CCCA6}");
                        break;
                    case MemoryAnalyzer.HostType.F12:
                        session = new MemoryAnalyzer.Extensions.LocalSession();
                        _this._internalFeedback = new MemoryAnalyzer.Extensions.NoOperationInternalFeedback();
                        _this._etwDataCollector = new Common.Data.F12EtwDataCollector(_this._externalObj.etwDataCollector);
                        memAnalyzerProxy = Plugin.F12.Utilities.createExternalObject("MemoryAnalyzerExtension", "{81ACDD7F-96B1-46DC-8971-424AABD93C69}");
                        perfTrace = Plugin.F12.Utilities.createExternalObject("PerformanceTraceExtension", "{D76A409F-7234-4B71-9BFD-DEF3DC4CCCA6}");
                        break;
                    default:
                        throw new Error(Plugin.Resources.getErrorString("JSPerf.1027"));
                }
                if(perfTrace) {
                    _this._traceWriter = new Common.TraceWriter(perfTrace);
                }
                _this._memoryAnalyzerData = new MemoryAnalyzer.Data.MemoryAnalyzerData(memAnalyzerProxy);
                var userSettingsProxy = new MemoryAnalyzer.Extensions.UserSettingsProxy();
                userSettingsProxy.getUserSettings().then(function (userSettings) {
                    _this._userSettings = userSettings;
                    _this._session = session;
                    _this.initializeErrorReporting();
                    Plugin.addEventListener("close", _this.onClose);
                    session.getSessionInfo().done(function (sessionInfo) {
                        _this._shell = _this.getShell(session, sessionInfo);
                        _this._shell.initializeView();
                        _this.onIdle();
                    });
                });
            });
        };
        ProgramMain.prototype.initializeErrorReporting = function () {
            var _this = this;
            window.onerror = function (e, url, line) {
                var column;
                if(arguments && arguments[3] && typeof arguments[3] === 'number') {
                    column = arguments[3];
                }
                _this.reportError(new Error(e), "Unhandled Error", url, line, column);
                return true;
            };
        };
        ProgramMain.prototype.onIdle = function () {
            Notifications.notify(MemoryAnalyzer.MemoryNotifications.Idle);
            Plugin.VS.Internal.CodeMarkers.fire(MemoryAnalyzer.CodeMarkerValues.perfBrowserTools_MemoryAnalyzerIdle);
        };
        ProgramMain.prototype.reportError = function (error, additionalInfo, source, line, column) {
            var _this = this;
            if(!this.userSettings.disableWER) {
                var message = (error.message || (error).description);
                var url = source || "MemoryAnalyzer";
                var lineNumber = line || 0;
                var columnNumber = column || 0;
                var errorInfo = "Error description:  " + message;
                if((error).number) {
                    errorInfo += "\r\nError number:  " + (error).number;
                }
                if(source) {
                    errorInfo += "\r\nSource:  " + source;
                }
                if((error).stack) {
                    var stack = (error).stack;
                    errorInfo += "\r\nError stack:  " + stack;
                    if(!message) {
                        var index = stack.indexOf("\n");
                        if(index > 0) {
                            index = Math.min(index, 50);
                            message = stack.substring(0, index);
                        }
                    }
                    if(typeof source === "undefined") {
                        var matchInfo = stack.match(/(file|res):?([^)]+)\)/);
                        if(matchInfo && matchInfo.length > 2) {
                            url = matchInfo[2];
                        }
                    }
                    if(typeof line === "undefined") {
                        matchInfo = stack.match(/line ?(\d+)/);
                        if(!matchInfo || matchInfo.length <= 1) {
                            matchInfo = stack.match(/js:?(\d+):/);
                        }
                        if(matchInfo && matchInfo.length > 1) {
                            lineNumber = parseInt(matchInfo[1]);
                        }
                    }
                }
                if(additionalInfo) {
                    errorInfo += "\r\nAdditional Info:  " + additionalInfo;
                }
                Plugin.Diagnostics.reportError(message, url, lineNumber, errorInfo, columnNumber);
                this.internalFeedback.isEnabled().done(function (enabled) {
                    if(enabled) {
                        _this._session.save(false).done(function (fileLocation) {
                            _this.internalFeedback.sendData(true, "", "", "", errorInfo, fileLocation);
                        });
                    }
                });
            }
        };
        ProgramMain.prototype.getShell = function (session, sessionInfo) {
            switch(this.hostType) {
                case MemoryAnalyzer.HostType.VS:
                    return new MemoryAnalyzer.VsMemoryAnalyzerShell(session, sessionInfo);
                case MemoryAnalyzer.HostType.F12:
                    return new MemoryAnalyzer.F12MemoryAnalyzerShell(this._externalObj, session, sessionInfo);
                default:
                    throw new Error(Plugin.Resources.getErrorString("JSPerf.1027"));
            }
        };
        ProgramMain.prototype.onClose = function () {
            Notifications.notify(MemoryAnalyzer.MemoryNotifications.WindowClose);
            Plugin.VS.Internal.CodeMarkers.fire(MemoryAnalyzer.CodeMarkerValues.perfBrowserTools_MemoryAnalyzerWindowClose);
        };
        return ProgramMain;
    })();
    MemoryAnalyzer.ProgramMain = ProgramMain;    
    MemoryAnalyzer.Program = new ProgramMain();
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
(MemoryAnalyzer.Program).main();
//@ sourceMappingURL=Program.main.js.map

// RemoteCommands.ts
var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var MemoryAnalyzer;
(function (MemoryAnalyzer) {
    "use strict";
    var RegisterConsoleCallbacksCommand = (function () {
        function RegisterConsoleCallbacksCommand(callback) {
            this._dataReceivedHandler = callback;
        }
        Object.defineProperty(RegisterConsoleCallbacksCommand.prototype, "args", {
            get: function () {
                return [];
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(RegisterConsoleCallbacksCommand.prototype, "hasCompleted", {
            get: function () {
                return null;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(RegisterConsoleCallbacksCommand.prototype, "name", {
            get: function () {
                return "registerConsoleCallbacks";
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(RegisterConsoleCallbacksCommand.prototype, "dataReceivedHandler", {
            get: function () {
                return this._dataReceivedHandler;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(RegisterConsoleCallbacksCommand.prototype, "executedHandler", {
            get: function () {
                return null;
            },
            enumerable: true,
            configurable: true
        });
        return RegisterConsoleCallbacksCommand;
    })();
    MemoryAnalyzer.RegisterConsoleCallbacksCommand = RegisterConsoleCallbacksCommand;    
    var MultipartResponseCommand = (function () {
        function MultipartResponseCommand(name, args) {
            this._name = name;
            this._args = args;
            this._hasCompleted = false;
            this._currentPartId = 0;
            this.actualPartCount = 0;
            this.expectedPartCount = -1;
            this._parts = {
            };
            this._processedPartCount = 0;
            this.executedHandler = this.onExecuted.bind(this);
            this.dataReceivedHandler = this.onDataReceived.bind(this);
        }
        Object.defineProperty(MultipartResponseCommand.prototype, "args", {
            get: function () {
                return this._args;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(MultipartResponseCommand.prototype, "hasCompleted", {
            get: function () {
                return this._hasCompleted;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(MultipartResponseCommand.prototype, "name", {
            get: function () {
                return this._name;
            },
            enumerable: true,
            configurable: true
        });
        MultipartResponseCommand.prototype.checkCompleted = function () {
            if(!this.hasCompleted && this.actualPartCount === this.expectedPartCount && this._processedPartCount === this.expectedPartCount) {
                this._hasCompleted = true;
                if(this.allPartsReceivedHandler) {
                    this.allPartsReceivedHandler(this._parts);
                }
                if(this.completedHandler) {
                    this.completedHandler(this);
                }
            }
        };
        MultipartResponseCommand.prototype.onDataReceived = function (part) {
            var _this = this;
            if(part.partId === -1) {
                if(this.errorHandler) {
                    this.errorHandler(new Error(part.data));
                }
                return;
            }
            ++this.actualPartCount;
            this._parts[part.partId] = part.data;
            if(this.partProcessingHandler) {
                while(typeof this._parts[this._currentPartId] !== "undefined") {
                    var currentPart = this._parts[this._currentPartId];
                    this.partProcessingHandler(currentPart).done(function () {
                        _this._processedPartCount++;
                        _this.checkCompleted();
                    }, function (err) {
                        if(_this.errorHandler) {
                            _this.errorHandler(err);
                        }
                    });
                    delete this._parts[this._currentPartId];
                    ++this._currentPartId;
                }
            } else {
                this._processedPartCount++;
            }
            this.checkCompleted();
        };
        MultipartResponseCommand.prototype.onExecuted = function (args) {
            if(typeof args !== "undefined") {
                this.expectedPartCount = args;
            } else {
                if(this.errorHandler) {
                    this.errorHandler(new Error(Plugin.Resources.getErrorString("JSPerf.1059")));
                }
            }
        };
        return MultipartResponseCommand;
    })();
    MemoryAnalyzer.MultipartResponseCommand = MultipartResponseCommand;    
    var TakeSnapshotCommand = (function (_super) {
        __extends(TakeSnapshotCommand, _super);
        function TakeSnapshotCommand(args, file) {
            var _this = this;
                _super.call(this, "takeSnapshot", args);
            this._file = file;
            this.partProcessingHandler = function (data) {
                return _this._file.write(data);
            };
        }
        return TakeSnapshotCommand;
    })(MultipartResponseCommand);
    MemoryAnalyzer.TakeSnapshotCommand = TakeSnapshotCommand;    
})(MemoryAnalyzer || (MemoryAnalyzer = {}));
//@ sourceMappingURL=RemoteCommands.js.map


// SIG // Begin signature block
// SIG // MIIatwYJKoZIhvcNAQcCoIIaqDCCGqQCAQExCzAJBgUr
// SIG // DgMCGgUAMGcGCisGAQQBgjcCAQSgWTBXMDIGCisGAQQB
// SIG // gjcCAR4wJAIBAQQQEODJBs441BGiowAQS9NQkAIBAAIB
// SIG // AAIBAAIBAAIBADAhMAkGBSsOAwIaBQAEFEuYEnO6tjxM
// SIG // +nL+S66u07NdiNdroIIVgjCCBMMwggOroAMCAQICEzMA
// SIG // AAArOTJIwbLJSPMAAAAAACswDQYJKoZIhvcNAQEFBQAw
// SIG // dzELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0
// SIG // b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1p
// SIG // Y3Jvc29mdCBDb3Jwb3JhdGlvbjEhMB8GA1UEAxMYTWlj
// SIG // cm9zb2Z0IFRpbWUtU3RhbXAgUENBMB4XDTEyMDkwNDIx
// SIG // MTIzNFoXDTEzMTIwNDIxMTIzNFowgbMxCzAJBgNVBAYT
// SIG // AlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQH
// SIG // EwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29y
// SIG // cG9yYXRpb24xDTALBgNVBAsTBE1PUFIxJzAlBgNVBAsT
// SIG // Hm5DaXBoZXIgRFNFIEVTTjpDMEY0LTMwODYtREVGODEl
// SIG // MCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2Vy
// SIG // dmljZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
// SIG // ggEBAKa2MA4DZa5QWoZrhZ9IoR7JwO5eSQeF4HCWfL65
// SIG // X2JfBibTizm7GCKlLpKt2EuIOhqvm4OuyF45jMIyexZ4
// SIG // 7Tc4OvFi+2iCAmjs67tAirH+oSw2YmBwOWBiDvvGGDhv
// SIG // sJLWQA2Apg14izZrhoomFxj/sOtNurspE+ZcSI5wRjYm
// SIG // /jQ1qzTh99rYXOqZfTG3TR9X63zWlQ1mDB4OMhc+LNWA
// SIG // oc7r95iRAtzBX/04gPg5f11kyjdcO1FbXYVfzh4c+zS+
// SIG // X+UoVXBUnLjsfABVRlsomChWTOHxugkZloFIKjDI9zMg
// SIG // bOdpw7PUw07PMB431JhS1KkjRbKuXEFJT7RiaJMCAwEA
// SIG // AaOCAQkwggEFMB0GA1UdDgQWBBSlGDNTP5VgoUMW747G
// SIG // r9Irup5Y0DAfBgNVHSMEGDAWgBQjNPjZUkZwCu1A+3b7
// SIG // syuwwzWzDzBUBgNVHR8ETTBLMEmgR6BFhkNodHRwOi8v
// SIG // Y3JsLm1pY3Jvc29mdC5jb20vcGtpL2NybC9wcm9kdWN0
// SIG // cy9NaWNyb3NvZnRUaW1lU3RhbXBQQ0EuY3JsMFgGCCsG
// SIG // AQUFBwEBBEwwSjBIBggrBgEFBQcwAoY8aHR0cDovL3d3
// SIG // dy5taWNyb3NvZnQuY29tL3BraS9jZXJ0cy9NaWNyb3Nv
// SIG // ZnRUaW1lU3RhbXBQQ0EuY3J0MBMGA1UdJQQMMAoGCCsG
// SIG // AQUFBwMIMA0GCSqGSIb3DQEBBQUAA4IBAQB+zLB75S++
// SIG // 51a1z3PbqlLRFjnGtM361/4eZbXnSPObRogFZmomhl7+
// SIG // h1jcxmOOOID0CEZ8K3OxDr9BqsvHqpSkN/BkOeHF1fnO
// SIG // B86r5CXwaa7URuL+ZjI815fFMiH67holoF4MQiwRMzqC
// SIG // g/3tHbO+zpGkkSVxuatysJ6v5M8AYolwqbhKUIzuLyJk
// SIG // pajmTWuVLBx57KejMdqQYJCkbv6TAg0/LCQNxmomgVGD
// SIG // ShC7dWNEqmkIxgPr4s8L7VY67O9ypwoM9ADTIrivInKz
// SIG // 58ScCyiggMrj4dc5ZjDnRhcY5/qC+lkLeryoDf4c/wOL
// SIG // Y7JNEgIjTy2zhYQ74qFH6M8VMIIE7DCCA9SgAwIBAgIT
// SIG // MwAAALARrwqL0Duf3QABAAAAsDANBgkqhkiG9w0BAQUF
// SIG // ADB5MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGlu
// SIG // Z3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMV
// SIG // TWljcm9zb2Z0IENvcnBvcmF0aW9uMSMwIQYDVQQDExpN
// SIG // aWNyb3NvZnQgQ29kZSBTaWduaW5nIFBDQTAeFw0xMzAx
// SIG // MjQyMjMzMzlaFw0xNDA0MjQyMjMzMzlaMIGDMQswCQYD
// SIG // VQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4G
// SIG // A1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0
// SIG // IENvcnBvcmF0aW9uMQ0wCwYDVQQLEwRNT1BSMR4wHAYD
// SIG // VQQDExVNaWNyb3NvZnQgQ29ycG9yYXRpb24wggEiMA0G
// SIG // CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDor1yiIA34
// SIG // KHy8BXt/re7rdqwoUz8620B9s44z5lc/pVEVNFSlz7SL
// SIG // qT+oN+EtUO01Fk7vTXrbE3aIsCzwWVyp6+HXKXXkG4Un
// SIG // m/P4LZ5BNisLQPu+O7q5XHWTFlJLyjPFN7Dz636o9UEV
// SIG // XAhlHSE38Cy6IgsQsRCddyKFhHxPuRuQsPWj/ov0DJpO
// SIG // oPXJCiHiquMBNkf9L4JqgQP1qTXclFed+0vUDoLbOI8S
// SIG // /uPWenSIZOFixCUuKq6dGB8OHrbCryS0DlC83hyTXEmm
// SIG // ebW22875cHsoAYS4KinPv6kFBeHgD3FN/a1cI4Mp68fF
// SIG // SsjoJ4TTfsZDC5UABbFPZXHFAgMBAAGjggFgMIIBXDAT
// SIG // BgNVHSUEDDAKBggrBgEFBQcDAzAdBgNVHQ4EFgQUWXGm
// SIG // WjNN2pgHgP+EHr6H+XIyQfIwUQYDVR0RBEowSKRGMEQx
// SIG // DTALBgNVBAsTBE1PUFIxMzAxBgNVBAUTKjMxNTk1KzRm
// SIG // YWYwYjcxLWFkMzctNGFhMy1hNjcxLTc2YmMwNTIzNDRh
// SIG // ZDAfBgNVHSMEGDAWgBTLEejK0rQWWAHJNy4zFha5TJoK
// SIG // HzBWBgNVHR8ETzBNMEugSaBHhkVodHRwOi8vY3JsLm1p
// SIG // Y3Jvc29mdC5jb20vcGtpL2NybC9wcm9kdWN0cy9NaWND
// SIG // b2RTaWdQQ0FfMDgtMzEtMjAxMC5jcmwwWgYIKwYBBQUH
// SIG // AQEETjBMMEoGCCsGAQUFBzAChj5odHRwOi8vd3d3Lm1p
// SIG // Y3Jvc29mdC5jb20vcGtpL2NlcnRzL01pY0NvZFNpZ1BD
// SIG // QV8wOC0zMS0yMDEwLmNydDANBgkqhkiG9w0BAQUFAAOC
// SIG // AQEAMdduKhJXM4HVncbr+TrURE0Inu5e32pbt3nPApy8
// SIG // dmiekKGcC8N/oozxTbqVOfsN4OGb9F0kDxuNiBU6fNut
// SIG // zrPJbLo5LEV9JBFUJjANDf9H6gMH5eRmXSx7nR2pEPoc
// SIG // sHTyT2lrnqkkhNrtlqDfc6TvahqsS2Ke8XzAFH9IzU2y
// SIG // RPnwPJNtQtjofOYXoJtoaAko+QKX7xEDumdSrcHps3Om
// SIG // 0mPNSuI+5PNO/f+h4LsCEztdIN5VP6OukEAxOHUoXgSp
// SIG // Rm3m9Xp5QL0fzehF1a7iXT71dcfmZmNgzNWahIeNJDD3
// SIG // 7zTQYx2xQmdKDku/Og7vtpU6pzjkJZIIpohmgjCCBbww
// SIG // ggOkoAMCAQICCmEzJhoAAAAAADEwDQYJKoZIhvcNAQEF
// SIG // BQAwXzETMBEGCgmSJomT8ixkARkWA2NvbTEZMBcGCgmS
// SIG // JomT8ixkARkWCW1pY3Jvc29mdDEtMCsGA1UEAxMkTWlj
// SIG // cm9zb2Z0IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5
// SIG // MB4XDTEwMDgzMTIyMTkzMloXDTIwMDgzMTIyMjkzMlow
// SIG // eTELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0
// SIG // b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1p
// SIG // Y3Jvc29mdCBDb3Jwb3JhdGlvbjEjMCEGA1UEAxMaTWlj
// SIG // cm9zb2Z0IENvZGUgU2lnbmluZyBQQ0EwggEiMA0GCSqG
// SIG // SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCycllcGTBkvx2a
// SIG // YCAgQpl2U2w+G9ZvzMvx6mv+lxYQ4N86dIMaty+gMuz/
// SIG // 3sJCTiPVcgDbNVcKicquIEn08GisTUuNpb15S3GbRwfa
// SIG // /SXfnXWIz6pzRH/XgdvzvfI2pMlcRdyvrT3gKGiXGqel
// SIG // cnNW8ReU5P01lHKg1nZfHndFg4U4FtBzWwW6Z1KNpbJp
// SIG // L9oZC/6SdCnidi9U3RQwWfjSjWL9y8lfRjFQuScT5EAw
// SIG // z3IpECgixzdOPaAyPZDNoTgGhVxOVoIoKgUyt0vXT2Pn
// SIG // 0i1i8UU956wIAPZGoZ7RW4wmU+h6qkryRs83PDietHdc
// SIG // pReejcsRj1Y8wawJXwPTAgMBAAGjggFeMIIBWjAPBgNV
// SIG // HRMBAf8EBTADAQH/MB0GA1UdDgQWBBTLEejK0rQWWAHJ
// SIG // Ny4zFha5TJoKHzALBgNVHQ8EBAMCAYYwEgYJKwYBBAGC
// SIG // NxUBBAUCAwEAATAjBgkrBgEEAYI3FQIEFgQU/dExTtMm
// SIG // ipXhmGA7qDFvpjy82C0wGQYJKwYBBAGCNxQCBAweCgBT
// SIG // AHUAYgBDAEEwHwYDVR0jBBgwFoAUDqyCYEBWJ5flJRP8
// SIG // KuEKU5VZ5KQwUAYDVR0fBEkwRzBFoEOgQYY/aHR0cDov
// SIG // L2NybC5taWNyb3NvZnQuY29tL3BraS9jcmwvcHJvZHVj
// SIG // dHMvbWljcm9zb2Z0cm9vdGNlcnQuY3JsMFQGCCsGAQUF
// SIG // BwEBBEgwRjBEBggrBgEFBQcwAoY4aHR0cDovL3d3dy5t
// SIG // aWNyb3NvZnQuY29tL3BraS9jZXJ0cy9NaWNyb3NvZnRS
// SIG // b290Q2VydC5jcnQwDQYJKoZIhvcNAQEFBQADggIBAFk5
// SIG // Pn8mRq/rb0CxMrVq6w4vbqhJ9+tfde1MOy3XQ60L/svp
// SIG // LTGjI8x8UJiAIV2sPS9MuqKoVpzjcLu4tPh5tUly9z7q
// SIG // QX/K4QwXaculnCAt+gtQxFbNLeNK0rxw56gNogOlVuC4
// SIG // iktX8pVCnPHz7+7jhh80PLhWmvBTI4UqpIIck+KUBx3y
// SIG // 4k74jKHK6BOlkU7IG9KPcpUqcW2bGvgc8FPWZ8wi/1wd
// SIG // zaKMvSeyeWNWRKJRzfnpo1hW3ZsCRUQvX/TartSCMm78
// SIG // pJUT5Otp56miLL7IKxAOZY6Z2/Wi+hImCWU4lPF6H0q7
// SIG // 0eFW6NB4lhhcyTUWX92THUmOLb6tNEQc7hAVGgBd3TVb
// SIG // Ic6YxwnuhQ6MT20OE049fClInHLR82zKwexwo1eSV32U
// SIG // jaAbSANa98+jZwp0pTbtLS8XyOZyNxL0b7E8Z4L5UrKN
// SIG // MxZlHg6K3RDeZPRvzkbU0xfpecQEtNP7LN8fip6sCvsT
// SIG // J0Ct5PnhqX9GuwdgR2VgQE6wQuxO7bN2edgKNAltHIAx
// SIG // H+IOVN3lofvlRxCtZJj/UBYufL8FIXrilUEnacOTj5XJ
// SIG // jdibIa4NXJzwoq6GaIMMai27dmsAHZat8hZ79haDJLmI
// SIG // z2qoRzEvmtzjcT3XAH5iR9HOiMm4GPoOco3Boz2vAkBq
// SIG // /2mbluIQqBC0N1AI1sM9MIIGBzCCA++gAwIBAgIKYRZo
// SIG // NAAAAAAAHDANBgkqhkiG9w0BAQUFADBfMRMwEQYKCZIm
// SIG // iZPyLGQBGRYDY29tMRkwFwYKCZImiZPyLGQBGRYJbWlj
// SIG // cm9zb2Z0MS0wKwYDVQQDEyRNaWNyb3NvZnQgUm9vdCBD
// SIG // ZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDcwNDAzMTI1
// SIG // MzA5WhcNMjEwNDAzMTMwMzA5WjB3MQswCQYDVQQGEwJV
// SIG // UzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMH
// SIG // UmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBv
// SIG // cmF0aW9uMSEwHwYDVQQDExhNaWNyb3NvZnQgVGltZS1T
// SIG // dGFtcCBQQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
// SIG // ggEKAoIBAQCfoWyx39tIkip8ay4Z4b3i48WZUSNQrc7d
// SIG // GE4kD+7Rp9FMrXQwIBHrB9VUlRVJlBtCkq6YXDAm2gBr
// SIG // 6Hu97IkHD/cOBJjwicwfyzMkh53y9GccLPx754gd6udO
// SIG // o6HBI1PKjfpFzwnQXq/QsEIEovmmbJNn1yjcRlOwhtDl
// SIG // KEYuJ6yGT1VSDOQDLPtqkJAwbofzWTCd+n7Wl7PoIZd+
// SIG // +NIT8wi3U21StEWQn0gASkdmEScpZqiX5NMGgUqi+YSn
// SIG // EUcUCYKfhO1VeP4Bmh1QCIUAEDBG7bfeI0a7xC1Un68e
// SIG // eEExd8yb3zuDk6FhArUdDbH895uyAc4iS1T/+QXDwiAL
// SIG // AgMBAAGjggGrMIIBpzAPBgNVHRMBAf8EBTADAQH/MB0G
// SIG // A1UdDgQWBBQjNPjZUkZwCu1A+3b7syuwwzWzDzALBgNV
// SIG // HQ8EBAMCAYYwEAYJKwYBBAGCNxUBBAMCAQAwgZgGA1Ud
// SIG // IwSBkDCBjYAUDqyCYEBWJ5flJRP8KuEKU5VZ5KShY6Rh
// SIG // MF8xEzARBgoJkiaJk/IsZAEZFgNjb20xGTAXBgoJkiaJ
// SIG // k/IsZAEZFgltaWNyb3NvZnQxLTArBgNVBAMTJE1pY3Jv
// SIG // c29mdCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eYIQ
// SIG // ea0WoUqgpa1Mc1j0BxMuZTBQBgNVHR8ESTBHMEWgQ6BB
// SIG // hj9odHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpL2Ny
// SIG // bC9wcm9kdWN0cy9taWNyb3NvZnRyb290Y2VydC5jcmww
// SIG // VAYIKwYBBQUHAQEESDBGMEQGCCsGAQUFBzAChjhodHRw
// SIG // Oi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpL2NlcnRzL01p
// SIG // Y3Jvc29mdFJvb3RDZXJ0LmNydDATBgNVHSUEDDAKBggr
// SIG // BgEFBQcDCDANBgkqhkiG9w0BAQUFAAOCAgEAEJeKw1wD
// SIG // RDbd6bStd9vOeVFNAbEudHFbbQwTq86+e4+4LtQSooxt
// SIG // YrhXAstOIBNQmd16QOJXu69YmhzhHQGGrLt48ovQ7DsB
// SIG // 7uK+jwoFyI1I4vBTFd1Pq5Lk541q1YDB5pTyBi+FA+mR
// SIG // KiQicPv2/OR4mS4N9wficLwYTp2OawpylbihOZxnLcVR
// SIG // DupiXD8WmIsgP+IHGjL5zDFKdjE9K3ILyOpwPf+FChPf
// SIG // wgphjvDXuBfrTot/xTUrXqO/67x9C0J71FNyIe4wyrt4
// SIG // ZVxbARcKFA7S2hSY9Ty5ZlizLS/n+YWGzFFW6J1wlGys
// SIG // OUzU9nm/qhh6YinvopspNAZ3GmLJPR5tH4LwC8csu89D
// SIG // s+X57H2146SodDW4TsVxIxImdgs8UoxxWkZDFLyzs7BN
// SIG // Z8ifQv+AeSGAnhUwZuhCEl4ayJ4iIdBD6Svpu/RIzCzU
// SIG // 2DKATCYqSCRfWupW76bemZ3KOm+9gSd0BhHudiG/m4LB
// SIG // J1S2sWo9iaF2YbRuoROmv6pH8BJv/YoybLL+31HIjCPJ
// SIG // Zr2dHYcSZAI9La9Zj7jkIeW1sMpjtHhUBdRBLlCslLCl
// SIG // eKuzoJZ1GtmShxN1Ii8yqAhuoFuMJb+g74TKIdbrHk/J
// SIG // mu5J4PcBZW+JC33Iacjmbuqnl84xKf8OxVtc2E0bodj6
// SIG // L54/LlUWa8kTo/0xggShMIIEnQIBATCBkDB5MQswCQYD
// SIG // VQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4G
// SIG // A1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0
// SIG // IENvcnBvcmF0aW9uMSMwIQYDVQQDExpNaWNyb3NvZnQg
// SIG // Q29kZSBTaWduaW5nIFBDQQITMwAAALARrwqL0Duf3QAB
// SIG // AAAAsDAJBgUrDgMCGgUAoIG6MBkGCSqGSIb3DQEJAzEM
// SIG // BgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAMBgor
// SIG // BgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBTJVdrHOYdV
// SIG // 0VzIl9I5m0jMdgDM9zBaBgorBgEEAYI3AgEMMUwwSqAw
// SIG // gC4ATQBlAG0AbwByAHkAQQBuAGEAbAB5AHoAZQByAE0A
// SIG // ZQByAGcAZQBkAC4AagBzoRaAFGh0dHA6Ly9taWNyb3Nv
// SIG // ZnQuY29tMA0GCSqGSIb3DQEBAQUABIIBAGAtlsK9v0Ab
// SIG // GFLsrwmNJKkak+WPJRsSuQaUSI3C2J/WBBVIOLOCwWsJ
// SIG // P1h9CSUHmBjOL99hVGbw0fZyJaHxxK70sqyoKJ0RzD6Z
// SIG // 5DJ8qXopIyw4zO7gJ0q88HVzZC/OkhR0yT8eiHem+6Cs
// SIG // RqT7RYokof2VmWDfQ3IXtNwUqjlke5bnO5xXY+PLWik0
// SIG // gaYan7hWuUMPYCnEybpyMIhS+uN7GpiR9v5kLwC7gETR
// SIG // Pm36ZnZSJNQQBs7ASTOQfwbX9GIZLJwgw3OGYbXXLy12
// SIG // WPYxFVkWZg0dPZCRGdrYIXUkPooisyG6UrPm5ELtcLQ/
// SIG // ULbcH3y/GD6pXUjioqovnMyhggIoMIICJAYJKoZIhvcN
// SIG // AQkGMYICFTCCAhECAQEwgY4wdzELMAkGA1UEBhMCVVMx
// SIG // EzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1Jl
// SIG // ZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3Jh
// SIG // dGlvbjEhMB8GA1UEAxMYTWljcm9zb2Z0IFRpbWUtU3Rh
// SIG // bXAgUENBAhMzAAAAKzkySMGyyUjzAAAAAAArMAkGBSsO
// SIG // AwIaBQCgXTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcB
// SIG // MBwGCSqGSIb3DQEJBTEPFw0xMzEwMDUwODUxMDVaMCMG
// SIG // CSqGSIb3DQEJBDEWBBS+LsGA57mNSLTygv5eP/UnuYcV
// SIG // yDANBgkqhkiG9w0BAQUFAASCAQAJDYKXMuwzk4h540Bq
// SIG // xGuIAseIPCe+1UyuAX7OnuzD7/zSjCN2uHYNofXkN+aZ
// SIG // Cw7nVrVvVjb6T97ORpqM4TsSJ4Ep1Im3qOOmLtyXTP14
// SIG // A6JYCFCy1w3VrWY6sTey+cMwZMe/zAW3/Y4URH25NosK
// SIG // cObLDkGh9qXY0eA3gFquCt5FMOwFuj/WPacseZ1SM7P0
// SIG // F9p51BXKCXXI14ezOXSIELJqN/8eBcrCw5Am8li9qosd
// SIG // KSg5BpZjNS1l3wzkIOHGl1BXfzxveN6hCtMj9m/3fGYI
// SIG // x86+1kkvWJsBNqhsbCEPRPrJLqUOMaHt66vzbq/d0bmQ
// SIG // iWZEhDknEs29ScZw
// SIG // End signature block
