700 lines
263 KiB
JavaScript
Generated
700 lines
263 KiB
JavaScript
Generated
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/utils-vendor-BysuhMZA.js","assets/react-vendor-DEwriMA6.js"])))=>i.map(i=>d[i]);
|
|
var di=Object.defineProperty;var fi=(t,e,r)=>e in t?di(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var $e=(t,e,r)=>fi(t,typeof e!="symbol"?e+"":e,r);import{R as W,r as p,c as hi,g as He,d as gi,e as pi}from"./react-vendor-DEwriMA6.js";import{_ as aa,a as sa,f as Zt,N as ia,b as la,c as ca,D as bn,d as Ut,F as mi,E as ua,e as vi,g as Un,h as yi,n as qn,v as Be,i as da,j as fa,r as We,k as ha,y as ga,p as bi,l as wi,U as Xr,m as xi,o as Si,S as Ei}from"./graph-vendor-B-X5JegA.js";import{j as g,c as wn,P as St,a as pa,D as _i,C as Ci,S as ki,R as Ti,u as Xe,b as ft,d as ma,e as Ri,A as Ai,f as Ee,g as Ce,h as ji,i as Ii,O as xn,k as va,l as Sn,m as Li,T as ya,n as ba,o as wa,p as Ni,q as Pi,r as xa,s as zi,t as Di,v as Oi,w as Gi,x as Fi,y as ct,z as $i,B as Mi}from"./ui-vendor-CeCm8EER.js";import{t as Hi,c as Sa,a as er,b as Bi}from"./utils-vendor-BysuhMZA.js";function fe(...t){return Hi(Sa(t))}function tr(t){return t instanceof Error?t.message:`${t}`}function $g(t,e){let r=0,n=null;return function(...a){const o=Date.now(),l=e-(o-r);l<=0?(n&&(clearTimeout(n),n=null),r=o,t.apply(this,a)):n||(n=setTimeout(()=>{r=Date.now(),n=null,t.apply(this,a)},l))}}const En=t=>{const e=t;e.use={};for(const r of Object.keys(e.getState()))e.use[r]=()=>e(n=>n[r]);return e},Yr="",Mg="/webui/",Le="ghost",Vi="#B2EBF2",Ui="#000",qi="#E2E2E2",Kr="#EEEEEE",Wi="#F57F17",Xi="#969696",Yi="#F57F17",Wn="#B2EBF2",It=50,Xn=100,ut=4,Qr=20,Hg=15,Yn="*",Bg={"text/plain":[".txt",".md",".html",".htm",".tex",".json",".xml",".yaml",".yml",".rtf",".odt",".epub",".csv",".log",".conf",".ini",".properties",".sql",".bat",".sh",".c",".cpp",".py",".java",".js",".ts",".swift",".go",".rb",".php",".css",".scss",".less"],"application/pdf":[".pdf"],"application/msword":[".doc"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":[".docx"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":[".pptx"]},Vg={name:"LightRAG",github:"https://github.com/HKUDS/LightRAG"},Ki="modulepreload",Qi=function(t){return"/webui/"+t},Kn={},Ji=function(e,r,n){let a=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),i=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));a=Promise.allSettled(r.map(s=>{if(s=Qi(s),s in Kn)return;Kn[s]=!0;const c=s.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${s}"]${u}`))return;const d=document.createElement("link");if(d.rel=c?"stylesheet":Ki,c||(d.as="script"),d.crossOrigin="",d.href=s,i&&d.setAttribute("nonce",i),document.head.appendChild(d),c)return new Promise((h,f)=>{d.addEventListener("load",h),d.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${s}`)))})}))}function o(l){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=l,window.dispatchEvent(i),!i.defaultPrevented)throw l}return a.then(l=>{for(const i of l||[])i.status==="rejected"&&o(i.reason);return e().catch(o)})};function Ea(t,e){let r;try{r=t()}catch{return}return{getItem:a=>{var o;const l=s=>s===null?null:JSON.parse(s,void 0),i=(o=r.getItem(a))!=null?o:null;return i instanceof Promise?i.then(l):l(i)},setItem:(a,o)=>r.setItem(a,JSON.stringify(o,void 0)),removeItem:a=>r.removeItem(a)}}const Jr=t=>e=>{try{const r=t(e);return r instanceof Promise?r:{then(n){return Jr(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return Jr(n)(r)}}}},Zi=(t,e)=>(r,n,a)=>{let o={storage:Ea(()=>localStorage),partialize:y=>y,version:0,merge:(y,T)=>({...T,...y}),...e},l=!1;const i=new Set,s=new Set;let c=o.storage;if(!c)return t((...y)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...y)},n,a);const u=()=>{const y=o.partialize({...n()});return c.setItem(o.name,{state:y,version:o.version})},d=a.setState;a.setState=(y,T)=>{d(y,T),u()};const h=t((...y)=>{r(...y),u()},n,a);a.getInitialState=()=>h;let f;const b=()=>{var y,T;if(!c)return;l=!1,i.forEach(_=>{var A;return _((A=n())!=null?A:h)});const N=((T=o.onRehydrateStorage)==null?void 0:T.call(o,(y=n())!=null?y:h))||void 0;return Jr(c.getItem.bind(c))(o.name).then(_=>{if(_)if(typeof _.version=="number"&&_.version!==o.version){if(o.migrate){const A=o.migrate(_.state,_.version);return A instanceof Promise?A.then(R=>[!0,R]):[!0,A]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,_.state];return[!1,void 0]}).then(_=>{var A;const[R,I]=_;if(f=o.merge(I,(A=n())!=null?A:h),r(f,!0),R)return u()}).then(()=>{N==null||N(f,void 0),f=n(),l=!0,s.forEach(_=>_(f))}).catch(_=>{N==null||N(void 0,_)})};return a.persist={setOptions:y=>{o={...o,...y},y.storage&&(c=y.storage)},clearStorage:()=>{c==null||c.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>b(),hasHydrated:()=>l,onHydrate:y=>(i.add(y),()=>{i.delete(y)}),onFinishHydration:y=>(s.add(y),()=>{s.delete(y)})},o.skipHydration||b(),f||h},el=Zi,tl=er()(el(t=>({theme:"system",language:"en",showPropertyPanel:!0,showNodeSearchBar:!0,showLegend:!1,showNodeLabel:!0,enableNodeDrag:!0,showEdgeLabel:!1,enableHideUnselectedEdges:!0,enableEdgeEvents:!1,minEdgeSize:1,maxEdgeSize:1,graphQueryMaxDepth:3,graphMaxNodes:1e3,graphLayoutMaxIterations:15,queryLabel:Yn,enableHealthCheck:!0,apiKey:null,currentTab:"documents",showFileName:!1,retrievalHistory:[],querySettings:{mode:"global",response_type:"Multiple Paragraphs",top_k:10,max_token_for_text_unit:4e3,max_token_for_global_context:4e3,max_token_for_local_context:4e3,only_need_context:!1,only_need_prompt:!1,stream:!0,history_turns:3,hl_keywords:[],ll_keywords:[]},setTheme:e=>t({theme:e}),setLanguage:e=>{t({language:e}),Ji(async()=>{const{default:r}=await import("./utils-vendor-BysuhMZA.js").then(n=>n.d);return{default:r}},__vite__mapDeps([0,1])).then(({default:r})=>{r.language!==e&&r.changeLanguage(e)})},setGraphLayoutMaxIterations:e=>t({graphLayoutMaxIterations:e}),setQueryLabel:e=>t({queryLabel:e}),setGraphQueryMaxDepth:e=>t({graphQueryMaxDepth:e}),setGraphMaxNodes:e=>t({graphMaxNodes:e}),setMinEdgeSize:e=>t({minEdgeSize:e}),setMaxEdgeSize:e=>t({maxEdgeSize:e}),setEnableHealthCheck:e=>t({enableHealthCheck:e}),setApiKey:e=>t({apiKey:e}),setCurrentTab:e=>t({currentTab:e}),setRetrievalHistory:e=>t({retrievalHistory:e}),updateQuerySettings:e=>t(r=>({querySettings:{...r.querySettings,...e}})),setShowFileName:e=>t({showFileName:e}),setShowLegend:e=>t({showLegend:e})}),{name:"settings-storage",storage:Ea(()=>localStorage),version:11,migrate:(t,e)=>(e<2&&(t.showEdgeLabel=!1),e<3&&(t.queryLabel=Yn),e<4&&(t.showPropertyPanel=!0,t.showNodeSearchBar=!0,t.showNodeLabel=!0,t.enableHealthCheck=!0,t.apiKey=null),e<5&&(t.currentTab="documents"),e<6&&(t.querySettings={mode:"global",response_type:"Multiple Paragraphs",top_k:10,max_token_for_text_unit:4e3,max_token_for_global_context:4e3,max_token_for_local_context:4e3,only_need_context:!1,only_need_prompt:!1,stream:!0,history_turns:3,hl_keywords:[],ll_keywords:[]},t.retrievalHistory=[]),e<7&&(t.graphQueryMaxDepth=3,t.graphLayoutMaxIterations=15),e<8&&(t.graphMinDegree=0,t.language="en"),e<9&&(t.showFileName=!1),e<10&&(delete t.graphMinDegree,t.graphMaxNodes=1e3),e<11&&(t.minEdgeSize=1,t.maxEdgeSize=1),t)})),re=En(tl);class rl{constructor(){$e(this,"nodes",[]);$e(this,"edges",[]);$e(this,"nodeIdMap",{});$e(this,"edgeIdMap",{});$e(this,"edgeDynamicIdMap",{});$e(this,"getNode",e=>{const r=this.nodeIdMap[e];if(r!==void 0)return this.nodes[r]});$e(this,"getEdge",(e,r=!0)=>{const n=r?this.edgeDynamicIdMap[e]:this.edgeIdMap[e];if(n!==void 0)return this.edges[n]});$e(this,"buildDynamicMap",()=>{this.edgeDynamicIdMap={};for(let e=0;e<this.edges.length;e++){const r=this.edges[e];this.edgeDynamicIdMap[r.dynamicId]=e}})}}const nl=er()((t,e)=>({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null,moveToSelectedNode:!1,isFetching:!1,graphIsEmpty:!1,lastSuccessfulQueryLabel:"",graphDataFetchAttempted:!1,labelsFetchAttempted:!1,rawGraph:null,sigmaGraph:null,sigmaInstance:null,allDatabaseLabels:["*"],typeColorMap:new Map,searchEngine:null,setGraphIsEmpty:r=>t({graphIsEmpty:r}),setLastSuccessfulQueryLabel:r=>t({lastSuccessfulQueryLabel:r}),setIsFetching:r=>t({isFetching:r}),setSelectedNode:(r,n)=>t({selectedNode:r,moveToSelectedNode:n}),setFocusedNode:r=>t({focusedNode:r}),setSelectedEdge:r=>t({selectedEdge:r}),setFocusedEdge:r=>t({focusedEdge:r}),clearSelection:()=>t({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null}),reset:()=>{t({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null,rawGraph:null,sigmaGraph:null,searchEngine:null,moveToSelectedNode:!1,graphIsEmpty:!1})},setRawGraph:r=>t({rawGraph:r}),setSigmaGraph:r=>{t({sigmaGraph:r})},setAllDatabaseLabels:r=>t({allDatabaseLabels:r}),fetchAllDatabaseLabels:async()=>{try{console.log("Fetching all database labels...");const r=await al();t({allDatabaseLabels:["*",...r]});return}catch(r){throw console.error("Failed to fetch all database labels:",r),t({allDatabaseLabels:["*"]}),r}},setMoveToSelectedNode:r=>t({moveToSelectedNode:r}),setSigmaInstance:r=>t({sigmaInstance:r}),setTypeColorMap:r=>t({typeColorMap:r}),setSearchEngine:r=>t({searchEngine:r}),resetSearchEngine:()=>t({searchEngine:null}),setGraphDataFetchAttempted:r=>t({graphDataFetchAttempted:r}),setLabelsFetchAttempted:r=>t({labelsFetchAttempted:r}),nodeToExpand:null,nodeToPrune:null,triggerNodeExpand:r=>t({nodeToExpand:r}),triggerNodePrune:r=>t({nodeToPrune:r}),graphDataVersion:0,incrementGraphDataVersion:()=>t(r=>({graphDataVersion:r.graphDataVersion+1})),updateNodeAndSelect:async(r,n,a,o)=>{const l=e(),{sigmaGraph:i,rawGraph:s}=l;if(!(!i||!s||!i.hasNode(r)))try{const c=i.getNodeAttributes(r);if(console.log("updateNodeAndSelect",r,n,a,o),r===n&&a==="entity_id"){i.addNode(o,{...c,label:o});const u=[];i.forEachEdge(r,(h,f,b,y)=>{const T=b===r?y:b,N=b===r,_=h,A=s.edgeDynamicIdMap[_],R=i.addEdge(N?o:T,N?T:o,f);A!==void 0&&u.push({originalDynamicId:_,newEdgeId:R,edgeIndex:A}),i.dropEdge(h)}),i.dropNode(r);const d=s.nodeIdMap[r];d!==void 0&&(s.nodes[d].id=o,s.nodes[d].labels=[o],s.nodes[d].properties.entity_id=o,delete s.nodeIdMap[r],s.nodeIdMap[o]=d),u.forEach(({originalDynamicId:h,newEdgeId:f,edgeIndex:b})=>{s.edges[b]&&(s.edges[b].source===r&&(s.edges[b].source=o),s.edges[b].target===r&&(s.edges[b].target=o),s.edges[b].dynamicId=f,delete s.edgeDynamicIdMap[h],s.edgeDynamicIdMap[f]=b)}),t({selectedNode:o,moveToSelectedNode:!0})}else{const u=s.nodeIdMap[String(r)];u!==void 0&&(s.nodes[u].properties[a]=o,a==="entity_id"&&(s.nodes[u].labels=[o],i.setNodeAttribute(String(r),"label",o))),t(d=>({graphDataVersion:d.graphDataVersion+1}))}}catch(c){throw console.error("Error updating node in graph:",c),new Error("Failed to update node in graph")}},updateEdgeAndSelect:async(r,n,a,o,l,i)=>{const s=e(),{sigmaGraph:c,rawGraph:u}=s;if(!(!c||!u))try{const d=u.edgeIdMap[String(r)];d!==void 0&&u.edges[d]&&(u.edges[d].properties[l]=i,n!==void 0&&l==="keywords"&&c.setEdgeAttribute(n,"label",i)),t(h=>({graphDataVersion:h.graphDataVersion+1})),t({selectedEdge:n})}catch(d){throw console.error(`Error updating edge ${a}->${o} in graph:`,d),new Error("Failed to update edge in graph")}}})),ee=En(nl);class ol{constructor(){$e(this,"navigate",null)}setNavigate(e){this.navigate=e}resetAllApplicationState(){console.log("Resetting all application state...");const e=ee.getState(),r=e.sigmaInstance;e.reset(),e.setGraphDataFetchAttempted(!1),e.setLabelsFetchAttempted(!1),e.setSigmaInstance(null),e.setIsFetching(!1),_n.getState().clear(),re.getState().setRetrievalHistory([]),sessionStorage.clear(),r&&(r.getGraph().clear(),r.kill(),ee.getState().setSigmaInstance(null))}handleDirectLoginAccess(){const e=!document.referrer;return e&&this.resetAllApplicationState(),e}navigateToLogin(){if(!this.navigate){console.error("Navigation function not set");return}this.resetAllApplicationState(),Zr.getState().logout(),this.navigate("/login")}navigateToHome(){if(!this.navigate){console.error("Navigation function not set");return}this.navigate("/")}}const _a=new ol,Ug="Invalid API Key",qg="API Key required",_e=Bi.create({baseURL:Yr,headers:{"Content-Type":"application/json"}});_e.interceptors.request.use(t=>{const e=re.getState().apiKey,r=localStorage.getItem("LIGHTRAG-API-TOKEN");return r&&(t.headers.Authorization=`Bearer ${r}`),e&&(t.headers["X-API-Key"]=e),t});_e.interceptors.response.use(t=>t,t=>{var e,r,n,a;if(t.response){if(((e=t.response)==null?void 0:e.status)===401){if((n=(r=t.config)==null?void 0:r.url)!=null&&n.includes("/login"))throw t;return _a.navigateToLogin(),Promise.reject(new Error("Authentication required"))}throw new Error(`${t.response.status} ${t.response.statusText}
|
|
${JSON.stringify(t.response.data)}
|
|
${(a=t.config)==null?void 0:a.url}`)}throw t});const Ca=async(t,e,r)=>(await _e.get(`/graphs?label=${encodeURIComponent(t)}&max_depth=${e}&max_nodes=${r}`)).data,al=async()=>(await _e.get("/graph/label/list")).data,sl=async()=>{try{return(await _e.get("/health")).data}catch(t){return{status:"error",message:tr(t)}}},Wg=async()=>(await _e.get("/documents")).data,Xg=async()=>(await _e.post("/documents/scan")).data,Yg=async t=>(await _e.post("/query",t)).data,Kg=async(t,e,r)=>{const n=re.getState().apiKey,a=localStorage.getItem("LIGHTRAG-API-TOKEN"),o={"Content-Type":"application/json",Accept:"application/x-ndjson"};a&&(o.Authorization=`Bearer ${a}`),n&&(o["X-API-Key"]=n);try{const l=await fetch(`${Yr}/query/stream`,{method:"POST",headers:o,body:JSON.stringify(t)});if(!l.ok){if(l.status===401)throw _a.navigateToLogin(),new Error("Authentication required");let u="Unknown error";try{u=await l.text()}catch{}const d=`${Yr}/query/stream`;throw new Error(`${l.status} ${l.statusText}
|
|
${JSON.stringify({error:u})}
|
|
${d}`)}if(!l.body)throw new Error("Response body is null");const i=l.body.getReader(),s=new TextDecoder;let c="";for(;;){const{done:u,value:d}=await i.read();if(u)break;c+=s.decode(d,{stream:!0});const h=c.split(`
|
|
`);c=h.pop()||"";for(const f of h)if(f.trim())try{const b=JSON.parse(f);b.response?e(b.response):b.error&&r&&r(b.error)}catch(b){console.error("Error parsing stream chunk:",f,b),r&&r(`Error parsing server response: ${f}`)}}if(c.trim())try{const u=JSON.parse(c);u.response?e(u.response):u.error&&r&&r(u.error)}catch(u){console.error("Error parsing final chunk:",c,u),r&&r(`Error parsing final server response: ${c}`)}}catch(l){const i=tr(l);if(i==="Authentication required"){console.error("Authentication required for stream request"),r&&r("Authentication required");return}const s=i.match(/^(\d{3})\s/);if(s){const c=parseInt(s[1],10);let u=i;switch(c){case 403:u="You do not have permission to access this resource (403 Forbidden)",console.error("Permission denied for stream request:",i);break;case 404:u="The requested resource does not exist (404 Not Found)",console.error("Resource not found for stream request:",i);break;case 429:u="Too many requests, please try again later (429 Too Many Requests)",console.error("Rate limited for stream request:",i);break;case 500:case 502:case 503:case 504:u=`Server error, please try again later (${c})`,console.error("Server error for stream request:",i);break;default:console.error("Stream request failed with status code:",c,i)}r&&r(u);return}if(i.includes("NetworkError")||i.includes("Failed to fetch")||i.includes("Network request failed")){console.error("Network error for stream request:",i),r&&r("Network connection error, please check your internet connection");return}if(i.includes("Error parsing")||i.includes("SyntaxError")){console.error("JSON parsing error in stream:",i),r&&r("Error processing response data");return}console.error("Unhandled stream error:",i),r?r(i):console.error("No error handler provided for stream error:",i)}},Qg=async(t,e)=>{const r=new FormData;return r.append("file",t),(await _e.post("/documents/upload",r,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:e!==void 0?a=>{const o=Math.round(a.loaded*100/a.total);e(o)}:void 0})).data},Jg=async()=>(await _e.delete("/documents")).data,Zg=async t=>(await _e.post("/documents/clear_cache",{modes:t})).data,ep=async()=>{try{const t=await _e.get("/auth-status",{timeout:5e3,headers:{Accept:"application/json"}});if((t.headers["content-type"]||"").includes("text/html"))return console.warn("Received HTML response instead of JSON for auth-status endpoint"),{auth_configured:!0,auth_mode:"enabled"};if(t.data&&typeof t.data=="object"&&"auth_configured"in t.data&&typeof t.data.auth_configured=="boolean"){if(t.data.auth_configured)return t.data;if(t.data.access_token&&typeof t.data.access_token=="string")return t.data;console.warn("Auth not configured but no valid access token provided")}return console.warn("Received invalid auth status response:",t.data),{auth_configured:!0,auth_mode:"enabled"}}catch(t){return console.error("Failed to get auth status:",tr(t)),{auth_configured:!0,auth_mode:"enabled"}}},tp=async()=>(await _e.get("/documents/pipeline_status")).data,rp=async(t,e)=>{const r=new FormData;return r.append("username",t),r.append("password",e),(await _e.post("/login",r,{headers:{"Content-Type":"multipart/form-data"}})).data},il=async(t,e,r=!1)=>(await _e.post("/graph/entity/edit",{entity_name:t,updated_data:e,allow_rename:r})).data,ll=async(t,e,r)=>(await _e.post("/graph/relation/edit",{source_id:t,target_id:e,updated_data:r})).data,cl=async t=>{try{return(await _e.get(`/graph/entity/exists?name=${encodeURIComponent(t)}`)).data.exists}catch(e){return console.error("Error checking entity name:",e),!1}},ul=er()(t=>({health:!0,message:null,messageTitle:null,lastCheckTime:Date.now(),status:null,pipelineBusy:!1,check:async()=>{const e=await sl();return e.status==="healthy"?((e.core_version||e.api_version)&&Zr.getState().setVersion(e.core_version||null,e.api_version||null),("webui_title"in e||"webui_description"in e)&&Zr.getState().setCustomTitle("webui_title"in e?e.webui_title??null:null,"webui_description"in e?e.webui_description??null:null),t({health:!0,message:null,messageTitle:null,lastCheckTime:Date.now(),status:e,pipelineBusy:e.pipeline_busy}),!0):(t({health:!1,message:e.message,messageTitle:"Backend Health Check Error!",lastCheckTime:Date.now(),status:null}),!1)},clear:()=>{t({health:!0,message:null,messageTitle:null})},setErrorMessage:(e,r)=>{t({health:!1,message:e,messageTitle:r})},setPipelineBusy:e=>{t({pipelineBusy:e})}})),_n=En(ul),ka=t=>{try{const e=t.split(".");return e.length!==3?{}:JSON.parse(atob(e[1]))}catch(e){return console.error("Error parsing token payload:",e),{}}},Ta=t=>ka(t).sub||null,dl=t=>ka(t).role==="guest",fl=()=>{const t=localStorage.getItem("LIGHTRAG-API-TOKEN"),e=localStorage.getItem("LIGHTRAG-CORE-VERSION"),r=localStorage.getItem("LIGHTRAG-API-VERSION"),n=localStorage.getItem("LIGHTRAG-WEBUI-TITLE"),a=localStorage.getItem("LIGHTRAG-WEBUI-DESCRIPTION"),o=t?Ta(t):null;return t?{isAuthenticated:!0,isGuestMode:dl(t),coreVersion:e,apiVersion:r,username:o,webuiTitle:n,webuiDescription:a}:{isAuthenticated:!1,isGuestMode:!1,coreVersion:e,apiVersion:r,username:null,webuiTitle:n,webuiDescription:a}},Zr=er(t=>{const e=fl();return{isAuthenticated:e.isAuthenticated,isGuestMode:e.isGuestMode,coreVersion:e.coreVersion,apiVersion:e.apiVersion,username:e.username,webuiTitle:e.webuiTitle,webuiDescription:e.webuiDescription,login:(r,n=!1,a=null,o=null,l=null,i=null)=>{localStorage.setItem("LIGHTRAG-API-TOKEN",r),a&&localStorage.setItem("LIGHTRAG-CORE-VERSION",a),o&&localStorage.setItem("LIGHTRAG-API-VERSION",o),l?localStorage.setItem("LIGHTRAG-WEBUI-TITLE",l):localStorage.removeItem("LIGHTRAG-WEBUI-TITLE"),i?localStorage.setItem("LIGHTRAG-WEBUI-DESCRIPTION",i):localStorage.removeItem("LIGHTRAG-WEBUI-DESCRIPTION");const s=Ta(r);t({isAuthenticated:!0,isGuestMode:n,username:s,coreVersion:a,apiVersion:o,webuiTitle:l,webuiDescription:i})},logout:()=>{localStorage.removeItem("LIGHTRAG-API-TOKEN");const r=localStorage.getItem("LIGHTRAG-CORE-VERSION"),n=localStorage.getItem("LIGHTRAG-API-VERSION"),a=localStorage.getItem("LIGHTRAG-WEBUI-TITLE"),o=localStorage.getItem("LIGHTRAG-WEBUI-DESCRIPTION");t({isAuthenticated:!1,isGuestMode:!1,username:null,coreVersion:r,apiVersion:n,webuiTitle:a,webuiDescription:o})},setVersion:(r,n)=>{r&&localStorage.setItem("LIGHTRAG-CORE-VERSION",r),n&&localStorage.setItem("LIGHTRAG-API-VERSION",n),t({coreVersion:r,apiVersion:n})},setCustomTitle:(r,n)=>{r?localStorage.setItem("LIGHTRAG-WEBUI-TITLE",r):localStorage.removeItem("LIGHTRAG-WEBUI-TITLE"),n?localStorage.setItem("LIGHTRAG-WEBUI-DESCRIPTION",n):localStorage.removeItem("LIGHTRAG-WEBUI-DESCRIPTION"),t({webuiTitle:r,webuiDescription:n})}}});var hl=t=>{switch(t){case"success":return ml;case"info":return yl;case"warning":return vl;case"error":return bl;default:return null}},gl=Array(12).fill(0),pl=({visible:t,className:e})=>W.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},W.createElement("div",{className:"sonner-spinner"},gl.map((r,n)=>W.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),ml=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},W.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),vl=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},W.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),yl=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},W.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),bl=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},W.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),wl=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},W.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),W.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),xl=()=>{let[t,e]=W.useState(document.hidden);return W.useEffect(()=>{let r=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),t},en=1,Sl=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:r,...n}=t,a=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:en++,o=this.toasts.find(i=>i.id===a),l=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),o?this.toasts=this.toasts.map(i=>i.id===a?(this.publish({...i,...t,id:a,title:r}),{...i,...t,id:a,dismissible:l,title:r}):i):this.addToast({title:r,...n,dismissible:l,id:a}),a},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(e=>{this.subscribers.forEach(r=>r({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let r;e.loading!==void 0&&(r=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let n=t instanceof Promise?t:t(),a=r!==void 0,o,l=n.then(async s=>{if(o=["resolve",s],W.isValidElement(s))a=!1,this.create({id:r,type:"default",message:s});else if(_l(s)&&!s.ok){a=!1;let c=typeof e.error=="function"?await e.error(`HTTP error! status: ${s.status}`):e.error,u=typeof e.description=="function"?await e.description(`HTTP error! status: ${s.status}`):e.description;this.create({id:r,type:"error",message:c,description:u})}else if(e.success!==void 0){a=!1;let c=typeof e.success=="function"?await e.success(s):e.success,u=typeof e.description=="function"?await e.description(s):e.description;this.create({id:r,type:"success",message:c,description:u})}}).catch(async s=>{if(o=["reject",s],e.error!==void 0){a=!1;let c=typeof e.error=="function"?await e.error(s):e.error,u=typeof e.description=="function"?await e.description(s):e.description;this.create({id:r,type:"error",message:c,description:u})}}).finally(()=>{var s;a&&(this.dismiss(r),r=void 0),(s=e.finally)==null||s.call(e)}),i=()=>new Promise((s,c)=>l.then(()=>o[0]==="reject"?c(o[1]):s(o[1])).catch(c));return typeof r!="string"&&typeof r!="number"?{unwrap:i}:Object.assign(r,{unwrap:i})},this.custom=(t,e)=>{let r=(e==null?void 0:e.id)||en++;return this.create({jsx:t(r),id:r,...e}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Ae=new Sl,El=(t,e)=>{let r=(e==null?void 0:e.id)||en++;return Ae.addToast({title:t,...e,id:r}),r},_l=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",Cl=El,kl=()=>Ae.toasts,Tl=()=>Ae.getActiveToasts(),rt=Object.assign(Cl,{success:Ae.success,info:Ae.info,warning:Ae.warning,error:Ae.error,custom:Ae.custom,message:Ae.message,promise:Ae.promise,dismiss:Ae.dismiss,loading:Ae.loading},{getHistory:kl,getToasts:Tl});function Rl(t,{insertAt:e}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e==="top"&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}Rl(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
`);function Lt(t){return t.label!==void 0}var Al=3,jl="32px",Il="16px",Qn=4e3,Ll=356,Nl=14,Pl=20,zl=200;function Fe(...t){return t.filter(Boolean).join(" ")}function Dl(t){let[e,r]=t.split("-"),n=[];return e&&n.push(e),r&&n.push(r),n}var Ol=t=>{var e,r,n,a,o,l,i,s,c,u,d;let{invert:h,toast:f,unstyled:b,interacting:y,setHeights:T,visibleToasts:N,heights:_,index:A,toasts:R,expanded:I,removeToast:D,defaultRichColors:m,closeButton:E,style:x,cancelButtonStyle:k,actionButtonStyle:L,className:j="",descriptionClassName:w="",duration:V,position:K,gap:O,loadingIcon:C,expandByDefault:S,classNames:H,icons:ae,closeButtonAriaLabel:$="Close toast",pauseWhenPageIsHidden:v}=t,[z,B]=W.useState(null),[M,J]=W.useState(null),[X,Y]=W.useState(!1),[ie,ne]=W.useState(!1),[se,F]=W.useState(!1),[Q,q]=W.useState(!1),[U,P]=W.useState(!1),[oe,ue]=W.useState(0),[te,Z]=W.useState(0),G=W.useRef(f.duration||V||Qn),ge=W.useRef(null),pe=W.useRef(null),ye=A===0,we=A+1<=N,de=f.type,me=f.dismissible!==!1,Ie=f.className||"",ke=f.descriptionClassName||"",Te=W.useMemo(()=>_.findIndex(le=>le.toastId===f.id)||0,[_,f.id]),Pe=W.useMemo(()=>{var le;return(le=f.closeButton)!=null?le:E},[f.closeButton,E]),Ye=W.useMemo(()=>f.duration||V||Qn,[f.duration,V]),Ke=W.useRef(0),Re=W.useRef(0),st=W.useRef(0),ze=W.useRef(null),[ii,li]=K.split("-"),Bn=W.useMemo(()=>_.reduce((le,he,ve)=>ve>=Te?le:le+he.height,0),[_,Te]),Vn=xl(),ci=f.invert||h,fr=de==="loading";Re.current=W.useMemo(()=>Te*O+Bn,[Te,Bn]),W.useEffect(()=>{G.current=Ye},[Ye]),W.useEffect(()=>{Y(!0)},[]),W.useEffect(()=>{let le=pe.current;if(le){let he=le.getBoundingClientRect().height;return Z(he),T(ve=>[{toastId:f.id,height:he,position:f.position},...ve]),()=>T(ve=>ve.filter(De=>De.toastId!==f.id))}},[T,f.id]),W.useLayoutEffect(()=>{if(!X)return;let le=pe.current,he=le.style.height;le.style.height="auto";let ve=le.getBoundingClientRect().height;le.style.height=he,Z(ve),T(De=>De.find(Oe=>Oe.toastId===f.id)?De.map(Oe=>Oe.toastId===f.id?{...Oe,height:ve}:Oe):[{toastId:f.id,height:ve,position:f.position},...De])},[X,f.title,f.description,T,f.id]);let Qe=W.useCallback(()=>{ne(!0),ue(Re.current),T(le=>le.filter(he=>he.toastId!==f.id)),setTimeout(()=>{D(f)},zl)},[f,D,T,Re]);W.useEffect(()=>{if(f.promise&&de==="loading"||f.duration===1/0||f.type==="loading")return;let le;return I||y||v&&Vn?(()=>{if(st.current<Ke.current){let he=new Date().getTime()-Ke.current;G.current=G.current-he}st.current=new Date().getTime()})():G.current!==1/0&&(Ke.current=new Date().getTime(),le=setTimeout(()=>{var he;(he=f.onAutoClose)==null||he.call(f,f),Qe()},G.current)),()=>clearTimeout(le)},[I,y,f,de,v,Vn,Qe]),W.useEffect(()=>{f.delete&&Qe()},[Qe,f.delete]);function ui(){var le,he,ve;return ae!=null&&ae.loading?W.createElement("div",{className:Fe(H==null?void 0:H.loader,(le=f==null?void 0:f.classNames)==null?void 0:le.loader,"sonner-loader"),"data-visible":de==="loading"},ae.loading):C?W.createElement("div",{className:Fe(H==null?void 0:H.loader,(he=f==null?void 0:f.classNames)==null?void 0:he.loader,"sonner-loader"),"data-visible":de==="loading"},C):W.createElement(pl,{className:Fe(H==null?void 0:H.loader,(ve=f==null?void 0:f.classNames)==null?void 0:ve.loader),visible:de==="loading"})}return W.createElement("li",{tabIndex:0,ref:pe,className:Fe(j,Ie,H==null?void 0:H.toast,(e=f==null?void 0:f.classNames)==null?void 0:e.toast,H==null?void 0:H.default,H==null?void 0:H[de],(r=f==null?void 0:f.classNames)==null?void 0:r[de]),"data-sonner-toast":"","data-rich-colors":(n=f.richColors)!=null?n:m,"data-styled":!(f.jsx||f.unstyled||b),"data-mounted":X,"data-promise":!!f.promise,"data-swiped":U,"data-removed":ie,"data-visible":we,"data-y-position":ii,"data-x-position":li,"data-index":A,"data-front":ye,"data-swiping":se,"data-dismissible":me,"data-type":de,"data-invert":ci,"data-swipe-out":Q,"data-swipe-direction":M,"data-expanded":!!(I||S&&X),style:{"--index":A,"--toasts-before":A,"--z-index":R.length-A,"--offset":`${ie?oe:Re.current}px`,"--initial-height":S?"auto":`${te}px`,...x,...f.style},onDragEnd:()=>{F(!1),B(null),ze.current=null},onPointerDown:le=>{fr||!me||(ge.current=new Date,ue(Re.current),le.target.setPointerCapture(le.pointerId),le.target.tagName!=="BUTTON"&&(F(!0),ze.current={x:le.clientX,y:le.clientY}))},onPointerUp:()=>{var le,he,ve,De;if(Q||!me)return;ze.current=null;let Oe=Number(((le=pe.current)==null?void 0:le.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Je=Number(((he=pe.current)==null?void 0:he.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),it=new Date().getTime()-((ve=ge.current)==null?void 0:ve.getTime()),Ge=z==="x"?Oe:Je,Ze=Math.abs(Ge)/it;if(Math.abs(Ge)>=Pl||Ze>.11){ue(Re.current),(De=f.onDismiss)==null||De.call(f,f),J(z==="x"?Oe>0?"right":"left":Je>0?"down":"up"),Qe(),q(!0),P(!1);return}F(!1),B(null)},onPointerMove:le=>{var he,ve,De,Oe;if(!ze.current||!me||((he=window.getSelection())==null?void 0:he.toString().length)>0)return;let Je=le.clientY-ze.current.y,it=le.clientX-ze.current.x,Ge=(ve=t.swipeDirections)!=null?ve:Dl(K);!z&&(Math.abs(it)>1||Math.abs(Je)>1)&&B(Math.abs(it)>Math.abs(Je)?"x":"y");let Ze={x:0,y:0};z==="y"?(Ge.includes("top")||Ge.includes("bottom"))&&(Ge.includes("top")&&Je<0||Ge.includes("bottom")&&Je>0)&&(Ze.y=Je):z==="x"&&(Ge.includes("left")||Ge.includes("right"))&&(Ge.includes("left")&&it<0||Ge.includes("right")&&it>0)&&(Ze.x=it),(Math.abs(Ze.x)>0||Math.abs(Ze.y)>0)&&P(!0),(De=pe.current)==null||De.style.setProperty("--swipe-amount-x",`${Ze.x}px`),(Oe=pe.current)==null||Oe.style.setProperty("--swipe-amount-y",`${Ze.y}px`)}},Pe&&!f.jsx?W.createElement("button",{"aria-label":$,"data-disabled":fr,"data-close-button":!0,onClick:fr||!me?()=>{}:()=>{var le;Qe(),(le=f.onDismiss)==null||le.call(f,f)},className:Fe(H==null?void 0:H.closeButton,(a=f==null?void 0:f.classNames)==null?void 0:a.closeButton)},(o=ae==null?void 0:ae.close)!=null?o:wl):null,f.jsx||p.isValidElement(f.title)?f.jsx?f.jsx:typeof f.title=="function"?f.title():f.title:W.createElement(W.Fragment,null,de||f.icon||f.promise?W.createElement("div",{"data-icon":"",className:Fe(H==null?void 0:H.icon,(l=f==null?void 0:f.classNames)==null?void 0:l.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||ui():null,f.type!=="loading"?f.icon||(ae==null?void 0:ae[de])||hl(de):null):null,W.createElement("div",{"data-content":"",className:Fe(H==null?void 0:H.content,(i=f==null?void 0:f.classNames)==null?void 0:i.content)},W.createElement("div",{"data-title":"",className:Fe(H==null?void 0:H.title,(s=f==null?void 0:f.classNames)==null?void 0:s.title)},typeof f.title=="function"?f.title():f.title),f.description?W.createElement("div",{"data-description":"",className:Fe(w,ke,H==null?void 0:H.description,(c=f==null?void 0:f.classNames)==null?void 0:c.description)},typeof f.description=="function"?f.description():f.description):null),p.isValidElement(f.cancel)?f.cancel:f.cancel&&Lt(f.cancel)?W.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||k,onClick:le=>{var he,ve;Lt(f.cancel)&&me&&((ve=(he=f.cancel).onClick)==null||ve.call(he,le),Qe())},className:Fe(H==null?void 0:H.cancelButton,(u=f==null?void 0:f.classNames)==null?void 0:u.cancelButton)},f.cancel.label):null,p.isValidElement(f.action)?f.action:f.action&&Lt(f.action)?W.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||L,onClick:le=>{var he,ve;Lt(f.action)&&((ve=(he=f.action).onClick)==null||ve.call(he,le),!le.defaultPrevented&&Qe())},className:Fe(H==null?void 0:H.actionButton,(d=f==null?void 0:f.classNames)==null?void 0:d.actionButton)},f.action.label):null))};function Jn(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function Gl(t,e){let r={};return[t,e].forEach((n,a)=>{let o=a===1,l=o?"--mobile-offset":"--offset",i=o?Il:jl;function s(c){["top","right","bottom","left"].forEach(u=>{r[`${l}-${u}`]=typeof c=="number"?`${c}px`:c})}typeof n=="number"||typeof n=="string"?s(n):typeof n=="object"?["top","right","bottom","left"].forEach(c=>{n[c]===void 0?r[`${l}-${c}`]=i:r[`${l}-${c}`]=typeof n[c]=="number"?`${n[c]}px`:n[c]}):s(i)}),r}var np=p.forwardRef(function(t,e){let{invert:r,position:n="bottom-right",hotkey:a=["altKey","KeyT"],expand:o,closeButton:l,className:i,offset:s,mobileOffset:c,theme:u="light",richColors:d,duration:h,style:f,visibleToasts:b=Al,toastOptions:y,dir:T=Jn(),gap:N=Nl,loadingIcon:_,icons:A,containerAriaLabel:R="Notifications",pauseWhenPageIsHidden:I}=t,[D,m]=W.useState([]),E=W.useMemo(()=>Array.from(new Set([n].concat(D.filter(v=>v.position).map(v=>v.position)))),[D,n]),[x,k]=W.useState([]),[L,j]=W.useState(!1),[w,V]=W.useState(!1),[K,O]=W.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),C=W.useRef(null),S=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),H=W.useRef(null),ae=W.useRef(!1),$=W.useCallback(v=>{m(z=>{var B;return(B=z.find(M=>M.id===v.id))!=null&&B.delete||Ae.dismiss(v.id),z.filter(({id:M})=>M!==v.id)})},[]);return W.useEffect(()=>Ae.subscribe(v=>{if(v.dismiss){m(z=>z.map(B=>B.id===v.id?{...B,delete:!0}:B));return}setTimeout(()=>{hi.flushSync(()=>{m(z=>{let B=z.findIndex(M=>M.id===v.id);return B!==-1?[...z.slice(0,B),{...z[B],...v},...z.slice(B+1)]:[v,...z]})})})}),[]),W.useEffect(()=>{if(u!=="system"){O(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?O("dark"):O("light")),typeof window>"u")return;let v=window.matchMedia("(prefers-color-scheme: dark)");try{v.addEventListener("change",({matches:z})=>{O(z?"dark":"light")})}catch{v.addListener(({matches:B})=>{try{O(B?"dark":"light")}catch(M){console.error(M)}})}},[u]),W.useEffect(()=>{D.length<=1&&j(!1)},[D]),W.useEffect(()=>{let v=z=>{var B,M;a.every(J=>z[J]||z.code===J)&&(j(!0),(B=C.current)==null||B.focus()),z.code==="Escape"&&(document.activeElement===C.current||(M=C.current)!=null&&M.contains(document.activeElement))&&j(!1)};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[a]),W.useEffect(()=>{if(C.current)return()=>{H.current&&(H.current.focus({preventScroll:!0}),H.current=null,ae.current=!1)}},[C.current]),W.createElement("section",{ref:e,"aria-label":`${R} ${S}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},E.map((v,z)=>{var B;let[M,J]=v.split("-");return D.length?W.createElement("ol",{key:v,dir:T==="auto"?Jn():T,tabIndex:-1,ref:C,className:i,"data-sonner-toaster":!0,"data-theme":K,"data-y-position":M,"data-lifted":L&&D.length>1&&!o,"data-x-position":J,style:{"--front-toast-height":`${((B=x[0])==null?void 0:B.height)||0}px`,"--width":`${Ll}px`,"--gap":`${N}px`,...f,...Gl(s,c)},onBlur:X=>{ae.current&&!X.currentTarget.contains(X.relatedTarget)&&(ae.current=!1,H.current&&(H.current.focus({preventScroll:!0}),H.current=null))},onFocus:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||ae.current||(ae.current=!0,H.current=X.relatedTarget)},onMouseEnter:()=>j(!0),onMouseMove:()=>j(!0),onMouseLeave:()=>{w||j(!1)},onDragEnd:()=>j(!1),onPointerDown:X=>{X.target instanceof HTMLElement&&X.target.dataset.dismissible==="false"||V(!0)},onPointerUp:()=>V(!1)},D.filter(X=>!X.position&&z===0||X.position===v).map((X,Y)=>{var ie,ne;return W.createElement(Ol,{key:X.id,icons:A,index:Y,toast:X,defaultRichColors:d,duration:(ie=y==null?void 0:y.duration)!=null?ie:h,className:y==null?void 0:y.className,descriptionClassName:y==null?void 0:y.descriptionClassName,invert:r,visibleToasts:b,closeButton:(ne=y==null?void 0:y.closeButton)!=null?ne:l,interacting:w,position:v,style:y==null?void 0:y.style,unstyled:y==null?void 0:y.unstyled,classNames:y==null?void 0:y.classNames,cancelButtonStyle:y==null?void 0:y.cancelButtonStyle,actionButtonStyle:y==null?void 0:y.actionButtonStyle,removeToast:$,toasts:D.filter(se=>se.position==X.position),heights:x.filter(se=>se.position==X.position),setHeights:k,expandByDefault:o,gap:N,loadingIcon:_,expanded:L,pauseWhenPageIsHidden:I,swipeDirections:t.swipeDirections})})):null}))});const Fl={theme:"system",setTheme:()=>null},Ra=p.createContext(Fl);function op({children:t,...e}){const r=re.use.theme(),n=re.use.setTheme();p.useEffect(()=>{const o=window.document.documentElement;if(o.classList.remove("light","dark"),r==="system"){const l=window.matchMedia("(prefers-color-scheme: dark)"),i=s=>{o.classList.remove("light","dark"),o.classList.add(s.matches?"dark":"light")};return o.classList.add(l.matches?"dark":"light"),l.addEventListener("change",i),()=>l.removeEventListener("change",i)}else o.classList.add(r)},[r]);const a={theme:r,setTheme:n};return g.jsx(Ra.Provider,{...e,value:a,children:t})}const $l=(t,e,r,n)=>{var o,l,i,s;const a=[r,{code:e,...n||{}}];if((l=(o=t==null?void 0:t.services)==null?void 0:o.logger)!=null&&l.forward)return t.services.logger.forward(a,"warn","react-i18next::",!0);ht(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),(s=(i=t==null?void 0:t.services)==null?void 0:i.logger)!=null&&s.warn?t.services.logger.warn(...a):console!=null&&console.warn&&console.warn(...a)},Zn={},tn=(t,e,r,n)=>{ht(r)&&Zn[r]||(ht(r)&&(Zn[r]=new Date),$l(t,e,r,n))},Aa=(t,e)=>()=>{if(t.isInitialized)e();else{const r=()=>{setTimeout(()=>{t.off("initialized",r)},0),e()};t.on("initialized",r)}},rn=(t,e,r)=>{t.loadNamespaces(e,Aa(t,r))},eo=(t,e,r,n)=>{if(ht(r)&&(r=[r]),t.options.preload&&t.options.preload.indexOf(e)>-1)return rn(t,r,n);r.forEach(a=>{t.options.ns.indexOf(a)<0&&t.options.ns.push(a)}),t.loadLanguages(e,Aa(t,n))},Ml=(t,e,r={})=>!e.languages||!e.languages.length?(tn(e,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:e.languages}),!0):e.hasLoadedNamespace(t,{lng:r.lng,precheck:(n,a)=>{var o;if(((o=r.bindI18n)==null?void 0:o.indexOf("languageChanging"))>-1&&n.services.backendConnector.backend&&n.isLanguageChangingTo&&!a(n.isLanguageChangingTo,t))return!1}}),ht=t=>typeof t=="string",Hl=t=>typeof t=="object"&&t!==null,Bl=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Vl={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Ul=t=>Vl[t],ql=t=>t.replace(Bl,Ul);let nn={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:ql};const Wl=(t={})=>{nn={...nn,...t}},Xl=()=>nn;let ja;const Yl=t=>{ja=t},Kl=()=>ja,ap={type:"3rdParty",init(t){Wl(t.options.react),Yl(t)}},Ql=p.createContext();class Jl{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(r=>{this.usedNamespaces[r]||(this.usedNamespaces[r]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const Zl=(t,e)=>{const r=p.useRef();return p.useEffect(()=>{r.current=t},[t,e]),r.current},Ia=(t,e,r,n)=>t.getFixedT(e,r,n),ec=(t,e,r,n)=>p.useCallback(Ia(t,e,r,n),[t,e,r,n]),xe=(t,e={})=>{var R,I,D,m;const{i18n:r}=e,{i18n:n,defaultNS:a}=p.useContext(Ql)||{},o=r||n||Kl();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new Jl),!o){tn(o,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const E=(k,L)=>ht(L)?L:Hl(L)&&ht(L.defaultValue)?L.defaultValue:Array.isArray(k)?k[k.length-1]:k,x=[E,{},!1];return x.t=E,x.i18n={},x.ready=!1,x}(R=o.options.react)!=null&&R.wait&&tn(o,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const l={...Xl(),...o.options.react,...e},{useSuspense:i,keyPrefix:s}=l;let c=a||((I=o.options)==null?void 0:I.defaultNS);c=ht(c)?[c]:c||["translation"],(m=(D=o.reportNamespaces).addUsedNamespaces)==null||m.call(D,c);const u=(o.isInitialized||o.initializedStoreOnce)&&c.every(E=>Ml(E,o,l)),d=ec(o,e.lng||null,l.nsMode==="fallback"?c:c[0],s),h=()=>d,f=()=>Ia(o,e.lng||null,l.nsMode==="fallback"?c:c[0],s),[b,y]=p.useState(h);let T=c.join();e.lng&&(T=`${e.lng}${T}`);const N=Zl(T),_=p.useRef(!0);p.useEffect(()=>{const{bindI18n:E,bindI18nStore:x}=l;_.current=!0,!u&&!i&&(e.lng?eo(o,e.lng,c,()=>{_.current&&y(f)}):rn(o,c,()=>{_.current&&y(f)})),u&&N&&N!==T&&_.current&&y(f);const k=()=>{_.current&&y(f)};return E&&(o==null||o.on(E,k)),x&&(o==null||o.store.on(x,k)),()=>{_.current=!1,o&&(E==null||E.split(" ").forEach(L=>o.off(L,k))),x&&o&&x.split(" ").forEach(L=>o.store.off(L,k))}},[o,T]),p.useEffect(()=>{_.current&&u&&y(h)},[o,s,u]);const A=[b,o,u];if(A.t=b,A.i18n=o,A.ready=u,u||!u&&!i)return A;throw new Promise(E=>{e.lng?eo(o,e.lng,c,()=>E()):rn(o,c,()=>E())})},to=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,ro=Sa,tc=(t,e)=>r=>{var n;if((e==null?void 0:e.variants)==null)return ro(t,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:a,defaultVariants:o}=e,l=Object.keys(a).map(c=>{const u=r==null?void 0:r[c],d=o==null?void 0:o[c];if(u===null)return null;const h=to(u)||to(d);return a[c][h]}),i=r&&Object.entries(r).reduce((c,u)=>{let[d,h]=u;return h===void 0||(c[d]=h),c},{}),s=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((c,u)=>{let{class:d,className:h,...f}=u;return Object.entries(f).every(b=>{let[y,T]=b;return Array.isArray(T)?T.includes({...o,...i}[y]):{...o,...i}[y]===T})?[...c,d,h]:c},[]);return ro(t,l,s,r==null?void 0:r.class,r==null?void 0:r.className)};var[rr,sp]=wn("Tooltip",[pa]),nr=pa(),La="TooltipProvider",rc=700,on="tooltip.open",[nc,Cn]=rr(La),Na=t=>{const{__scopeTooltip:e,delayDuration:r=rc,skipDelayDuration:n=300,disableHoverableContent:a=!1,children:o}=t,[l,i]=p.useState(!0),s=p.useRef(!1),c=p.useRef(0);return p.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),g.jsx(nc,{scope:e,isOpenDelayed:l,delayDuration:r,onOpen:p.useCallback(()=>{window.clearTimeout(c.current),i(!1)},[]),onClose:p.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i(!0),n)},[n]),isPointerInTransitRef:s,onPointerInTransitChange:p.useCallback(u=>{s.current=u},[]),disableHoverableContent:a,children:o})};Na.displayName=La;var or="Tooltip",[oc,ar]=rr(or),Pa=t=>{const{__scopeTooltip:e,children:r,open:n,defaultOpen:a=!1,onOpenChange:o,disableHoverableContent:l,delayDuration:i}=t,s=Cn(or,t.__scopeTooltip),c=nr(e),[u,d]=p.useState(null),h=ft(),f=p.useRef(0),b=l??s.disableHoverableContent,y=i??s.delayDuration,T=p.useRef(!1),[N=!1,_]=ma({prop:n,defaultProp:a,onChange:m=>{m?(s.onOpen(),document.dispatchEvent(new CustomEvent(on))):s.onClose(),o==null||o(m)}}),A=p.useMemo(()=>N?T.current?"delayed-open":"instant-open":"closed",[N]),R=p.useCallback(()=>{window.clearTimeout(f.current),f.current=0,T.current=!1,_(!0)},[_]),I=p.useCallback(()=>{window.clearTimeout(f.current),f.current=0,_(!1)},[_]),D=p.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{T.current=!0,_(!0),f.current=0},y)},[y,_]);return p.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),g.jsx(Ri,{...c,children:g.jsx(oc,{scope:e,contentId:h,open:N,stateAttribute:A,trigger:u,onTriggerChange:d,onTriggerEnter:p.useCallback(()=>{s.isOpenDelayed?D():R()},[s.isOpenDelayed,D,R]),onTriggerLeave:p.useCallback(()=>{b?I():(window.clearTimeout(f.current),f.current=0)},[I,b]),onOpen:R,onClose:I,disableHoverableContent:b,children:r})})};Pa.displayName=or;var an="TooltipTrigger",za=p.forwardRef((t,e)=>{const{__scopeTooltip:r,...n}=t,a=ar(an,r),o=Cn(an,r),l=nr(r),i=p.useRef(null),s=Xe(e,i,a.onTriggerChange),c=p.useRef(!1),u=p.useRef(!1),d=p.useCallback(()=>c.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),g.jsx(Ai,{asChild:!0,...l,children:g.jsx(Ee.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:s,onPointerMove:Ce(t.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),u.current=!0)}),onPointerLeave:Ce(t.onPointerLeave,()=>{a.onTriggerLeave(),u.current=!1}),onPointerDown:Ce(t.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Ce(t.onFocus,()=>{c.current||a.onOpen()}),onBlur:Ce(t.onBlur,a.onClose),onClick:Ce(t.onClick,a.onClose)})})});za.displayName=an;var ac="TooltipPortal",[ip,sc]=rr(ac,{forceMount:void 0}),wt="TooltipContent",Da=p.forwardRef((t,e)=>{const r=sc(wt,t.__scopeTooltip),{forceMount:n=r.forceMount,side:a="top",...o}=t,l=ar(wt,t.__scopeTooltip);return g.jsx(St,{present:n||l.open,children:l.disableHoverableContent?g.jsx(Oa,{side:a,...o,ref:e}):g.jsx(ic,{side:a,...o,ref:e})})}),ic=p.forwardRef((t,e)=>{const r=ar(wt,t.__scopeTooltip),n=Cn(wt,t.__scopeTooltip),a=p.useRef(null),o=Xe(e,a),[l,i]=p.useState(null),{trigger:s,onClose:c}=r,u=a.current,{onPointerInTransitChange:d}=n,h=p.useCallback(()=>{i(null),d(!1)},[d]),f=p.useCallback((b,y)=>{const T=b.currentTarget,N={x:b.clientX,y:b.clientY},_=dc(N,T.getBoundingClientRect()),A=fc(N,_),R=hc(y.getBoundingClientRect()),I=pc([...A,...R]);i(I),d(!0)},[d]);return p.useEffect(()=>()=>h(),[h]),p.useEffect(()=>{if(s&&u){const b=T=>f(T,u),y=T=>f(T,s);return s.addEventListener("pointerleave",b),u.addEventListener("pointerleave",y),()=>{s.removeEventListener("pointerleave",b),u.removeEventListener("pointerleave",y)}}},[s,u,f,h]),p.useEffect(()=>{if(l){const b=y=>{const T=y.target,N={x:y.clientX,y:y.clientY},_=(s==null?void 0:s.contains(T))||(u==null?void 0:u.contains(T)),A=!gc(N,l);_?h():A&&(h(),c())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[s,u,l,c,h]),g.jsx(Oa,{...t,ref:o})}),[lc,cc]=rr(or,{isInside:!1}),Oa=p.forwardRef((t,e)=>{const{__scopeTooltip:r,children:n,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:l,...i}=t,s=ar(wt,r),c=nr(r),{onClose:u}=s;return p.useEffect(()=>(document.addEventListener(on,u),()=>document.removeEventListener(on,u)),[u]),p.useEffect(()=>{if(s.trigger){const d=h=>{const f=h.target;f!=null&&f.contains(s.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[s.trigger,u]),g.jsx(_i,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:g.jsxs(Ci,{"data-state":s.stateAttribute,...c,...i,ref:e,style:{...i.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[g.jsx(ki,{children:n}),g.jsx(lc,{scope:r,isInside:!0,children:g.jsx(Ti,{id:s.contentId,role:"tooltip",children:a||n})})]})})});Da.displayName=wt;var Ga="TooltipArrow",uc=p.forwardRef((t,e)=>{const{__scopeTooltip:r,...n}=t,a=nr(r);return cc(Ga,r).isInside?null:g.jsx(ji,{...a,...n,ref:e})});uc.displayName=Ga;function dc(t,e){const r=Math.abs(e.top-t.y),n=Math.abs(e.bottom-t.y),a=Math.abs(e.right-t.x),o=Math.abs(e.left-t.x);switch(Math.min(r,n,a,o)){case o:return"left";case a:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function fc(t,e,r=5){const n=[];switch(e){case"top":n.push({x:t.x-r,y:t.y+r},{x:t.x+r,y:t.y+r});break;case"bottom":n.push({x:t.x-r,y:t.y-r},{x:t.x+r,y:t.y-r});break;case"left":n.push({x:t.x+r,y:t.y-r},{x:t.x+r,y:t.y+r});break;case"right":n.push({x:t.x-r,y:t.y-r},{x:t.x-r,y:t.y+r});break}return n}function hc(t){const{top:e,right:r,bottom:n,left:a}=t;return[{x:a,y:e},{x:r,y:e},{x:r,y:n},{x:a,y:n}]}function gc(t,e){const{x:r,y:n}=t;let a=!1;for(let o=0,l=e.length-1;o<e.length;l=o++){const i=e[o].x,s=e[o].y,c=e[l].x,u=e[l].y;s>n!=u>n&&r<(c-i)*(n-s)/(u-s)+i&&(a=!a)}return a}function pc(t){const e=t.slice();return e.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),mc(e)}function mc(t){if(t.length<=1)return t.slice();const e=[];for(let n=0;n<t.length;n++){const a=t[n];for(;e.length>=2;){const o=e[e.length-1],l=e[e.length-2];if((o.x-l.x)*(a.y-l.y)>=(o.y-l.y)*(a.x-l.x))e.pop();else break}e.push(a)}e.pop();const r=[];for(let n=t.length-1;n>=0;n--){const a=t[n];for(;r.length>=2;){const o=r[r.length-1],l=r[r.length-2];if((o.x-l.x)*(a.y-l.y)>=(o.y-l.y)*(a.x-l.x))r.pop();else break}r.push(a)}return r.pop(),e.length===1&&r.length===1&&e[0].x===r[0].x&&e[0].y===r[0].y?e:e.concat(r)}var vc=Na,yc=Pa,bc=za,Fa=Da;const $a=vc,Ma=yc,Ha=bc,wc=t=>typeof t!="string"?t:g.jsx("div",{className:"relative top-0 pt-1 whitespace-pre-wrap break-words",children:t}),kn=p.forwardRef(({className:t,side:e="left",align:r="start",children:n,...a},o)=>{const l=p.useRef(null);return p.useEffect(()=>{l.current&&(l.current.scrollTop=0)},[n]),g.jsx(Fa,{ref:o,side:e,align:r,className:fe("bg-popover text-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-[60vh] overflow-y-auto whitespace-pre-wrap break-words rounded-md border px-3 py-2 text-sm shadow-md z-60",t),...a,children:typeof n=="string"?wc(n):n})});kn.displayName=Fa.displayName;const no=tc("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"size-8"}},defaultVariants:{variant:"default",size:"default"}}),be=p.forwardRef(({className:t,variant:e,tooltip:r,size:n,side:a="right",asChild:o=!1,...l},i)=>{const s=o?Ii:"button";return r?g.jsx($a,{children:g.jsxs(Ma,{children:[g.jsx(Ha,{asChild:!0,children:g.jsx(s,{className:fe(no({variant:e,size:n,className:t}),"cursor-pointer"),ref:i,...l})}),g.jsx(kn,{side:a,children:r})]})}):g.jsx(s,{className:fe(no({variant:e,size:n,className:t}),"cursor-pointer"),ref:i,...l})});be.displayName="Button";const qt=p.forwardRef(({className:t,type:e,...r},n)=>g.jsx("input",{type:e,className:fe("border-input file:text-foreground placeholder:text-muted-foreground focus-visible:ring-ring flex h-9 rounded-md border bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-1 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm [&::-webkit-inner-spin-button]:opacity-50 [&::-webkit-outer-spin-button]:opacity-50",t),ref:n,...r}));qt.displayName="Input";/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const xc=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ba=(...t)=>t.filter((e,r,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===r).join(" ").trim();/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/var Sc={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Ec=p.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:o,iconNode:l,...i},s)=>p.createElement("svg",{ref:s,...Sc,width:e,height:e,stroke:t,strokeWidth:n?Number(r)*24/Number(e):r,className:Ba("lucide",a),...i},[...l.map(([c,u])=>p.createElement(c,u)),...Array.isArray(o)?o:[o]]));/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const ce=(t,e)=>{const r=p.forwardRef(({className:n,...a},o)=>p.createElement(Ec,{ref:o,iconNode:e,className:Ba(`lucide-${xc(t)}`,n),...a}));return r.displayName=`${t}`,r};/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const _c=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],lp=ce("Activity",_c);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Cc=[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],cp=ce("AlignCenter",Cc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const kc=[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],up=ce("AlignLeft",kc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Tc=[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]],dp=ce("AlignRight",Tc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Rc=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],fp=ce("ArrowDown",Rc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Ac=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],hp=ce("ArrowUp",Ac);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const jc=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],Ic=ce("BookOpen",jc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Lc=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Va=ce("Check",Lc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Nc=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],gp=ce("ChevronDown",Nc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Pc=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],pp=ce("ChevronUp",Pc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const zc=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],Dc=ce("ChevronsUpDown",zc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Oc=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],mp=ce("Copy",Oc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Gc=[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]],vp=ce("Eraser",Gc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Fc=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],yp=ce("FileText",Fc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const $c=[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]],bp=ce("Files",$c);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Mc=[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]],wp=ce("Filter",Mc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Hc=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["rect",{width:"10",height:"8",x:"7",y:"8",rx:"1",key:"vys8me"}]],Bc=ce("Fullscreen",Hc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Vc=[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]],Uc=ce("GitBranchPlus",Vc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const qc=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],xp=ce("Github",qc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Wc=[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"19",cy:"5",r:"1",key:"w8mnmm"}],["circle",{cx:"5",cy:"5",r:"1",key:"lttvr7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}],["circle",{cx:"19",cy:"19",r:"1",key:"shf9b7"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]],Xc=ce("Grip",Wc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Yc=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ua=ce("LoaderCircle",Yc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Kc=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],Sp=ce("Loader",Kc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Qc=[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]],Ep=ce("LogOut",Qc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Jc=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],Zc=ce("Maximize",Jc);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const eu=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],tu=ce("Minimize",eu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const ru=[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]],_p=ce("Palette",ru);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const nu=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],ou=ce("Pause",nu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const au=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],su=ce("Pencil",au);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const iu=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],lu=ce("Play",iu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const cu=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],uu=ce("RefreshCw",cu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const du=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],fu=ce("RotateCcw",du);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const hu=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],gu=ce("RotateCw",hu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const pu=[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]],mu=ce("Scissors",pu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const vu=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],yu=ce("Search",vu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const bu=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Cp=ce("Send",bu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const wu=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],xu=ce("Settings",wu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Su=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],kp=ce("TriangleAlert",Su);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Eu=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],qa=ce("Undo2",Eu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const _u=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]],Tp=ce("Upload",_u);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Cu=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ku=ce("X",Cu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Tu=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Rp=ce("Zap",Tu);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Ru=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Au=ce("ZoomIn",Ru);/**
|
|
* @license lucide-react v0.475.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const ju=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Iu=ce("ZoomOut",ju),Lu=wa,Ap=Ni,Nu=va,Wa=p.forwardRef(({className:t,...e},r)=>g.jsx(xn,{ref:r,className:fe("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/30",t),...e}));Wa.displayName=xn.displayName;const Xa=p.forwardRef(({className:t,children:e,...r},n)=>g.jsxs(Nu,{children:[g.jsx(Wa,{}),g.jsxs(Sn,{ref:n,className:fe("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-top-[48%] fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg",t),...r,children:[e,g.jsxs(Li,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none",children:[g.jsx(ku,{className:"h-4 w-4"}),g.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Xa.displayName=Sn.displayName;const Ya=({className:t,...e})=>g.jsx("div",{className:fe("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Ya.displayName="DialogHeader";const Ka=({className:t,...e})=>g.jsx("div",{className:fe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Ka.displayName="DialogFooter";const Qa=p.forwardRef(({className:t,...e},r)=>g.jsx(ya,{ref:r,className:fe("text-lg leading-none font-semibold tracking-tight",t),...e}));Qa.displayName=ya.displayName;const Ja=p.forwardRef(({className:t,...e},r)=>g.jsx(ba,{ref:r,className:fe("text-muted-foreground text-sm",t),...e}));Ja.displayName=ba.displayName;const Tn=zi,Rn=Di,sr=p.forwardRef(({className:t,align:e="center",sideOffset:r=4,collisionPadding:n,sticky:a,avoidCollisions:o=!1,...l},i)=>g.jsx(Pi,{children:g.jsx(xa,{ref:i,align:e,sideOffset:r,collisionPadding:n,sticky:a,avoidCollisions:o,className:fe("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 rounded-md border p-4 shadow-md outline-none",t),...l})}));sr.displayName=xa.displayName;var Pu=`
|
|
precision mediump float;
|
|
|
|
varying vec4 v_color;
|
|
varying float v_border;
|
|
|
|
const float radius = 0.5;
|
|
const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);
|
|
|
|
void main(void) {
|
|
vec2 m = gl_PointCoord - vec2(0.5, 0.5);
|
|
float dist = radius - length(m);
|
|
|
|
// No antialiasing for picking mode:
|
|
#ifdef PICKING_MODE
|
|
if (dist > v_border)
|
|
gl_FragColor = v_color;
|
|
else
|
|
gl_FragColor = transparent;
|
|
|
|
#else
|
|
float t = 0.0;
|
|
if (dist > v_border)
|
|
t = 1.0;
|
|
else if (dist > 0.0)
|
|
t = dist / v_border;
|
|
|
|
gl_FragColor = mix(transparent, v_color, t);
|
|
#endif
|
|
}
|
|
`,zu=Pu,Du=`
|
|
attribute vec4 a_id;
|
|
attribute vec4 a_color;
|
|
attribute vec2 a_position;
|
|
attribute float a_size;
|
|
|
|
uniform float u_sizeRatio;
|
|
uniform float u_pixelRatio;
|
|
uniform mat3 u_matrix;
|
|
|
|
varying vec4 v_color;
|
|
varying float v_border;
|
|
|
|
const float bias = 255.0 / 254.0;
|
|
|
|
void main() {
|
|
gl_Position = vec4(
|
|
(u_matrix * vec3(a_position, 1)).xy,
|
|
0,
|
|
1
|
|
);
|
|
|
|
// Multiply the point size twice:
|
|
// - x SCALING_RATIO to correct the canvas scaling
|
|
// - x 2 to correct the formulae
|
|
gl_PointSize = a_size / u_sizeRatio * u_pixelRatio * 2.0;
|
|
|
|
v_border = (0.5 / a_size) * u_sizeRatio;
|
|
|
|
#ifdef PICKING_MODE
|
|
// For picking mode, we use the ID as the color:
|
|
v_color = a_id;
|
|
#else
|
|
// For normal mode, we use the color:
|
|
v_color = a_color;
|
|
#endif
|
|
|
|
v_color.a *= bias;
|
|
}
|
|
`,Ou=Du,Za=WebGLRenderingContext,oo=Za.UNSIGNED_BYTE,ao=Za.FLOAT,Gu=["u_sizeRatio","u_pixelRatio","u_matrix"],Fu=function(t){function e(){return la(this,e),ca(this,e,arguments)}return aa(e,t),sa(e,[{key:"getDefinition",value:function(){return{VERTICES:1,VERTEX_SHADER_SOURCE:Ou,FRAGMENT_SHADER_SOURCE:zu,METHOD:WebGLRenderingContext.POINTS,UNIFORMS:Gu,ATTRIBUTES:[{name:"a_position",size:2,type:ao},{name:"a_size",size:1,type:ao},{name:"a_color",size:4,type:oo,normalized:!0},{name:"a_id",size:4,type:oo,normalized:!0}]}}},{key:"processVisibleItem",value:function(n,a,o){var l=this.array;l[a++]=o.x,l[a++]=o.y,l[a++]=o.size,l[a++]=Zt(o.color),l[a++]=n}},{key:"setUniforms",value:function(n,a){var o=n.sizeRatio,l=n.pixelRatio,i=n.matrix,s=a.gl,c=a.uniformLocations,u=c.u_sizeRatio,d=c.u_pixelRatio,h=c.u_matrix;s.uniform1f(d,l),s.uniform1f(u,o),s.uniformMatrix3fv(h,!1,i)}}])}(ia),$u=`
|
|
attribute vec4 a_id;
|
|
attribute vec4 a_color;
|
|
attribute vec2 a_normal;
|
|
attribute float a_normalCoef;
|
|
attribute vec2 a_positionStart;
|
|
attribute vec2 a_positionEnd;
|
|
attribute float a_positionCoef;
|
|
attribute float a_sourceRadius;
|
|
attribute float a_targetRadius;
|
|
attribute float a_sourceRadiusCoef;
|
|
attribute float a_targetRadiusCoef;
|
|
|
|
uniform mat3 u_matrix;
|
|
uniform float u_zoomRatio;
|
|
uniform float u_sizeRatio;
|
|
uniform float u_pixelRatio;
|
|
uniform float u_correctionRatio;
|
|
uniform float u_minEdgeThickness;
|
|
uniform float u_lengthToThicknessRatio;
|
|
uniform float u_feather;
|
|
|
|
varying vec4 v_color;
|
|
varying vec2 v_normal;
|
|
varying float v_thickness;
|
|
varying float v_feather;
|
|
|
|
const float bias = 255.0 / 254.0;
|
|
|
|
void main() {
|
|
float minThickness = u_minEdgeThickness;
|
|
|
|
vec2 normal = a_normal * a_normalCoef;
|
|
vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef;
|
|
|
|
float normalLength = length(normal);
|
|
vec2 unitNormal = normal / normalLength;
|
|
|
|
// These first computations are taken from edge.vert.glsl. Please read it to
|
|
// get better comments on what's happening:
|
|
float pixelsThickness = max(normalLength, minThickness * u_sizeRatio);
|
|
float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio;
|
|
|
|
// Here, we move the point to leave space for the arrow heads:
|
|
// Source arrow head
|
|
float sourceRadius = a_sourceRadius * a_sourceRadiusCoef;
|
|
float sourceDirection = sign(sourceRadius);
|
|
float webGLSourceRadius = sourceDirection * sourceRadius * 2.0 * u_correctionRatio / u_sizeRatio;
|
|
float webGLSourceArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;
|
|
vec2 sourceCompensationVector =
|
|
vec2(-sourceDirection * unitNormal.y, sourceDirection * unitNormal.x)
|
|
* (webGLSourceRadius + webGLSourceArrowHeadLength);
|
|
|
|
// Target arrow head
|
|
float targetRadius = a_targetRadius * a_targetRadiusCoef;
|
|
float targetDirection = sign(targetRadius);
|
|
float webGLTargetRadius = targetDirection * targetRadius * 2.0 * u_correctionRatio / u_sizeRatio;
|
|
float webGLTargetArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0;
|
|
vec2 targetCompensationVector =
|
|
vec2(-targetDirection * unitNormal.y, targetDirection * unitNormal.x)
|
|
* (webGLTargetRadius + webGLTargetArrowHeadLength);
|
|
|
|
// Here is the proper position of the vertex
|
|
gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness + sourceCompensationVector + targetCompensationVector, 1)).xy, 0, 1);
|
|
|
|
v_thickness = webGLThickness / u_zoomRatio;
|
|
|
|
v_normal = unitNormal;
|
|
|
|
v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0;
|
|
|
|
#ifdef PICKING_MODE
|
|
// For picking mode, we use the ID as the color:
|
|
v_color = a_id;
|
|
#else
|
|
// For normal mode, we use the color:
|
|
v_color = a_color;
|
|
#endif
|
|
|
|
v_color.a *= bias;
|
|
}
|
|
`,Mu=$u,es=WebGLRenderingContext,so=es.UNSIGNED_BYTE,Ue=es.FLOAT,Hu=["u_matrix","u_zoomRatio","u_sizeRatio","u_correctionRatio","u_pixelRatio","u_feather","u_minEdgeThickness","u_lengthToThicknessRatio"],Bu={lengthToThicknessRatio:bn.lengthToThicknessRatio};function ts(t){var e=Ut(Ut({},Bu),{});return function(r){function n(){return la(this,n),ca(this,n,arguments)}return aa(n,r),sa(n,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:Mu,FRAGMENT_SHADER_SOURCE:mi,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:Hu,ATTRIBUTES:[{name:"a_positionStart",size:2,type:Ue},{name:"a_positionEnd",size:2,type:Ue},{name:"a_normal",size:2,type:Ue},{name:"a_color",size:4,type:so,normalized:!0},{name:"a_id",size:4,type:so,normalized:!0},{name:"a_sourceRadius",size:1,type:Ue},{name:"a_targetRadius",size:1,type:Ue}],CONSTANT_ATTRIBUTES:[{name:"a_positionCoef",size:1,type:Ue},{name:"a_normalCoef",size:1,type:Ue},{name:"a_sourceRadiusCoef",size:1,type:Ue},{name:"a_targetRadiusCoef",size:1,type:Ue}],CONSTANT_DATA:[[0,1,-1,0],[0,-1,1,0],[1,1,0,1],[1,1,0,1],[0,-1,1,0],[1,-1,0,-1]]}}},{key:"processVisibleItem",value:function(o,l,i,s,c){var u=c.size||1,d=i.x,h=i.y,f=s.x,b=s.y,y=Zt(c.color),T=f-d,N=b-h,_=i.size||1,A=s.size||1,R=T*T+N*N,I=0,D=0;R&&(R=1/Math.sqrt(R),I=-N*R*u,D=T*R*u);var m=this.array;m[l++]=d,m[l++]=h,m[l++]=f,m[l++]=b,m[l++]=I,m[l++]=D,m[l++]=y,m[l++]=o,m[l++]=_,m[l++]=A}},{key:"setUniforms",value:function(o,l){var i=l.gl,s=l.uniformLocations,c=s.u_matrix,u=s.u_zoomRatio,d=s.u_feather,h=s.u_pixelRatio,f=s.u_correctionRatio,b=s.u_sizeRatio,y=s.u_minEdgeThickness,T=s.u_lengthToThicknessRatio;i.uniformMatrix3fv(c,!1,o.matrix),i.uniform1f(u,o.zoomRatio),i.uniform1f(b,o.sizeRatio),i.uniform1f(f,o.correctionRatio),i.uniform1f(h,o.pixelRatio),i.uniform1f(d,o.antiAliasingFeather),i.uniform1f(y,o.minEdgeThickness),i.uniform1f(T,e.lengthToThicknessRatio)}}])}(ua)}ts();function Vu(t){return vi([ts(),Un(t),Un(Ut(Ut({},t),{},{extremity:"source"}))])}Vu();function Uu(t){if(Array.isArray(t))return t}function qu(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,a,o,l,i=[],s=!0,c=!1;try{if(o=(r=r.call(t)).next,e!==0)for(;!(s=(n=o.call(r)).done)&&(i.push(n.value),i.length!==e);s=!0);}catch(u){c=!0,a=u}finally{try{if(!s&&r.return!=null&&(l=r.return(),Object(l)!==l))return}finally{if(c)throw a}}return i}}function sn(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function rs(t,e){if(t){if(typeof t=="string")return sn(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?sn(t,e):void 0}}function Wu(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xu(t,e){return Uu(t)||qu(t,e)||rs(t,e)||Wu()}function Yu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ku(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ns(t){var e=Ku(t,"string");return typeof e=="symbol"?e:e+""}function Qu(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ns(n.key),n)}}function Ju(t,e,r){return e&&Qu(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Wt(t){return Wt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Wt(t)}function os(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(os=function(){return!!t})()}function ln(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Zu(t,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ln(t)}function ed(t,e,r){return e=Wt(e),Zu(t,os()?Reflect.construct(e,r||[],Wt(t).constructor):e.apply(t,r))}function cn(t,e){return cn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},cn(t,e)}function td(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&cn(t,e)}function vt(t,e,r){return(e=ns(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function rd(t){if(Array.isArray(t))return sn(t)}function nd(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function od(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hr(t){return rd(t)||nd(t)||rs(t)||od()}function io(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function lo(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?io(Object(r),!0).forEach(function(n){vt(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):io(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var ad="relative",sd={drawLabel:void 0,drawHover:void 0,borders:[{size:{value:.1},color:{attribute:"borderColor"}},{size:{fill:!0},color:{attribute:"color"}}]},id="#000000";function ld(t){var e=t.borders,r=qn(e.filter(function(a){var o=a.size;return"fill"in o}).length),n=`
|
|
precision highp float;
|
|
|
|
varying vec2 v_diffVector;
|
|
varying float v_radius;
|
|
|
|
#ifdef PICKING_MODE
|
|
varying vec4 v_color;
|
|
#else
|
|
// For normal mode, we use the border colors defined in the program:
|
|
`.concat(e.flatMap(function(a,o){var l=a.size;return"attribute"in l?["varying float v_borderSize_".concat(o+1,";")]:[]}).join(`
|
|
`),`
|
|
`).concat(e.flatMap(function(a,o){var l=a.color;return"attribute"in l?["varying vec4 v_borderColor_".concat(o+1,";")]:"value"in l?["uniform vec4 u_borderColor_".concat(o+1,";")]:[]}).join(`
|
|
`),`
|
|
#endif
|
|
|
|
uniform float u_correctionRatio;
|
|
|
|
const float bias = 255.0 / 254.0;
|
|
const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);
|
|
|
|
void main(void) {
|
|
float dist = length(v_diffVector);
|
|
float aaBorder = 2.0 * u_correctionRatio;
|
|
float v_borderSize_0 = v_radius;
|
|
vec4 v_borderColor_0 = transparent;
|
|
|
|
// No antialiasing for picking mode:
|
|
#ifdef PICKING_MODE
|
|
if (dist > v_radius)
|
|
gl_FragColor = transparent;
|
|
else {
|
|
gl_FragColor = v_color;
|
|
gl_FragColor.a *= bias;
|
|
}
|
|
#else
|
|
// Sizes:
|
|
`).concat(e.flatMap(function(a,o){var l=a.size;if("fill"in l)return[];l=l;var i="attribute"in l?"v_borderSize_".concat(o+1):qn(l.value),s=(l.mode||ad)==="pixels"?"u_correctionRatio":"v_radius";return[" float borderSize_".concat(o+1," = ").concat(s," * ").concat(i,";")]}).join(`
|
|
`),`
|
|
// Now, let's split the remaining space between "fill" borders:
|
|
float fillBorderSize = (v_radius - (`).concat(e.flatMap(function(a,o){var l=a.size;return"fill"in l?[]:["borderSize_".concat(o+1)]}).join(" + "),") ) / ").concat(r,`;
|
|
`).concat(e.flatMap(function(a,o){var l=a.size;return"fill"in l?[" float borderSize_".concat(o+1," = fillBorderSize;")]:[]}).join(`
|
|
`),`
|
|
|
|
// Finally, normalize all border sizes, to start from the full size and to end with the smallest:
|
|
float adjustedBorderSize_0 = v_radius;
|
|
`).concat(e.map(function(a,o){return" float adjustedBorderSize_".concat(o+1," = adjustedBorderSize_").concat(o," - borderSize_").concat(o+1,";")}).join(`
|
|
`),`
|
|
|
|
// Colors:
|
|
vec4 borderColor_0 = transparent;
|
|
`).concat(e.map(function(a,o){var l=a.color,i=[];return"attribute"in l?i.push(" vec4 borderColor_".concat(o+1," = v_borderColor_").concat(o+1,";")):"transparent"in l?i.push(" vec4 borderColor_".concat(o+1," = vec4(0.0, 0.0, 0.0, 0.0);")):i.push(" vec4 borderColor_".concat(o+1," = u_borderColor_").concat(o+1,";")),i.push(" borderColor_".concat(o+1,".a *= bias;")),i.push(" if (borderSize_".concat(o+1," <= 1.0 * u_correctionRatio) { borderColor_").concat(o+1," = borderColor_").concat(o,"; }")),i.join(`
|
|
`)}).join(`
|
|
`),`
|
|
if (dist > adjustedBorderSize_0) {
|
|
gl_FragColor = borderColor_0;
|
|
} else `).concat(e.map(function(a,o){return"if (dist > adjustedBorderSize_".concat(o,` - aaBorder) {
|
|
gl_FragColor = mix(borderColor_`).concat(o+1,", borderColor_").concat(o,", (dist - adjustedBorderSize_").concat(o,` + aaBorder) / aaBorder);
|
|
} else if (dist > adjustedBorderSize_`).concat(o+1,`) {
|
|
gl_FragColor = borderColor_`).concat(o+1,`;
|
|
} else `)}).join(""),` { /* Nothing to add here */ }
|
|
#endif
|
|
}
|
|
`);return n}function cd(t){var e=t.borders,r=`
|
|
attribute vec2 a_position;
|
|
attribute float a_size;
|
|
attribute float a_angle;
|
|
|
|
uniform mat3 u_matrix;
|
|
uniform float u_sizeRatio;
|
|
uniform float u_correctionRatio;
|
|
|
|
varying vec2 v_diffVector;
|
|
varying float v_radius;
|
|
|
|
#ifdef PICKING_MODE
|
|
attribute vec4 a_id;
|
|
varying vec4 v_color;
|
|
#else
|
|
`.concat(e.flatMap(function(n,a){var o=n.size;return"attribute"in o?["attribute float a_borderSize_".concat(a+1,";"),"varying float v_borderSize_".concat(a+1,";")]:[]}).join(`
|
|
`),`
|
|
`).concat(e.flatMap(function(n,a){var o=n.color;return"attribute"in o?["attribute vec4 a_borderColor_".concat(a+1,";"),"varying vec4 v_borderColor_".concat(a+1,";")]:[]}).join(`
|
|
`),`
|
|
#endif
|
|
|
|
const float bias = 255.0 / 254.0;
|
|
const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);
|
|
|
|
void main() {
|
|
float size = a_size * u_correctionRatio / u_sizeRatio * 4.0;
|
|
vec2 diffVector = size * vec2(cos(a_angle), sin(a_angle));
|
|
vec2 position = a_position + diffVector;
|
|
gl_Position = vec4(
|
|
(u_matrix * vec3(position, 1)).xy,
|
|
0,
|
|
1
|
|
);
|
|
|
|
v_radius = size / 2.0;
|
|
v_diffVector = diffVector;
|
|
|
|
#ifdef PICKING_MODE
|
|
v_color = a_id;
|
|
#else
|
|
`).concat(e.flatMap(function(n,a){var o=n.size;return"attribute"in o?[" v_borderSize_".concat(a+1," = a_borderSize_").concat(a+1,";")]:[]}).join(`
|
|
`),`
|
|
`).concat(e.flatMap(function(n,a){var o=n.color;return"attribute"in o?[" v_borderColor_".concat(a+1," = a_borderColor_").concat(a+1,";")]:[]}).join(`
|
|
`),`
|
|
#endif
|
|
}
|
|
`);return r}var as=WebGLRenderingContext,co=as.UNSIGNED_BYTE,Nt=as.FLOAT;function ud(t){var e,r=lo(lo({},sd),{}),n=r.borders,a=r.drawLabel,o=r.drawHover,l=["u_sizeRatio","u_correctionRatio","u_matrix"].concat(hr(n.flatMap(function(i,s){var c=i.color;return"value"in c?["u_borderColor_".concat(s+1)]:[]})));return e=function(i){td(s,i);function s(){var c;Yu(this,s);for(var u=arguments.length,d=new Array(u),h=0;h<u;h++)d[h]=arguments[h];return c=ed(this,s,[].concat(d)),vt(ln(c),"drawLabel",a),vt(ln(c),"drawHover",o),c}return Ju(s,[{key:"getDefinition",value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:cd(r),FRAGMENT_SHADER_SOURCE:ld(r),METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:l,ATTRIBUTES:[{name:"a_position",size:2,type:Nt},{name:"a_id",size:4,type:co,normalized:!0},{name:"a_size",size:1,type:Nt}].concat(hr(n.flatMap(function(u,d){var h=u.color;return"attribute"in h?[{name:"a_borderColor_".concat(d+1),size:4,type:co,normalized:!0}]:[]})),hr(n.flatMap(function(u,d){var h=u.size;return"attribute"in h?[{name:"a_borderSize_".concat(d+1),size:1,type:Nt}]:[]}))),CONSTANT_ATTRIBUTES:[{name:"a_angle",size:1,type:Nt}],CONSTANT_DATA:[[s.ANGLE_1],[s.ANGLE_2],[s.ANGLE_3]]}}},{key:"processVisibleItem",value:function(u,d,h){var f=this.array;f[d++]=h.x,f[d++]=h.y,f[d++]=u,f[d++]=h.size,n.forEach(function(b){var y=b.color;"attribute"in y&&(f[d++]=Zt(h[y.attribute]||y.defaultValue||id))}),n.forEach(function(b){var y=b.size;"attribute"in y&&(f[d++]=h[y.attribute]||y.defaultValue)})}},{key:"setUniforms",value:function(u,d){var h=d.gl,f=d.uniformLocations,b=f.u_sizeRatio,y=f.u_correctionRatio,T=f.u_matrix;h.uniform1f(y,u.correctionRatio),h.uniform1f(b,u.sizeRatio),h.uniformMatrix3fv(T,!1,u.matrix),n.forEach(function(N,_){var A=N.color;if("value"in A){var R=f["u_borderColor_".concat(_+1)],I=yi(A.value),D=Xu(I,4),m=D[0],E=D[1],x=D[2],k=D[3];h.uniform4f(R,m/255,E/255,x/255,k/255)}})}}]),s}(ia),vt(e,"ANGLE_1",0),vt(e,"ANGLE_2",2*Math.PI/3),vt(e,"ANGLE_3",4*Math.PI/3),e}var dd=ud();function fd(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ss(t){var e=fd(t,"string");return typeof e=="symbol"?e:e+""}function is(t,e,r){return(e=ss(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function uo(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Xt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?uo(Object(r),!0).forEach(function(n){is(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):uo(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function hd(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function gd(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ss(n.key),n)}}function pd(t,e,r){return e&&gd(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Yt(t){return Yt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Yt(t)}function ls(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ls=function(){return!!t})()}function cs(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function md(t,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cs(t)}function vd(t,e,r){return e=Yt(e),md(t,ls()?Reflect.construct(e,r||[],Yt(t).constructor):e.apply(t,r))}function un(t,e){return un=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},un(t,e)}function yd(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&un(t,e)}function dn(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function bd(t){if(Array.isArray(t))return dn(t)}function wd(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function xd(t,e){if(t){if(typeof t=="string")return dn(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?dn(t,e):void 0}}function Sd(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gr(t){return bd(t)||wd(t)||xd(t)||Sd()}function us(t,e,r,n){var a=Math.pow(1-t,2)*e.x+2*(1-t)*t*r.x+Math.pow(t,2)*n.x,o=Math.pow(1-t,2)*e.y+2*(1-t)*t*r.y+Math.pow(t,2)*n.y;return{x:a,y:o}}function Ed(t,e,r){for(var n=20,a=0,o=t,l=0;l<n;l++){var i=us((l+1)/n,t,e,r);a+=Math.sqrt(Math.pow(o.x-i.x,2)+Math.pow(o.y-i.y,2)),o=i}return a}function _d(t){var e=t.curvatureAttribute,r=t.defaultCurvature,n=t.keepLabelUpright,a=n===void 0?!0:n;return function(o,l,i,s,c){var u=c.edgeLabelSize,d=l[e]||r,h=c.edgeLabelFont,f=c.edgeLabelWeight,b=c.edgeLabelColor.attribute?l[c.edgeLabelColor.attribute]||c.edgeLabelColor.color||"#000":c.edgeLabelColor.color,y=l.label;if(y){o.fillStyle=b,o.font="".concat(f," ").concat(u,"px ").concat(h);var T=!a||i.x<s.x,N=T?i.x:s.x,_=T?i.y:s.y,A=T?s.x:i.x,R=T?s.y:i.y,I=(N+A)/2,D=(_+R)/2,m=A-N,E=R-_,x=Math.sqrt(Math.pow(m,2)+Math.pow(E,2)),k=T?1:-1,L=I+E*d*k,j=D-m*d*k,w=l.size*.7+5,V={x:j-_,y:-(L-N)},K=Math.sqrt(Math.pow(V.x,2)+Math.pow(V.y,2)),O={x:R-j,y:-(A-L)},C=Math.sqrt(Math.pow(O.x,2)+Math.pow(O.y,2));N+=w*V.x/K,_+=w*V.y/K,A+=w*O.x/C,R+=w*O.y/C,L+=w*E/x,j-=w*m/x;var S={x:L,y:j},H={x:N,y:_},ae={x:A,y:R},$=Ed(H,S,ae);if(!($<i.size+s.size)){var v=o.measureText(y).width,z=$-i.size-s.size;if(v>z){var B="…";for(y=y+B,v=o.measureText(y).width;v>z&&y.length>1;)y=y.slice(0,-2)+B,v=o.measureText(y).width;if(y.length<4)return}for(var M={},J=0,X=y.length;J<X;J++){var Y=y[J];M[Y]||(M[Y]=o.measureText(Y).width*(1+d*.35))}for(var ie=.5-v/$/2,ne=0,se=y.length;ne<se;ne++){var F=y[ne],Q=us(ie,H,S,ae),q=2*(1-ie)*(L-N)+2*ie*(A-L),U=2*(1-ie)*(j-_)+2*ie*(R-j),P=Math.atan2(U,q);o.save(),o.translate(Q.x,Q.y),o.rotate(P),o.fillText(F,0,0),o.restore(),ie+=M[F]/$}}}}}function Cd(t){var e=t.arrowHead,r=(e==null?void 0:e.extremity)==="target"||(e==null?void 0:e.extremity)==="both",n=(e==null?void 0:e.extremity)==="source"||(e==null?void 0:e.extremity)==="both",a=`
|
|
precision highp float;
|
|
|
|
varying vec4 v_color;
|
|
varying float v_thickness;
|
|
varying float v_feather;
|
|
varying vec2 v_cpA;
|
|
varying vec2 v_cpB;
|
|
varying vec2 v_cpC;
|
|
`.concat(r?`
|
|
varying float v_targetSize;
|
|
varying vec2 v_targetPoint;`:"",`
|
|
`).concat(n?`
|
|
varying float v_sourceSize;
|
|
varying vec2 v_sourcePoint;`:"",`
|
|
`).concat(e?`
|
|
uniform float u_lengthToThicknessRatio;
|
|
uniform float u_widenessToThicknessRatio;`:"",`
|
|
|
|
float det(vec2 a, vec2 b) {
|
|
return a.x * b.y - b.x * a.y;
|
|
}
|
|
|
|
vec2 getDistanceVector(vec2 b0, vec2 b1, vec2 b2) {
|
|
float a = det(b0, b2), b = 2.0 * det(b1, b0), d = 2.0 * det(b2, b1);
|
|
float f = b * d - a * a;
|
|
vec2 d21 = b2 - b1, d10 = b1 - b0, d20 = b2 - b0;
|
|
vec2 gf = 2.0 * (b * d21 + d * d10 + a * d20);
|
|
gf = vec2(gf.y, -gf.x);
|
|
vec2 pp = -f * gf / dot(gf, gf);
|
|
vec2 d0p = b0 - pp;
|
|
float ap = det(d0p, d20), bp = 2.0 * det(d10, d0p);
|
|
float t = clamp((ap + bp) / (2.0 * a + b + d), 0.0, 1.0);
|
|
return mix(mix(b0, b1, t), mix(b1, b2, t), t);
|
|
}
|
|
|
|
float distToQuadraticBezierCurve(vec2 p, vec2 b0, vec2 b1, vec2 b2) {
|
|
return length(getDistanceVector(b0 - p, b1 - p, b2 - p));
|
|
}
|
|
|
|
const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);
|
|
|
|
void main(void) {
|
|
float dist = distToQuadraticBezierCurve(gl_FragCoord.xy, v_cpA, v_cpB, v_cpC);
|
|
float thickness = v_thickness;
|
|
`).concat(r?`
|
|
float distToTarget = length(gl_FragCoord.xy - v_targetPoint);
|
|
float targetArrowLength = v_targetSize + thickness * u_lengthToThicknessRatio;
|
|
if (distToTarget < targetArrowLength) {
|
|
thickness = (distToTarget - v_targetSize) / (targetArrowLength - v_targetSize) * u_widenessToThicknessRatio * thickness;
|
|
}`:"",`
|
|
`).concat(n?`
|
|
float distToSource = length(gl_FragCoord.xy - v_sourcePoint);
|
|
float sourceArrowLength = v_sourceSize + thickness * u_lengthToThicknessRatio;
|
|
if (distToSource < sourceArrowLength) {
|
|
thickness = (distToSource - v_sourceSize) / (sourceArrowLength - v_sourceSize) * u_widenessToThicknessRatio * thickness;
|
|
}`:"",`
|
|
|
|
float halfThickness = thickness / 2.0;
|
|
if (dist < halfThickness) {
|
|
#ifdef PICKING_MODE
|
|
gl_FragColor = v_color;
|
|
#else
|
|
float t = smoothstep(
|
|
halfThickness - v_feather,
|
|
halfThickness,
|
|
dist
|
|
);
|
|
|
|
gl_FragColor = mix(v_color, transparent, t);
|
|
#endif
|
|
} else {
|
|
gl_FragColor = transparent;
|
|
}
|
|
}
|
|
`);return a}function kd(t){var e=t.arrowHead,r=(e==null?void 0:e.extremity)==="target"||(e==null?void 0:e.extremity)==="both",n=(e==null?void 0:e.extremity)==="source"||(e==null?void 0:e.extremity)==="both",a=`
|
|
attribute vec4 a_id;
|
|
attribute vec4 a_color;
|
|
attribute float a_direction;
|
|
attribute float a_thickness;
|
|
attribute vec2 a_source;
|
|
attribute vec2 a_target;
|
|
attribute float a_current;
|
|
attribute float a_curvature;
|
|
`.concat(r?`attribute float a_targetSize;
|
|
`:"",`
|
|
`).concat(n?`attribute float a_sourceSize;
|
|
`:"",`
|
|
|
|
uniform mat3 u_matrix;
|
|
uniform float u_sizeRatio;
|
|
uniform float u_pixelRatio;
|
|
uniform vec2 u_dimensions;
|
|
uniform float u_minEdgeThickness;
|
|
uniform float u_feather;
|
|
|
|
varying vec4 v_color;
|
|
varying float v_thickness;
|
|
varying float v_feather;
|
|
varying vec2 v_cpA;
|
|
varying vec2 v_cpB;
|
|
varying vec2 v_cpC;
|
|
`).concat(r?`
|
|
varying float v_targetSize;
|
|
varying vec2 v_targetPoint;`:"",`
|
|
`).concat(n?`
|
|
varying float v_sourceSize;
|
|
varying vec2 v_sourcePoint;`:"",`
|
|
`).concat(e?`
|
|
uniform float u_widenessToThicknessRatio;`:"",`
|
|
|
|
const float bias = 255.0 / 254.0;
|
|
const float epsilon = 0.7;
|
|
|
|
vec2 clipspaceToViewport(vec2 pos, vec2 dimensions) {
|
|
return vec2(
|
|
(pos.x + 1.0) * dimensions.x / 2.0,
|
|
(pos.y + 1.0) * dimensions.y / 2.0
|
|
);
|
|
}
|
|
|
|
vec2 viewportToClipspace(vec2 pos, vec2 dimensions) {
|
|
return vec2(
|
|
pos.x / dimensions.x * 2.0 - 1.0,
|
|
pos.y / dimensions.y * 2.0 - 1.0
|
|
);
|
|
}
|
|
|
|
void main() {
|
|
float minThickness = u_minEdgeThickness;
|
|
|
|
// Selecting the correct position
|
|
// Branchless "position = a_source if a_current == 1.0 else a_target"
|
|
vec2 position = a_source * max(0.0, a_current) + a_target * max(0.0, 1.0 - a_current);
|
|
position = (u_matrix * vec3(position, 1)).xy;
|
|
|
|
vec2 source = (u_matrix * vec3(a_source, 1)).xy;
|
|
vec2 target = (u_matrix * vec3(a_target, 1)).xy;
|
|
|
|
vec2 viewportPosition = clipspaceToViewport(position, u_dimensions);
|
|
vec2 viewportSource = clipspaceToViewport(source, u_dimensions);
|
|
vec2 viewportTarget = clipspaceToViewport(target, u_dimensions);
|
|
|
|
vec2 delta = viewportTarget.xy - viewportSource.xy;
|
|
float len = length(delta);
|
|
vec2 normal = vec2(-delta.y, delta.x) * a_direction;
|
|
vec2 unitNormal = normal / len;
|
|
float boundingBoxThickness = len * a_curvature;
|
|
|
|
float curveThickness = max(minThickness, a_thickness / u_sizeRatio);
|
|
v_thickness = curveThickness * u_pixelRatio;
|
|
v_feather = u_feather;
|
|
|
|
v_cpA = viewportSource;
|
|
v_cpB = 0.5 * (viewportSource + viewportTarget) + unitNormal * a_direction * boundingBoxThickness;
|
|
v_cpC = viewportTarget;
|
|
|
|
vec2 viewportOffsetPosition = (
|
|
viewportPosition +
|
|
unitNormal * (boundingBoxThickness / 2.0 + sign(boundingBoxThickness) * (`).concat(e?"curveThickness * u_widenessToThicknessRatio":"curveThickness",` + epsilon)) *
|
|
max(0.0, a_direction) // NOTE: cutting the bounding box in half to avoid overdraw
|
|
);
|
|
|
|
position = viewportToClipspace(viewportOffsetPosition, u_dimensions);
|
|
gl_Position = vec4(position, 0, 1);
|
|
|
|
`).concat(r?`
|
|
v_targetSize = a_targetSize * u_pixelRatio / u_sizeRatio;
|
|
v_targetPoint = viewportTarget;
|
|
`:"",`
|
|
`).concat(n?`
|
|
v_sourceSize = a_sourceSize * u_pixelRatio / u_sizeRatio;
|
|
v_sourcePoint = viewportSource;
|
|
`:"",`
|
|
|
|
#ifdef PICKING_MODE
|
|
// For picking mode, we use the ID as the color:
|
|
v_color = a_id;
|
|
#else
|
|
// For normal mode, we use the color:
|
|
v_color = a_color;
|
|
#endif
|
|
|
|
v_color.a *= bias;
|
|
}
|
|
`);return a}var ds=.25,Td={arrowHead:null,curvatureAttribute:"curvature",defaultCurvature:ds},fs=WebGLRenderingContext,fo=fs.UNSIGNED_BYTE,et=fs.FLOAT;function An(t){var e=Xt(Xt({},Td),t||{}),r=e,n=r.arrowHead,a=r.curvatureAttribute,o=r.drawLabel,l=(n==null?void 0:n.extremity)==="target"||(n==null?void 0:n.extremity)==="both",i=(n==null?void 0:n.extremity)==="source"||(n==null?void 0:n.extremity)==="both",s=["u_matrix","u_sizeRatio","u_dimensions","u_pixelRatio","u_feather","u_minEdgeThickness"].concat(gr(n?["u_lengthToThicknessRatio","u_widenessToThicknessRatio"]:[]));return function(c){yd(u,c);function u(){var d;hd(this,u);for(var h=arguments.length,f=new Array(h),b=0;b<h;b++)f[b]=arguments[b];return d=vd(this,u,[].concat(f)),is(cs(d),"drawLabel",o||_d(e)),d}return pd(u,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:kd(e),FRAGMENT_SHADER_SOURCE:Cd(e),METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:s,ATTRIBUTES:[{name:"a_source",size:2,type:et},{name:"a_target",size:2,type:et}].concat(gr(l?[{name:"a_targetSize",size:1,type:et}]:[]),gr(i?[{name:"a_sourceSize",size:1,type:et}]:[]),[{name:"a_thickness",size:1,type:et},{name:"a_curvature",size:1,type:et},{name:"a_color",size:4,type:fo,normalized:!0},{name:"a_id",size:4,type:fo,normalized:!0}]),CONSTANT_ATTRIBUTES:[{name:"a_current",size:1,type:et},{name:"a_direction",size:1,type:et}],CONSTANT_DATA:[[0,1],[0,-1],[1,1],[0,-1],[1,1],[1,-1]]}}},{key:"processVisibleItem",value:function(h,f,b,y,T){var N,_=T.size||1,A=b.x,R=b.y,I=y.x,D=y.y,m=Zt(T.color),E=(N=T[a])!==null&&N!==void 0?N:ds,x=this.array;x[f++]=A,x[f++]=R,x[f++]=I,x[f++]=D,l&&(x[f++]=y.size),i&&(x[f++]=b.size),x[f++]=_,x[f++]=E,x[f++]=m,x[f++]=h}},{key:"setUniforms",value:function(h,f){var b=f.gl,y=f.uniformLocations,T=y.u_matrix,N=y.u_pixelRatio,_=y.u_feather,A=y.u_sizeRatio,R=y.u_dimensions,I=y.u_minEdgeThickness;if(b.uniformMatrix3fv(T,!1,h.matrix),b.uniform1f(N,h.pixelRatio),b.uniform1f(A,h.sizeRatio),b.uniform1f(_,h.antiAliasingFeather),b.uniform2f(R,h.width*h.pixelRatio,h.height*h.pixelRatio),b.uniform1f(I,h.minEdgeThickness),n){var D=y.u_lengthToThicknessRatio,m=y.u_widenessToThicknessRatio;b.uniform1f(D,n.lengthToThicknessRatio),b.uniform1f(m,n.widenessToThicknessRatio)}}}]),u}(ua)}var Rd=An(),Ad=An({arrowHead:bn});An({arrowHead:Xt(Xt({},bn),{},{extremity:"both"})});const jd=({node:t,move:e})=>{const r=Be(),{gotoNode:n}=da();return p.useEffect(()=>{const a=r.getGraph();if(e){if(t&&a.hasNode(t))try{a.setNodeAttribute(t,"highlighted",!0),n(t)}catch(o){console.error("Error focusing on node:",o)}else r.setCustomBBox(null),r.getCamera().animate({x:.5,y:.5,ratio:1},{duration:0});ee.getState().setMoveToSelectedNode(!1)}else if(t&&a.hasNode(t))try{a.setNodeAttribute(t,"highlighted",!0)}catch(o){console.error("Error highlighting node:",o)}return()=>{if(t&&a.hasNode(t))try{a.setNodeAttribute(t,"highlighted",!1)}catch(o){console.error("Error cleaning up node highlight:",o)}}},[t,e,r,n]),null};function Et(t,e){const r=Be(),n=p.useRef(e);return fa(n.current,e)||(n.current=e),{positions:p.useCallback(()=>n.current?t(r.getGraph(),n.current):{},[r,n,t]),assign:p.useCallback(()=>{n.current&&t.assign(r.getGraph(),n.current)},[r,n,t])}}function jn(t,e){const r=Be(),[n,a]=p.useState(!1),[o,l]=p.useState(null),i=p.useRef(e);return fa(i.current,e)||(i.current=e),p.useEffect(()=>{a(!1);let s=null;return i.current&&(s=new t(r.getGraph(),i.current)),l(s),()=>{s!==null&&s.kill()}},[r,i,l,a,t]),{stop:p.useCallback(()=>{o&&(o.stop(),a(!1))},[o,a]),start:p.useCallback(()=>{o&&(o.start(),a(!0))},[o,a]),kill:p.useCallback(()=>{o&&o.kill(),a(!1)},[o,a]),isRunning:n}}var pr,ho;function At(){if(ho)return pr;ho=1;function t(r){return!r||typeof r!="object"||typeof r=="function"||Array.isArray(r)||r instanceof Set||r instanceof Map||r instanceof RegExp||r instanceof Date}function e(r,n){r=r||{};var a={};for(var o in n){var l=r[o],i=n[o];if(!t(i)){a[o]=e(l,i);continue}l===void 0?a[o]=i:a[o]=l}return a}return pr=e,pr}var mr,go;function Id(){if(go)return mr;go=1;function t(r){return function(n,a){return n+Math.floor(r()*(a-n+1))}}var e=t(Math.random);return e.createRandom=t,mr=e,mr}var vr,po;function Ld(){if(po)return vr;po=1;var t=Id().createRandom;function e(n){var a=t(n);return function(o){for(var l=o.length,i=l-1,s=-1;++s<l;){var c=a(s,i),u=o[c];o[c]=o[s],o[s]=u}}}var r=e(Math.random);return r.createShuffleInPlace=e,vr=r,vr}var yr,mo;function Nd(){if(mo)return yr;mo=1;var t=At(),e=We(),r=Ld(),n={attributes:{x:"x",y:"y"},center:0,hierarchyAttributes:[],rng:Math.random,scale:1};function a(m,E,x,k,L){this.wrappedCircle=L||null,this.children={},this.countChildren=0,this.id=m||null,this.next=null,this.previous=null,this.x=E||null,this.y=x||null,L?this.r=1010101:this.r=k||999}a.prototype.hasChildren=function(){return this.countChildren>0},a.prototype.addChild=function(m,E){this.children[m]=E,++this.countChildren},a.prototype.getChild=function(m){if(!this.children.hasOwnProperty(m)){var E=new a;this.children[m]=E,++this.countChildren}return this.children[m]},a.prototype.applyPositionToChildren=function(){if(this.hasChildren()){var m=this;for(var E in m.children){var x=m.children[E];x.x+=m.x,x.y+=m.y,x.applyPositionToChildren()}}};function o(m,E,x){for(var k in E.children){var L=E.children[k];L.hasChildren()?o(m,L,x):x[L.id]={x:L.x,y:L.y}}}function l(m,E){var x=m.r-E.r,k=E.x-m.x,L=E.y-m.y;return x<0||x*x<k*k+L*L}function i(m,E){var x=m.r-E.r+1e-6,k=E.x-m.x,L=E.y-m.y;return x>0&&x*x>k*k+L*L}function s(m,E){for(var x=0;x<E.length;++x)if(!i(m,E[x]))return!1;return!0}function c(m){return new a(null,m.x,m.y,m.r)}function u(m,E){var x=m.x,k=m.y,L=m.r,j=E.x,w=E.y,V=E.r,K=j-x,O=w-k,C=V-L,S=Math.sqrt(K*K+O*O);return new a(null,(x+j+K/S*C)/2,(k+w+O/S*C)/2,(S+L+V)/2)}function d(m,E,x){var k=m.x,L=m.y,j=m.r,w=E.x,V=E.y,K=E.r,O=x.x,C=x.y,S=x.r,H=k-w,ae=k-O,$=L-V,v=L-C,z=K-j,B=S-j,M=k*k+L*L-j*j,J=M-w*w-V*V+K*K,X=M-O*O-C*C+S*S,Y=ae*$-H*v,ie=($*X-v*J)/(Y*2)-k,ne=(v*z-$*B)/Y,se=(ae*J-H*X)/(Y*2)-L,F=(H*B-ae*z)/Y,Q=ne*ne+F*F-1,q=2*(j+ie*ne+se*F),U=ie*ie+se*se-j*j,P=-(Q?(q+Math.sqrt(q*q-4*Q*U))/(2*Q):U/q);return new a(null,k+ie+ne*P,L+se+F*P,P)}function h(m){switch(m.length){case 1:return c(m[0]);case 2:return u(m[0],m[1]);case 3:return d(m[0],m[1],m[2]);default:throw new Error("graphology-layout/circlepack: Invalid basis length "+m.length)}}function f(m,E){var x,k;if(s(E,m))return[E];for(x=0;x<m.length;++x)if(l(E,m[x])&&s(u(m[x],E),m))return[m[x],E];for(x=0;x<m.length-1;++x)for(k=x+1;k<m.length;++k)if(l(u(m[x],m[k]),E)&&l(u(m[x],E),m[k])&&l(u(m[k],E),m[x])&&s(d(m[x],m[k],E),m))return[m[x],m[k],E];throw new Error("graphology-layout/circlepack: extendBasis failure !")}function b(m){var E=m.wrappedCircle,x=m.next.wrappedCircle,k=E.r+x.r,L=(E.x*x.r+x.x*E.r)/k,j=(E.y*x.r+x.y*E.r)/k;return L*L+j*j}function y(m,E){var x=0,k=m.slice(),L=m.length,j=[],w,V;for(E(k);x<L;)w=k[x],V&&i(V,w)?++x:(j=f(j,w),V=h(j),x=0);return V}function T(m,E,x){var k=m.x-E.x,L,j,w=m.y-E.y,V,K,O=k*k+w*w;O?(j=E.r+x.r,j*=j,K=m.r+x.r,K*=K,j>K?(L=(O+K-j)/(2*O),V=Math.sqrt(Math.max(0,K/O-L*L)),x.x=m.x-L*k-V*w,x.y=m.y-L*w+V*k):(L=(O+j-K)/(2*O),V=Math.sqrt(Math.max(0,j/O-L*L)),x.x=E.x+L*k-V*w,x.y=E.y+L*w+V*k)):(x.x=E.x+x.r,x.y=E.y)}function N(m,E){var x=m.r+E.r-1e-6,k=E.x-m.x,L=E.y-m.y;return x>0&&x*x>k*k+L*L}function _(m,E){var x=m.length;if(x===0)return 0;var k,L,j,w,V,K,O,C,S,H;if(k=m[0],k.x=0,k.y=0,x<=1)return k.r;if(L=m[1],k.x=-L.r,L.x=k.r,L.y=0,x<=2)return k.r+L.r;j=m[2],T(L,k,j),k=new a(null,null,null,null,k),L=new a(null,null,null,null,L),j=new a(null,null,null,null,j),k.next=j.previous=L,L.next=k.previous=j,j.next=L.previous=k;e:for(K=3;K<x;++K){j=m[K],T(k.wrappedCircle,L.wrappedCircle,j),j=new a(null,null,null,null,j),O=L.next,C=k.previous,S=L.wrappedCircle.r,H=k.wrappedCircle.r;do if(S<=H){if(N(O.wrappedCircle,j.wrappedCircle)){L=O,k.next=L,L.previous=k,--K;continue e}S+=O.wrappedCircle.r,O=O.next}else{if(N(C.wrappedCircle,j.wrappedCircle)){k=C,k.next=L,L.previous=k,--K;continue e}H+=C.wrappedCircle.r,C=C.previous}while(O!==C.next);for(j.previous=k,j.next=L,k.next=L.previous=L=j,w=b(k);(j=j.next)!==L;)(V=b(j))<w&&(k=j,w=V);L=k.next}k=[L.wrappedCircle],j=L;for(var ae=1e4;(j=j.next)!==L&&--ae!==0;)k.push(j.wrappedCircle);for(j=y(k,E),K=0;K<x;++K)k=m[K],k.x-=j.x,k.y-=j.y;return j.r}function A(m,E){var x=0;if(m.hasChildren()){for(var k in m.children){var L=m.children[k];L.hasChildren()&&(L.r=A(L,E))}x=_(Object.values(m.children),E)}return x}function R(m,E){A(m,E);for(var x in m.children){var k=m.children[x];k.applyPositionToChildren()}}function I(m,E,x){if(!e(E))throw new Error("graphology-layout/circlepack: the given graph is not a valid graphology instance.");x=t(x,n);var k={},L={},j=E.nodes(),w=x.center,V=x.hierarchyAttributes,K=r.createShuffleInPlace(x.rng),O=x.scale,C=new a;E.forEachNode(function(z,B){var M=B.size?B.size:1,J=new a(z,null,null,M),X=C;V.forEach(function(Y){var ie=B[Y];X=X.getChild(ie)}),X.addChild(z,J)}),R(C,K),o(E,C,k);var S=j.length,H,ae,$;for($=0;$<S;$++){var v=j[$];H=w+O*k[v].x,ae=w+O*k[v].y,L[v]={x:H,y:ae},m&&(E.setNodeAttribute(v,x.attributes.x,H),E.setNodeAttribute(v,x.attributes.y,ae))}return L}var D=I.bind(null,!1);return D.assign=I.bind(null,!0),yr=D,yr}var Pd=Nd();const zd=He(Pd);function Dd(t={}){return Et(zd,t)}var br,vo;function Od(){if(vo)return br;vo=1;var t=At(),e=We(),r={dimensions:["x","y"],center:.5,scale:1};function n(o,l,i){if(!e(l))throw new Error("graphology-layout/random: the given graph is not a valid graphology instance.");i=t(i,r);var s=i.dimensions;if(!Array.isArray(s)||s.length!==2)throw new Error("graphology-layout/random: given dimensions are invalid.");var c=i.center,u=i.scale,d=Math.PI*2,h=(c-.5)*u,f=l.order,b=s[0],y=s[1];function T(A,R){return R[b]=u*Math.cos(A*d/f)+h,R[y]=u*Math.sin(A*d/f)+h,R}var N=0;if(!o){var _={};return l.forEachNode(function(A){_[A]=T(N++,{})}),_}l.updateEachNodeAttributes(function(A,R){return T(N++,R),R},{attributes:s})}var a=n.bind(null,!1);return a.assign=n.bind(null,!0),br=a,br}var Gd=Od();const Fd=He(Gd);function $d(t={}){return Et(Fd,t)}var kt={},yo;function In(){if(yo)return kt;yo=1;function t(n){return typeof n!="number"||isNaN(n)?1:n}function e(n,a){var o={},l=function(c){return typeof c>"u"?a:c};typeof a=="function"&&(l=a);var i=function(c){return l(c[n])},s=function(){return l(void 0)};return typeof n=="string"?(o.fromAttributes=i,o.fromGraph=function(c,u){return i(c.getNodeAttributes(u))},o.fromEntry=function(c,u){return i(u)}):typeof n=="function"?(o.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},o.fromGraph=function(c,u){return l(n(u,c.getNodeAttributes(u)))},o.fromEntry=function(c,u){return l(n(c,u))}):(o.fromAttributes=s,o.fromGraph=s,o.fromEntry=s),o}function r(n,a){var o={},l=function(c){return typeof c>"u"?a:c};typeof a=="function"&&(l=a);var i=function(c){return l(c[n])},s=function(){return l(void 0)};return typeof n=="string"?(o.fromAttributes=i,o.fromGraph=function(c,u){return i(c.getEdgeAttributes(u))},o.fromEntry=function(c,u){return i(u)},o.fromPartialEntry=o.fromEntry,o.fromMinimalEntry=o.fromEntry):typeof n=="function"?(o.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},o.fromGraph=function(c,u){var d=c.extremities(u);return l(n(u,c.getEdgeAttributes(u),d[0],d[1],c.getNodeAttributes(d[0]),c.getNodeAttributes(d[1]),c.isUndirected(u)))},o.fromEntry=function(c,u,d,h,f,b,y){return l(n(c,u,d,h,f,b,y))},o.fromPartialEntry=function(c,u,d,h){return l(n(c,u,d,h))},o.fromMinimalEntry=function(c,u){return l(n(c,u))}):(o.fromAttributes=s,o.fromGraph=s,o.fromEntry=s,o.fromMinimalEntry=s),o}return kt.createNodeValueGetter=e,kt.createEdgeValueGetter=r,kt.createEdgeWeightGetter=function(n){return r(n,t)},kt}var wr,bo;function hs(){if(bo)return wr;bo=1;const{createNodeValueGetter:t,createEdgeValueGetter:e}=In();return wr=function(n,a,o){const{nodeXAttribute:l,nodeYAttribute:i}=o,{attraction:s,repulsion:c,gravity:u,inertia:d,maxMove:h}=o.settings;let{shouldSkipNode:f,shouldSkipEdge:b,isNodeFixed:y}=o;y=t(y),f=t(f,!1),b=e(b,!1);const T=n.filterNodes((A,R)=>!f.fromEntry(A,R)),N=T.length;for(let A=0;A<N;A++){const R=T[A],I=n.getNodeAttributes(R),D=a[R];D?a[R]={dx:D.dx*d,dy:D.dy*d,x:I[l]||0,y:I[i]||0}:a[R]={dx:0,dy:0,x:I[l]||0,y:I[i]||0}}if(c)for(let A=0;A<N;A++){const R=T[A],I=a[R];for(let D=A+1;D<N;D++){const m=T[D],E=a[m],x=E.x-I.x,k=E.y-I.y,L=Math.sqrt(x*x+k*k)||1,j=c/L*x,w=c/L*k;I.dx-=j,I.dy-=w,E.dx+=j,E.dy+=w}}if(s&&n.forEachEdge((A,R,I,D,m,E,x)=>{if(I===D||f.fromEntry(I,m)||f.fromEntry(D,E)||b.fromEntry(A,R,I,D,m,E,x))return;const k=a[I],L=a[D],j=L.x-k.x,w=L.y-k.y,V=Math.sqrt(j*j+w*w)||1,K=s*V*j,O=s*V*w;k.dx+=K,k.dy+=O,L.dx-=K,L.dy-=O}),u)for(let A=0;A<N;A++){const R=T[A],I=a[R],{x:D,y:m}=I,E=Math.sqrt(D*D+m*m)||1;a[R].dx-=D*u*E,a[R].dy-=m*u*E}const _=!1;for(let A=0;A<N;A++){const R=T[A],I=a[R],D=Math.sqrt(I.dx*I.dx+I.dy*I.dy);D>h&&(I.dx*=h/D,I.dy*=h/D),y.fromGraph(n,R)?I.fixed=!0:(I.x+=I.dx,I.y+=I.dy,I.fixed=!1)}return{converged:_}},wr}var Pt={},wo;function gs(){return wo||(wo=1,Pt.assignLayoutChanges=function(t,e,r){const{nodeXAttribute:n,nodeYAttribute:a}=r;t.updateEachNodeAttributes((o,l)=>{const i=e[o];return!i||i.fixed||(l[n]=i.x,l[a]=i.y),l},{attributes:["x","y"]})},Pt.collectLayoutChanges=function(t){const e={};for(const r in t){const n=t[r];e[r]={x:n.x,y:n.y}}return e}),Pt}var xr,xo;function ps(){return xo||(xo=1,xr={nodeXAttribute:"x",nodeYAttribute:"y",isNodeFixed:"fixed",shouldSkipNode:null,shouldSkipEdge:null,settings:{attraction:5e-4,repulsion:.1,gravity:1e-4,inertia:.6,maxMove:200}}),xr}var Sr,So;function Md(){if(So)return Sr;So=1;const t=We(),e=At(),r=hs(),n=gs(),a=ps();function o(i,s,c){if(!t(s))throw new Error("graphology-layout-force: the given graph is not a valid graphology instance.");typeof c=="number"?c={maxIterations:c}:c=c||{};const u=c.maxIterations;if(c=e(c,a),typeof u!="number"||u<=0)throw new Error("graphology-layout-force: you should provide a positive number of maximum iterations.");const d={};let h=null,f;for(f=0;f<u&&(h=r(s,d,c),!h.converged);f++);if(i){n.assignLayoutChanges(s,d,c);return}return n.collectLayoutChanges(d)}const l=o.bind(null,!1);return l.assign=o.bind(null,!0),Sr=l,Sr}var Hd=Md();const Bd=He(Hd);var Er,Eo;function Vd(){if(Eo)return Er;Eo=1;const t=We(),e=At(),r=hs(),n=gs(),a=ps();function o(l,i){if(!t(l))throw new Error("graphology-layout-force/worker: the given graph is not a valid graphology instance.");i=e(i,a),this.callbacks={},i.onConverged&&(this.callbacks.onConverged=i.onConverged),this.graph=l,this.params=i,this.nodeStates={},this.frameID=null,this.running=!1,this.killed=!1}return o.prototype.isRunning=function(){return this.running},o.prototype.runFrame=function(){let{converged:l}=r(this.graph,this.nodeStates,this.params);n.assignLayoutChanges(this.graph,this.nodeStates,this.params),l=!1,l?(this.callbacks.onConverged&&this.callbacks.onConverged(),this.stop()):this.frameID=window.requestAnimationFrame(()=>this.runFrame())},o.prototype.stop=function(){return this.running=!1,this.frameID!==null&&(window.cancelAnimationFrame(this.frameID),this.frameID=null),this},o.prototype.start=function(){if(this.killed)throw new Error("graphology-layout-force/worker.start: layout was killed.");this.running||(this.running=!0,this.runFrame())},o.prototype.kill=function(){this.stop(),delete this.nodeStates,this.killed=!0},Er=o,Er}var Ud=Vd();const qd=He(Ud);function Wd(t={maxIterations:100}){return Et(Bd,t)}function Xd(t={}){return jn(qd,t)}var _r,_o;function Yd(){if(_o)return _r;_o=1;var t=0,e=1,r=2,n=3,a=4,o=5,l=6,i=7,s=8,c=9,u=0,d=1,h=2,f=0,b=1,y=2,T=3,N=4,_=5,A=6,R=7,I=8,D=3,m=10,E=3,x=9,k=10;return _r=function(j,w,V){var K,O,C,S,H,ae,$,v,z,B,M=w.length,J=V.length,X=j.adjustSizes,Y=j.barnesHutTheta*j.barnesHutTheta,ie,ne,se,F,Q,q,U,P=[];for(C=0;C<M;C+=m)w[C+a]=w[C+r],w[C+o]=w[C+n],w[C+r]=0,w[C+n]=0;if(j.outboundAttractionDistribution){for(ie=0,C=0;C<M;C+=m)ie+=w[C+l];ie/=M/m}if(j.barnesHutOptimize){var oe=1/0,ue=-1/0,te=1/0,Z=-1/0,G,ge,pe;for(C=0;C<M;C+=m)oe=Math.min(oe,w[C+t]),ue=Math.max(ue,w[C+t]),te=Math.min(te,w[C+e]),Z=Math.max(Z,w[C+e]);var ye=ue-oe,we=Z-te;for(ye>we?(te-=(ye-we)/2,Z=te+ye):(oe-=(we-ye)/2,ue=oe+we),P[0+f]=-1,P[0+b]=(oe+ue)/2,P[0+y]=(te+Z)/2,P[0+T]=Math.max(ue-oe,Z-te),P[0+N]=-1,P[0+_]=-1,P[0+A]=0,P[0+R]=0,P[0+I]=0,K=1,C=0;C<M;C+=m)for(O=0,pe=D;;)if(P[O+_]>=0){w[C+t]<P[O+b]?w[C+e]<P[O+y]?G=P[O+_]:G=P[O+_]+x:w[C+e]<P[O+y]?G=P[O+_]+x*2:G=P[O+_]+x*3,P[O+R]=(P[O+R]*P[O+A]+w[C+t]*w[C+l])/(P[O+A]+w[C+l]),P[O+I]=(P[O+I]*P[O+A]+w[C+e]*w[C+l])/(P[O+A]+w[C+l]),P[O+A]+=w[C+l],O=G;continue}else if(P[O+f]<0){P[O+f]=C;break}else{if(P[O+_]=K*x,v=P[O+T]/2,z=P[O+_],P[z+f]=-1,P[z+b]=P[O+b]-v,P[z+y]=P[O+y]-v,P[z+T]=v,P[z+N]=z+x,P[z+_]=-1,P[z+A]=0,P[z+R]=0,P[z+I]=0,z+=x,P[z+f]=-1,P[z+b]=P[O+b]-v,P[z+y]=P[O+y]+v,P[z+T]=v,P[z+N]=z+x,P[z+_]=-1,P[z+A]=0,P[z+R]=0,P[z+I]=0,z+=x,P[z+f]=-1,P[z+b]=P[O+b]+v,P[z+y]=P[O+y]-v,P[z+T]=v,P[z+N]=z+x,P[z+_]=-1,P[z+A]=0,P[z+R]=0,P[z+I]=0,z+=x,P[z+f]=-1,P[z+b]=P[O+b]+v,P[z+y]=P[O+y]+v,P[z+T]=v,P[z+N]=P[O+N],P[z+_]=-1,P[z+A]=0,P[z+R]=0,P[z+I]=0,K+=4,w[P[O+f]+t]<P[O+b]?w[P[O+f]+e]<P[O+y]?G=P[O+_]:G=P[O+_]+x:w[P[O+f]+e]<P[O+y]?G=P[O+_]+x*2:G=P[O+_]+x*3,P[O+A]=w[P[O+f]+l],P[O+R]=w[P[O+f]+t],P[O+I]=w[P[O+f]+e],P[G+f]=P[O+f],P[O+f]=-1,w[C+t]<P[O+b]?w[C+e]<P[O+y]?ge=P[O+_]:ge=P[O+_]+x:w[C+e]<P[O+y]?ge=P[O+_]+x*2:ge=P[O+_]+x*3,G===ge)if(pe--){O=G;continue}else{pe=D;break}P[ge+f]=C;break}}if(j.barnesHutOptimize)for(ne=j.scalingRatio,C=0;C<M;C+=m)for(O=0;;)if(P[O+_]>=0)if(q=Math.pow(w[C+t]-P[O+R],2)+Math.pow(w[C+e]-P[O+I],2),B=P[O+T],4*B*B/q<Y){if(se=w[C+t]-P[O+R],F=w[C+e]-P[O+I],X===!0?q>0?(U=ne*w[C+l]*P[O+A]/q,w[C+r]+=se*U,w[C+n]+=F*U):q<0&&(U=-ne*w[C+l]*P[O+A]/Math.sqrt(q),w[C+r]+=se*U,w[C+n]+=F*U):q>0&&(U=ne*w[C+l]*P[O+A]/q,w[C+r]+=se*U,w[C+n]+=F*U),O=P[O+N],O<0)break;continue}else{O=P[O+_];continue}else{if(ae=P[O+f],ae>=0&&ae!==C&&(se=w[C+t]-w[ae+t],F=w[C+e]-w[ae+e],q=se*se+F*F,X===!0?q>0?(U=ne*w[C+l]*w[ae+l]/q,w[C+r]+=se*U,w[C+n]+=F*U):q<0&&(U=-ne*w[C+l]*w[ae+l]/Math.sqrt(q),w[C+r]+=se*U,w[C+n]+=F*U):q>0&&(U=ne*w[C+l]*w[ae+l]/q,w[C+r]+=se*U,w[C+n]+=F*U)),O=P[O+N],O<0)break;continue}else for(ne=j.scalingRatio,S=0;S<M;S+=m)for(H=0;H<S;H+=m)se=w[S+t]-w[H+t],F=w[S+e]-w[H+e],X===!0?(q=Math.sqrt(se*se+F*F)-w[S+s]-w[H+s],q>0?(U=ne*w[S+l]*w[H+l]/q/q,w[S+r]+=se*U,w[S+n]+=F*U,w[H+r]-=se*U,w[H+n]-=F*U):q<0&&(U=100*ne*w[S+l]*w[H+l],w[S+r]+=se*U,w[S+n]+=F*U,w[H+r]-=se*U,w[H+n]-=F*U)):(q=Math.sqrt(se*se+F*F),q>0&&(U=ne*w[S+l]*w[H+l]/q/q,w[S+r]+=se*U,w[S+n]+=F*U,w[H+r]-=se*U,w[H+n]-=F*U));for(z=j.gravity/j.scalingRatio,ne=j.scalingRatio,C=0;C<M;C+=m)U=0,se=w[C+t],F=w[C+e],q=Math.sqrt(Math.pow(se,2)+Math.pow(F,2)),j.strongGravityMode?q>0&&(U=ne*w[C+l]*z):q>0&&(U=ne*w[C+l]*z/q),w[C+r]-=se*U,w[C+n]-=F*U;for(ne=1*(j.outboundAttractionDistribution?ie:1),$=0;$<J;$+=E)S=V[$+u],H=V[$+d],v=V[$+h],Q=Math.pow(v,j.edgeWeightInfluence),se=w[S+t]-w[H+t],F=w[S+e]-w[H+e],X===!0?(q=Math.sqrt(se*se+F*F)-w[S+s]-w[H+s],j.linLogMode?j.outboundAttractionDistribution?q>0&&(U=-ne*Q*Math.log(1+q)/q/w[S+l]):q>0&&(U=-ne*Q*Math.log(1+q)/q):j.outboundAttractionDistribution?q>0&&(U=-ne*Q/w[S+l]):q>0&&(U=-ne*Q)):(q=Math.sqrt(Math.pow(se,2)+Math.pow(F,2)),j.linLogMode?j.outboundAttractionDistribution?q>0&&(U=-ne*Q*Math.log(1+q)/q/w[S+l]):q>0&&(U=-ne*Q*Math.log(1+q)/q):j.outboundAttractionDistribution?(q=1,U=-ne*Q/w[S+l]):(q=1,U=-ne*Q)),q>0&&(w[S+r]+=se*U,w[S+n]+=F*U,w[H+r]-=se*U,w[H+n]-=F*U);var de,me,Ie,ke,Te,Pe;if(X===!0)for(C=0;C<M;C+=m)w[C+c]!==1&&(de=Math.sqrt(Math.pow(w[C+r],2)+Math.pow(w[C+n],2)),de>k&&(w[C+r]=w[C+r]*k/de,w[C+n]=w[C+n]*k/de),me=w[C+l]*Math.sqrt((w[C+a]-w[C+r])*(w[C+a]-w[C+r])+(w[C+o]-w[C+n])*(w[C+o]-w[C+n])),Ie=Math.sqrt((w[C+a]+w[C+r])*(w[C+a]+w[C+r])+(w[C+o]+w[C+n])*(w[C+o]+w[C+n]))/2,ke=.1*Math.log(1+Ie)/(1+Math.sqrt(me)),Te=w[C+t]+w[C+r]*(ke/j.slowDown),w[C+t]=Te,Pe=w[C+e]+w[C+n]*(ke/j.slowDown),w[C+e]=Pe);else for(C=0;C<M;C+=m)w[C+c]!==1&&(me=w[C+l]*Math.sqrt((w[C+a]-w[C+r])*(w[C+a]-w[C+r])+(w[C+o]-w[C+n])*(w[C+o]-w[C+n])),Ie=Math.sqrt((w[C+a]+w[C+r])*(w[C+a]+w[C+r])+(w[C+o]+w[C+n])*(w[C+o]+w[C+n]))/2,ke=w[C+i]*Math.log(1+Ie)/(1+Math.sqrt(me)),w[C+i]=Math.min(1,Math.sqrt(ke*(Math.pow(w[C+r],2)+Math.pow(w[C+n],2))/(1+Math.sqrt(me)))),Te=w[C+t]+w[C+r]*(ke/j.slowDown),w[C+t]=Te,Pe=w[C+e]+w[C+n]*(ke/j.slowDown),w[C+e]=Pe);return{}},_r}var qe={},Co;function ms(){if(Co)return qe;Co=1;var t=10,e=3;return qe.assign=function(r){r=r||{};var n=Array.prototype.slice.call(arguments).slice(1),a,o,l;for(a=0,l=n.length;a<l;a++)if(n[a])for(o in n[a])r[o]=n[a][o];return r},qe.validateSettings=function(r){return"linLogMode"in r&&typeof r.linLogMode!="boolean"?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in r&&typeof r.outboundAttractionDistribution!="boolean"?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in r&&typeof r.adjustSizes!="boolean"?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in r&&typeof r.edgeWeightInfluence!="number"?{message:"the `edgeWeightInfluence` setting should be a number."}:"scalingRatio"in r&&!(typeof r.scalingRatio=="number"&&r.scalingRatio>=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in r&&typeof r.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in r&&!(typeof r.gravity=="number"&&r.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in r&&!(typeof r.slowDown=="number"||r.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in r&&typeof r.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in r&&!(typeof r.barnesHutTheta=="number"&&r.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},qe.graphToByteArrays=function(r,n){var a=r.order,o=r.size,l={},i,s=new Float32Array(a*t),c=new Float32Array(o*e);return i=0,r.forEachNode(function(u,d){l[u]=i,s[i]=d.x,s[i+1]=d.y,s[i+2]=0,s[i+3]=0,s[i+4]=0,s[i+5]=0,s[i+6]=1,s[i+7]=1,s[i+8]=d.size||1,s[i+9]=d.fixed?1:0,i+=t}),i=0,r.forEachEdge(function(u,d,h,f,b,y,T){var N=l[h],_=l[f],A=n(u,d,h,f,b,y,T);s[N+6]+=A,s[_+6]+=A,c[i]=N,c[i+1]=_,c[i+2]=A,i+=e}),{nodes:s,edges:c}},qe.assignLayoutChanges=function(r,n,a){var o=0;r.updateEachNodeAttributes(function(l,i){return i.x=n[o],i.y=n[o+1],o+=t,a?a(l,i):i})},qe.readGraphPositions=function(r,n){var a=0;r.forEachNode(function(o,l){n[a]=l.x,n[a+1]=l.y,a+=t})},qe.collectLayoutChanges=function(r,n,a){for(var o=r.nodes(),l={},i=0,s=0,c=n.length;i<c;i+=t){if(a){var u=Object.assign({},r.getNodeAttributes(o[s]));u.x=n[i],u.y=n[i+1],u=a(o[s],u),l[o[s]]={x:u.x,y:u.y}}else l[o[s]]={x:n[i],y:n[i+1]};s++}return l},qe.createWorker=function(n){var a=window.URL||window.webkitURL,o=n.toString(),l=a.createObjectURL(new Blob(["("+o+").call(this);"],{type:"text/javascript"})),i=new Worker(l);return a.revokeObjectURL(l),i},qe}var Cr,ko;function vs(){return ko||(ko=1,Cr={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}),Cr}var kr,To;function Kd(){if(To)return kr;To=1;var t=We(),e=In().createEdgeWeightGetter,r=Yd(),n=ms(),a=vs();function o(s,c,u){if(!t(c))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");typeof u=="number"&&(u={iterations:u});var d=u.iterations;if(typeof d!="number")throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(d<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var h=e("getEdgeWeight"in u?u.getEdgeWeight:"weight").fromEntry,f=typeof u.outputReducer=="function"?u.outputReducer:null,b=n.assign({},a,u.settings),y=n.validateSettings(b);if(y)throw new Error("graphology-layout-forceatlas2: "+y.message);var T=n.graphToByteArrays(c,h),N;for(N=0;N<d;N++)r(b,T.nodes,T.edges);if(s){n.assignLayoutChanges(c,T.nodes,f);return}return n.collectLayoutChanges(c,T.nodes)}function l(s){var c=typeof s=="number"?s:s.order;return{barnesHutOptimize:c>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(c)}}var i=o.bind(null,!1);return i.assign=o.bind(null,!0),i.inferSettings=l,kr=i,kr}var Qd=Kd();const Jd=He(Qd);var Tr,Ro;function Zd(){return Ro||(Ro=1,Tr=function(){var e,r,n={};(function(){var o=0,l=1,i=2,s=3,c=4,u=5,d=6,h=7,f=8,b=9,y=0,T=1,N=2,_=0,A=1,R=2,I=3,D=4,m=5,E=6,x=7,k=8,L=3,j=10,w=3,V=9,K=10;n.exports=function(C,S,H){var ae,$,v,z,B,M,J,X,Y,ie,ne=S.length,se=H.length,F=C.adjustSizes,Q=C.barnesHutTheta*C.barnesHutTheta,q,U,P,oe,ue,te,Z,G=[];for(v=0;v<ne;v+=j)S[v+c]=S[v+i],S[v+u]=S[v+s],S[v+i]=0,S[v+s]=0;if(C.outboundAttractionDistribution){for(q=0,v=0;v<ne;v+=j)q+=S[v+d];q/=ne/j}if(C.barnesHutOptimize){var ge=1/0,pe=-1/0,ye=1/0,we=-1/0,de,me,Ie;for(v=0;v<ne;v+=j)ge=Math.min(ge,S[v+o]),pe=Math.max(pe,S[v+o]),ye=Math.min(ye,S[v+l]),we=Math.max(we,S[v+l]);var ke=pe-ge,Te=we-ye;for(ke>Te?(ye-=(ke-Te)/2,we=ye+ke):(ge-=(Te-ke)/2,pe=ge+Te),G[0+_]=-1,G[0+A]=(ge+pe)/2,G[0+R]=(ye+we)/2,G[0+I]=Math.max(pe-ge,we-ye),G[0+D]=-1,G[0+m]=-1,G[0+E]=0,G[0+x]=0,G[0+k]=0,ae=1,v=0;v<ne;v+=j)for($=0,Ie=L;;)if(G[$+m]>=0){S[v+o]<G[$+A]?S[v+l]<G[$+R]?de=G[$+m]:de=G[$+m]+V:S[v+l]<G[$+R]?de=G[$+m]+V*2:de=G[$+m]+V*3,G[$+x]=(G[$+x]*G[$+E]+S[v+o]*S[v+d])/(G[$+E]+S[v+d]),G[$+k]=(G[$+k]*G[$+E]+S[v+l]*S[v+d])/(G[$+E]+S[v+d]),G[$+E]+=S[v+d],$=de;continue}else if(G[$+_]<0){G[$+_]=v;break}else{if(G[$+m]=ae*V,X=G[$+I]/2,Y=G[$+m],G[Y+_]=-1,G[Y+A]=G[$+A]-X,G[Y+R]=G[$+R]-X,G[Y+I]=X,G[Y+D]=Y+V,G[Y+m]=-1,G[Y+E]=0,G[Y+x]=0,G[Y+k]=0,Y+=V,G[Y+_]=-1,G[Y+A]=G[$+A]-X,G[Y+R]=G[$+R]+X,G[Y+I]=X,G[Y+D]=Y+V,G[Y+m]=-1,G[Y+E]=0,G[Y+x]=0,G[Y+k]=0,Y+=V,G[Y+_]=-1,G[Y+A]=G[$+A]+X,G[Y+R]=G[$+R]-X,G[Y+I]=X,G[Y+D]=Y+V,G[Y+m]=-1,G[Y+E]=0,G[Y+x]=0,G[Y+k]=0,Y+=V,G[Y+_]=-1,G[Y+A]=G[$+A]+X,G[Y+R]=G[$+R]+X,G[Y+I]=X,G[Y+D]=G[$+D],G[Y+m]=-1,G[Y+E]=0,G[Y+x]=0,G[Y+k]=0,ae+=4,S[G[$+_]+o]<G[$+A]?S[G[$+_]+l]<G[$+R]?de=G[$+m]:de=G[$+m]+V:S[G[$+_]+l]<G[$+R]?de=G[$+m]+V*2:de=G[$+m]+V*3,G[$+E]=S[G[$+_]+d],G[$+x]=S[G[$+_]+o],G[$+k]=S[G[$+_]+l],G[de+_]=G[$+_],G[$+_]=-1,S[v+o]<G[$+A]?S[v+l]<G[$+R]?me=G[$+m]:me=G[$+m]+V:S[v+l]<G[$+R]?me=G[$+m]+V*2:me=G[$+m]+V*3,de===me)if(Ie--){$=de;continue}else{Ie=L;break}G[me+_]=v;break}}if(C.barnesHutOptimize)for(U=C.scalingRatio,v=0;v<ne;v+=j)for($=0;;)if(G[$+m]>=0)if(te=Math.pow(S[v+o]-G[$+x],2)+Math.pow(S[v+l]-G[$+k],2),ie=G[$+I],4*ie*ie/te<Q){if(P=S[v+o]-G[$+x],oe=S[v+l]-G[$+k],F===!0?te>0?(Z=U*S[v+d]*G[$+E]/te,S[v+i]+=P*Z,S[v+s]+=oe*Z):te<0&&(Z=-U*S[v+d]*G[$+E]/Math.sqrt(te),S[v+i]+=P*Z,S[v+s]+=oe*Z):te>0&&(Z=U*S[v+d]*G[$+E]/te,S[v+i]+=P*Z,S[v+s]+=oe*Z),$=G[$+D],$<0)break;continue}else{$=G[$+m];continue}else{if(M=G[$+_],M>=0&&M!==v&&(P=S[v+o]-S[M+o],oe=S[v+l]-S[M+l],te=P*P+oe*oe,F===!0?te>0?(Z=U*S[v+d]*S[M+d]/te,S[v+i]+=P*Z,S[v+s]+=oe*Z):te<0&&(Z=-U*S[v+d]*S[M+d]/Math.sqrt(te),S[v+i]+=P*Z,S[v+s]+=oe*Z):te>0&&(Z=U*S[v+d]*S[M+d]/te,S[v+i]+=P*Z,S[v+s]+=oe*Z)),$=G[$+D],$<0)break;continue}else for(U=C.scalingRatio,z=0;z<ne;z+=j)for(B=0;B<z;B+=j)P=S[z+o]-S[B+o],oe=S[z+l]-S[B+l],F===!0?(te=Math.sqrt(P*P+oe*oe)-S[z+f]-S[B+f],te>0?(Z=U*S[z+d]*S[B+d]/te/te,S[z+i]+=P*Z,S[z+s]+=oe*Z,S[B+i]-=P*Z,S[B+s]-=oe*Z):te<0&&(Z=100*U*S[z+d]*S[B+d],S[z+i]+=P*Z,S[z+s]+=oe*Z,S[B+i]-=P*Z,S[B+s]-=oe*Z)):(te=Math.sqrt(P*P+oe*oe),te>0&&(Z=U*S[z+d]*S[B+d]/te/te,S[z+i]+=P*Z,S[z+s]+=oe*Z,S[B+i]-=P*Z,S[B+s]-=oe*Z));for(Y=C.gravity/C.scalingRatio,U=C.scalingRatio,v=0;v<ne;v+=j)Z=0,P=S[v+o],oe=S[v+l],te=Math.sqrt(Math.pow(P,2)+Math.pow(oe,2)),C.strongGravityMode?te>0&&(Z=U*S[v+d]*Y):te>0&&(Z=U*S[v+d]*Y/te),S[v+i]-=P*Z,S[v+s]-=oe*Z;for(U=1*(C.outboundAttractionDistribution?q:1),J=0;J<se;J+=w)z=H[J+y],B=H[J+T],X=H[J+N],ue=Math.pow(X,C.edgeWeightInfluence),P=S[z+o]-S[B+o],oe=S[z+l]-S[B+l],F===!0?(te=Math.sqrt(P*P+oe*oe)-S[z+f]-S[B+f],C.linLogMode?C.outboundAttractionDistribution?te>0&&(Z=-U*ue*Math.log(1+te)/te/S[z+d]):te>0&&(Z=-U*ue*Math.log(1+te)/te):C.outboundAttractionDistribution?te>0&&(Z=-U*ue/S[z+d]):te>0&&(Z=-U*ue)):(te=Math.sqrt(Math.pow(P,2)+Math.pow(oe,2)),C.linLogMode?C.outboundAttractionDistribution?te>0&&(Z=-U*ue*Math.log(1+te)/te/S[z+d]):te>0&&(Z=-U*ue*Math.log(1+te)/te):C.outboundAttractionDistribution?(te=1,Z=-U*ue/S[z+d]):(te=1,Z=-U*ue)),te>0&&(S[z+i]+=P*Z,S[z+s]+=oe*Z,S[B+i]-=P*Z,S[B+s]-=oe*Z);var Pe,Ye,Ke,Re,st,ze;if(F===!0)for(v=0;v<ne;v+=j)S[v+b]!==1&&(Pe=Math.sqrt(Math.pow(S[v+i],2)+Math.pow(S[v+s],2)),Pe>K&&(S[v+i]=S[v+i]*K/Pe,S[v+s]=S[v+s]*K/Pe),Ye=S[v+d]*Math.sqrt((S[v+c]-S[v+i])*(S[v+c]-S[v+i])+(S[v+u]-S[v+s])*(S[v+u]-S[v+s])),Ke=Math.sqrt((S[v+c]+S[v+i])*(S[v+c]+S[v+i])+(S[v+u]+S[v+s])*(S[v+u]+S[v+s]))/2,Re=.1*Math.log(1+Ke)/(1+Math.sqrt(Ye)),st=S[v+o]+S[v+i]*(Re/C.slowDown),S[v+o]=st,ze=S[v+l]+S[v+s]*(Re/C.slowDown),S[v+l]=ze);else for(v=0;v<ne;v+=j)S[v+b]!==1&&(Ye=S[v+d]*Math.sqrt((S[v+c]-S[v+i])*(S[v+c]-S[v+i])+(S[v+u]-S[v+s])*(S[v+u]-S[v+s])),Ke=Math.sqrt((S[v+c]+S[v+i])*(S[v+c]+S[v+i])+(S[v+u]+S[v+s])*(S[v+u]+S[v+s]))/2,Re=S[v+h]*Math.log(1+Ke)/(1+Math.sqrt(Ye)),S[v+h]=Math.min(1,Math.sqrt(Re*(Math.pow(S[v+i],2)+Math.pow(S[v+s],2))/(1+Math.sqrt(Ye)))),st=S[v+o]+S[v+i]*(Re/C.slowDown),S[v+o]=st,ze=S[v+l]+S[v+s]*(Re/C.slowDown),S[v+l]=ze);return{}}})();var a=n.exports;self.addEventListener("message",function(o){var l=o.data;e=new Float32Array(l.nodes),l.edges&&(r=new Float32Array(l.edges)),a(l.settings,e,r),self.postMessage({nodes:e.buffer},[e.buffer])})}),Tr}var Rr,Ao;function ef(){if(Ao)return Rr;Ao=1;var t=Zd(),e=We(),r=In().createEdgeWeightGetter,n=ms(),a=vs();function o(l,i){if(i=i||{},!e(l))throw new Error("graphology-layout-forceatlas2/worker: the given graph is not a valid graphology instance.");var s=r("getEdgeWeight"in i?i.getEdgeWeight:"weight").fromEntry,c=n.assign({},a,i.settings),u=n.validateSettings(c);if(u)throw new Error("graphology-layout-forceatlas2/worker: "+u.message);this.worker=null,this.graph=l,this.settings=c,this.getEdgeWeight=s,this.matrices=null,this.running=!1,this.killed=!1,this.outputReducer=typeof i.outputReducer=="function"?i.outputReducer:null,this.handleMessage=this.handleMessage.bind(this);var d=void 0,h=this;this.handleGraphUpdate=function(){h.worker&&h.worker.terminate(),d&&clearTimeout(d),d=setTimeout(function(){d=void 0,h.spawnWorker()},0)},l.on("nodeAdded",this.handleGraphUpdate),l.on("edgeAdded",this.handleGraphUpdate),l.on("nodeDropped",this.handleGraphUpdate),l.on("edgeDropped",this.handleGraphUpdate),this.spawnWorker()}return o.prototype.isRunning=function(){return this.running},o.prototype.spawnWorker=function(){this.worker&&this.worker.terminate(),this.worker=n.createWorker(t),this.worker.addEventListener("message",this.handleMessage),this.running&&(this.running=!1,this.start())},o.prototype.handleMessage=function(l){if(this.running){var i=new Float32Array(l.data.nodes);n.assignLayoutChanges(this.graph,i,this.outputReducer),this.outputReducer&&n.readGraphPositions(this.graph,i),this.matrices.nodes=i,this.askForIterations()}},o.prototype.askForIterations=function(l){var i=this.matrices,s={settings:this.settings,nodes:i.nodes.buffer},c=[i.nodes.buffer];return l&&(s.edges=i.edges.buffer,c.push(i.edges.buffer)),this.worker.postMessage(s,c),this},o.prototype.start=function(){if(this.killed)throw new Error("graphology-layout-forceatlas2/worker.start: layout was killed.");return this.running?this:(this.matrices=n.graphToByteArrays(this.graph,this.getEdgeWeight),this.running=!0,this.askForIterations(!0),this)},o.prototype.stop=function(){return this.running=!1,this},o.prototype.kill=function(){if(this.killed)return this;this.running=!1,this.killed=!0,this.matrices=null,this.worker.terminate(),this.graph.removeListener("nodeAdded",this.handleGraphUpdate),this.graph.removeListener("edgeAdded",this.handleGraphUpdate),this.graph.removeListener("nodeDropped",this.handleGraphUpdate),this.graph.removeListener("edgeDropped",this.handleGraphUpdate)},Rr=o,Rr}var tf=ef();const rf=He(tf);function ys(t={iterations:100}){return Et(Jd,t)}function nf(t={}){return jn(rf,t)}var Ar,jo;function of(){if(jo)return Ar;jo=1;var t=0,e=1,r=2,n=3;function a(l,i){return l+"§"+i}function o(){return .01*(.5-Math.random())}return Ar=function(i,s){var c=i.margin,u=i.ratio,d=i.expansion,h=i.gridSize,f=i.speed,b,y,T,N,_,A,R=!0,I=s.length,D=I/n|0,m=new Float32Array(D),E=new Float32Array(D),x=1/0,k=1/0,L=-1/0,j=-1/0;for(b=0;b<I;b+=n)T=s[b+t],N=s[b+e],A=s[b+r]*u+c,x=Math.min(x,T-A),L=Math.max(L,T+A),k=Math.min(k,N-A),j=Math.max(j,N+A);var w=L-x,V=j-k,K=(x+L)/2,O=(k+j)/2;x=K-d*w/2,L=K+d*w/2,k=O-d*V/2,j=O+d*V/2;var C=new Array(h*h),S=C.length,H;for(H=0;H<S;H++)C[H]=[];var ae,$,v,z,B,M,J,X,Y,ie;for(b=0;b<I;b+=n)for(T=s[b+t],N=s[b+e],A=s[b+r]*u+c,ae=T-A,$=T+A,v=N-A,z=N+A,B=Math.floor(h*(ae-x)/(L-x)),M=Math.floor(h*($-x)/(L-x)),J=Math.floor(h*(v-k)/(j-k)),X=Math.floor(h*(z-k)/(j-k)),Y=B;Y<=M;Y++)for(ie=J;ie<=X;ie++)C[Y*h+ie].push(b);var ne,se=new Set,F,Q,q,U,P,oe,ue,te,Z,G,ge,pe,ye;for(H=0;H<S;H++)for(ne=C[H],b=0,_=ne.length;b<_;b++)for(F=ne[b],q=s[F+t],P=s[F+e],ue=s[F+r],y=b+1;y<_;y++)Q=ne[y],Z=a(F,Q),!(S>1&&se.has(Z))&&(S>1&&se.add(Z),U=s[Q+t],oe=s[Q+e],te=s[Q+r],G=U-q,ge=oe-P,pe=Math.sqrt(G*G+ge*ge),ye=pe<ue*u+c+(te*u+c),ye&&(R=!1,Q=Q/n|0,pe>0?(m[Q]+=G/pe*(1+ue),E[Q]+=ge/pe*(1+ue)):(m[Q]+=w*o(),E[Q]+=V*o())));for(b=0,y=0;b<I;b+=n,y++)s[b+t]+=m[y]*.1*f,s[b+e]+=E[y]*.1*f;return{converged:R}},Ar}var lt={},Io;function bs(){if(Io)return lt;Io=1;var t=3;return lt.validateSettings=function(e){return"gridSize"in e&&typeof e.gridSize!="number"||e.gridSize<=0?{message:"the `gridSize` setting should be a positive number."}:"margin"in e&&typeof e.margin!="number"||e.margin<0?{message:"the `margin` setting should be 0 or a positive number."}:"expansion"in e&&typeof e.expansion!="number"||e.expansion<=0?{message:"the `expansion` setting should be a positive number."}:"ratio"in e&&typeof e.ratio!="number"||e.ratio<=0?{message:"the `ratio` setting should be a positive number."}:"speed"in e&&typeof e.speed!="number"||e.speed<=0?{message:"the `speed` setting should be a positive number."}:null},lt.graphToByteArray=function(e,r){var n=e.order,a=new Float32Array(n*t),o=0;return e.forEachNode(function(l,i){typeof r=="function"&&(i=r(l,i)),a[o]=i.x,a[o+1]=i.y,a[o+2]=i.size||1,o+=t}),a},lt.assignLayoutChanges=function(e,r,n){var a=0;e.forEachNode(function(o){var l={x:r[a],y:r[a+1]};typeof n=="function"&&(l=n(o,l)),e.mergeNodeAttributes(o,l),a+=t})},lt.collectLayoutChanges=function(e,r,n){var a={},o=0;return e.forEachNode(function(l){var i={x:r[o],y:r[o+1]};typeof n=="function"&&(i=n(l,i)),a[l]=i,o+=t}),a},lt.createWorker=function(r){var n=window.URL||window.webkitURL,a=r.toString(),o=n.createObjectURL(new Blob(["("+a+").call(this);"],{type:"text/javascript"})),l=new Worker(o);return n.revokeObjectURL(o),l},lt}var jr,Lo;function ws(){return Lo||(Lo=1,jr={gridSize:20,margin:5,expansion:1.1,ratio:1,speed:3}),jr}var Ir,No;function af(){if(No)return Ir;No=1;var t=We(),e=of(),r=bs(),n=ws(),a=500;function o(i,s,c){if(!t(s))throw new Error("graphology-layout-noverlap: the given graph is not a valid graphology instance.");typeof c=="number"?c={maxIterations:c}:c=c||{};var u=c.maxIterations||a;if(typeof u!="number"||u<=0)throw new Error("graphology-layout-force: you should provide a positive number of maximum iterations.");var d=Object.assign({},n,c.settings),h=r.validateSettings(d);if(h)throw new Error("graphology-layout-noverlap: "+h.message);var f=r.graphToByteArray(s,c.inputReducer),b=!1,y;for(y=0;y<u&&!b;y++)b=e(d,f).converged;if(i){r.assignLayoutChanges(s,f,c.outputReducer);return}return r.collectLayoutChanges(s,f,c.outputReducer)}var l=o.bind(null,!1);return l.assign=o.bind(null,!0),Ir=l,Ir}var sf=af();const lf=He(sf);var Lr,Po;function cf(){return Po||(Po=1,Lr=function(){var e,r={};(function(){var a=0,o=1,l=2,i=3;function s(u,d){return u+"§"+d}function c(){return .01*(.5-Math.random())}r.exports=function(d,h){var f=d.margin,b=d.ratio,y=d.expansion,T=d.gridSize,N=d.speed,_,A,R,I,D,m,E=!0,x=h.length,k=x/i|0,L=new Float32Array(k),j=new Float32Array(k),w=1/0,V=1/0,K=-1/0,O=-1/0;for(_=0;_<x;_+=i)R=h[_+a],I=h[_+o],m=h[_+l]*b+f,w=Math.min(w,R-m),K=Math.max(K,R+m),V=Math.min(V,I-m),O=Math.max(O,I+m);var C=K-w,S=O-V,H=(w+K)/2,ae=(V+O)/2;w=H-y*C/2,K=H+y*C/2,V=ae-y*S/2,O=ae+y*S/2;var $=new Array(T*T),v=$.length,z;for(z=0;z<v;z++)$[z]=[];var B,M,J,X,Y,ie,ne,se,F,Q;for(_=0;_<x;_+=i)for(R=h[_+a],I=h[_+o],m=h[_+l]*b+f,B=R-m,M=R+m,J=I-m,X=I+m,Y=Math.floor(T*(B-w)/(K-w)),ie=Math.floor(T*(M-w)/(K-w)),ne=Math.floor(T*(J-V)/(O-V)),se=Math.floor(T*(X-V)/(O-V)),F=Y;F<=ie;F++)for(Q=ne;Q<=se;Q++)$[F*T+Q].push(_);var q,U=new Set,P,oe,ue,te,Z,G,ge,pe,ye,we,de,me,Ie;for(z=0;z<v;z++)for(q=$[z],_=0,D=q.length;_<D;_++)for(P=q[_],ue=h[P+a],Z=h[P+o],ge=h[P+l],A=_+1;A<D;A++)oe=q[A],ye=s(P,oe),!(v>1&&U.has(ye))&&(v>1&&U.add(ye),te=h[oe+a],G=h[oe+o],pe=h[oe+l],we=te-ue,de=G-Z,me=Math.sqrt(we*we+de*de),Ie=me<ge*b+f+(pe*b+f),Ie&&(E=!1,oe=oe/i|0,me>0?(L[oe]+=we/me*(1+ge),j[oe]+=de/me*(1+ge)):(L[oe]+=C*c(),j[oe]+=S*c())));for(_=0,A=0;_<x;_+=i,A++)h[_+a]+=L[A]*.1*N,h[_+o]+=j[A]*.1*N;return{converged:E}}})();var n=r.exports;self.addEventListener("message",function(a){var o=a.data;e=new Float32Array(o.nodes);var l=n(o.settings,e);self.postMessage({result:l,nodes:e.buffer},[e.buffer])})}),Lr}var Nr,zo;function uf(){if(zo)return Nr;zo=1;var t=cf(),e=We(),r=bs(),n=ws();function a(o,l){if(l=l||{},!e(o))throw new Error("graphology-layout-noverlap/worker: the given graph is not a valid graphology instance.");var i=Object.assign({},n,l.settings),s=r.validateSettings(i);if(s)throw new Error("graphology-layout-noverlap/worker: "+s.message);this.worker=null,this.graph=o,this.settings=i,this.matrices=null,this.running=!1,this.killed=!1,this.inputReducer=l.inputReducer,this.outputReducer=l.outputReducer,this.callbacks={onConverged:typeof l.onConverged=="function"?l.onConverged:null},this.handleMessage=this.handleMessage.bind(this);var c=!1,u=this;this.handleAddition=function(){c||(c=!0,u.spawnWorker(),setTimeout(function(){c=!1},0))},o.on("nodeAdded",this.handleAddition),o.on("edgeAdded",this.handleAddition),this.spawnWorker()}return a.prototype.isRunning=function(){return this.running},a.prototype.spawnWorker=function(){this.worker&&this.worker.terminate(),this.worker=r.createWorker(t),this.worker.addEventListener("message",this.handleMessage),this.running&&(this.running=!1,this.start())},a.prototype.handleMessage=function(o){if(this.running){var l=new Float32Array(o.data.nodes);if(r.assignLayoutChanges(this.graph,l,this.outputReducer),this.matrices.nodes=l,o.data.result.converged){this.callbacks.onConverged&&this.callbacks.onConverged(),this.stop();return}this.askForIterations()}},a.prototype.askForIterations=function(){var o=this.matrices,l={settings:this.settings,nodes:o.nodes.buffer},i=[o.nodes.buffer];return this.worker.postMessage(l,i),this},a.prototype.start=function(){if(this.killed)throw new Error("graphology-layout-noverlap/worker.start: layout was killed.");return this.running?this:(this.matrices={nodes:r.graphToByteArray(this.graph,this.inputReducer)},this.running=!0,this.askForIterations(),this)},a.prototype.stop=function(){return this.running=!1,this},a.prototype.kill=function(){if(this.killed)return this;this.running=!1,this.killed=!0,this.matrices=null,this.worker.terminate(),this.graph.removeListener("nodeAdded",this.handleAddition),this.graph.removeListener("edgeAdded",this.handleAddition)},Nr=a,Nr}var df=uf();const ff=He(df);function hf(t={}){return Et(lf,t)}function gf(t={}){return jn(ff,t)}var Pr,Do;function pf(){if(Do)return Pr;Do=1;var t=At(),e=We(),r={dimensions:["x","y"],center:.5,rng:Math.random,scale:1};function n(o,l,i){if(!e(l))throw new Error("graphology-layout/random: the given graph is not a valid graphology instance.");i=t(i,r);var s=i.dimensions;if(!Array.isArray(s)||s.length<1)throw new Error("graphology-layout/random: given dimensions are invalid.");var c=s.length,u=i.center,d=i.rng,h=i.scale,f=(u-.5)*h;function b(T){for(var N=0;N<c;N++)T[s[N]]=d()*h+f;return T}if(!o){var y={};return l.forEachNode(function(T){y[T]=b({})}),y}l.updateEachNodeAttributes(function(T,N){return b(N),N},{attributes:s})}var a=n.bind(null,!1);return a.assign=n.bind(null,!0),Pr=a,Pr}var mf=pf();const vf=He(mf);function yf(t={}){return Et(vf,t)}var Oo=1,bf=.9,wf=.8,xf=.17,zr=.1,Dr=.999,Sf=.9999,Ef=.99,_f=/[\\\/_+.#"@\[\(\{&]/,Cf=/[\\\/_+.#"@\[\(\{&]/g,kf=/[\s-]/,xs=/[\s-]/g;function fn(t,e,r,n,a,o,l){if(o===e.length)return a===t.length?Oo:Ef;var i=`${a},${o}`;if(l[i]!==void 0)return l[i];for(var s=n.charAt(o),c=r.indexOf(s,a),u=0,d,h,f,b;c>=0;)d=fn(t,e,r,n,c+1,o+1,l),d>u&&(c===a?d*=Oo:_f.test(t.charAt(c-1))?(d*=wf,f=t.slice(a,c-1).match(Cf),f&&a>0&&(d*=Math.pow(Dr,f.length))):kf.test(t.charAt(c-1))?(d*=bf,b=t.slice(a,c-1).match(xs),b&&a>0&&(d*=Math.pow(Dr,b.length))):(d*=xf,a>0&&(d*=Math.pow(Dr,c-a))),t.charAt(c)!==e.charAt(o)&&(d*=Sf)),(d<zr&&r.charAt(c-1)===n.charAt(o+1)||n.charAt(o+1)===n.charAt(o)&&r.charAt(c-1)!==n.charAt(o))&&(h=fn(t,e,r,n,c+1,o+2,l),h*zr>d&&(d=h*zr)),d>u&&(u=d),c=r.indexOf(s,c+1);return l[i]=u,u}function Go(t){return t.toLowerCase().replace(xs," ")}function Tf(t,e,r){return t=r&&r.length>0?`${t+" "+r.join(" ")}`:t,fn(t,e,Go(t),Go(e),0,0,{})}var Or={exports:{}},Gr={};/**
|
|
* @license React
|
|
* use-sync-external-store-shim.production.js
|
|
*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/var Fo;function Rf(){if(Fo)return Gr;Fo=1;var t=gi();function e(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var r=typeof Object.is=="function"?Object.is:e,n=t.useState,a=t.useEffect,o=t.useLayoutEffect,l=t.useDebugValue;function i(d,h){var f=h(),b=n({inst:{value:f,getSnapshot:h}}),y=b[0].inst,T=b[1];return o(function(){y.value=f,y.getSnapshot=h,s(y)&&T({inst:y})},[d,f,h]),a(function(){return s(y)&&T({inst:y}),d(function(){s(y)&&T({inst:y})})},[d]),l(f),f}function s(d){var h=d.getSnapshot;d=d.value;try{var f=h();return!r(d,f)}catch{return!0}}function c(d,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:i;return Gr.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,Gr}var $o;function Af(){return $o||($o=1,Or.exports=Rf()),Or.exports}var jf=Af(),Tt='[cmdk-group=""]',Fr='[cmdk-group-items=""]',If='[cmdk-group-heading=""]',Ln='[cmdk-item=""]',Mo=`${Ln}:not([aria-disabled="true"])`,hn="cmdk-item-select",dt="data-value",Lf=(t,e,r)=>Tf(t,e,r),Ss=p.createContext(void 0),jt=()=>p.useContext(Ss),Es=p.createContext(void 0),Nn=()=>p.useContext(Es),_s=p.createContext(void 0),Cs=p.forwardRef((t,e)=>{let r=yt(()=>{var v,z;return{search:"",value:(z=(v=t.value)!=null?v:t.defaultValue)!=null?z:"",filtered:{count:0,items:new Map,groups:new Set}}}),n=yt(()=>new Set),a=yt(()=>new Map),o=yt(()=>new Map),l=yt(()=>new Set),i=ks(t),{label:s,children:c,value:u,onValueChange:d,filter:h,shouldFilter:f,loop:b,disablePointerSelection:y=!1,vimBindings:T=!0,...N}=t,_=ft(),A=ft(),R=ft(),I=p.useRef(null),D=Bf();gt(()=>{if(u!==void 0){let v=u.trim();r.current.value=v,m.emit()}},[u]),gt(()=>{D(6,w)},[]);let m=p.useMemo(()=>({subscribe:v=>(l.current.add(v),()=>l.current.delete(v)),snapshot:()=>r.current,setState:(v,z,B)=>{var M,J,X;if(!Object.is(r.current[v],z)){if(r.current[v]=z,v==="search")j(),k(),D(1,L);else if(v==="value"&&(B||D(5,w),((M=i.current)==null?void 0:M.value)!==void 0)){let Y=z??"";(X=(J=i.current).onValueChange)==null||X.call(J,Y);return}m.emit()}},emit:()=>{l.current.forEach(v=>v())}}),[]),E=p.useMemo(()=>({value:(v,z,B)=>{var M;z!==((M=o.current.get(v))==null?void 0:M.value)&&(o.current.set(v,{value:z,keywords:B}),r.current.filtered.items.set(v,x(z,B)),D(2,()=>{k(),m.emit()}))},item:(v,z)=>(n.current.add(v),z&&(a.current.has(z)?a.current.get(z).add(v):a.current.set(z,new Set([v]))),D(3,()=>{j(),k(),r.current.value||L(),m.emit()}),()=>{o.current.delete(v),n.current.delete(v),r.current.filtered.items.delete(v);let B=V();D(4,()=>{j(),(B==null?void 0:B.getAttribute("id"))===v&&L(),m.emit()})}),group:v=>(a.current.has(v)||a.current.set(v,new Set),()=>{o.current.delete(v),a.current.delete(v)}),filter:()=>i.current.shouldFilter,label:s||t["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:_,inputId:R,labelId:A,listInnerRef:I}),[]);function x(v,z){var B,M;let J=(M=(B=i.current)==null?void 0:B.filter)!=null?M:Lf;return v?J(v,r.current.search,z):0}function k(){if(!r.current.search||i.current.shouldFilter===!1)return;let v=r.current.filtered.items,z=[];r.current.filtered.groups.forEach(M=>{let J=a.current.get(M),X=0;J.forEach(Y=>{let ie=v.get(Y);X=Math.max(ie,X)}),z.push([M,X])});let B=I.current;K().sort((M,J)=>{var X,Y;let ie=M.getAttribute("id"),ne=J.getAttribute("id");return((X=v.get(ne))!=null?X:0)-((Y=v.get(ie))!=null?Y:0)}).forEach(M=>{let J=M.closest(Fr);J?J.appendChild(M.parentElement===J?M:M.closest(`${Fr} > *`)):B.appendChild(M.parentElement===B?M:M.closest(`${Fr} > *`))}),z.sort((M,J)=>J[1]-M[1]).forEach(M=>{var J;let X=(J=I.current)==null?void 0:J.querySelector(`${Tt}[${dt}="${encodeURIComponent(M[0])}"]`);X==null||X.parentElement.appendChild(X)})}function L(){let v=K().find(B=>B.getAttribute("aria-disabled")!=="true"),z=v==null?void 0:v.getAttribute(dt);m.setState("value",z||void 0)}function j(){var v,z,B,M;if(!r.current.search||i.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let J=0;for(let X of n.current){let Y=(z=(v=o.current.get(X))==null?void 0:v.value)!=null?z:"",ie=(M=(B=o.current.get(X))==null?void 0:B.keywords)!=null?M:[],ne=x(Y,ie);r.current.filtered.items.set(X,ne),ne>0&&J++}for(let[X,Y]of a.current)for(let ie of Y)if(r.current.filtered.items.get(ie)>0){r.current.filtered.groups.add(X);break}r.current.filtered.count=J}function w(){var v,z,B;let M=V();M&&(((v=M.parentElement)==null?void 0:v.firstChild)===M&&((B=(z=M.closest(Tt))==null?void 0:z.querySelector(If))==null||B.scrollIntoView({block:"nearest"})),M.scrollIntoView({block:"nearest"}))}function V(){var v;return(v=I.current)==null?void 0:v.querySelector(`${Ln}[aria-selected="true"]`)}function K(){var v;return Array.from(((v=I.current)==null?void 0:v.querySelectorAll(Mo))||[])}function O(v){let z=K()[v];z&&m.setState("value",z.getAttribute(dt))}function C(v){var z;let B=V(),M=K(),J=M.findIndex(Y=>Y===B),X=M[J+v];(z=i.current)!=null&&z.loop&&(X=J+v<0?M[M.length-1]:J+v===M.length?M[0]:M[J+v]),X&&m.setState("value",X.getAttribute(dt))}function S(v){let z=V(),B=z==null?void 0:z.closest(Tt),M;for(;B&&!M;)B=v>0?Mf(B,Tt):Hf(B,Tt),M=B==null?void 0:B.querySelector(Mo);M?m.setState("value",M.getAttribute(dt)):C(v)}let H=()=>O(K().length-1),ae=v=>{v.preventDefault(),v.metaKey?H():v.altKey?S(1):C(1)},$=v=>{v.preventDefault(),v.metaKey?O(0):v.altKey?S(-1):C(-1)};return p.createElement(Ee.div,{ref:e,tabIndex:-1,...N,"cmdk-root":"",onKeyDown:v=>{var z;if((z=N.onKeyDown)==null||z.call(N,v),!v.defaultPrevented)switch(v.key){case"n":case"j":{T&&v.ctrlKey&&ae(v);break}case"ArrowDown":{ae(v);break}case"p":case"k":{T&&v.ctrlKey&&$(v);break}case"ArrowUp":{$(v);break}case"Home":{v.preventDefault(),O(0);break}case"End":{v.preventDefault(),H();break}case"Enter":if(!v.nativeEvent.isComposing&&v.keyCode!==229){v.preventDefault();let B=V();if(B){let M=new Event(hn);B.dispatchEvent(M)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:E.inputId,id:E.labelId,style:Uf},s),ir(t,v=>p.createElement(Es.Provider,{value:m},p.createElement(Ss.Provider,{value:E},v))))}),Nf=p.forwardRef((t,e)=>{var r,n;let a=ft(),o=p.useRef(null),l=p.useContext(_s),i=jt(),s=ks(t),c=(n=(r=s.current)==null?void 0:r.forceMount)!=null?n:l==null?void 0:l.forceMount;gt(()=>{if(!c)return i.item(a,l==null?void 0:l.id)},[c]);let u=Ts(a,o,[t.value,t.children,o],t.keywords),d=Nn(),h=pt(D=>D.value&&D.value===u.current),f=pt(D=>c||i.filter()===!1?!0:D.search?D.filtered.items.get(a)>0:!0);p.useEffect(()=>{let D=o.current;if(!(!D||t.disabled))return D.addEventListener(hn,b),()=>D.removeEventListener(hn,b)},[f,t.onSelect,t.disabled]);function b(){var D,m;y(),(m=(D=s.current).onSelect)==null||m.call(D,u.current)}function y(){d.setState("value",u.current,!0)}if(!f)return null;let{disabled:T,value:N,onSelect:_,forceMount:A,keywords:R,...I}=t;return p.createElement(Ee.div,{ref:Rt([o,e]),...I,id:a,"cmdk-item":"",role:"option","aria-disabled":!!T,"aria-selected":!!h,"data-disabled":!!T,"data-selected":!!h,onPointerMove:T||i.getDisablePointerSelection()?void 0:y,onClick:T?void 0:b},t.children)}),Pf=p.forwardRef((t,e)=>{let{heading:r,children:n,forceMount:a,...o}=t,l=ft(),i=p.useRef(null),s=p.useRef(null),c=ft(),u=jt(),d=pt(f=>a||u.filter()===!1?!0:f.search?f.filtered.groups.has(l):!0);gt(()=>u.group(l),[]),Ts(l,i,[t.value,t.heading,s]);let h=p.useMemo(()=>({id:l,forceMount:a}),[a]);return p.createElement(Ee.div,{ref:Rt([i,e]),...o,"cmdk-group":"",role:"presentation",hidden:d?void 0:!0},r&&p.createElement("div",{ref:s,"cmdk-group-heading":"","aria-hidden":!0,id:c},r),ir(t,f=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?c:void 0},p.createElement(_s.Provider,{value:h},f))))}),zf=p.forwardRef((t,e)=>{let{alwaysRender:r,...n}=t,a=p.useRef(null),o=pt(l=>!l.search);return!r&&!o?null:p.createElement(Ee.div,{ref:Rt([a,e]),...n,"cmdk-separator":"",role:"separator"})}),Df=p.forwardRef((t,e)=>{let{onValueChange:r,...n}=t,a=t.value!=null,o=Nn(),l=pt(u=>u.search),i=pt(u=>u.value),s=jt(),c=p.useMemo(()=>{var u;let d=(u=s.listInnerRef.current)==null?void 0:u.querySelector(`${Ln}[${dt}="${encodeURIComponent(i)}"]`);return d==null?void 0:d.getAttribute("id")},[]);return p.useEffect(()=>{t.value!=null&&o.setState("search",t.value)},[t.value]),p.createElement(Ee.input,{ref:e,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":s.listId,"aria-labelledby":s.labelId,"aria-activedescendant":c,id:s.inputId,type:"text",value:a?t.value:l,onChange:u=>{a||o.setState("search",u.target.value),r==null||r(u.target.value)}})}),Of=p.forwardRef((t,e)=>{let{children:r,label:n="Suggestions",...a}=t,o=p.useRef(null),l=p.useRef(null),i=jt();return p.useEffect(()=>{if(l.current&&o.current){let s=l.current,c=o.current,u,d=new ResizeObserver(()=>{u=requestAnimationFrame(()=>{let h=s.offsetHeight;c.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return d.observe(s),()=>{cancelAnimationFrame(u),d.unobserve(s)}}},[]),p.createElement(Ee.div,{ref:Rt([o,e]),...a,"cmdk-list":"",role:"listbox","aria-label":n,id:i.listId},ir(t,s=>p.createElement("div",{ref:Rt([l,i.listInnerRef]),"cmdk-list-sizer":""},s)))}),Gf=p.forwardRef((t,e)=>{let{open:r,onOpenChange:n,overlayClassName:a,contentClassName:o,container:l,...i}=t;return p.createElement(wa,{open:r,onOpenChange:n},p.createElement(va,{container:l},p.createElement(xn,{"cmdk-overlay":"",className:a}),p.createElement(Sn,{"aria-label":t.label,"cmdk-dialog":"",className:o},p.createElement(Cs,{ref:e,...i}))))}),Ff=p.forwardRef((t,e)=>pt(r=>r.filtered.count===0)?p.createElement(Ee.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),$f=p.forwardRef((t,e)=>{let{progress:r,children:n,label:a="Loading...",...o}=t;return p.createElement(Ee.div,{ref:e,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},ir(t,l=>p.createElement("div",{"aria-hidden":!0},l)))}),je=Object.assign(Cs,{List:Of,Item:Nf,Input:Df,Group:Pf,Separator:zf,Dialog:Gf,Empty:Ff,Loading:$f});function Mf(t,e){let r=t.nextElementSibling;for(;r;){if(r.matches(e))return r;r=r.nextElementSibling}}function Hf(t,e){let r=t.previousElementSibling;for(;r;){if(r.matches(e))return r;r=r.previousElementSibling}}function ks(t){let e=p.useRef(t);return gt(()=>{e.current=t}),e}var gt=typeof window>"u"?p.useEffect:p.useLayoutEffect;function yt(t){let e=p.useRef();return e.current===void 0&&(e.current=t()),e}function Rt(t){return e=>{t.forEach(r=>{typeof r=="function"?r(e):r!=null&&(r.current=e)})}}function pt(t){let e=Nn(),r=()=>t(e.snapshot());return jf.useSyncExternalStore(e.subscribe,r,r)}function Ts(t,e,r,n=[]){let a=p.useRef(),o=jt();return gt(()=>{var l;let i=(()=>{var c;for(let u of r){if(typeof u=="string")return u.trim();if(typeof u=="object"&&"current"in u)return u.current?(c=u.current.textContent)==null?void 0:c.trim():a.current}})(),s=n.map(c=>c.trim());o.value(t,i,s),(l=e.current)==null||l.setAttribute(dt,i),a.current=i}),a}var Bf=()=>{let[t,e]=p.useState(),r=yt(()=>new Map);return gt(()=>{r.current.forEach(n=>n()),r.current=new Map},[t]),(n,a)=>{r.current.set(n,a),e({})}};function Vf(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function ir({asChild:t,children:e},r){return t&&p.isValidElement(e)?p.cloneElement(Vf(e),{ref:e.ref},r(e.props.children)):r(e)}var Uf={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const lr=p.forwardRef(({className:t,...e},r)=>g.jsx(je,{ref:r,className:fe("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",t),...e}));lr.displayName=je.displayName;const Pn=p.forwardRef(({className:t,...e},r)=>g.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[g.jsx(yu,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),g.jsx(je.Input,{ref:r,className:fe("placeholder:text-muted-foreground flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));Pn.displayName=je.Input.displayName;const cr=p.forwardRef(({className:t,...e},r)=>g.jsx(je.List,{ref:r,className:fe("max-h-[300px] overflow-x-hidden overflow-y-auto",t),...e}));cr.displayName=je.List.displayName;const zn=p.forwardRef((t,e)=>g.jsx(je.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));zn.displayName=je.Empty.displayName;const _t=p.forwardRef(({className:t,...e},r)=>g.jsx(je.Group,{ref:r,className:fe("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",t),...e}));_t.displayName=je.Group.displayName;const qf=p.forwardRef(({className:t,...e},r)=>g.jsx(je.Separator,{ref:r,className:fe("bg-border -mx-1 h-px",t),...e}));qf.displayName=je.Separator.displayName;const Ct=p.forwardRef(({className:t,...e},r)=>g.jsx(je.Item,{ref:r,className:fe("data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...e}));Ct.displayName=je.Item.displayName;const Wf=({layout:t,autoRunFor:e,mainLayout:r})=>{const n=Be(),[a,o]=p.useState(!1),l=p.useRef(null),{t:i}=xe(),s=p.useCallback(()=>{if(n)try{const u=n.getGraph();if(!u||u.order===0)return;const d=r.positions();ha(u,d,{duration:300})}catch(u){console.error("Error updating positions:",u),l.current&&(window.clearInterval(l.current),l.current=null,o(!1))}},[n,r]),c=p.useCallback(()=>{if(a){console.log("Stopping layout animation"),l.current&&(window.clearInterval(l.current),l.current=null);try{typeof t.kill=="function"?(t.kill(),console.log("Layout algorithm killed")):typeof t.stop=="function"&&(t.stop(),console.log("Layout algorithm stopped"))}catch(u){console.error("Error stopping layout algorithm:",u)}o(!1)}else console.log("Starting layout animation"),s(),l.current=window.setInterval(()=>{s()},200),o(!0),setTimeout(()=>{if(l.current){console.log("Auto-stopping layout animation after 3 seconds"),window.clearInterval(l.current),l.current=null,o(!1);try{typeof t.kill=="function"?t.kill():typeof t.stop=="function"&&t.stop()}catch(u){console.error("Error stopping layout algorithm:",u)}}},3e3)},[a,t,s]);return p.useEffect(()=>{if(!n){console.log("No sigma instance available");return}let u=null;return e!==void 0&&e>-1&&n.getGraph().order>0&&(console.log("Auto-starting layout animation"),s(),l.current=window.setInterval(()=>{s()},200),o(!0),e>0&&(u=window.setTimeout(()=>{console.log("Auto-stopping layout animation after timeout"),l.current&&(window.clearInterval(l.current),l.current=null),o(!1)},e))),()=>{l.current&&(window.clearInterval(l.current),l.current=null),u&&window.clearTimeout(u),o(!1)}},[e,n,s]),g.jsx(be,{size:"icon",onClick:c,tooltip:i(a?"graphPanel.sideBar.layoutsControl.stopAnimation":"graphPanel.sideBar.layoutsControl.startAnimation"),variant:Le,children:a?g.jsx(ou,{}):g.jsx(lu,{})})},Xf=()=>{const t=Be(),{t:e}=xe(),[r,n]=p.useState("Circular"),[a,o]=p.useState(!1),l=re.use.graphLayoutMaxIterations(),i=$d(),s=Dd(),c=yf(),u=hf({maxIterations:l,settings:{margin:5,expansion:1.1,gridSize:1,ratio:1,speed:3}}),d=Wd({maxIterations:l,settings:{attraction:3e-4,repulsion:.02,gravity:.02,inertia:.4,maxMove:100}}),h=ys({iterations:l}),f=gf(),b=Xd(),y=nf(),T=p.useMemo(()=>({Circular:{layout:i},Circlepack:{layout:s},Random:{layout:c},Noverlaps:{layout:u,worker:f},"Force Directed":{layout:d,worker:b},"Force Atlas":{layout:h,worker:y}}),[s,i,d,h,u,c,b,f,y]),N=p.useCallback(_=>{console.debug("Running layout:",_);const{positions:A}=T[_].layout;try{const R=t.getGraph();if(!R){console.error("No graph available");return}const I=A();console.log("Positions calculated, animating nodes"),ha(R,I,{duration:400}),n(_)}catch(R){console.error("Error running layout:",R)}},[T,t]);return g.jsxs("div",{children:[g.jsx("div",{children:T[r]&&"worker"in T[r]&&g.jsx(Wf,{layout:T[r].worker,mainLayout:T[r].layout})}),g.jsx("div",{children:g.jsxs(Tn,{open:a,onOpenChange:o,children:[g.jsx(Rn,{asChild:!0,children:g.jsx(be,{size:"icon",variant:Le,onClick:()=>o(_=>!_),tooltip:e("graphPanel.sideBar.layoutsControl.layoutGraph"),children:g.jsx(Xc,{})})}),g.jsx(sr,{side:"right",align:"start",sideOffset:8,collisionPadding:5,sticky:"always",className:"p-1 min-w-auto",children:g.jsx(lr,{children:g.jsx(cr,{children:g.jsx(_t,{children:Object.keys(T).map(_=>g.jsx(Ct,{onSelect:()=>{N(_)},className:"cursor-pointer text-xs",children:e(`graphPanel.sideBar.layoutsControl.layouts.${_}`)},_))})})})})]})})]})},Yf=()=>{const t=p.useContext(Ra);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},zt=t=>!!(t.type.startsWith("mouse")&&t.buttons!==0),Kf=({disableHoverEffect:t})=>{const e=Be(),r=ga(),n=bi(),a=re.use.graphLayoutMaxIterations(),{assign:o}=ys({iterations:a}),{theme:l}=Yf(),i=re.use.enableHideUnselectedEdges(),s=re.use.enableEdgeEvents(),c=re.use.showEdgeLabel(),u=re.use.showNodeLabel(),d=re.use.minEdgeSize(),h=re.use.maxEdgeSize(),f=ee.use.selectedNode(),b=ee.use.focusedNode(),y=ee.use.selectedEdge(),T=ee.use.focusedEdge(),N=ee.use.sigmaGraph();return p.useEffect(()=>{if(N&&e){try{typeof e.setGraph=="function"?(e.setGraph(N),console.log("Binding graph to sigma instance")):(e.graph=N,console.warn("Simgma missing setGraph function, set graph property directly"))}catch(_){console.error("Error setting graph on sigma instance:",_)}o(),console.log("Initial layout applied to graph")}},[e,N,o,a]),p.useEffect(()=>{e&&(ee.getState().sigmaInstance||(console.log("Setting sigma instance from GraphControl"),ee.getState().setSigmaInstance(e)))},[e]),p.useEffect(()=>{const{setFocusedNode:_,setSelectedNode:A,setFocusedEdge:R,setSelectedEdge:I,clearSelection:D}=ee.getState(),m={enterNode:E=>{zt(E.event.original)||e.getGraph().hasNode(E.node)&&_(E.node)},leaveNode:E=>{zt(E.event.original)||_(null)},clickNode:E=>{e.getGraph().hasNode(E.node)&&(A(E.node),I(null))},clickStage:()=>D()};s&&(m.clickEdge=E=>{I(E.edge),A(null)},m.enterEdge=E=>{zt(E.event.original)||R(E.edge)},m.leaveEdge=E=>{zt(E.event.original)||R(null)}),r(m)},[r,s]),p.useEffect(()=>{if(e&&N){const _=e.getGraph();let A=Number.MAX_SAFE_INTEGER,R=0;_.forEachEdge(D=>{const m=_.getEdgeAttribute(D,"originalWeight")||1;typeof m=="number"&&(A=Math.min(A,m),R=Math.max(R,m))});const I=R-A;if(I>0){const D=h-d;_.forEachEdge(m=>{const E=_.getEdgeAttribute(m,"originalWeight")||1;if(typeof E=="number"){const x=d+D*Math.pow((E-A)/I,.5);_.setEdgeAttribute(m,"size",x)}})}else _.forEachEdge(D=>{_.setEdgeAttribute(D,"size",d)});e.refresh()}},[e,N,d,h]),p.useEffect(()=>{const _=l==="dark",A=_?Vi:void 0,R=_?Xi:void 0;n({enableEdgeEvents:s,renderEdgeLabels:c,renderLabels:u,nodeReducer:(I,D)=>{const m=e.getGraph(),E={...D,highlighted:D.highlighted||!1,labelColor:A};if(!t){E.highlighted=!1;const x=b||f,k=T||y;if(x&&m.hasNode(x))try{(I===x||m.neighbors(x).includes(I))&&(E.highlighted=!0,I===f&&(E.borderColor=Wi))}catch(L){console.error("Error in nodeReducer:",L)}else if(k&&m.hasEdge(k))m.extremities(k).includes(I)&&(E.highlighted=!0,E.size=3);else return E;E.highlighted?_&&(E.labelColor=Ui):E.color=qi}return E},edgeReducer:(I,D)=>{const m=e.getGraph(),E={...D,hidden:!1,labelColor:A,color:R};if(!t){const x=b||f;if(x&&m.hasNode(x))try{i?m.extremities(I).includes(x)||(E.hidden=!0):m.extremities(I).includes(x)&&(E.color=Wn)}catch(k){console.error("Error in edgeReducer:",k)}else{const k=y&&m.hasEdge(y)?y:null,L=T&&m.hasEdge(T)?T:null;(k||L)&&(I===k?E.color=Yi:I===L?E.color=Wn:i&&(E.hidden=!0))}}return E}})},[f,b,y,T,n,e,t,l,i,s,c,u]),null},Qf=()=>{const{zoomIn:t,zoomOut:e,reset:r}=da({duration:200,factor:1.5}),n=Be(),{t:a}=xe(),o=p.useCallback(()=>t(),[t]),l=p.useCallback(()=>e(),[e]),i=p.useCallback(()=>{if(n)try{n.setCustomBBox(null),n.refresh();const u=n.getGraph();if(!(u!=null&&u.order)||u.nodes().length===0){r();return}n.getCamera().animate({x:.5,y:.5,ratio:1.1},{duration:1e3})}catch(u){console.error("Error resetting zoom:",u),r()}},[n,r]),s=p.useCallback(()=>{if(!n)return;const u=n.getCamera(),h=u.angle+Math.PI/8;u.animate({angle:h},{duration:200})},[n]),c=p.useCallback(()=>{if(!n)return;const u=n.getCamera(),h=u.angle-Math.PI/8;u.animate({angle:h},{duration:200})},[n]);return g.jsxs(g.Fragment,{children:[g.jsx(be,{variant:Le,onClick:s,tooltip:a("graphPanel.sideBar.zoomControl.rotateCamera"),size:"icon",children:g.jsx(gu,{})}),g.jsx(be,{variant:Le,onClick:c,tooltip:a("graphPanel.sideBar.zoomControl.rotateCameraCounterClockwise"),size:"icon",children:g.jsx(fu,{})}),g.jsx(be,{variant:Le,onClick:i,tooltip:a("graphPanel.sideBar.zoomControl.resetZoom"),size:"icon",children:g.jsx(Bc,{})}),g.jsx(be,{variant:Le,onClick:o,tooltip:a("graphPanel.sideBar.zoomControl.zoomIn"),size:"icon",children:g.jsx(Au,{})}),g.jsx(be,{variant:Le,onClick:l,tooltip:a("graphPanel.sideBar.zoomControl.zoomOut"),size:"icon",children:g.jsx(Iu,{})})]})},Jf=()=>{const{isFullScreen:t,toggle:e}=wi(),{t:r}=xe();return g.jsx(g.Fragment,{children:t?g.jsx(be,{variant:Le,onClick:e,tooltip:r("graphPanel.sideBar.fullScreenControl.windowed"),size:"icon",children:g.jsx(tu,{})}):g.jsx(be,{variant:Le,onClick:e,tooltip:r("graphPanel.sideBar.fullScreenControl.fullScreen"),size:"icon",children:g.jsx(Zc,{})})})};var Dn="Checkbox",[Zf,jp]=wn(Dn),[eh,th]=Zf(Dn),Rs=p.forwardRef((t,e)=>{const{__scopeCheckbox:r,name:n,checked:a,defaultChecked:o,required:l,disabled:i,value:s="on",onCheckedChange:c,form:u,...d}=t,[h,f]=p.useState(null),b=Xe(e,R=>f(R)),y=p.useRef(!1),T=h?u||!!h.closest("form"):!0,[N=!1,_]=ma({prop:a,defaultProp:o,onChange:c}),A=p.useRef(N);return p.useEffect(()=>{const R=h==null?void 0:h.form;if(R){const I=()=>_(A.current);return R.addEventListener("reset",I),()=>R.removeEventListener("reset",I)}},[h,_]),g.jsxs(eh,{scope:r,state:N,disabled:i,children:[g.jsx(Ee.button,{type:"button",role:"checkbox","aria-checked":ot(N)?"mixed":N,"aria-required":l,"data-state":Is(N),"data-disabled":i?"":void 0,disabled:i,value:s,...d,ref:b,onKeyDown:Ce(t.onKeyDown,R=>{R.key==="Enter"&&R.preventDefault()}),onClick:Ce(t.onClick,R=>{_(I=>ot(I)?!0:!I),T&&(y.current=R.isPropagationStopped(),y.current||R.stopPropagation())})}),T&&g.jsx(rh,{control:h,bubbles:!y.current,name:n,value:s,checked:N,required:l,disabled:i,form:u,style:{transform:"translateX(-100%)"},defaultChecked:ot(o)?!1:o})]})});Rs.displayName=Dn;var As="CheckboxIndicator",js=p.forwardRef((t,e)=>{const{__scopeCheckbox:r,forceMount:n,...a}=t,o=th(As,r);return g.jsx(St,{present:n||ot(o.state)||o.state===!0,children:g.jsx(Ee.span,{"data-state":Is(o.state),"data-disabled":o.disabled?"":void 0,...a,ref:e,style:{pointerEvents:"none",...t.style}})})});js.displayName=As;var rh=t=>{const{control:e,checked:r,bubbles:n=!0,defaultChecked:a,...o}=t,l=p.useRef(null),i=Oi(r),s=Gi(e);p.useEffect(()=>{const u=l.current,d=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(d,"checked").set;if(i!==r&&f){const b=new Event("click",{bubbles:n});u.indeterminate=ot(r),f.call(u,ot(r)?!1:r),u.dispatchEvent(b)}},[i,r,n]);const c=p.useRef(ot(r)?!1:r);return g.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a??c.current,...o,tabIndex:-1,ref:l,style:{...t.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function ot(t){return t==="indeterminate"}function Is(t){return ot(t)?"indeterminate":t?"checked":"unchecked"}var Ls=Rs,nh=js;const Ns=p.forwardRef(({className:t,...e},r)=>g.jsx(Ls,{ref:r,className:fe("peer border-primary ring-offset-background focus-visible:ring-ring data-[state=checked]:bg-muted data-[state=checked]:text-muted-foreground h-4 w-4 shrink-0 rounded-sm border focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:g.jsx(nh,{className:fe("flex items-center justify-center text-current"),children:g.jsx(Va,{className:"h-4 w-4"})})}));Ns.displayName=Ls.displayName;var oh="Separator",Ho="horizontal",ah=["horizontal","vertical"],Ps=p.forwardRef((t,e)=>{const{decorative:r,orientation:n=Ho,...a}=t,o=sh(n)?n:Ho,i=r?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return g.jsx(Ee.div,{"data-orientation":o,...i,...a,ref:e})});Ps.displayName=oh;function sh(t){return ah.includes(t)}var zs=Ps;const bt=p.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...n},a)=>g.jsx(zs,{ref:a,decorative:r,orientation:e,className:fe("bg-border shrink-0",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...n}));bt.displayName=zs.displayName;const tt=({checked:t,onCheckedChange:e,label:r})=>{const n=`checkbox-${r.toLowerCase().replace(/\s+/g,"-")}`;return g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Ns,{id:n,checked:t,onCheckedChange:e}),g.jsx("label",{htmlFor:n,className:"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:r})]})},$r=({value:t,onEditFinished:e,label:r,min:n,max:a,defaultValue:o})=>{const{t:l}=xe(),[i,s]=p.useState(t),c=`input-${r.toLowerCase().replace(/\s+/g,"-")}`,u=p.useCallback(f=>{const b=f.target.value.trim();if(b.length===0){s(null);return}const y=Number.parseInt(b);if(!isNaN(y)&&y!==i){if(n!==void 0&&y<n||a!==void 0&&y>a)return;s(y)}},[i,n,a]),d=p.useCallback(()=>{i!==null&&t!==i&&e(i)},[t,i,e]),h=p.useCallback(()=>{o!==void 0&&t!==o&&(s(o),e(o))},[o,t,e]);return g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx("label",{htmlFor:c,className:"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:r}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(qt,{id:c,type:"number",value:i===null?"":i,onChange:u,className:"h-6 w-full min-w-0 pr-1",min:n,max:a,onBlur:d,onKeyDown:f=>{f.key==="Enter"&&d()}}),o!==void 0&&g.jsx(be,{variant:"ghost",size:"icon",className:"h-6 w-6 flex-shrink-0 hover:bg-muted text-muted-foreground hover:text-foreground",onClick:h,type:"button",title:l("graphPanel.sideBar.settings.resetToDefault"),children:g.jsx(qa,{className:"h-3.5 w-3.5"})})]})]})};function ih(){const[t,e]=p.useState(!1),r=re.use.showPropertyPanel(),n=re.use.showNodeSearchBar(),a=re.use.showNodeLabel(),o=re.use.enableEdgeEvents(),l=re.use.enableNodeDrag(),i=re.use.enableHideUnselectedEdges(),s=re.use.showEdgeLabel(),c=re.use.minEdgeSize(),u=re.use.maxEdgeSize(),d=re.use.graphQueryMaxDepth(),h=re.use.graphMaxNodes(),f=re.use.graphLayoutMaxIterations(),b=re.use.enableHealthCheck(),y=p.useCallback(()=>re.setState(j=>({enableNodeDrag:!j.enableNodeDrag})),[]),T=p.useCallback(()=>re.setState(j=>({enableEdgeEvents:!j.enableEdgeEvents})),[]),N=p.useCallback(()=>re.setState(j=>({enableHideUnselectedEdges:!j.enableHideUnselectedEdges})),[]),_=p.useCallback(()=>re.setState(j=>({showEdgeLabel:!j.showEdgeLabel})),[]),A=p.useCallback(()=>re.setState(j=>({showPropertyPanel:!j.showPropertyPanel})),[]),R=p.useCallback(()=>re.setState(j=>({showNodeSearchBar:!j.showNodeSearchBar})),[]),I=p.useCallback(()=>re.setState(j=>({showNodeLabel:!j.showNodeLabel})),[]),D=p.useCallback(()=>re.setState(j=>({enableHealthCheck:!j.enableHealthCheck})),[]),m=p.useCallback(j=>{if(j<1)return;re.setState({graphQueryMaxDepth:j});const w=re.getState().queryLabel;re.getState().setQueryLabel(""),setTimeout(()=>{re.getState().setQueryLabel(w)},300)},[]),E=p.useCallback(j=>{if(j<1||j>1e3)return;re.setState({graphMaxNodes:j});const w=re.getState().queryLabel;re.getState().setQueryLabel(""),setTimeout(()=>{re.getState().setQueryLabel(w)},300)},[]),x=p.useCallback(j=>{j<1||re.setState({graphLayoutMaxIterations:j})},[]),{t:k}=xe(),L=()=>e(!1);return g.jsx(g.Fragment,{children:g.jsxs(Tn,{open:t,onOpenChange:e,children:[g.jsx(Rn,{asChild:!0,children:g.jsx(be,{variant:Le,tooltip:k("graphPanel.sideBar.settings.settings"),size:"icon",children:g.jsx(xu,{})})}),g.jsx(sr,{side:"right",align:"end",sideOffset:8,collisionPadding:5,className:"p-2 max-w-[200px]",onCloseAutoFocus:j=>j.preventDefault(),children:g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx(tt,{checked:b,onCheckedChange:D,label:k("graphPanel.sideBar.settings.healthCheck")}),g.jsx(bt,{}),g.jsx(tt,{checked:r,onCheckedChange:A,label:k("graphPanel.sideBar.settings.showPropertyPanel")}),g.jsx(tt,{checked:n,onCheckedChange:R,label:k("graphPanel.sideBar.settings.showSearchBar")}),g.jsx(bt,{}),g.jsx(tt,{checked:a,onCheckedChange:I,label:k("graphPanel.sideBar.settings.showNodeLabel")}),g.jsx(tt,{checked:l,onCheckedChange:y,label:k("graphPanel.sideBar.settings.nodeDraggable")}),g.jsx(bt,{}),g.jsx(tt,{checked:s,onCheckedChange:_,label:k("graphPanel.sideBar.settings.showEdgeLabel")}),g.jsx(tt,{checked:i,onCheckedChange:N,label:k("graphPanel.sideBar.settings.hideUnselectedEdges")}),g.jsx(tt,{checked:o,onCheckedChange:T,label:k("graphPanel.sideBar.settings.edgeEvents")}),g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx("label",{htmlFor:"edge-size-min",className:"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:k("graphPanel.sideBar.settings.edgeSizeRange")}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(qt,{id:"edge-size-min",type:"number",value:c,onChange:j=>{const w=Number(j.target.value);!isNaN(w)&&w>=1&&w<=u&&re.setState({minEdgeSize:w})},className:"h-6 w-16 min-w-0 pr-1",min:1,max:Math.min(u,10)}),g.jsx("span",{children:"-"}),g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(qt,{id:"edge-size-max",type:"number",value:u,onChange:j=>{const w=Number(j.target.value);!isNaN(w)&&w>=c&&w>=1&&w<=10&&re.setState({maxEdgeSize:w})},className:"h-6 w-16 min-w-0 pr-1",min:c,max:10}),g.jsx(be,{variant:"ghost",size:"icon",className:"h-6 w-6 flex-shrink-0 hover:bg-muted text-muted-foreground hover:text-foreground",onClick:()=>re.setState({minEdgeSize:1,maxEdgeSize:5}),type:"button",title:k("graphPanel.sideBar.settings.resetToDefault"),children:g.jsx(qa,{className:"h-3.5 w-3.5"})})]})]})]}),g.jsx(bt,{}),g.jsx($r,{label:k("graphPanel.sideBar.settings.maxQueryDepth"),min:1,value:d,defaultValue:3,onEditFinished:m}),g.jsx($r,{label:k("graphPanel.sideBar.settings.maxNodes"),min:1,max:1e3,value:h,defaultValue:1e3,onEditFinished:E}),g.jsx($r,{label:k("graphPanel.sideBar.settings.maxLayoutIterations"),min:1,max:30,value:f,defaultValue:15,onEditFinished:x}),g.jsx(bt,{}),g.jsx(be,{onClick:L,variant:"outline",size:"sm",className:"ml-auto px-4",children:k("graphPanel.sideBar.settings.save")})]})})]})})}const lh="ENTRIES",Ds="KEYS",Os="VALUES",Se="";class Mr{constructor(e,r){const n=e._tree,a=Array.from(n.keys());this.set=e,this._type=r,this._path=a.length>0?[{node:n,keys:a}]:[]}next(){const e=this.dive();return this.backtrack(),e}dive(){if(this._path.length===0)return{done:!0,value:void 0};const{node:e,keys:r}=mt(this._path);if(mt(r)===Se)return{done:!1,value:this.result()};const n=e.get(mt(r));return this._path.push({node:n,keys:Array.from(n.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;const e=mt(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map(({keys:e})=>mt(e)).filter(e=>e!==Se).join("")}value(){return mt(this._path).node.get(Se)}result(){switch(this._type){case Os:return this.value();case Ds:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}}const mt=t=>t[t.length-1],ch=(t,e,r)=>{const n=new Map;if(e===void 0)return n;const a=e.length+1,o=a+r,l=new Uint8Array(o*a).fill(r+1);for(let i=0;i<a;++i)l[i]=i;for(let i=1;i<o;++i)l[i*a]=i;return Gs(t,e,r,n,l,1,a,""),n},Gs=(t,e,r,n,a,o,l,i)=>{const s=o*l;e:for(const c of t.keys())if(c===Se){const u=a[s-1];u<=r&&n.set(i,[t.get(c),u])}else{let u=o;for(let d=0;d<c.length;++d,++u){const h=c[d],f=l*u,b=f-l;let y=a[f];const T=Math.max(0,u-r-1),N=Math.min(l-1,u+r);for(let _=T;_<N;++_){const A=h!==e[_],R=a[b+_]+ +A,I=a[b+_+1]+1,D=a[f+_]+1,m=a[f+_+1]=Math.min(R,I,D);m<y&&(y=m)}if(y>r)continue e}Gs(t.get(c),e,r,n,a,u,l,i+c)}};class nt{constructor(e=new Map,r=""){this._size=void 0,this._tree=e,this._prefix=r}atPrefix(e){if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");const[r,n]=Kt(this._tree,e.slice(this._prefix.length));if(r===void 0){const[a,o]=On(n);for(const l of a.keys())if(l!==Se&&l.startsWith(o)){const i=new Map;return i.set(l.slice(o.length),a.get(l)),new nt(i,e)}}return new nt(r,e)}clear(){this._size=void 0,this._tree.clear()}delete(e){return this._size=void 0,uh(this._tree,e)}entries(){return new Mr(this,lh)}forEach(e){for(const[r,n]of this)e(r,n,this)}fuzzyGet(e,r){return ch(this._tree,e,r)}get(e){const r=gn(this._tree,e);return r!==void 0?r.get(Se):void 0}has(e){const r=gn(this._tree,e);return r!==void 0&&r.has(Se)}keys(){return new Mr(this,Ds)}set(e,r){if(typeof e!="string")throw new Error("key must be a string");return this._size=void 0,Hr(this._tree,e).set(Se,r),this}get size(){if(this._size)return this._size;this._size=0;const e=this.entries();for(;!e.next().done;)this._size+=1;return this._size}update(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;const n=Hr(this._tree,e);return n.set(Se,r(n.get(Se))),this}fetch(e,r){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;const n=Hr(this._tree,e);let a=n.get(Se);return a===void 0&&n.set(Se,a=r()),a}values(){return new Mr(this,Os)}[Symbol.iterator](){return this.entries()}static from(e){const r=new nt;for(const[n,a]of e)r.set(n,a);return r}static fromObject(e){return nt.from(Object.entries(e))}}const Kt=(t,e,r=[])=>{if(e.length===0||t==null)return[t,r];for(const n of t.keys())if(n!==Se&&e.startsWith(n))return r.push([t,n]),Kt(t.get(n),e.slice(n.length),r);return r.push([t,e]),Kt(void 0,"",r)},gn=(t,e)=>{if(e.length===0||t==null)return t;for(const r of t.keys())if(r!==Se&&e.startsWith(r))return gn(t.get(r),e.slice(r.length))},Hr=(t,e)=>{const r=e.length;e:for(let n=0;t&&n<r;){for(const o of t.keys())if(o!==Se&&e[n]===o[0]){const l=Math.min(r-n,o.length);let i=1;for(;i<l&&e[n+i]===o[i];)++i;const s=t.get(o);if(i===o.length)t=s;else{const c=new Map;c.set(o.slice(i),s),t.set(e.slice(n,n+i),c),t.delete(o),t=c}n+=i;continue e}const a=new Map;return t.set(e.slice(n),a),a}return t},uh=(t,e)=>{const[r,n]=Kt(t,e);if(r!==void 0){if(r.delete(Se),r.size===0)Fs(n);else if(r.size===1){const[a,o]=r.entries().next().value;$s(n,a,o)}}},Fs=t=>{if(t.length===0)return;const[e,r]=On(t);if(e.delete(r),e.size===0)Fs(t.slice(0,-1));else if(e.size===1){const[n,a]=e.entries().next().value;n!==Se&&$s(t.slice(0,-1),n,a)}},$s=(t,e,r)=>{if(t.length===0)return;const[n,a]=On(t);n.set(a+e,r),n.delete(a)},On=t=>t[t.length-1],Gn="or",Ms="and",dh="and_not";class at{constructor(e){if((e==null?void 0:e.fields)==null)throw new Error('MiniSearch: option "fields" must be provided');const r=e.autoVacuum==null||e.autoVacuum===!0?Ur:e.autoVacuum;this._options={...Vr,...e,autoVacuum:r,searchOptions:{...Bo,...e.searchOptions||{}},autoSuggestOptions:{...mh,...e.autoSuggestOptions||{}}},this._index=new nt,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=mn,this.addFields(this._options.fields)}add(e){const{extractField:r,tokenize:n,processTerm:a,fields:o,idField:l}=this._options,i=r(e,l);if(i==null)throw new Error(`MiniSearch: document does not have ID field "${l}"`);if(this._idToShortId.has(i))throw new Error(`MiniSearch: duplicate ID ${i}`);const s=this.addDocumentId(i);this.saveStoredFields(s,e);for(const c of o){const u=r(e,c);if(u==null)continue;const d=n(u.toString(),c),h=this._fieldIds[c],f=new Set(d).size;this.addFieldLength(s,h,this._documentCount-1,f);for(const b of d){const y=a(b,c);if(Array.isArray(y))for(const T of y)this.addTerm(h,s,T);else y&&this.addTerm(h,s,y)}}}addAll(e){for(const r of e)this.add(r)}addAllAsync(e,r={}){const{chunkSize:n=10}=r,a={chunk:[],promise:Promise.resolve()},{chunk:o,promise:l}=e.reduce(({chunk:i,promise:s},c,u)=>(i.push(c),(u+1)%n===0?{chunk:[],promise:s.then(()=>new Promise(d=>setTimeout(d,0))).then(()=>this.addAll(i))}:{chunk:i,promise:s}),a);return l.then(()=>this.addAll(o))}remove(e){const{tokenize:r,processTerm:n,extractField:a,fields:o,idField:l}=this._options,i=a(e,l);if(i==null)throw new Error(`MiniSearch: document does not have ID field "${l}"`);const s=this._idToShortId.get(i);if(s==null)throw new Error(`MiniSearch: cannot remove document with ID ${i}: it is not in the index`);for(const c of o){const u=a(e,c);if(u==null)continue;const d=r(u.toString(),c),h=this._fieldIds[c],f=new Set(d).size;this.removeFieldLength(s,h,this._documentCount,f);for(const b of d){const y=n(b,c);if(Array.isArray(y))for(const T of y)this.removeTerm(h,s,T);else y&&this.removeTerm(h,s,y)}}this._storedFields.delete(s),this._documentIds.delete(s),this._idToShortId.delete(i),this._fieldLength.delete(s),this._documentCount-=1}removeAll(e){if(e)for(const r of e)this.remove(r);else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new nt,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}}discard(e){const r=this._idToShortId.get(e);if(r==null)throw new Error(`MiniSearch: cannot discard document with ID ${e}: it is not in the index`);this._idToShortId.delete(e),this._documentIds.delete(r),this._storedFields.delete(r),(this._fieldLength.get(r)||[]).forEach((n,a)=>{this.removeFieldLength(r,a,this._documentCount,n)}),this._fieldLength.delete(r),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()}maybeAutoVacuum(){if(this._options.autoVacuum===!1)return;const{minDirtFactor:e,minDirtCount:r,batchSize:n,batchWait:a}=this._options.autoVacuum;this.conditionalVacuum({batchSize:n,batchWait:a},{minDirtCount:r,minDirtFactor:e})}discardAll(e){const r=this._options.autoVacuum;try{this._options.autoVacuum=!1;for(const n of e)this.discard(n)}finally{this._options.autoVacuum=r}this.maybeAutoVacuum()}replace(e){const{idField:r,extractField:n}=this._options,a=n(e,r);this.discard(a),this.add(e)}vacuum(e={}){return this.conditionalVacuum(e)}conditionalVacuum(e,r){return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&r,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(()=>{const n=this._enqueuedVacuumConditions;return this._enqueuedVacuumConditions=mn,this.performVacuuming(e,n)}),this._enqueuedVacuum)):this.vacuumConditionsMet(r)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)}async performVacuuming(e,r){const n=this._dirtCount;if(this.vacuumConditionsMet(r)){const a=e.batchSize||pn.batchSize,o=e.batchWait||pn.batchWait;let l=1;for(const[i,s]of this._index){for(const[c,u]of s)for(const[d]of u)this._documentIds.has(d)||(u.size<=1?s.delete(c):u.delete(d));this._index.get(i).size===0&&this._index.delete(i),l%a===0&&await new Promise(c=>setTimeout(c,o)),l+=1}this._dirtCount-=n}await null,this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null}vacuumConditionsMet(e){if(e==null)return!0;let{minDirtCount:r,minDirtFactor:n}=e;return r=r||Ur.minDirtCount,n=n||Ur.minDirtFactor,this.dirtCount>=r&&this.dirtFactor>=n}get isVacuuming(){return this._currentVacuum!=null}get dirtCount(){return this._dirtCount}get dirtFactor(){return this._dirtCount/(1+this._documentCount+this._dirtCount)}has(e){return this._idToShortId.has(e)}getStoredFields(e){const r=this._idToShortId.get(e);if(r!=null)return this._storedFields.get(r)}search(e,r={}){const{searchOptions:n}=this._options,a={...n,...r},o=this.executeQuery(e,r),l=[];for(const[i,{score:s,terms:c,match:u}]of o){const d=c.length||1,h={id:this._documentIds.get(i),score:s*d,terms:Object.keys(u),queryTerms:c,match:u};Object.assign(h,this._storedFields.get(i)),(a.filter==null||a.filter(h))&&l.push(h)}return e===at.wildcard&&a.boostDocument==null||l.sort(Uo),l}autoSuggest(e,r={}){r={...this._options.autoSuggestOptions,...r};const n=new Map;for(const{score:o,terms:l}of this.search(e,r)){const i=l.join(" "),s=n.get(i);s!=null?(s.score+=o,s.count+=1):n.set(i,{score:o,terms:l,count:1})}const a=[];for(const[o,{score:l,terms:i,count:s}]of n)a.push({suggestion:o,terms:i,score:l/s});return a.sort(Uo),a}get documentCount(){return this._documentCount}get termCount(){return this._index.size}static loadJSON(e,r){if(r==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(e),r)}static async loadJSONAsync(e,r){if(r==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJSAsync(JSON.parse(e),r)}static getDefault(e){if(Vr.hasOwnProperty(e))return Br(Vr,e);throw new Error(`MiniSearch: unknown option "${e}"`)}static loadJS(e,r){const{index:n,documentIds:a,fieldLength:o,storedFields:l,serializationVersion:i}=e,s=this.instantiateMiniSearch(e,r);s._documentIds=Dt(a),s._fieldLength=Dt(o),s._storedFields=Dt(l);for(const[c,u]of s._documentIds)s._idToShortId.set(u,c);for(const[c,u]of n){const d=new Map;for(const h of Object.keys(u)){let f=u[h];i===1&&(f=f.ds),d.set(parseInt(h,10),Dt(f))}s._index.set(c,d)}return s}static async loadJSAsync(e,r){const{index:n,documentIds:a,fieldLength:o,storedFields:l,serializationVersion:i}=e,s=this.instantiateMiniSearch(e,r);s._documentIds=await Ot(a),s._fieldLength=await Ot(o),s._storedFields=await Ot(l);for(const[u,d]of s._documentIds)s._idToShortId.set(d,u);let c=0;for(const[u,d]of n){const h=new Map;for(const f of Object.keys(d)){let b=d[f];i===1&&(b=b.ds),h.set(parseInt(f,10),await Ot(b))}++c%1e3===0&&await Hs(0),s._index.set(u,h)}return s}static instantiateMiniSearch(e,r){const{documentCount:n,nextId:a,fieldIds:o,averageFieldLength:l,dirtCount:i,serializationVersion:s}=e;if(s!==1&&s!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");const c=new at(r);return c._documentCount=n,c._nextId=a,c._idToShortId=new Map,c._fieldIds=o,c._avgFieldLength=l,c._dirtCount=i||0,c._index=new nt,c}executeQuery(e,r={}){if(e===at.wildcard)return this.executeWildcardQuery(r);if(typeof e!="string"){const h={...r,...e,queries:void 0},f=e.queries.map(b=>this.executeQuery(b,h));return this.combineResults(f,h.combineWith)}const{tokenize:n,processTerm:a,searchOptions:o}=this._options,l={tokenize:n,processTerm:a,...o,...r},{tokenize:i,processTerm:s}=l,d=i(e).flatMap(h=>s(h)).filter(h=>!!h).map(ph(l)).map(h=>this.executeQuerySpec(h,l));return this.combineResults(d,l.combineWith)}executeQuerySpec(e,r){const n={...this._options.searchOptions,...r},a=(n.fields||this._options.fields).reduce((y,T)=>({...y,[T]:Br(n.boost,T)||1}),{}),{boostDocument:o,weights:l,maxFuzzy:i,bm25:s}=n,{fuzzy:c,prefix:u}={...Bo.weights,...l},d=this._index.get(e.term),h=this.termResults(e.term,e.term,1,e.termBoost,d,a,o,s);let f,b;if(e.prefix&&(f=this._index.atPrefix(e.term)),e.fuzzy){const y=e.fuzzy===!0?.2:e.fuzzy,T=y<1?Math.min(i,Math.round(e.term.length*y)):y;T&&(b=this._index.fuzzyGet(e.term,T))}if(f)for(const[y,T]of f){const N=y.length-e.term.length;if(!N)continue;b==null||b.delete(y);const _=u*y.length/(y.length+.3*N);this.termResults(e.term,y,_,e.termBoost,T,a,o,s,h)}if(b)for(const y of b.keys()){const[T,N]=b.get(y);if(!N)continue;const _=c*y.length/(y.length+N);this.termResults(e.term,y,_,e.termBoost,T,a,o,s,h)}return h}executeWildcardQuery(e){const r=new Map,n={...this._options.searchOptions,...e};for(const[a,o]of this._documentIds){const l=n.boostDocument?n.boostDocument(o,"",this._storedFields.get(a)):1;r.set(a,{score:l,terms:[],match:{}})}return r}combineResults(e,r=Gn){if(e.length===0)return new Map;const n=r.toLowerCase(),a=fh[n];if(!a)throw new Error(`Invalid combination operator: ${r}`);return e.reduce(a)||new Map}toJSON(){const e=[];for(const[r,n]of this._index){const a={};for(const[o,l]of n)a[o]=Object.fromEntries(l);e.push([r,a])}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:e,serializationVersion:2}}termResults(e,r,n,a,o,l,i,s,c=new Map){if(o==null)return c;for(const u of Object.keys(l)){const d=l[u],h=this._fieldIds[u],f=o.get(h);if(f==null)continue;let b=f.size;const y=this._avgFieldLength[h];for(const T of f.keys()){if(!this._documentIds.has(T)){this.removeTerm(h,T,r),b-=1;continue}const N=i?i(this._documentIds.get(T),r,this._storedFields.get(T)):1;if(!N)continue;const _=f.get(T),A=this._fieldLength.get(T)[h],R=gh(_,b,this._documentCount,A,y,s),I=n*a*d*N*R,D=c.get(T);if(D){D.score+=I,vh(D.terms,e);const m=Br(D.match,r);m?m.push(u):D.match[r]=[u]}else c.set(T,{score:I,terms:[e],match:{[r]:[u]}})}}return c}addTerm(e,r,n){const a=this._index.fetch(n,qo);let o=a.get(e);if(o==null)o=new Map,o.set(r,1),a.set(e,o);else{const l=o.get(r);o.set(r,(l||0)+1)}}removeTerm(e,r,n){if(!this._index.has(n)){this.warnDocumentChanged(r,e,n);return}const a=this._index.fetch(n,qo),o=a.get(e);o==null||o.get(r)==null?this.warnDocumentChanged(r,e,n):o.get(r)<=1?o.size<=1?a.delete(e):o.delete(r):o.set(r,o.get(r)-1),this._index.get(n).size===0&&this._index.delete(n)}warnDocumentChanged(e,r,n){for(const a of Object.keys(this._fieldIds))if(this._fieldIds[a]===r){this._options.logger("warn",`MiniSearch: document with ID ${this._documentIds.get(e)} has changed before removal: term "${n}" was not present in field "${a}". Removing a document after it has changed can corrupt the index!`,"version_conflict");return}}addDocumentId(e){const r=this._nextId;return this._idToShortId.set(e,r),this._documentIds.set(r,e),this._documentCount+=1,this._nextId+=1,r}addFields(e){for(let r=0;r<e.length;r++)this._fieldIds[e[r]]=r}addFieldLength(e,r,n,a){let o=this._fieldLength.get(e);o==null&&this._fieldLength.set(e,o=[]),o[r]=a;const i=(this._avgFieldLength[r]||0)*n+a;this._avgFieldLength[r]=i/(n+1)}removeFieldLength(e,r,n,a){if(n===1){this._avgFieldLength[r]=0;return}const o=this._avgFieldLength[r]*n-a;this._avgFieldLength[r]=o/(n-1)}saveStoredFields(e,r){const{storeFields:n,extractField:a}=this._options;if(n==null||n.length===0)return;let o=this._storedFields.get(e);o==null&&this._storedFields.set(e,o={});for(const l of n){const i=a(r,l);i!==void 0&&(o[l]=i)}}}at.wildcard=Symbol("*");const Br=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0,fh={[Gn]:(t,e)=>{for(const r of e.keys()){const n=t.get(r);if(n==null)t.set(r,e.get(r));else{const{score:a,terms:o,match:l}=e.get(r);n.score=n.score+a,n.match=Object.assign(n.match,l),Vo(n.terms,o)}}return t},[Ms]:(t,e)=>{const r=new Map;for(const n of e.keys()){const a=t.get(n);if(a==null)continue;const{score:o,terms:l,match:i}=e.get(n);Vo(a.terms,l),r.set(n,{score:a.score+o,terms:a.terms,match:Object.assign(a.match,i)})}return r},[dh]:(t,e)=>{for(const r of e.keys())t.delete(r);return t}},hh={k:1.2,b:.7,d:.5},gh=(t,e,r,n,a,o)=>{const{k:l,b:i,d:s}=o;return Math.log(1+(r-e+.5)/(e+.5))*(s+t*(l+1)/(t+l*(1-i+i*n/a)))},ph=t=>(e,r,n)=>{const a=typeof t.fuzzy=="function"?t.fuzzy(e,r,n):t.fuzzy||!1,o=typeof t.prefix=="function"?t.prefix(e,r,n):t.prefix===!0,l=typeof t.boostTerm=="function"?t.boostTerm(e,r,n):1;return{term:e,fuzzy:a,prefix:o,termBoost:l}},Vr={idField:"id",extractField:(t,e)=>t[e],tokenize:t=>t.split(yh),processTerm:t=>t.toLowerCase(),fields:void 0,searchOptions:void 0,storeFields:[],logger:(t,e)=>{typeof(console==null?void 0:console[t])=="function"&&console[t](e)},autoVacuum:!0},Bo={combineWith:Gn,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:hh},mh={combineWith:Ms,prefix:(t,e,r)=>e===r.length-1},pn={batchSize:1e3,batchWait:10},mn={minDirtFactor:.1,minDirtCount:20},Ur={...pn,...mn},vh=(t,e)=>{t.includes(e)||t.push(e)},Vo=(t,e)=>{for(const r of e)t.includes(r)||t.push(r)},Uo=({score:t},{score:e})=>e-t,qo=()=>new Map,Dt=t=>{const e=new Map;for(const r of Object.keys(t))e.set(parseInt(r,10),t[r]);return e},Ot=async t=>{const e=new Map;let r=0;for(const n of Object.keys(t))e.set(parseInt(n,10),t[n]),++r%1e3===0&&await Hs(0);return e},Hs=t=>new Promise(e=>setTimeout(e,t)),yh=/[\n\r\p{Z}\p{P}]+/u,bh={index:new at({fields:[]})};p.createContext(bh);const vn=({label:t,color:e,hidden:r,labels:n={}})=>W.createElement("div",{className:"node"},W.createElement("span",{className:"render "+(r?"circle":"disc"),style:{backgroundColor:e||"#000"}}),W.createElement("span",{className:`label ${r?"text-muted":""} ${t?"":"text-italic"}`},t||n.no_label||"No label")),wh=({id:t,labels:e})=>{const r=Be(),n=p.useMemo(()=>{const a=r.getGraph().getNodeAttributes(t),o=r.getSetting("nodeReducer");return Object.assign(Object.assign({color:r.getSetting("defaultNodeColor")},a),o?o(t,a):{})},[r,t]);return W.createElement(vn,Object.assign({},n,{labels:e}))},xh=({label:t,color:e,source:r,target:n,hidden:a,directed:o,labels:l={}})=>W.createElement("div",{className:"edge"},W.createElement(vn,Object.assign({},r,{labels:l})),W.createElement("div",{className:"body"},W.createElement("div",{className:"render"},W.createElement("span",{className:a?"dotted":"dash",style:{borderColor:e||"#000"}})," ",o&&W.createElement("span",{className:"arrow",style:{borderTopColor:e||"#000"}})),W.createElement("span",{className:`label ${a?"text-muted":""} ${t?"":"fst-italic"}`},t||l.no_label||"No label")),W.createElement(vn,Object.assign({},n,{labels:l}))),Sh=({id:t,labels:e})=>{const r=Be(),n=p.useMemo(()=>{const a=r.getGraph().getEdgeAttributes(t),o=r.getSetting("nodeReducer"),l=r.getSetting("edgeReducer"),i=r.getGraph().getNodeAttributes(r.getGraph().source(t)),s=r.getGraph().getNodeAttributes(r.getGraph().target(t));return Object.assign(Object.assign(Object.assign({color:r.getSetting("defaultEdgeColor"),directed:r.getGraph().isDirected(t)},a),l?l(t,a):{}),{source:Object.assign(Object.assign({color:r.getSetting("defaultNodeColor")},i),o?o(t,i):{}),target:Object.assign(Object.assign({color:r.getSetting("defaultNodeColor")},s),o?o(t,s):{})})},[r,t]);return W.createElement(xh,Object.assign({},n,{labels:e}))};function Bs(t,e){const[r,n]=p.useState(t);return p.useEffect(()=>{const a=setTimeout(()=>{n(t)},e);return()=>{clearTimeout(a)}},[t,e]),r}function Eh({fetcher:t,preload:e,filterFn:r,renderOption:n,getOptionValue:a,notFound:o,loadingSkeleton:l,label:i,placeholder:s="Select...",value:c,onChange:u,onFocus:d,disabled:h=!1,className:f,noResultsMessage:b}){const[y,T]=p.useState(!1),[N,_]=p.useState(!1),[A,R]=p.useState([]),[I,D]=p.useState(!1),[m,E]=p.useState(null),[x,k]=p.useState(""),L=Bs(x,e?0:150),j=p.useRef(null);p.useEffect(()=>{T(!0)},[]),p.useEffect(()=>{const C=S=>{j.current&&!j.current.contains(S.target)&&N&&_(!1)};return document.addEventListener("mousedown",C),()=>{document.removeEventListener("mousedown",C)}},[N]);const w=p.useCallback(async C=>{try{D(!0),E(null);const S=await t(C);R(S)}catch(S){E(S instanceof Error?S.message:"Failed to fetch options")}finally{D(!1)}},[t]);p.useEffect(()=>{y&&(e?L&&R(C=>C.filter(S=>r?r(S,L):!0)):w(L))},[y,L,e,r,w]),p.useEffect(()=>{!y||!c||w(c)},[y,c,w]);const V=p.useCallback(C=>{u(C),requestAnimationFrame(()=>{const S=document.activeElement;S==null||S.blur(),_(!1)})},[u]),K=p.useCallback(()=>{_(!0),w(x)},[x,w]),O=p.useCallback(C=>{C.target.closest(".cmd-item")&&C.preventDefault()},[]);return g.jsx("div",{ref:j,className:fe(h&&"cursor-not-allowed opacity-50",f),onMouseDown:O,children:g.jsxs(lr,{shouldFilter:!1,className:"bg-transparent",children:[g.jsxs("div",{children:[g.jsx(Pn,{placeholder:s,value:x,className:"max-h-8",onFocus:K,onValueChange:C=>{k(C),N||_(!0)}}),I&&g.jsx("div",{className:"absolute top-1/2 right-2 flex -translate-y-1/2 transform items-center",children:g.jsx(Ua,{className:"h-4 w-4 animate-spin"})})]}),g.jsxs(cr,{hidden:!N,children:[m&&g.jsx("div",{className:"text-destructive p-4 text-center",children:m}),I&&A.length===0&&(l||g.jsx(_h,{})),!I&&!m&&A.length===0&&(o||g.jsx(zn,{children:b??`No ${i.toLowerCase()} found.`})),g.jsx(_t,{children:A.map((C,S)=>g.jsxs(W.Fragment,{children:[g.jsx(Ct,{value:a(C),onSelect:V,onMouseMove:()=>d(a(C)),className:"truncate cmd-item",children:n(C)},a(C)+`${S}`),S!==A.length-1&&g.jsx("div",{className:"bg-foreground/10 h-[1px]"},`divider-${S}`)]},a(C)+`-fragment-${S}`))})]})]})})}function _h(){return g.jsx(_t,{children:g.jsx(Ct,{disabled:!0,children:g.jsxs("div",{className:"flex w-full items-center gap-2",children:[g.jsx("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),g.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[g.jsx("div",{className:"bg-muted h-4 w-24 animate-pulse rounded"}),g.jsx("div",{className:"bg-muted h-3 w-16 animate-pulse rounded"})]})]})})})}const qr="__message_item",Ch=({id:t})=>{const e=ee.use.sigmaGraph();return e!=null&&e.hasNode(t)?g.jsx(wh,{id:t}):null};function kh(t){return g.jsxs("div",{children:[t.type==="nodes"&&g.jsx(Ch,{id:t.id}),t.type==="edges"&&g.jsx(Sh,{id:t.id}),t.type==="message"&&g.jsx("div",{children:t.message})]})}const Th=({onChange:t,onFocus:e,value:r})=>{const{t:n}=xe(),a=ee.use.sigmaGraph(),o=ee.use.searchEngine();p.useEffect(()=>{a&&ee.getState().resetSearchEngine()},[a]),p.useEffect(()=>{if(!a||a.nodes().length===0||o)return;const i=new at({idField:"id",fields:["label"],searchOptions:{prefix:!0,fuzzy:.2,boost:{label:2}}}),s=a.nodes().map(c=>({id:c,label:a.getNodeAttribute(c,"label")}));i.addAll(s),ee.getState().setSearchEngine(i)},[a,o]);const l=p.useCallback(async i=>{if(e&&e(null),!a||!o)return[];if(a.nodes().length===0)return[];if(!i)return a.nodes().filter(u=>a.hasNode(u)).slice(0,It).map(u=>({id:u,type:"nodes"}));let s=o.search(i).filter(c=>a.hasNode(c.id)).map(c=>({id:c.id,type:"nodes"}));if(s.length<5){const c=new Set(s.map(d=>d.id)),u=a.nodes().filter(d=>{if(c.has(d))return!1;const h=a.getNodeAttribute(d,"label");return h&&typeof h=="string"&&!h.toLowerCase().startsWith(i.toLowerCase())&&h.toLowerCase().includes(i.toLowerCase())}).map(d=>({id:d,type:"nodes"}));s=[...s,...u]}return s.length<=It?s:[...s.slice(0,It),{type:"message",id:qr,message:n("graphPanel.search.message",{count:s.length-It})}]},[a,o,e,n]);return g.jsx(Eh,{className:"bg-background/60 w-24 rounded-xl border-1 opacity-60 backdrop-blur-lg transition-all hover:w-fit hover:opacity-100",fetcher:l,renderOption:kh,getOptionValue:i=>i.id,value:r&&r.type!=="message"?r.id:null,onChange:i=>{i!==qr&&t(i?{id:i,type:"nodes"}:null)},onFocus:i=>{i!==qr&&e&&e(i?{id:i,type:"nodes"}:null)},label:"item",placeholder:n("graphPanel.search.placeholder")})},Rh=({...t})=>g.jsx(Th,{...t});function Ah({fetcher:t,preload:e,filterFn:r,renderOption:n,getOptionValue:a,getDisplayValue:o,notFound:l,loadingSkeleton:i,label:s,placeholder:c="Select...",value:u,onChange:d,disabled:h=!1,className:f,triggerClassName:b,searchInputClassName:y,noResultsMessage:T,triggerTooltip:N,clearable:_=!0}){const[A,R]=p.useState(!1),[I,D]=p.useState(!1),[m,E]=p.useState([]),[x,k]=p.useState(!1),[L,j]=p.useState(null),[w,V]=p.useState(u),[K,O]=p.useState(null),[C,S]=p.useState(""),H=Bs(C,e?0:150),[ae,$]=p.useState([]),[v,z]=p.useState(null);p.useEffect(()=>{R(!0),V(u)},[u]),p.useEffect(()=>{u&&(!m.length||!K)?z(g.jsx("div",{children:u})):K&&z(null)},[u,m.length,K]),p.useEffect(()=>{if(u&&m.length>0){const M=m.find(J=>a(J)===u);M&&O(M)}},[u,m,a]),p.useEffect(()=>{A||(async()=>{try{k(!0),j(null);const J=await t(u);$(J),E(J)}catch(J){j(J instanceof Error?J.message:"Failed to fetch options")}finally{k(!1)}})()},[A,t,u]),p.useEffect(()=>{const M=async()=>{try{k(!0),j(null);const J=await t(H);$(J),E(J)}catch(J){j(J instanceof Error?J.message:"Failed to fetch options")}finally{k(!1)}};A&&e?e&&E(H?ae.filter(J=>r?r(J,H):!0):ae):M()},[t,H,A,e,r]);const B=p.useCallback(M=>{const J=_&&M===w?"":M;V(J),O(m.find(X=>a(X)===J)||null),d(J),D(!1)},[w,d,_,m,a]);return g.jsxs(Tn,{open:I,onOpenChange:D,children:[g.jsx(Rn,{asChild:!0,children:g.jsxs(be,{variant:"outline",role:"combobox","aria-expanded":I,className:fe("justify-between",h&&"cursor-not-allowed opacity-50",b),disabled:h,tooltip:N,side:"bottom",children:[u==="*"?g.jsx("div",{children:"*"}):K?o(K):v||c,g.jsx(Dc,{className:"opacity-50",size:10})]})}),g.jsx(sr,{className:fe("p-0",f),onCloseAutoFocus:M=>M.preventDefault(),align:"start",sideOffset:8,collisionPadding:5,children:g.jsxs(lr,{shouldFilter:!1,children:[g.jsxs("div",{className:"relative w-full border-b",children:[g.jsx(Pn,{placeholder:`Search ${s.toLowerCase()}...`,value:C,onValueChange:M=>{S(M)},className:y}),x&&m.length>0&&g.jsx("div",{className:"absolute top-1/2 right-2 flex -translate-y-1/2 transform items-center",children:g.jsx(Ua,{className:"h-4 w-4 animate-spin"})})]}),g.jsxs(cr,{children:[L&&g.jsx("div",{className:"text-destructive p-4 text-center",children:L}),x&&m.length===0&&(i||g.jsx(jh,{})),!x&&!L&&m.length===0&&(l||g.jsx(zn,{children:T??`No ${s.toLowerCase()} found.`})),g.jsx(_t,{children:m.map(M=>g.jsxs(Ct,{value:a(M),onSelect:B,className:"truncate",children:[n(M),g.jsx(Va,{className:fe("ml-auto h-3 w-3",w===a(M)?"opacity-100":"opacity-0")})]},a(M)))})]})]})})]})}function jh(){return g.jsx(_t,{children:g.jsx(Ct,{disabled:!0,children:g.jsxs("div",{className:"flex w-full items-center gap-2",children:[g.jsx("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),g.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[g.jsx("div",{className:"bg-muted h-4 w-24 animate-pulse rounded"}),g.jsx("div",{className:"bg-muted h-3 w-16 animate-pulse rounded"})]})]})})})}const Ih=()=>{const{t}=xe(),e=re.use.queryLabel(),r=ee.use.allDatabaseLabels(),n=ee.use.labelsFetchAttempted(),a=p.useCallback(()=>{const i=new at({idField:"id",fields:["value"],searchOptions:{prefix:!0,fuzzy:.2,boost:{label:2}}}),s=r.map((c,u)=>({id:u,value:c}));return i.addAll(s),{labels:r,searchEngine:i}},[r]),o=p.useCallback(async i=>{const{labels:s,searchEngine:c}=a();let u=s;if(i&&(u=c.search(i).map(d=>s[d.id]),u.length<15)){const d=new Set(u),h=s.filter(f=>d.has(f)?!1:f&&typeof f=="string"&&!f.toLowerCase().startsWith(i.toLowerCase())&&f.toLowerCase().includes(i.toLowerCase()));u=[...u,...h]}return u.length<=Xn?u:[...u.slice(0,Xn),"..."]},[a]);p.useEffect(()=>{n&&(r.length>1?e&&e!=="*"&&!r.includes(e)?(console.log(`Label "${e}" not in available labels, setting to "*"`),re.getState().setQueryLabel("*")):console.log(`Label "${e}" is valid`):e&&r.length<=1&&e&&e!=="*"&&(console.log("Available labels list is empty, setting label to empty"),re.getState().setQueryLabel("")),ee.getState().setLabelsFetchAttempted(!1))},[r,e,n]);const l=p.useCallback(()=>{ee.getState().setLabelsFetchAttempted(!1),ee.getState().setGraphDataFetchAttempted(!1),ee.getState().setLastSuccessfulQueryLabel("");const i=re.getState().queryLabel;i?(re.getState().setQueryLabel(""),setTimeout(()=>{re.getState().setQueryLabel(i)},0)):re.getState().setQueryLabel("*")},[]);return g.jsxs("div",{className:"flex items-center",children:[g.jsx(be,{size:"icon",variant:Le,onClick:l,tooltip:t("graphPanel.graphLabels.refreshTooltip"),className:"mr-2",children:g.jsx(uu,{className:"h-4 w-4"})}),g.jsx(Ah,{className:"min-w-[300px]",triggerClassName:"max-h-8",searchInputClassName:"max-h-8",triggerTooltip:t("graphPanel.graphLabels.selectTooltip"),fetcher:o,renderOption:i=>g.jsx("div",{children:i}),getOptionValue:i=>i,getDisplayValue:i=>g.jsx("div",{children:i}),notFound:g.jsx("div",{className:"py-6 text-center text-sm",children:"No labels found"}),label:t("graphPanel.graphLabels.label"),placeholder:t("graphPanel.graphLabels.placeholder"),value:e!==null?e:"*",onChange:i=>{const s=re.getState().queryLabel;i==="..."&&(i="*"),i===s&&i!=="*"&&(i="*"),ee.getState().setGraphDataFetchAttempted(!1),re.getState().setQueryLabel(i)},clearable:!1})]})},Vs=({text:t,className:e,tooltipClassName:r,tooltip:n,side:a,onClick:o})=>n?g.jsx($a,{delayDuration:200,children:g.jsxs(Ma,{children:[g.jsx(Ha,{asChild:!0,children:g.jsx("label",{className:fe(e,o!==void 0?"cursor-pointer":void 0),onClick:o,children:t})}),g.jsx(kn,{side:a,className:r,children:n})]})}):g.jsx("label",{className:fe(e,o!==void 0?"cursor-pointer":void 0),onClick:o,children:t});var Gt={exports:{}},Lh=Gt.exports,Wo;function Nh(){return Wo||(Wo=1,function(t){(function(e,r,n){function a(s){var c=this,u=i();c.next=function(){var d=2091639*c.s0+c.c*23283064365386963e-26;return c.s0=c.s1,c.s1=c.s2,c.s2=d-(c.c=d|0)},c.c=1,c.s0=u(" "),c.s1=u(" "),c.s2=u(" "),c.s0-=u(s),c.s0<0&&(c.s0+=1),c.s1-=u(s),c.s1<0&&(c.s1+=1),c.s2-=u(s),c.s2<0&&(c.s2+=1),u=null}function o(s,c){return c.c=s.c,c.s0=s.s0,c.s1=s.s1,c.s2=s.s2,c}function l(s,c){var u=new a(s),d=c&&c.state,h=u.next;return h.int32=function(){return u.next()*4294967296|0},h.double=function(){return h()+(h()*2097152|0)*11102230246251565e-32},h.quick=h,d&&(typeof d=="object"&&o(d,u),h.state=function(){return o(u,{})}),h}function i(){var s=4022871197,c=function(u){u=String(u);for(var d=0;d<u.length;d++){s+=u.charCodeAt(d);var h=.02519603282416938*s;s=h>>>0,h-=s,h*=s,s=h>>>0,h-=s,s+=h*4294967296}return(s>>>0)*23283064365386963e-26};return c}r&&r.exports?r.exports=l:this.alea=l})(Lh,t)}(Gt)),Gt.exports}var Ft={exports:{}},Ph=Ft.exports,Xo;function zh(){return Xo||(Xo=1,function(t){(function(e,r,n){function a(i){var s=this,c="";s.x=0,s.y=0,s.z=0,s.w=0,s.next=function(){var d=s.x^s.x<<11;return s.x=s.y,s.y=s.z,s.z=s.w,s.w^=s.w>>>19^d^d>>>8},i===(i|0)?s.x=i:c+=i;for(var u=0;u<c.length+64;u++)s.x^=c.charCodeAt(u)|0,s.next()}function o(i,s){return s.x=i.x,s.y=i.y,s.z=i.z,s.w=i.w,s}function l(i,s){var c=new a(i),u=s&&s.state,d=function(){return(c.next()>>>0)/4294967296};return d.double=function(){do var h=c.next()>>>11,f=(c.next()>>>0)/4294967296,b=(h+f)/(1<<21);while(b===0);return b},d.int32=c.next,d.quick=d,u&&(typeof u=="object"&&o(u,c),d.state=function(){return o(c,{})}),d}r&&r.exports?r.exports=l:this.xor128=l})(Ph,t)}(Ft)),Ft.exports}var $t={exports:{}},Dh=$t.exports,Yo;function Oh(){return Yo||(Yo=1,function(t){(function(e,r,n){function a(i){var s=this,c="";s.next=function(){var d=s.x^s.x>>>2;return s.x=s.y,s.y=s.z,s.z=s.w,s.w=s.v,(s.d=s.d+362437|0)+(s.v=s.v^s.v<<4^(d^d<<1))|0},s.x=0,s.y=0,s.z=0,s.w=0,s.v=0,i===(i|0)?s.x=i:c+=i;for(var u=0;u<c.length+64;u++)s.x^=c.charCodeAt(u)|0,u==c.length&&(s.d=s.x<<10^s.x>>>4),s.next()}function o(i,s){return s.x=i.x,s.y=i.y,s.z=i.z,s.w=i.w,s.v=i.v,s.d=i.d,s}function l(i,s){var c=new a(i),u=s&&s.state,d=function(){return(c.next()>>>0)/4294967296};return d.double=function(){do var h=c.next()>>>11,f=(c.next()>>>0)/4294967296,b=(h+f)/(1<<21);while(b===0);return b},d.int32=c.next,d.quick=d,u&&(typeof u=="object"&&o(u,c),d.state=function(){return o(c,{})}),d}r&&r.exports?r.exports=l:this.xorwow=l})(Dh,t)}($t)),$t.exports}var Mt={exports:{}},Gh=Mt.exports,Ko;function Fh(){return Ko||(Ko=1,function(t){(function(e,r,n){function a(i){var s=this;s.next=function(){var u=s.x,d=s.i,h,f;return h=u[d],h^=h>>>7,f=h^h<<24,h=u[d+1&7],f^=h^h>>>10,h=u[d+3&7],f^=h^h>>>3,h=u[d+4&7],f^=h^h<<7,h=u[d+7&7],h=h^h<<13,f^=h^h<<9,u[d]=f,s.i=d+1&7,f};function c(u,d){var h,f=[];if(d===(d|0))f[0]=d;else for(d=""+d,h=0;h<d.length;++h)f[h&7]=f[h&7]<<15^d.charCodeAt(h)+f[h+1&7]<<13;for(;f.length<8;)f.push(0);for(h=0;h<8&&f[h]===0;++h);for(h==8?f[7]=-1:f[h],u.x=f,u.i=0,h=256;h>0;--h)u.next()}c(s,i)}function o(i,s){return s.x=i.x.slice(),s.i=i.i,s}function l(i,s){i==null&&(i=+new Date);var c=new a(i),u=s&&s.state,d=function(){return(c.next()>>>0)/4294967296};return d.double=function(){do var h=c.next()>>>11,f=(c.next()>>>0)/4294967296,b=(h+f)/(1<<21);while(b===0);return b},d.int32=c.next,d.quick=d,u&&(u.x&&o(u,c),d.state=function(){return o(c,{})}),d}r&&r.exports?r.exports=l:this.xorshift7=l})(Gh,t)}(Mt)),Mt.exports}var Ht={exports:{}},$h=Ht.exports,Qo;function Mh(){return Qo||(Qo=1,function(t){(function(e,r,n){function a(i){var s=this;s.next=function(){var u=s.w,d=s.X,h=s.i,f,b;return s.w=u=u+1640531527|0,b=d[h+34&127],f=d[h=h+1&127],b^=b<<13,f^=f<<17,b^=b>>>15,f^=f>>>12,b=d[h]=b^f,s.i=h,b+(u^u>>>16)|0};function c(u,d){var h,f,b,y,T,N=[],_=128;for(d===(d|0)?(f=d,d=null):(d=d+"\0",f=0,_=Math.max(_,d.length)),b=0,y=-32;y<_;++y)d&&(f^=d.charCodeAt((y+32)%d.length)),y===0&&(T=f),f^=f<<10,f^=f>>>15,f^=f<<4,f^=f>>>13,y>=0&&(T=T+1640531527|0,h=N[y&127]^=f+T,b=h==0?b+1:0);for(b>=128&&(N[(d&&d.length||0)&127]=-1),b=127,y=4*128;y>0;--y)f=N[b+34&127],h=N[b=b+1&127],f^=f<<13,h^=h<<17,f^=f>>>15,h^=h>>>12,N[b]=f^h;u.w=T,u.X=N,u.i=b}c(s,i)}function o(i,s){return s.i=i.i,s.w=i.w,s.X=i.X.slice(),s}function l(i,s){i==null&&(i=+new Date);var c=new a(i),u=s&&s.state,d=function(){return(c.next()>>>0)/4294967296};return d.double=function(){do var h=c.next()>>>11,f=(c.next()>>>0)/4294967296,b=(h+f)/(1<<21);while(b===0);return b},d.int32=c.next,d.quick=d,u&&(u.X&&o(u,c),d.state=function(){return o(c,{})}),d}r&&r.exports?r.exports=l:this.xor4096=l})($h,t)}(Ht)),Ht.exports}var Bt={exports:{}},Hh=Bt.exports,Jo;function Bh(){return Jo||(Jo=1,function(t){(function(e,r,n){function a(i){var s=this,c="";s.next=function(){var d=s.b,h=s.c,f=s.d,b=s.a;return d=d<<25^d>>>7^h,h=h-f|0,f=f<<24^f>>>8^b,b=b-d|0,s.b=d=d<<20^d>>>12^h,s.c=h=h-f|0,s.d=f<<16^h>>>16^b,s.a=b-d|0},s.a=0,s.b=0,s.c=-1640531527,s.d=1367130551,i===Math.floor(i)?(s.a=i/4294967296|0,s.b=i|0):c+=i;for(var u=0;u<c.length+20;u++)s.b^=c.charCodeAt(u)|0,s.next()}function o(i,s){return s.a=i.a,s.b=i.b,s.c=i.c,s.d=i.d,s}function l(i,s){var c=new a(i),u=s&&s.state,d=function(){return(c.next()>>>0)/4294967296};return d.double=function(){do var h=c.next()>>>11,f=(c.next()>>>0)/4294967296,b=(h+f)/(1<<21);while(b===0);return b},d.int32=c.next,d.quick=d,u&&(typeof u=="object"&&o(u,c),d.state=function(){return o(c,{})}),d}r&&r.exports?r.exports=l:this.tychei=l})(Hh,t)}(Bt)),Bt.exports}var Vt={exports:{}};const Vh={},Uh=Object.freeze(Object.defineProperty({__proto__:null,default:Vh},Symbol.toStringTag,{value:"Module"})),qh=pi(Uh);var Wh=Vt.exports,Zo;function Xh(){return Zo||(Zo=1,function(t){(function(e,r,n){var a=256,o=6,l=52,i="random",s=n.pow(a,o),c=n.pow(2,l),u=c*2,d=a-1,h;function f(R,I,D){var m=[];I=I==!0?{entropy:!0}:I||{};var E=N(T(I.entropy?[R,A(r)]:R??_(),3),m),x=new b(m),k=function(){for(var L=x.g(o),j=s,w=0;L<c;)L=(L+w)*a,j*=a,w=x.g(1);for(;L>=u;)L/=2,j/=2,w>>>=1;return(L+w)/j};return k.int32=function(){return x.g(4)|0},k.quick=function(){return x.g(4)/4294967296},k.double=k,N(A(x.S),r),(I.pass||D||function(L,j,w,V){return V&&(V.S&&y(V,x),L.state=function(){return y(x,{})}),w?(n[i]=L,j):L})(k,E,"global"in I?I.global:this==n,I.state)}function b(R){var I,D=R.length,m=this,E=0,x=m.i=m.j=0,k=m.S=[];for(D||(R=[D++]);E<a;)k[E]=E++;for(E=0;E<a;E++)k[E]=k[x=d&x+R[E%D]+(I=k[E])],k[x]=I;(m.g=function(L){for(var j,w=0,V=m.i,K=m.j,O=m.S;L--;)j=O[V=d&V+1],w=w*a+O[d&(O[V]=O[K=d&K+j])+(O[K]=j)];return m.i=V,m.j=K,w})(a)}function y(R,I){return I.i=R.i,I.j=R.j,I.S=R.S.slice(),I}function T(R,I){var D=[],m=typeof R,E;if(I&&m=="object")for(E in R)try{D.push(T(R[E],I-1))}catch{}return D.length?D:m=="string"?R:R+"\0"}function N(R,I){for(var D=R+"",m,E=0;E<D.length;)I[d&E]=d&(m^=I[d&E]*19)+D.charCodeAt(E++);return A(I)}function _(){try{var R;return h&&(R=h.randomBytes)?R=R(a):(R=new Uint8Array(a),(e.crypto||e.msCrypto).getRandomValues(R)),A(R)}catch{var I=e.navigator,D=I&&I.plugins;return[+new Date,e,D,e.screen,A(r)]}}function A(R){return String.fromCharCode.apply(0,R)}if(N(n.random(),r),t.exports){t.exports=f;try{h=qh}catch{}}else n["seed"+i]=f})(typeof self<"u"?self:Wh,[],Math)}(Vt)),Vt.exports}var Wr,ea;function Yh(){if(ea)return Wr;ea=1;var t=Nh(),e=zh(),r=Oh(),n=Fh(),a=Mh(),o=Bh(),l=Xh();return l.alea=t,l.xor128=e,l.xorwow=r,l.xorshift7=n,l.xor4096=a,l.tychei=o,Wr=l,Wr}var Kh=Yh();const yn=He(Kh),Qh={unknown:"unknown",未知:"unknown",other:"unknown",category:"category",类别:"category",type:"category",分类:"category",organization:"organization",组织:"organization",org:"organization",company:"organization",公司:"organization",机构:"organization",event:"event",事件:"event",activity:"event",活动:"event",person:"person",人物:"person",people:"person",human:"person",人:"person",animal:"animal",动物:"animal",creature:"animal",生物:"animal",geo:"geo",地理:"geo",geography:"geo",地域:"geo",location:"location",地点:"location",place:"location",address:"location",位置:"location",地址:"location",technology:"technology",技术:"technology",tech:"technology",科技:"technology",equipment:"equipment",设备:"equipment",device:"equipment",装备:"equipment",weapon:"weapon",武器:"weapon",arms:"weapon",军火:"weapon",object:"object",物品:"object",stuff:"object",物体:"object",group:"group",群组:"group",community:"group",社区:"group"},ta={unknown:"#f4d371",category:"#e3493b",organization:"#0f705d",event:"#00bfa0",person:"#4169E1",animal:"#84a3e1",geo:"#ff99cc",location:"#cf6d17",technology:"#b300b3",equipment:"#2F4F4F",weapon:"#4421af",object:"#00cc00",group:"#0f558a"},Jh=["#5a2c6d","#0000ff","#cd071e","#00CED1","#9b3a31","#b2e061","#bd7ebe","#6ef7b3","#003366","#DEB887"],ra=t=>{const e="#5D6D7E",r=t?t.toLowerCase():"unknown",n=ee.getState().typeColorMap;if(n.has(r))return n.get(r)||e;const a=Qh[r];if(a){const c=ta[a],u=new Map(n);return u.set(r,c),ee.setState({typeColorMap:u}),c}const o=new Set(Array.from(n.entries()).filter(([,c])=>!Object.values(ta).includes(c)).map(([,c])=>c)),i=Jh.find(c=>!o.has(c))||e,s=new Map(n);return s.set(r,i),ee.setState({typeColorMap:s}),i},Zh=t=>{if(!t)return console.log("Graph validation failed: graph is null"),!1;if(!Array.isArray(t.nodes)||!Array.isArray(t.edges))return console.log("Graph validation failed: nodes or edges is not an array"),!1;if(t.nodes.length===0)return console.log("Graph validation failed: nodes array is empty"),!1;for(const e of t.nodes)if(!e.id||!e.labels||!e.properties)return console.log("Graph validation failed: invalid node structure"),!1;for(const e of t.edges)if(!e.id||!e.source||!e.target)return console.log("Graph validation failed: invalid edge structure"),!1;for(const e of t.edges){const r=t.getNode(e.source),n=t.getNode(e.target);if(r==null||n==null)return console.log("Graph validation failed: edge references non-existent node"),!1}return console.log("Graph validation passed"),!0},eg=async(t,e,r)=>{let n=null;if(!ee.getState().lastSuccessfulQueryLabel){console.log("Last successful queryLabel is empty");try{await ee.getState().fetchAllDatabaseLabels()}catch(i){console.error("Failed to fetch all database labels:",i)}}ee.getState().setLabelsFetchAttempted(!0);const o=t||"*";try{console.log(`Fetching graph label: ${o}, depth: ${e}, nodes: ${r}`),n=await Ca(o,e,r)}catch(i){return _n.getState().setErrorMessage(tr(i),"Query Graphs Error!"),null}let l=null;if(n){const i={},s={};for(let h=0;h<n.nodes.length;h++){const f=n.nodes[h];i[f.id]=h,f.x=Math.random(),f.y=Math.random(),f.degree=0,f.size=10}for(let h=0;h<n.edges.length;h++){const f=n.edges[h];s[f.id]=h;const b=i[f.source],y=i[f.target];if(b!==void 0&&b!==void 0){const T=n.nodes[b],N=n.nodes[y];if(!T){console.error(`Source node ${f.source} is undefined`);continue}if(!N){console.error(`Target node ${f.target} is undefined`);continue}T.degree+=1,N.degree+=1}}let c=Number.MAX_SAFE_INTEGER,u=0;for(const h of n.nodes)c=Math.min(c,h.degree),u=Math.max(u,h.degree);const d=u-c;if(d>0){const h=Qr-ut;for(const f of n.nodes)f.size=Math.round(ut+h*Math.pow((f.degree-c)/d,.5))}l=new rl,l.nodes=n.nodes,l.edges=n.edges,l.nodeIdMap=i,l.edgeIdMap=s,Zh(l)||(l=null,console.warn("Invalid graph data")),console.log("Graph data loaded")}return{rawGraph:l,is_truncated:n.is_truncated}},tg=t=>{var i,s;const e=re.getState().minEdgeSize,r=re.getState().maxEdgeSize;if(!t||!t.nodes.length)return console.log("No graph data available, skipping sigma graph creation"),null;const n=new Xr;for(const c of(t==null?void 0:t.nodes)??[]){yn(c.id+Date.now().toString(),{global:!0});const u=Math.random(),d=Math.random();n.addNode(c.id,{label:c.labels.join(", "),color:c.color,x:u,y:d,size:c.size,borderColor:Kr,borderSize:.2})}for(const c of(t==null?void 0:t.edges)??[]){const u=((i=c.properties)==null?void 0:i.weight)!==void 0?Number(c.properties.weight):1;c.dynamicId=n.addEdge(c.source,c.target,{label:((s=c.properties)==null?void 0:s.keywords)||void 0,size:u,originalWeight:u,type:"curvedNoArrow"})}let a=Number.MAX_SAFE_INTEGER,o=0;n.forEachEdge(c=>{const u=n.getEdgeAttribute(c,"originalWeight")||1;a=Math.min(a,u),o=Math.max(o,u)});const l=o-a;if(l>0){const c=r-e;n.forEachEdge(u=>{const d=n.getEdgeAttribute(u,"originalWeight")||1,h=e+c*Math.pow((d-a)/l,.5);n.setEdgeAttribute(u,"size",h)})}else n.forEachEdge(c=>{n.setEdgeAttribute(c,"size",e)});return n},rg=()=>{const{t}=xe(),e=re.use.queryLabel(),r=ee.use.rawGraph(),n=ee.use.sigmaGraph(),a=re.use.graphQueryMaxDepth(),o=re.use.graphMaxNodes(),l=ee.use.isFetching(),i=ee.use.nodeToExpand(),s=ee.use.nodeToPrune(),c=p.useRef(!1),u=p.useRef(!1),d=p.useRef(!1),h=p.useCallback(N=>(r==null?void 0:r.getNode(N))||null,[r]),f=p.useCallback((N,_=!0)=>(r==null?void 0:r.getEdge(N,_))||null,[r]),b=p.useRef(!1);p.useEffect(()=>{if(!e&&(r!==null||n!==null)){const N=ee.getState();N.reset(),N.setGraphDataFetchAttempted(!1),N.setLabelsFetchAttempted(!1),c.current=!1,u.current=!1}},[e,r,n]),p.useEffect(()=>{if(!b.current&&!(!e&&d.current)&&!l&&!ee.getState().graphDataFetchAttempted){b.current=!0,ee.getState().setGraphDataFetchAttempted(!0);const N=ee.getState();N.setIsFetching(!0),N.clearSelection(),N.sigmaGraph&&N.sigmaGraph.forEachNode(D=>{var m;(m=N.sigmaGraph)==null||m.setNodeAttribute(D,"highlighted",!1)}),console.log("Preparing graph data...");const _=e,A=a,R=o;let I;_?I=eg(_,A,R):(console.log("Query label is empty, show empty graph"),I=Promise.resolve({rawGraph:null,is_truncated:!1})),I.then(D=>{const m=ee.getState(),E=D==null?void 0:D.rawGraph;if(E&&E.nodes&&E.nodes.forEach(x=>{var L;const k=(L=x.properties)==null?void 0:L.entity_type;x.color=ra(k)}),D!=null&&D.is_truncated&&rt.info(t("graphPanel.dataIsTruncated","Graph data is truncated to Max Nodes")),m.reset(),!E||!E.nodes||E.nodes.length===0){const x=new Xr;x.addNode("empty-graph-node",{label:t("graphPanel.emptyGraph"),color:"#5D6D7E",x:.5,y:.5,size:15,borderColor:Kr,borderSize:.2}),m.setSigmaGraph(x),m.setRawGraph(null),m.setGraphIsEmpty(!0);const k=_n.getState().message,L=k&&k.includes("Authentication required");!L&&_&&re.getState().setQueryLabel(""),L?console.log("Keep queryLabel for post-login reload"):m.setLastSuccessfulQueryLabel(""),console.log(`Graph data is empty, created graph with empty graph node. Auth error: ${L}`)}else{const x=tg(E);E.buildDynamicMap(),m.setSigmaGraph(x),m.setRawGraph(E),m.setGraphIsEmpty(!1),m.setLastSuccessfulQueryLabel(_),m.setMoveToSelectedNode(!0)}c.current=!0,u.current=!0,b.current=!1,m.setIsFetching(!1),(!E||!E.nodes||E.nodes.length===0)&&!_&&(d.current=!0)}).catch(D=>{console.error("Error fetching graph data:",D);const m=ee.getState();m.setIsFetching(!1),c.current=!1,b.current=!1,m.setGraphDataFetchAttempted(!1),m.setLastSuccessfulQueryLabel("")})}},[e,a,o,l,t]),p.useEffect(()=>{i&&((async _=>{var A,R,I,D,m,E;if(!(!_||!n||!r))try{const x=r.getNode(_);if(!x){console.error("Node not found:",_);return}const k=x.labels[0];if(!k){console.error("Node has no label:",_);return}const L=await Ca(k,2,1e3);if(!L||!L.nodes||!L.edges){console.error("Failed to fetch extended graph");return}const j=[];for(const F of L.nodes){yn(F.id,{global:!0});const Q=(A=F.properties)==null?void 0:A.entity_type,q=ra(Q);j.push({id:F.id,labels:F.labels,properties:F.properties,size:10,x:Math.random(),y:Math.random(),color:q,degree:0})}const w=[];for(const F of L.edges)w.push({id:F.id,source:F.source,target:F.target,type:F.type,properties:F.properties,dynamicId:""});const V={};n.forEachNode(F=>{V[F]={x:n.getNodeAttribute(F,"x"),y:n.getNodeAttribute(F,"y")}});const K=new Set(n.nodes()),O=new Set,C=new Set,S=1;let H=0,ae=Number.MAX_SAFE_INTEGER,$=0;n.forEachNode(F=>{const Q=n.degree(F);H=Math.max(H,Q)}),n.forEachEdge(F=>{const Q=n.getEdgeAttribute(F,"originalWeight")||1;ae=Math.min(ae,Q),$=Math.max($,Q)});for(const F of j){if(K.has(F.id))continue;w.some(q=>q.source===_&&q.target===F.id||q.target===_&&q.source===F.id)&&O.add(F.id)}const v=new Map,z=new Map,B=new Set;for(const F of w){const Q=K.has(F.source)||O.has(F.source),q=K.has(F.target)||O.has(F.target);Q&&q?(C.add(F.id),O.has(F.source)?v.set(F.source,(v.get(F.source)||0)+1):K.has(F.source)&&z.set(F.source,(z.get(F.source)||0)+1),O.has(F.target)?v.set(F.target,(v.get(F.target)||0)+1):K.has(F.target)&&z.set(F.target,(z.get(F.target)||0)+1)):(n.hasNode(F.source)?B.add(F.source):O.has(F.source)&&(B.add(F.source),v.set(F.source,(v.get(F.source)||0)+1)),n.hasNode(F.target)?B.add(F.target):O.has(F.target)&&(B.add(F.target),v.set(F.target,(v.get(F.target)||0)+1)))}const M=(F,Q,q,U)=>{const P=U-q||1,oe=Qr-ut;for(const ue of Q)if(F.hasNode(ue)){let te=F.degree(ue);te+=1;const Z=Math.min(te,U+1),G=Math.round(ut+oe*Math.pow((Z-q)/P,.5));F.setNodeAttribute(ue,"size",G)}},J=(F,Q,q)=>{const U=re.getState().minEdgeSize,P=re.getState().maxEdgeSize,oe=q-Q||1,ue=P-U;F.forEachEdge(te=>{const Z=F.getEdgeAttribute(te,"originalWeight")||1,G=U+ue*Math.pow((Z-Q)/oe,.5);F.setEdgeAttribute(te,"size",G)})};if(O.size===0){M(n,B,S,H),rt.info(t("graphPanel.propertiesView.node.noNewNodes"));return}for(const[,F]of v.entries())H=Math.max(H,F);for(const[F,Q]of z.entries()){const U=n.degree(F)+Q;H=Math.max(H,U)}const X=H-S||1,Y=Qr-ut,ie=((R=ee.getState().sigmaInstance)==null?void 0:R.getCamera().ratio)||1,ne=Math.max(Math.sqrt(x.size)*4,Math.sqrt(O.size)*3)/ie;yn(Date.now().toString(),{global:!0});const se=Math.random()*2*Math.PI;console.log("nodeSize:",x.size,"nodesToAdd:",O.size),console.log("cameraRatio:",Math.round(ie*100)/100,"spreadFactor:",Math.round(ne*100)/100);for(const F of O){const Q=j.find(Z=>Z.id===F),q=v.get(F)||0,U=Math.min(q,H+1),P=Math.round(ut+Y*Math.pow((U-S)/X,.5)),oe=2*Math.PI*(Array.from(O).indexOf(F)/O.size),ue=((I=V[F])==null?void 0:I.x)||V[x.id].x+Math.cos(se+oe)*ne,te=((D=V[F])==null?void 0:D.y)||V[x.id].y+Math.sin(se+oe)*ne;n.addNode(F,{label:Q.labels.join(", "),color:Q.color,x:ue,y:te,size:P,borderColor:Kr,borderSize:.2}),r.getNode(F)||(Q.size=P,Q.x=ue,Q.y=te,Q.degree=q,r.nodes.push(Q),r.nodeIdMap[F]=r.nodes.length-1)}for(const F of C){const Q=w.find(U=>U.id===F);if(n.hasEdge(Q.source,Q.target))continue;const q=((m=Q.properties)==null?void 0:m.weight)!==void 0?Number(Q.properties.weight):1;ae=Math.min(ae,q),$=Math.max($,q),Q.dynamicId=n.addEdge(Q.source,Q.target,{label:((E=Q.properties)==null?void 0:E.keywords)||void 0,size:q,originalWeight:q,type:"curvedNoArrow"}),r.getEdge(Q.id,!1)?console.error("Edge already exists in rawGraph:",Q.id):(r.edges.push(Q),r.edgeIdMap[Q.id]=r.edges.length-1,r.edgeDynamicIdMap[Q.dynamicId]=r.edges.length-1)}if(r.buildDynamicMap(),ee.getState().resetSearchEngine(),M(n,B,S,H),J(n,ae,$),n.hasNode(_)){const F=n.degree(_),Q=Math.min(F,H+1),q=Math.round(ut+Y*Math.pow((Q-S)/X,.5));n.setNodeAttribute(_,"size",q),x.size=q,x.degree=F}}catch(x){console.error("Error expanding node:",x)}})(i),window.setTimeout(()=>{ee.getState().triggerNodeExpand(null)},0))},[i,n,r,t]);const y=p.useCallback((N,_)=>{const A=new Set([N]);return _.forEachNode(R=>{if(R===N)return;const I=_.neighbors(R);I.length===1&&I[0]===N&&A.add(R)}),A},[]);return p.useEffect(()=>{s&&((_=>{if(!(!_||!n||!r))try{const A=ee.getState();if(!n.hasNode(_)){console.error("Node not found:",_);return}const R=y(_,n);if(R.size===n.nodes().length){rt.error(t("graphPanel.propertiesView.node.deleteAllNodesError"));return}A.clearSelection();for(const I of R){n.dropNode(I);const D=r.nodeIdMap[I];if(D!==void 0){const m=r.edges.filter(E=>E.source===I||E.target===I);for(const E of m){const x=r.edgeIdMap[E.id];if(x!==void 0){r.edges.splice(x,1);for(const[k,L]of Object.entries(r.edgeIdMap))L>x&&(r.edgeIdMap[k]=L-1);delete r.edgeIdMap[E.id],delete r.edgeDynamicIdMap[E.dynamicId]}}r.nodes.splice(D,1);for(const[E,x]of Object.entries(r.nodeIdMap))x>D&&(r.nodeIdMap[E]=x-1);delete r.nodeIdMap[I]}}r.buildDynamicMap(),ee.getState().resetSearchEngine(),R.size>1&&rt.info(t("graphPanel.propertiesView.node.nodesRemoved",{count:R.size}))}catch(A){console.error("Error pruning node:",A)}})(s),window.setTimeout(()=>{ee.getState().triggerNodePrune(null)},0))},[s,n,r,y,t]),{lightrageGraph:p.useCallback(()=>{if(n)return n;console.log("Creating new Sigma graph instance");const N=new Xr;return ee.getState().setSigmaGraph(N),N},[n]),getNode:h,getEdge:f}},ng=({name:t})=>{const{t:e}=xe(),r=n=>{const a=`graphPanel.propertiesView.node.propertyNames.${n}`,o=e(a);return o===a?n:o};return g.jsx("span",{className:"text-primary/60 tracking-wide whitespace-nowrap",children:r(t)})},og=({onClick:t})=>g.jsx("div",{children:g.jsx(su,{className:"h-3 w-3 text-gray-500 hover:text-gray-700 cursor-pointer",onClick:t})}),ag=({value:t,onClick:e,tooltip:r})=>g.jsx("div",{className:"flex items-center gap-1 overflow-hidden",children:g.jsx(Vs,{className:"hover:bg-primary/20 rounded p-1 overflow-hidden text-ellipsis whitespace-nowrap",tooltipClassName:"max-w-80 -translate-x-15",text:t,tooltip:r||(typeof t=="string"?t:JSON.stringify(t,null,2)),side:"left",onClick:e})}),sg=({isOpen:t,onClose:e,onSave:r,propertyName:n,initialValue:a,isSubmitting:o=!1})=>{const{t:l}=xe(),[i,s]=p.useState("");p.useEffect(()=>{t&&s(a)},[t,a]);const c=h=>{const f=`graphPanel.propertiesView.node.propertyNames.${h}`,b=l(f);return b===f?h:b},u=h=>{switch(h){case"description":return{className:"max-h-[50vh] min-h-[10em] resize-y",style:{height:"70vh",minHeight:"20em",resize:"vertical"}};case"entity_id":return{rows:2,className:"",style:{}};case"keywords":return{rows:4,className:"",style:{}};default:return{rows:5,className:"",style:{}}}},d=()=>{i.trim()!==""&&(r(i),e())};return g.jsx(Lu,{open:t,onOpenChange:h=>!h&&e(),children:g.jsxs(Xa,{className:"sm:max-w-md",children:[g.jsxs(Ya,{children:[g.jsx(Qa,{children:l("graphPanel.propertiesView.editProperty",{property:c(n)})}),g.jsx(Ja,{children:l("graphPanel.propertiesView.editPropertyDescription")})]}),g.jsx("div",{className:"grid gap-4 py-4",children:(()=>{const h=u(n);return n==="description"?g.jsx("textarea",{value:i,onChange:f=>s(f.target.value),className:`border-input focus-visible:ring-ring flex w-full rounded-md border bg-transparent px-3 py-2 text-sm shadow-sm transition-colors focus-visible:ring-1 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 ${h.className}`,style:h.style,disabled:o}):g.jsx("textarea",{value:i,onChange:f=>s(f.target.value),rows:h.rows,className:`border-input focus-visible:ring-ring flex w-full rounded-md border bg-transparent px-3 py-2 text-sm shadow-sm transition-colors focus-visible:ring-1 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 ${h.className}`,disabled:o})})()}),g.jsxs(Ka,{children:[g.jsx(be,{type:"button",variant:"outline",onClick:e,disabled:o,children:l("common.cancel")}),g.jsx(be,{type:"button",onClick:d,disabled:o,children:l("common.save")})]})]})})},ig=({name:t,value:e,onClick:r,nodeId:n,edgeId:a,entityId:o,dynamicId:l,entityType:i,sourceId:s,targetId:c,onValueChange:u,isEditable:d=!1,tooltip:h})=>{const{t:f}=xe(),[b,y]=p.useState(!1),[T,N]=p.useState(!1),[_,A]=p.useState(e);p.useEffect(()=>{A(e)},[e]);const R=()=>{d&&!b&&y(!0)},I=()=>{y(!1)},D=async m=>{if(T||m===String(_)){y(!1);return}N(!0);try{if(i==="node"&&o&&n){let E={[t]:m};if(t==="entity_id"){if(await cl(m)){rt.error(f("graphPanel.propertiesView.errors.duplicateName"));return}E={entity_name:m}}await il(o,E,!0);try{await ee.getState().updateNodeAndSelect(n,o,t,m)}catch(x){throw console.error("Error updating node in graph:",x),new Error("Failed to update node in graph")}rt.success(f("graphPanel.propertiesView.success.entityUpdated"))}else if(i==="edge"&&s&&c&&a&&l){const E={[t]:m};await ll(s,c,E);try{await ee.getState().updateEdgeAndSelect(a,l,s,c,t,m)}catch(x){throw console.error(`Error updating edge ${s}->${c} in graph:`,x),new Error("Failed to update edge in graph")}rt.success(f("graphPanel.propertiesView.success.relationUpdated"))}y(!1),A(m),u==null||u(m)}catch(E){console.error("Error updating property:",E),rt.error(f("graphPanel.propertiesView.errors.updateFailed"))}finally{N(!1)}};return g.jsxs("div",{className:"flex items-center gap-1 overflow-hidden",children:[g.jsx(ng,{name:t}),g.jsx(og,{onClick:R}),":",g.jsx(ag,{value:_,onClick:r,tooltip:h||(typeof _=="string"?_:JSON.stringify(_,null,2))}),g.jsx(sg,{isOpen:b,onClose:I,onSave:D,propertyName:t,initialValue:String(_),isSubmitting:T})]})},lg=()=>{const{getNode:t,getEdge:e}=rg(),r=ee.use.selectedNode(),n=ee.use.focusedNode(),a=ee.use.selectedEdge(),o=ee.use.focusedEdge(),l=ee.use.graphDataVersion(),[i,s]=p.useState(null),[c,u]=p.useState(null);return p.useEffect(()=>{let d=null,h=null;n?(d="node",h=t(n)):r?(d="node",h=t(r)):o?(d="edge",h=e(o,!0)):a&&(d="edge",h=e(a,!0)),h?(d=="node"?s(cg(h)):s(ug(h)),u(d)):(s(null),u(null))},[n,r,o,a,l,s,u,t,e]),i?g.jsx("div",{className:"bg-background/80 max-w-xs rounded-lg border-2 p-2 text-xs backdrop-blur-lg",children:c=="node"?g.jsx(dg,{node:i}):g.jsx(fg,{edge:i})}):g.jsx(g.Fragment,{})},cg=t=>{const e=ee.getState(),r=[];if(e.sigmaGraph&&e.rawGraph)try{if(!e.sigmaGraph.hasNode(t.id))return console.warn("Node not found in sigmaGraph:",t.id),{...t,relationships:[]};const n=e.sigmaGraph.edges(t.id);for(const a of n){if(!e.sigmaGraph.hasEdge(a))continue;const o=e.rawGraph.getEdge(a,!0);if(o){const i=t.id===o.source?o.target:o.source;if(!e.sigmaGraph.hasNode(i))continue;const s=e.rawGraph.getNode(i);s&&r.push({type:"Neighbour",id:i,label:s.properties.entity_id?s.properties.entity_id:s.labels.join(", ")})}}}catch(n){console.error("Error refining node properties:",n)}return{...t,relationships:r}},ug=t=>{const e=ee.getState();let r,n;if(e.sigmaGraph&&e.rawGraph)try{if(!e.sigmaGraph.hasEdge(t.dynamicId))return console.warn("Edge not found in sigmaGraph:",t.id,"dynamicId:",t.dynamicId),{...t,sourceNode:void 0,targetNode:void 0};e.sigmaGraph.hasNode(t.source)&&(r=e.rawGraph.getNode(t.source)),e.sigmaGraph.hasNode(t.target)&&(n=e.rawGraph.getNode(t.target))}catch(a){console.error("Error refining edge properties:",a)}return{...t,sourceNode:r,targetNode:n}},Me=({name:t,value:e,onClick:r,tooltip:n,nodeId:a,edgeId:o,dynamicId:l,entityId:i,entityType:s,sourceId:c,targetId:u,isEditable:d=!1})=>{const{t:h}=xe(),f=b=>{const y=`graphPanel.propertiesView.node.propertyNames.${b}`,T=h(y);return T===y?b:T};return d&&(t==="description"||t==="entity_id"||t==="keywords")?g.jsx(ig,{name:t,value:e,onClick:r,nodeId:a,entityId:i,edgeId:o,dynamicId:l,entityType:s,sourceId:c,targetId:u,isEditable:!0,tooltip:n||(typeof e=="string"?e:JSON.stringify(e,null,2))}):g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"text-primary/60 tracking-wide whitespace-nowrap",children:f(t)}),":",g.jsx(Vs,{className:"hover:bg-primary/20 rounded p-1 overflow-hidden text-ellipsis",tooltipClassName:"max-w-80 -translate-x-13",text:e,tooltip:n||(typeof e=="string"?e:JSON.stringify(e,null,2)),side:"left",onClick:r})]})},dg=({node:t})=>{const{t:e}=xe(),r=()=>{ee.getState().triggerNodeExpand(t.id)},n=()=>{ee.getState().triggerNodePrune(t.id)};return g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsxs("div",{className:"flex justify-between items-center",children:[g.jsx("h3",{className:"text-md pl-1 font-bold tracking-wide text-blue-700",children:e("graphPanel.propertiesView.node.title")}),g.jsxs("div",{className:"flex gap-3",children:[g.jsx(be,{size:"icon",variant:"ghost",className:"h-7 w-7 border border-gray-400 hover:bg-gray-200 dark:border-gray-600 dark:hover:bg-gray-700",onClick:r,tooltip:e("graphPanel.propertiesView.node.expandNode"),children:g.jsx(Uc,{className:"h-4 w-4 text-gray-700 dark:text-gray-300"})}),g.jsx(be,{size:"icon",variant:"ghost",className:"h-7 w-7 border border-gray-400 hover:bg-gray-200 dark:border-gray-600 dark:hover:bg-gray-700",onClick:n,tooltip:e("graphPanel.propertiesView.node.pruneNode"),children:g.jsx(mu,{className:"h-4 w-4 text-gray-900 dark:text-gray-300"})})]})]}),g.jsxs("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:[g.jsx(Me,{name:e("graphPanel.propertiesView.node.id"),value:String(t.id)}),g.jsx(Me,{name:e("graphPanel.propertiesView.node.labels"),value:t.labels.join(", "),onClick:()=>{ee.getState().setSelectedNode(t.id,!0)}}),g.jsx(Me,{name:e("graphPanel.propertiesView.node.degree"),value:t.degree})]}),g.jsx("h3",{className:"text-md pl-1 font-bold tracking-wide text-amber-700",children:e("graphPanel.propertiesView.node.properties")}),g.jsx("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:Object.keys(t.properties).sort().map(a=>g.jsx(Me,{name:a,value:t.properties[a],nodeId:String(t.id),entityId:t.properties.entity_id,entityType:"node",isEditable:a==="description"||a==="entity_id"},a))}),t.relationships.length>0&&g.jsxs(g.Fragment,{children:[g.jsx("h3",{className:"text-md pl-1 font-bold tracking-wide text-emerald-700",children:e("graphPanel.propertiesView.node.relationships")}),g.jsx("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:t.relationships.map(({type:a,id:o,label:l})=>g.jsx(Me,{name:a,value:l,onClick:()=>{ee.getState().setSelectedNode(o,!0)}},o))})]})]})},fg=({edge:t})=>{const{t:e}=xe();return g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx("h3",{className:"text-md pl-1 font-bold tracking-wide text-violet-700",children:e("graphPanel.propertiesView.edge.title")}),g.jsxs("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:[g.jsx(Me,{name:e("graphPanel.propertiesView.edge.id"),value:t.id}),t.type&&g.jsx(Me,{name:e("graphPanel.propertiesView.edge.type"),value:t.type}),g.jsx(Me,{name:e("graphPanel.propertiesView.edge.source"),value:t.sourceNode?t.sourceNode.labels.join(", "):t.source,onClick:()=>{ee.getState().setSelectedNode(t.source,!0)}}),g.jsx(Me,{name:e("graphPanel.propertiesView.edge.target"),value:t.targetNode?t.targetNode.labels.join(", "):t.target,onClick:()=>{ee.getState().setSelectedNode(t.target,!0)}})]}),g.jsx("h3",{className:"text-md pl-1 font-bold tracking-wide text-amber-700",children:e("graphPanel.propertiesView.edge.properties")}),g.jsx("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:Object.keys(t.properties).sort().map(r=>{var n,a;return g.jsx(Me,{name:r,value:t.properties[r],edgeId:String(t.id),dynamicId:String(t.dynamicId),entityType:"edge",sourceId:((n=t.sourceNode)==null?void 0:n.properties.entity_id)||t.source,targetId:((a=t.targetNode)==null?void 0:a.properties.entity_id)||t.target,isEditable:r==="description"||r==="keywords"},r)})})]})},hg=()=>{const{t}=xe(),e=re.use.graphQueryMaxDepth(),r=re.use.graphMaxNodes();return g.jsxs("div",{className:"absolute bottom-4 left-[calc(1rem+2.5rem)] flex items-center gap-2 text-xs text-gray-400",children:[g.jsxs("div",{children:[t("graphPanel.sideBar.settings.depth"),": ",e]}),g.jsxs("div",{children:[t("graphPanel.sideBar.settings.max"),": ",r]})]})},Us=p.forwardRef(({className:t,...e},r)=>g.jsx("div",{ref:r,className:fe("bg-card text-card-foreground rounded-xl border shadow",t),...e}));Us.displayName="Card";const gg=p.forwardRef(({className:t,...e},r)=>g.jsx("div",{ref:r,className:fe("flex flex-col space-y-1.5 p-6",t),...e}));gg.displayName="CardHeader";const pg=p.forwardRef(({className:t,...e},r)=>g.jsx("div",{ref:r,className:fe("leading-none font-semibold tracking-tight",t),...e}));pg.displayName="CardTitle";const mg=p.forwardRef(({className:t,...e},r)=>g.jsx("div",{ref:r,className:fe("text-muted-foreground text-sm",t),...e}));mg.displayName="CardDescription";const vg=p.forwardRef(({className:t,...e},r)=>g.jsx("div",{ref:r,className:fe("p-6 pt-0",t),...e}));vg.displayName="CardContent";const yg=p.forwardRef(({className:t,...e},r)=>g.jsx("div",{ref:r,className:fe("flex items-center p-6 pt-0",t),...e}));yg.displayName="CardFooter";function bg(t,e){return p.useReducer((r,n)=>e[r][n]??r,t)}var Fn="ScrollArea",[qs,Ip]=wn(Fn),[wg,Ne]=qs(Fn),Ws=p.forwardRef((t,e)=>{const{__scopeScrollArea:r,type:n="hover",dir:a,scrollHideDelay:o=600,...l}=t,[i,s]=p.useState(null),[c,u]=p.useState(null),[d,h]=p.useState(null),[f,b]=p.useState(null),[y,T]=p.useState(null),[N,_]=p.useState(0),[A,R]=p.useState(0),[I,D]=p.useState(!1),[m,E]=p.useState(!1),x=Xe(e,L=>s(L)),k=Fi(a);return g.jsx(wg,{scope:r,type:n,dir:k,scrollHideDelay:o,scrollArea:i,viewport:c,onViewportChange:u,content:d,onContentChange:h,scrollbarX:f,onScrollbarXChange:b,scrollbarXEnabled:I,onScrollbarXEnabledChange:D,scrollbarY:y,onScrollbarYChange:T,scrollbarYEnabled:m,onScrollbarYEnabledChange:E,onCornerWidthChange:_,onCornerHeightChange:R,children:g.jsx(Ee.div,{dir:k,...l,ref:x,style:{position:"relative","--radix-scroll-area-corner-width":N+"px","--radix-scroll-area-corner-height":A+"px",...t.style}})})});Ws.displayName=Fn;var Xs="ScrollAreaViewport",Ys=p.forwardRef((t,e)=>{const{__scopeScrollArea:r,children:n,nonce:a,...o}=t,l=Ne(Xs,r),i=p.useRef(null),s=Xe(e,i,l.onViewportChange);return g.jsxs(g.Fragment,{children:[g.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),g.jsx(Ee.div,{"data-radix-scroll-area-viewport":"",...o,ref:s,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...t.style},children:g.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});Ys.displayName=Xs;var Ve="ScrollAreaScrollbar",$n=p.forwardRef((t,e)=>{const{forceMount:r,...n}=t,a=Ne(Ve,t.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:l}=a,i=t.orientation==="horizontal";return p.useEffect(()=>(i?o(!0):l(!0),()=>{i?o(!1):l(!1)}),[i,o,l]),a.type==="hover"?g.jsx(xg,{...n,ref:e,forceMount:r}):a.type==="scroll"?g.jsx(Sg,{...n,ref:e,forceMount:r}):a.type==="auto"?g.jsx(Ks,{...n,ref:e,forceMount:r}):a.type==="always"?g.jsx(Mn,{...n,ref:e}):null});$n.displayName=Ve;var xg=p.forwardRef((t,e)=>{const{forceMount:r,...n}=t,a=Ne(Ve,t.__scopeScrollArea),[o,l]=p.useState(!1);return p.useEffect(()=>{const i=a.scrollArea;let s=0;if(i){const c=()=>{window.clearTimeout(s),l(!0)},u=()=>{s=window.setTimeout(()=>l(!1),a.scrollHideDelay)};return i.addEventListener("pointerenter",c),i.addEventListener("pointerleave",u),()=>{window.clearTimeout(s),i.removeEventListener("pointerenter",c),i.removeEventListener("pointerleave",u)}}},[a.scrollArea,a.scrollHideDelay]),g.jsx(St,{present:r||o,children:g.jsx(Ks,{"data-state":o?"visible":"hidden",...n,ref:e})})}),Sg=p.forwardRef((t,e)=>{const{forceMount:r,...n}=t,a=Ne(Ve,t.__scopeScrollArea),o=t.orientation==="horizontal",l=dr(()=>s("SCROLL_END"),100),[i,s]=bg("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return p.useEffect(()=>{if(i==="idle"){const c=window.setTimeout(()=>s("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(c)}},[i,a.scrollHideDelay,s]),p.useEffect(()=>{const c=a.viewport,u=o?"scrollLeft":"scrollTop";if(c){let d=c[u];const h=()=>{const f=c[u];d!==f&&(s("SCROLL"),l()),d=f};return c.addEventListener("scroll",h),()=>c.removeEventListener("scroll",h)}},[a.viewport,o,s,l]),g.jsx(St,{present:r||i!=="hidden",children:g.jsx(Mn,{"data-state":i==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:Ce(t.onPointerEnter,()=>s("POINTER_ENTER")),onPointerLeave:Ce(t.onPointerLeave,()=>s("POINTER_LEAVE"))})})}),Ks=p.forwardRef((t,e)=>{const r=Ne(Ve,t.__scopeScrollArea),{forceMount:n,...a}=t,[o,l]=p.useState(!1),i=t.orientation==="horizontal",s=dr(()=>{if(r.viewport){const c=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;l(i?c:u)}},10);return xt(r.viewport,s),xt(r.content,s),g.jsx(St,{present:n||o,children:g.jsx(Mn,{"data-state":o?"visible":"hidden",...a,ref:e})})}),Mn=p.forwardRef((t,e)=>{const{orientation:r="vertical",...n}=t,a=Ne(Ve,t.__scopeScrollArea),o=p.useRef(null),l=p.useRef(0),[i,s]=p.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=ti(i.viewport,i.content),u={...n,sizes:i,onSizesChange:s,hasThumb:c>0&&c<1,onThumbChange:h=>o.current=h,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:h=>l.current=h};function d(h,f){return Rg(h,l.current,i,f)}return r==="horizontal"?g.jsx(Eg,{...u,ref:e,onThumbPositionChange:()=>{if(a.viewport&&o.current){const h=a.viewport.scrollLeft,f=na(h,i,a.dir);o.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:h=>{a.viewport&&(a.viewport.scrollLeft=h)},onDragScroll:h=>{a.viewport&&(a.viewport.scrollLeft=d(h,a.dir))}}):r==="vertical"?g.jsx(_g,{...u,ref:e,onThumbPositionChange:()=>{if(a.viewport&&o.current){const h=a.viewport.scrollTop,f=na(h,i);o.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:h=>{a.viewport&&(a.viewport.scrollTop=h)},onDragScroll:h=>{a.viewport&&(a.viewport.scrollTop=d(h))}}):null}),Eg=p.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...a}=t,o=Ne(Ve,t.__scopeScrollArea),[l,i]=p.useState(),s=p.useRef(null),c=Xe(e,s,o.onScrollbarXChange);return p.useEffect(()=>{s.current&&i(getComputedStyle(s.current))},[s]),g.jsx(Js,{"data-orientation":"horizontal",...a,ref:c,sizes:r,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ur(r)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.x),onDragScroll:u=>t.onDragScroll(u.x),onWheelScroll:(u,d)=>{if(o.viewport){const h=o.viewport.scrollLeft+u.deltaX;t.onWheelScroll(h),ni(h,d)&&u.preventDefault()}},onResize:()=>{s.current&&o.viewport&&l&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:s.current.clientWidth,paddingStart:Jt(l.paddingLeft),paddingEnd:Jt(l.paddingRight)}})}})}),_g=p.forwardRef((t,e)=>{const{sizes:r,onSizesChange:n,...a}=t,o=Ne(Ve,t.__scopeScrollArea),[l,i]=p.useState(),s=p.useRef(null),c=Xe(e,s,o.onScrollbarYChange);return p.useEffect(()=>{s.current&&i(getComputedStyle(s.current))},[s]),g.jsx(Js,{"data-orientation":"vertical",...a,ref:c,sizes:r,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ur(r)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.y),onDragScroll:u=>t.onDragScroll(u.y),onWheelScroll:(u,d)=>{if(o.viewport){const h=o.viewport.scrollTop+u.deltaY;t.onWheelScroll(h),ni(h,d)&&u.preventDefault()}},onResize:()=>{s.current&&o.viewport&&l&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:s.current.clientHeight,paddingStart:Jt(l.paddingTop),paddingEnd:Jt(l.paddingBottom)}})}})}),[Cg,Qs]=qs(Ve),Js=p.forwardRef((t,e)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:a,onThumbChange:o,onThumbPointerUp:l,onThumbPointerDown:i,onThumbPositionChange:s,onDragScroll:c,onWheelScroll:u,onResize:d,...h}=t,f=Ne(Ve,r),[b,y]=p.useState(null),T=Xe(e,x=>y(x)),N=p.useRef(null),_=p.useRef(""),A=f.viewport,R=n.content-n.viewport,I=ct(u),D=ct(s),m=dr(d,10);function E(x){if(N.current){const k=x.clientX-N.current.left,L=x.clientY-N.current.top;c({x:k,y:L})}}return p.useEffect(()=>{const x=k=>{const L=k.target;(b==null?void 0:b.contains(L))&&I(k,R)};return document.addEventListener("wheel",x,{passive:!1}),()=>document.removeEventListener("wheel",x,{passive:!1})},[A,b,R,I]),p.useEffect(D,[n,D]),xt(b,m),xt(f.content,m),g.jsx(Cg,{scope:r,scrollbar:b,hasThumb:a,onThumbChange:ct(o),onThumbPointerUp:ct(l),onThumbPositionChange:D,onThumbPointerDown:ct(i),children:g.jsx(Ee.div,{...h,ref:T,style:{position:"absolute",...h.style},onPointerDown:Ce(t.onPointerDown,x=>{x.button===0&&(x.target.setPointerCapture(x.pointerId),N.current=b.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),E(x))}),onPointerMove:Ce(t.onPointerMove,E),onPointerUp:Ce(t.onPointerUp,x=>{const k=x.target;k.hasPointerCapture(x.pointerId)&&k.releasePointerCapture(x.pointerId),document.body.style.webkitUserSelect=_.current,f.viewport&&(f.viewport.style.scrollBehavior=""),N.current=null})})})}),Qt="ScrollAreaThumb",Zs=p.forwardRef((t,e)=>{const{forceMount:r,...n}=t,a=Qs(Qt,t.__scopeScrollArea);return g.jsx(St,{present:r||a.hasThumb,children:g.jsx(kg,{ref:e,...n})})}),kg=p.forwardRef((t,e)=>{const{__scopeScrollArea:r,style:n,...a}=t,o=Ne(Qt,r),l=Qs(Qt,r),{onThumbPositionChange:i}=l,s=Xe(e,d=>l.onThumbChange(d)),c=p.useRef(void 0),u=dr(()=>{c.current&&(c.current(),c.current=void 0)},100);return p.useEffect(()=>{const d=o.viewport;if(d){const h=()=>{if(u(),!c.current){const f=Ag(d,i);c.current=f,i()}};return i(),d.addEventListener("scroll",h),()=>d.removeEventListener("scroll",h)}},[o.viewport,u,i]),g.jsx(Ee.div,{"data-state":l.hasThumb?"visible":"hidden",...a,ref:s,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:Ce(t.onPointerDownCapture,d=>{const f=d.target.getBoundingClientRect(),b=d.clientX-f.left,y=d.clientY-f.top;l.onThumbPointerDown({x:b,y})}),onPointerUp:Ce(t.onPointerUp,l.onThumbPointerUp)})});Zs.displayName=Qt;var Hn="ScrollAreaCorner",ei=p.forwardRef((t,e)=>{const r=Ne(Hn,t.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?g.jsx(Tg,{...t,ref:e}):null});ei.displayName=Hn;var Tg=p.forwardRef((t,e)=>{const{__scopeScrollArea:r,...n}=t,a=Ne(Hn,r),[o,l]=p.useState(0),[i,s]=p.useState(0),c=!!(o&&i);return xt(a.scrollbarX,()=>{var d;const u=((d=a.scrollbarX)==null?void 0:d.offsetHeight)||0;a.onCornerHeightChange(u),s(u)}),xt(a.scrollbarY,()=>{var d;const u=((d=a.scrollbarY)==null?void 0:d.offsetWidth)||0;a.onCornerWidthChange(u),l(u)}),c?g.jsx(Ee.div,{...n,ref:e,style:{width:o,height:i,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function Jt(t){return t?parseInt(t,10):0}function ti(t,e){const r=t/e;return isNaN(r)?0:r}function ur(t){const e=ti(t.viewport,t.content),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=(t.scrollbar.size-r)*e;return Math.max(n,18)}function Rg(t,e,r,n="ltr"){const a=ur(r),o=a/2,l=e||o,i=a-l,s=r.scrollbar.paddingStart+l,c=r.scrollbar.size-r.scrollbar.paddingEnd-i,u=r.content-r.viewport,d=n==="ltr"?[0,u]:[u*-1,0];return ri([s,c],d)(t)}function na(t,e,r="ltr"){const n=ur(e),a=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-a,l=e.content-e.viewport,i=o-n,s=r==="ltr"?[0,l]:[l*-1,0],c=Mi(t,s);return ri([0,l],[0,i])(c)}function ri(t,e){return r=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const n=(e[1]-e[0])/(t[1]-t[0]);return e[0]+n*(r-t[0])}}function ni(t,e){return t>0&&t<e}var Ag=(t,e=()=>{})=>{let r={left:t.scrollLeft,top:t.scrollTop},n=0;return function a(){const o={left:t.scrollLeft,top:t.scrollTop},l=r.left!==o.left,i=r.top!==o.top;(l||i)&&e(),r=o,n=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(n)};function dr(t,e){const r=ct(t),n=p.useRef(0);return p.useEffect(()=>()=>window.clearTimeout(n.current),[]),p.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,e)},[r,e])}function xt(t,e){const r=ct(e);$i(()=>{let n=0;if(t){const a=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return a.observe(t),()=>{window.cancelAnimationFrame(n),a.unobserve(t)}}},[t,r])}var oi=Ws,jg=Ys,Ig=ei;const ai=p.forwardRef(({className:t,children:e,...r},n)=>g.jsxs(oi,{ref:n,className:fe("relative overflow-hidden",t),...r,children:[g.jsx(jg,{className:"h-full w-full rounded-[inherit]",children:e}),g.jsx(si,{}),g.jsx(Ig,{})]}));ai.displayName=oi.displayName;const si=p.forwardRef(({className:t,orientation:e="vertical",...r},n)=>g.jsx($n,{ref:n,orientation:e,className:fe("flex touch-none transition-colors select-none",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...r,children:g.jsx(Zs,{className:"bg-border relative flex-1 rounded-full"})}));si.displayName=$n.displayName;const Lg=({className:t})=>{const{t:e}=xe(),r=ee.use.typeColorMap();return!r||r.size===0?null:g.jsxs(Us,{className:`p-2 max-w-xs ${t}`,children:[g.jsx("h3",{className:"text-sm font-medium mb-2",children:e("graphPanel.legend")}),g.jsx(ai,{className:"max-h-80",children:g.jsx("div",{className:"flex flex-col gap-1",children:Array.from(r.entries()).map(([n,a])=>g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:a}}),g.jsx("span",{className:"text-xs truncate",title:n,children:e(`graphPanel.nodeTypes.${n.toLowerCase()}`,n)})]},n))})})]})},Ng=()=>{const{t}=xe(),e=re.use.showLegend(),r=re.use.setShowLegend(),n=p.useCallback(()=>{r(!e)},[e,r]);return g.jsx(be,{variant:Le,onClick:n,tooltip:t("graphPanel.sideBar.legendControl.toggleLegend"),size:"icon",children:g.jsx(Ic,{})})},oa={allowInvalidContainer:!0,defaultNodeType:"default",defaultEdgeType:"curvedNoArrow",renderEdgeLabels:!1,edgeProgramClasses:{arrow:Si,curvedArrow:Ad,curvedNoArrow:Rd},nodeProgramClasses:{default:dd,circel:xi,point:Fu},labelGridCellSize:60,labelRenderedSizeThreshold:12,enableEdgeEvents:!0,labelColor:{color:"#000",attribute:"labelColor"},edgeLabelColor:{color:"#000",attribute:"labelColor"},edgeLabelSize:8,labelSize:12},Pg=()=>{const t=ga(),e=Be(),[r,n]=p.useState(null);return p.useEffect(()=>{t({downNode:a=>{n(a.node),e.getGraph().setNodeAttribute(a.node,"highlighted",!0)},mousemovebody:a=>{if(!r)return;const o=e.viewportToGraph(a);e.getGraph().setNodeAttribute(r,"x",o.x),e.getGraph().setNodeAttribute(r,"y",o.y),a.preventSigmaDefault(),a.original.preventDefault(),a.original.stopPropagation()},mouseup:()=>{r&&(n(null),e.getGraph().removeNodeAttribute(r,"highlighted"))},mousedown:a=>{a.original.buttons!==0&&!e.getCustomBBox()&&e.setCustomBBox(e.getBBox())}})},[t,e,r]),null},Lp=()=>{const[t,e]=p.useState(oa),r=p.useRef(null),n=ee.use.selectedNode(),a=ee.use.focusedNode(),o=ee.use.moveToSelectedNode(),l=ee.use.isFetching(),i=re.use.showPropertyPanel(),s=re.use.showNodeSearchBar(),c=re.use.enableNodeDrag(),u=re.use.showLegend();p.useEffect(()=>{e(oa),console.log("Initialized sigma settings")},[]),p.useEffect(()=>()=>{const y=ee.getState().sigmaInstance;if(y)try{y.kill(),ee.getState().setSigmaInstance(null),console.log("Cleared sigma instance on Graphviewer unmount")}catch(T){console.error("Error cleaning up sigma instance:",T)}},[]);const d=p.useCallback(y=>{y===null?ee.getState().setFocusedNode(null):y.type==="nodes"&&ee.getState().setFocusedNode(y.id)},[]),h=p.useCallback(y=>{y===null?ee.getState().setSelectedNode(null):y.type==="nodes"&&ee.getState().setSelectedNode(y.id,!0)},[]),f=p.useMemo(()=>a??n,[a,n]),b=p.useMemo(()=>n?{type:"nodes",id:n}:null,[n]);return g.jsxs("div",{className:"relative h-full w-full overflow-hidden",children:[g.jsxs(Ei,{settings:t,className:"!bg-background !size-full overflow-hidden",ref:r,children:[g.jsx(Kf,{}),c&&g.jsx(Pg,{}),g.jsx(jd,{node:f,move:o}),g.jsxs("div",{className:"absolute top-2 left-2 flex items-start gap-2",children:[g.jsx(Ih,{}),s&&g.jsx(Rh,{value:b,onFocus:d,onChange:h})]}),g.jsxs("div",{className:"bg-background/60 absolute bottom-2 left-2 flex flex-col rounded-xl border-2 backdrop-blur-lg",children:[g.jsx(Xf,{}),g.jsx(Qf,{}),g.jsx(Jf,{}),g.jsx(Ng,{}),g.jsx(ih,{})]}),i&&g.jsx("div",{className:"absolute top-2 right-2",children:g.jsx(lg,{})}),u&&g.jsx("div",{className:"absolute bottom-10 right-2",children:g.jsx(Lg,{className:"bg-background/60 backdrop-blur-lg"})}),g.jsx(hg,{})]}),l&&g.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/80 z-10",children:g.jsxs("div",{className:"text-center",children:[g.jsx("div",{className:"mb-2 h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),g.jsx("p",{children:"Loading Graph Data..."})]})})]})};export{Bs as $,up as A,be as B,Us as C,Lu as D,vp as E,bp as F,vg as G,lp as H,qt as I,wp as J,hp as K,fp as L,gp as M,pp as N,Va as O,Vs as P,mp as Q,uu as R,ai as S,kp as T,Tp as U,Sp as V,Yf as W,ku as X,Kg as Y,Yg as Z,$g as _,pg as a,Cp as a0,Ji as a1,no as a2,Ug as a3,qg as a4,Tn as a5,Rn as a6,_p as a7,sr as a8,Zr as a9,Mg as aa,Rp as ab,Vg as ac,$a as ad,Ma as ae,Ha as af,kn as ag,xp as ah,Ep as ai,_a as aj,Yr as ak,Hg as al,op as am,Lp as an,ep as ao,rp as ap,np as aq,ap as ar,mg as b,fe as c,rt as d,yp as e,Qg as f,tr as g,Ap as h,Xa as i,Ya as j,Qa as k,Ja as l,Jg as m,Zg as n,Ns as o,Ka as p,cp as q,dp as r,Bg as s,tp as t,xe as u,_n as v,re as w,Wg as x,Xg as y,gg as z};
|