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 { helper } from '@ember/component/helper';
import { concat } from '@ember/helper';
import VerticalCollection from '@html-next/vertical-collection/components/vertical-collection/component';
import style from 'ember-style-modifier/modifiers/style';
import randomId from '../../-private/random-id.js';
import { getHtmlContent } from '../../utils/code/utils.js';
import EuiAutoSizerComponent from '../eui-auto-sizer.js';

class EuiCodeBlockVirtualizedComponent extends Component {
  constructor(...args) {
    super(...args);
    _defineProperty(this, "getHtmlContent", helper(function ([node, index, rowHeight]) {
      const content = getHtmlContent([node]);
      const span = content.element.firstChild;
      if (span) {
        span.style.position = 'absolute';
        span.style.height = `${rowHeight}px`;
        span.style.left = '0';
        span.style.top = `${index * rowHeight}px`;
      }
      return span;
    }));
  }
}
setComponentTemplate(precompileTemplate(`
    {{! DO NOT FORMAT AT ALL, PRE TAGS RESPECT WHITESPACE LITERALLY }}
    {{! DO NOT FORMAT AT ALL, PRE TAGS RESPECT WHITESPACE LITERALLY }}
    {{! DO NOT FORMAT AT ALL, PRE TAGS RESPECT WHITESPACE LITERALLY }}
    {{! DO NOT FORMAT AT ALL, PRE TAGS RESPECT WHITESPACE LITERALLY }}
    {{! DO NOT FORMAT AT ALL, PRE TAGS RESPECT WHITESPACE LITERALLY }}
    {{! DO NOT FORMAT AT ALL, PRE TAGS RESPECT WHITESPACE LITERALLY }}
    {{! DO NOT FORMAT AT ALL, PRE TAGS RESPECT WHITESPACE LITERALLY }}
    {{! DO NOT FORMAT AT ALL, PRE TAGS RESPECT WHITESPACE LITERALLY }}
    {{! DO NOT FORMAT AT ALL, PRE TAGS RESPECT WHITESPACE LITERALLY }}
    {{#let (randomId) as |theID|}}
      <EuiAutoSizer as |styles|>
        <pre
          {{style styles}}
          {{!template-lint-disable}}
          style="position: relative; overflow: auto;"
          id={{theID}}
          ...attributes
        ><VerticalCollection
            @items={{@data}}
            @tagName="code"
            class="euiCodeBlock__code"
            data-code-language={{@language}}
            @estimateHeight={{@rowHeight}}
            @bufferSize={{40}}
            @staticHeight={{true}}
            @containerSelector={{concat "#" theID}}
            as |opt index|
          >{{this.getHtmlContent
              opt
              index
              @rowHeight
            }}</VerticalCollection></pre>
      </EuiAutoSizer>
    {{/let}}
  `, {
  strictMode: true,
  scope: () => ({
    randomId,
    EuiAutoSizer: EuiAutoSizerComponent,
    style,
    VerticalCollection,
    concat
  })
}), EuiCodeBlockVirtualizedComponent);

export { EuiCodeBlockVirtualizedComponent as default };
//# sourceMappingURL=virtualized.js.map
