1import{i as a,x as d}from"./property-B5Pl7mtY.js";import{S as u,c,_ as m,e as h}from"./chunk.PFOQ5QRR-D5PzUM7v.js";try{let e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="23b9da74-919e-42b0-9e06-cb2d8528ba64",e._sentryDebugIdIdentifier="sentry-dbid-23b9da74-919e-42b0-9e06-cb2d8528ba64")}catch{}var f=a` 2 :host { 3 display: block; 4 position: relative; 5 background: var(--sl-panel-background-color); 6 border: solid var(--sl-panel-border-width) var(--sl-panel-border-color); 7 border-radius: var(--sl-border-radius-medium); 8 padding: var(--sl-spacing-x-small) 0; 9 overflow: auto; 10 overscroll-behavior: none; 11 } 12 13 ::slotted(sl-divider) { 14 --spacing: var(--sl-spacing-x-small); 15 } 16`,o=class extends u{connectedCallback(){super.connectedCallback(),this.setAttribute("role","menu")}handleClick(e){const t=["menuitem","menuitemcheckbox"],n=e.composedPath(),s=n.find(l=>{var r;return t.includes(((r=l==null?void 0:l.getAttribute)==null?void 0:r.call(l,"role"))||"")});if(!s||n.find(l=>{var r;return((r=l==null?void 0:l.getAttribute)==null?void 0:r.call(l,"role"))==="menu"})!==this)return;const i=s;i.type==="checkbox"&&(i.checked=!i.checked),this.emit("sl-select",{detail:{item:i}})}handleKeyDown(e){if(e.key==="Enter"||e.key===" "){const t=this.getCurrentItem();e.preventDefault(),e.stopPropagation(),t==null||t.click()}else if(["ArrowDown","ArrowUp","Home","End"].includes(e.key)){const t=this.getAllItems(),n=this.getCurrentItem();let s=n?t.indexOf(n):0;t.length>0&&(e.preventDefault(),e.stopPropagation(),e.key==="ArrowDown"?s++:e.key==="ArrowUp"?s--:e.key==="Home"?s=0:e.key==="End"&&(s=t.length-1),s<0&&(s=t.length-1),s>t.length-1&&(s=0),this.setCurrentItem(t[s]),t[s].focus())}}handleMouseDown(e){const t=e.target;this.isMenuItem(t)&&this.setCurrentItem(t)}handleSlotChange(){const e=this.getAllItems();e.length>0&&this.setCurrentItem(e[0])}isMenuItem(e){var t;return e.tagName.toLowerCase()==="sl-menu-item"||["menuitem","menuitemcheckbox","menuitemradio"].includes((t=e.getAttribute("role"))!=null?t:"")}getAllItems(){return[...this.defaultSlot.assignedElements({flatten:!0})].filter(e=>!(e.inert||!this.isMenuItem(e)))}getCurrentItem(){return this.getAllItems().find(e=>e.getAttribute("tabindex")==="0")}
16setCurrentItem(e){this.getAllItems().forEach(n=>{n.setAttribute("tabindex",n===e?"0":"-1")})}render(){return d` 17 <slot 18 @slotchange=${this.handleSlotChange} 19 @click=${this.handleClick} 20 @keydown=${this.handleKeyDown} 21 @mousedown=${this.handleMouseDown} 22 ></slot> 23 `}};o.styles=[c,f];m([h("slot")],o.prototype,"defaultSlot",2);var k=o;o.define("sl-menu");export{k as default}; 24//# sourceMappingURL=menu-pG6JctKP.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.