/*!
 * Custom elements for Nanopore-Digital Web applications
 */
import{r as n,g as r,h as o}from"./index-BM3Om9WE.js";import{a}from"./style-Ds52s5za.js";const e=class{constructor(r){n(this,r)}get el(){return r(this)}breadcrumbs=[];isOpen=!1;isOverflowing=!1;mainRef;componentDidLoad(){this.checkOverflow(),a(this.el?.shadowRoot)}componentDidUpdate(){this.checkOverflow()}connectedCallback(){window.addEventListener("resize",this.checkOverflow)}disconnectedCallback(){window.removeEventListener("resize",this.checkOverflow)}checkOverflow=()=>{if(!this.mainRef)return;const n=this.mainRef.scrollWidth>.9*this.el.clientWidth;this.isOverflowing!==n&&(this.isOverflowing=n,this.isOverflowing&&(this.isOpen=!1))};render(){const n=this.breadcrumbs?.find((n=>n.return));if(n)return o("nav",{"aria-label":"Breadcrumb",class:"breadcrumbs"},o(t,{breadcrumbs:[n],className:"return-only"}));const r=this.breadcrumbs?.length?this.breadcrumbs.at(-1):null;return o("div",{class:"breadcrumbs"},o("nav",{"aria-label":"Breadcrumb"},o(t,{breadcrumbs:this.breadcrumbs,className:"main"+(this.isOverflowing?" breadcrumbs-hidden":""),mainRef:n=>this.mainRef=n})),this.isOverflowing&&o("nano-dropdown",{dialogTitle:`${r?.label} Breadcrumb`,onNanoShow:()=>this.isOpen=!0,onNanoHide:()=>this.isOpen=!1,containingElement:this.el,class:"breadcrumbs__dropdown"},o("button",{class:"trigger-button",slot:"trigger"},o("span",null,this.breadcrumbs&&this.breadcrumbs.length>1&&o("span",{class:"trigger-button_label"},".."),o("span",{class:"trigger-button_label"},r?.label)),o("nano-icon",{class:{"trigger-icon":!0,"trigger-icon--open":this.isOpen},name:"light/chevron-down"})),o("nav",null,o("nano-menu",{class:"breadcrumbs small",label:"Breadcrumbs"},this.breadcrumbs?.slice(0,-1)?.map(((n,r)=>o("nano-nav-item",{key:r,href:n.href,class:{return:n.return,link:!!n.href},disabled:!n.href},n.label)))))))}},t=({breadcrumbs:n,className:r,mainRef:a})=>o("ol",{class:`breadcrumbs ${r}`,ref:a},n?.map(((n,r)=>o("li",null,o("a",{key:r,href:n.href,class:{return:n.return,link:!!n.href}},n.return&&o("nano-icon",{name:"light/chevron-left",size:"small",class:"breadcrumb-icon"}),n.label)))));e.style=':host,*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}@media (prefers-reduced-motion: reduce){:host,*,*::before,*::after{animation-duration:0.01ms !important;animation-iteration-count:1 !important;transition-duration:0.01ms !important;scroll-behavior:auto !important}}:host,*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}@media (prefers-reduced-motion: reduce){:host,*,*::before,*::after{animation-duration:0.01ms !important;animation-iteration-count:1 !important;transition-duration:0.01ms !important;scroll-behavior:auto !important}}:host{--text-color:var(--nano-color-primary-1100);--text-color-hover:var(--nano-color-primary-1200);--text-color-secondary:var(--nano-color-neutral-1400);--text-color-disabled:var(--nano-color-neutral-1000);--border-color:var(--nano-color-neutral-400);--trigger-bg-color:var(--nano-color-base-0);display:block}.breadcrumbs{inline-size:fit-content}nano-menu.breadcrumbs{inline-size:100%}.breadcrumbs-hidden{position:absolute;visibility:hidden;pointer-events:none;block-size:0;overflow:hidden}ol{list-style:none;padding:var(--nano-spacing-l3) 0;margin:0;display:flex;flex-direction:row}li{display:flex;align-items:center;justify-content:flex-start;font-size:var(--nano-font-size-xs);line-height:var(--nano-line-height-normal);letter-spacing:var(--nano-letter-spacing-loose);text-wrap:nowrap;margin-block-end:0}li:not(.return-only li)::after,nano-nav-item::after{content:"/";margin:0 var(--nano-spacing-xs);color:var(--border-color)}a.link{color:var(--text-color)}a:not(.link){color:var(--text-color-secondary)}a:focus-visible{outline:var(--nano-focus-ring);outline-offset:var(--nano-focus-ring-offset);z-index:1}a.link:hover{color:var(--text-color-hover)}a.return.link{display:flex;align-items:center;gap:calc(var(--nano-spacing-sm) / 2)}.breadcrumbs__dropdown{inline-size:100%}.breadcrumbs__dropdown[open]::part(trigger){box-shadow:var(--nano-shadow-l1)}.trigger-button{inline-size:100%;display:flex;justify-content:space-between;align-items:center;padding:var(--nano-spacing-l3) var(--nano-spacing-l2);color:var(--text-color);background-color:var(--trigger-bg-color);cursor:pointer;text-align:start;border:none;font-size:var(--nano-font-size-xs)}.trigger-button .trigger-button_label{text-decoration:underline}.trigger-button .trigger-button_label::after{content:"/";margin:0 var(--nano-spacing-xs);color:var(--border-color)}.trigger-button:focus-visible{outline:var(--nano-focus-ring);outline-offset:var(--nano-focus-ring-offset)}.trigger-icon{transform:rotate(0deg);transition:var(--nano-transition-x-fast) ease transform}.trigger-icon--open{transform:rotate(180deg)}nano-nav-item::after{display:none !important}.trigger-button_label::after{display:inline-block !important}.return-only{padding:var(--nano-spacing-l3) var(--nano-spacing-l2) !important}';export{e as nano_breadcrumb}