'use client';import { a as a$1 } from './chunk-MYWYANOV.js';
import { a as a$2 } from './chunk-EB33T44P.js';
import { a as a$6 } from './chunk-37TUZSO4.js';
import { a as a$4 } from './chunk-F2KWYQOD.js';
import { a as a$5 } from './chunk-UKJSEI2I.js';
import { a as a$3 } from './chunk-TOIWDFR7.js';
import { a } from './chunk-TWGPE4V7.js';
import { cx } from '@onbeam/styled-system/css';
import { selectModal, gridBackground, noiseBackground } from '@onbeam/styled-system/recipes';
import { jsxs, jsx } from 'react/jsx-runtime';
import { useState, useEffect } from 'react';
import { Close } from '@radix-ui/react-dialog';

var u=a(({as:x="div",id:b,name:N,subname:l,logo:n,detailCaption:m,detailLabel:i,className:y,isSelected:p,isDisabled:f,onClick:v,action:a,address:g,chainId:C,...k},P)=>{let e=selectModal(),r=f||p;return jsxs(x,{ref:P,tabIndex:r?-1:0,"aria-disabled":r,className:cx(e.listItem,e.listItemHover,y),onClick:r?void 0:()=>v?.(b),...k,children:[jsxs("div",{className:e.token,children:[jsx(a$1,{as:"div",disabled:r,disableChevron:!0,icon:n,children:N}),l&&jsx("span",{className:e.tokenSubname,children:l})]}),a&&jsxs("div",{className:e.action,children:[jsx("p",{children:a.title}),jsx("div",{onClick:d=>d.stopPropagation(),onKeyDown:d=>d.stopPropagation(),children:jsx(a$2,{as:"span",role:"button",tabIndex:0,onClick:a.onClick,className:e.actionButton,children:a.buttonLabel})})]}),(i||m)&&jsxs("div",{className:e.detail,children:[i&&jsx("span",{className:e.detailLabel,"data-selected":p,children:i}),m&&jsx("span",{className:e.detailCaption,children:m})]})]})});u.displayName="SelectModalItem";var _=a(({as:x="div",label:b,searchPlaceholder:N="search",items:l=[],selectedId:n,title:m,listTitle:i,onChange:y,onOpenChange:p,searchQuery:f,onSearch:v,sort:a,filter:g,selectButtonProps:C,...k},P)=>{let[e,r]=useState(l.find(t=>t.id===n)),d=g?l.filter(g):l,B=a?[...d].sort(a):d,c=selectModal();return useEffect(()=>{r(l.find(t=>t.id===n));},[l,n]),jsx(a$3,{description:"select an item",hideDescription:!0,trigger:jsx(a$1,{icon:e?.logo,label:jsx(a$4,{children:b}),...C,children:e?.name||"select"}),title:m,onOpenChange:t=>p?.(t),children:jsxs("div",{ref:P,...k,children:[v&&f!==void 0&&jsx(a$5,{type:"search",placeholder:N,className:c.search,value:f,onChange:t=>{v(t.currentTarget.value);}}),i&&jsx("span",{className:c.listTitle,children:i}),jsx("div",{className:cx(gridBackground(),noiseBackground(),c.box),children:jsxs("ul",{children:[B.map((t,E)=>jsxs("li",{children:[E!==0&&jsx(a$6,{}),jsx(u,{as:Close,onClick:F=>y?.(F,t),isSelected:t.id===e?.id,...t})]},t.id)),!B.length&&jsx("li",{className:cx(c.listItem,c.emptyText),children:"no results were found"})]})})]})})});_.displayName="SelectModal";var V={Item:u};

export { _ as a, V as b };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=chunk-HOV3TRBR.js.map