"use strict";const _=require("./tslib.es6-C4EgNkz1.js"),e=require("react"),k=require("classnames"),p=require("./forwardRef-DBQKIlPy.js");require("./array.polyfill.flat-5BAolFdk.js");const v=require("./badge-BWhBKWCu.js"),h=require("./icons/ebay-icon-tick-16/index.js"),N=t=>{var{className:m,itemMatchesUrl:c=!0,onKeyDown:b=()=>{},onSelect:g=()=>{},children:i,forwardedRef:f}=t,l=_.__rest(t,["className","itemMatchesUrl","onKeyDown","onSelect","children","forwardedRef"]);const y=e.Children.toArray(i),o=c===!1?"true":"page";return e.createElement("div",Object.assign({},l,{ref:f,className:k(m,"fake-menu")}),e.createElement("ul",{className:"fake-menu__items",tabIndex:-1},y.map((n,a)=>{const r=n.props,{current:E,onClick:u=()=>{}}=r,s=_.__rest(r,["current","onClick"]);return e.createElement("li",{key:a},e.cloneElement(n,Object.assign(Object.assign({},s),{"aria-current":E?o:void 0,onClick:d=>{g(d,{index:a}),u(d)},onKeyDown:d=>{b(d,{index:a})}})))})))},w=p.withForwardRef(N),R=t=>{var{className:m,disabled:c,autoFocus:b,type:g,badgeNumber:i,badgeAriaLabel:f,children:l}=t,y=_.__rest(t,["className","disabled","autoFocus","type","badgeNumber","badgeAriaLabel","children"]);const o=e.useRef(null),n=i!==void 0;e.useEffect(()=>{var s;b&&((s=o.current)===null||s===void 0||s.focus())});const a=Object.assign(Object.assign({},y),{ref:o,className:k(m,"fake-menu__item",n&&"menu__item--badged"),"aria-label":f}),r=e.createElement(h.EbayIconTick16,null),E={marginLeft:"var(--spacing-100)",marginRight:"var(--spacing-100)"},u=n&&e.createElement(v.EbayBadge,{type:"menu",number:i,style:E});return g==="button"?e.createElement("button",Object.assign({},a,{type:"button",disabled:c}),e.createElement("span",null,l,u),r):e.createElement("a",Object.assign({},a,{"aria-disabled":c?"true":void 0}),e.createElement("span",null,l,u),r)};exports.EbayFakeMenu=w;exports.EbayMenuItem=R;
