import { _ as _applyDecoratedDescriptor } from '../_rollupPluginBabelHelpers-9wjJaosZ.js';
import { setComponentTemplate } from '@ember/component';
import { precompileTemplate } from '@ember/template-compilation';
import Component from '@glimmer/component';
import { assert } from '@ember/debug';
import { hash } from '@ember/helper';
import { action } from '@ember/object';
import didInsert from '@ember/render-modifiers/modifiers/did-insert';
import didUpdate from '@ember/render-modifiers/modifiers/did-update';
import classNames from '../helpers/class-names.js';
import inlineStyles from '../helpers/inline-styles.js';
import simpleStyle from '../modifiers/simple-style.js';

var _class;
const LEVEL_COLORS = ['primary', 'success', 'warning', 'danger'];
let EuiRangeLevelsComponent = setComponentTemplate(precompileTemplate(`
    <div
      class={{classNames
        "euiRangeLevels"
        (if @showTicks "euiRangeLevels--hasTicks")
        (if @compressed "euiRangeLevels--compressed")
      }}
      {{didInsert this.validateLevels}}
      {{didUpdate this.validateLevels @levels}}
      {{didUpdate this.validateLevels @min}}
      {{didUpdate this.validateLevels @max}}
    >
      {{#each @levels as |level|}}
        <span
          class="euiRangeLevel euiRangeLevel--{{level.color}}"
          {{simpleStyle
            (inlineStyles
              componentName="EuiRangeLevels"
              componentArgs=(hash
                level=level max=@max min=@min trackWidth=@trackWidth
              )
            )
          }}
        ></span>
      {{/each}}
    </div>
  `, {
  strictMode: true,
  scope: () => ({
    classNames,
    didInsert,
    didUpdate,
    simpleStyle,
    inlineStyles,
    hash
  })
}), (_class = class EuiRangeLevelsComponent extends Component {
  validateLevels() {
    const {
      min,
      max
    } = this.args;
    this.args.levels?.forEach?.(level => {
      if (level.min < min) {
        assert(`The level min of ${level.min} is lower than the min value of ${min}.`, true);
      }
      if (level.max > max) {
        assert(`The level max of ${level.max} is higher than the max value of ${max}.`, true);
      }
    });
  }
}, (_applyDecoratedDescriptor(_class.prototype, "validateLevels", [action], Object.getOwnPropertyDescriptor(_class.prototype, "validateLevels"), _class.prototype)), _class));

export { LEVEL_COLORS, EuiRangeLevelsComponent as default };
//# sourceMappingURL=eui-range-levels.js.map
