import templateOnly from '@ember/component/template-only';
import { setComponentTemplate } from '@ember/component';
import { precompileTemplate } from '@ember/template-compilation';
import { concat } from '@ember/helper';
import style from 'ember-style-modifier/modifiers/style';
import { and, or, eq, not } from 'ember-truth-helpers';
import argOrDefault from '../helpers/arg-or-default.js';
import classNames from '../helpers/class-names.js';
import euiPageRestrictWidth from '../helpers/eui-page-restrict-width.js';
import EuiPageHeaderContent from './eui-page-header-content.js';

const EuiPageHeader = setComponentTemplate(precompileTemplate(`
  {{#let
    (euiPageRestrictWidth (argOrDefault @restrictWidth false) @style)
    (argOrDefault @responsive true)
    (and (argOrDefault @hasDefaultBlock true) (has-block "default"))
    (or
      (and (argOrDefault @hasDescriptionBlock true) (has-block "description"))
      @description
    )
    (or
      (and (argOrDefault @hasPageTitleBlock true) (has-block "pageTitle"))
      @pageTitle
    )
    (or
      (and
        (argOrDefault @hasRightSideItemsBlock true) (has-block "rightSideItems")
      )
      @rightSideItems
    )
    as |styling responsive hasDefaultBlock hasDescriptionBlock hasPageTitleBlock hasRightSideItemsBlock|
  }}
    {{#let
      (classNames
        (if
          styling.widthClassName
          (concat "euiPageHeader--" styling.widthClassName)
        )
        (if @bottomBorder "euiPageHeader--bottomBorder")
        (if responsive "euiPageHeader--responsive")
        (if (eq responsive "reverse") "euiPageHeader--responsiveReverse")
        (if (and hasPageTitleBlock @tabs) "euiPageHeader--tabsAtBottom")
        (if
          (and
            @tabs
            (not hasPageTitleBlock)
            (not hasRightSideItemsBlock)
            (not hasDescriptionBlock)
            (not hasDefaultBlock)
          )
          "euiPageHeader--onlyTabs"
        )
        (if
          @alignItems
          (concat "euiPageHeader--" @alignItems)
          "euiPageHeader--center"
        )
        componentName="EuiPageHeader"
        paddingSize=@paddingSize
      )
      as |classes|
    }}
      {{#if
        (and
          (not @tabs)
          (not hasPageTitleBlock)
          (not hasDescriptionBlock)
          (not hasRightSideItemsBlock)
        )
      }}
        <header class={{classes}} {{style styling.newStyle}} ...attributes>
          {{yield to="default"}}
        </header>
      {{else}}
        {{!template-lint-disable}}
        <header class={{classes}} {{style styling.newStyle}} ...attributes>
          <EuiPageHeaderContent
            @alignItems={{@alignItems}}
            @responsive={{responsive}}
            @pageTitle={{@pageTitle}}
            @pageTitleProps={{@pageTitleProps}}
            @iconType={{@iconType}}
            @breadcrumbs={{@breadcrumbs}}
            @tabs={{@tabs}}
            @description={{@description}}
            @restrictWidth={{@restrictWidth}}
            @hasDescriptionBlock={{not (not hasDescriptionBlock)}}
            @hasPageTitleBlock={{not (not hasPageTitleBlock)}}
            @hasRightSideItemsBlock={{not (not hasRightSideItemsBlock)}}
            @hasDefaultBlock={{not (not hasDefaultBlock)}}
          >
            <:pageTitle>
              {{yield to="pageTitle"}}
            </:pageTitle>
            <:rightSideItems as |item|>
              {{yield item to="rightSideItems"}}
            </:rightSideItems>
            <:description>
              {{yield to="description"}}
            </:description>
            <:default>
              {{yield to="default"}}
            </:default>
          </EuiPageHeaderContent>
        </header>
      {{/if}}
    {{/let}}
  {{/let}}
`, {
  strictMode: true,
  scope: () => ({
    euiPageRestrictWidth,
    argOrDefault,
    and,
    or,
    classNames,
    concat,
    eq,
    not,
    style,
    EuiPageHeaderContent
  })
}), templateOnly("eui-page-header", "EuiPageHeader"));

export { EuiPageHeader as default };
//# sourceMappingURL=eui-page-header.js.map
