import * as React from 'react';
import { Treemap } from "./Treemap";
import { toPoint, ensureEnum, brushToString, stringToBrush, ensureBool, initializePropertiesFromCss, NamePatcher, isValidProp, toSpinal, getModifiedProps, fromBrushCollection, toBrushCollection } from "igniteui-react-core";
import { FontInfo } from "igniteui-react-core";
import { ReactRenderer } from "igniteui-react-core";
import { delegateCombine, delegateRemove } from "igniteui-react-core";
import { DataChartStylingDefaults } from './DataChartStylingDefaults';
import { TreemapNodeStyleMapping } from './TreemapNodeStyleMapping';
import { IgrTreemapNodeStyleMappingCollection } from './igr-treemap-node-style-mapping-collection';
import { ContentChildrenManager } from "igniteui-react-core";
import { CollectionAdapter } from "igniteui-react-core";
import { NotifyCollectionChangedAction } from "igniteui-react-core";
import { TreemapFillScaleMode_$type } from "./TreemapFillScaleMode";
import { IgrTreemapNodeStylingEventArgs } from "./igr-treemap-node-styling-event-args";
import { TreemapOrientation_$type } from './TreemapOrientation';
import { TreemapLayoutType_$type } from './TreemapLayoutType';
import { IgrTreemapNodePointerEventArgs } from './igr-treemap-node-pointer-event-args';
import { TreemapHeaderDisplayMode_$type } from './TreemapHeaderDisplayMode';
import { HorizontalAlignment_$type } from "igniteui-react-core";
import { VerticalAlignment_$type } from "igniteui-react-core";
import { TreemapLabelHorizontalFitMode_$type } from './TreemapLabelHorizontalFitMode';
import { TreemapLabelVerticalFitMode_$type } from './TreemapLabelVerticalFitMode';
import { TreemapHighlightingMode_$type } from './TreemapHighlightingMode';
export class IgrTreemap extends React.Component {
    set height(value) {
        this._height = value;
        if (this._elRef) {
            this._elRef.style.height = value;
            this._treeMap.notifySizeChanged();
        }
    }
    get height() {
        return this._height;
    }
    set width(value) {
        this._width = value;
        if (this._elRef) {
            this._elRef.style.height = value;
            this._treeMap.notifySizeChanged();
        }
    }
    get width() {
        return this._width;
    }
    _getMainRef(ref) {
        this._elRef = ref;
    }
    _updateContentChildren() {
        this.contentStyleMappings.length = 0;
        let contentChildrenActual = this._contentChildrenManager.contentChildrenActual;
        for (let i = 0; i < contentChildrenActual.length; i++) {
            if ((TreemapNodeStyleMapping.$type).isAssignableFrom(contentChildrenActual[i].i.$type)) {
                this.contentStyleMappings.push(contentChildrenActual[i]);
            }
        }
        if (this._styleMappingsAdapter !== null) {
            this._styleMappingsAdapter.notifyContentChanged();
        }
    }
    /**
     * A collection of manually added style mappings for the treemap.
    */
    get styleMappings() {
        if (this._styleMappings === null) {
            let coll = new IgrTreemapNodeStyleMappingCollection();
            let inner = coll._innerColl;
            inner.addListener((sender, e) => {
                switch (e.action) {
                    case NotifyCollectionChangedAction.Add:
                        this._styleMappingsAdapter.insertManualItem(e.newStartingIndex, e.newItems.item(0));
                        break;
                    case NotifyCollectionChangedAction.Remove:
                        this._styleMappingsAdapter.removeManualItemAt(e.oldStartingIndex);
                        break;
                    case NotifyCollectionChangedAction.Replace:
                        this._styleMappingsAdapter.removeManualItemAt(e.oldStartingIndex);
                        this._styleMappingsAdapter.insertManualItem(e.newStartingIndex, e.newItems.item(0));
                        break;
                    case NotifyCollectionChangedAction.Reset:
                        this._styleMappingsAdapter.clearManualItems();
                        break;
                }
            });
            this._styleMappings = coll;
        }
        return this._styleMappings;
    }
    render() {
        let children = this._contentChildrenManager.getChildren(this.props.children);
        let div = React.createElement("div", {
            className: "ig-treemap igr-treemap",
            ref: this._getMainRef,
            children: children
        });
        //}
        return div;
    }
    constructor(props) {
        super(props);
        this._wrapper = null;
        this.contentStyleMappings = [];
        /**
        * The style mappings actually present in the treemap. Do not directly modify this array.
        * This array's contents can be modified by causing React to reproject the child content.
        * Or adding and removing ranges from the manual ranges collection on the ranges property.
        */
        this.actualStyleMappings = [];
        this._styleMappings = null;
        this._styleMappingsAdapter = null;
        this._implementation = null;
        this.__p = null;
        this._hasUserValues = new Set();
        this._stylingContainer = null;
        this._stylingParent = null;
        this._inStyling = false;
        this._nodeStyling = null;
        this._nodeStyling_wrapped = null;
        this._nodeRenderStyling = null;
        this._nodeRenderStyling_wrapped = null;
        this._nodePointerOver = null;
        this._nodePointerOver_wrapped = null;
        this._nodePointerEnter = null;
        this._nodePointerEnter_wrapped = null;
        this._nodePointerLeave = null;
        this._nodePointerLeave_wrapped = null;
        this._nodePointerPressed = null;
        this._nodePointerPressed_wrapped = null;
        this._nodePointerReleased = null;
        this._nodePointerReleased_wrapped = null;
        if (this._styling) {
            NamePatcher.ensureStylablePatched(Object.getPrototypeOf(this));
        }
        this._getMainRef = this._getMainRef.bind(this);
        this._contentChildrenManager = new ContentChildrenManager((ch) => ch.key || ch.props.name, (ch) => ch.key || ch.props.name, () => this._updateContentChildren());
        this._implementation = this.createImplementation();
        if (document) {
            this._container = document.createElement("div");
            this._container.style.display = "block";
            this._container.style.width = "100%";
            this._container.style.height = "100%";
        }
        var root;
        root = this._container;
        if (this._container != null) {
            root = this._container;
        }
        var ren = new ReactRenderer(root, document, true, DataChartStylingDefaults);
        this._wrapper = ren;
        var treemap = this.i;
        this._treeMap = treemap;
        this._styleMappingsAdapter = new CollectionAdapter(this.contentStyleMappings, this.i.styleMappings, this.actualStyleMappings, (c) => c.i, (i) => {
            if (this._container && this._container.parentElement) {
                i._styling(this._container, this, this);
            }
        }, (i) => { });
        treemap.provideContainer(ren);
        treemap.notifySizeChanged();
        if (props) {
            this.initializeProperties();
        }
        ren.addSizeWatcher(() => {
            this._treeMap.notifySizeChanged();
        });
    }
    shouldComponentUpdate(nextProps, nextState) {
        const mod = getModifiedProps(this.props, nextProps);
        for (const p of Object.keys(mod)) {
            if (isValidProp(this, p)) {
                this[p] = mod[p];
            }
        }
        return true;
    }
    initializeProperties() {
        for (const p of Object.keys(this.props)) {
            if (isValidProp(this, p)) {
                this[p] = this.props[p];
            }
        }
    }
    // supports angular themes or custom properties set in CSS
    updateStyle() {
        this._styling(this._elRef, this);
    }
    destroy() {
        this._treeMap.destroy();
        this._wrapper.destroy();
    }
    componentWillUnmount() {
    }
    componentDidMount() {
        this._elRef.style.width = this._width ? this._width : "";
        this._elRef.style.height = this._height ? this._height : "";
        this._elRef.appendChild(this._container);
        this._treeMap.notifySizeChanged();
        this.initializeContent();
    }
    initializeContent() {
        this._styling(this._container, this);
        if (this.actualStyleMappings && this.actualStyleMappings.length > 0) {
            var currStyleMapping = this.actualStyleMappings;
            for (var i = 0; i < currStyleMapping.length; i++) {
                currStyleMapping[i]._styling(this._container, this, this);
            }
        }
        this._updateContentChildren();
        this.updateStyle();
        this.i.notifySizeChanged();
    }
    createImplementation() {
        return new Treemap();
    }
    get i() {
        return this._implementation;
    }
    /**
 * Gets or sets path to use to get the values from the items.
*/
    get valueMemberPath() {
        return this.i.g3;
    }
    set valueMemberPath(v) {
        this.i.g3 = v;
    }
    /**
     * Gets or sets the root title to use for breadcrumbs.
    */
    get rootTitle() {
        return this.i.gt;
    }
    set rootTitle(v) {
        this.i.gt = v;
    }
    /**
     * Gets or sets the root title to use for breadcrumbs.
    */
    get breadcrumbSequence() {
        return this.i.ev;
    }
    set breadcrumbSequence(v) {
        this.i.ev = v;
    }
    /**
     * Gets or sets the path to use to get the Parent of the items.
    */
    get parentIdMemberPath() {
        return this.i.gh;
    }
    set parentIdMemberPath(v) {
        this.i.gh = v;
    }
    /**
     * Gets or sets the path to use to get the Label of the items.
    */
    get labelMemberPath() {
        return this.i.fz;
    }
    set labelMemberPath(v) {
        this.i.fz = v;
    }
    /**
     * Gets or sets the path to use to get the custom value of the items.
    */
    get customValueMemberPath() {
        return this.i.ey;
    }
    set customValueMemberPath(v) {
        this.i.ey = v;
    }
    /**
     * Gets or sets the path to use to get the id of the items.
    */
    get idMemberPath() {
        return this.i.fp;
    }
    set idMemberPath(v) {
        this.i.fp = v;
    }
    /**
     * Gets or sets the (possibly hierarchical) data to assign to the TreeMap.
    */
    get dataSource() {
        return this.i.dataSource;
    }
    set dataSource(v) {
        this.i.dataSource = v;
    }
    /**
     * Gets or sets brushes to use for the fill scale.
    */
    get fillBrushes() {
        return fromBrushCollection(this.i.b);
    }
    set fillBrushes(v) {
        this.i.b = toBrushCollection(v);
    }
    /**
     * Gets or sets mode to use for the fill scale.
    */
    get fillScaleMode() {
        return this.i.d;
    }
    set fillScaleMode(v) {
        this.i.d = ensureEnum(TreemapFillScaleMode_$type, v);
    }
    /**
     * Gets or sets whether the fill scale is logarithmic.
    */
    get isFillScaleLogarithmic() {
        return this.i.bq;
    }
    set isFillScaleLogarithmic(v) {
        this.i.bq = ensureBool(v);
    }
    /**
     * Gets or sets the logarithm base to use if the fill scale is logarithmic.
    */
    get fillScaleLogarithmBase() {
        return this.i.ee;
    }
    set fillScaleLogarithmBase(v) {
        this.i.ee = +v;
    }
    /**
     * Gets or sets the minimum value to use for the fill scale.
    */
    get fillScaleMinimumValue() {
        return this.i.c6;
    }
    set fillScaleMinimumValue(v) {
        this.i.c6 = +v;
    }
    /**
     * Gets or sets the maximum value to use for the fill scale.
    */
    get fillScaleMaximumValue() {
        return this.i.c5;
    }
    set fillScaleMaximumValue(v) {
        this.i.c5 = +v;
    }
    /**
     * Gets or sets the vertical fit mode to use for the node labels.
    */
    get labelVerticalFitMode() {
        return this.i.p;
    }
    set labelVerticalFitMode(v) {
        this.i.p = ensureEnum(TreemapLabelVerticalFitMode_$type, v);
    }
    /**
     * Gets or sets the horizontal fit mode to use for the node labels.
    */
    get labelHorizontalFitMode() {
        return this.i.m;
    }
    set labelHorizontalFitMode(v) {
        this.i.m = ensureEnum(TreemapLabelHorizontalFitMode_$type, v);
    }
    /**
     * Gets or sets the background to use for the overlay header when it is hovered.
    */
    get overlayHeaderHoverBackground() {
        return brushToString(this.i.i2);
    }
    set overlayHeaderHoverBackground(v) {
        this.i.i2 = stringToBrush(v);
    }
    /**
     * Gets or sets the background to use for the header when it is hovered.
    */
    get headerHoverBackground() {
        return brushToString(this.i.iw);
    }
    set headerHoverBackground(v) {
        this.i.iw = stringToBrush(v);
    }
    /**
     * Gets or sets the background to use for the header.
    */
    get headerBackground() {
        return brushToString(this.i.iu);
    }
    set headerBackground(v) {
        this.i.iu = stringToBrush(v);
    }
    /**
     * Gets or sets the background to use for the overlay header.
    */
    get overlayHeaderBackground() {
        return brushToString(this.i.i1);
    }
    set overlayHeaderBackground(v) {
        this.i.i1 = stringToBrush(v);
    }
    /**
     * Gets or sets the text color to use for the header.
    */
    get headerTextColor() {
        return brushToString(this.i.iz);
    }
    set headerTextColor(v) {
        this.i.iz = stringToBrush(v);
    }
    /**
     * Gets or sets the dark text color to use for the header.
    */
    get headerDarkTextColor() {
        return brushToString(this.i.iv);
    }
    set headerDarkTextColor(v) {
        this.i.iv = stringToBrush(v);
    }
    /**
     * Gets or sets the text color to use for the nodes.
    */
    get textColor() {
        return brushToString(this.i.jc);
    }
    set textColor(v) {
        this.i.jc = stringToBrush(v);
    }
    /**
     * Gets or sets the dark text color to use for the nodes.
    */
    get darkTextColor() {
        return brushToString(this.i.it);
    }
    set darkTextColor(v) {
        this.i.it = stringToBrush(v);
    }
    /**
     * Gets or sets the text color to use for the header.
    */
    get headerHoverTextColor() {
        return brushToString(this.i.iy);
    }
    set headerHoverTextColor(v) {
        this.i.iy = stringToBrush(v);
    }
    /**
     * Gets or sets the dark text color to use for the header when hovered.
    */
    get headerHoverDarkTextColor() {
        return brushToString(this.i.ix);
    }
    set headerHoverDarkTextColor(v) {
        this.i.ix = stringToBrush(v);
    }
    /**
     * Gets or sets the font to use for content nodes
    */
    get textStyle() {
        if (this.i.a4 == null) {
            return null;
        }
        return this.i.a4.fontString;
    }
    set textStyle(v) {
        let fi = new FontInfo();
        fi.fontString = v;
        this.i.a4 = fi;
    }
    /**
     * Gets or sets the font to use for header nodes
    */
    get headerTextStyle() {
        if (this.i.a2 == null) {
            return null;
        }
        return this.i.a2.fontString;
    }
    set headerTextStyle(v) {
        let fi = new FontInfo();
        fi.fontString = v;
        this.i.a2 = fi;
    }
    /**
     * Gets or sets the font to use for header nodes
    */
    get headerDisplayMode() {
        return this.i.j;
    }
    set headerDisplayMode(v) {
        this.i.j = ensureEnum(TreemapHeaderDisplayMode_$type, v);
    }
    /**
     * Gets or sets the left margin to use for the header.
    */
    get headerLabelLeftMargin() {
        return this.i.da;
    }
    set headerLabelLeftMargin(v) {
        this.i.da = +v;
    }
    /**
     * Gets or sets the top margin to use for the header.
    */
    get headerLabelTopMargin() {
        return this.i.dc;
    }
    set headerLabelTopMargin(v) {
        this.i.dc = +v;
    }
    /**
     * Gets or sets the right margin to use for the header.
    */
    get headerLabelRightMargin() {
        return this.i.db;
    }
    set headerLabelRightMargin(v) {
        this.i.db = +v;
    }
    /**
     * Gets or sets the bottom margin to use for the header.
    */
    get headerLabelBottomMargin() {
        return this.i.c9;
    }
    set headerLabelBottomMargin(v) {
        this.i.c9 = +v;
    }
    /**
     * Gets or sets the left margin to use for the overlay header.
    */
    get overlayHeaderLabelLeftMargin() {
        return this.i.dl;
    }
    set overlayHeaderLabelLeftMargin(v) {
        this.i.dl = +v;
    }
    /**
     * Gets or sets the top margin to use for the overlay header.
    */
    get overlayHeaderLabelTopMargin() {
        return this.i.dn;
    }
    set overlayHeaderLabelTopMargin(v) {
        this.i.dn = +v;
    }
    /**
     * Gets or sets the right margin to use for the overlay header.
    */
    get overlayHeaderLabelRightMargin() {
        return this.i.dm;
    }
    set overlayHeaderLabelRightMargin(v) {
        this.i.dm = +v;
    }
    /**
     * Gets or sets the bottom margin to use for the overlay header.
    */
    get overlayHeaderLabelBottomMargin() {
        return this.i.dk;
    }
    set overlayHeaderLabelBottomMargin(v) {
        this.i.dk = +v;
    }
    /**
     * Gets or sets the left margin to use for the labels.
    */
    get labelLeftMargin() {
        return this.i.df;
    }
    set labelLeftMargin(v) {
        this.i.df = +v;
    }
    /**
     * Gets or sets the top margin to use for the labels.
    */
    get labelTopMargin() {
        return this.i.dh;
    }
    set labelTopMargin(v) {
        this.i.dh = +v;
    }
    /**
     * Gets or sets the right margin to use for the labels.
    */
    get labelRightMargin() {
        return this.i.dg;
    }
    set labelRightMargin(v) {
        this.i.dg = +v;
    }
    /**
     * Gets or sets the bottom margin to use for the labels.
    */
    get labelBottomMargin() {
        return this.i.de;
    }
    set labelBottomMargin(v) {
        this.i.de = +v;
    }
    /**
     * Gets or sets the left margin to use for the parent nodes.
    */
    get parentNodeLeftMargin() {
        return this.i.dr;
    }
    set parentNodeLeftMargin(v) {
        this.i.dr = +v;
    }
    /**
     * Gets or sets the top margin to use for the parent nodes.
    */
    get parentNodeTopMargin() {
        return this.i.dv;
    }
    set parentNodeTopMargin(v) {
        this.i.dv = +v;
    }
    /**
     * Gets or sets the right margin to use for the parent nodes.
    */
    get parentNodeRightMargin() {
        return this.i.dt;
    }
    set parentNodeRightMargin(v) {
        this.i.dt = +v;
    }
    /**
     * Gets or sets the bottom margin to use for the parent nodes.
    */
    get parentNodeBottomMargin() {
        return this.i.dp;
    }
    set parentNodeBottomMargin(v) {
        this.i.dp = +v;
    }
    /**
     * Gets or sets the left padding to use for the parent nodes.
    */
    get parentNodeLeftPadding() {
        return this.i.ds;
    }
    set parentNodeLeftPadding(v) {
        this.i.ds = +v;
    }
    /**
     * Gets or sets the top padding to use for the parent nodes.
    */
    get parentNodeTopPadding() {
        return this.i.dw;
    }
    set parentNodeTopPadding(v) {
        this.i.dw = +v;
    }
    /**
     * Gets or sets the right padding to use for the parent nodes.
    */
    get parentNodeRightPadding() {
        return this.i.du;
    }
    set parentNodeRightPadding(v) {
        this.i.du = +v;
    }
    /**
     * Gets or sets the bottom padding to use for the parent nodes.
    */
    get parentNodeBottomPadding() {
        return this.i.dq;
    }
    set parentNodeBottomPadding(v) {
        this.i.dq = +v;
    }
    /**
     * Gets or sets the horizontal alignment to use for the node labels.
    */
    get labelHorizontalAlignment() {
        return this.i.id;
    }
    set labelHorizontalAlignment(v) {
        this.i.id = ensureEnum(HorizontalAlignment_$type, v);
    }
    /**
     * Gets or sets the vertical alignment to use for the node labels.
    */
    get labelVerticalAlignment() {
        return this.i.ji;
    }
    set labelVerticalAlignment(v) {
        this.i.ji = ensureEnum(VerticalAlignment_$type, v);
    }
    /**
     * Gets or sets the height to use for the header.
    */
    get headerHeight() {
        return this.i.c8;
    }
    set headerHeight(v) {
        this.i.c8 = +v;
    }
    /**
     * Gets or sets the outline to use for the nodes.
    */
    get outline() {
        return brushToString(this.i.i0);
    }
    set outline(v) {
        this.i.i0 = stringToBrush(v);
    }
    /**
     * Gets or sets the stroke thickness to use for the node outline.
    */
    get strokeThickness() {
        return this.i.d8;
    }
    set strokeThickness(v) {
        this.i.d8 = +v;
    }
    /**
     * Gets or sets the opacity to use for the nodes.
    */
    get nodeOpacity() {
        return this.i.dj;
    }
    set nodeOpacity(v) {
        this.i.dj = +v;
    }
    /**
     * Gets or sets the orientation to use for the stripped and slice and dice layout types.
    */
    get layoutOrientation() {
        return this.i.aj;
    }
    set layoutOrientation(v) {
        this.i.aj = ensureEnum(TreemapOrientation_$type, v);
    }
    /**
     * Gets or sets the type of layout to use for the nodes.
    */
    get layoutType() {
        return this.i.s;
    }
    set layoutType(v) {
        this.i.s = ensureEnum(TreemapLayoutType_$type, v);
    }
    /**
     * Gets or sets the minimum size (width or height) to display a node.
    */
    get minimumDisplaySize() {
        return this.i.di;
    }
    set minimumDisplaySize(v) {
        this.i.di = +v;
    }
    /**
     * Gets or sets the number of milliseconds over which changes to the gauge should be animated.
    */
    get transitionDuration() {
        return this.i.ei;
    }
    set transitionDuration(v) {
        this.i.ei = +v;
    }
    /**
     * Gets or sets the scaling value used to affect the pixel density of the control.
     * A higher scaling ratio will produce crisper visuals at the expense of memory.  Lower values will cause the control
     * to appear blurry.
    */
    get pixelScalingRatio() {
        return this.i.dx;
    }
    set pixelScalingRatio(v) {
        this.i.dx = +v;
    }
    get actualPixelScalingRatio() {
        return this.i.c1;
    }
    set actualPixelScalingRatio(v) {
        this.i.c1 = +v;
    }
    /**
     * Gets or sets the scaling value used to affect the pixel density of the control while it is animating.
     * A higher scaling ratio will produce crisper visuals at the expense of memory.  Lower values will cause the control
     * to appear blurry.
    */
    get interactionPixelScalingRatio() {
        return this.i.dd;
    }
    set interactionPixelScalingRatio(v) {
        this.i.dd = +v;
    }
    /**
     * Gets or sets the resolved scaling value used to affect the pixel density of the control while it is animating.
     * A higher scaling ratio will produce crisper visuals at the expense of memory.  Lower values will cause the control
     * to appear blurry.
    */
    get actualInteractionPixelScalingRatio() {
        return this.i.c0;
    }
    set actualInteractionPixelScalingRatio(v) {
        this.i.c0 = +v;
    }
    /**
     * Gets or sets the number of milliseconds over which the highlighting effect will render.
    */
    get highlightingTransitionDuration() {
        return this.i.eg;
    }
    set highlightingTransitionDuration(v) {
        this.i.eg = +v;
    }
    /**
     * Gets or sets the highlighting mode to use.
    */
    get highlightingMode() {
        return this.i.au;
    }
    set highlightingMode(v) {
        this.i.au = ensureEnum(TreemapHighlightingMode_$type, v);
    }
    /**
     * Gets the actual highlighting mode used.
    */
    get actualHighlightingMode() {
        return this.i.as;
    }
    set actualHighlightingMode(v) {
        this.i.as = ensureEnum(TreemapHighlightingMode_$type, v);
    }
    get animating() {
        return this.i.bm;
    }
    /**
     * Gets or sets the item to drill to in the treemap.
    */
    get focusItem() {
        return this.i.ek;
    }
    set focusItem(v) {
        this.i.ek = v;
    }
    findByName(name) {
        if (this.findEphemera) {
            if (name && name.indexOf("@@e:") == 0) {
                return this.findEphemera(name);
            }
        }
        if (this.styleMappings != null && this.styleMappings.findByName && this.styleMappings.findByName(name)) {
            return this.styleMappings.findByName(name);
        }
        return null;
    }
    get hasUserValues() {
        return this._hasUserValues;
    }
    __m(propertyName) {
        if (!this._inStyling) {
            this._hasUserValues.add(propertyName);
        }
    }
    _styling(container, component, parent) {
        if (this._inStyling) {
            return;
        }
        this._inStyling = true;
        this._stylingContainer = container;
        this._stylingParent = component;
        let genericPrefix = "";
        let typeName = this.i.$type.name;
        if (typeName.indexOf("Xam") === 0) {
            typeName = typeName.substring(3);
        }
        genericPrefix = toSpinal("Treemap");
        let additionalPrefixes = [];
        let prefix = toSpinal(typeName);
        additionalPrefixes.push(prefix + "-");
        let b = this.i.$type.baseType;
        while (b && b.name != "Object" &&
            b.name != "Base" &&
            b.name != "Control" &&
            b.Name != "DependencyObject" &&
            b.Name != "FrameworkElement") {
            typeName = b.name;
            if (typeName.indexOf("Xam") === 0) {
                typeName = typeName.substring(3);
            }
            let basePrefix = toSpinal(typeName);
            additionalPrefixes.push(basePrefix + "-");
            b = b.baseType;
        }
        if (parent) {
            let parentTypeName = parent.i.$type.name;
            if (parentTypeName.indexOf("Xam") === 0) {
                parentTypeName = parentTypeName.substring(3);
            }
            let parentPrefix = toSpinal(parentTypeName);
            additionalPrefixes.push(parentPrefix + "-" + genericPrefix + "-");
            additionalPrefixes.push(parentPrefix + "-" + prefix + "-");
        }
        initializePropertiesFromCss(container, this, genericPrefix + "-", this.hasUserValues, false, additionalPrefixes);
        if (this._otherStyling) {
            this._otherStyling(container, component, parent);
        }
        this._inStyling = false;
    }
    notifySizeChanged() {
        this.i.notifySizeChanged();
    }
    /**
     * Returns visuals as a serialized string.
    
    */
    exportSerializedVisualData() {
        let iv = this.i.e1();
        return (iv);
    }
    markDirty() {
        this.i.hh();
    }
    onDetachedFromUI() {
        this.i.onDetachedFromUI();
    }
    onAttachedToUI() {
        this.i.onAttachedToUI();
    }
    flush() {
        this.i.he();
    }
    notifySetItem(source_, index, oldItem, newItem) {
        this.i.hm(source_, index, oldItem, newItem);
    }
    /**
     * Manually notifies the treemap's data source that the data it has bound to has been cleared and needs to be re-examined.
     * This should not be called if the data that the pie chart is bound to is already observable.
    
    * @param source_  * The data source.
    */
    notifyClearItems(source_) {
        this.i.hj(source_);
    }
    notifyInsertItem(source_, index, newItem) {
        this.i.hk(source_, index, newItem);
    }
    notifyRemoveItem(source_, index, oldItem) {
        this.i.hl(source_, index, oldItem);
    }
    simulateHover(point) {
        this.i.h5(toPoint(point));
    }
    /**
     * Fired when a node is being styled. Provides an opportunity to customize node styling.
    */
    get nodeStyling() {
        return this._nodeStyling;
    }
    set nodeStyling(ev) {
        if (this._nodeStyling_wrapped !== null) {
            this.i.nodeStyling = delegateRemove(this.i.nodeStyling, this._nodeStyling_wrapped);
            this._nodeStyling_wrapped = null;
            this._nodeStyling = null;
        }
        this._nodeStyling = ev;
        this._nodeStyling_wrapped = (o, e) => {
            let outerArgs = new IgrTreemapNodeStylingEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeNodeStyling) {
                this.beforeNodeStyling(this, outerArgs);
            }
            if (this._nodeStyling) {
                this._nodeStyling(this, outerArgs);
            }
        };
        this.i.nodeStyling = delegateCombine(this.i.nodeStyling, this._nodeStyling_wrapped);
        ;
    }
    /**
     * Fired before a node is rendered for last minute style changes.
    */
    get nodeRenderStyling() {
        return this._nodeRenderStyling;
    }
    set nodeRenderStyling(ev) {
        if (this._nodeRenderStyling_wrapped !== null) {
            this.i.nodeRenderStyling = delegateRemove(this.i.nodeRenderStyling, this._nodeRenderStyling_wrapped);
            this._nodeRenderStyling_wrapped = null;
            this._nodeRenderStyling = null;
        }
        this._nodeRenderStyling = ev;
        this._nodeRenderStyling_wrapped = (o, e) => {
            let outerArgs = new IgrTreemapNodeStylingEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeNodeRenderStyling) {
                this.beforeNodeRenderStyling(this, outerArgs);
            }
            if (this._nodeRenderStyling) {
                this._nodeRenderStyling(this, outerArgs);
            }
        };
        this.i.nodeRenderStyling = delegateCombine(this.i.nodeRenderStyling, this._nodeRenderStyling_wrapped);
        ;
    }
    /**
     * Fired with the pointer is moving over a node.
    */
    get nodePointerOver() {
        return this._nodePointerOver;
    }
    set nodePointerOver(ev) {
        if (this._nodePointerOver_wrapped !== null) {
            this.i.nodePointerOver = delegateRemove(this.i.nodePointerOver, this._nodePointerOver_wrapped);
            this._nodePointerOver_wrapped = null;
            this._nodePointerOver = null;
        }
        this._nodePointerOver = ev;
        this._nodePointerOver_wrapped = (o, e) => {
            let outerArgs = new IgrTreemapNodePointerEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeNodePointerOver) {
                this.beforeNodePointerOver(this, outerArgs);
            }
            if (this._nodePointerOver) {
                this._nodePointerOver(this, outerArgs);
            }
        };
        this.i.nodePointerOver = delegateCombine(this.i.nodePointerOver, this._nodePointerOver_wrapped);
        ;
    }
    /**
     * Fired when the pointer enters a node.
    */
    get nodePointerEnter() {
        return this._nodePointerEnter;
    }
    set nodePointerEnter(ev) {
        if (this._nodePointerEnter_wrapped !== null) {
            this.i.nodePointerEnter = delegateRemove(this.i.nodePointerEnter, this._nodePointerEnter_wrapped);
            this._nodePointerEnter_wrapped = null;
            this._nodePointerEnter = null;
        }
        this._nodePointerEnter = ev;
        this._nodePointerEnter_wrapped = (o, e) => {
            let outerArgs = new IgrTreemapNodePointerEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeNodePointerEnter) {
                this.beforeNodePointerEnter(this, outerArgs);
            }
            if (this._nodePointerEnter) {
                this._nodePointerEnter(this, outerArgs);
            }
        };
        this.i.nodePointerEnter = delegateCombine(this.i.nodePointerEnter, this._nodePointerEnter_wrapped);
        ;
    }
    /**
     * Fired when the pointer leaved a node.
    */
    get nodePointerLeave() {
        return this._nodePointerLeave;
    }
    set nodePointerLeave(ev) {
        if (this._nodePointerLeave_wrapped !== null) {
            this.i.nodePointerLeave = delegateRemove(this.i.nodePointerLeave, this._nodePointerLeave_wrapped);
            this._nodePointerLeave_wrapped = null;
            this._nodePointerLeave = null;
        }
        this._nodePointerLeave = ev;
        this._nodePointerLeave_wrapped = (o, e) => {
            let outerArgs = new IgrTreemapNodePointerEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeNodePointerLeave) {
                this.beforeNodePointerLeave(this, outerArgs);
            }
            if (this._nodePointerLeave) {
                this._nodePointerLeave(this, outerArgs);
            }
        };
        this.i.nodePointerLeave = delegateCombine(this.i.nodePointerLeave, this._nodePointerLeave_wrapped);
        ;
    }
    /**
     * Fired when the pointer is pressed on a node.
    */
    get nodePointerPressed() {
        return this._nodePointerPressed;
    }
    set nodePointerPressed(ev) {
        if (this._nodePointerPressed_wrapped !== null) {
            this.i.nodePointerPressed = delegateRemove(this.i.nodePointerPressed, this._nodePointerPressed_wrapped);
            this._nodePointerPressed_wrapped = null;
            this._nodePointerPressed = null;
        }
        this._nodePointerPressed = ev;
        this._nodePointerPressed_wrapped = (o, e) => {
            let outerArgs = new IgrTreemapNodePointerEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeNodePointerPressed) {
                this.beforeNodePointerPressed(this, outerArgs);
            }
            if (this._nodePointerPressed) {
                this._nodePointerPressed(this, outerArgs);
            }
        };
        this.i.nodePointerPressed = delegateCombine(this.i.nodePointerPressed, this._nodePointerPressed_wrapped);
        ;
    }
    /**
     * Fired when the pointer is released on a node.
    */
    get nodePointerReleased() {
        return this._nodePointerReleased;
    }
    set nodePointerReleased(ev) {
        if (this._nodePointerReleased_wrapped !== null) {
            this.i.nodePointerReleased = delegateRemove(this.i.nodePointerReleased, this._nodePointerReleased_wrapped);
            this._nodePointerReleased_wrapped = null;
            this._nodePointerReleased = null;
        }
        this._nodePointerReleased = ev;
        this._nodePointerReleased_wrapped = (o, e) => {
            let outerArgs = new IgrTreemapNodePointerEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeNodePointerReleased) {
                this.beforeNodePointerReleased(this, outerArgs);
            }
            if (this._nodePointerReleased) {
                this._nodePointerReleased(this, outerArgs);
            }
        };
        this.i.nodePointerReleased = delegateCombine(this.i.nodePointerReleased, this._nodePointerReleased_wrapped);
        ;
    }
}
