/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
import{LitElement as v,html as n,nothing as l,render as m}from"lit";import{property as b,customElement as C}from"lit/decorators.js";import{classMap as f}from"lit/directives/class-map.js";import"@typo3/backend/element/icon-element.js";import"@typo3/backend/dropdown.js";var p=function(d,e,t,i){var s=arguments.length,r=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(d,e,t,i);else for(var c=d.length-1;c>=0;c--)(o=d[c])&&(r=(s<3?o(r):s>3?o(e,t,r):o(e,t))||r);return s>3&&r&&Object.defineProperty(e,t,r),r},a;(function(d){d.FULL="full",d.PATH="path"})(a||(a={}));let u=class extends v{constructor(){super(...arguments),this.nodes=[],this.alignRight=!1,this.label="Breadcrumb",this.mode=a.FULL,this.collapsedNodes=[],this.adjustRafId=null,this.dropdownButtonWidth=null,this.ellipsisWidth=null,this.measurementContainer=null}connectedCallback(){super.connectedCallback(),this.identifier=Date.now().toString(36)+Math.random().toString(36).slice(2),this.resizeObserver=new ResizeObserver(()=>this.scheduleAdjust()),this.resizeObserver.observe(this),this.intersectionObserver=new IntersectionObserver(e=>{e.some(t=>t.isIntersecting)&&this.scheduleAdjust()}),this.intersectionObserver.observe(this)}disconnectedCallback(){this.resizeObserver.disconnect(),this.intersectionObserver.disconnect(),this.adjustRafId!==null&&(cancelAnimationFrame(this.adjustRafId),this.adjustRafId=null),super.disconnectedCallback()}createRenderRoot(){return this}willUpdate(e){e.has("nodes")&&(this.createMeasurementContainer(),this.measureEllipsis(),this.measureDropdownToggle(),this.measureNodeWidths())}render(){const e=this.nodes.filter(s=>!this.collapsedNodes.includes(s)),t=f({breadcrumb:!0,"breadcrumb-collapsible":!0,"breadcrumb-right":this.alignRight,"breadcrumb-condensed":this.mode===a.PATH}),i=n`${this.renderCollapsedNodesIndicator()} ${e.map(s=>{const r=f({"breadcrumb-item":!0,"breadcrumb-item-first":this.isFirstNode(s),"breadcrumb-item-last":this.isLastNode(s)});return n`