import { b as _defineProperty } from '../../_rollupPluginBabelHelpers-9wjJaosZ.js';
import { setComponentTemplate } from '@ember/component';
import { precompileTemplate } from '@ember/template-compilation';
import Component from '@glimmer/component';
import { on } from '@ember/modifier';
import { get } from '@ember/object';
import { htmlSafe, isHTMLSafe } from '@ember/template';
import EuiBadge from '../eui-badge.js';
import EuiTextComponent from '../eui-text.js';

function unwrap(input) {
  if (isHTMLSafe(input)) {
    return input.toString();
  }
  return input;
}
class EuiAccordionAccordionComponent extends Component {
  constructor(...args) {
    super(...args);
    _defineProperty(this, "_regex", /\{\s*(.*?)\s*\}/g);
  }
  get formattedString() {
    let str = unwrap(this.args.customOptionText || 'Add&nbsp;<strong>{searchText}</strong>&nbsp;as custom option');
    let context = {
      searchText: this.args.select.searchText
    };
    return htmlSafe(str.replace(this._regex, (_s, p1, p2) => {
      return get(context, p1 || p2);
    }));
  }
}
setComponentTemplate(precompileTemplate(`
    <div
      role="button"
      class="euiComboBoxOptionsList__rowWrap"
      {{on "click" @onCreateOption}}
    >
      <EuiText class="euiComboBoxOptionsList__empty" @size="xs">
        <div class="euiComboBoxOption__contentWrapper">
          <p class="euiComboBoxOption__emptyStateText">
            {{this.formattedString}}
          </p>
          <EuiBadge
            @iconType="returnKey"
            class="euiComboBoxOption__enterBadge"
            @color="hollow"
          />
        </div>
      </EuiText>
    </div>
  `, {
  strictMode: true,
  scope: () => ({
    on,
    EuiText: EuiTextComponent,
    EuiBadge
  })
}), EuiAccordionAccordionComponent);

export { EuiAccordionAccordionComponent as default };
//# sourceMappingURL=create-option.js.map
