import{r as x,j as e,f as w,av as h,I as j}from"./index-f9c70843.js";import{P as b,$ as g,a as N,b as P,c as $}from"./popover-6c4eec5c.js";import{a as k,b as D,c as I,d as E,e as F,C as O}from"./index-ec47a6a3.js";function R({disabled:f,isLoading:u,value:o,options:n,onSelect:C,editNode:r=!1,id:l="",children:s}){var m,i;const[c,d]=x.useState(!!s),t=x.useRef(null),y=s||r?P:$;return e.jsx(e.Fragment,{children:((m=Object.keys(n))==null?void 0:m.length)>0?e.jsx(e.Fragment,{children:e.jsxs(b,{open:c,onOpenChange:s?()=>{}:d,children:[s?e.jsx(g,{children:s}):e.jsx(N,{asChild:!0,children:e.jsxs(w,{disabled:f,variant:"primary",size:"xs",role:"combobox",ref:t,"aria-expanded":c,"data-testid":`${l??""}`,className:h(r?"dropdown-component-outline":"dropdown-component-false-outline","w-full justify-between font-normal",r?"input-edit-node":"py-2"),children:[e.jsx("span",{"data-testid":"value-dropdown-"+l,children:o&&o!==""&&n.find(a=>a===o)?n.find(a=>a===o):"Choose an option..."}),e.jsx(j,{name:"ChevronsUpDown",className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(y,{side:"bottom",avoidCollisions:!!s,className:"nocopy nowheel nopan nodelete nodrag noundo p-0",style:s?{}:{minWidth:((i=t==null?void 0:t.current)==null?void 0:i.clientWidth)??"200px"},children:e.jsxs(k,{children:[e.jsx(D,{placeholder:"Search options...",className:"h-9"}),e.jsxs(I,{children:[e.jsx(E,{children:"No values found."}),e.jsx(F,{defaultChecked:!1,children:n==null?void 0:n.map((a,p)=>e.jsxs(O,{value:a,onSelect:v=>{C(v),d(!1)},"data-testid":`${a}-${p??""}-option`,children:[a,e.jsx(j,{name:"Check",className:h("ml-auto h-4 w-4 text-primary",o===a?"opacity-100":"opacity-0")})]},p))})]})]})})]})}):e.jsx(e.Fragment,{children:!u&&e.jsx("div",{children:e.jsx("span",{className:"text-sm italic",children:"No parameters are available for display."})})||e.jsx("div",{children:e.jsx("span",{className:"text-sm italic",children:"Loading..."})})})})}export{R as D};
