import { _ as _applyDecoratedDescriptor, a as _initializerDefineProperty } from '../_rollupPluginBabelHelpers-9wjJaosZ.js';
import { setComponentTemplate } from '@ember/component';
import { precompileTemplate } from '@ember/template-compilation';
import Component from '@glimmer/component';
import { array } from '@ember/helper';
import { inject } from '@ember/service';
import { ensureSafeComponent } from '@embroider/util';
import { notEq } from 'ember-truth-helpers';
import typeOf from '../helpers/type-of.js';
import Render from './eui-i18n/render.js';

var _class, _descriptor;
let EuiI18nComponent = setComponentTemplate(precompileTemplate(`
    {{#let this.lookupToken as |result|}}
      {{#if this.customComponent}}
        {{#each
          (if (notEq (typeOf result) "array") (array result) result)
          as |token|
        }}
          {{yield (component this.customComponent token=token)}}
        {{/each}}
      {{else}}
        {{#each
          (if (notEq (typeOf result) "array") (array result) result)
          as |token|
        }}
          {{yield (component Render token=token)}}
        {{/each}}
      {{/if}}
    {{/let}}
  `, {
  strictMode: true,
  scope: () => ({
    notEq,
    typeOf,
    array,
    Render
  })
}), (_class = class EuiI18nComponent extends Component {
  constructor(...args) {
    super(...args);
    _initializerDefineProperty(this, "euiI18n", _descriptor, this);
  }
  get lookupToken() {
    const lookupToken = this.euiI18n._lookupToken;
    return lookupToken({
      token: this.args.token,
      i18nMapping: this.args.i18n?.mapping,
      valueDefault: this.args.default,
      values: this.args.values
    });
  }
  get customComponent() {
    if (!this.args.i18n?.renderComponent) return undefined;
    return ensureSafeComponent(this.args.i18n?.renderComponent, this);
  }
}, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "euiI18n", [inject], {
  configurable: true,
  enumerable: true,
  writable: true,
  initializer: null
})), _class));

export { EuiI18nComponent as default };
//# sourceMappingURL=eui-i18n.js.map
