'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var palette = require('../../model/mixin/palette.js');

function enableAriaDecalForTree(seriesModel) {
  var data = seriesModel.getData();
  var tree = data.tree;
  var decalPaletteScope = {};
  tree.eachNode(function (node) {
    // Use decal of level 1 node
    var current = node;
    while (current && current.depth > 1) {
      current = current.parentNode;
    }
    var decal = palette.getDecalFromPalette(seriesModel.ecModel, current.name || current.dataIndex + '', decalPaletteScope);
    node.setVisual('decal', decal);
  });
}

exports.default = enableAriaDecalForTree;
