import templateOnly from '@ember/component/template-only';
import { setComponentTemplate } from '@ember/component';
import { precompileTemplate } from '@ember/template-compilation';
import { hash } from '@ember/helper';
import add from 'ember-math-helpers/helpers/add';
import { or } from 'ember-truth-helpers';
import classNames from '../helpers/class-names.js';
import EuiButtonEmpty from './eui-button-empty.js';
import EuiI18nComponent from './eui-i18n.js';

const EuiPaginationButton = setComponentTemplate(precompileTemplate(`
    {{#let (add @pageIndex 1) as |pageNumber|}}
      <EuiI18n
        @token="euiPaginationButton.longPageString"
        @default="Page {page} of {totalPages}"
        @values={{hash page=pageNumber totalPages=@totalPages}}
        as |Token|
      >
        <Token as |longPageString|>
          <EuiI18n
            @token="euiPaginationButton.shortPageString"
            @default="Page {page}"
            @values={{hash page=pageNumber}}
            as |InnerToken|
          >
            <InnerToken as |shortPageString|>
              <EuiButtonEmpty
                class={{classNames
                  "euiPaginationButton"
                  (if @isActive "euiPaginationButton-isActive")
                  (if @isPlaceholder "euiPaginationButton-isPlaceholder")
                  (if @hideOnMobile "euiPaginationButton--hideOnMobile")
                }}
                aria-label={{if @totalPages longPageString shortPageString}}
                @size="s"
                @color="text"
                @isDisabled={{or @isPlaceholder @isActive}}
                aria-current={{if @isActive true}}
                ...attributes
              >
                {{pageNumber}}
              </EuiButtonEmpty>
            </InnerToken>
          </EuiI18n>
        </Token>
      </EuiI18n>
    {{/let}}
  `, {
  strictMode: true,
  scope: () => ({
    add,
    EuiI18n: EuiI18nComponent,
    hash,
    EuiButtonEmpty,
    classNames,
    or
  })
}), templateOnly("eui-pagination-button", "EuiPaginationButton"));

export { EuiPaginationButton as default };
//# sourceMappingURL=eui-pagination-button.js.map
