From bf18a5406ed1e2685202f5aa48285ea6476e2f18 Mon Sep 17 00:00:00 2001 From: zrguo Date: Mon, 17 Mar 2025 23:32:35 +0800 Subject: [PATCH 01/16] add citation --- lightrag/base.py | 2 + lightrag/lightrag.py | 93 +++++++++++++++++++++++++++--------- lightrag/operate.py | 109 +++++++++++++++++++++++++++++++++++++------ lightrag/prompt.py | 10 ++-- 4 files changed, 173 insertions(+), 41 deletions(-) diff --git a/lightrag/base.py b/lightrag/base.py index 86566787..f0376c01 100644 --- a/lightrag/base.py +++ b/lightrag/base.py @@ -257,6 +257,8 @@ class DocProcessingStatus: """First 100 chars of document content, used for preview""" content_length: int """Total length of document""" + file_path: str + """File path of the document""" status: DocStatus """Current processing status""" created_at: str diff --git a/lightrag/lightrag.py b/lightrag/lightrag.py index 27a03e12..275c910f 100644 --- a/lightrag/lightrag.py +++ b/lightrag/lightrag.py @@ -389,20 +389,21 @@ class LightRAG: self.namespace_prefix, NameSpace.VECTOR_STORE_ENTITIES ), embedding_func=self.embedding_func, - meta_fields={"entity_name", "source_id", "content"}, + meta_fields={"entity_name", "source_id", "content", "file_path"}, ) self.relationships_vdb: BaseVectorStorage = self.vector_db_storage_cls( # type: ignore namespace=make_namespace( self.namespace_prefix, NameSpace.VECTOR_STORE_RELATIONSHIPS ), embedding_func=self.embedding_func, - meta_fields={"src_id", "tgt_id", "source_id", "content"}, + meta_fields={"src_id", "tgt_id", "source_id", "content", "file_path"}, ) self.chunks_vdb: BaseVectorStorage = self.vector_db_storage_cls( # type: ignore namespace=make_namespace( self.namespace_prefix, NameSpace.VECTOR_STORE_CHUNKS ), embedding_func=self.embedding_func, + meta_fields={"full_doc_id", "content", "file_path"}, ) # Initialize document status storage @@ -547,6 +548,7 @@ class LightRAG: split_by_character: str | None = None, split_by_character_only: bool = False, ids: str | list[str] | None = None, + file_paths: str | list[str] | None = None, ) -> None: """Sync Insert documents with checkpoint support @@ -557,10 +559,11 @@ class LightRAG: split_by_character_only: if split_by_character_only is True, split the string by character only, when split_by_character is None, this parameter is ignored. ids: single string of the document ID or list of unique document IDs, if not provided, MD5 hash IDs will be generated + file_paths: single string of the file path or list of file paths, used for citation """ loop = always_get_an_event_loop() loop.run_until_complete( - self.ainsert(input, split_by_character, split_by_character_only, ids) + self.ainsert(input, split_by_character, split_by_character_only, ids, file_paths) ) async def ainsert( @@ -569,6 +572,7 @@ class LightRAG: split_by_character: str | None = None, split_by_character_only: bool = False, ids: str | list[str] | None = None, + file_paths: str | list[str] | None = None, ) -> None: """Async Insert documents with checkpoint support @@ -579,8 +583,9 @@ class LightRAG: split_by_character_only: if split_by_character_only is True, split the string by character only, when split_by_character is None, this parameter is ignored. ids: list of unique document IDs, if not provided, MD5 hash IDs will be generated + file_paths: list of file paths corresponding to each document, used for citation """ - await self.apipeline_enqueue_documents(input, ids) + await self.apipeline_enqueue_documents(input, ids, file_paths) await self.apipeline_process_enqueue_documents( split_by_character, split_by_character_only ) @@ -654,7 +659,7 @@ class LightRAG: await self._insert_done() async def apipeline_enqueue_documents( - self, input: str | list[str], ids: list[str] | None = None + self, input: str | list[str], ids: list[str] | None = None, file_paths: str | list[str] | None = None ) -> None: """ Pipeline for Processing Documents @@ -664,11 +669,28 @@ class LightRAG: 3. Generate document initial status 4. Filter out already processed documents 5. Enqueue document in status + + Args: + input: Single document string or list of document strings + ids: list of unique document IDs, if not provided, MD5 hash IDs will be generated + file_paths: list of file paths corresponding to each document, used for citation """ if isinstance(input, str): input = [input] if isinstance(ids, str): ids = [ids] + if isinstance(file_paths, str): + file_paths = [file_paths] + + # If file_paths is provided, ensure it matches the number of documents + if file_paths is not None: + if isinstance(file_paths, str): + file_paths = [file_paths] + if len(file_paths) != len(input): + raise ValueError("Number of file paths must match the number of documents") + else: + # If no file paths provided, use placeholder + file_paths = ["unknown_source"] * len(input) # 1. Validate ids if provided or generate MD5 hash IDs if ids is not None: @@ -681,32 +703,47 @@ class LightRAG: raise ValueError("IDs must be unique") # Generate contents dict of IDs provided by user and documents - contents = {id_: doc for id_, doc in zip(ids, input)} + contents = {id_: {"content": doc, "file_path": path} + for id_, doc, path in zip(ids, input, file_paths)} else: # Clean input text and remove duplicates - input = list(set(clean_text(doc) for doc in input)) - # Generate contents dict of MD5 hash IDs and documents - contents = {compute_mdhash_id(doc, prefix="doc-"): doc for doc in input} + cleaned_input = [(clean_text(doc), path) for doc, path in zip(input, file_paths)] + unique_content_with_paths = {} + + # Keep track of unique content and their paths + for content, path in cleaned_input: + if content not in unique_content_with_paths: + unique_content_with_paths[content] = path + + # Generate contents dict of MD5 hash IDs and documents with paths + contents = {compute_mdhash_id(content, prefix="doc-"): + {"content": content, "file_path": path} + for content, path in unique_content_with_paths.items()} # 2. Remove duplicate contents - unique_contents = { - id_: content - for content, id_ in { - content: id_ for id_, content in contents.items() - }.items() - } + unique_contents = {} + for id_, content_data in contents.items(): + content = content_data["content"] + file_path = content_data["file_path"] + if content not in unique_contents: + unique_contents[content] = (id_, file_path) + + # Reconstruct contents with unique content + contents = {id_: {"content": content, "file_path": file_path} + for content, (id_, file_path) in unique_contents.items()} # 3. Generate document initial status new_docs: dict[str, Any] = { id_: { - "content": content, - "content_summary": get_content_summary(content), - "content_length": len(content), "status": DocStatus.PENDING, + "content": content_data["content"], + "content_summary": get_content_summary(content_data["content"]), + "content_length": len(content_data["content"]), "created_at": datetime.now().isoformat(), "updated_at": datetime.now().isoformat(), + "file_path": content_data["file_path"], # Store file path in document status } - for id_, content in unique_contents.items() + for id_, content_data in contents.items() } # 4. Filter out already processed documents @@ -841,11 +878,15 @@ class LightRAG: ) -> None: """Process single document""" try: + # Get file path from status document + file_path = getattr(status_doc, "file_path", "unknown_source") + # Generate chunks from document chunks: dict[str, Any] = { compute_mdhash_id(dp["content"], prefix="chunk-"): { **dp, "full_doc_id": doc_id, + "file_path": file_path, # Add file path to each chunk } for dp in self.chunking_func( status_doc.content, @@ -856,6 +897,7 @@ class LightRAG: self.tiktoken_model_name, ) } + # Process document (text chunks and full docs) in parallel # Create tasks with references for potential cancellation doc_status_task = asyncio.create_task( @@ -863,11 +905,13 @@ class LightRAG: { doc_id: { "status": DocStatus.PROCESSING, - "updated_at": datetime.now().isoformat(), + "chunks_count": len(chunks), "content": status_doc.content, "content_summary": status_doc.content_summary, "content_length": status_doc.content_length, "created_at": status_doc.created_at, + "updated_at": datetime.now().isoformat(), + "file_path": file_path, } } ) @@ -906,6 +950,7 @@ class LightRAG: "content_length": status_doc.content_length, "created_at": status_doc.created_at, "updated_at": datetime.now().isoformat(), + "file_path": file_path, } } ) @@ -937,6 +982,7 @@ class LightRAG: "content_length": status_doc.content_length, "created_at": status_doc.created_at, "updated_at": datetime.now().isoformat(), + "file_path": file_path, } } ) @@ -1063,7 +1109,7 @@ class LightRAG: loop.run_until_complete(self.ainsert_custom_kg(custom_kg, full_doc_id)) async def ainsert_custom_kg( - self, custom_kg: dict[str, Any], full_doc_id: str = None + self, custom_kg: dict[str, Any], full_doc_id: str = None, file_path: str = "custom_kg" ) -> None: update_storage = False try: @@ -1093,6 +1139,7 @@ class LightRAG: "full_doc_id": full_doc_id if full_doc_id is not None else source_id, + "file_path": file_path, # Add file path "status": DocStatus.PROCESSED, } all_chunks_data[chunk_id] = chunk_entry @@ -1197,6 +1244,7 @@ class LightRAG: "source_id": dp["source_id"], "description": dp["description"], "entity_type": dp["entity_type"], + "file_path": file_path, # Add file path } for dp in all_entities_data } @@ -1212,6 +1260,7 @@ class LightRAG: "keywords": dp["keywords"], "description": dp["description"], "weight": dp["weight"], + "file_path": file_path, # Add file path } for dp in all_relationships_data } @@ -2220,7 +2269,6 @@ class LightRAG: """Synchronously create a new entity. Creates a new entity in the knowledge graph and adds it to the vector database. - Args: entity_name: Name of the new entity entity_data: Dictionary containing entity attributes, e.g. {"description": "description", "entity_type": "type"} @@ -3077,3 +3125,4 @@ class LightRAG: ] ] ) + diff --git a/lightrag/operate.py b/lightrag/operate.py index d062ae73..6c99992f 100644 --- a/lightrag/operate.py +++ b/lightrag/operate.py @@ -138,6 +138,7 @@ async def _handle_entity_relation_summary( async def _handle_single_entity_extraction( record_attributes: list[str], chunk_key: str, + file_path: str = "unknown_source", ): if len(record_attributes) < 4 or record_attributes[0] != '"entity"': return None @@ -171,13 +172,14 @@ async def _handle_single_entity_extraction( entity_type=entity_type, description=entity_description, source_id=chunk_key, - metadata={"created_at": time.time()}, + metadata={"created_at": time.time(), "file_path": file_path}, ) async def _handle_single_relationship_extraction( record_attributes: list[str], chunk_key: str, + file_path: str = "unknown_source", ): if len(record_attributes) < 5 or record_attributes[0] != '"relationship"': return None @@ -199,7 +201,7 @@ async def _handle_single_relationship_extraction( description=edge_description, keywords=edge_keywords, source_id=edge_source_id, - metadata={"created_at": time.time()}, + metadata={"created_at": time.time(), "file_path": file_path}, ) @@ -213,6 +215,7 @@ async def _merge_nodes_then_upsert( already_entity_types = [] already_source_ids = [] already_description = [] + already_file_paths = [] already_node = await knowledge_graph_inst.get_node(entity_name) if already_node is not None: @@ -220,6 +223,9 @@ async def _merge_nodes_then_upsert( already_source_ids.extend( split_string_by_multi_markers(already_node["source_id"], [GRAPH_FIELD_SEP]) ) + already_file_paths.extend( + split_string_by_multi_markers(already_node["metadata"]["file_path"], [GRAPH_FIELD_SEP]) + ) already_description.append(already_node["description"]) entity_type = sorted( @@ -235,6 +241,10 @@ async def _merge_nodes_then_upsert( source_id = GRAPH_FIELD_SEP.join( set([dp["source_id"] for dp in nodes_data] + already_source_ids) ) + file_path = GRAPH_FIELD_SEP.join( + set([dp["metadata"]["file_path"] for dp in nodes_data] + already_file_paths) + ) + print(f"file_path: {file_path}") description = await _handle_entity_relation_summary( entity_name, description, global_config ) @@ -243,6 +253,7 @@ async def _merge_nodes_then_upsert( entity_type=entity_type, description=description, source_id=source_id, + file_path=file_path, ) await knowledge_graph_inst.upsert_node( entity_name, @@ -263,6 +274,7 @@ async def _merge_edges_then_upsert( already_source_ids = [] already_description = [] already_keywords = [] + already_file_paths = [] if await knowledge_graph_inst.has_edge(src_id, tgt_id): already_edge = await knowledge_graph_inst.get_edge(src_id, tgt_id) @@ -278,6 +290,14 @@ async def _merge_edges_then_upsert( already_edge["source_id"], [GRAPH_FIELD_SEP] ) ) + + # Get file_path with empty string default if missing or None + if already_edge.get("file_path") is not None: + already_file_paths.extend( + split_string_by_multi_markers( + already_edge["metadata"]["file_path"], [GRAPH_FIELD_SEP] + ) + ) # Get description with empty string default if missing or None if already_edge.get("description") is not None: @@ -315,6 +335,9 @@ async def _merge_edges_then_upsert( + already_source_ids ) ) + file_path = GRAPH_FIELD_SEP.join( + set([dp["metadata"]["file_path"] for dp in edges_data if dp.get("metadata", {}).get("file_path")] + already_file_paths) + ) for need_insert_id in [src_id, tgt_id]: if not (await knowledge_graph_inst.has_node(need_insert_id)): @@ -325,6 +348,7 @@ async def _merge_edges_then_upsert( "source_id": source_id, "description": description, "entity_type": "UNKNOWN", + "file_path": file_path, }, ) description = await _handle_entity_relation_summary( @@ -338,6 +362,7 @@ async def _merge_edges_then_upsert( description=description, keywords=keywords, source_id=source_id, + file_path=file_path, ), ) @@ -347,6 +372,7 @@ async def _merge_edges_then_upsert( description=description, keywords=keywords, source_id=source_id, + file_path=file_path, ) return edge_data @@ -456,11 +482,12 @@ async def extract_entities( else: return await use_llm_func(input_text) - async def _process_extraction_result(result: str, chunk_key: str): + async def _process_extraction_result(result: str, chunk_key: str, file_path: str = "unknown_source"): """Process a single extraction result (either initial or gleaning) Args: result (str): The extraction result to process chunk_key (str): The chunk key for source tracking + file_path (str): The file path for citation Returns: tuple: (nodes_dict, edges_dict) containing the extracted entities and relationships """ @@ -482,14 +509,14 @@ async def extract_entities( ) if_entities = await _handle_single_entity_extraction( - record_attributes, chunk_key + record_attributes, chunk_key, file_path ) if if_entities is not None: maybe_nodes[if_entities["entity_name"]].append(if_entities) continue if_relation = await _handle_single_relationship_extraction( - record_attributes, chunk_key + record_attributes, chunk_key, file_path ) if if_relation is not None: maybe_edges[(if_relation["src_id"], if_relation["tgt_id"])].append( @@ -508,6 +535,8 @@ async def extract_entities( chunk_key = chunk_key_dp[0] chunk_dp = chunk_key_dp[1] content = chunk_dp["content"] + # Get file path from chunk data or use default + file_path = chunk_dp.get("file_path", "unknown_source") # Get initial extraction hint_prompt = entity_extract_prompt.format( @@ -517,9 +546,9 @@ async def extract_entities( final_result = await _user_llm_func_with_cache(hint_prompt) history = pack_user_ass_to_openai_messages(hint_prompt, final_result) - # Process initial extraction + # Process initial extraction with file path maybe_nodes, maybe_edges = await _process_extraction_result( - final_result, chunk_key + final_result, chunk_key, file_path ) # Process additional gleaning results @@ -530,9 +559,9 @@ async def extract_entities( history += pack_user_ass_to_openai_messages(continue_prompt, glean_result) - # Process gleaning result separately + # Process gleaning result separately with file path glean_nodes, glean_edges = await _process_extraction_result( - glean_result, chunk_key + glean_result, chunk_key, file_path ) # Merge results @@ -594,7 +623,7 @@ async def extract_entities( for k, v in maybe_edges.items() ] ) - + if not (all_entities_data or all_relationships_data): log_message = "Didn't extract any entities and relationships." logger.info(log_message) @@ -637,8 +666,10 @@ async def extract_entities( "entity_type": dp["entity_type"], "content": f"{dp['entity_name']}\n{dp['description']}", "source_id": dp["source_id"], + "file_path": dp.get("metadata", {}).get("file_path", "unknown_source"), "metadata": { - "created_at": dp.get("metadata", {}).get("created_at", time.time()) + "created_at": dp.get("metadata", {}).get("created_at", time.time()), + "file_path": dp.get("metadata", {}).get("file_path", "unknown_source"), }, } for dp in all_entities_data @@ -653,8 +684,10 @@ async def extract_entities( "keywords": dp["keywords"], "content": f"{dp['src_id']}\t{dp['tgt_id']}\n{dp['keywords']}\n{dp['description']}", "source_id": dp["source_id"], + "file_path": dp.get("metadata", {}).get("file_path", "unknown_source"), "metadata": { - "created_at": dp.get("metadata", {}).get("created_at", time.time()) + "created_at": dp.get("metadata", {}).get("created_at", time.time()), + "file_path": dp.get("metadata", {}).get("file_path", "unknown_source"), }, } for dp in all_relationships_data @@ -1232,12 +1265,20 @@ async def _get_node_data( "description", "rank", "created_at", + "file_path", ] ] for i, n in enumerate(node_datas): created_at = n.get("created_at", "UNKNOWN") if isinstance(created_at, (int, float)): created_at = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(created_at)) + + # Get file path from metadata or directly from node data + file_path = n.get("file_path", "unknown_source") + if not file_path or file_path == "unknown_source": + # Try to get from metadata + file_path = n.get("metadata", {}).get("file_path", "unknown_source") + entites_section_list.append( [ i, @@ -1246,6 +1287,7 @@ async def _get_node_data( n.get("description", "UNKNOWN"), n["rank"], created_at, + file_path, ] ) entities_context = list_of_list_to_csv(entites_section_list) @@ -1260,6 +1302,7 @@ async def _get_node_data( "weight", "rank", "created_at", + "file_path", ] ] for i, e in enumerate(use_relations): @@ -1267,6 +1310,13 @@ async def _get_node_data( # Convert timestamp to readable format if isinstance(created_at, (int, float)): created_at = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(created_at)) + + # Get file path from metadata or directly from edge data + file_path = e.get("file_path", "unknown_source") + if not file_path or file_path == "unknown_source": + # Try to get from metadata + file_path = e.get("metadata", {}).get("file_path", "unknown_source") + relations_section_list.append( [ i, @@ -1277,6 +1327,7 @@ async def _get_node_data( e["weight"], e["rank"], created_at, + file_path, ] ) relations_context = list_of_list_to_csv(relations_section_list) @@ -1492,6 +1543,7 @@ async def _get_edge_data( "weight", "rank", "created_at", + "file_path", ] ] for i, e in enumerate(edge_datas): @@ -1499,6 +1551,13 @@ async def _get_edge_data( # Convert timestamp to readable format if isinstance(created_at, (int, float)): created_at = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(created_at)) + + # Get file path from metadata or directly from edge data + file_path = e.get("file_path", "unknown_source") + if not file_path or file_path == "unknown_source": + # Try to get from metadata + file_path = e.get("metadata", {}).get("file_path", "unknown_source") + relations_section_list.append( [ i, @@ -1509,16 +1568,34 @@ async def _get_edge_data( e["weight"], e["rank"], created_at, + file_path, ] ) relations_context = list_of_list_to_csv(relations_section_list) - entites_section_list = [["id", "entity", "type", "description", "rank"]] + entites_section_list = [ + [ + "id", + "entity", + "type", + "description", + "rank", + "created_at", + "file_path" + ] + ] for i, n in enumerate(use_entities): - created_at = e.get("created_at", "Unknown") + created_at = n.get("created_at", "Unknown") # Convert timestamp to readable format if isinstance(created_at, (int, float)): created_at = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(created_at)) + + # Get file path from metadata or directly from node data + file_path = n.get("file_path", "unknown_source") + if not file_path or file_path == "unknown_source": + # Try to get from metadata + file_path = n.get("metadata", {}).get("file_path", "unknown_source") + entites_section_list.append( [ i, @@ -1527,6 +1604,7 @@ async def _get_edge_data( n.get("description", "UNKNOWN"), n["rank"], created_at, + file_path, ] ) entities_context = list_of_list_to_csv(entites_section_list) @@ -1882,13 +1960,14 @@ async def kg_query_with_keywords( len_of_prompts = len(encode_string_by_tiktoken(query + sys_prompt)) logger.debug(f"[kg_query_with_keywords]Prompt Tokens: {len_of_prompts}") + # 6. Generate response response = await use_model_func( query, system_prompt=sys_prompt, stream=query_param.stream, ) - # 清理响应内容 + # Clean up response content if isinstance(response, str) and len(response) > len(sys_prompt): response = ( response.replace(sys_prompt, "") diff --git a/lightrag/prompt.py b/lightrag/prompt.py index f81cd441..88ebd7fc 100644 --- a/lightrag/prompt.py +++ b/lightrag/prompt.py @@ -61,7 +61,7 @@ Text: ``` while Alex clenched his jaw, the buzz of frustration dull against the backdrop of Taylor's authoritarian certainty. It was this competitive undercurrent that kept him alert, the sense that his and Jordan's shared commitment to discovery was an unspoken rebellion against Cruz's narrowing vision of control and order. -Then Taylor did something unexpected. They paused beside Jordan and, for a moment, observed the device with something akin to reverence. “If this tech can be understood..." Taylor said, their voice quieter, "It could change the game for us. For all of us.” +Then Taylor did something unexpected. They paused beside Jordan and, for a moment, observed the device with something akin to reverence. "If this tech can be understood..." Taylor said, their voice quieter, "It could change the game for us. For all of us." The underlying dismissal earlier seemed to falter, replaced by a glimpse of reluctant respect for the gravity of what lay in their hands. Jordan looked up, and for a fleeting heartbeat, their eyes locked with Taylor's, a wordless clash of wills softening into an uneasy truce. @@ -92,7 +92,7 @@ Among the hardest hit, Nexon Technologies saw its stock plummet by 7.8% after re Meanwhile, commodity markets reflected a mixed sentiment. Gold futures rose by 1.5%, reaching $2,080 per ounce, as investors sought safe-haven assets. Crude oil prices continued their rally, climbing to $87.60 per barrel, supported by supply constraints and strong demand. -Financial experts are closely watching the Federal Reserve’s next move, as speculation grows over potential rate hikes. The upcoming policy announcement is expected to influence investor confidence and overall market stability. +Financial experts are closely watching the Federal Reserve's next move, as speculation grows over potential rate hikes. The upcoming policy announcement is expected to influence investor confidence and overall market stability. ``` Output: @@ -222,6 +222,7 @@ When handling relationships with timestamps: - Use markdown formatting with appropriate section headings - Please respond in the same language as the user's question. - Ensure the response maintains continuity with the conversation history. +- List up to 5 most important reference sources at the end under "References" section. Clearly indicating whether each source is from Knowledge Graph (KG) or Vector Data (DC), and include the file path if available, in the following format: [KG/DC] Source content (File: file_path) - If you don't know the answer, just say so. - Do not make anything up. Do not include information not provided by the Knowledge Base.""" @@ -319,6 +320,7 @@ When handling content with timestamps: - Use markdown formatting with appropriate section headings - Please respond in the same language as the user's question. - Ensure the response maintains continuity with the conversation history. +- List up to 5 most important reference sources at the end under "References" section. Clearly indicating whether each source is from Knowledge Graph (KG) or Vector Data (DC), and include the file path if available, in the following format: [KG/DC] Source content (File: file_path) - If you don't know the answer, just say so. - Do not include information not provided by the Document Chunks.""" @@ -378,8 +380,8 @@ When handling information with timestamps: - Use markdown formatting with appropriate section headings - Please respond in the same language as the user's question. - Ensure the response maintains continuity with the conversation history. -- Organize answer in sesctions focusing on one main point or aspect of the answer +- Organize answer in sections focusing on one main point or aspect of the answer - Use clear and descriptive section titles that reflect the content -- List up to 5 most important reference sources at the end under "References" sesction. Clearly indicating whether each source is from Knowledge Graph (KG) or Vector Data (DC), in the following format: [KG/DC] Source content +- List up to 5 most important reference sources at the end under "References" section. Clearly indicating whether each source is from Knowledge Graph (KG) or Vector Data (DC), and include the file path if available, in the following format: [KG/DC] Source content (File: file_path) - If you don't know the answer, just say so. Do not make anything up. - Do not include information not provided by the Data Sources.""" From 6115f60072cefe9f423c5fec339b6b19f6ef44e8 Mon Sep 17 00:00:00 2001 From: zrguo Date: Mon, 17 Mar 2025 23:36:00 +0800 Subject: [PATCH 02/16] fix lint --- lightrag/lightrag.py | 63 +++++++++++++++++++++++++++++--------------- lightrag/operate.py | 55 +++++++++++++++++++++----------------- 2 files changed, 73 insertions(+), 45 deletions(-) diff --git a/lightrag/lightrag.py b/lightrag/lightrag.py index 275c910f..3e0ebfe4 100644 --- a/lightrag/lightrag.py +++ b/lightrag/lightrag.py @@ -563,7 +563,9 @@ class LightRAG: """ loop = always_get_an_event_loop() loop.run_until_complete( - self.ainsert(input, split_by_character, split_by_character_only, ids, file_paths) + self.ainsert( + input, split_by_character, split_by_character_only, ids, file_paths + ) ) async def ainsert( @@ -659,7 +661,10 @@ class LightRAG: await self._insert_done() async def apipeline_enqueue_documents( - self, input: str | list[str], ids: list[str] | None = None, file_paths: str | list[str] | None = None + self, + input: str | list[str], + ids: list[str] | None = None, + file_paths: str | list[str] | None = None, ) -> None: """ Pipeline for Processing Documents @@ -669,7 +674,7 @@ class LightRAG: 3. Generate document initial status 4. Filter out already processed documents 5. Enqueue document in status - + Args: input: Single document string or list of document strings ids: list of unique document IDs, if not provided, MD5 hash IDs will be generated @@ -681,13 +686,15 @@ class LightRAG: ids = [ids] if isinstance(file_paths, str): file_paths = [file_paths] - + # If file_paths is provided, ensure it matches the number of documents if file_paths is not None: if isinstance(file_paths, str): file_paths = [file_paths] if len(file_paths) != len(input): - raise ValueError("Number of file paths must match the number of documents") + raise ValueError( + "Number of file paths must match the number of documents" + ) else: # If no file paths provided, use placeholder file_paths = ["unknown_source"] * len(input) @@ -703,22 +710,30 @@ class LightRAG: raise ValueError("IDs must be unique") # Generate contents dict of IDs provided by user and documents - contents = {id_: {"content": doc, "file_path": path} - for id_, doc, path in zip(ids, input, file_paths)} + contents = { + id_: {"content": doc, "file_path": path} + for id_, doc, path in zip(ids, input, file_paths) + } else: # Clean input text and remove duplicates - cleaned_input = [(clean_text(doc), path) for doc, path in zip(input, file_paths)] + cleaned_input = [ + (clean_text(doc), path) for doc, path in zip(input, file_paths) + ] unique_content_with_paths = {} - + # Keep track of unique content and their paths for content, path in cleaned_input: if content not in unique_content_with_paths: unique_content_with_paths[content] = path - + # Generate contents dict of MD5 hash IDs and documents with paths - contents = {compute_mdhash_id(content, prefix="doc-"): - {"content": content, "file_path": path} - for content, path in unique_content_with_paths.items()} + contents = { + compute_mdhash_id(content, prefix="doc-"): { + "content": content, + "file_path": path, + } + for content, path in unique_content_with_paths.items() + } # 2. Remove duplicate contents unique_contents = {} @@ -727,10 +742,12 @@ class LightRAG: file_path = content_data["file_path"] if content not in unique_contents: unique_contents[content] = (id_, file_path) - + # Reconstruct contents with unique content - contents = {id_: {"content": content, "file_path": file_path} - for content, (id_, file_path) in unique_contents.items()} + contents = { + id_: {"content": content, "file_path": file_path} + for content, (id_, file_path) in unique_contents.items() + } # 3. Generate document initial status new_docs: dict[str, Any] = { @@ -741,7 +758,9 @@ class LightRAG: "content_length": len(content_data["content"]), "created_at": datetime.now().isoformat(), "updated_at": datetime.now().isoformat(), - "file_path": content_data["file_path"], # Store file path in document status + "file_path": content_data[ + "file_path" + ], # Store file path in document status } for id_, content_data in contents.items() } @@ -880,7 +899,7 @@ class LightRAG: try: # Get file path from status document file_path = getattr(status_doc, "file_path", "unknown_source") - + # Generate chunks from document chunks: dict[str, Any] = { compute_mdhash_id(dp["content"], prefix="chunk-"): { @@ -897,7 +916,7 @@ class LightRAG: self.tiktoken_model_name, ) } - + # Process document (text chunks and full docs) in parallel # Create tasks with references for potential cancellation doc_status_task = asyncio.create_task( @@ -1109,7 +1128,10 @@ class LightRAG: loop.run_until_complete(self.ainsert_custom_kg(custom_kg, full_doc_id)) async def ainsert_custom_kg( - self, custom_kg: dict[str, Any], full_doc_id: str = None, file_path: str = "custom_kg" + self, + custom_kg: dict[str, Any], + full_doc_id: str = None, + file_path: str = "custom_kg", ) -> None: update_storage = False try: @@ -3125,4 +3147,3 @@ class LightRAG: ] ] ) - diff --git a/lightrag/operate.py b/lightrag/operate.py index 6c99992f..11a09e40 100644 --- a/lightrag/operate.py +++ b/lightrag/operate.py @@ -224,7 +224,9 @@ async def _merge_nodes_then_upsert( split_string_by_multi_markers(already_node["source_id"], [GRAPH_FIELD_SEP]) ) already_file_paths.extend( - split_string_by_multi_markers(already_node["metadata"]["file_path"], [GRAPH_FIELD_SEP]) + split_string_by_multi_markers( + already_node["metadata"]["file_path"], [GRAPH_FIELD_SEP] + ) ) already_description.append(already_node["description"]) @@ -290,7 +292,7 @@ async def _merge_edges_then_upsert( already_edge["source_id"], [GRAPH_FIELD_SEP] ) ) - + # Get file_path with empty string default if missing or None if already_edge.get("file_path") is not None: already_file_paths.extend( @@ -336,7 +338,14 @@ async def _merge_edges_then_upsert( ) ) file_path = GRAPH_FIELD_SEP.join( - set([dp["metadata"]["file_path"] for dp in edges_data if dp.get("metadata", {}).get("file_path")] + already_file_paths) + set( + [ + dp["metadata"]["file_path"] + for dp in edges_data + if dp.get("metadata", {}).get("file_path") + ] + + already_file_paths + ) ) for need_insert_id in [src_id, tgt_id]: @@ -482,7 +491,9 @@ async def extract_entities( else: return await use_llm_func(input_text) - async def _process_extraction_result(result: str, chunk_key: str, file_path: str = "unknown_source"): + async def _process_extraction_result( + result: str, chunk_key: str, file_path: str = "unknown_source" + ): """Process a single extraction result (either initial or gleaning) Args: result (str): The extraction result to process @@ -623,7 +634,7 @@ async def extract_entities( for k, v in maybe_edges.items() ] ) - + if not (all_entities_data or all_relationships_data): log_message = "Didn't extract any entities and relationships." logger.info(log_message) @@ -669,7 +680,9 @@ async def extract_entities( "file_path": dp.get("metadata", {}).get("file_path", "unknown_source"), "metadata": { "created_at": dp.get("metadata", {}).get("created_at", time.time()), - "file_path": dp.get("metadata", {}).get("file_path", "unknown_source"), + "file_path": dp.get("metadata", {}).get( + "file_path", "unknown_source" + ), }, } for dp in all_entities_data @@ -687,7 +700,9 @@ async def extract_entities( "file_path": dp.get("metadata", {}).get("file_path", "unknown_source"), "metadata": { "created_at": dp.get("metadata", {}).get("created_at", time.time()), - "file_path": dp.get("metadata", {}).get("file_path", "unknown_source"), + "file_path": dp.get("metadata", {}).get( + "file_path", "unknown_source" + ), }, } for dp in all_relationships_data @@ -1272,13 +1287,13 @@ async def _get_node_data( created_at = n.get("created_at", "UNKNOWN") if isinstance(created_at, (int, float)): created_at = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(created_at)) - + # Get file path from metadata or directly from node data file_path = n.get("file_path", "unknown_source") if not file_path or file_path == "unknown_source": # Try to get from metadata file_path = n.get("metadata", {}).get("file_path", "unknown_source") - + entites_section_list.append( [ i, @@ -1310,13 +1325,13 @@ async def _get_node_data( # Convert timestamp to readable format if isinstance(created_at, (int, float)): created_at = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(created_at)) - + # Get file path from metadata or directly from edge data file_path = e.get("file_path", "unknown_source") if not file_path or file_path == "unknown_source": # Try to get from metadata file_path = e.get("metadata", {}).get("file_path", "unknown_source") - + relations_section_list.append( [ i, @@ -1551,13 +1566,13 @@ async def _get_edge_data( # Convert timestamp to readable format if isinstance(created_at, (int, float)): created_at = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(created_at)) - + # Get file path from metadata or directly from edge data file_path = e.get("file_path", "unknown_source") if not file_path or file_path == "unknown_source": # Try to get from metadata file_path = e.get("metadata", {}).get("file_path", "unknown_source") - + relations_section_list.append( [ i, @@ -1574,28 +1589,20 @@ async def _get_edge_data( relations_context = list_of_list_to_csv(relations_section_list) entites_section_list = [ - [ - "id", - "entity", - "type", - "description", - "rank", - "created_at", - "file_path" - ] + ["id", "entity", "type", "description", "rank", "created_at", "file_path"] ] for i, n in enumerate(use_entities): created_at = n.get("created_at", "Unknown") # Convert timestamp to readable format if isinstance(created_at, (int, float)): created_at = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(created_at)) - + # Get file path from metadata or directly from node data file_path = n.get("file_path", "unknown_source") if not file_path or file_path == "unknown_source": # Try to get from metadata file_path = n.get("metadata", {}).get("file_path", "unknown_source") - + entites_section_list.append( [ i, From dfd19b8d27e1079f2584c0e8be14f8ccbe27a97c Mon Sep 17 00:00:00 2001 From: zrguo Date: Mon, 17 Mar 2025 23:59:47 +0800 Subject: [PATCH 03/16] fix postgres support --- lightrag/kg/postgres_impl.py | 30 ++++++++++++++++++++++-------- lightrag/operate.py | 16 ++++++---------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/lightrag/kg/postgres_impl.py b/lightrag/kg/postgres_impl.py index d2630659..a862b8b6 100644 --- a/lightrag/kg/postgres_impl.py +++ b/lightrag/kg/postgres_impl.py @@ -423,6 +423,7 @@ class PGVectorStorage(BaseVectorStorage): "full_doc_id": item["full_doc_id"], "content": item["content"], "content_vector": json.dumps(item["__vector__"].tolist()), + "file_path": item["file_path"], } except Exception as e: logger.error(f"Error to prepare upsert,\nsql: {e}\nitem: {item}") @@ -445,6 +446,7 @@ class PGVectorStorage(BaseVectorStorage): "content": item["content"], "content_vector": json.dumps(item["__vector__"].tolist()), "chunk_ids": chunk_ids, + "file_path": item["file_path"], # TODO: add document_id } return upsert_sql, data @@ -465,6 +467,7 @@ class PGVectorStorage(BaseVectorStorage): "content": item["content"], "content_vector": json.dumps(item["__vector__"].tolist()), "chunk_ids": chunk_ids, + "file_path": item["file_path"], # TODO: add document_id } return upsert_sql, data @@ -740,6 +743,7 @@ class PGDocStatusStorage(DocStatusStorage): chunks_count=result[0]["chunks_count"], created_at=result[0]["created_at"], updated_at=result[0]["updated_at"], + file_path=result[0]["file_path"], ) async def get_by_ids(self, ids: list[str]) -> list[dict[str, Any]]: @@ -774,6 +778,7 @@ class PGDocStatusStorage(DocStatusStorage): created_at=element["created_at"], updated_at=element["updated_at"], chunks_count=element["chunks_count"], + file_path=element["file_path"], ) for element in result } @@ -793,14 +798,15 @@ class PGDocStatusStorage(DocStatusStorage): if not data: return - sql = """insert into LIGHTRAG_DOC_STATUS(workspace,id,content,content_summary,content_length,chunks_count,status) - values($1,$2,$3,$4,$5,$6,$7) + sql = """insert into LIGHTRAG_DOC_STATUS(workspace,id,content,content_summary,content_length,chunks_count,status,file_path) + values($1,$2,$3,$4,$5,$6,$7,$8) on conflict(id,workspace) do update set content = EXCLUDED.content, content_summary = EXCLUDED.content_summary, content_length = EXCLUDED.content_length, chunks_count = EXCLUDED.chunks_count, status = EXCLUDED.status, + file_path = EXCLUDED.file_path, updated_at = CURRENT_TIMESTAMP""" for k, v in data.items(): # chunks_count is optional @@ -814,6 +820,7 @@ class PGDocStatusStorage(DocStatusStorage): "content_length": v["content_length"], "chunks_count": v["chunks_count"] if "chunks_count" in v else -1, "status": v["status"], + "file_path": v["file_path"], }, ) @@ -1549,6 +1556,7 @@ TABLES = { tokens INTEGER, content TEXT, content_vector VECTOR, + file_path VARCHAR(256), create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, update_time TIMESTAMP, CONSTRAINT LIGHTRAG_DOC_CHUNKS_PK PRIMARY KEY (workspace, id) @@ -1564,6 +1572,7 @@ TABLES = { create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, update_time TIMESTAMP, chunk_id TEXT NULL, + file_path TEXT NULL, CONSTRAINT LIGHTRAG_VDB_ENTITY_PK PRIMARY KEY (workspace, id) )""" }, @@ -1578,6 +1587,7 @@ TABLES = { create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, update_time TIMESTAMP, chunk_id TEXT NULL, + file_path TEXT NULL, CONSTRAINT LIGHTRAG_VDB_RELATION_PK PRIMARY KEY (workspace, id) )""" }, @@ -1602,6 +1612,7 @@ TABLES = { content_length int4 NULL, chunks_count int4 NULL, status varchar(64) NULL, + file_path TEXT NULL, created_at timestamp DEFAULT CURRENT_TIMESTAMP NULL, updated_at timestamp DEFAULT CURRENT_TIMESTAMP NULL, CONSTRAINT LIGHTRAG_DOC_STATUS_PK PRIMARY KEY (workspace, id) @@ -1650,35 +1661,38 @@ SQL_TEMPLATES = { update_time = CURRENT_TIMESTAMP """, "upsert_chunk": """INSERT INTO LIGHTRAG_DOC_CHUNKS (workspace, id, tokens, - chunk_order_index, full_doc_id, content, content_vector) - VALUES ($1, $2, $3, $4, $5, $6, $7) + chunk_order_index, full_doc_id, content, content_vector, file_path) + VALUES ($1, $2, $3, $4, $5, $6, $7, $8) ON CONFLICT (workspace,id) DO UPDATE SET tokens=EXCLUDED.tokens, chunk_order_index=EXCLUDED.chunk_order_index, full_doc_id=EXCLUDED.full_doc_id, content = EXCLUDED.content, content_vector=EXCLUDED.content_vector, + file_path=EXCLUDED.file_path, update_time = CURRENT_TIMESTAMP """, "upsert_entity": """INSERT INTO LIGHTRAG_VDB_ENTITY (workspace, id, entity_name, content, - content_vector, chunk_ids) - VALUES ($1, $2, $3, $4, $5, $6::varchar[]) + content_vector, chunk_ids, file_path) + VALUES ($1, $2, $3, $4, $5, $6::varchar[], $7::varchar[]) ON CONFLICT (workspace,id) DO UPDATE SET entity_name=EXCLUDED.entity_name, content=EXCLUDED.content, content_vector=EXCLUDED.content_vector, chunk_ids=EXCLUDED.chunk_ids, + file_path=EXCLUDED.file_path, update_time=CURRENT_TIMESTAMP """, "upsert_relationship": """INSERT INTO LIGHTRAG_VDB_RELATION (workspace, id, source_id, - target_id, content, content_vector, chunk_ids) - VALUES ($1, $2, $3, $4, $5, $6, $7::varchar[]) + target_id, content, content_vector, chunk_ids, file_path) + VALUES ($1, $2, $3, $4, $5, $6, $7::varchar[], $8::varchar[]) ON CONFLICT (workspace,id) DO UPDATE SET source_id=EXCLUDED.source_id, target_id=EXCLUDED.target_id, content=EXCLUDED.content, content_vector=EXCLUDED.content_vector, chunk_ids=EXCLUDED.chunk_ids, + file_path=EXCLUDED.file_path, update_time = CURRENT_TIMESTAMP """, # SQL for VectorStorage diff --git a/lightrag/operate.py b/lightrag/operate.py index 11a09e40..ec450a1d 100644 --- a/lightrag/operate.py +++ b/lightrag/operate.py @@ -677,12 +677,10 @@ async def extract_entities( "entity_type": dp["entity_type"], "content": f"{dp['entity_name']}\n{dp['description']}", "source_id": dp["source_id"], - "file_path": dp.get("metadata", {}).get("file_path", "unknown_source"), + "file_path": dp.get("file_path", "unknown_source"), "metadata": { - "created_at": dp.get("metadata", {}).get("created_at", time.time()), - "file_path": dp.get("metadata", {}).get( - "file_path", "unknown_source" - ), + "created_at": dp.get("created_at", time.time()), + "file_path": dp.get("file_path", "unknown_source"), }, } for dp in all_entities_data @@ -697,12 +695,10 @@ async def extract_entities( "keywords": dp["keywords"], "content": f"{dp['src_id']}\t{dp['tgt_id']}\n{dp['keywords']}\n{dp['description']}", "source_id": dp["source_id"], - "file_path": dp.get("metadata", {}).get("file_path", "unknown_source"), + "file_path": dp.get("file_path", "unknown_source"), "metadata": { - "created_at": dp.get("metadata", {}).get("created_at", time.time()), - "file_path": dp.get("metadata", {}).get( - "file_path", "unknown_source" - ), + "created_at": dp.get("created_at", time.time()), + "file_path": dp.get("file_path", "unknown_source"), }, } for dp in all_relationships_data From 54e4a31aa63028dc46df4ccf9fe2ff19f4c9c285 Mon Sep 17 00:00:00 2001 From: jofoks Date: Mon, 17 Mar 2025 17:32:54 -0700 Subject: [PATCH 04/16] Fixed get_by_id type error in PSQL impl --- lightrag/kg/postgres_impl.py | 3 +-- lightrag/lightrag.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lightrag/kg/postgres_impl.py b/lightrag/kg/postgres_impl.py index d2630659..36b98013 100644 --- a/lightrag/kg/postgres_impl.py +++ b/lightrag/kg/postgres_impl.py @@ -732,7 +732,7 @@ class PGDocStatusStorage(DocStatusStorage): if result is None or result == []: return None else: - return DocProcessingStatus( + return dict( content=result[0]["content"], content_length=result[0]["content_length"], content_summary=result[0]["content_summary"], @@ -1058,7 +1058,6 @@ class PGGraphStorage(BaseGraphStorage): Args: query (str): a cypher query to be executed - params (dict): parameters for the query Returns: list[dict[str, Any]]: a list of dictionaries containing the result set diff --git a/lightrag/lightrag.py b/lightrag/lightrag.py index 27a03e12..3d891f87 100644 --- a/lightrag/lightrag.py +++ b/lightrag/lightrag.py @@ -1473,8 +1473,7 @@ class LightRAG: """ try: # 1. Get the document status and related data - doc_status = await self.doc_status.get_by_id(doc_id) - if not doc_status: + if not await self.doc_status.get_by_id(doc_id): logger.warning(f"Document {doc_id} not found") return From 77c23a23e472a45eb285ffe530d040be5cae4d77 Mon Sep 17 00:00:00 2001 From: yangdx Date: Tue, 18 Mar 2025 09:51:53 +0800 Subject: [PATCH 05/16] Added error logging for duplicate edges in rawGraph. --- .../api/webui/assets/{index-DSwGiLVk.js => index-D6vUNmAf.js} | 2 +- lightrag/api/webui/index.html | 2 +- lightrag_webui/src/hooks/useLightragGraph.tsx | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) rename lightrag/api/webui/assets/{index-DSwGiLVk.js => index-D6vUNmAf.js} (96%) diff --git a/lightrag/api/webui/assets/index-DSwGiLVk.js b/lightrag/api/webui/assets/index-D6vUNmAf.js similarity index 96% rename from lightrag/api/webui/assets/index-DSwGiLVk.js rename to lightrag/api/webui/assets/index-D6vUNmAf.js index c63c7c6a..dedd87eb 100644 --- a/lightrag/api/webui/assets/index-DSwGiLVk.js +++ b/lightrag/api/webui/assets/index-D6vUNmAf.js @@ -1059,7 +1059,7 @@ void main() { * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var yO;function Ere(){if(yO)return Ym;yO=1;var e=Hf();function t(g,m){return g===m&&(g!==0||1/g===1/m)||g!==g&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,a=e.useEffect,o=e.useLayoutEffect,s=e.useDebugValue;function u(g,m){var b=m(),y=r({inst:{value:b,getSnapshot:m}}),S=y[0].inst,k=y[1];return o(function(){S.value=b,S.getSnapshot=m,c(S)&&k({inst:S})},[g,b,m]),a(function(){return c(S)&&k({inst:S}),g(function(){c(S)&&k({inst:S})})},[g]),s(b),b}function c(g){var m=g.getSnapshot;g=g.value;try{var b=m();return!n(g,b)}catch{return!0}}function d(g,m){return m()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:u;return Ym.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,Ym}var vO;function wre(){return vO||(vO=1,Wm.exports=Ere()),Wm.exports}var xre=wre(),uu='[cmdk-group=""]',Km='[cmdk-group-items=""]',kre='[cmdk-group-heading=""]',AT='[cmdk-item=""]',SO=`${AT}:not([aria-disabled="true"])`,Yk="cmdk-item-select",ui="data-value",Tre=(e,t,n)=>Sre(e,t,n),p5=E.createContext(void 0),tc=()=>E.useContext(p5),g5=E.createContext(void 0),RT=()=>E.useContext(g5),h5=E.createContext(void 0),m5=E.forwardRef((e,t)=>{let n=vs(()=>{var B,M;return{search:"",value:(M=(B=e.value)!=null?B:e.defaultValue)!=null?M:"",filtered:{count:0,items:new Map,groups:new Set}}}),r=vs(()=>new Set),a=vs(()=>new Map),o=vs(()=>new Map),s=vs(()=>new Set),u=b5(e),{label:c,children:d,value:p,onValueChange:g,filter:m,shouldFilter:b,loop:y,disablePointerSelection:S=!1,vimBindings:k=!0,...R}=e,x=Tn(),A=Tn(),C=Tn(),N=E.useRef(null),_=Fre();vi(()=>{if(p!==void 0){let B=p.trim();n.current.value=B,O.emit()}},[p]),vi(()=>{_(6,U)},[]);let O=E.useMemo(()=>({subscribe:B=>(s.current.add(B),()=>s.current.delete(B)),snapshot:()=>n.current,setState:(B,M,K)=>{var J,le,oe;if(!Object.is(n.current[B],M)){if(n.current[B]=M,B==="search")$(),L(),_(1,G);else if(B==="value"&&(K||_(5,U),((J=u.current)==null?void 0:J.value)!==void 0)){let Q=M??"";(oe=(le=u.current).onValueChange)==null||oe.call(le,Q);return}O.emit()}},emit:()=>{s.current.forEach(B=>B())}}),[]),F=E.useMemo(()=>({value:(B,M,K)=>{var J;M!==((J=o.current.get(B))==null?void 0:J.value)&&(o.current.set(B,{value:M,keywords:K}),n.current.filtered.items.set(B,D(M,K)),_(2,()=>{L(),O.emit()}))},item:(B,M)=>(r.current.add(B),M&&(a.current.has(M)?a.current.get(M).add(B):a.current.set(M,new Set([B]))),_(3,()=>{$(),L(),n.current.value||G(),O.emit()}),()=>{o.current.delete(B),r.current.delete(B),n.current.filtered.items.delete(B);let K=W();_(4,()=>{$(),(K==null?void 0:K.getAttribute("id"))===B&&G(),O.emit()})}),group:B=>(a.current.has(B)||a.current.set(B,new Set),()=>{o.current.delete(B),a.current.delete(B)}),filter:()=>u.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>u.current.disablePointerSelection,listId:x,inputId:C,labelId:A,listInnerRef:N}),[]);function D(B,M){var K,J;let le=(J=(K=u.current)==null?void 0:K.filter)!=null?J:Tre;return B?le(B,n.current.search,M):0}function L(){if(!n.current.search||u.current.shouldFilter===!1)return;let B=n.current.filtered.items,M=[];n.current.filtered.groups.forEach(J=>{let le=a.current.get(J),oe=0;le.forEach(Q=>{let pe=B.get(Q);oe=Math.max(pe,oe)}),M.push([J,oe])});let K=N.current;Z().sort((J,le)=>{var oe,Q;let pe=J.getAttribute("id"),re=le.getAttribute("id");return((oe=B.get(re))!=null?oe:0)-((Q=B.get(pe))!=null?Q:0)}).forEach(J=>{let le=J.closest(Km);le?le.appendChild(J.parentElement===le?J:J.closest(`${Km} > *`)):K.appendChild(J.parentElement===K?J:J.closest(`${Km} > *`))}),M.sort((J,le)=>le[1]-J[1]).forEach(J=>{var le;let oe=(le=N.current)==null?void 0:le.querySelector(`${uu}[${ui}="${encodeURIComponent(J[0])}"]`);oe==null||oe.parentElement.appendChild(oe)})}function G(){let B=Z().find(K=>K.getAttribute("aria-disabled")!=="true"),M=B==null?void 0:B.getAttribute(ui);O.setState("value",M||void 0)}function $(){var B,M,K,J;if(!n.current.search||u.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let le=0;for(let oe of r.current){let Q=(M=(B=o.current.get(oe))==null?void 0:B.value)!=null?M:"",pe=(J=(K=o.current.get(oe))==null?void 0:K.keywords)!=null?J:[],re=D(Q,pe);n.current.filtered.items.set(oe,re),re>0&&le++}for(let[oe,Q]of a.current)for(let pe of Q)if(n.current.filtered.items.get(pe)>0){n.current.filtered.groups.add(oe);break}n.current.filtered.count=le}function U(){var B,M,K;let J=W();J&&(((B=J.parentElement)==null?void 0:B.firstChild)===J&&((K=(M=J.closest(uu))==null?void 0:M.querySelector(kre))==null||K.scrollIntoView({block:"nearest"})),J.scrollIntoView({block:"nearest"}))}function W(){var B;return(B=N.current)==null?void 0:B.querySelector(`${AT}[aria-selected="true"]`)}function Z(){var B;return Array.from(((B=N.current)==null?void 0:B.querySelectorAll(SO))||[])}function j(B){let M=Z()[B];M&&O.setState("value",M.getAttribute(ui))}function H(B){var M;let K=W(),J=Z(),le=J.findIndex(Q=>Q===K),oe=J[le+B];(M=u.current)!=null&&M.loop&&(oe=le+B<0?J[J.length-1]:le+B===J.length?J[0]:J[le+B]),oe&&O.setState("value",oe.getAttribute(ui))}function z(B){let M=W(),K=M==null?void 0:M.closest(uu),J;for(;K&&!J;)K=B>0?Lre(K,uu):Mre(K,uu),J=K==null?void 0:K.querySelector(SO);J?O.setState("value",J.getAttribute(ui)):H(B)}let Y=()=>j(Z().length-1),I=B=>{B.preventDefault(),B.metaKey?Y():B.altKey?z(1):H(1)},V=B=>{B.preventDefault(),B.metaKey?j(0):B.altKey?z(-1):H(-1)};return E.createElement(Ze.div,{ref:t,tabIndex:-1,...R,"cmdk-root":"",onKeyDown:B=>{var M;if((M=R.onKeyDown)==null||M.call(R,B),!B.defaultPrevented)switch(B.key){case"n":case"j":{k&&B.ctrlKey&&I(B);break}case"ArrowDown":{I(B);break}case"p":case"k":{k&&B.ctrlKey&&V(B);break}case"ArrowUp":{V(B);break}case"Home":{B.preventDefault(),j(0);break}case"End":{B.preventDefault(),Y();break}case"Enter":if(!B.nativeEvent.isComposing&&B.keyCode!==229){B.preventDefault();let K=W();if(K){let J=new Event(Yk);K.dispatchEvent(J)}}}}},E.createElement("label",{"cmdk-label":"",htmlFor:F.inputId,id:F.labelId,style:zre},c),wp(e,B=>E.createElement(g5.Provider,{value:O},E.createElement(p5.Provider,{value:F},B))))}),Are=E.forwardRef((e,t)=>{var n,r;let a=Tn(),o=E.useRef(null),s=E.useContext(h5),u=tc(),c=b5(e),d=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:s==null?void 0:s.forceMount;vi(()=>{if(!d)return u.item(a,s==null?void 0:s.id)},[d]);let p=y5(a,o,[e.value,e.children,o],e.keywords),g=RT(),m=Si(_=>_.value&&_.value===p.current),b=Si(_=>d||u.filter()===!1?!0:_.search?_.filtered.items.get(a)>0:!0);E.useEffect(()=>{let _=o.current;if(!(!_||e.disabled))return _.addEventListener(Yk,y),()=>_.removeEventListener(Yk,y)},[b,e.onSelect,e.disabled]);function y(){var _,O;S(),(O=(_=c.current).onSelect)==null||O.call(_,p.current)}function S(){g.setState("value",p.current,!0)}if(!b)return null;let{disabled:k,value:R,onSelect:x,forceMount:A,keywords:C,...N}=e;return E.createElement(Ze.div,{ref:_u([o,t]),...N,id:a,"cmdk-item":"",role:"option","aria-disabled":!!k,"aria-selected":!!m,"data-disabled":!!k,"data-selected":!!m,onPointerMove:k||u.getDisablePointerSelection()?void 0:S,onClick:k?void 0:y},e.children)}),Rre=E.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:a,...o}=e,s=Tn(),u=E.useRef(null),c=E.useRef(null),d=Tn(),p=tc(),g=Si(b=>a||p.filter()===!1?!0:b.search?b.filtered.groups.has(s):!0);vi(()=>p.group(s),[]),y5(s,u,[e.value,e.heading,c]);let m=E.useMemo(()=>({id:s,forceMount:a}),[a]);return E.createElement(Ze.div,{ref:_u([u,t]),...o,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},n&&E.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:d},n),wp(e,b=>E.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?d:void 0},E.createElement(h5.Provider,{value:m},b))))}),_re=E.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,a=E.useRef(null),o=Si(s=>!s.search);return!n&&!o?null:E.createElement(Ze.div,{ref:_u([a,t]),...r,"cmdk-separator":"",role:"separator"})}),Cre=E.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,a=e.value!=null,o=RT(),s=Si(p=>p.search),u=Si(p=>p.value),c=tc(),d=E.useMemo(()=>{var p;let g=(p=c.listInnerRef.current)==null?void 0:p.querySelector(`${AT}[${ui}="${encodeURIComponent(u)}"]`);return g==null?void 0:g.getAttribute("id")},[]);return E.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),E.createElement(Ze.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":d,id:c.inputId,type:"text",value:a?e.value:s,onChange:p=>{a||o.setState("search",p.target.value),n==null||n(p.target.value)}})}),Nre=E.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...a}=e,o=E.useRef(null),s=E.useRef(null),u=tc();return E.useEffect(()=>{if(s.current&&o.current){let c=s.current,d=o.current,p,g=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let m=c.offsetHeight;d.style.setProperty("--cmdk-list-height",m.toFixed(1)+"px")})});return g.observe(c),()=>{cancelAnimationFrame(p),g.unobserve(c)}}},[]),E.createElement(Ze.div,{ref:_u([o,t]),...a,"cmdk-list":"",role:"listbox","aria-label":r,id:u.listId},wp(e,c=>E.createElement("div",{ref:_u([s,u.listInnerRef]),"cmdk-list-sizer":""},c)))}),Ore=E.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:a,contentClassName:o,container:s,...u}=e;return E.createElement($0,{open:n,onOpenChange:r},E.createElement(q0,{container:s},E.createElement(rp,{"cmdk-overlay":"",className:a}),E.createElement(ap,{"aria-label":e.label,"cmdk-dialog":"",className:o},E.createElement(m5,{ref:t,...u}))))}),Dre=E.forwardRef((e,t)=>Si(n=>n.filtered.count===0)?E.createElement(Ze.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Ire=E.forwardRef((e,t)=>{let{progress:n,children:r,label:a="Loading...",...o}=e;return E.createElement(Ze.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},wp(e,s=>E.createElement("div",{"aria-hidden":!0},s)))}),Vn=Object.assign(m5,{List:Nre,Item:Are,Input:Cre,Group:Rre,Separator:_re,Dialog:Ore,Empty:Dre,Loading:Ire});function Lre(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Mre(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function b5(e){let t=E.useRef(e);return vi(()=>{t.current=e}),t}var vi=typeof window>"u"?E.useEffect:E.useLayoutEffect;function vs(e){let t=E.useRef();return t.current===void 0&&(t.current=e()),t}function _u(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}function Si(e){let t=RT(),n=()=>e(t.snapshot());return xre.useSyncExternalStore(t.subscribe,n,n)}function y5(e,t,n,r=[]){let a=E.useRef(),o=tc();return vi(()=>{var s;let u=(()=>{var d;for(let p of n){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(d=p.current.textContent)==null?void 0:d.trim():a.current}})(),c=r.map(d=>d.trim());o.value(e,u,c),(s=t.current)==null||s.setAttribute(ui,u),a.current=u}),a}var Fre=()=>{let[e,t]=E.useState(),n=vs(()=>new Map);return vi(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,a)=>{n.current.set(r,a),t({})}};function Pre(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function wp({asChild:e,children:t},n){return e&&E.isValidElement(t)?E.cloneElement(Pre(t),{ref:t.ref},n(t.props.children)):n(t)}var zre={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const v5=$0,S5=MU,Bre=q0,E5=E.forwardRef(({className:e,...t},n)=>w.jsx(rp,{ref:n,className:Me("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/80",e),...t}));E5.displayName=rp.displayName;const _T=E.forwardRef(({className:e,children:t,...n},r)=>w.jsxs(Bre,{children:[w.jsx(E5,{}),w.jsxs(ap,{ref:r,className:Me("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",e),...n,children:[t,w.jsxs(Y0,{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:[w.jsx(aU,{className:"h-4 w-4"}),w.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_T.displayName=ap.displayName;const CT=({className:e,...t})=>w.jsx("div",{className:Me("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});CT.displayName="DialogHeader";const NT=E.forwardRef(({className:e,...t},n)=>w.jsx(V0,{ref:n,className:Me("text-lg leading-none font-semibold tracking-tight",e),...t}));NT.displayName=V0.displayName;const OT=E.forwardRef(({className:e,...t},n)=>w.jsx(W0,{ref:n,className:Me("text-muted-foreground text-sm",e),...t}));OT.displayName=W0.displayName;const xp=E.forwardRef(({className:e,...t},n)=>w.jsx(Vn,{ref:n,className:Me("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t}));xp.displayName=Vn.displayName;const DT=E.forwardRef(({className:e,...t},n)=>w.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[w.jsx(oY,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),w.jsx(Vn.Input,{ref:n,className:Me("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",e),...t})]}));DT.displayName=Vn.Input.displayName;const kp=E.forwardRef(({className:e,...t},n)=>w.jsx(Vn.List,{ref:n,className:Me("max-h-[300px] overflow-x-hidden overflow-y-auto",e),...t}));kp.displayName=Vn.List.displayName;const IT=E.forwardRef((e,t)=>w.jsx(Vn.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));IT.displayName=Vn.Empty.displayName;const el=E.forwardRef(({className:e,...t},n)=>w.jsx(Vn.Group,{ref:n,className:Me("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",e),...t}));el.displayName=Vn.Group.displayName;const Ure=E.forwardRef(({className:e,...t},n)=>w.jsx(Vn.Separator,{ref:n,className:Me("bg-border -mx-1 h-px",e),...t}));Ure.displayName=Vn.Separator.displayName;const tl=E.forwardRef(({className:e,...t},n)=>w.jsx(Vn.Item,{ref:n,className:Me("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",e),...t}));tl.displayName=Vn.Item.displayName;const jre=({layout:e,autoRunFor:t,mainLayout:n})=>{const r=Tr(),[a,o]=E.useState(!1),s=E.useRef(null),{t:u}=Pt(),c=E.useCallback(()=>{if(r)try{const p=r.getGraph();if(!p||p.order===0)return;const g=n.positions();P4(p,g,{duration:300})}catch(p){console.error("Error updating positions:",p),s.current&&(window.clearInterval(s.current),s.current=null,o(!1))}},[r,n]),d=E.useCallback(()=>{if(a){console.log("Stopping layout animation"),s.current&&(window.clearInterval(s.current),s.current=null);try{typeof e.kill=="function"?(e.kill(),console.log("Layout algorithm killed")):typeof e.stop=="function"&&(e.stop(),console.log("Layout algorithm stopped"))}catch(p){console.error("Error stopping layout algorithm:",p)}o(!1)}else console.log("Starting layout animation"),c(),s.current=window.setInterval(()=>{c()},200),o(!0),setTimeout(()=>{if(s.current){console.log("Auto-stopping layout animation after 3 seconds"),window.clearInterval(s.current),s.current=null,o(!1);try{typeof e.kill=="function"?e.kill():typeof e.stop=="function"&&e.stop()}catch(p){console.error("Error stopping layout algorithm:",p)}}},3e3)},[a,e,c]);return E.useEffect(()=>{if(!r){console.log("No sigma instance available");return}let p=null;return t!==void 0&&t>-1&&r.getGraph().order>0&&(console.log("Auto-starting layout animation"),c(),s.current=window.setInterval(()=>{c()},200),o(!0),t>0&&(p=window.setTimeout(()=>{console.log("Auto-stopping layout animation after timeout"),s.current&&(window.clearInterval(s.current),s.current=null),o(!1)},t))),()=>{s.current&&(window.clearInterval(s.current),s.current=null),p&&window.clearTimeout(p),o(!1)}},[t,r,c]),w.jsx(Tt,{size:"icon",onClick:d,tooltip:u(a?"graphPanel.sideBar.layoutsControl.stopAnimation":"graphPanel.sideBar.layoutsControl.startAnimation"),variant:Ua,children:a?w.jsx(QW,{}):w.jsx(eY,{})})},Gre=()=>{const e=Tr(),{t}=Pt(),[n,r]=E.useState("Circular"),[a,o]=E.useState(!1),s=Ge.use.graphLayoutMaxIterations(),u=Lne(),c=Nne(),d=dre(),p=ire({maxIterations:s,settings:{margin:2,expansion:1.1,gridSize:5,ratio:1,speed:3}}),g=jne({maxIterations:s,settings:{attraction:3e-4,repulsion:.05,gravity:.01,inertia:.4,maxMove:100}}),m=u5({iterations:s}),b=sre(),y=Gne(),S=Zne(),k=E.useMemo(()=>({Circular:{layout:u},Circlepack:{layout:c},Random:{layout:d},Noverlaps:{layout:p,worker:b},"Force Directed":{layout:g,worker:y},"Force Atlas":{layout:m,worker:S}}),[c,u,g,m,p,d,y,b,S]),R=E.useCallback(x=>{console.debug("Running layout:",x);const{positions:A}=k[x].layout;try{const C=e.getGraph();if(!C){console.error("No graph available");return}const N=A();console.log("Positions calculated, animating nodes"),P4(C,N,{duration:400}),r(x)}catch(C){console.error("Error running layout:",C)}},[k,e]);return w.jsxs(w.Fragment,{children:[w.jsx("div",{children:k[n]&&"worker"in k[n]&&w.jsx(jre,{layout:k[n].worker,mainLayout:k[n].layout})}),w.jsx("div",{children:w.jsxs(Wu,{open:a,onOpenChange:o,children:[w.jsx(Yu,{asChild:!0,children:w.jsx(Tt,{size:"icon",variant:Ua,onClick:()=>o(x=>!x),tooltip:t("graphPanel.sideBar.layoutsControl.layoutGraph"),children:w.jsx(BW,{})})}),w.jsx(Ys,{side:"right",align:"center",className:"p-1",children:w.jsx(xp,{children:w.jsx(kp,{children:w.jsx(el,{children:Object.keys(k).map(x=>w.jsx(tl,{onSelect:()=>{R(x)},className:"cursor-pointer text-xs",children:t(`graphPanel.sideBar.layoutsControl.layouts.${x}`)},x))})})})})]})})]})},w5=()=>{const e=E.useContext(VB);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},Dd=e=>!!(e.type.startsWith("mouse")&&e.buttons!==0),Hre=({disableHoverEffect:e})=>{const t=Tr(),n=G4(),r=j4(),a=Ge.use.graphLayoutMaxIterations(),{assign:o}=u5({iterations:a}),{theme:s}=w5(),u=Ge.use.enableHideUnselectedEdges(),c=Ge.use.enableEdgeEvents(),d=Ge.use.showEdgeLabel(),p=Ge.use.showNodeLabel(),g=Pe.use.selectedNode(),m=Pe.use.focusedNode(),b=Pe.use.selectedEdge(),y=Pe.use.focusedEdge(),S=Pe.use.sigmaGraph();return E.useEffect(()=>{if(S&&t){try{typeof t.setGraph=="function"?(t.setGraph(S),console.log("Binding graph to sigma instance")):(t.graph=S,console.warn("Simgma missing setGraph function, set graph property directly"))}catch(k){console.error("Error setting graph on sigma instance:",k)}o(),console.log("Initial layout applied to graph")}},[t,S,o,a]),E.useEffect(()=>{t&&(Pe.getState().sigmaInstance||(console.log("Setting sigma instance from GraphControl"),Pe.getState().setSigmaInstance(t)))},[t]),E.useEffect(()=>{const{setFocusedNode:k,setSelectedNode:R,setFocusedEdge:x,setSelectedEdge:A,clearSelection:C}=Pe.getState(),N={enterNode:_=>{Dd(_.event.original)||k(_.node)},leaveNode:_=>{Dd(_.event.original)||k(null)},clickNode:_=>{R(_.node),A(null)},clickStage:()=>C()};c&&(N.clickEdge=_=>{A(_.edge),R(null)},N.enterEdge=_=>{Dd(_.event.original)||x(_.edge)},N.leaveEdge=_=>{Dd(_.event.original)||x(null)}),n(N)},[n,c]),E.useEffect(()=>{const k=s==="dark",R=k?fV:void 0,x=k?mV:void 0;r({enableEdgeEvents:c,renderEdgeLabels:d,renderLabels:p,nodeReducer:(A,C)=>{const N=t.getGraph(),_={...C,highlighted:C.highlighted||!1,labelColor:R};if(!e){_.highlighted=!1;const O=m||g,F=y||b;if(O&&N.hasNode(O))try{(A===O||N.neighbors(O).includes(A))&&(_.highlighted=!0,A===g&&(_.borderColor=hV))}catch(D){console.error("Error in nodeReducer:",D)}else if(F&&N.hasEdge(F))N.extremities(F).includes(A)&&(_.highlighted=!0,_.size=3);else return _;_.highlighted?k&&(_.labelColor=pV):_.color=gV}return _},edgeReducer:(A,C)=>{const N=t.getGraph(),_={...C,hidden:!1,labelColor:R,color:x};if(!e){const O=m||g;if(O&&N.hasNode(O))try{u?N.extremities(A).includes(O)||(_.hidden=!0):N.extremities(A).includes(O)&&(_.color=CC)}catch(F){console.error("Error in edgeReducer:",F)}else{const F=b&&N.hasEdge(b)?b:null,D=y&&N.hasEdge(y)?y:null;(F||D)&&(A===F?_.color=bV:A===D?_.color=CC:u&&(_.hidden=!0))}}return _}})},[g,m,b,y,r,t,e,s,u,c,d,p]),null},$re=()=>{const{zoomIn:e,zoomOut:t,reset:n}=H4({duration:200,factor:1.5}),r=Tr(),{t:a}=Pt(),o=E.useCallback(()=>e(),[e]),s=E.useCallback(()=>t(),[t]),u=E.useCallback(()=>{if(r)try{r.setCustomBBox(null),r.refresh();const c=r.getGraph();if(!(c!=null&&c.order)||c.nodes().length===0){n();return}r.getCamera().animate({x:.5,y:.5,ratio:1.1},{duration:1e3})}catch(c){console.error("Error resetting zoom:",c),n()}},[r,n]);return w.jsxs(w.Fragment,{children:[w.jsx(Tt,{variant:Ua,onClick:u,tooltip:a("graphPanel.sideBar.zoomControl.resetZoom"),size:"icon",children:w.jsx(IW,{})}),w.jsx(Tt,{variant:Ua,onClick:o,tooltip:a("graphPanel.sideBar.zoomControl.zoomIn"),size:"icon",children:w.jsx(gY,{})}),w.jsx(Tt,{variant:Ua,onClick:s,tooltip:a("graphPanel.sideBar.zoomControl.zoomOut"),size:"icon",children:w.jsx(mY,{})})]})},qre=()=>{const{isFullScreen:e,toggle:t}=kte(),{t:n}=Pt();return w.jsx(w.Fragment,{children:e?w.jsx(Tt,{variant:Ua,onClick:t,tooltip:n("graphPanel.sideBar.fullScreenControl.windowed"),size:"icon",children:w.jsx(YW,{})}):w.jsx(Tt,{variant:Ua,onClick:t,tooltip:n("graphPanel.sideBar.fullScreenControl.fullScreen"),size:"icon",children:w.jsx(VW,{})})})};var LT="Checkbox",[Vre,Nxe]=xr(LT),[Wre,Yre]=Vre(LT),x5=E.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:a,defaultChecked:o,required:s,disabled:u,value:c="on",onCheckedChange:d,form:p,...g}=e,[m,b]=E.useState(null),y=gt(t,C=>b(C)),S=E.useRef(!1),k=m?p||!!m.closest("form"):!0,[R=!1,x]=Ha({prop:a,defaultProp:o,onChange:d}),A=E.useRef(R);return E.useEffect(()=>{const C=m==null?void 0:m.form;if(C){const N=()=>x(A.current);return C.addEventListener("reset",N),()=>C.removeEventListener("reset",N)}},[m,x]),w.jsxs(Wre,{scope:n,state:R,disabled:u,children:[w.jsx(Ze.button,{type:"button",role:"checkbox","aria-checked":Ro(R)?"mixed":R,"aria-required":s,"data-state":A5(R),"data-disabled":u?"":void 0,disabled:u,value:c,...g,ref:y,onKeyDown:Ke(e.onKeyDown,C=>{C.key==="Enter"&&C.preventDefault()}),onClick:Ke(e.onClick,C=>{x(N=>Ro(N)?!0:!N),k&&(S.current=C.isPropagationStopped(),S.current||C.stopPropagation())})}),k&&w.jsx(Kre,{control:m,bubbles:!S.current,name:r,value:c,checked:R,required:s,disabled:u,form:p,style:{transform:"translateX(-100%)"},defaultChecked:Ro(o)?!1:o})]})});x5.displayName=LT;var k5="CheckboxIndicator",T5=E.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...a}=e,o=Yre(k5,n);return w.jsx(kr,{present:r||Ro(o.state)||o.state===!0,children:w.jsx(Ze.span,{"data-state":A5(o.state),"data-disabled":o.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});T5.displayName=k5;var Kre=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:a,...o}=e,s=E.useRef(null),u=Z3(n),c=d3(t);E.useEffect(()=>{const p=s.current,g=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(g,"checked").set;if(u!==n&&b){const y=new Event("click",{bubbles:r});p.indeterminate=Ro(n),b.call(p,Ro(n)?!1:n),p.dispatchEvent(y)}},[u,n,r]);const d=E.useRef(Ro(n)?!1:n);return w.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a??d.current,...o,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Ro(e){return e==="indeterminate"}function A5(e){return Ro(e)?"indeterminate":e?"checked":"unchecked"}var R5=x5,Xre=T5;const bu=E.forwardRef(({className:e,...t},n)=>w.jsx(R5,{ref:n,className:Me("peer border-primary ring-offset-background focus-visible:ring-ring data-[state=checked]:bg-primary data-[state=checked]:text-primary-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",e),...t,children:w.jsx(Xre,{className:Me("flex items-center justify-center text-current"),children:w.jsx(L0,{className:"h-4 w-4"})})}));bu.displayName=R5.displayName;var Zre="Separator",EO="horizontal",Qre=["horizontal","vertical"],_5=E.forwardRef((e,t)=>{const{decorative:n,orientation:r=EO,...a}=e,o=Jre(r)?r:EO,u=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return w.jsx(Ze.div,{"data-orientation":o,...u,...a,ref:t})});_5.displayName=Zre;function Jre(e){return Qre.includes(e)}var C5=_5;const Ss=E.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},a)=>w.jsx(C5,{ref:a,decorative:n,orientation:t,className:Me("bg-border shrink-0",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));Ss.displayName=C5.displayName;const Eo=({checked:e,onCheckedChange:t,label:n})=>w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx(bu,{checked:e,onCheckedChange:t}),w.jsx("label",{htmlFor:"terms",className:"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:n})]}),Xm=({value:e,onEditFinished:t,label:n,min:r,max:a})=>{const[o,s]=E.useState(e),u=E.useCallback(d=>{const p=d.target.value.trim();if(p.length===0){s(null);return}const g=Number.parseInt(p);if(!isNaN(g)&&g!==o){if(r!==void 0&&ga)return;s(g)}},[o,r,a]),c=E.useCallback(()=>{o!==null&&e!==o&&t(o)},[e,o,t]);return w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx("label",{htmlFor:"terms",className:"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:n}),w.jsx(oa,{type:"number",value:o===null?"":o,onChange:u,className:"h-6 w-full min-w-0 pr-1",min:r,max:a,onBlur:c,onKeyDown:d=>{d.key==="Enter"&&c()}})]})};function eae(){const[e,t]=E.useState(!1),[n,r]=E.useState(""),a=Ge.use.showPropertyPanel(),o=Ge.use.showNodeSearchBar(),s=Ge.use.showNodeLabel(),u=Ge.use.enableEdgeEvents(),c=Ge.use.enableNodeDrag(),d=Ge.use.enableHideUnselectedEdges(),p=Ge.use.showEdgeLabel(),g=Ge.use.graphQueryMaxDepth(),m=Ge.use.graphMinDegree(),b=Ge.use.graphLayoutMaxIterations(),y=Ge.use.enableHealthCheck(),S=Ge.use.apiKey();E.useEffect(()=>{r(S||"")},[S,e]);const k=E.useCallback(()=>Ge.setState(W=>({enableNodeDrag:!W.enableNodeDrag})),[]),R=E.useCallback(()=>Ge.setState(W=>({enableEdgeEvents:!W.enableEdgeEvents})),[]),x=E.useCallback(()=>Ge.setState(W=>({enableHideUnselectedEdges:!W.enableHideUnselectedEdges})),[]),A=E.useCallback(()=>Ge.setState(W=>({showEdgeLabel:!W.showEdgeLabel})),[]),C=E.useCallback(()=>Ge.setState(W=>({showPropertyPanel:!W.showPropertyPanel})),[]),N=E.useCallback(()=>Ge.setState(W=>({showNodeSearchBar:!W.showNodeSearchBar})),[]),_=E.useCallback(()=>Ge.setState(W=>({showNodeLabel:!W.showNodeLabel})),[]),O=E.useCallback(()=>Ge.setState(W=>({enableHealthCheck:!W.enableHealthCheck})),[]),F=E.useCallback(W=>{W<1||Ge.setState({graphQueryMaxDepth:W})},[]),D=E.useCallback(W=>{W<0||Ge.setState({graphMinDegree:W})},[]),L=E.useCallback(W=>{W<1||Ge.setState({graphLayoutMaxIterations:W})},[]),G=E.useCallback(async()=>{Ge.setState({apiKey:n||null}),await Hn.getState().check(),t(!1)},[n]),$=E.useCallback(W=>{r(W.target.value)},[r]),{t:U}=Pt();return w.jsx(w.Fragment,{children:w.jsxs(Wu,{open:e,onOpenChange:t,children:[w.jsx(Yu,{asChild:!0,children:w.jsx(Tt,{variant:Ua,tooltip:U("graphPanel.sideBar.settings.settings"),size:"icon",children:w.jsx(uY,{})})}),w.jsx(Ys,{side:"right",align:"start",className:"mb-2 p-2",onCloseAutoFocus:W=>W.preventDefault(),children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(Eo,{checked:y,onCheckedChange:O,label:U("graphPanel.sideBar.settings.healthCheck")}),w.jsx(Ss,{}),w.jsx(Eo,{checked:a,onCheckedChange:C,label:U("graphPanel.sideBar.settings.showPropertyPanel")}),w.jsx(Eo,{checked:o,onCheckedChange:N,label:U("graphPanel.sideBar.settings.showSearchBar")}),w.jsx(Ss,{}),w.jsx(Eo,{checked:s,onCheckedChange:_,label:U("graphPanel.sideBar.settings.showNodeLabel")}),w.jsx(Eo,{checked:c,onCheckedChange:k,label:U("graphPanel.sideBar.settings.nodeDraggable")}),w.jsx(Ss,{}),w.jsx(Eo,{checked:p,onCheckedChange:A,label:U("graphPanel.sideBar.settings.showEdgeLabel")}),w.jsx(Eo,{checked:d,onCheckedChange:x,label:U("graphPanel.sideBar.settings.hideUnselectedEdges")}),w.jsx(Eo,{checked:u,onCheckedChange:R,label:U("graphPanel.sideBar.settings.edgeEvents")}),w.jsx(Ss,{}),w.jsx(Xm,{label:U("graphPanel.sideBar.settings.maxQueryDepth"),min:1,value:g,onEditFinished:F}),w.jsx(Xm,{label:U("graphPanel.sideBar.settings.minDegree"),min:0,value:m,onEditFinished:D}),w.jsx(Xm,{label:U("graphPanel.sideBar.settings.maxLayoutIterations"),min:1,max:30,value:b,onEditFinished:L}),w.jsx(Ss,{}),w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx("label",{className:"text-sm font-medium",children:U("graphPanel.sideBar.settings.apiKey")}),w.jsxs("form",{className:"flex h-6 gap-2",onSubmit:W=>W.preventDefault(),children:[w.jsx("div",{className:"w-0 flex-1",children:w.jsx(oa,{type:"password",value:n,onChange:$,placeholder:U("graphPanel.sideBar.settings.enterYourAPIkey"),className:"max-h-full w-full min-w-0",autoComplete:"off"})}),w.jsx(Tt,{onClick:G,variant:"outline",size:"sm",className:"max-h-full shrink-0",children:U("graphPanel.sideBar.settings.save")})]})]})]})})]})})}const tae="ENTRIES",N5="KEYS",O5="VALUES",mn="";class Zm{constructor(t,n){const r=t._tree,a=Array.from(r.keys());this.set=t,this._type=n,this._path=a.length>0?[{node:r,keys:a}]:[]}next(){const t=this.dive();return this.backtrack(),t}dive(){if(this._path.length===0)return{done:!0,value:void 0};const{node:t,keys:n}=ps(this._path);if(ps(n)===mn)return{done:!1,value:this.result()};const r=t.get(ps(n));return this._path.push({node:r,keys:Array.from(r.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;const t=ps(this._path).keys;t.pop(),!(t.length>0)&&(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map(({keys:t})=>ps(t)).filter(t=>t!==mn).join("")}value(){return ps(this._path).node.get(mn)}result(){switch(this._type){case O5:return this.value();case N5:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}}const ps=e=>e[e.length-1],nae=(e,t,n)=>{const r=new Map;if(t===void 0)return r;const a=t.length+1,o=a+n,s=new Uint8Array(o*a).fill(n+1);for(let u=0;u{const c=o*s;e:for(const d of e.keys())if(d===mn){const p=a[c-1];p<=n&&r.set(u,[e.get(d),p])}else{let p=o;for(let g=0;gn)continue e}D5(e.get(d),t,n,r,a,p,s,u+d)}};class To{constructor(t=new Map,n=""){this._size=void 0,this._tree=t,this._prefix=n}atPrefix(t){if(!t.startsWith(this._prefix))throw new Error("Mismatched prefix");const[n,r]=Rf(this._tree,t.slice(this._prefix.length));if(n===void 0){const[a,o]=MT(r);for(const s of a.keys())if(s!==mn&&s.startsWith(o)){const u=new Map;return u.set(s.slice(o.length),a.get(s)),new To(u,t)}}return new To(n,t)}clear(){this._size=void 0,this._tree.clear()}delete(t){return this._size=void 0,rae(this._tree,t)}entries(){return new Zm(this,tae)}forEach(t){for(const[n,r]of this)t(n,r,this)}fuzzyGet(t,n){return nae(this._tree,t,n)}get(t){const n=Kk(this._tree,t);return n!==void 0?n.get(mn):void 0}has(t){const n=Kk(this._tree,t);return n!==void 0&&n.has(mn)}keys(){return new Zm(this,N5)}set(t,n){if(typeof t!="string")throw new Error("key must be a string");return this._size=void 0,Qm(this._tree,t).set(mn,n),this}get size(){if(this._size)return this._size;this._size=0;const t=this.entries();for(;!t.next().done;)this._size+=1;return this._size}update(t,n){if(typeof t!="string")throw new Error("key must be a string");this._size=void 0;const r=Qm(this._tree,t);return r.set(mn,n(r.get(mn))),this}fetch(t,n){if(typeof t!="string")throw new Error("key must be a string");this._size=void 0;const r=Qm(this._tree,t);let a=r.get(mn);return a===void 0&&r.set(mn,a=n()),a}values(){return new Zm(this,O5)}[Symbol.iterator](){return this.entries()}static from(t){const n=new To;for(const[r,a]of t)n.set(r,a);return n}static fromObject(t){return To.from(Object.entries(t))}}const Rf=(e,t,n=[])=>{if(t.length===0||e==null)return[e,n];for(const r of e.keys())if(r!==mn&&t.startsWith(r))return n.push([e,r]),Rf(e.get(r),t.slice(r.length),n);return n.push([e,t]),Rf(void 0,"",n)},Kk=(e,t)=>{if(t.length===0||e==null)return e;for(const n of e.keys())if(n!==mn&&t.startsWith(n))return Kk(e.get(n),t.slice(n.length))},Qm=(e,t)=>{const n=t.length;e:for(let r=0;e&&r{const[n,r]=Rf(e,t);if(n!==void 0){if(n.delete(mn),n.size===0)I5(r);else if(n.size===1){const[a,o]=n.entries().next().value;L5(r,a,o)}}},I5=e=>{if(e.length===0)return;const[t,n]=MT(e);if(t.delete(n),t.size===0)I5(e.slice(0,-1));else if(t.size===1){const[r,a]=t.entries().next().value;r!==mn&&L5(e.slice(0,-1),r,a)}},L5=(e,t,n)=>{if(e.length===0)return;const[r,a]=MT(e);r.set(a+t,n),r.delete(a)},MT=e=>e[e.length-1],FT="or",M5="and",aae="and_not";class _o{constructor(t){if((t==null?void 0:t.fields)==null)throw new Error('MiniSearch: option "fields" must be provided');const n=t.autoVacuum==null||t.autoVacuum===!0?tb:t.autoVacuum;this._options={...eb,...t,autoVacuum:n,searchOptions:{...wO,...t.searchOptions||{}},autoSuggestOptions:{...uae,...t.autoSuggestOptions||{}}},this._index=new To,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=Zk,this.addFields(this._options.fields)}add(t){const{extractField:n,tokenize:r,processTerm:a,fields:o,idField:s}=this._options,u=n(t,s);if(u==null)throw new Error(`MiniSearch: document does not have ID field "${s}"`);if(this._idToShortId.has(u))throw new Error(`MiniSearch: duplicate ID ${u}`);const c=this.addDocumentId(u);this.saveStoredFields(c,t);for(const d of o){const p=n(t,d);if(p==null)continue;const g=r(p.toString(),d),m=this._fieldIds[d],b=new Set(g).size;this.addFieldLength(c,m,this._documentCount-1,b);for(const y of g){const S=a(y,d);if(Array.isArray(S))for(const k of S)this.addTerm(m,c,k);else S&&this.addTerm(m,c,S)}}}addAll(t){for(const n of t)this.add(n)}addAllAsync(t,n={}){const{chunkSize:r=10}=n,a={chunk:[],promise:Promise.resolve()},{chunk:o,promise:s}=t.reduce(({chunk:u,promise:c},d,p)=>(u.push(d),(p+1)%r===0?{chunk:[],promise:c.then(()=>new Promise(g=>setTimeout(g,0))).then(()=>this.addAll(u))}:{chunk:u,promise:c}),a);return s.then(()=>this.addAll(o))}remove(t){const{tokenize:n,processTerm:r,extractField:a,fields:o,idField:s}=this._options,u=a(t,s);if(u==null)throw new Error(`MiniSearch: document does not have ID field "${s}"`);const c=this._idToShortId.get(u);if(c==null)throw new Error(`MiniSearch: cannot remove document with ID ${u}: it is not in the index`);for(const d of o){const p=a(t,d);if(p==null)continue;const g=n(p.toString(),d),m=this._fieldIds[d],b=new Set(g).size;this.removeFieldLength(c,m,this._documentCount,b);for(const y of g){const S=r(y,d);if(Array.isArray(S))for(const k of S)this.removeTerm(m,c,k);else S&&this.removeTerm(m,c,S)}}this._storedFields.delete(c),this._documentIds.delete(c),this._idToShortId.delete(u),this._fieldLength.delete(c),this._documentCount-=1}removeAll(t){if(t)for(const n of t)this.remove(n);else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new To,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(t){const n=this._idToShortId.get(t);if(n==null)throw new Error(`MiniSearch: cannot discard document with ID ${t}: it is not in the index`);this._idToShortId.delete(t),this._documentIds.delete(n),this._storedFields.delete(n),(this._fieldLength.get(n)||[]).forEach((r,a)=>{this.removeFieldLength(n,a,this._documentCount,r)}),this._fieldLength.delete(n),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()}maybeAutoVacuum(){if(this._options.autoVacuum===!1)return;const{minDirtFactor:t,minDirtCount:n,batchSize:r,batchWait:a}=this._options.autoVacuum;this.conditionalVacuum({batchSize:r,batchWait:a},{minDirtCount:n,minDirtFactor:t})}discardAll(t){const n=this._options.autoVacuum;try{this._options.autoVacuum=!1;for(const r of t)this.discard(r)}finally{this._options.autoVacuum=n}this.maybeAutoVacuum()}replace(t){const{idField:n,extractField:r}=this._options,a=r(t,n);this.discard(a),this.add(t)}vacuum(t={}){return this.conditionalVacuum(t)}conditionalVacuum(t,n){return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&n,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(()=>{const r=this._enqueuedVacuumConditions;return this._enqueuedVacuumConditions=Zk,this.performVacuuming(t,r)}),this._enqueuedVacuum)):this.vacuumConditionsMet(n)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(t),this._currentVacuum)}async performVacuuming(t,n){const r=this._dirtCount;if(this.vacuumConditionsMet(n)){const a=t.batchSize||Xk.batchSize,o=t.batchWait||Xk.batchWait;let s=1;for(const[u,c]of this._index){for(const[d,p]of c)for(const[g]of p)this._documentIds.has(g)||(p.size<=1?c.delete(d):p.delete(g));this._index.get(u).size===0&&this._index.delete(u),s%a===0&&await new Promise(d=>setTimeout(d,o)),s+=1}this._dirtCount-=r}await null,this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null}vacuumConditionsMet(t){if(t==null)return!0;let{minDirtCount:n,minDirtFactor:r}=t;return n=n||tb.minDirtCount,r=r||tb.minDirtFactor,this.dirtCount>=n&&this.dirtFactor>=r}get isVacuuming(){return this._currentVacuum!=null}get dirtCount(){return this._dirtCount}get dirtFactor(){return this._dirtCount/(1+this._documentCount+this._dirtCount)}has(t){return this._idToShortId.has(t)}getStoredFields(t){const n=this._idToShortId.get(t);if(n!=null)return this._storedFields.get(n)}search(t,n={}){const{searchOptions:r}=this._options,a={...r,...n},o=this.executeQuery(t,n),s=[];for(const[u,{score:c,terms:d,match:p}]of o){const g=d.length||1,m={id:this._documentIds.get(u),score:c*g,terms:Object.keys(p),queryTerms:d,match:p};Object.assign(m,this._storedFields.get(u)),(a.filter==null||a.filter(m))&&s.push(m)}return t===_o.wildcard&&a.boostDocument==null||s.sort(kO),s}autoSuggest(t,n={}){n={...this._options.autoSuggestOptions,...n};const r=new Map;for(const{score:o,terms:s}of this.search(t,n)){const u=s.join(" "),c=r.get(u);c!=null?(c.score+=o,c.count+=1):r.set(u,{score:o,terms:s,count:1})}const a=[];for(const[o,{score:s,terms:u,count:c}]of r)a.push({suggestion:o,terms:u,score:s/c});return a.sort(kO),a}get documentCount(){return this._documentCount}get termCount(){return this._index.size}static loadJSON(t,n){if(n==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(t),n)}static async loadJSONAsync(t,n){if(n==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJSAsync(JSON.parse(t),n)}static getDefault(t){if(eb.hasOwnProperty(t))return Jm(eb,t);throw new Error(`MiniSearch: unknown option "${t}"`)}static loadJS(t,n){const{index:r,documentIds:a,fieldLength:o,storedFields:s,serializationVersion:u}=t,c=this.instantiateMiniSearch(t,n);c._documentIds=Id(a),c._fieldLength=Id(o),c._storedFields=Id(s);for(const[d,p]of c._documentIds)c._idToShortId.set(p,d);for(const[d,p]of r){const g=new Map;for(const m of Object.keys(p)){let b=p[m];u===1&&(b=b.ds),g.set(parseInt(m,10),Id(b))}c._index.set(d,g)}return c}static async loadJSAsync(t,n){const{index:r,documentIds:a,fieldLength:o,storedFields:s,serializationVersion:u}=t,c=this.instantiateMiniSearch(t,n);c._documentIds=await Ld(a),c._fieldLength=await Ld(o),c._storedFields=await Ld(s);for(const[p,g]of c._documentIds)c._idToShortId.set(g,p);let d=0;for(const[p,g]of r){const m=new Map;for(const b of Object.keys(g)){let y=g[b];u===1&&(y=y.ds),m.set(parseInt(b,10),await Ld(y))}++d%1e3===0&&await F5(0),c._index.set(p,m)}return c}static instantiateMiniSearch(t,n){const{documentCount:r,nextId:a,fieldIds:o,averageFieldLength:s,dirtCount:u,serializationVersion:c}=t;if(c!==1&&c!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");const d=new _o(n);return d._documentCount=r,d._nextId=a,d._idToShortId=new Map,d._fieldIds=o,d._avgFieldLength=s,d._dirtCount=u||0,d._index=new To,d}executeQuery(t,n={}){if(t===_o.wildcard)return this.executeWildcardQuery(n);if(typeof t!="string"){const m={...n,...t,queries:void 0},b=t.queries.map(y=>this.executeQuery(y,m));return this.combineResults(b,m.combineWith)}const{tokenize:r,processTerm:a,searchOptions:o}=this._options,s={tokenize:r,processTerm:a,...o,...n},{tokenize:u,processTerm:c}=s,g=u(t).flatMap(m=>c(m)).filter(m=>!!m).map(lae(s)).map(m=>this.executeQuerySpec(m,s));return this.combineResults(g,s.combineWith)}executeQuerySpec(t,n){const r={...this._options.searchOptions,...n},a=(r.fields||this._options.fields).reduce((S,k)=>({...S,[k]:Jm(r.boost,k)||1}),{}),{boostDocument:o,weights:s,maxFuzzy:u,bm25:c}=r,{fuzzy:d,prefix:p}={...wO.weights,...s},g=this._index.get(t.term),m=this.termResults(t.term,t.term,1,t.termBoost,g,a,o,c);let b,y;if(t.prefix&&(b=this._index.atPrefix(t.term)),t.fuzzy){const S=t.fuzzy===!0?.2:t.fuzzy,k=S<1?Math.min(u,Math.round(t.term.length*S)):S;k&&(y=this._index.fuzzyGet(t.term,k))}if(b)for(const[S,k]of b){const R=S.length-t.term.length;if(!R)continue;y==null||y.delete(S);const x=p*S.length/(S.length+.3*R);this.termResults(t.term,S,x,t.termBoost,k,a,o,c,m)}if(y)for(const S of y.keys()){const[k,R]=y.get(S);if(!R)continue;const x=d*S.length/(S.length+R);this.termResults(t.term,S,x,t.termBoost,k,a,o,c,m)}return m}executeWildcardQuery(t){const n=new Map,r={...this._options.searchOptions,...t};for(const[a,o]of this._documentIds){const s=r.boostDocument?r.boostDocument(o,"",this._storedFields.get(a)):1;n.set(a,{score:s,terms:[],match:{}})}return n}combineResults(t,n=FT){if(t.length===0)return new Map;const r=n.toLowerCase(),a=oae[r];if(!a)throw new Error(`Invalid combination operator: ${n}`);return t.reduce(a)||new Map}toJSON(){const t=[];for(const[n,r]of this._index){const a={};for(const[o,s]of r)a[o]=Object.fromEntries(s);t.push([n,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:t,serializationVersion:2}}termResults(t,n,r,a,o,s,u,c,d=new Map){if(o==null)return d;for(const p of Object.keys(s)){const g=s[p],m=this._fieldIds[p],b=o.get(m);if(b==null)continue;let y=b.size;const S=this._avgFieldLength[m];for(const k of b.keys()){if(!this._documentIds.has(k)){this.removeTerm(m,k,n),y-=1;continue}const R=u?u(this._documentIds.get(k),n,this._storedFields.get(k)):1;if(!R)continue;const x=b.get(k),A=this._fieldLength.get(k)[m],C=sae(x,y,this._documentCount,A,S,c),N=r*a*g*R*C,_=d.get(k);if(_){_.score+=N,cae(_.terms,t);const O=Jm(_.match,n);O?O.push(p):_.match[n]=[p]}else d.set(k,{score:N,terms:[t],match:{[n]:[p]}})}}return d}addTerm(t,n,r){const a=this._index.fetch(r,TO);let o=a.get(t);if(o==null)o=new Map,o.set(n,1),a.set(t,o);else{const s=o.get(n);o.set(n,(s||0)+1)}}removeTerm(t,n,r){if(!this._index.has(r)){this.warnDocumentChanged(n,t,r);return}const a=this._index.fetch(r,TO),o=a.get(t);o==null||o.get(n)==null?this.warnDocumentChanged(n,t,r):o.get(n)<=1?o.size<=1?a.delete(t):o.delete(n):o.set(n,o.get(n)-1),this._index.get(r).size===0&&this._index.delete(r)}warnDocumentChanged(t,n,r){for(const a of Object.keys(this._fieldIds))if(this._fieldIds[a]===n){this._options.logger("warn",`MiniSearch: document with ID ${this._documentIds.get(t)} has changed before removal: term "${r}" was not present in field "${a}". Removing a document after it has changed can corrupt the index!`,"version_conflict");return}}addDocumentId(t){const n=this._nextId;return this._idToShortId.set(t,n),this._documentIds.set(n,t),this._documentCount+=1,this._nextId+=1,n}addFields(t){for(let n=0;nObject.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,oae={[FT]:(e,t)=>{for(const n of t.keys()){const r=e.get(n);if(r==null)e.set(n,t.get(n));else{const{score:a,terms:o,match:s}=t.get(n);r.score=r.score+a,r.match=Object.assign(r.match,s),xO(r.terms,o)}}return e},[M5]:(e,t)=>{const n=new Map;for(const r of t.keys()){const a=e.get(r);if(a==null)continue;const{score:o,terms:s,match:u}=t.get(r);xO(a.terms,s),n.set(r,{score:a.score+o,terms:a.terms,match:Object.assign(a.match,u)})}return n},[aae]:(e,t)=>{for(const n of t.keys())e.delete(n);return e}},iae={k:1.2,b:.7,d:.5},sae=(e,t,n,r,a,o)=>{const{k:s,b:u,d:c}=o;return Math.log(1+(n-t+.5)/(t+.5))*(c+e*(s+1)/(e+s*(1-u+u*r/a)))},lae=e=>(t,n,r)=>{const a=typeof e.fuzzy=="function"?e.fuzzy(t,n,r):e.fuzzy||!1,o=typeof e.prefix=="function"?e.prefix(t,n,r):e.prefix===!0,s=typeof e.boostTerm=="function"?e.boostTerm(t,n,r):1;return{term:t,fuzzy:a,prefix:o,termBoost:s}},eb={idField:"id",extractField:(e,t)=>e[t],tokenize:e=>e.split(dae),processTerm:e=>e.toLowerCase(),fields:void 0,searchOptions:void 0,storeFields:[],logger:(e,t)=>{typeof(console==null?void 0:console[e])=="function"&&console[e](t)},autoVacuum:!0},wO={combineWith:FT,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:iae},uae={combineWith:M5,prefix:(e,t,n)=>t===n.length-1},Xk={batchSize:1e3,batchWait:10},Zk={minDirtFactor:.1,minDirtCount:20},tb={...Xk,...Zk},cae=(e,t)=>{e.includes(t)||e.push(t)},xO=(e,t)=>{for(const n of t)e.includes(n)||e.push(n)},kO=({score:e},{score:t})=>t-e,TO=()=>new Map,Id=e=>{const t=new Map;for(const n of Object.keys(e))t.set(parseInt(n,10),e[n]);return t},Ld=async e=>{const t=new Map;let n=0;for(const r of Object.keys(e))t.set(parseInt(r,10),e[r]),++n%1e3===0&&await F5(0);return t},F5=e=>new Promise(t=>setTimeout(t,e)),dae=/[\n\r\p{Z}\p{P}]+/u;function Qk(){return Qk=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);nve.createElement("div",{className:"node"},ve.createElement("span",{className:"render "+(n?"circle":"disc"),style:{backgroundColor:t||"#000"}}),ve.createElement("span",{className:`label ${n?"text-muted":""} ${e?"":"text-italic"}`},e||r.no_label||"No label")),Eae=({id:e,labels:t})=>{const n=Tr(),r=E.useMemo(()=>{const a=n.getGraph().getNodeAttributes(e),o=n.getSetting("nodeReducer");return Object.assign(Object.assign({color:n.getSetting("defaultNodeColor")},a),o?o(e,a):{})},[n,e]);return ve.createElement(t0,Object.assign({},r,{labels:t}))},wae=({label:e,color:t,source:n,target:r,hidden:a,directed:o,labels:s={}})=>ve.createElement("div",{className:"edge"},ve.createElement(t0,Object.assign({},n,{labels:s})),ve.createElement("div",{className:"body"},ve.createElement("div",{className:"render"},ve.createElement("span",{className:a?"dotted":"dash",style:{borderColor:t||"#000"}})," ",o&&ve.createElement("span",{className:"arrow",style:{borderTopColor:t||"#000"}})),ve.createElement("span",{className:`label ${a?"text-muted":""} ${e?"":"fst-italic"}`},e||s.no_label||"No label")),ve.createElement(t0,Object.assign({},r,{labels:s}))),xae=({id:e,labels:t})=>{const n=Tr(),r=E.useMemo(()=>{const a=n.getGraph().getEdgeAttributes(e),o=n.getSetting("nodeReducer"),s=n.getSetting("edgeReducer"),u=n.getGraph().getNodeAttributes(n.getGraph().source(e)),c=n.getGraph().getNodeAttributes(n.getGraph().target(e));return Object.assign(Object.assign(Object.assign({color:n.getSetting("defaultEdgeColor"),directed:n.getGraph().isDirected(e)},a),s?s(e,a):{}),{source:Object.assign(Object.assign({color:n.getSetting("defaultNodeColor")},u),o?o(e,u):{}),target:Object.assign(Object.assign({color:n.getSetting("defaultNodeColor")},c),o?o(e,c):{})})},[n,e]);return ve.createElement(wae,Object.assign({},r,{labels:t}))};function PT(e,t){const[n,r]=E.useState(e);return E.useEffect(()=>{const a=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(a)}},[e,t]),n}function kae({fetcher:e,preload:t,filterFn:n,renderOption:r,getOptionValue:a,notFound:o,loadingSkeleton:s,label:u,placeholder:c="Select...",value:d,onChange:p,onFocus:g,disabled:m=!1,className:b,noResultsMessage:y}){const[S,k]=E.useState(!1),[R,x]=E.useState(!1),[A,C]=E.useState([]),[N,_]=E.useState(!1),[O,F]=E.useState(null),[D,L]=E.useState(d),[G,$]=E.useState(null),[U,W]=E.useState(""),Z=PT(U,t?0:150),[j,H]=E.useState([]);E.useEffect(()=>{k(!0),L(d)},[d]),E.useEffect(()=>{S||(async()=>{try{_(!0),F(null);const V=d!==null?await e(d):[];H(V),C(V)}catch(V){F(V instanceof Error?V.message:"Failed to fetch options")}finally{_(!1)}})()},[S,e,d]),E.useEffect(()=>{const I=async()=>{try{_(!0),F(null);const V=await e(Z);H(V),C(V)}catch(V){F(V instanceof Error?V.message:"Failed to fetch options")}finally{_(!1)}};S&&t?t&&C(Z?j.filter(V=>n?n(V,Z):!0):j):I()},[e,Z,S,t,n]);const z=E.useCallback(I=>{I!==D&&(L(I),p(I)),x(!1)},[D,L,x,p]),Y=E.useCallback(I=>{I!==G&&($(I),g(I))},[G,$,g]);return w.jsx("div",{className:Me(m&&"cursor-not-allowed opacity-50",b),onFocus:()=>{x(!0)},onBlur:()=>x(!1),children:w.jsxs(xp,{shouldFilter:!1,className:"bg-transparent",children:[w.jsxs("div",{children:[w.jsx(DT,{placeholder:c,value:U,className:"max-h-8",onValueChange:I=>{W(I),I&&!R&&x(!0)}}),N&&A.length>0&&w.jsx("div",{className:"absolute top-1/2 right-2 flex -translate-y-1/2 transform items-center",children:w.jsx(nU,{className:"h-4 w-4 animate-spin"})})]}),w.jsxs(kp,{hidden:!R,children:[O&&w.jsx("div",{className:"text-destructive p-4 text-center",children:O}),N&&A.length===0&&(s||w.jsx(Tae,{})),!N&&!O&&A.length===0&&(o||w.jsx(IT,{children:y??`No ${u.toLowerCase()} found.`})),w.jsx(el,{children:A.map((I,V)=>w.jsxs(ve.Fragment,{children:[w.jsx(tl,{value:a(I),onSelect:z,onMouseEnter:()=>Y(a(I)),className:"truncate",children:r(I)},a(I)+`${V}`),V!==A.length-1&&w.jsx("div",{className:"bg-foreground/10 h-[1px]"},`divider-${V}`)]},a(I)+`-fragment-${V}`))})]})]})})}function Tae(){return w.jsx(el,{children:w.jsx(tl,{disabled:!0,children:w.jsxs("div",{className:"flex w-full items-center gap-2",children:[w.jsx("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),w.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[w.jsx("div",{className:"bg-muted h-4 w-24 animate-pulse rounded"}),w.jsx("div",{className:"bg-muted h-3 w-16 animate-pulse rounded"})]})]})})})}const nb="__message_item",Aae=({id:e})=>{const t=Pe.use.sigmaGraph();return t!=null&&t.hasNode(e)?w.jsx(Eae,{id:e}):null};function Rae(e){return w.jsxs("div",{children:[e.type==="nodes"&&w.jsx(Aae,{id:e.id}),e.type==="edges"&&w.jsx(xae,{id:e.id}),e.type==="message"&&w.jsx("div",{children:e.message})]})}const _ae=({onChange:e,onFocus:t,value:n})=>{const{t:r}=Pt(),a=Pe.use.sigmaGraph(),o=Pe.use.searchEngine();E.useEffect(()=>{a&&Pe.getState().resetSearchEngine()},[a]),E.useEffect(()=>{if(!a||a.nodes().length===0||o)return;const u=new _o({idField:"id",fields:["label"],searchOptions:{prefix:!0,fuzzy:.2,boost:{label:2}}}),c=a.nodes().map(d=>({id:d,label:a.getNodeAttribute(d,"label")}));u.addAll(c),Pe.getState().setSearchEngine(u)},[a,o]);const s=E.useCallback(async u=>{if(t&&t(null),!a||!o)return[];if(a.nodes().length===0)return[];if(!u)return a.nodes().filter(p=>a.hasNode(p)).slice(0,hd).map(p=>({id:p,type:"nodes"}));const c=o.search(u).filter(d=>a.hasNode(d.id)).map(d=>({id:d.id,type:"nodes"}));return c.length<=hd?c:[...c.slice(0,hd),{type:"message",id:nb,message:r("graphPanel.search.message",{count:c.length-hd})}]},[a,o,t,r]);return w.jsx(kae,{className:"bg-background/60 w-24 rounded-xl border-1 opacity-60 backdrop-blur-lg transition-all hover:w-fit hover:opacity-100",fetcher:s,renderOption:Rae,getOptionValue:u=>u.id,value:n&&n.type!=="message"?n.id:null,onChange:u=>{u!==nb&&e(u?{id:u,type:"nodes"}:null)},onFocus:u=>{u!==nb&&t&&t(u?{id:u,type:"nodes"}:null)},label:"item",placeholder:r("graphPanel.search.placeholder")})},Cae=({...e})=>w.jsx(_ae,{...e});function Nae({fetcher:e,preload:t,filterFn:n,renderOption:r,getOptionValue:a,getDisplayValue:o,notFound:s,loadingSkeleton:u,label:c,placeholder:d="Select...",value:p,onChange:g,disabled:m=!1,className:b,triggerClassName:y,searchInputClassName:S,noResultsMessage:k,triggerTooltip:R,clearable:x=!0}){const[A,C]=E.useState(!1),[N,_]=E.useState(!1),[O,F]=E.useState([]),[D,L]=E.useState(!1),[G,$]=E.useState(null),[U,W]=E.useState(p),[Z,j]=E.useState(null),[H,z]=E.useState(""),Y=PT(H,t?0:150),[I,V]=E.useState([]);E.useEffect(()=>{C(!0),W(p)},[p]),E.useEffect(()=>{if(p&&O.length>0){const M=O.find(K=>a(K)===p);M&&j(M)}},[p,O,a]),E.useEffect(()=>{A||(async()=>{try{L(!0),$(null);const K=await e(p);V(K),F(K)}catch(K){$(K instanceof Error?K.message:"Failed to fetch options")}finally{L(!1)}})()},[A,e,p]),E.useEffect(()=>{const M=async()=>{try{L(!0),$(null);const K=await e(Y);V(K),F(K)}catch(K){$(K instanceof Error?K.message:"Failed to fetch options")}finally{L(!1)}};A&&t?t&&F(Y?I.filter(K=>n?n(K,Y):!0):I):M()},[e,Y,A,t,n]);const B=E.useCallback(M=>{const K=x&&M===U?"":M;W(K),j(O.find(J=>a(J)===K)||null),g(K),_(!1)},[U,g,x,O,a]);return w.jsxs(Wu,{open:N,onOpenChange:_,children:[w.jsx(Yu,{asChild:!0,children:w.jsxs(Tt,{variant:"outline",role:"combobox","aria-expanded":N,className:Me("justify-between",m&&"cursor-not-allowed opacity-50",y),disabled:m,tooltip:R,side:"bottom",children:[Z?o(Z):d,w.jsx(wW,{className:"opacity-50",size:10})]})}),w.jsx(Ys,{className:Me("p-0",b),onCloseAutoFocus:M=>M.preventDefault(),children:w.jsxs(xp,{shouldFilter:!1,children:[w.jsxs("div",{className:"relative w-full border-b",children:[w.jsx(DT,{placeholder:`Search ${c.toLowerCase()}...`,value:H,onValueChange:M=>{z(M)},className:S}),D&&O.length>0&&w.jsx("div",{className:"absolute top-1/2 right-2 flex -translate-y-1/2 transform items-center",children:w.jsx(nU,{className:"h-4 w-4 animate-spin"})})]}),w.jsxs(kp,{children:[G&&w.jsx("div",{className:"text-destructive p-4 text-center",children:G}),D&&O.length===0&&(u||w.jsx(Oae,{})),!D&&!G&&O.length===0&&(s||w.jsx(IT,{children:k??`No ${c.toLowerCase()} found.`})),w.jsx(el,{children:O.map(M=>w.jsxs(tl,{value:a(M),onSelect:B,className:"truncate",children:[r(M),w.jsx(L0,{className:Me("ml-auto h-3 w-3",U===a(M)?"opacity-100":"opacity-0")})]},a(M)))})]})]})})]})}function Oae(){return w.jsx(el,{children:w.jsx(tl,{disabled:!0,children:w.jsxs("div",{className:"flex w-full items-center gap-2",children:[w.jsx("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),w.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[w.jsx("div",{className:"bg-muted h-4 w-24 animate-pulse rounded"}),w.jsx("div",{className:"bg-muted h-3 w-16 animate-pulse rounded"})]})]})})})}const Dae=()=>{const{t:e}=Pt(),t=Ge.use.queryLabel(),n=Pe.use.allDatabaseLabels(),r=Pe.use.rawGraph(),a=E.useRef(!1),o=E.useRef(!1);E.useEffect(()=>{!Pe.getState().labelsFetchAttempted&&!o.current&&(o.current=!0,Pe.getState().setLabelsFetchAttempted(!0),console.log("Fetching graph labels (once per session)..."),Pe.getState().fetchAllDatabaseLabels().then(()=>{a.current=!0,o.current=!1}).catch(p=>{console.error("Failed to fetch labels:",p),o.current=!1,Pe.getState().setLabelsFetchAttempted(!1)}))},[]);const s=E.useCallback(()=>{const d=new _o({idField:"id",fields:["value"],searchOptions:{prefix:!0,fuzzy:.2,boost:{label:2}}}),p=n.map((g,m)=>({id:m,value:g}));return d.addAll(p),{labels:n,searchEngine:d}},[n]),u=E.useCallback(async d=>{const{labels:p,searchEngine:g}=s();let m=p;return d&&(m=g.search(d).map(b=>p[b.id])),m.length<=NC?m:[...m.slice(0,NC),"..."]},[s]),c=E.useCallback(()=>{const d=Ge.getState().queryLabel;Pe.getState().setGraphDataFetchAttempted(!1),Pe.getState().reset(),Ge.getState().setQueryLabel(d)},[]);return w.jsxs("div",{className:"flex items-center",children:[r&&w.jsx(Tt,{size:"icon",variant:Ua,onClick:c,tooltip:e("graphPanel.graphLabels.refreshTooltip"),className:"mr-1",children:w.jsx(rU,{className:"h-4 w-4"})}),w.jsx(Nae,{className:"ml-2",triggerClassName:"max-h-8",searchInputClassName:"max-h-8",triggerTooltip:e("graphPanel.graphLabels.selectTooltip"),fetcher:u,renderOption:d=>w.jsx("div",{children:d}),getOptionValue:d=>d,getDisplayValue:d=>w.jsx("div",{children:d}),notFound:w.jsx("div",{className:"py-6 text-center text-sm",children:"No labels found"}),label:e("graphPanel.graphLabels.label"),placeholder:e("graphPanel.graphLabels.placeholder"),value:t!==null?t:"*",onChange:d=>{const p=Ge.getState().queryLabel;d==="..."&&(d="*"),Pe.getState().setGraphDataFetchAttempted(!1),d!==p&&Pe.getState().reset(),d===p&&d!=="*"?Ge.getState().setQueryLabel("*"):Ge.getState().setQueryLabel(d)},clearable:!1})]})},Bn=({text:e,className:t,tooltipClassName:n,tooltip:r,side:a,onClick:o})=>r?w.jsx(C3,{delayDuration:200,children:w.jsxs(N3,{children:[w.jsx(O3,{asChild:!0,children:w.jsx("label",{className:Me(t,o!==void 0?"cursor-pointer":void 0),onClick:o,children:e})}),w.jsx(uT,{side:a,className:n,children:r})]})}):w.jsx("label",{className:Me(t,o!==void 0?"cursor-pointer":void 0),onClick:o,children:e});var ef={exports:{}},Iae=ef.exports,AO;function Lae(){return AO||(AO=1,function(e){(function(t,n,r){function a(c){var d=this,p=u();d.next=function(){var g=2091639*d.s0+d.c*23283064365386963e-26;return d.s0=d.s1,d.s1=d.s2,d.s2=g-(d.c=g|0)},d.c=1,d.s0=p(" "),d.s1=p(" "),d.s2=p(" "),d.s0-=p(c),d.s0<0&&(d.s0+=1),d.s1-=p(c),d.s1<0&&(d.s1+=1),d.s2-=p(c),d.s2<0&&(d.s2+=1),p=null}function o(c,d){return d.c=c.c,d.s0=c.s0,d.s1=c.s1,d.s2=c.s2,d}function s(c,d){var p=new a(c),g=d&&d.state,m=p.next;return m.int32=function(){return p.next()*4294967296|0},m.double=function(){return m()+(m()*2097152|0)*11102230246251565e-32},m.quick=m,g&&(typeof g=="object"&&o(g,p),m.state=function(){return o(p,{})}),m}function u(){var c=4022871197,d=function(p){p=String(p);for(var g=0;g>>0,m-=c,m*=c,c=m>>>0,m-=c,c+=m*4294967296}return(c>>>0)*23283064365386963e-26};return d}n&&n.exports?n.exports=s:this.alea=s})(Iae,e)}(ef)),ef.exports}var tf={exports:{}},Mae=tf.exports,RO;function Fae(){return RO||(RO=1,function(e){(function(t,n,r){function a(u){var c=this,d="";c.x=0,c.y=0,c.z=0,c.w=0,c.next=function(){var g=c.x^c.x<<11;return c.x=c.y,c.y=c.z,c.z=c.w,c.w^=c.w>>>19^g^g>>>8},u===(u|0)?c.x=u:d+=u;for(var p=0;p>>0)/4294967296};return g.double=function(){do var m=d.next()>>>11,b=(d.next()>>>0)/4294967296,y=(m+b)/(1<<21);while(y===0);return y},g.int32=d.next,g.quick=g,p&&(typeof p=="object"&&o(p,d),g.state=function(){return o(d,{})}),g}n&&n.exports?n.exports=s:this.xor128=s})(Mae,e)}(tf)),tf.exports}var nf={exports:{}},Pae=nf.exports,_O;function zae(){return _O||(_O=1,function(e){(function(t,n,r){function a(u){var c=this,d="";c.next=function(){var g=c.x^c.x>>>2;return c.x=c.y,c.y=c.z,c.z=c.w,c.w=c.v,(c.d=c.d+362437|0)+(c.v=c.v^c.v<<4^(g^g<<1))|0},c.x=0,c.y=0,c.z=0,c.w=0,c.v=0,u===(u|0)?c.x=u:d+=u;for(var p=0;p>>4),c.next()}function o(u,c){return c.x=u.x,c.y=u.y,c.z=u.z,c.w=u.w,c.v=u.v,c.d=u.d,c}function s(u,c){var d=new a(u),p=c&&c.state,g=function(){return(d.next()>>>0)/4294967296};return g.double=function(){do var m=d.next()>>>11,b=(d.next()>>>0)/4294967296,y=(m+b)/(1<<21);while(y===0);return y},g.int32=d.next,g.quick=g,p&&(typeof p=="object"&&o(p,d),g.state=function(){return o(d,{})}),g}n&&n.exports?n.exports=s:this.xorwow=s})(Pae,e)}(nf)),nf.exports}var rf={exports:{}},Bae=rf.exports,CO;function Uae(){return CO||(CO=1,function(e){(function(t,n,r){function a(u){var c=this;c.next=function(){var p=c.x,g=c.i,m,b;return m=p[g],m^=m>>>7,b=m^m<<24,m=p[g+1&7],b^=m^m>>>10,m=p[g+3&7],b^=m^m>>>3,m=p[g+4&7],b^=m^m<<7,m=p[g+7&7],m=m^m<<13,b^=m^m<<9,p[g]=b,c.i=g+1&7,b};function d(p,g){var m,b=[];if(g===(g|0))b[0]=g;else for(g=""+g,m=0;m0;--m)p.next()}d(c,u)}function o(u,c){return c.x=u.x.slice(),c.i=u.i,c}function s(u,c){u==null&&(u=+new Date);var d=new a(u),p=c&&c.state,g=function(){return(d.next()>>>0)/4294967296};return g.double=function(){do var m=d.next()>>>11,b=(d.next()>>>0)/4294967296,y=(m+b)/(1<<21);while(y===0);return y},g.int32=d.next,g.quick=g,p&&(p.x&&o(p,d),g.state=function(){return o(d,{})}),g}n&&n.exports?n.exports=s:this.xorshift7=s})(Bae,e)}(rf)),rf.exports}var af={exports:{}},jae=af.exports,NO;function Gae(){return NO||(NO=1,function(e){(function(t,n,r){function a(u){var c=this;c.next=function(){var p=c.w,g=c.X,m=c.i,b,y;return c.w=p=p+1640531527|0,y=g[m+34&127],b=g[m=m+1&127],y^=y<<13,b^=b<<17,y^=y>>>15,b^=b>>>12,y=g[m]=y^b,c.i=m,y+(p^p>>>16)|0};function d(p,g){var m,b,y,S,k,R=[],x=128;for(g===(g|0)?(b=g,g=null):(g=g+"\0",b=0,x=Math.max(x,g.length)),y=0,S=-32;S>>15,b^=b<<4,b^=b>>>13,S>=0&&(k=k+1640531527|0,m=R[S&127]^=b+k,y=m==0?y+1:0);for(y>=128&&(R[(g&&g.length||0)&127]=-1),y=127,S=4*128;S>0;--S)b=R[y+34&127],m=R[y=y+1&127],b^=b<<13,m^=m<<17,b^=b>>>15,m^=m>>>12,R[y]=b^m;p.w=k,p.X=R,p.i=y}d(c,u)}function o(u,c){return c.i=u.i,c.w=u.w,c.X=u.X.slice(),c}function s(u,c){u==null&&(u=+new Date);var d=new a(u),p=c&&c.state,g=function(){return(d.next()>>>0)/4294967296};return g.double=function(){do var m=d.next()>>>11,b=(d.next()>>>0)/4294967296,y=(m+b)/(1<<21);while(y===0);return y},g.int32=d.next,g.quick=g,p&&(p.X&&o(p,d),g.state=function(){return o(d,{})}),g}n&&n.exports?n.exports=s:this.xor4096=s})(jae,e)}(af)),af.exports}var of={exports:{}},Hae=of.exports,OO;function $ae(){return OO||(OO=1,function(e){(function(t,n,r){function a(u){var c=this,d="";c.next=function(){var g=c.b,m=c.c,b=c.d,y=c.a;return g=g<<25^g>>>7^m,m=m-b|0,b=b<<24^b>>>8^y,y=y-g|0,c.b=g=g<<20^g>>>12^m,c.c=m=m-b|0,c.d=b<<16^m>>>16^y,c.a=y-g|0},c.a=0,c.b=0,c.c=-1640531527,c.d=1367130551,u===Math.floor(u)?(c.a=u/4294967296|0,c.b=u|0):d+=u;for(var p=0;p>>0)/4294967296};return g.double=function(){do var m=d.next()>>>11,b=(d.next()>>>0)/4294967296,y=(m+b)/(1<<21);while(y===0);return y},g.int32=d.next,g.quick=g,p&&(typeof p=="object"&&o(p,d),g.state=function(){return o(d,{})}),g}n&&n.exports?n.exports=s:this.tychei=s})(Hae,e)}(of)),of.exports}var sf={exports:{}};const qae={},Vae=Object.freeze(Object.defineProperty({__proto__:null,default:qae},Symbol.toStringTag,{value:"Module"})),Wae=f9(Vae);var Yae=sf.exports,DO;function Kae(){return DO||(DO=1,function(e){(function(t,n,r){var a=256,o=6,s=52,u="random",c=r.pow(a,o),d=r.pow(2,s),p=d*2,g=a-1,m;function b(C,N,_){var O=[];N=N==!0?{entropy:!0}:N||{};var F=R(k(N.entropy?[C,A(n)]:C??x(),3),O),D=new y(O),L=function(){for(var G=D.g(o),$=c,U=0;G=p;)G/=2,$/=2,U>>>=1;return(G+U)/$};return L.int32=function(){return D.g(4)|0},L.quick=function(){return D.g(4)/4294967296},L.double=L,R(A(D.S),n),(N.pass||_||function(G,$,U,W){return W&&(W.S&&S(W,D),G.state=function(){return S(D,{})}),U?(r[u]=G,$):G})(L,F,"global"in N?N.global:this==r,N.state)}function y(C){var N,_=C.length,O=this,F=0,D=O.i=O.j=0,L=O.S=[];for(_||(C=[_++]);F{if(!e||!Array.isArray(e.nodes)||!Array.isArray(e.edges))return!1;for(const t of e.nodes)if(!t.id||!t.labels||!t.properties)return!1;for(const t of e.edges)if(!t.id||!t.source||!t.target)return!1;for(const t of e.edges){const n=e.getNode(t.source),r=e.getNode(t.target);if(n==null||r==null)return!1}return!0},Jae=async(e,t,n)=>{let r=null;try{r=await qB(e,t,n)}catch(o){return Hn.getState().setErrorMessage(Sr(o),"Query Graphs Error!"),null}let a=null;if(r){const o={},s={};for(let p=0;p0){const p=jB-hu;for(const g of r.nodes)g.size=Math.round(hu+p*Math.pow((g.degree-u)/d,.5))}a=new wne,a.nodes=r.nodes,a.edges=r.edges,a.nodeIdMap=o,a.edgeIdMap=s,Qae(a)||(a=null,console.error("Invalid graph data")),console.log("Graph data loaded")}return a},eoe=e=>{const t=new Sp;for(const n of(e==null?void 0:e.nodes)??[]){_f(n.id+Date.now().toString(),{global:!0});const r=Math.random(),a=Math.random();t.addNode(n.id,{label:n.labels.join(", "),color:n.color,x:r,y:a,size:n.size,borderColor:UB,borderSize:.2})}for(const n of(e==null?void 0:e.edges)??[])n.dynamicId=t.addDirectedEdge(n.source,n.target,{label:n.type||void 0});return t},toe=()=>{const{t:e}=Pt(),t=Ge.use.queryLabel(),n=Pe.use.rawGraph(),r=Pe.use.sigmaGraph(),a=Ge.use.graphQueryMaxDepth(),o=Ge.use.graphMinDegree(),s=Pe.use.isFetching(),u=Pe.use.nodeToExpand(),c=Pe.use.nodeToPrune(),{isTabVisible:d}=yp(),p=d("knowledge-graph"),g=E.useRef({queryLabel:t,maxQueryDepth:a,minDegree:o}),m=E.useRef(!1),b=E.useRef(!1),y=g.current.queryLabel!==t||g.current.maxQueryDepth!==a||g.current.minDegree!==o,S=E.useCallback(C=>(n==null?void 0:n.getNode(C))||null,[n]),k=E.useCallback((C,N=!0)=>(n==null?void 0:n.getEdge(C,N))||null,[n]),R=E.useRef(!1);E.useEffect(()=>{if(!R.current){if(!t){if(n!==null||r!==null){const C=Pe.getState();C.reset(),C.setGraphDataFetchAttempted(!1),C.setLabelsFetchAttempted(!1)}m.current=!1,b.current=!1;return}if(!s&&!R.current&&(y||!Pe.getState().graphDataFetchAttempted)){if(!p){console.log("Graph tab not visible, skipping data fetch");return}R.current=!0,Pe.getState().setGraphDataFetchAttempted(!0);const C=Pe.getState();C.setIsFetching(!0),C.setShouldRender(!1),C.clearSelection(),C.sigmaGraph&&C.sigmaGraph.forEachNode(F=>{var D;(D=C.sigmaGraph)==null||D.setNodeAttribute(F,"highlighted",!1)}),g.current={queryLabel:t,maxQueryDepth:a,minDegree:o},console.log("Fetching graph data..."),Jae(t,a,o).then(F=>{const D=Pe.getState();D.reset();const L=eoe(F);F==null||F.buildDynamicMap(),D.setSigmaGraph(L),D.setRawGraph(F),m.current=!0,b.current=!0,R.current=!1,D.setMoveToSelectedNode(!0),D.setShouldRender(p),D.setIsFetching(!1)}).catch(F=>{console.error("Error fetching graph data:",F);const D=Pe.getState();D.setIsFetching(!1),D.setShouldRender(p),m.current=!1,R.current=!1,D.setGraphDataFetchAttempted(!1)})}}},[t,a,o,s,y,p,n,r]),E.useEffect(()=>{p?n&&Pe.getState().setShouldRender(!0):Pe.getState().setShouldRender(!1)},[p,n]),E.useEffect(()=>{u&&((async N=>{var _,O,F;if(!(!N||!r||!n))try{const D=n.getNode(N);if(!D){console.error("Node not found:",N);return}const L=D.labels[0];if(!L){console.error("Node has no label:",N);return}const G=await qB(L,2,0);if(!G||!G.nodes||!G.edges){console.error("Failed to fetch extended graph");return}const $=[];for(const Q of G.nodes){_f(Q.id,{global:!0});const pe=pB();$.push({id:Q.id,labels:Q.labels,properties:Q.properties,size:10,x:Math.random(),y:Math.random(),color:pe,degree:0})}const U=[];for(const Q of G.edges)U.push({id:Q.id,source:Q.source,target:Q.target,type:Q.type,properties:Q.properties,dynamicId:""});const W={};r.forEachNode(Q=>{W[Q]={x:r.getNodeAttribute(Q,"x"),y:r.getNodeAttribute(Q,"y")}});const Z=new Set(r.nodes()),j=new Set,H=new Set,z=1;let Y=0;r.forEachNode(Q=>{const pe=r.degree(Q);Y=Math.max(Y,pe)});const I=Y-z||1,V=jB-hu;for(const Q of $){if(Z.has(Q.id))continue;U.some(re=>re.source===N&&re.target===Q.id||re.target===N&&re.source===Q.id)&&j.add(Q.id)}const B=new Map,M=new Set;for(const Q of U){const pe=Z.has(Q.source)||j.has(Q.source),re=Z.has(Q.target)||j.has(Q.target);pe&&re?(H.add(Q.id),j.has(Q.source)&&B.set(Q.source,(B.get(Q.source)||0)+1),j.has(Q.target)&&B.set(Q.target,(B.get(Q.target)||0)+1)):(r.hasNode(Q.source)?M.add(Q.source):j.has(Q.source)&&(M.add(Q.source),B.set(Q.source,(B.get(Q.source)||0)+1)),r.hasNode(Q.target)?M.add(Q.target):j.has(Q.target)&&(M.add(Q.target),B.set(Q.target,(B.get(Q.target)||0)+1)))}const K=(Q,pe,re,Ee,we)=>{for(const De of pe)if(Q.hasNode(De)){let _e=Q.degree(De);_e+=1;const Se=Math.round(hu+we*Math.pow((_e-re)/Ee,.5)),ee=Q.getNodeAttribute(De,"size");Se>ee&&Q.setNodeAttribute(De,"size",Se)}};if(j.size===0){K(r,M,z,I,V),Ft.info(e("graphPanel.propertiesView.node.noNewNodes"));return}for(const[,Q]of B.entries())Y=Math.max(Y,Q);const J=((_=Pe.getState().sigmaInstance)==null?void 0:_.getCamera().ratio)||1,le=Math.max(Math.sqrt(D.size)*4,Math.sqrt(j.size)*3)/J;_f(Date.now().toString(),{global:!0});const oe=Math.random()*2*Math.PI;console.log("nodeSize:",D.size,"nodesToAdd:",j.size),console.log("cameraRatio:",Math.round(J*100)/100,"spreadFactor:",Math.round(le*100)/100);for(const Q of j){const pe=$.find(Se=>Se.id===Q),re=B.get(Q)||0,Ee=Math.round(hu+V*Math.pow((re-z)/I,.5)),we=2*Math.PI*(Array.from(j).indexOf(Q)/j.size),De=((O=W[Q])==null?void 0:O.x)||W[D.id].x+Math.cos(oe+we)*le,_e=((F=W[Q])==null?void 0:F.y)||W[D.id].y+Math.sin(oe+we)*le;r.addNode(Q,{label:pe.labels.join(", "),color:pe.color,x:De,y:_e,size:Ee,borderColor:UB,borderSize:.2}),n.getNode(Q)||(pe.size=Ee,pe.x=De,pe.y=_e,pe.degree=re,n.nodes.push(pe),n.nodeIdMap[Q]=n.nodes.length-1)}for(const Q of H){const pe=U.find(re=>re.id===Q);r.hasEdge(pe.source,pe.target)||r.hasEdge(pe.target,pe.source)||(pe.dynamicId=r.addDirectedEdge(pe.source,pe.target,{label:pe.type||void 0}),n.getEdge(pe.id,!1)||(n.edges.push(pe),n.edgeIdMap[pe.id]=n.edges.length-1,n.edgeDynamicIdMap[pe.dynamicId]=n.edges.length-1))}n.buildDynamicMap(),Pe.getState().resetSearchEngine(),K(r,M,z,I,V)}catch(D){console.error("Error expanding node:",D)}})(u),window.setTimeout(()=>{Pe.getState().triggerNodeExpand(null)},0))},[u,r,n,e]);const x=E.useCallback((C,N)=>{const _=new Set([C]);return N.forEachNode(O=>{if(O===C)return;const F=N.neighbors(O);F.length===1&&F[0]===C&&_.add(O)}),_},[]);return E.useEffect(()=>{c&&((N=>{if(!(!N||!r||!n))try{const _=Pe.getState();if(!r.hasNode(N)){console.error("Node not found:",N);return}const O=x(N,r);if(O.size===r.nodes().length){Ft.error(e("graphPanel.propertiesView.node.deleteAllNodesError"));return}_.clearSelection();for(const F of O){r.dropNode(F);const D=n.nodeIdMap[F];if(D!==void 0){const L=n.edges.filter(G=>G.source===F||G.target===F);for(const G of L){const $=n.edgeIdMap[G.id];if($!==void 0){n.edges.splice($,1);for(const[U,W]of Object.entries(n.edgeIdMap))W>$&&(n.edgeIdMap[U]=W-1);delete n.edgeIdMap[G.id],delete n.edgeDynamicIdMap[G.dynamicId]}}n.nodes.splice(D,1);for(const[G,$]of Object.entries(n.nodeIdMap))$>D&&(n.nodeIdMap[G]=$-1);delete n.nodeIdMap[F]}}n.buildDynamicMap(),Pe.getState().resetSearchEngine(),O.size>1&&Ft.info(e("graphPanel.propertiesView.node.nodesRemoved",{count:O.size}))}catch(_){console.error("Error pruning node:",_)}})(c),window.setTimeout(()=>{Pe.getState().triggerNodePrune(null)},0))},[c,r,n,x,e]),{lightrageGraph:E.useCallback(()=>{if(r)return r;console.log("Creating new Sigma graph instance");const C=new Sp;return Pe.getState().setSigmaGraph(C),C},[r]),getNode:S,getEdge:k}},noe=()=>{const{getNode:e,getEdge:t}=toe(),n=Pe.use.selectedNode(),r=Pe.use.focusedNode(),a=Pe.use.selectedEdge(),o=Pe.use.focusedEdge(),[s,u]=E.useState(null),[c,d]=E.useState(null);return E.useEffect(()=>{let p=null,g=null;r?(p="node",g=e(r)):n?(p="node",g=e(n)):o?(p="edge",g=t(o,!0)):a&&(p="edge",g=t(a,!0)),g?(p=="node"?u(roe(g)):u(aoe(g)),d(p)):(u(null),d(null))},[r,n,o,a,u,d,e,t]),s?w.jsx("div",{className:"bg-background/80 max-w-xs rounded-lg border-2 p-2 text-xs backdrop-blur-lg",children:c=="node"?w.jsx(ooe,{node:s}):w.jsx(ioe,{edge:s})}):w.jsx(w.Fragment,{})},roe=e=>{const t=Pe.getState(),n=[];if(t.sigmaGraph&&t.rawGraph)try{if(!t.sigmaGraph.hasNode(e.id))return{...e,relationships:[]};const r=t.sigmaGraph.edges(e.id);for(const a of r){if(!t.sigmaGraph.hasEdge(a))continue;const o=t.rawGraph.getEdge(a,!0);if(o){const u=e.id===o.source?o.target:o.source;if(!t.sigmaGraph.hasNode(u))continue;const c=t.rawGraph.getNode(u);c&&n.push({type:"Neighbour",id:u,label:c.properties.entity_id?c.properties.entity_id:c.labels.join(", ")})}}}catch(r){console.error("Error refining node properties:",r)}return{...e,relationships:n}},aoe=e=>{const t=Pe.getState();let n,r;if(t.sigmaGraph&&t.rawGraph)try{if(!t.sigmaGraph.hasEdge(e.id))return{...e,sourceNode:void 0,targetNode:void 0};t.sigmaGraph.hasNode(e.source)&&(n=t.rawGraph.getNode(e.source)),t.sigmaGraph.hasNode(e.target)&&(r=t.rawGraph.getNode(e.target))}catch(a){console.error("Error refining edge properties:",a)}return{...e,sourceNode:n,targetNode:r}},ea=({name:e,value:t,onClick:n,tooltip:r})=>{const{t:a}=Pt(),o=s=>{const u=`graphPanel.propertiesView.node.propertyNames.${s}`,c=a(u);return c===u?s:c};return w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx("label",{className:"text-primary/60 tracking-wide whitespace-nowrap",children:o(e)}),":",w.jsx(Bn,{className:"hover:bg-primary/20 rounded p-1 overflow-hidden text-ellipsis",tooltipClassName:"max-w-80",text:t,tooltip:r||(typeof t=="string"?t:JSON.stringify(t,null,2)),side:"left",onClick:n})]})},ooe=({node:e})=>{const{t}=Pt(),n=()=>{Pe.getState().triggerNodeExpand(e.id)},r=()=>{Pe.getState().triggerNodePrune(e.id)};return w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsxs("div",{className:"flex justify-between items-center",children:[w.jsx("label",{className:"text-md pl-1 font-bold tracking-wide text-blue-700",children:t("graphPanel.propertiesView.node.title")}),w.jsxs("div",{className:"flex gap-3",children:[w.jsx(Tt,{size:"icon",variant:"ghost",className:"h-7 w-7 border border-gray-400 hover:bg-gray-200",onClick:n,tooltip:t("graphPanel.propertiesView.node.expandNode"),children:w.jsx(MW,{className:"h-4 w-4 text-gray-700"})}),w.jsx(Tt,{size:"icon",variant:"ghost",className:"h-7 w-7 border border-gray-400 hover:bg-gray-200",onClick:r,tooltip:t("graphPanel.propertiesView.node.pruneNode"),children:w.jsx(rY,{className:"h-4 w-4 text-gray-900"})})]})]}),w.jsxs("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:[w.jsx(ea,{name:t("graphPanel.propertiesView.node.id"),value:e.id}),w.jsx(ea,{name:t("graphPanel.propertiesView.node.labels"),value:e.labels.join(", "),onClick:()=>{Pe.getState().setSelectedNode(e.id,!0)}}),w.jsx(ea,{name:t("graphPanel.propertiesView.node.degree"),value:e.degree})]}),w.jsx("label",{className:"text-md pl-1 font-bold tracking-wide text-amber-700",children:t("graphPanel.propertiesView.node.properties")}),w.jsx("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:Object.keys(e.properties).sort().map(a=>w.jsx(ea,{name:a,value:e.properties[a]},a))}),e.relationships.length>0&&w.jsxs(w.Fragment,{children:[w.jsx("label",{className:"text-md pl-1 font-bold tracking-wide text-emerald-700",children:t("graphPanel.propertiesView.node.relationships")}),w.jsx("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:e.relationships.map(({type:a,id:o,label:s})=>w.jsx(ea,{name:a,value:s,onClick:()=>{Pe.getState().setSelectedNode(o,!0)}},o))})]})]})},ioe=({edge:e})=>{const{t}=Pt();return w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx("label",{className:"text-md pl-1 font-bold tracking-wide text-violet-700",children:t("graphPanel.propertiesView.edge.title")}),w.jsxs("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:[w.jsx(ea,{name:t("graphPanel.propertiesView.edge.id"),value:e.id}),e.type&&w.jsx(ea,{name:t("graphPanel.propertiesView.edge.type"),value:e.type}),w.jsx(ea,{name:t("graphPanel.propertiesView.edge.source"),value:e.sourceNode?e.sourceNode.labels.join(", "):e.source,onClick:()=>{Pe.getState().setSelectedNode(e.source,!0)}}),w.jsx(ea,{name:t("graphPanel.propertiesView.edge.target"),value:e.targetNode?e.targetNode.labels.join(", "):e.target,onClick:()=>{Pe.getState().setSelectedNode(e.target,!0)}})]}),w.jsx("label",{className:"text-md pl-1 font-bold tracking-wide text-amber-700",children:t("graphPanel.propertiesView.edge.properties")}),w.jsx("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:Object.keys(e.properties).sort().map(n=>w.jsx(ea,{name:n,value:e.properties[n]},n))})]})},soe=()=>{const{t:e}=Pt(),t=Ge.use.graphQueryMaxDepth(),n=Ge.use.graphMinDegree();return w.jsxs("div",{className:"absolute bottom-2 left-[calc(2rem+2.5rem)] flex items-center gap-2 text-xs text-gray-400",children:[w.jsxs("div",{children:[e("graphPanel.sideBar.settings.depth"),": ",t]}),w.jsxs("div",{children:[e("graphPanel.sideBar.settings.degree"),": ",n]})]})},LO={allowInvalidContainer:!0,defaultNodeType:"default",defaultEdgeType:"curvedArrow",renderEdgeLabels:!1,edgeProgramClasses:{arrow:I4,curvedArrow:Ene,curvedNoArrow:Sne},nodeProgramClasses:{default:rne,circel:Zu,point:Ote},labelGridCellSize:60,labelRenderedSizeThreshold:12,enableEdgeEvents:!0,labelColor:{color:"#000",attribute:"labelColor"},edgeLabelColor:{color:"#000",attribute:"labelColor"},edgeLabelSize:8,labelSize:12},loe=()=>{const e=G4(),t=Tr(),[n,r]=E.useState(null);return E.useEffect(()=>{e({downNode:a=>{r(a.node),t.getGraph().setNodeAttribute(a.node,"highlighted",!0)},mousemovebody:a=>{if(!n)return;const o=t.viewportToGraph(a);t.getGraph().setNodeAttribute(n,"x",o.x),t.getGraph().setNodeAttribute(n,"y",o.y),a.preventSigmaDefault(),a.original.preventDefault(),a.original.stopPropagation()},mouseup:()=>{n&&(r(null),t.getGraph().removeNodeAttribute(n,"highlighted"))},mousedown:a=>{a.original.buttons!==0&&!t.getCustomBBox()&&t.setCustomBBox(t.getBBox())}})},[e,t,n]),null},uoe=()=>{const[e,t]=E.useState(LO),n=E.useRef(null),r=E.useRef(!1),a=Pe.use.selectedNode(),o=Pe.use.focusedNode(),s=Pe.use.moveToSelectedNode(),u=Pe.use.isFetching(),c=Pe.use.shouldRender(),{isTabVisible:d}=yp(),p=d("knowledge-graph"),g=Ge.use.showPropertyPanel(),m=Ge.use.showNodeSearchBar(),b=Ge.use.enableNodeDrag();E.useEffect(()=>(p&&!c&&!u&&!r.current&&(Pe.getState().setShouldRender(!0),r.current=!0,console.log("Graph viewer initialized")),()=>{console.log("Graph viewer cleanup")}),[p,c,u]),E.useEffect(()=>{t(LO)},[]),E.useEffect(()=>()=>{Pe.getState().setSigmaInstance(null),console.log("Cleared sigma instance on unmount")},[]);const y=E.useCallback(x=>{x===null?Pe.getState().setFocusedNode(null):x.type==="nodes"&&Pe.getState().setFocusedNode(x.id)},[]),S=E.useCallback(x=>{x===null?Pe.getState().setSelectedNode(null):x.type==="nodes"&&Pe.getState().setSelectedNode(x.id,!0)},[]),k=E.useMemo(()=>o??a,[o,a]),R=E.useMemo(()=>a?{type:"nodes",id:a}:null,[a]);return w.jsxs("div",{className:"relative h-full w-full overflow-hidden",children:[w.jsxs(Tte,{settings:e,className:"!bg-background !size-full overflow-hidden",ref:n,children:[w.jsx(Hre,{}),b&&w.jsx(loe,{}),w.jsx(kne,{node:k,move:s}),w.jsxs("div",{className:"absolute top-2 left-2 flex items-start gap-2",children:[w.jsx(Dae,{}),m&&w.jsx(Cae,{value:R,onFocus:y,onChange:S})]}),w.jsxs("div",{className:"bg-background/60 absolute bottom-2 left-2 flex flex-col rounded-xl border-2 backdrop-blur-lg",children:[w.jsx(Gre,{}),w.jsx($re,{}),w.jsx(qre,{}),w.jsx(eae,{})]}),g&&w.jsx("div",{className:"absolute top-2 right-2",children:w.jsx(noe,{})}),w.jsx(soe,{})]}),u&&w.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/80 z-10",children:w.jsxs("div",{className:"text-center",children:[w.jsx("div",{className:"mb-2 h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),w.jsx("p",{children:"Loading Graph Data..."})]})})]})},z5=E.forwardRef(({className:e,...t},n)=>w.jsx("div",{className:"relative w-full overflow-auto",children:w.jsx("table",{ref:n,className:Me("w-full caption-bottom text-sm",e),...t})}));z5.displayName="Table";const B5=E.forwardRef(({className:e,...t},n)=>w.jsx("thead",{ref:n,className:Me("[&_tr]:border-b",e),...t}));B5.displayName="TableHeader";const U5=E.forwardRef(({className:e,...t},n)=>w.jsx("tbody",{ref:n,className:Me("[&_tr:last-child]:border-0",e),...t}));U5.displayName="TableBody";const coe=E.forwardRef(({className:e,...t},n)=>w.jsx("tfoot",{ref:n,className:Me("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t}));coe.displayName="TableFooter";const n0=E.forwardRef(({className:e,...t},n)=>w.jsx("tr",{ref:n,className:Me("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t}));n0.displayName="TableRow";const Fa=E.forwardRef(({className:e,...t},n)=>w.jsx("th",{ref:n,className:Me("text-muted-foreground h-10 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));Fa.displayName="TableHead";const Pa=E.forwardRef(({className:e,...t},n)=>w.jsx("td",{ref:n,className:Me("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));Pa.displayName="TableCell";const doe=E.forwardRef(({className:e,...t},n)=>w.jsx("caption",{ref:n,className:Me("text-muted-foreground mt-4 text-sm",e),...t}));doe.displayName="TableCaption";const Ms=E.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:Me("bg-card text-card-foreground rounded-xl border shadow",e),...t}));Ms.displayName="Card";const Nu=E.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:Me("flex flex-col space-y-1.5 p-6",e),...t}));Nu.displayName="CardHeader";const Ou=E.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:Me("leading-none font-semibold tracking-tight",e),...t}));Ou.displayName="CardTitle";const Tp=E.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:Me("text-muted-foreground text-sm",e),...t}));Tp.displayName="CardDescription";const Du=E.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:Me("p-6 pt-0",e),...t}));Du.displayName="CardContent";const foe=E.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:Me("flex items-center p-6 pt-0",e),...t}));foe.displayName="CardFooter";function poe({title:e,description:t,icon:n=OW,action:r,className:a,...o}){return w.jsxs(Ms,{className:Me("flex w-full flex-col items-center justify-center space-y-6 bg-transparent p-16",a),...o,children:[w.jsx("div",{className:"mr-4 shrink-0 rounded-full border border-dashed p-4",children:w.jsx(n,{className:"text-muted-foreground size-8","aria-hidden":"true"})}),w.jsxs("div",{className:"flex flex-col items-center gap-1.5 text-center",children:[w.jsx(Ou,{children:e}),t?w.jsx(Tp,{children:t}):null]}),r||null]})}var ab={exports:{}},ob,MO;function goe(){if(MO)return ob;MO=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ob=e,ob}var ib,FO;function hoe(){if(FO)return ib;FO=1;var e=goe();function t(){}function n(){}return n.resetWarningCache=t,ib=function(){function r(s,u,c,d,p,g){if(g!==e){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}r.isRequired=r;function a(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},ib}var PO;function moe(){return PO||(PO=1,ab.exports=hoe()()),ab.exports}var boe=moe();const Ot=un(boe),yoe=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function Fs(e,t,n){const r=voe(e),{webkitRelativePath:a}=e,o=typeof t=="string"?t:typeof a=="string"&&a.length>0?a:`./${e.name}`;return typeof r.path!="string"&&zO(r,"path",o),zO(r,"relativePath",o),r}function voe(e){const{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){const r=t.split(".").pop().toLowerCase(),a=yoe.get(r);a&&Object.defineProperty(e,"type",{value:a,writable:!1,configurable:!1,enumerable:!0})}return e}function zO(e,t,n){Object.defineProperty(e,t,{value:n,writable:!1,configurable:!1,enumerable:!0})}const Soe=[".DS_Store","Thumbs.db"];function Eoe(e){return xi(this,void 0,void 0,function*(){return Cf(e)&&woe(e.dataTransfer)?Aoe(e.dataTransfer,e.type):xoe(e)?koe(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?Toe(e):[]})}function woe(e){return Cf(e)}function xoe(e){return Cf(e)&&Cf(e.target)}function Cf(e){return typeof e=="object"&&e!==null}function koe(e){return r0(e.target.files).map(t=>Fs(t))}function Toe(e){return xi(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>n.getFile()))).map(n=>Fs(n))})}function Aoe(e,t){return xi(this,void 0,void 0,function*(){if(e.items){const n=r0(e.items).filter(a=>a.kind==="file");if(t!=="drop")return n;const r=yield Promise.all(n.map(Roe));return BO(j5(r))}return BO(r0(e.files).map(n=>Fs(n)))})}function BO(e){return e.filter(t=>Soe.indexOf(t.name)===-1)}function r0(e){if(e===null)return[];const t=[];for(let n=0;n[...t,...Array.isArray(n)?j5(n):[n]],[])}function UO(e,t){return xi(this,void 0,void 0,function*(){var n;if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle=="function"){const o=yield e.getAsFileSystemHandle();if(o===null)throw new Error(`${e} is not a File`);if(o!==void 0){const s=yield o.getFile();return s.handle=o,Fs(s)}}const r=e.getAsFile();if(!r)throw new Error(`${e} is not a File`);return Fs(r,(n=t==null?void 0:t.fullPath)!==null&&n!==void 0?n:void 0)})}function _oe(e){return xi(this,void 0,void 0,function*(){return e.isDirectory?G5(e):Coe(e)})}function G5(e){const t=e.createReader();return new Promise((n,r)=>{const a=[];function o(){t.readEntries(s=>xi(this,void 0,void 0,function*(){if(s.length){const u=Promise.all(s.map(_oe));a.push(u),o()}else try{const u=yield Promise.all(a);n(u)}catch(u){r(u)}}),s=>{r(s)})}o()})}function Coe(e){return xi(this,void 0,void 0,function*(){return new Promise((t,n)=>{e.file(r=>{const a=Fs(r,e.fullPath);t(a)},r=>{n(r)})})})}var Md={},jO;function Noe(){return jO||(jO=1,Md.__esModule=!0,Md.default=function(e,t){if(e&&t){var n=Array.isArray(t)?t:t.split(",");if(n.length===0)return!0;var r=e.name||"",a=(e.type||"").toLowerCase(),o=a.replace(/\/.*$/,"");return n.some(function(s){var u=s.trim().toLowerCase();return u.charAt(0)==="."?r.toLowerCase().endsWith(u):u.endsWith("/*")?o===u.replace(/\/.*$/,""):a===u})}return!0}),Md}var Ooe=Noe();const sb=un(Ooe);function GO(e){return Loe(e)||Ioe(e)||$5(e)||Doe()}function Doe(){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 e0(e){return gae(e)||hae(e)||mae(e)||bae()}function yae(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function vae(e,t){if(e==null)return{};var n,r,a=yae(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;rve.createElement("div",{className:"node"},ve.createElement("span",{className:"render "+(n?"circle":"disc"),style:{backgroundColor:t||"#000"}}),ve.createElement("span",{className:`label ${n?"text-muted":""} ${e?"":"text-italic"}`},e||r.no_label||"No label")),Eae=({id:e,labels:t})=>{const n=Tr(),r=E.useMemo(()=>{const a=n.getGraph().getNodeAttributes(e),o=n.getSetting("nodeReducer");return Object.assign(Object.assign({color:n.getSetting("defaultNodeColor")},a),o?o(e,a):{})},[n,e]);return ve.createElement(t0,Object.assign({},r,{labels:t}))},wae=({label:e,color:t,source:n,target:r,hidden:a,directed:o,labels:s={}})=>ve.createElement("div",{className:"edge"},ve.createElement(t0,Object.assign({},n,{labels:s})),ve.createElement("div",{className:"body"},ve.createElement("div",{className:"render"},ve.createElement("span",{className:a?"dotted":"dash",style:{borderColor:t||"#000"}})," ",o&&ve.createElement("span",{className:"arrow",style:{borderTopColor:t||"#000"}})),ve.createElement("span",{className:`label ${a?"text-muted":""} ${e?"":"fst-italic"}`},e||s.no_label||"No label")),ve.createElement(t0,Object.assign({},r,{labels:s}))),xae=({id:e,labels:t})=>{const n=Tr(),r=E.useMemo(()=>{const a=n.getGraph().getEdgeAttributes(e),o=n.getSetting("nodeReducer"),s=n.getSetting("edgeReducer"),u=n.getGraph().getNodeAttributes(n.getGraph().source(e)),c=n.getGraph().getNodeAttributes(n.getGraph().target(e));return Object.assign(Object.assign(Object.assign({color:n.getSetting("defaultEdgeColor"),directed:n.getGraph().isDirected(e)},a),s?s(e,a):{}),{source:Object.assign(Object.assign({color:n.getSetting("defaultNodeColor")},u),o?o(e,u):{}),target:Object.assign(Object.assign({color:n.getSetting("defaultNodeColor")},c),o?o(e,c):{})})},[n,e]);return ve.createElement(wae,Object.assign({},r,{labels:t}))};function PT(e,t){const[n,r]=E.useState(e);return E.useEffect(()=>{const a=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(a)}},[e,t]),n}function kae({fetcher:e,preload:t,filterFn:n,renderOption:r,getOptionValue:a,notFound:o,loadingSkeleton:s,label:u,placeholder:c="Select...",value:d,onChange:p,onFocus:g,disabled:m=!1,className:b,noResultsMessage:y}){const[S,k]=E.useState(!1),[R,x]=E.useState(!1),[A,C]=E.useState([]),[N,_]=E.useState(!1),[O,F]=E.useState(null),[D,L]=E.useState(d),[G,$]=E.useState(null),[U,W]=E.useState(""),Z=PT(U,t?0:150),[j,H]=E.useState([]);E.useEffect(()=>{k(!0),L(d)},[d]),E.useEffect(()=>{S||(async()=>{try{_(!0),F(null);const V=d!==null?await e(d):[];H(V),C(V)}catch(V){F(V instanceof Error?V.message:"Failed to fetch options")}finally{_(!1)}})()},[S,e,d]),E.useEffect(()=>{const I=async()=>{try{_(!0),F(null);const V=await e(Z);H(V),C(V)}catch(V){F(V instanceof Error?V.message:"Failed to fetch options")}finally{_(!1)}};S&&t?t&&C(Z?j.filter(V=>n?n(V,Z):!0):j):I()},[e,Z,S,t,n]);const z=E.useCallback(I=>{I!==D&&(L(I),p(I)),x(!1)},[D,L,x,p]),Y=E.useCallback(I=>{I!==G&&($(I),g(I))},[G,$,g]);return w.jsx("div",{className:Me(m&&"cursor-not-allowed opacity-50",b),onFocus:()=>{x(!0)},onBlur:()=>x(!1),children:w.jsxs(xp,{shouldFilter:!1,className:"bg-transparent",children:[w.jsxs("div",{children:[w.jsx(DT,{placeholder:c,value:U,className:"max-h-8",onValueChange:I=>{W(I),I&&!R&&x(!0)}}),N&&A.length>0&&w.jsx("div",{className:"absolute top-1/2 right-2 flex -translate-y-1/2 transform items-center",children:w.jsx(nU,{className:"h-4 w-4 animate-spin"})})]}),w.jsxs(kp,{hidden:!R,children:[O&&w.jsx("div",{className:"text-destructive p-4 text-center",children:O}),N&&A.length===0&&(s||w.jsx(Tae,{})),!N&&!O&&A.length===0&&(o||w.jsx(IT,{children:y??`No ${u.toLowerCase()} found.`})),w.jsx(el,{children:A.map((I,V)=>w.jsxs(ve.Fragment,{children:[w.jsx(tl,{value:a(I),onSelect:z,onMouseEnter:()=>Y(a(I)),className:"truncate",children:r(I)},a(I)+`${V}`),V!==A.length-1&&w.jsx("div",{className:"bg-foreground/10 h-[1px]"},`divider-${V}`)]},a(I)+`-fragment-${V}`))})]})]})})}function Tae(){return w.jsx(el,{children:w.jsx(tl,{disabled:!0,children:w.jsxs("div",{className:"flex w-full items-center gap-2",children:[w.jsx("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),w.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[w.jsx("div",{className:"bg-muted h-4 w-24 animate-pulse rounded"}),w.jsx("div",{className:"bg-muted h-3 w-16 animate-pulse rounded"})]})]})})})}const nb="__message_item",Aae=({id:e})=>{const t=Pe.use.sigmaGraph();return t!=null&&t.hasNode(e)?w.jsx(Eae,{id:e}):null};function Rae(e){return w.jsxs("div",{children:[e.type==="nodes"&&w.jsx(Aae,{id:e.id}),e.type==="edges"&&w.jsx(xae,{id:e.id}),e.type==="message"&&w.jsx("div",{children:e.message})]})}const _ae=({onChange:e,onFocus:t,value:n})=>{const{t:r}=Pt(),a=Pe.use.sigmaGraph(),o=Pe.use.searchEngine();E.useEffect(()=>{a&&Pe.getState().resetSearchEngine()},[a]),E.useEffect(()=>{if(!a||a.nodes().length===0||o)return;const u=new _o({idField:"id",fields:["label"],searchOptions:{prefix:!0,fuzzy:.2,boost:{label:2}}}),c=a.nodes().map(d=>({id:d,label:a.getNodeAttribute(d,"label")}));u.addAll(c),Pe.getState().setSearchEngine(u)},[a,o]);const s=E.useCallback(async u=>{if(t&&t(null),!a||!o)return[];if(a.nodes().length===0)return[];if(!u)return a.nodes().filter(p=>a.hasNode(p)).slice(0,hd).map(p=>({id:p,type:"nodes"}));const c=o.search(u).filter(d=>a.hasNode(d.id)).map(d=>({id:d.id,type:"nodes"}));return c.length<=hd?c:[...c.slice(0,hd),{type:"message",id:nb,message:r("graphPanel.search.message",{count:c.length-hd})}]},[a,o,t,r]);return w.jsx(kae,{className:"bg-background/60 w-24 rounded-xl border-1 opacity-60 backdrop-blur-lg transition-all hover:w-fit hover:opacity-100",fetcher:s,renderOption:Rae,getOptionValue:u=>u.id,value:n&&n.type!=="message"?n.id:null,onChange:u=>{u!==nb&&e(u?{id:u,type:"nodes"}:null)},onFocus:u=>{u!==nb&&t&&t(u?{id:u,type:"nodes"}:null)},label:"item",placeholder:r("graphPanel.search.placeholder")})},Cae=({...e})=>w.jsx(_ae,{...e});function Nae({fetcher:e,preload:t,filterFn:n,renderOption:r,getOptionValue:a,getDisplayValue:o,notFound:s,loadingSkeleton:u,label:c,placeholder:d="Select...",value:p,onChange:g,disabled:m=!1,className:b,triggerClassName:y,searchInputClassName:S,noResultsMessage:k,triggerTooltip:R,clearable:x=!0}){const[A,C]=E.useState(!1),[N,_]=E.useState(!1),[O,F]=E.useState([]),[D,L]=E.useState(!1),[G,$]=E.useState(null),[U,W]=E.useState(p),[Z,j]=E.useState(null),[H,z]=E.useState(""),Y=PT(H,t?0:150),[I,V]=E.useState([]);E.useEffect(()=>{C(!0),W(p)},[p]),E.useEffect(()=>{if(p&&O.length>0){const M=O.find(K=>a(K)===p);M&&j(M)}},[p,O,a]),E.useEffect(()=>{A||(async()=>{try{L(!0),$(null);const K=await e(p);V(K),F(K)}catch(K){$(K instanceof Error?K.message:"Failed to fetch options")}finally{L(!1)}})()},[A,e,p]),E.useEffect(()=>{const M=async()=>{try{L(!0),$(null);const K=await e(Y);V(K),F(K)}catch(K){$(K instanceof Error?K.message:"Failed to fetch options")}finally{L(!1)}};A&&t?t&&F(Y?I.filter(K=>n?n(K,Y):!0):I):M()},[e,Y,A,t,n]);const B=E.useCallback(M=>{const K=x&&M===U?"":M;W(K),j(O.find(J=>a(J)===K)||null),g(K),_(!1)},[U,g,x,O,a]);return w.jsxs(Wu,{open:N,onOpenChange:_,children:[w.jsx(Yu,{asChild:!0,children:w.jsxs(Tt,{variant:"outline",role:"combobox","aria-expanded":N,className:Me("justify-between",m&&"cursor-not-allowed opacity-50",y),disabled:m,tooltip:R,side:"bottom",children:[Z?o(Z):d,w.jsx(wW,{className:"opacity-50",size:10})]})}),w.jsx(Ys,{className:Me("p-0",b),onCloseAutoFocus:M=>M.preventDefault(),children:w.jsxs(xp,{shouldFilter:!1,children:[w.jsxs("div",{className:"relative w-full border-b",children:[w.jsx(DT,{placeholder:`Search ${c.toLowerCase()}...`,value:H,onValueChange:M=>{z(M)},className:S}),D&&O.length>0&&w.jsx("div",{className:"absolute top-1/2 right-2 flex -translate-y-1/2 transform items-center",children:w.jsx(nU,{className:"h-4 w-4 animate-spin"})})]}),w.jsxs(kp,{children:[G&&w.jsx("div",{className:"text-destructive p-4 text-center",children:G}),D&&O.length===0&&(u||w.jsx(Oae,{})),!D&&!G&&O.length===0&&(s||w.jsx(IT,{children:k??`No ${c.toLowerCase()} found.`})),w.jsx(el,{children:O.map(M=>w.jsxs(tl,{value:a(M),onSelect:B,className:"truncate",children:[r(M),w.jsx(L0,{className:Me("ml-auto h-3 w-3",U===a(M)?"opacity-100":"opacity-0")})]},a(M)))})]})]})})]})}function Oae(){return w.jsx(el,{children:w.jsx(tl,{disabled:!0,children:w.jsxs("div",{className:"flex w-full items-center gap-2",children:[w.jsx("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),w.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[w.jsx("div",{className:"bg-muted h-4 w-24 animate-pulse rounded"}),w.jsx("div",{className:"bg-muted h-3 w-16 animate-pulse rounded"})]})]})})})}const Dae=()=>{const{t:e}=Pt(),t=Ge.use.queryLabel(),n=Pe.use.allDatabaseLabels(),r=Pe.use.rawGraph(),a=E.useRef(!1),o=E.useRef(!1);E.useEffect(()=>{!Pe.getState().labelsFetchAttempted&&!o.current&&(o.current=!0,Pe.getState().setLabelsFetchAttempted(!0),console.log("Fetching graph labels (once per session)..."),Pe.getState().fetchAllDatabaseLabels().then(()=>{a.current=!0,o.current=!1}).catch(p=>{console.error("Failed to fetch labels:",p),o.current=!1,Pe.getState().setLabelsFetchAttempted(!1)}))},[]);const s=E.useCallback(()=>{const d=new _o({idField:"id",fields:["value"],searchOptions:{prefix:!0,fuzzy:.2,boost:{label:2}}}),p=n.map((g,m)=>({id:m,value:g}));return d.addAll(p),{labels:n,searchEngine:d}},[n]),u=E.useCallback(async d=>{const{labels:p,searchEngine:g}=s();let m=p;return d&&(m=g.search(d).map(b=>p[b.id])),m.length<=NC?m:[...m.slice(0,NC),"..."]},[s]),c=E.useCallback(()=>{const d=Ge.getState().queryLabel;Pe.getState().setGraphDataFetchAttempted(!1),Pe.getState().reset(),Ge.getState().setQueryLabel(d)},[]);return w.jsxs("div",{className:"flex items-center",children:[r&&w.jsx(Tt,{size:"icon",variant:Ua,onClick:c,tooltip:e("graphPanel.graphLabels.refreshTooltip"),className:"mr-1",children:w.jsx(rU,{className:"h-4 w-4"})}),w.jsx(Nae,{className:"ml-2",triggerClassName:"max-h-8",searchInputClassName:"max-h-8",triggerTooltip:e("graphPanel.graphLabels.selectTooltip"),fetcher:u,renderOption:d=>w.jsx("div",{children:d}),getOptionValue:d=>d,getDisplayValue:d=>w.jsx("div",{children:d}),notFound:w.jsx("div",{className:"py-6 text-center text-sm",children:"No labels found"}),label:e("graphPanel.graphLabels.label"),placeholder:e("graphPanel.graphLabels.placeholder"),value:t!==null?t:"*",onChange:d=>{const p=Ge.getState().queryLabel;d==="..."&&(d="*"),Pe.getState().setGraphDataFetchAttempted(!1),d!==p&&Pe.getState().reset(),d===p&&d!=="*"?Ge.getState().setQueryLabel("*"):Ge.getState().setQueryLabel(d)},clearable:!1})]})},Bn=({text:e,className:t,tooltipClassName:n,tooltip:r,side:a,onClick:o})=>r?w.jsx(C3,{delayDuration:200,children:w.jsxs(N3,{children:[w.jsx(O3,{asChild:!0,children:w.jsx("label",{className:Me(t,o!==void 0?"cursor-pointer":void 0),onClick:o,children:e})}),w.jsx(uT,{side:a,className:n,children:r})]})}):w.jsx("label",{className:Me(t,o!==void 0?"cursor-pointer":void 0),onClick:o,children:e});var ef={exports:{}},Iae=ef.exports,AO;function Lae(){return AO||(AO=1,function(e){(function(t,n,r){function a(c){var d=this,p=u();d.next=function(){var g=2091639*d.s0+d.c*23283064365386963e-26;return d.s0=d.s1,d.s1=d.s2,d.s2=g-(d.c=g|0)},d.c=1,d.s0=p(" "),d.s1=p(" "),d.s2=p(" "),d.s0-=p(c),d.s0<0&&(d.s0+=1),d.s1-=p(c),d.s1<0&&(d.s1+=1),d.s2-=p(c),d.s2<0&&(d.s2+=1),p=null}function o(c,d){return d.c=c.c,d.s0=c.s0,d.s1=c.s1,d.s2=c.s2,d}function s(c,d){var p=new a(c),g=d&&d.state,m=p.next;return m.int32=function(){return p.next()*4294967296|0},m.double=function(){return m()+(m()*2097152|0)*11102230246251565e-32},m.quick=m,g&&(typeof g=="object"&&o(g,p),m.state=function(){return o(p,{})}),m}function u(){var c=4022871197,d=function(p){p=String(p);for(var g=0;g>>0,m-=c,m*=c,c=m>>>0,m-=c,c+=m*4294967296}return(c>>>0)*23283064365386963e-26};return d}n&&n.exports?n.exports=s:this.alea=s})(Iae,e)}(ef)),ef.exports}var tf={exports:{}},Mae=tf.exports,RO;function Fae(){return RO||(RO=1,function(e){(function(t,n,r){function a(u){var c=this,d="";c.x=0,c.y=0,c.z=0,c.w=0,c.next=function(){var g=c.x^c.x<<11;return c.x=c.y,c.y=c.z,c.z=c.w,c.w^=c.w>>>19^g^g>>>8},u===(u|0)?c.x=u:d+=u;for(var p=0;p>>0)/4294967296};return g.double=function(){do var m=d.next()>>>11,b=(d.next()>>>0)/4294967296,y=(m+b)/(1<<21);while(y===0);return y},g.int32=d.next,g.quick=g,p&&(typeof p=="object"&&o(p,d),g.state=function(){return o(d,{})}),g}n&&n.exports?n.exports=s:this.xor128=s})(Mae,e)}(tf)),tf.exports}var nf={exports:{}},Pae=nf.exports,_O;function zae(){return _O||(_O=1,function(e){(function(t,n,r){function a(u){var c=this,d="";c.next=function(){var g=c.x^c.x>>>2;return c.x=c.y,c.y=c.z,c.z=c.w,c.w=c.v,(c.d=c.d+362437|0)+(c.v=c.v^c.v<<4^(g^g<<1))|0},c.x=0,c.y=0,c.z=0,c.w=0,c.v=0,u===(u|0)?c.x=u:d+=u;for(var p=0;p>>4),c.next()}function o(u,c){return c.x=u.x,c.y=u.y,c.z=u.z,c.w=u.w,c.v=u.v,c.d=u.d,c}function s(u,c){var d=new a(u),p=c&&c.state,g=function(){return(d.next()>>>0)/4294967296};return g.double=function(){do var m=d.next()>>>11,b=(d.next()>>>0)/4294967296,y=(m+b)/(1<<21);while(y===0);return y},g.int32=d.next,g.quick=g,p&&(typeof p=="object"&&o(p,d),g.state=function(){return o(d,{})}),g}n&&n.exports?n.exports=s:this.xorwow=s})(Pae,e)}(nf)),nf.exports}var rf={exports:{}},Bae=rf.exports,CO;function Uae(){return CO||(CO=1,function(e){(function(t,n,r){function a(u){var c=this;c.next=function(){var p=c.x,g=c.i,m,b;return m=p[g],m^=m>>>7,b=m^m<<24,m=p[g+1&7],b^=m^m>>>10,m=p[g+3&7],b^=m^m>>>3,m=p[g+4&7],b^=m^m<<7,m=p[g+7&7],m=m^m<<13,b^=m^m<<9,p[g]=b,c.i=g+1&7,b};function d(p,g){var m,b=[];if(g===(g|0))b[0]=g;else for(g=""+g,m=0;m0;--m)p.next()}d(c,u)}function o(u,c){return c.x=u.x.slice(),c.i=u.i,c}function s(u,c){u==null&&(u=+new Date);var d=new a(u),p=c&&c.state,g=function(){return(d.next()>>>0)/4294967296};return g.double=function(){do var m=d.next()>>>11,b=(d.next()>>>0)/4294967296,y=(m+b)/(1<<21);while(y===0);return y},g.int32=d.next,g.quick=g,p&&(p.x&&o(p,d),g.state=function(){return o(d,{})}),g}n&&n.exports?n.exports=s:this.xorshift7=s})(Bae,e)}(rf)),rf.exports}var af={exports:{}},jae=af.exports,NO;function Gae(){return NO||(NO=1,function(e){(function(t,n,r){function a(u){var c=this;c.next=function(){var p=c.w,g=c.X,m=c.i,b,y;return c.w=p=p+1640531527|0,y=g[m+34&127],b=g[m=m+1&127],y^=y<<13,b^=b<<17,y^=y>>>15,b^=b>>>12,y=g[m]=y^b,c.i=m,y+(p^p>>>16)|0};function d(p,g){var m,b,y,S,k,R=[],x=128;for(g===(g|0)?(b=g,g=null):(g=g+"\0",b=0,x=Math.max(x,g.length)),y=0,S=-32;S>>15,b^=b<<4,b^=b>>>13,S>=0&&(k=k+1640531527|0,m=R[S&127]^=b+k,y=m==0?y+1:0);for(y>=128&&(R[(g&&g.length||0)&127]=-1),y=127,S=4*128;S>0;--S)b=R[y+34&127],m=R[y=y+1&127],b^=b<<13,m^=m<<17,b^=b>>>15,m^=m>>>12,R[y]=b^m;p.w=k,p.X=R,p.i=y}d(c,u)}function o(u,c){return c.i=u.i,c.w=u.w,c.X=u.X.slice(),c}function s(u,c){u==null&&(u=+new Date);var d=new a(u),p=c&&c.state,g=function(){return(d.next()>>>0)/4294967296};return g.double=function(){do var m=d.next()>>>11,b=(d.next()>>>0)/4294967296,y=(m+b)/(1<<21);while(y===0);return y},g.int32=d.next,g.quick=g,p&&(p.X&&o(p,d),g.state=function(){return o(d,{})}),g}n&&n.exports?n.exports=s:this.xor4096=s})(jae,e)}(af)),af.exports}var of={exports:{}},Hae=of.exports,OO;function $ae(){return OO||(OO=1,function(e){(function(t,n,r){function a(u){var c=this,d="";c.next=function(){var g=c.b,m=c.c,b=c.d,y=c.a;return g=g<<25^g>>>7^m,m=m-b|0,b=b<<24^b>>>8^y,y=y-g|0,c.b=g=g<<20^g>>>12^m,c.c=m=m-b|0,c.d=b<<16^m>>>16^y,c.a=y-g|0},c.a=0,c.b=0,c.c=-1640531527,c.d=1367130551,u===Math.floor(u)?(c.a=u/4294967296|0,c.b=u|0):d+=u;for(var p=0;p>>0)/4294967296};return g.double=function(){do var m=d.next()>>>11,b=(d.next()>>>0)/4294967296,y=(m+b)/(1<<21);while(y===0);return y},g.int32=d.next,g.quick=g,p&&(typeof p=="object"&&o(p,d),g.state=function(){return o(d,{})}),g}n&&n.exports?n.exports=s:this.tychei=s})(Hae,e)}(of)),of.exports}var sf={exports:{}};const qae={},Vae=Object.freeze(Object.defineProperty({__proto__:null,default:qae},Symbol.toStringTag,{value:"Module"})),Wae=f9(Vae);var Yae=sf.exports,DO;function Kae(){return DO||(DO=1,function(e){(function(t,n,r){var a=256,o=6,s=52,u="random",c=r.pow(a,o),d=r.pow(2,s),p=d*2,g=a-1,m;function b(C,N,_){var O=[];N=N==!0?{entropy:!0}:N||{};var F=R(k(N.entropy?[C,A(n)]:C??x(),3),O),D=new y(O),L=function(){for(var G=D.g(o),$=c,U=0;G=p;)G/=2,$/=2,U>>>=1;return(G+U)/$};return L.int32=function(){return D.g(4)|0},L.quick=function(){return D.g(4)/4294967296},L.double=L,R(A(D.S),n),(N.pass||_||function(G,$,U,W){return W&&(W.S&&S(W,D),G.state=function(){return S(D,{})}),U?(r[u]=G,$):G})(L,F,"global"in N?N.global:this==r,N.state)}function y(C){var N,_=C.length,O=this,F=0,D=O.i=O.j=0,L=O.S=[];for(_||(C=[_++]);F{if(!e||!Array.isArray(e.nodes)||!Array.isArray(e.edges))return!1;for(const t of e.nodes)if(!t.id||!t.labels||!t.properties)return!1;for(const t of e.edges)if(!t.id||!t.source||!t.target)return!1;for(const t of e.edges){const n=e.getNode(t.source),r=e.getNode(t.target);if(n==null||r==null)return!1}return!0},Jae=async(e,t,n)=>{let r=null;try{r=await qB(e,t,n)}catch(o){return Hn.getState().setErrorMessage(Sr(o),"Query Graphs Error!"),null}let a=null;if(r){const o={},s={};for(let p=0;p0){const p=jB-hu;for(const g of r.nodes)g.size=Math.round(hu+p*Math.pow((g.degree-u)/d,.5))}a=new wne,a.nodes=r.nodes,a.edges=r.edges,a.nodeIdMap=o,a.edgeIdMap=s,Qae(a)||(a=null,console.error("Invalid graph data")),console.log("Graph data loaded")}return a},eoe=e=>{const t=new Sp;for(const n of(e==null?void 0:e.nodes)??[]){_f(n.id+Date.now().toString(),{global:!0});const r=Math.random(),a=Math.random();t.addNode(n.id,{label:n.labels.join(", "),color:n.color,x:r,y:a,size:n.size,borderColor:UB,borderSize:.2})}for(const n of(e==null?void 0:e.edges)??[])n.dynamicId=t.addDirectedEdge(n.source,n.target,{label:n.type||void 0});return t},toe=()=>{const{t:e}=Pt(),t=Ge.use.queryLabel(),n=Pe.use.rawGraph(),r=Pe.use.sigmaGraph(),a=Ge.use.graphQueryMaxDepth(),o=Ge.use.graphMinDegree(),s=Pe.use.isFetching(),u=Pe.use.nodeToExpand(),c=Pe.use.nodeToPrune(),{isTabVisible:d}=yp(),p=d("knowledge-graph"),g=E.useRef({queryLabel:t,maxQueryDepth:a,minDegree:o}),m=E.useRef(!1),b=E.useRef(!1),y=g.current.queryLabel!==t||g.current.maxQueryDepth!==a||g.current.minDegree!==o,S=E.useCallback(C=>(n==null?void 0:n.getNode(C))||null,[n]),k=E.useCallback((C,N=!0)=>(n==null?void 0:n.getEdge(C,N))||null,[n]),R=E.useRef(!1);E.useEffect(()=>{if(!R.current){if(!t){if(n!==null||r!==null){const C=Pe.getState();C.reset(),C.setGraphDataFetchAttempted(!1),C.setLabelsFetchAttempted(!1)}m.current=!1,b.current=!1;return}if(!s&&!R.current&&(y||!Pe.getState().graphDataFetchAttempted)){if(!p){console.log("Graph tab not visible, skipping data fetch");return}R.current=!0,Pe.getState().setGraphDataFetchAttempted(!0);const C=Pe.getState();C.setIsFetching(!0),C.setShouldRender(!1),C.clearSelection(),C.sigmaGraph&&C.sigmaGraph.forEachNode(F=>{var D;(D=C.sigmaGraph)==null||D.setNodeAttribute(F,"highlighted",!1)}),g.current={queryLabel:t,maxQueryDepth:a,minDegree:o},console.log("Fetching graph data..."),Jae(t,a,o).then(F=>{const D=Pe.getState();D.reset();const L=eoe(F);F==null||F.buildDynamicMap(),D.setSigmaGraph(L),D.setRawGraph(F),m.current=!0,b.current=!0,R.current=!1,D.setMoveToSelectedNode(!0),D.setShouldRender(p),D.setIsFetching(!1)}).catch(F=>{console.error("Error fetching graph data:",F);const D=Pe.getState();D.setIsFetching(!1),D.setShouldRender(p),m.current=!1,R.current=!1,D.setGraphDataFetchAttempted(!1)})}}},[t,a,o,s,y,p,n,r]),E.useEffect(()=>{p?n&&Pe.getState().setShouldRender(!0):Pe.getState().setShouldRender(!1)},[p,n]),E.useEffect(()=>{u&&((async N=>{var _,O,F;if(!(!N||!r||!n))try{const D=n.getNode(N);if(!D){console.error("Node not found:",N);return}const L=D.labels[0];if(!L){console.error("Node has no label:",N);return}const G=await qB(L,2,0);if(!G||!G.nodes||!G.edges){console.error("Failed to fetch extended graph");return}const $=[];for(const Q of G.nodes){_f(Q.id,{global:!0});const pe=pB();$.push({id:Q.id,labels:Q.labels,properties:Q.properties,size:10,x:Math.random(),y:Math.random(),color:pe,degree:0})}const U=[];for(const Q of G.edges)U.push({id:Q.id,source:Q.source,target:Q.target,type:Q.type,properties:Q.properties,dynamicId:""});const W={};r.forEachNode(Q=>{W[Q]={x:r.getNodeAttribute(Q,"x"),y:r.getNodeAttribute(Q,"y")}});const Z=new Set(r.nodes()),j=new Set,H=new Set,z=1;let Y=0;r.forEachNode(Q=>{const pe=r.degree(Q);Y=Math.max(Y,pe)});const I=Y-z||1,V=jB-hu;for(const Q of $){if(Z.has(Q.id))continue;U.some(re=>re.source===N&&re.target===Q.id||re.target===N&&re.source===Q.id)&&j.add(Q.id)}const B=new Map,M=new Set;for(const Q of U){const pe=Z.has(Q.source)||j.has(Q.source),re=Z.has(Q.target)||j.has(Q.target);pe&&re?(H.add(Q.id),j.has(Q.source)&&B.set(Q.source,(B.get(Q.source)||0)+1),j.has(Q.target)&&B.set(Q.target,(B.get(Q.target)||0)+1)):(r.hasNode(Q.source)?M.add(Q.source):j.has(Q.source)&&(M.add(Q.source),B.set(Q.source,(B.get(Q.source)||0)+1)),r.hasNode(Q.target)?M.add(Q.target):j.has(Q.target)&&(M.add(Q.target),B.set(Q.target,(B.get(Q.target)||0)+1)))}const K=(Q,pe,re,Ee,we)=>{for(const De of pe)if(Q.hasNode(De)){let _e=Q.degree(De);_e+=1;const Se=Math.round(hu+we*Math.pow((_e-re)/Ee,.5)),ee=Q.getNodeAttribute(De,"size");Se>ee&&Q.setNodeAttribute(De,"size",Se)}};if(j.size===0){K(r,M,z,I,V),Ft.info(e("graphPanel.propertiesView.node.noNewNodes"));return}for(const[,Q]of B.entries())Y=Math.max(Y,Q);const J=((_=Pe.getState().sigmaInstance)==null?void 0:_.getCamera().ratio)||1,le=Math.max(Math.sqrt(D.size)*4,Math.sqrt(j.size)*3)/J;_f(Date.now().toString(),{global:!0});const oe=Math.random()*2*Math.PI;console.log("nodeSize:",D.size,"nodesToAdd:",j.size),console.log("cameraRatio:",Math.round(J*100)/100,"spreadFactor:",Math.round(le*100)/100);for(const Q of j){const pe=$.find(Se=>Se.id===Q),re=B.get(Q)||0,Ee=Math.round(hu+V*Math.pow((re-z)/I,.5)),we=2*Math.PI*(Array.from(j).indexOf(Q)/j.size),De=((O=W[Q])==null?void 0:O.x)||W[D.id].x+Math.cos(oe+we)*le,_e=((F=W[Q])==null?void 0:F.y)||W[D.id].y+Math.sin(oe+we)*le;r.addNode(Q,{label:pe.labels.join(", "),color:pe.color,x:De,y:_e,size:Ee,borderColor:UB,borderSize:.2}),n.getNode(Q)||(pe.size=Ee,pe.x=De,pe.y=_e,pe.degree=re,n.nodes.push(pe),n.nodeIdMap[Q]=n.nodes.length-1)}for(const Q of H){const pe=U.find(re=>re.id===Q);r.hasEdge(pe.source,pe.target)||r.hasEdge(pe.target,pe.source)||(pe.dynamicId=r.addDirectedEdge(pe.source,pe.target,{label:pe.type||void 0}),n.getEdge(pe.id,!1)?console.error("Edge already exists in rawGraph:",pe.id):(n.edges.push(pe),n.edgeIdMap[pe.id]=n.edges.length-1,n.edgeDynamicIdMap[pe.dynamicId]=n.edges.length-1))}n.buildDynamicMap(),Pe.getState().resetSearchEngine(),K(r,M,z,I,V)}catch(D){console.error("Error expanding node:",D)}})(u),window.setTimeout(()=>{Pe.getState().triggerNodeExpand(null)},0))},[u,r,n,e]);const x=E.useCallback((C,N)=>{const _=new Set([C]);return N.forEachNode(O=>{if(O===C)return;const F=N.neighbors(O);F.length===1&&F[0]===C&&_.add(O)}),_},[]);return E.useEffect(()=>{c&&((N=>{if(!(!N||!r||!n))try{const _=Pe.getState();if(!r.hasNode(N)){console.error("Node not found:",N);return}const O=x(N,r);if(O.size===r.nodes().length){Ft.error(e("graphPanel.propertiesView.node.deleteAllNodesError"));return}_.clearSelection();for(const F of O){r.dropNode(F);const D=n.nodeIdMap[F];if(D!==void 0){const L=n.edges.filter(G=>G.source===F||G.target===F);for(const G of L){const $=n.edgeIdMap[G.id];if($!==void 0){n.edges.splice($,1);for(const[U,W]of Object.entries(n.edgeIdMap))W>$&&(n.edgeIdMap[U]=W-1);delete n.edgeIdMap[G.id],delete n.edgeDynamicIdMap[G.dynamicId]}}n.nodes.splice(D,1);for(const[G,$]of Object.entries(n.nodeIdMap))$>D&&(n.nodeIdMap[G]=$-1);delete n.nodeIdMap[F]}}n.buildDynamicMap(),Pe.getState().resetSearchEngine(),O.size>1&&Ft.info(e("graphPanel.propertiesView.node.nodesRemoved",{count:O.size}))}catch(_){console.error("Error pruning node:",_)}})(c),window.setTimeout(()=>{Pe.getState().triggerNodePrune(null)},0))},[c,r,n,x,e]),{lightrageGraph:E.useCallback(()=>{if(r)return r;console.log("Creating new Sigma graph instance");const C=new Sp;return Pe.getState().setSigmaGraph(C),C},[r]),getNode:S,getEdge:k}},noe=()=>{const{getNode:e,getEdge:t}=toe(),n=Pe.use.selectedNode(),r=Pe.use.focusedNode(),a=Pe.use.selectedEdge(),o=Pe.use.focusedEdge(),[s,u]=E.useState(null),[c,d]=E.useState(null);return E.useEffect(()=>{let p=null,g=null;r?(p="node",g=e(r)):n?(p="node",g=e(n)):o?(p="edge",g=t(o,!0)):a&&(p="edge",g=t(a,!0)),g?(p=="node"?u(roe(g)):u(aoe(g)),d(p)):(u(null),d(null))},[r,n,o,a,u,d,e,t]),s?w.jsx("div",{className:"bg-background/80 max-w-xs rounded-lg border-2 p-2 text-xs backdrop-blur-lg",children:c=="node"?w.jsx(ooe,{node:s}):w.jsx(ioe,{edge:s})}):w.jsx(w.Fragment,{})},roe=e=>{const t=Pe.getState(),n=[];if(t.sigmaGraph&&t.rawGraph)try{if(!t.sigmaGraph.hasNode(e.id))return{...e,relationships:[]};const r=t.sigmaGraph.edges(e.id);for(const a of r){if(!t.sigmaGraph.hasEdge(a))continue;const o=t.rawGraph.getEdge(a,!0);if(o){const u=e.id===o.source?o.target:o.source;if(!t.sigmaGraph.hasNode(u))continue;const c=t.rawGraph.getNode(u);c&&n.push({type:"Neighbour",id:u,label:c.properties.entity_id?c.properties.entity_id:c.labels.join(", ")})}}}catch(r){console.error("Error refining node properties:",r)}return{...e,relationships:n}},aoe=e=>{const t=Pe.getState();let n,r;if(t.sigmaGraph&&t.rawGraph)try{if(!t.sigmaGraph.hasEdge(e.id))return{...e,sourceNode:void 0,targetNode:void 0};t.sigmaGraph.hasNode(e.source)&&(n=t.rawGraph.getNode(e.source)),t.sigmaGraph.hasNode(e.target)&&(r=t.rawGraph.getNode(e.target))}catch(a){console.error("Error refining edge properties:",a)}return{...e,sourceNode:n,targetNode:r}},ea=({name:e,value:t,onClick:n,tooltip:r})=>{const{t:a}=Pt(),o=s=>{const u=`graphPanel.propertiesView.node.propertyNames.${s}`,c=a(u);return c===u?s:c};return w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx("label",{className:"text-primary/60 tracking-wide whitespace-nowrap",children:o(e)}),":",w.jsx(Bn,{className:"hover:bg-primary/20 rounded p-1 overflow-hidden text-ellipsis",tooltipClassName:"max-w-80",text:t,tooltip:r||(typeof t=="string"?t:JSON.stringify(t,null,2)),side:"left",onClick:n})]})},ooe=({node:e})=>{const{t}=Pt(),n=()=>{Pe.getState().triggerNodeExpand(e.id)},r=()=>{Pe.getState().triggerNodePrune(e.id)};return w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsxs("div",{className:"flex justify-between items-center",children:[w.jsx("label",{className:"text-md pl-1 font-bold tracking-wide text-blue-700",children:t("graphPanel.propertiesView.node.title")}),w.jsxs("div",{className:"flex gap-3",children:[w.jsx(Tt,{size:"icon",variant:"ghost",className:"h-7 w-7 border border-gray-400 hover:bg-gray-200",onClick:n,tooltip:t("graphPanel.propertiesView.node.expandNode"),children:w.jsx(MW,{className:"h-4 w-4 text-gray-700"})}),w.jsx(Tt,{size:"icon",variant:"ghost",className:"h-7 w-7 border border-gray-400 hover:bg-gray-200",onClick:r,tooltip:t("graphPanel.propertiesView.node.pruneNode"),children:w.jsx(rY,{className:"h-4 w-4 text-gray-900"})})]})]}),w.jsxs("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:[w.jsx(ea,{name:t("graphPanel.propertiesView.node.id"),value:e.id}),w.jsx(ea,{name:t("graphPanel.propertiesView.node.labels"),value:e.labels.join(", "),onClick:()=>{Pe.getState().setSelectedNode(e.id,!0)}}),w.jsx(ea,{name:t("graphPanel.propertiesView.node.degree"),value:e.degree})]}),w.jsx("label",{className:"text-md pl-1 font-bold tracking-wide text-amber-700",children:t("graphPanel.propertiesView.node.properties")}),w.jsx("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:Object.keys(e.properties).sort().map(a=>w.jsx(ea,{name:a,value:e.properties[a]},a))}),e.relationships.length>0&&w.jsxs(w.Fragment,{children:[w.jsx("label",{className:"text-md pl-1 font-bold tracking-wide text-emerald-700",children:t("graphPanel.propertiesView.node.relationships")}),w.jsx("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:e.relationships.map(({type:a,id:o,label:s})=>w.jsx(ea,{name:a,value:s,onClick:()=>{Pe.getState().setSelectedNode(o,!0)}},o))})]})]})},ioe=({edge:e})=>{const{t}=Pt();return w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx("label",{className:"text-md pl-1 font-bold tracking-wide text-violet-700",children:t("graphPanel.propertiesView.edge.title")}),w.jsxs("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:[w.jsx(ea,{name:t("graphPanel.propertiesView.edge.id"),value:e.id}),e.type&&w.jsx(ea,{name:t("graphPanel.propertiesView.edge.type"),value:e.type}),w.jsx(ea,{name:t("graphPanel.propertiesView.edge.source"),value:e.sourceNode?e.sourceNode.labels.join(", "):e.source,onClick:()=>{Pe.getState().setSelectedNode(e.source,!0)}}),w.jsx(ea,{name:t("graphPanel.propertiesView.edge.target"),value:e.targetNode?e.targetNode.labels.join(", "):e.target,onClick:()=>{Pe.getState().setSelectedNode(e.target,!0)}})]}),w.jsx("label",{className:"text-md pl-1 font-bold tracking-wide text-amber-700",children:t("graphPanel.propertiesView.edge.properties")}),w.jsx("div",{className:"bg-primary/5 max-h-96 overflow-auto rounded p-1",children:Object.keys(e.properties).sort().map(n=>w.jsx(ea,{name:n,value:e.properties[n]},n))})]})},soe=()=>{const{t:e}=Pt(),t=Ge.use.graphQueryMaxDepth(),n=Ge.use.graphMinDegree();return w.jsxs("div",{className:"absolute bottom-2 left-[calc(2rem+2.5rem)] flex items-center gap-2 text-xs text-gray-400",children:[w.jsxs("div",{children:[e("graphPanel.sideBar.settings.depth"),": ",t]}),w.jsxs("div",{children:[e("graphPanel.sideBar.settings.degree"),": ",n]})]})},LO={allowInvalidContainer:!0,defaultNodeType:"default",defaultEdgeType:"curvedArrow",renderEdgeLabels:!1,edgeProgramClasses:{arrow:I4,curvedArrow:Ene,curvedNoArrow:Sne},nodeProgramClasses:{default:rne,circel:Zu,point:Ote},labelGridCellSize:60,labelRenderedSizeThreshold:12,enableEdgeEvents:!0,labelColor:{color:"#000",attribute:"labelColor"},edgeLabelColor:{color:"#000",attribute:"labelColor"},edgeLabelSize:8,labelSize:12},loe=()=>{const e=G4(),t=Tr(),[n,r]=E.useState(null);return E.useEffect(()=>{e({downNode:a=>{r(a.node),t.getGraph().setNodeAttribute(a.node,"highlighted",!0)},mousemovebody:a=>{if(!n)return;const o=t.viewportToGraph(a);t.getGraph().setNodeAttribute(n,"x",o.x),t.getGraph().setNodeAttribute(n,"y",o.y),a.preventSigmaDefault(),a.original.preventDefault(),a.original.stopPropagation()},mouseup:()=>{n&&(r(null),t.getGraph().removeNodeAttribute(n,"highlighted"))},mousedown:a=>{a.original.buttons!==0&&!t.getCustomBBox()&&t.setCustomBBox(t.getBBox())}})},[e,t,n]),null},uoe=()=>{const[e,t]=E.useState(LO),n=E.useRef(null),r=E.useRef(!1),a=Pe.use.selectedNode(),o=Pe.use.focusedNode(),s=Pe.use.moveToSelectedNode(),u=Pe.use.isFetching(),c=Pe.use.shouldRender(),{isTabVisible:d}=yp(),p=d("knowledge-graph"),g=Ge.use.showPropertyPanel(),m=Ge.use.showNodeSearchBar(),b=Ge.use.enableNodeDrag();E.useEffect(()=>(p&&!c&&!u&&!r.current&&(Pe.getState().setShouldRender(!0),r.current=!0,console.log("Graph viewer initialized")),()=>{console.log("Graph viewer cleanup")}),[p,c,u]),E.useEffect(()=>{t(LO)},[]),E.useEffect(()=>()=>{Pe.getState().setSigmaInstance(null),console.log("Cleared sigma instance on unmount")},[]);const y=E.useCallback(x=>{x===null?Pe.getState().setFocusedNode(null):x.type==="nodes"&&Pe.getState().setFocusedNode(x.id)},[]),S=E.useCallback(x=>{x===null?Pe.getState().setSelectedNode(null):x.type==="nodes"&&Pe.getState().setSelectedNode(x.id,!0)},[]),k=E.useMemo(()=>o??a,[o,a]),R=E.useMemo(()=>a?{type:"nodes",id:a}:null,[a]);return w.jsxs("div",{className:"relative h-full w-full overflow-hidden",children:[w.jsxs(Tte,{settings:e,className:"!bg-background !size-full overflow-hidden",ref:n,children:[w.jsx(Hre,{}),b&&w.jsx(loe,{}),w.jsx(kne,{node:k,move:s}),w.jsxs("div",{className:"absolute top-2 left-2 flex items-start gap-2",children:[w.jsx(Dae,{}),m&&w.jsx(Cae,{value:R,onFocus:y,onChange:S})]}),w.jsxs("div",{className:"bg-background/60 absolute bottom-2 left-2 flex flex-col rounded-xl border-2 backdrop-blur-lg",children:[w.jsx(Gre,{}),w.jsx($re,{}),w.jsx(qre,{}),w.jsx(eae,{})]}),g&&w.jsx("div",{className:"absolute top-2 right-2",children:w.jsx(noe,{})}),w.jsx(soe,{})]}),u&&w.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/80 z-10",children:w.jsxs("div",{className:"text-center",children:[w.jsx("div",{className:"mb-2 h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),w.jsx("p",{children:"Loading Graph Data..."})]})})]})},z5=E.forwardRef(({className:e,...t},n)=>w.jsx("div",{className:"relative w-full overflow-auto",children:w.jsx("table",{ref:n,className:Me("w-full caption-bottom text-sm",e),...t})}));z5.displayName="Table";const B5=E.forwardRef(({className:e,...t},n)=>w.jsx("thead",{ref:n,className:Me("[&_tr]:border-b",e),...t}));B5.displayName="TableHeader";const U5=E.forwardRef(({className:e,...t},n)=>w.jsx("tbody",{ref:n,className:Me("[&_tr:last-child]:border-0",e),...t}));U5.displayName="TableBody";const coe=E.forwardRef(({className:e,...t},n)=>w.jsx("tfoot",{ref:n,className:Me("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t}));coe.displayName="TableFooter";const n0=E.forwardRef(({className:e,...t},n)=>w.jsx("tr",{ref:n,className:Me("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t}));n0.displayName="TableRow";const Fa=E.forwardRef(({className:e,...t},n)=>w.jsx("th",{ref:n,className:Me("text-muted-foreground h-10 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));Fa.displayName="TableHead";const Pa=E.forwardRef(({className:e,...t},n)=>w.jsx("td",{ref:n,className:Me("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));Pa.displayName="TableCell";const doe=E.forwardRef(({className:e,...t},n)=>w.jsx("caption",{ref:n,className:Me("text-muted-foreground mt-4 text-sm",e),...t}));doe.displayName="TableCaption";const Ms=E.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:Me("bg-card text-card-foreground rounded-xl border shadow",e),...t}));Ms.displayName="Card";const Nu=E.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:Me("flex flex-col space-y-1.5 p-6",e),...t}));Nu.displayName="CardHeader";const Ou=E.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:Me("leading-none font-semibold tracking-tight",e),...t}));Ou.displayName="CardTitle";const Tp=E.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:Me("text-muted-foreground text-sm",e),...t}));Tp.displayName="CardDescription";const Du=E.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:Me("p-6 pt-0",e),...t}));Du.displayName="CardContent";const foe=E.forwardRef(({className:e,...t},n)=>w.jsx("div",{ref:n,className:Me("flex items-center p-6 pt-0",e),...t}));foe.displayName="CardFooter";function poe({title:e,description:t,icon:n=OW,action:r,className:a,...o}){return w.jsxs(Ms,{className:Me("flex w-full flex-col items-center justify-center space-y-6 bg-transparent p-16",a),...o,children:[w.jsx("div",{className:"mr-4 shrink-0 rounded-full border border-dashed p-4",children:w.jsx(n,{className:"text-muted-foreground size-8","aria-hidden":"true"})}),w.jsxs("div",{className:"flex flex-col items-center gap-1.5 text-center",children:[w.jsx(Ou,{children:e}),t?w.jsx(Tp,{children:t}):null]}),r||null]})}var ab={exports:{}},ob,MO;function goe(){if(MO)return ob;MO=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ob=e,ob}var ib,FO;function hoe(){if(FO)return ib;FO=1;var e=goe();function t(){}function n(){}return n.resetWarningCache=t,ib=function(){function r(s,u,c,d,p,g){if(g!==e){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}r.isRequired=r;function a(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},ib}var PO;function moe(){return PO||(PO=1,ab.exports=hoe()()),ab.exports}var boe=moe();const Ot=un(boe),yoe=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function Fs(e,t,n){const r=voe(e),{webkitRelativePath:a}=e,o=typeof t=="string"?t:typeof a=="string"&&a.length>0?a:`./${e.name}`;return typeof r.path!="string"&&zO(r,"path",o),zO(r,"relativePath",o),r}function voe(e){const{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){const r=t.split(".").pop().toLowerCase(),a=yoe.get(r);a&&Object.defineProperty(e,"type",{value:a,writable:!1,configurable:!1,enumerable:!0})}return e}function zO(e,t,n){Object.defineProperty(e,t,{value:n,writable:!1,configurable:!1,enumerable:!0})}const Soe=[".DS_Store","Thumbs.db"];function Eoe(e){return xi(this,void 0,void 0,function*(){return Cf(e)&&woe(e.dataTransfer)?Aoe(e.dataTransfer,e.type):xoe(e)?koe(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?Toe(e):[]})}function woe(e){return Cf(e)}function xoe(e){return Cf(e)&&Cf(e.target)}function Cf(e){return typeof e=="object"&&e!==null}function koe(e){return r0(e.target.files).map(t=>Fs(t))}function Toe(e){return xi(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>n.getFile()))).map(n=>Fs(n))})}function Aoe(e,t){return xi(this,void 0,void 0,function*(){if(e.items){const n=r0(e.items).filter(a=>a.kind==="file");if(t!=="drop")return n;const r=yield Promise.all(n.map(Roe));return BO(j5(r))}return BO(r0(e.files).map(n=>Fs(n)))})}function BO(e){return e.filter(t=>Soe.indexOf(t.name)===-1)}function r0(e){if(e===null)return[];const t=[];for(let n=0;n[...t,...Array.isArray(n)?j5(n):[n]],[])}function UO(e,t){return xi(this,void 0,void 0,function*(){var n;if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle=="function"){const o=yield e.getAsFileSystemHandle();if(o===null)throw new Error(`${e} is not a File`);if(o!==void 0){const s=yield o.getFile();return s.handle=o,Fs(s)}}const r=e.getAsFile();if(!r)throw new Error(`${e} is not a File`);return Fs(r,(n=t==null?void 0:t.fullPath)!==null&&n!==void 0?n:void 0)})}function _oe(e){return xi(this,void 0,void 0,function*(){return e.isDirectory?G5(e):Coe(e)})}function G5(e){const t=e.createReader();return new Promise((n,r)=>{const a=[];function o(){t.readEntries(s=>xi(this,void 0,void 0,function*(){if(s.length){const u=Promise.all(s.map(_oe));a.push(u),o()}else try{const u=yield Promise.all(a);n(u)}catch(u){r(u)}}),s=>{r(s)})}o()})}function Coe(e){return xi(this,void 0,void 0,function*(){return new Promise((t,n)=>{e.file(r=>{const a=Fs(r,e.fullPath);t(a)},r=>{n(r)})})})}var Md={},jO;function Noe(){return jO||(jO=1,Md.__esModule=!0,Md.default=function(e,t){if(e&&t){var n=Array.isArray(t)?t:t.split(",");if(n.length===0)return!0;var r=e.name||"",a=(e.type||"").toLowerCase(),o=a.replace(/\/.*$/,"");return n.some(function(s){var u=s.trim().toLowerCase();return u.charAt(0)==="."?r.toLowerCase().endsWith(u):u.endsWith("/*")?o===u.replace(/\/.*$/,""):a===u})}return!0}),Md}var Ooe=Noe();const sb=un(Ooe);function GO(e){return Loe(e)||Ioe(e)||$5(e)||Doe()}function Doe(){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 Ioe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Loe(e){if(Array.isArray(e))return a0(e)}function HO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function $O(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:"",n=t.split(","),r=n.length>1?"one of ".concat(n.join(", ")):n[0];return{code:Boe,message:"File type must be ".concat(r)}},qO=function(t){return{code:Uoe,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},VO=function(t){return{code:joe,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},$oe={code:Goe,message:"Too many files"};function q5(e,t){var n=e.type==="application/x-moz-file"||zoe(e,t);return[n,n?null:Hoe(t)]}function V5(e,t,n){if(ci(e.size))if(ci(t)&&ci(n)){if(e.size>n)return[!1,qO(n)];if(e.sizen)return[!1,qO(n)]}return[!0,null]}function ci(e){return e!=null}function qoe(e){var t=e.files,n=e.accept,r=e.minSize,a=e.maxSize,o=e.multiple,s=e.maxFiles,u=e.validator;return!o&&t.length>1||o&&s>=1&&t.length>s?!1:t.every(function(c){var d=q5(c,n),p=Iu(d,1),g=p[0],m=V5(c,r,a),b=Iu(m,1),y=b[0],S=u?u(c):null;return g&&y&&!S})}function Nf(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Fd(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function WO(e){e.preventDefault()}function Voe(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function Woe(e){return e.indexOf("Edge/")!==-1}function Yoe(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return Voe(e)||Woe(e)}function Zr(){for(var e=arguments.length,t=new Array(e),n=0;n1?a-1:0),s=1;s