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

export { w as a, U as b };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=chunk-EHD4STG4.js.map