import { r as registerInstance, g as getAssetPath, h, c as getElement } from './index-0a3acb15.js';

const eclBreadcrumbEcCss = ".ecl-breadcrumb.sc-ecl-breadcrumb-ec{background-color:#fff;margin:0}.ecl-breadcrumb__container.sc-ecl-breadcrumb-ec{box-sizing:border-box;display:flex;flex-wrap:wrap;list-style:none;margin:0;padding:0 0 1rem}.ecl-breadcrumb__container.sc-ecl-breadcrumb-ec::after{clear:both;content:\"\";display:block}.ecl-breadcrumb__segment.sc-ecl-breadcrumb-ec{align-items:center;display:inline-flex;margin-top:1rem;max-width:100%}.ecl-breadcrumb__segment[aria-hidden=true].sc-ecl-breadcrumb-ec{position:absolute;visibility:hidden}.no-js.sc-ecl-breadcrumb-ec .ecl-breadcrumb__segment[aria-hidden=true].sc-ecl-breadcrumb-ec{position:static;visibility:visible}.no-js.sc-ecl-breadcrumb-ec .ecl-breadcrumb__segment--ellipsis[aria-hidden=false].sc-ecl-breadcrumb-ec{display:none}.ecl-breadcrumb__ellipsis.sc-ecl-breadcrumb-ec{background-color:transparent;border-width:0;box-sizing:border-box;color:#004494;font:normal normal 400 0.875rem/1rem arial, sans-serif;font-weight:700;margin:0;padding:0 0}.ecl-breadcrumb__ellipsis.sc-ecl-breadcrumb-ec:hover{background-color:#f2f5f9;color:#004494}.ecl-breadcrumb__ellipsis.sc-ecl-breadcrumb-ec:focus-visible{outline-offset:2px}.ecl-breadcrumb__link.sc-ecl-breadcrumb-ec{font:normal normal 400 0.875rem/1rem arial, sans-serif;font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ecl-breadcrumb__icon.sc-ecl-breadcrumb-ec{fill:#004494;flex-shrink:0;-webkit-margin-start:0.5rem;margin-inline-start:0.5rem;-webkit-margin-end:0.5rem;margin-inline-end:0.5rem;vertical-align:text-bottom}.ecl-breadcrumb__current-page.sc-ecl-breadcrumb-ec{color:#707070;font:normal normal 400 0.875rem/1rem arial, sans-serif;font-weight:700}.ecl-breadcrumb--negative.sc-ecl-breadcrumb-ec{background-color:#004494}.ecl-breadcrumb--negative.sc-ecl-breadcrumb-ec .ecl-breadcrumb__ellipsis.sc-ecl-breadcrumb-ec{color:#fff}.ecl-breadcrumb--negative.sc-ecl-breadcrumb-ec .ecl-breadcrumb__ellipsis.sc-ecl-breadcrumb-ec:hover{background-color:#003776}.ecl-breadcrumb--negative.sc-ecl-breadcrumb-ec .ecl-breadcrumb__icon.sc-ecl-breadcrumb-ec{fill:#fff}.ecl-breadcrumb--negative.sc-ecl-breadcrumb-ec .ecl-breadcrumb__current-page.sc-ecl-breadcrumb-ec{color:#bfd0e4}.ecl-breadcrumb__icon.sc-ecl-breadcrumb-ec.sc-ecl-breadcrumb-ec{-webkit-margin-end:0.5rem !important;margin-inline-end:0.5rem !important}.ecl-breadcrumb__ellipsis.sc-ecl-breadcrumb-ec.sc-ecl-breadcrumb-ec{padding:0 !important}.ecl-breadcrumb__ellipsis.sc-ecl-breadcrumb-ec .ecl-icon.sc-ecl-breadcrumb-ec{-webkit-margin-start:0.5rem !important;margin-inline-start:0.5rem !important}";

const eclBreadcrumbEuCss = ".ecl-breadcrumb.sc-ecl-breadcrumb-eu{background-color:#fff;margin:0}.ecl-breadcrumb__container.sc-ecl-breadcrumb-eu{box-sizing:border-box;display:flex;flex-wrap:wrap;list-style:none;margin:0;padding:0 0 1rem}.ecl-breadcrumb__container.sc-ecl-breadcrumb-eu::after{clear:both;content:\"\";display:block}.ecl-breadcrumb__segment.sc-ecl-breadcrumb-eu{align-items:center;display:inline-flex;margin-top:1rem;max-width:100%}.ecl-breadcrumb__segment[aria-hidden=true].sc-ecl-breadcrumb-eu{position:absolute;visibility:hidden}.no-js.sc-ecl-breadcrumb-eu .ecl-breadcrumb__segment[aria-hidden=true].sc-ecl-breadcrumb-eu{position:static;visibility:visible}.no-js.sc-ecl-breadcrumb-eu .ecl-breadcrumb__segment--ellipsis[aria-hidden=false].sc-ecl-breadcrumb-eu{display:none}.ecl-breadcrumb__ellipsis.sc-ecl-breadcrumb-eu{background-color:#f3f6fc;border-width:0;box-sizing:border-box;color:#0e47cb;font:normal normal 400 1rem/1.5rem arial, sans-serif;font-weight:700;margin:0;padding:0 0.25rem}.ecl-breadcrumb__ellipsis.sc-ecl-breadcrumb-eu:hover{background-color:#e7edfa;color:#0e47cb}.ecl-breadcrumb__ellipsis.sc-ecl-breadcrumb-eu:focus-visible{outline-offset:2px}.ecl-breadcrumb__link.sc-ecl-breadcrumb-eu{font:normal normal 400 1rem/1.5rem arial, sans-serif;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ecl-breadcrumb__icon.sc-ecl-breadcrumb-eu{fill:#515560;flex-shrink:0;-webkit-margin-start:0.5rem;margin-inline-start:0.5rem;-webkit-margin-end:0.5rem;margin-inline-end:0.5rem;vertical-align:text-bottom}.ecl-breadcrumb__current-page.sc-ecl-breadcrumb-eu{color:#515560;font:normal normal 400 1rem/1.5rem arial, sans-serif}.ecl-breadcrumb--negative.sc-ecl-breadcrumb-eu{background-color:#0e47cb}.ecl-breadcrumb--negative.sc-ecl-breadcrumb-eu .ecl-breadcrumb__ellipsis.sc-ecl-breadcrumb-eu{color:#fff}.ecl-breadcrumb--negative.sc-ecl-breadcrumb-eu .ecl-breadcrumb__ellipsis.sc-ecl-breadcrumb-eu:hover{background-color:#0b39a2}.ecl-breadcrumb--negative.sc-ecl-breadcrumb-eu .ecl-breadcrumb__icon.sc-ecl-breadcrumb-eu{fill:#fff}.ecl-breadcrumb--negative.sc-ecl-breadcrumb-eu .ecl-breadcrumb__current-page.sc-ecl-breadcrumb-eu{color:#bfd0e4}.ecl-breadcrumb__icon.sc-ecl-breadcrumb-eu.sc-ecl-breadcrumb-eu{-webkit-margin-end:0.5rem !important;margin-inline-end:0.5rem !important}.ecl-breadcrumb__ellipsis.sc-ecl-breadcrumb-eu.sc-ecl-breadcrumb-eu{padding:0 !important}.ecl-breadcrumb__ellipsis.sc-ecl-breadcrumb-eu .ecl-icon.sc-ecl-breadcrumb-eu{-webkit-margin-start:0.5rem !important;margin-inline-start:0.5rem !important}";

const EclBreadcrumb = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.styleClass = '';
    this.variant = 'default';
    this.theme = 'ec';
    this.eclScript = false;
    this.minItemsRight = 2;
  }
  getClass() {
    return [
      `ecl-breadcrumb`,
      `ecl-breadcrumb--${this.variant}`,
      this.styleClass
    ].join(' ');
  }
  componentDidRender() {
    const items = this.el.querySelectorAll('.ecl-breadcrumb__segment');
    const itemsCount = items.length;
    const ellipsis = this.el.querySelector('.ecl-breadcrumb__segment--ellipsis');
    const startHidingIndex = Array.from(items).indexOf(ellipsis);
    const toBeHidden = Array.from(items).slice((startHidingIndex + 1), (itemsCount - this.minItemsRight));
    toBeHidden.forEach((item) => {
      item.setAttribute('data-ecl-breadcrumb-item', 'expandable');
    });
    this.el.querySelector('.ecl-breadcrumb__container').innerHTML = '';
    this.el.querySelector('.ecl-breadcrumb__container').append(...items);
    if (this.eclScript) {
      // Load the ECL vanilla js if not already present.
      const src = getAssetPath('./build/scripts/ecl-breadcrumb-vanilla.js');
      if (document.querySelector(`script[src="${src}"]`)) {
        document.querySelector(`script[src="${src}"]`).remove();
      }
      const script = document.createElement('script');
      script.src = src;
      script.onload = () => {
        const breadcrumb = new ECL.Breadcrumb(this.el.firstElementChild);
        breadcrumb.init();
      };
      document.body.appendChild(script);
    }
  }
  render() {
    return (h("nav", { class: this.getClass(), "data-ecl-breadcrumb": true }, h("ol", { class: "ecl-breadcrumb__container" }, h("slot", null))));
  }
  static get assetsDirs() { return ["build"]; }
  get el() { return getElement(this); }
};
EclBreadcrumb.style = {
  ec: eclBreadcrumbEcCss,
  eu: eclBreadcrumbEuCss
};

export { EclBreadcrumb as ecl_breadcrumb };

//# sourceMappingURL=ecl-breadcrumb.entry.js.map