import{a as v}from"./chunk.VAM5SM3O.js";import{a as g}from"./chunk.UFTAQNZB.js";import{a as b,b as f,c,d as o,h}from"./chunk.XJAJO727.js";import{b as m,e as u}from"./chunk.OBAEIKIV.js";import{e as s}from"./chunk.6EV4YU6C.js";var e=class extends h{constructor(){super(...arguments);this.localize=new v(this);this.label="";this.itemPositionsCached=!1;this.isTruncated=!1}get items(){return this.querySelectorAll("sd-6-22-0-breadcrumb-item")}cacheItemPositions(){this.items.forEach(t=>{let{width:r}=t.getBoundingClientRect();t.dataset.size=`${r}`}),this.itemPositionsCached=!0}handleTruncation(){var a;if(document.documentElement.clientWidth<=1024)return;let{width:t}=this.base.getBoundingClientRect(),{width:r}=this.truncated.getBoundingClientRect();this.itemPositionsCached||this.cacheItemPositions(),this.dropdown.innerHTML="",this.isTruncated=!1;let n=0;for(let[p,i]of Array.from(this.items).reverse().entries()){let l=parseFloat(`${(a=i.dataset.size)!=null?a:i.getBoundingClientRect().width}`);if(i.hidden=!1,this.isTruncated){let d=i.cloneNode(!0);this.dropdown.prepend(d),i.hidden=!0;continue}if(p===0||p===1){n+=l;continue}if(this.isTruncated=n+l+r>t,this.isTruncated){let d=i.cloneNode(!0);this.dropdown.prepend(d),i.hidden=!0}else n+=l}}handleMobileChevron(){var r,n,a;let t=document.createElement("sd-6-22-0-icon");t.setAttribute("slot","icon-left"),t.setAttribute("library","_internal"),t.setAttribute("name","chevron-left"),t.setAttribute("class","text-base me-1 lg:hidden"),(a=(n=(r=Array.from(this.items).at(-2))==null?void 0:r.shadowRoot)==null?void 0:n.querySelector("sd-6-22-0-link"))==null||a.appendChild(t)}handleSlotChange(){this.handleMobileChevron()}connectedCallback(){super.connectedCallback(),this.resizeObserver=new ResizeObserver(()=>this.handleTruncation()),this.resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver.unobserve(this)}render(){return u`<nav part="base" class="flex items-center pb-1" aria-label="${this.label}"><sd-6-22-0-dropdown part="truncated" class="${g(!this.isTruncated&&"absolute opacity-0 pointer-events-none")}"><button slot="trigger" tabindex="${this.isTruncated?"0":"-1"}" aria-label="${this.localize.term("truncatedBreadcrumbs")}" aria-expanded="false" aria-haspopup="true" class="flex sd-interactive">[...]</button><ol part="truncated-dropdown" class="flex flex-col gap-4 px-2 py-3 min-w-40"></ol></sd-6-22-0-dropdown><ol part="list" class="flex items-center"><slot @slotchange="${this.handleSlotChange}"></slot></ol></nav>`}};e.styles=[...h.styles,m`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */@layer properties;@layer theme,base,components,utilities;
:host{position:relative;display:block}::slotted(sd-6-22-0-breadcrumb-item:not(:last-of-type))::after,sd-6-22-0-dropdown::after{margin-inline:var(--sd-spacing-2);display:none;height:var(--sd-spacing-1);width:var(--sd-spacing-1);border-radius:var(--sd-radius-full);background-color:rgba(var(--sd-breadcrumb__separator-color,rgba(var(--sd-color-neutral-400))));--tw-content:'';content:var(--tw-content)}@media (width >= 64rem){::slotted(sd-6-22-0-breadcrumb-item:not(:last-of-type))::after,sd-6-22-0-dropdown::after{display:inline-block}}::slotted(sd-6-22-0-breadcrumb-item:nth-last-child(2)){display:flex}@media (width >= 64rem){::slotted(sd-6-22-0-breadcrumb-item:nth-last-child(2))::after{background-color:rgba(var(--sd-breadcrumb__separator--current-color,rgba(var(--sd-color-accent))))}}::slotted(sd-6-22-0-breadcrumb-item),sd-6-22-0-dropdown{display:none;align-items:center;font-size:var(--sd-text-sm);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)))}@media (width >= 64rem){::slotted(sd-6-22-0-breadcrumb-item),sd-6-22-0-dropdown{display:flex}}@property --tw-content{syntax:"*";inherits:false;initial-value:""}`],s([o('[part="base"]')],e.prototype,"base",2),s([o('[part="truncated"]')],e.prototype,"truncated",2),s([o('[part="truncated-dropdown"]')],e.prototype,"dropdown",2),s([o("slot")],e.prototype,"defaultSlot",2),s([f({type:String,reflect:!0})],e.prototype,"label",2),s([c()],e.prototype,"itemPositionsCached",2),s([c()],e.prototype,"isTruncated",2),e=s([b("sd-6-22-0-breadcrumb")],e);export{e as a};
