import{r as n,v as m,_ as S,F as h,j as e,g as b,aq as R,I as w,c as F,C as k,o as j,aO as I,a as E}from"./main-gLMaKCvr.js";import{C}from"./index-Jdu54dr5.js";import{T}from"./index-BrNLqRge.js";import{C as v,S as $}from"./Table-CWRWFg95.js";import{R as D}from"./ClearOutlined-DLfz_o_l.js";import"./index-ZwmWfN3I.js";import"./Dropdown-CSp8FTqG.js";import"./addEventListener-BwXlid1p.js";import"./index-B-_sZvQI.js";var O={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 00-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 00-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z"}}]},name:"undo",theme:"outlined"},z=function(d,i){return n.createElement(m,S({},d,{ref:i,icon:O}))},A=n.forwardRef(z);const J=({close:x,height:d,graphOpt:i,queryParams:t,...l})=>{const[a]=h.useForm(),[c,p]=n.useState([]);n.useEffect(()=>{t!=null&&t.nodes&&Array.isArray(t==null?void 0:t.nodes)&&p(t==null?void 0:t.nodes.map(o=>({value:o,name:o})))},[t==null?void 0:t.nodes]),n.useEffect(()=>{a.setFieldsValue(t==null?void 0:t.nodes_dict)},[]);const f=()=>{const o=a.getFieldsValue();console.log(o),i.updateQueryParam("nodes_dict",o)};return e.jsxs(C,{title:e.jsx(e.Fragment,{children:`${l==null?void 0:l.label}`}),styles:{body:{padding:0,height:"100%",overflowY:"auto"}},size:"small",extra:e.jsxs(b,{gap:"small",children:[e.jsx(T,{style:{cursor:"pointer"},onClick:()=>{(t==null?void 0:t.nodes_dict_condition)=="OR"?i.updateQueryParam("nodes_dict_condition","AND"):i.updateQueryParam("nodes_dict_condition","OR")},children:t==null?void 0:t.nodes_dict_condition}),e.jsx(R,{onClick:x})]}),style:{borderRadius:"12px",boxShadow:"0 4px 20px rgba(0,0,0,0.1)",padding:"0.5rem",overflow:"hidden",height:d},children:[e.jsx("div",{style:{marginTop:"1rem"}}),e.jsx(h.Provider,{onFormChange:f,children:e.jsx(h,{form:a,children:c.map((o,r)=>e.jsx(h.Item,{name:o.value,label:o.name,noStyle:!0,children:e.jsx(B,{title:o.name,label:o.value})},r))})})]})},B=({title:x,label:d,value:i,onChange:t})=>{const[l,a]=n.useState(!1),[c,p]=n.useState(""),[f,o]=n.useState(!1),[r,u]=n.useState([]),g=async()=>{o(!0);const s=await E.post("/entity/query-nodes",{label:d,keyword:c});u(s.data),o(!1)};return n.useEffect(()=>{g()},[c]),e.jsx(e.Fragment,{children:e.jsxs(C,{size:"small",loading:f,title:x,style:{marginBottom:"1rem"},extra:e.jsxs($,{children:[e.jsx(j,{title:"Search",children:e.jsx(I,{style:{cursor:"pointer"},onClick:()=>{a(!l),l&&p("")}})}),e.jsx(j,{title:"Clear Selection",children:e.jsx(D,{style:{cursor:"pointer"},onClick:()=>{t(void 0)}})}),e.jsx(j,{title:"Refresh",children:e.jsx(A,{style:{cursor:"pointer"},onClick:g})})]}),children:[l&&e.jsx(w.Search,{allowClear:!0,onSearch:s=>p(s),style:{marginBottom:"0.5rem"}}),e.jsx("div",{style:{overflowY:"auto",maxHeight:"240px"},children:e.jsx(v.Group,{style:{width:"100%"},value:i,onChange:t,children:e.jsx(F,{children:r&&r.length>0&&r.filter(s=>c?s.entity_name.includes(c):!0).map((s,_)=>e.jsx(k,{span:24,style:{marginTop:"0.3em"},children:e.jsx(v,{value:s.entity_id,children:s.entity_name})},_))})})})]})})};export{J as default};
